From 21346cd2fdf892dbc953e33b589caa4c3b5c5ff7 Mon Sep 17 00:00:00 2001 From: Matthieu Baumann Date: Sat, 6 Jul 2024 14:26:49 +0200 Subject: [PATCH] fix lonpole support for zenital projections --- examples/cutout-CDS_P_HST_PHAT_F475W.fits.csv | 200 +++++++++--------- .../cutout-CDS_P_PanSTARRS_DR1_g.fits.csv | 200 +++++++++--------- src/coo_system.rs | 25 +-- src/lib.rs | 9 +- src/projection.rs | 13 +- 5 files changed, 226 insertions(+), 221 deletions(-) diff --git a/examples/cutout-CDS_P_HST_PHAT_F475W.fits.csv b/examples/cutout-CDS_P_HST_PHAT_F475W.fits.csv index aa9f4aa..ad846d1 100644 --- a/examples/cutout-CDS_P_HST_PHAT_F475W.fits.csv +++ b/examples/cutout-CDS_P_HST_PHAT_F475W.fits.csv @@ -1,100 +1,100 @@ -1.940389079541792183e-01,7.255100094660600352e-01,6.405623127897234781e+02,5.501830927931571296e+02 -1.927752551917726875e-01,7.264350686576003246e-01,1.543331365304168912e+03,1.433207856067085004e+03 -1.923918951316466730e-01,7.266115742449286152e-01,1.816944695576176628e+03,1.601804269884018822e+03 -1.910407263390051236e-01,7.259731308043159137e-01,2.782059021482837124e+03,9.928542642128234093e+02 -1.944168030388825907e-01,7.275242985174876775e-01,3.725964617613178689e+02,2.473935892150744621e+03 -1.910823371562360429e-01,7.277708412035136520e-01,2.750341441494364062e+03,2.709505801830822293e+03 -1.911841610480436715e-01,7.279346592531005244e-01,2.677568442127984781e+03,2.865858397448227151e+03 -1.933224772861342755e-01,7.277820846882083750e-01,1.153109060764727474e+03,2.719567917927559847e+03 -1.938141100875041822e-01,7.256109330521024470e-01,8.012297218080833545e+02,6.464419658138963314e+02 -1.947659340552226892e-01,7.279842803909086779e-01,1.241714896404417772e+02,2.913477087464050328e+03 -1.948368717770868619e-01,7.266569831133721236e-01,7.191847997181521635e+01,1.646067351659355154e+03 -1.935793760165758770e-01,7.260655239588563736e-01,9.691323493915696190e+02,1.080448532194390509e+03 -1.942829502083661952e-01,7.256352391301817972e-01,4.663232472046592534e+02,6.699217534658048407e+02 -1.908059313925825895e-01,7.270380297543623804e-01,2.948365186338257445e+03,2.009970422404714782e+03 -1.929873347124791694e-01,7.250217832760429415e-01,1.391803051622451676e+03,8.362421936604447126e+01 -1.931219974905429571e-01,7.251511611109379141e-01,1.295576094812674910e+03,2.071849690303065756e+02 -1.907921816729578057e-01,7.251728963180817944e-01,2.960594876186095007e+03,2.289127038676529367e+02 -1.930104173446189619e-01,7.269413231388941465e-01,1.375515443771942955e+03,1.916651091078204445e+03 -1.914451734812677164e-01,7.277411011011972741e-01,2.491662679862680307e+03,2.680835266703234993e+03 -1.931626751328443248e-01,7.280529450067411146e-01,1.267103861326708284e+03,2.978190063476434261e+03 -1.907941212095832784e-01,7.262123293118355472e-01,2.957861595877743639e+03,1.221496389900303257e+03 -1.912050012701404789e-01,7.269959124402285422e-01,2.663683387883884734e+03,1.969404689190169393e+03 -1.910641018192480722e-01,7.250199830579360238e-01,2.766437584779886947e+03,8.264501740985474498e+01 -1.935666838257237010e-01,7.260160126989141371e-01,9.781727949619904621e+02,1.033164362011277944e+03 -1.919839338277648522e-01,7.279994574805952467e-01,2.107372638336189084e+03,2.927260794333124522e+03 -1.943171976612007856e-01,7.279484796246334932e-01,4.440295953307115155e+02,2.878927091492467753e+03 -1.935203278368038959e-01,7.278435281852152494e-01,1.012068263930030753e+03,2.778296996441086321e+03 -1.928214646778194929e-01,7.255587685946517373e-01,1.510353362187881203e+03,5.964025012861527557e+02 -1.947775462197392227e-01,7.262203324839041629e-01,1.137225957282959001e+02,1.229041544222207904e+03 -1.936154939598183633e-01,7.279698318221158315e-01,9.442808782034497881e+02,2.898941203451356159e+03 -1.923712598079796721e-01,7.264302545072950368e-01,1.831726607312225497e+03,1.428661274034384633e+03 -1.927803746070820556e-01,7.250691086735704394e-01,1.539726221603476461e+03,1.288121427459062431e+02 -1.923999799094235630e-01,7.265953900125532439e-01,1.811178737737344818e+03,1.586347786572257291e+03 -1.948434291341924196e-01,7.260144368394971792e-01,6.642076146961517225e+01,1.032487405965381640e+03 -1.943439723590382473e-01,7.268003266468000545e-01,4.238447860698383352e+02,1.782540529427325737e+03 -1.937908337654673518e-01,7.269106508091093266e-01,8.186438799546316432e+02,1.887569644131375071e+03 -1.914468266499314564e-01,7.264655962853789894e-01,2.491608978698105602e+03,1.462817058886895438e+03 -1.909336701757578247e-01,7.275133805572085999e-01,2.856653043186498508e+03,2.463777817478179259e+03 -1.940437406452524549e-01,7.279158264653431409e-01,6.389506564303127334e+02,2.847571371627193457e+03 -1.937554541371383499e-01,7.264359989501278925e-01,8.436126888441253868e+02,1.434295135585793787e+03 -1.936651929288192020e-01,7.250546313384895747e-01,9.073206202294809373e+02,1.151489358013327831e+02 -1.941781522410406247e-01,7.249398254099573835e-01,5.405954895921335037e+02,5.780818539229959363e+00 -1.945860950839571613e-01,7.259685980514168913e-01,2.501377928720749253e+02,9.884855561422351684e+02 -1.927140620294792439e-01,7.249894894258320788e-01,1.587127419253214384e+03,5.278409197925848417e+01 -1.925654691369307059e-01,7.274401985376760527e-01,1.692914679119473021e+03,2.393052276183820140e+03 -1.908594267329156713e-01,7.279034972063376241e-01,2.909111864657636943e+03,2.836380438154953936e+03 -1.945177691804315934e-01,7.254038829638442820e-01,2.983308501161731101e+02,4.491668085415960832e+02 -1.922751934900445991e-01,7.260873512666119467e-01,1.900426530128247578e+03,1.101236458258896164e+03 -1.941754930577854477e-01,7.251062872467071152e-01,5.426375767433318060e+02,1.647387103827771000e+02 -1.931865090033655363e-01,7.252310432824239372e-01,1.249489430477484348e+03,2.834765833855889241e+02 -1.944305623475892919e-01,7.261627181337128034e-01,3.614077983365493196e+02,1.173733278213936046e+03 -1.918160953360071863e-01,7.275526724633498699e-01,2.227307770837478529e+03,2.500686779371289049e+03 -1.926270137082042866e-01,7.254406010902106905e-01,1.649286861923208107e+03,4.835712522862478409e+02 -1.912309405836845611e-01,7.259174914644881405e-01,2.646274606130233678e+03,9.395691841056365092e+02 -1.944755683334632446e-01,7.274582073937470028e-01,3.306184948161558168e+02,2.410868337532142505e+03 -1.922319547276803153e-01,7.274320722348857071e-01,1.930785844588989903e+03,2.385361609765162484e+03 -1.926338352598736259e-01,7.279999975166104864e-01,1.644082552207022445e+03,2.927613583013625885e+03 -1.927438846772621672e-01,7.254591631229028170e-01,1.565783202281030981e+03,5.012882771185575166e+02 -1.926731962165647016e-01,7.256741854485567744e-01,1.616265827168476108e+03,7.066238022700067631e+02 -1.920741044973768852e-01,7.271015325672646190e-01,2.043528118061557961e+03,2.069770770257004187e+03 -1.909719618147105447e-01,7.273989419930166900e-01,2.829479964539553748e+03,2.354462782656163654e+03 -1.930344148835411167e-01,7.275648569663984988e-01,1.358470346076584065e+03,2.512084007069762720e+03 -1.922122555703408842e-01,7.280087043770743227e-01,1.944607071195509889e+03,2.936010882075049267e+03 -1.928879367224743679e-01,7.266150080012161450e-01,1.462898951978929063e+03,1.605036823488416985e+03 -1.935312090736275303e-01,7.260386711387105674e-01,1.003516003202223828e+03,1.054789597960686933e+03 -1.918645311359629402e-01,7.280009468672051787e-01,2.192489372512447517e+03,2.928734771060634102e+03 -1.939407401524299579e-01,7.258699682427317557e-01,7.109493829404199232e+02,8.938647469023783287e+02 -1.917174865738486278e-01,7.273250084080769007e-01,2.297791896635192643e+03,2.283333660469929328e+03 -1.915001837743259272e-01,7.258311694271061265e-01,2.454058899099942664e+03,8.569498686427144776e+02 -1.934395749416215893e-01,7.275561267855589209e-01,1.069532133668710003e+03,2.503824089185754019e+03 -1.916248364752055067e-01,7.265246572126093927e-01,2.364493862023128258e+03,1.519106194900368564e+03 -1.910265783841317011e-01,7.259113757832497127e-01,2.792233688414492462e+03,9.338946798440699695e+02 -1.929599891792909694e-01,7.258583623899460546e-01,1.411413367024500985e+03,8.824969547180407972e+02 -1.922624844953271239e-01,7.272075822244110643e-01,1.909093207331608255e+03,2.170980924682465684e+03 -1.938518404043995946e-01,7.260571092704564133e-01,7.745631611428061660e+02,1.072526551348032399e+03 -1.923221566926241466e-01,7.280523550081843265e-01,1.866249119611378319e+03,2.977664506618735686e+03 -1.948245121681435321e-01,7.265275163309963258e-01,8.057651851375669594e+01,1.522424071103865117e+03 -1.912559821772748248e-01,7.268059011421060811e-01,2.627499157561814627e+03,1.787918511533344372e+03 -1.910731223682721192e-01,7.253332168921372558e-01,2.759639585496513973e+03,3.817540719967163909e+02 -1.941854769149009008e-01,7.272881630499185013e-01,5.373679537197813261e+02,2.248282514323169835e+03 -1.927948270125504626e-01,7.271570081805900365e-01,1.529340462305756773e+03,2.122608354581016556e+03 -1.916044323603013910e-01,7.280528288690186756e-01,2.377863134098550290e+03,2.978414574529099809e+03 -1.934769342109328716e-01,7.258195032277030556e-01,1.042185080021912881e+03,8.454826007532960830e+02 -1.925251833916634125e-01,7.251587360618502176e-01,1.722098915361850004e+03,2.144224159154218796e+02 -1.948983714772357656e-01,7.280688424837281625e-01,2.987104852665667210e+01,2.994353387660512908e+03 -1.924722299462103825e-01,7.258741998465155776e-01,1.759777121789357807e+03,8.976486425387356576e+02 -1.922495630405997857e-01,7.251674063883158938e-01,1.919071591752741597e+03,2.227607642381192932e+02 -1.940658081603172380e-01,7.250742568067886085e-01,6.210041391742395263e+02,1.340851355280016151e+02 -1.933118454103116834e-01,7.264317260282049382e-01,1.160283157427212927e+03,1.430068343178532587e+03 -1.910476414923164556e-01,7.273466207321543919e-01,2.775561315341865793e+03,2.304434059052040539e+03 -1.927951442496913803e-01,7.271710587528239511e-01,1.529113770287951638e+03,2.136025651163800831e+03 -1.920146577487293615e-01,7.256620644294958788e-01,2.086690503102736784e+03,6.952031257127789559e+02 -1.949328254310557229e-01,7.272720083387405055e-01,4.252462424713665534e+00,2.233466149374191900e+03 -1.923648615262413819e-01,7.260451355560451070e-01,1.836409493098337634e+03,1.060901456149766545e+03 -1.909384693522275245e-01,7.260824846302639246e-01,2.854953933301538655e+03,1.097369014841413900e+03 -1.938351752092947189e-01,7.274040765339029324e-01,7.873162274655937836e+02,2.358776868374228343e+03 -1.925645724989977214e-01,7.254397530652247905e-01,1.693900319076979713e+03,4.827685979558588087e+02 -1.911934378895481512e-01,7.280132023216754344e-01,2.670873045089607331e+03,2.940854361375143526e+03 -1.938227283328377848e-01,7.273333397940929812e-01,7.961496215838708395e+02,2.291222405369187072e+03 -1.931226671086387070e-01,7.263378606163156670e-01,1.295312307077286732e+03,1.340399472974880609e+03 +1.913175019448918601e-01,7.278234978052652293e-01,2.582616404565983430e+03,2.759606565304319247e+03 +1.945863987915519289e-01,7.264146743774870796e-01,2.504158020763231889e+02,1.414457096740909265e+03 +1.911696210529043871e-01,7.274400741507435209e-01,2.688457271122294969e+03,2.393575507010411457e+03 +1.925569017021622753e-01,7.271218975408156870e-01,1.699081741701707415e+03,2.089098398560354326e+03 +1.944251250920148721e-01,7.253166229510902285e-01,3.644379979502544415e+02,3.657678181467687182e+02 +1.934777001721915690e-01,7.256592257450400485e-01,1.041572894043694077e+03,6.924291437117918804e+02 +1.925811267522010151e-01,7.257999224394191540e-01,1.682014004584051690e+03,8.267029308345785239e+02 +1.938027764657422880e-01,7.265421123645531276e-01,8.098964449948215361e+02,1.535647035525249066e+03 +1.945636560828870043e-01,7.279228461619332569e-01,2.683025859451907422e+02,2.854636301673877824e+03 +1.935979994351482159e-01,7.256162126794479805e-01,9.556167860797545472e+02,6.513946417811016545e+02 +1.933201550169602323e-01,7.249542514974279817e-01,1.153898815478542247e+03,1.918593620911401842e+01 +1.918383402763175205e-01,7.280091242303387000e-01,2.211154637770019235e+03,2.936555837298320057e+03 +1.936385070277918674e-01,7.250304222483864303e-01,9.263815321635138389e+02,9.202062394961029668e+01 +1.917560284443487750e-01,7.267888388935199728e-01,2.270668129726084771e+03,1.771309589085176412e+03 +1.930686718352556674e-01,7.270782647938897059e-01,1.333969029441322391e+03,2.047426250799772561e+03 +1.937440345740143455e-01,7.255728640315518563e-01,8.512681767350716200e+02,6.100574433962201510e+02 +1.926103653817086703e-01,7.279646204851996094e-01,1.660818420071229184e+03,2.893833356634761003e+03 +1.938128985147036243e-01,7.252807151396822860e-01,8.018909003061542080e+02,3.311064124319509574e+02 +1.935153110036783031e-01,7.265928521180807786e-01,1.015107227440932888e+03,1.583987892833240949e+03 +1.948289229362636377e-01,7.259002976452766376e-01,7.663576506646730024e+01,9.234787889353548280e+02 +1.909964141041695651e-01,7.256736021370885359e-01,2.814054292133977924e+03,7.068637092270296307e+02 +1.921008318966913597e-01,7.275988246009578164e-01,2.024227614868668752e+03,2.544640151835214510e+03 +1.938842271546638019e-01,7.256279535587848439e-01,7.511509876038169295e+02,6.627289848683244600e+02 +1.921422006326779786e-01,7.261726755693153068e-01,1.995355765212315646e+03,1.182754751222674940e+03 +1.917886320698730940e-01,7.276426881504823863e-01,2.246833196043841326e+03,2.586658947320600873e+03 +1.930579830190085611e-01,7.264125344874446943e-01,1.341501757545672490e+03,1.411699951679416245e+03 +1.935640045253931851e-01,7.250682879206783449e-01,9.796493036139708011e+02,1.281527494754938346e+02 +1.921310187571431682e-01,7.274105421115120151e-01,2.002785236279483115e+03,2.364833251826796186e+03 +1.941751261082783619e-01,7.275368138048503575e-01,5.449623233870457852e+02,2.485719929267695989e+03 +1.913585191033500554e-01,7.264462705358912809e-01,2.554664156265382644e+03,1.444422412238297284e+03 +1.929968773654381631e-01,7.268444252259438354e-01,1.385166862251493512e+03,1.824119394340924828e+03 +1.943991312620049206e-01,7.273511793964532179e-01,3.850278312304771475e+02,2.308606113311365789e+03 +1.925813304061005926e-01,7.266475311895013167e-01,1.681730889179209498e+03,1.636109089847120686e+03 +1.926830381607112508e-01,7.262538417322711437e-01,1.609178622433672217e+03,1.260153758789126641e+03 +1.909892183969935098e-01,7.267666629646636345e-01,2.817913047502082009e+03,1.750665743726267465e+03 +1.930349240096730645e-01,7.279331913034228219e-01,1.358153429283860078e+03,2.863817698133099839e+03 +1.942751284929747357e-01,7.261095353609386960e-01,4.723433472543858898e+02,1.122835817417700355e+03 +1.932106671893496219e-01,7.253039033918023959e-01,1.232242809302115802e+03,3.530570490784114099e+02 +1.913777886554068608e-01,7.273209819782863184e-01,2.540098792506376412e+03,2.279696478534186554e+03 +1.935723576377289534e-01,7.255081979073193521e-01,9.738842542720095707e+02,5.482390320021386287e+02 +1.947811474962102274e-01,7.278330949005766826e-01,1.131398365077187549e+02,2.769119352354156490e+03 +1.916099134581788210e-01,7.265557533455820893e-01,2.375121666792973883e+03,1.548809425229911085e+03 +1.943949170102358126e-01,7.266693668132376827e-01,3.873601186264973535e+02,1.657520189808761415e+03 +1.947415130996591748e-01,7.271739450513164948e-01,1.406017510660936409e+02,2.139641176537815227e+03 +1.911842958316566643e-01,7.263788595210114440e-01,2.679103725061062505e+03,1.380179036739755247e+03 +1.933269089918898398e-01,7.279418002926202336e-01,1.149998852432339618e+03,2.872086268135697537e+03 +1.919741348845815654e-01,7.250455139913586367e-01,2.115975396406637174e+03,1.064566805633294706e+02 +1.909377444241859290e-01,7.255861474494370578e-01,2.856069658943907143e+03,6.234026394775974040e+02 +1.943897197683029376e-01,7.275213648403154876e-01,3.919083835807124387e+02,2.471114322083964908e+03 +1.925795075518072774e-01,7.255103785480134793e-01,1.683217887603307645e+03,5.502091039658871523e+02 +1.941353388996057139e-01,7.277366939664229317e-01,5.735013704538075672e+02,2.676566662748045019e+03 +1.911075011640034071e-01,7.266075584720673719e-01,2.733675765881414918e+03,1.598631896472835479e+03 +1.921623008902354490e-01,7.267876448213012042e-01,1.980740432366323375e+03,1.770000151614236302e+03 +1.910102066207624294e-01,7.278683969224536421e-01,2.801658000086891661e+03,2.802726029454606760e+03 +1.942655313650021587e-01,7.260909508183430727e-01,4.791794479207816835e+02,1.105082375878718494e+03 +1.925194220758442432e-01,7.254250133507200715e-01,1.726162618577731791e+03,4.686995243015776964e+02 +1.932025546984001418e-01,7.268106894667467621e-01,1.238388818015333072e+03,1.791929728374945626e+03 +1.924236922232434033e-01,7.264065745993317780e-01,1.794303557237675932e+03,1.406037710065975489e+03 +1.944005896917445075e-01,7.256307997015514211e-01,3.822816544016730518e+02,6.657663092013604000e+02 +1.926576696439321335e-01,7.256108229628092099e-01,1.627364252547341039e+03,6.461183555722326446e+02 +1.916750170426626265e-01,7.276443897816672335e-01,2.327849510465417097e+03,2.588343458709685819e+03 +1.916324382589399411e-01,7.268709984631281928e-01,2.358803015214758943e+03,1.849833142117483249e+03 +1.912929042623826292e-01,7.270938272531742852e-01,2.600868758971460011e+03,2.062840199645097528e+03 +1.913941878615312286e-01,7.279978451543283047e-01,2.527781733081332277e+03,2.926042346728489065e+03 +1.919851209834185224e-01,7.266587266013700974e-01,2.107251148408467543e+03,1.646956568695319447e+03 +1.942163389104319682e-01,7.258705248877140859e-01,5.141136398082464893e+02,8.945584730789868217e+02 +1.925844655203014510e-01,7.250288086696776713e-01,1.679752963470032910e+03,9.034281118657283116e+01 +1.935430083538759727e-01,7.255810098181801893e-01,9.948852149880912066e+02,6.177592722752472127e+02 +1.915390958821538148e-01,7.272575798187937979e-01,2.425091733565863706e+03,2.219046396108304180e+03 +1.929887514946799776e-01,7.257128456514690962e-01,1.390856770438268086e+03,7.435406157600489223e+02 +1.909413714876485313e-01,7.268667699109594427e-01,2.851938347010742291e+03,1.846303260692220647e+03 +1.938740537521266849e-01,7.277954372236288272e-01,7.598438619137399428e+02,2.732517724335646562e+03 +1.926326119460839426e-01,7.279910580378208262e-01,1.644955766596045123e+03,2.919077116041530644e+03 +1.947170132552971111e-01,7.254489824627295969e-01,1.560229192509981999e+02,4.924018022781817763e+02 +1.939183525810591890e-01,7.267829953588189618e-01,7.275649387558501076e+02,1.765729257936213116e+03 +1.919159524583775589e-01,7.273646231766893733e-01,2.156205019082235594e+03,2.321066910974750499e+03 +1.940925124314796524e-01,7.249685416328709442e-01,6.018339538063868304e+02,3.315015054253611737e+01 +1.913193458146222048e-01,7.267777215118051970e-01,2.582308760018534485e+03,1.760962400334426093e+03 +1.938750930444665121e-01,7.274240258118452873e-01,7.588583701243819633e+02,2.377846294715208387e+03 +1.942999972998110669e-01,7.252999314062243963e-01,4.538343575882647087e+02,3.497380901354028993e+02 +1.942160998169100705e-01,7.268390585846883356e-01,5.151314511825725049e+02,1.819439304962074175e+03 +1.941641048247496060e-01,7.279988304896473084e-01,5.532110426675407098e+02,2.926906795354582300e+03 +1.945740730712981204e-01,7.280217870805398839e-01,2.609851953902181663e+02,2.949126617173465547e+03 +1.923078371899347161e-01,7.259296049297173647e-01,1.877169469461433437e+03,9.505914389255395918e+02 +1.945556459235316393e-01,7.253529365006246010e-01,2.712120462041902442e+02,4.005470011868377469e+02 +1.938688203086147699e-01,7.266188252742248332e-01,7.628054290950115046e+02,1.608933679542606569e+03 +1.934346773401528774e-01,7.249441306795971762e-01,1.072035156136188789e+03,9.550566671072679981e+00 +1.933207702918582349e-01,7.264607029290862661e-01,1.153920959101452581e+03,1.457741249744048218e+03 +1.914760334500925643e-01,7.259934331346727943e-01,2.471167854298739712e+03,1.011915687417025538e+03 +1.930823403424026807e-01,7.277173392110306560e-01,1.324316595617161511e+03,2.657698917955587149e+03 +1.941405357638043561e-01,7.274738178478242778e-01,5.695785528028509361e+02,2.425541542042900801e+03 +1.917972878023535555e-01,7.276962120874945761e-01,2.240625581216050250e+03,2.637766285303936456e+03 +1.943256192587088926e-01,7.273348318429778692e-01,4.374465751542920771e+02,2.292942182518506343e+03 +1.946683367920643837e-01,7.255999475706317314e-01,1.909766413672735439e+02,6.365200993575734856e+02 +1.935217073783595254e-01,7.251284202638014209e-01,1.009906079869391647e+03,1.855608309300174028e+02 +1.914844725415864313e-01,7.249836908900227916e-01,2.466007730737539532e+03,4.767705315077530770e+01 +1.920653894296257547e-01,7.273606588931784689e-01,2.049618835025859880e+03,2.317221293935083850e+03 +1.945072401837144305e-01,7.257514390227242096e-01,3.062220601193594689e+02,7.810501063180306573e+02 +1.946367582910096539e-01,7.252374765368840848e-01,2.131221159969912549e+02,2.903583923331594292e+02 +1.941407577244098071e-01,7.256070053730275804e-01,5.678768155732386731e+02,6.428678483136508248e+02 diff --git a/examples/cutout-CDS_P_PanSTARRS_DR1_g.fits.csv b/examples/cutout-CDS_P_PanSTARRS_DR1_g.fits.csv index f014272..d9a02d0 100644 --- a/examples/cutout-CDS_P_PanSTARRS_DR1_g.fits.csv +++ b/examples/cutout-CDS_P_PanSTARRS_DR1_g.fits.csv @@ -1,100 +1,100 @@ -nan,nan,6.395898613325920223e+02,9.494665998209262625e+02 -5.672750927991242698e+00,7.210074313274436042e-01,3.055693950387627638e+02,7.659668803734523408e+02 -nan,nan,4.348277647846687444e+01,1.179282422010551500e+03 -8.797732027821610901e-01,-3.722231277375748215e-01,1.610264291517148649e+02,4.552835110025856693e+02 -3.210257668761300476e+00,3.996707944776960453e-01,9.163631891638834759e+02,6.773357055659795378e+02 -nan,nan,2.300957074041245392e+02,1.257714589933383422e+02 -nan,nan,2.089758378457044046e+02,1.023454045886478298e+03 -nan,nan,6.792506154302357118e+02,1.034297325173563422e+03 -4.634530584902866401e+00,1.114695597649526526e+00,1.173521805169720437e+03,8.893271607769034972e+02 -nan,nan,6.114795437325900593e+02,1.080162029351425872e+03 -nan,nan,2.071687162546568004e+02,7.245399316662010847e+01 -2.855885134479989151e+00,8.484814408235167305e-01,1.023446982119449558e+03,7.183967783660062878e+02 -nan,nan,4.572906381439743768e+02,1.821699348723676337e+02 -3.099010192828000054e+00,1.067268700270729287e+00,1.034970527492943347e+03,7.670553633930485375e+02 -5.146181530598434861e+00,1.242739407582089006e+00,1.189728327226552693e+02,8.485479648451961339e+02 -nan,nan,2.169148410627231272e+02,1.030057064947325216e+03 -4.753802627119260826e+00,6.121554129799988697e-01,5.620221028703826960e+02,8.116682143412253936e+02 -nan,nan,1.162413638371961042e+02,1.886134088793098442e+02 -nan,nan,1.027512539517662162e+03,1.419141932883557615e+02 -3.505286627147248257e+00,-6.338481300273157704e-01,7.714700587144836845e+02,5.293995658803152082e+02 -6.261557987993970009e+00,1.105755812514885861e-02,2.911370382441565425e+02,5.970564885124769035e+02 -nan,nan,7.249369575122032074e+02,1.011108692455867754e+03 -1.909485071993401339e+00,-8.230098494402131593e-01,1.018521328950714178e+03,3.627647650782393498e+02 -nan,nan,3.866530235167019214e+02,9.530635814227211995e+02 -nan,nan,2.301710882658881019e+02,1.920876653658087889e+02 -nan,nan,4.749349546863199976e+02,9.650060800595055071e+02 -3.532788489517437736e+00,-3.102807650593759070e-01,7.958553073440805292e+02,5.866499405904830837e+02 -nan,nan,9.135652471094527982e+02,1.212547698754414540e+02 -nan,nan,3.035205347325754133e+02,5.783882593497522606e+01 -nan,nan,5.120800841576490257e+02,2.299890177603405732e+02 -4.372406332948083119e+00,1.003454971284857944e+00,8.446122598510083890e+02,8.695961497145978001e+02 -nan,nan,1.150819385480917390e+03,2.324539005079313370e+01 -5.977507002468245290e+00,7.221308652559429997e-02,3.331547205822749333e+02,6.334731351182883827e+02 -nan,nan,8.897067101298164289e+02,1.051101914318249328e+03 -4.400234553369223534e+00,3.097872127938919862e-01,6.644557855798207129e+02,7.509061029205375917e+02 -6.105514637272575484e-01,-3.230509143467057420e-01,2.120280755620993887e+02,4.844861976472160450e+02 -nan,nan,3.195238266840084407e+02,9.595436235689965088e+02 -nan,nan,2.632851160495944214e+02,1.107372378250176325e+03 -2.963100309437979529e+00,1.320209332679569858e+00,1.110793615743661121e+03,7.871463354930135665e+02 -nan,nan,5.752731737500932923e+02,7.941484155979918569e+01 -nan,nan,8.256934163070981185e+02,6.510722812349736444e+01 -1.467948570610830838e+00,-7.378201861678448381e-01,1.670850537069323849e+01,3.615726244165160779e+02 -1.013832039986369837e+00,-6.801340116897177657e-01,1.706220729815680102e+02,3.927684913724521607e+02 -3.809209418441482420e+00,1.303933693704762087e+00,1.092191837558515545e+03,8.265479946152111097e+02 -nan,nan,4.266844422931293934e+02,5.711165950091658772e+01 -5.109221192230460673e+00,5.667205493359698254e-01,4.556307391568638536e+02,7.881394056588334252e+02 -2.134908128626035850e+00,-1.432293897824684081e-01,1.057101238961279478e+03,4.959925136733556883e+02 -nan,nan,5.948665296218574667e+02,9.378053435754659404e+02 -1.590834011153452465e+00,-8.730044962758274352e-01,1.146624286322485659e+03,3.366323645173657724e+02 -nan,nan,8.788949899444547782e+02,1.154619558491456246e+03 -nan,nan,1.411257999816907045e+02,1.085097891415018239e+03 -1.615633181762287540e+00,-2.356679024523601063e-01,1.171995029752396704e+03,4.580064549498505357e+02 -nan,nan,6.818129207948171597e+02,1.083411302274185118e+03 -6.147018770348896766e+00,-8.082320827791220630e-01,3.984372672985716122e+02,4.742453805740915982e+02 -1.547201540601726766e+00,-2.451829961713095918e-01,1.189120325397459055e+03,4.555798101854494462e+02 -nan,nan,9.800583044204807948e+02,4.690482823376243005e+01 -nan,nan,1.130740713021656120e+03,1.180202161145763057e+03 -2.790038153529663667e+00,6.037572697810139610e-01,1.003458011755281859e+03,6.740178859406935317e+02 -5.884454358703083088e+00,-7.872769481947127224e-01,4.303073405020551832e+02,4.975229243457266080e+02 -nan,nan,1.033312032931949943e+03,1.177916812382936769e+03 -nan,nan,7.175570855830600294e+02,2.088997480939141838e+02 -2.123158973488594725e+00,-1.532466854976251569e-01,1.058813746382587851e+03,4.934540795539899136e+02 -5.802176133173192474e-01,1.952944194633577935e-01,1.731062256976315439e+02,5.769062292578363440e+02 -4.670762387911516211e-01,4.460373725268922396e-01,1.724038226800303164e+02,6.289673180288351659e+02 -nan,nan,4.818428143249451523e+02,1.116550215037886801e+03 -1.663313003094809339e+00,-4.959614634903169450e-01,1.151007732568338270e+03,4.093935747123971396e+02 -1.611827696958420875e+00,-1.109419582861617126e+00,7.471330104300487847e+02,3.115672976059933035e+02 -4.803576419219409033e+00,5.615562830441949149e-01,5.479442142727655209e+02,8.010351354639749388e+02 -3.404416153351393914e-01,-6.328102641893342817e-01,3.016250044025949251e+02,4.586267687739526764e+02 -4.776264856748562160e+00,1.116377205589210719e+00,1.498312961344265375e+02,8.840986023419831099e+02 -4.688665680427326343e+00,5.978968383478222570e-01,5.853799707860925992e+02,8.097486499031195990e+02 -3.149733781299754565e+00,1.011983652008160289e-01,8.965971542633237732e+02,6.224427585447524507e+02 -4.933222144226245831e+00,1.360270955583309904e+00,3.589320286071288990e+01,8.399290052547727328e+02 -nan,nan,6.115952413025199803e+02,1.081198993824642685e+03 -1.437101239459889435e+00,-7.818614728355123278e-01,3.334837681653741726e+01,3.535809278914279048e+02 -nan,nan,2.188521522275446500e+02,1.007858085703516394e+03 -nan,nan,4.474422594750407001e+01,1.034754272927020793e+03 -3.968034466844613917e+00,6.422845644016417221e-01,8.101563007896562567e+02,7.844186749277545232e+02 -nan,nan,6.245511905258953220e+02,1.477181684519494240e+02 -nan,nan,1.427426853509841109e+01,1.056895987726315525e+03 -4.410592692759990108e+00,-6.060833497575970341e-01,6.366689652733875846e+02,5.777538824819183674e+02 -nan,nan,1.721366839309431498e+02,9.121570251951450246e+02 -nan,nan,1.266573151281818355e+02,1.675798157726626769e+01 -6.073303115573668975e+00,4.838258147327657022e-01,2.747191456191428642e+02,6.924102236868673117e+02 -nan,nan,2.915266202585973474e+02,2.755559502318410523e+02 -1.453650764150772989e+00,-4.690427867001547568e-01,1.555984682766373695e+01,4.129514733120506662e+02 -6.192122630226398527e+00,6.021792749823288160e-01,2.418494437935864880e+02,7.004974057876150937e+02 -nan,nan,4.729545736183548001e+02,2.469129527096279162e+02 -4.987062990917535465e+00,8.362157920887107743e-01,4.359279890250564904e+02,8.419642022736844638e+02 -nan,nan,4.120156443662377228e+02,1.164148820196130373e+03 -nan,nan,1.028359791466881461e+03,9.962737824920776575e+02 -nan,nan,8.448471938707228901e+02,1.630763014451641624e-01 -4.823251847500743317e+00,3.530964971869535174e-01,5.517180436564467527e+02,7.611388907681729279e+02 -4.264108437771312765e+00,8.431140559219738595e-01,7.814811629674588858e+02,8.395164106857043862e+02 -nan,nan,7.166753273351305324e+02,9.705633273442725795e+02 -4.782542212889268285e+00,1.077278237029836827e+00,2.501967104277586031e+02,8.866165697725375594e+02 -nan,nan,9.257673425155289806e+02,9.966358258139962345e-03 -nan,nan,2.220347056647756858e+02,1.056980877781021917e+02 -nan,nan,6.420521974069558837e+02,7.370200256718328546e+01 -nan,nan,7.627031109355260696e+02,1.165442841289152057e+03 +8.481008969225856120e-02,-7.582089884520653023e-01,3.606372716949642268e+02,4.630876374547980845e+02 +7.114543304851725924e-01,-1.013626933169800903e+00,3.428109541547543131e+02,3.751643059681059071e+02 +2.160389512824711034e+00,-1.425128140146386668e-01,1.051882109433784763e+03,4.977413655948006408e+02 +4.486238181014646997e+00,9.866485341456990854e-01,7.707459489235576484e+02,8.770415578912883348e+02 +4.389445661536004906e+00,8.160530973687367684e-01,7.256673882948417713e+02,8.435095361668140868e+02 +nan,nan,9.206319097841990242e+02,9.693037818186094512e+01 +nan,nan,1.002509057522813123e+03,6.389785485043404378e+01 +4.079044064271052150e+00,5.158766806300449925e-01,7.641024593024876594e+02,7.718214715526308964e+02 +nan,nan,2.040569952653141854e+02,1.042997461728765174e+01 +1.121127069517902974e+00,7.495402673760843959e-02,7.913557625605824342e+01,5.240850078302676138e+02 +6.063895205163818858e+00,3.879064843985748356e-01,2.870981576562950295e+02,6.777745883443225239e+02 +1.634987365160837092e+00,-1.121560559290572412e+00,7.404799754321795717e+02,3.145543125628288976e+02 +nan,nan,5.513925559318961405e+02,2.658278393842795140e+02 +1.393591544136221216e-01,-1.008035275129600894e+00,4.029983920019192851e+02,4.245543935645750366e+02 +nan,nan,3.573993329580406453e+02,1.161460616142464687e+03 +nan,nan,9.036574271230646218e+02,9.591833474008082021e+02 +5.372873869039379358e+00,1.098765394572153609e+00,2.191261717098118424e+02,8.349248518004035304e+02 +nan,nan,6.838579346236164156e+02,2.148388479774464486e+02 +4.390320117413866186e+00,-3.879624991223295516e-01,6.450516832434831258e+02,6.187036876524194895e+02 +nan,nan,6.342525600647342117e+02,1.199283926797459344e+03 +nan,nan,2.297543111384991903e+02,9.158855850422878575e+02 +nan,nan,1.033745344694754522e+03,1.174877795234879159e+03 +nan,nan,1.771658133472343479e+02,1.173094491956442198e+03 +2.570808385540713559e+00,-8.905008838740084975e-01,8.615166246835080983e+02,4.125838053763629318e+02 +nan,nan,6.205702010782011939e+02,1.498126720341570888e+02 +nan,nan,1.547933394012345332e+02,1.166128322457318745e+03 +nan,nan,8.239311487416752016e+02,7.106917866168834053e+01 +9.593151368954282443e-01,-5.838008796038267612e-01,1.682854277711938096e+02,4.129545438864727203e+02 +nan,nan,1.118917663877270115e+03,1.025007419664162853e+03 +2.260050832134484988e+00,1.611730914102104187e-02,1.043782338270754053e+03,5.327329136284445212e+02 +nan,nan,6.853391397691757447e+02,9.392203253820732698e+02 +nan,nan,1.116775609897345703e+03,2.372316678753230974e+02 +nan,nan,1.014386400232578694e+03,8.308281265250201386e+01 +5.787723887661731403e+00,-1.458809100716603524e+00,5.624001935857876333e+02,4.062744811579705129e+02 +nan,nan,8.853546019943577221e+02,9.906738845563097584e+02 +4.749418200551958513e+00,1.082961557477561509e+00,2.200374896331521484e+02,8.892756267436786857e+02 +4.507437100851672263e+00,7.793086706802723751e-02,6.314216368835043340e+02,7.094528584542723593e+02 +nan,nan,5.951739361037837170e+02,1.092354895297011581e+03 +5.529991563158407342e-01,-6.353600175659344096e-01,2.648758593743590950e+02,4.386461991161612559e+02 +3.655684733752880611e+00,-3.970665231433671560e-01,7.688148059522877702e+02,5.809450969933174065e+02 +3.244859290298246268e+00,4.356076994693492410e-01,9.147104880655048191e+02,6.863544910348545045e+02 +nan,nan,8.104242598263678588e+01,1.137037497816248560e+03 +nan,nan,6.965251605388669986e+01,1.176573061992306066e+03 +nan,nan,2.128285686226486177e+02,1.090640069641506898e+03 +4.696580536250758442e-01,6.253290949052530134e-01,1.568149963577266135e+02,6.596873077645659578e+02 +1.385590250730549755e+00,-9.908699012930123340e-01,1.448521112717095605e+02,3.175403934756310491e+02 +5.729358587647759293e+00,5.682012208949627219e-01,3.212061537698176608e+02,7.375380377597399502e+02 +nan,nan,4.985997866491692321e+02,2.529823358877815735e+02 +4.988388645216600636e+00,1.165802083409098300e+00,1.567560573558335761e+02,8.648235268427977189e+02 +4.756376249922584343e+00,5.034713941613070398e-01,5.656309629381113382e+02,7.909814056623919214e+02 +1.369526176949762197e+00,-4.930858418100648316e-02,3.007373367052630186e+01,4.939394881036906213e+02 +5.196152662807885569e+00,-2.050888989084155012e-01,4.940287367426652736e+02,6.428381520131164280e+02 +nan,nan,5.979350746359349387e+02,7.222092674788567024e+01 +4.100393038860797645e+00,6.082556793650372162e-01,7.722840762819694191e+02,7.891604752421401372e+02 +nan,nan,9.643632231585336285e+02,9.492388779148166122e+02 +nan,nan,8.867740009284021880e+02,2.866915982974780377e+02 +3.577725495900617947e+00,-6.466149533392521187e-01,7.597716969690824271e+02,5.323754354517565162e+02 +1.561730903121483882e+00,-1.021865328404456319e+00,1.087029281067329066e+03,3.086365150811287776e+02 +4.532961361706517422e+00,1.063998857374368612e+00,9.069255676439180434e+02,8.881767397218472979e+02 +nan,nan,6.871670274236510068e+02,2.144588801741211341e+02 +4.742227435012100756e+00,2.886636287446147642e-01,5.748821881197618495e+02,7.502776572072511954e+02 +nan,nan,3.391611988164991089e+02,1.114852852395199761e+03 +5.774601632535362405e+00,-2.361524406317730973e-01,3.946711118637893492e+02,5.987615078499529773e+02 +4.825321050075412010e+00,6.210771446690457331e-01,5.364780628827825240e+02,8.116465678612643160e+02 +2.706539299751112626e+00,1.294205507860117121e+00,1.116717495682732078e+03,7.739322200803633223e+02 +1.039861901836746094e+00,-4.249925104871435377e-01,1.284219741711433471e+02,4.356436717690104388e+02 +nan,nan,1.136310222029554325e+03,9.904099943792939484e+02 +2.278611729634234084e+00,-1.261255129633241268e+00,7.259611256078147790e+02,3.660484048872708627e+02 +nan,nan,2.056783750291932904e+02,1.051196842980827341e+03 +4.631550838078665855e+00,1.041402681105380479e+00,6.716630658694379008e+02,8.942550140247261652e+02 +nan,nan,7.260409832501266010e+02,5.921344375633857027e+01 +5.912791164800368371e+00,6.870955336233243171e-01,2.725437807733755449e+02,7.387905583136598580e+02 +5.746085504522058685e+00,-8.797735616799710057e-01,4.588083726029722129e+02,4.916996317346095111e+02 +5.182883888205888745e+00,8.928339855384324064e-01,3.541915725166210223e+02,8.342607894333269769e+02 +5.099994915687164010e+00,7.224729245779069053e-01,4.310131880487508624e+02,8.154467815910206809e+02 +nan,nan,1.693944973247032522e+02,4.327506516948180604e+01 +1.874363626650318082e+00,-4.631339753814169846e-01,1.092560763668923755e+03,4.232355522945699136e+02 +nan,nan,8.518310062988493883e+02,1.176693597875680325e+03 +4.250272993246030140e+00,7.315858899551317407e-01,7.536898139464097994e+02,8.204753868415810985e+02 +1.006986950228857314e+00,6.481326545836398889e-01,7.553541918071778127e+01,6.353065910685759263e+02 +4.470625321072967395e+00,-7.856690327508027982e-01,6.241489183961404024e+02,5.445438286720441283e+02 +nan,nan,4.593893767799145849e+02,1.901603889414861897e+02 +nan,nan,1.047318929761172285e+03,9.893210081198062653e+02 +nan,nan,5.655000761962183731e+01,9.893569890666494757e+02 +nan,nan,2.082443085929525353e+02,1.420444293969499654e+02 +nan,nan,6.426812382002314052e+02,1.710984781837902347e+02 +nan,nan,3.432546558034844679e+02,1.089426684121928247e+03 +nan,nan,2.862223578442319081e+02,6.179028334671281186e+01 +nan,nan,1.945495996196903832e+02,2.072113373627740316e+02 +1.724597451204637366e+00,-9.870658578897087976e-01,9.963746181060112121e+02,3.249707862646523040e+02 +1.731970302688488728e+00,-6.519215490893758291e-01,1.116706473675420057e+03,3.822626388770161157e+02 +1.882477517136493583e+00,-1.740303364131541575e-01,1.110201612084811131e+03,4.770640830258201959e+02 +5.309169562078034588e+00,-3.143036377559551564e-01,4.796118247134118633e+02,6.170004749999277465e+02 +1.687044453938627120e+00,-1.019515222033887225e+00,9.724553925750429926e+02,3.182275536900617112e+02 +nan,nan,5.323329828747844203e+02,1.065239878460286718e+03 +4.767605694984907494e+00,9.408988757690005533e-01,4.989052166922831475e+02,8.724963746088316157e+02 +nan,nan,7.624918335167243413e+02,9.995754700315480932e+02 +4.463516548325770827e+00,7.002714413734706378e-01,6.734594554084504807e+02,8.260669264854349194e+02 +2.471080793816387899e+00,-1.312465640496790487e+00,7.042469593981176104e+02,3.776948255699599031e+02 +3.686862622401297362e-01,5.362136332420458507e-01,1.798650439026320100e+02,6.517215011035892758e+02 diff --git a/src/coo_system.rs b/src/coo_system.rs index 22bf32d..8407b5a 100644 --- a/src/coo_system.rs +++ b/src/coo_system.rs @@ -80,7 +80,7 @@ impl CooSystem { CooSystem::GALACTIC => { let xyz = lonlat.to_xyz(); // ICRS_2_GAL * xyz - let rotated_xyz = XYZ::new( + let rotated_xyz = XYZ::new_renorming_if_necessary( ICRS_2_GAL[0] * xyz.x() + ICRS_2_GAL[1] * xyz.y() + ICRS_2_GAL[2] * xyz.z(), ICRS_2_GAL[3] * xyz.x() + ICRS_2_GAL[4] * xyz.y() + ICRS_2_GAL[5] * xyz.z(), ICRS_2_GAL[6] * xyz.x() + ICRS_2_GAL[7] * xyz.y() + ICRS_2_GAL[8] * xyz.z(), @@ -101,8 +101,9 @@ impl CooSystem { CooSystem::EQUATORIAL => lonlat, CooSystem::GALACTIC => { let xyz = lonlat.to_xyz(); + // ICRS_2_GAL * xyz - let rotated_xyz = XYZ::new( + let rotated_xyz = XYZ::new_renorming_if_necessary( GAL_2_ICRS[0] * xyz.x() + GAL_2_ICRS[1] * xyz.y() + GAL_2_ICRS[2] * xyz.z(), GAL_2_ICRS[3] * xyz.x() + GAL_2_ICRS[4] * xyz.y() + GAL_2_ICRS[5] * xyz.z(), GAL_2_ICRS[6] * xyz.x() + GAL_2_ICRS[7] * xyz.y() + GAL_2_ICRS[8] * xyz.z(), @@ -119,27 +120,27 @@ impl CooSystem { } const GAL_2_ICRS: &[f64; 9] = &[ + -0.0548755604024359, + 0.4941094279435681, + -0.8676661489811610, + -0.8734370902479237, -0.4448296299195045, -0.1980763734646737, - -0.873437090247923, + -0.4838350155267381, 0.7469822444763707, 0.4559837762325372, - -0.4838350155267381, - 0.4941094279435681, - -0.867_666_148_981_161, - -0.0548755604024359, ]; const ICRS_2_GAL: &[f64; 9] = &[ + -0.0548755604024359, + -0.873437090247923, + -0.4838350155267381, + 0.4941094279435681, -0.4448296299195045, 0.7469822444763707, - 0.4941094279435681, + -0.8676661489811610, -0.1980763734646737, 0.4559837762325372, - -0.867_666_148_981_161, - -0.873437090247923, - -0.4838350155267381, - -0.0548755604024359, ]; use mapproj::CustomFloat; diff --git a/src/lib.rs b/src/lib.rs index e713159..62a5625 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -707,7 +707,8 @@ mod tests { #[test] fn astropy_comparison() { //let f = File::open("examples/cutout-CDS_P_HST_PHAT_F475W.fits").unwrap(); - let f = File::open("examples/cutout-CDS_P_PanSTARRS_DR1_g.fits").unwrap(); + //let f = File::open("examples/cutout-CDS_P_PanSTARRS_DR1_g.fits").unwrap(); + let f = File::open("examples/cutout-CDS_P_allWISE_W3.fits").unwrap(); //let f = File::open("examples/FOCx38i0101t_c0f.fits").unwrap(); //let f = File::open("examples/pc.fits").unwrap(); let mut reader = BufReader::new(f); @@ -718,7 +719,9 @@ mod tests { use std::fs::File; // Build the CSV reader and iterate over each record. //let f = File::open("examples/pc.fits.csv").unwrap(); - let f = File::open("examples/cutout-CDS_P_PanSTARRS_DR1_g.fits.csv").unwrap(); + //let f = File::open("examples/cutout-CDS_P_PanSTARRS_DR1_g.fits.csv").unwrap(); + let f = File::open("examples/cutout-CDS_P_allWISE_W3.fits.csv").unwrap(); + //let f = File::open("examples/FOCx38i0101t_c0f.fits.csv").unwrap(); //let f = File::open("examples/cutout-CDS_P_HST_PHAT_F475W.fits.csv").unwrap(); @@ -733,7 +736,7 @@ mod tests { if ra.is_finite() && dec.is_finite() { if let Some(img_xy) = wcs.proj(&LonLat::new(ra, dec)) { - assert_delta!(img_xy.x(), x, 1e-4); + assert_delta!(dbg!(img_xy.x()), dbg!(x), 1e-4); assert_delta!(img_xy.y(), y, 1e-4); } } diff --git a/src/projection.rs b/src/projection.rs index 80234d5..2b4b62a 100644 --- a/src/projection.rs +++ b/src/projection.rs @@ -30,7 +30,7 @@ use crate::params::WCSParams; use super::Error; -#[derive(PartialEq)] +#[derive(PartialEq, Debug)] pub enum FiducialPoint { /// Fiducial point is the north pole (0, 90deg). This is the default for zenital projections NorthPole, @@ -139,13 +139,13 @@ pub trait WCSCanonicalProjection: CanonicalProjection { let latpole = params.latpole.unwrap_or(90.0); // Parse the native longitude of the fiducial point - let native_fiducial_point = match (params.pv1_1, params.pv1_2) { + let native_fiducial_point = dbg!(match (params.pv1_1, params.pv1_2) { (Some(phi_0), Some(theta_0)) => FiducialPoint::UserSpeficied { phi_0, theta_0 }, _ => Self::default_native_fiducial_point(params)?, - }; + }); - let positional_angle = if native_fiducial_point == FiducialPoint::Origin { - PI - lonpole.to_radians() + let positional_angle = if native_fiducial_point == FiducialPoint::NorthPole { + -PI + lonpole.to_radians() } else { let pole = celestial_pole( lonpole.to_radians(), @@ -176,7 +176,8 @@ pub trait WCSCanonicalProjection: CanonicalProjection { let mut rotated_proj = CenteredProjection::new(proj); rotated_proj.set_proj_center_from_lonlat_and_positional_angle(&crval, positional_angle); - + dbg!(positional_angle.to_degrees()); + //rotated_proj.set_proj_center_from_lonlat(&crval); Ok(rotated_proj) }