Skip to content

Astroberta/PyTICS

Repository files navigation

Description of the methodology can be found at https://doi.org/10.1093/rasti/rzaf021

PyTICS allows for easy intercalibration of photometric time-series data, applying a maximum likelihood ensemble photometry method. You can use the attached jupyter notebook ('PyTICS_Example_Use.ipynb') to run the algorithm for now, see below for the data you require. There is also an installable package available, see below instructions for usage. You can contact the author (rv40@st-andrews.ac.uk) if you'd like help with the intercalibration.

The jupyter notebook shows example usage of the PyTICS algorithm for NGC 3783 taken with ten Las Cumbres Observatory (LCO) 1-m telescopes for the u band, as described in the linked publication.

1. Data Format

You currently need a list of 6 arrays of data in this order:

i) Date (e.g. in MJD)
ii) Filter Name
iii) Unique Star identifier
iv) Instrumental magnitude
v) Instrumental magnitude error
vi) Unique telescope identifier

This should contain all your available comparisons stars as well as your Target.

2. PyTICS package installation (alternative to jupyter notebook)

The python package is available to install via the usual git clone, but using the jupyter notebook is recommended while the package is being generalised. If you do use the package in this way, this is how to run it:

import PyTICS

#e.g for our LCO AGN data the filters and unique targed identifier:
filters = ['up', 'B', 'V']
AGN_ID = 2387
#e.g for our LCO data, I get the lists from a pickle file:
lco2 = pd.read_pickle('lco_latest_stan.pkl')

Date = lco2.MJD.values
Filter = lco2.Filter.values
Star_IDs = lco2.id_apass.values
Inst_Mag = lco2.mag_aper.values
Inst_Mag_Err = lco2.err_aper.values
Tel_ID = lco2.telid.values

#Data format:
DATA = [Date, Filter, Star_IDs, Inst_Mag, Inst_Mag_Err, Tel_ID]
#Define your list of telescopes, even if its just one:
TEL = pd.unique(lco2.telid.values)

#Run the calibration, which saves star calibration file as .csv
myagn = PyTICS.PyTICS(DATA, TEL, filters, verbose=True,
                     objname='NGC3783', AGN_ID=AGN_ID)
myagn.max_loops = 100
myagn.CalibrateUpdate_New()

#Calibrate your target for specified filter
Calibrated_AGN = myagn.filters['up'].AGN_LC()

A note on the .csv file with calibrated star data: The dataframe has a lot of columns that are of no use to the general user and are mainly there to track the convergence etc. The file is needed for the final calibration of your target, as shown in the last line of the code above. If desired, the useful columns in the dataframe are the following:

mag_aper: calibrated (instrumental) star magnitude
err_tot: total noise model derived for the comparison stars. This is the square sum of the nominal uncertainty err_aper, the star-specific noise term rms_star, the telescope-specific noise term rms_sc, and the time-specific noise term rms_t. For the science target, only err_aper, rms_sc, and rms_t are summed in the noise model.
DMAGT: time-specific correction parameter applied to the uncalibrated data.
DMAGS: teleScope specific correction parameter applied to the uncalibrated data.

3. Empirical colour-corrections

As described in the linked publication, across 32 AGN fields we find consistent slopes of the residuals vs star-colours, unique to each telescope, that can be used to derive the colour-dependent offsets in the LCO telescope network (the 'global solution'). As empthasised, the colour-corrections can be derived with PyTICS for indiviudal AGN star fields, which may or may not give better colour correction results than the global solution. This can again be done using the attached jupyter notebook. All residuals vs star-colour fits are shown in the 'Residual Fits' folder above - the results may be less reliable with increasing wavelength as apparent from the scatter in the data.

Given the u-g colour index C(u-g) of your target, the colour correction parameter can be computed as a*C(u-g) + b, where a and b are specific to each filter.

u band

Telescope a b
1m001 0.0017263414071372986 ± 0.0005901625148146004 -0.0032159407063751125 ± 0.0010161079369647597
1m003 -0.0065355305507921345 ± 0.0004991478377633185 0.009368118410877117 ± 0.0008511225966782469
1m004 0.0017020014195029487 ± 0.0008145923267436035 -0.0016606518318294375 ± 0.0013708218147007601
1m005 -0.0006664675164166133 ± 0.00036645591842454303 0.0012770948905568098 ± 0.0006198747445340367
1m006 0.0014266992425666486 ± 0.000462702831935573 -0.002868846228322815 ± 0.0007839345082349487
1m008 0.0012654450189588684 ± 0.0004504291270247489 -0.0017610598500437098 ± 0.0007640127735934264
1m009 0.00298429430422531 ± 0.0003050136375345996 -0.004650331996861675 ± 0.0005124902521514217
1m010 0.0017884887021757 ± 0.0005352035785321668 -0.0030229795234532897 ± 0.0009008667692451755
1m011 -0.010912499177185859 ± 0.0005501797921170391 0.016485742319032076 ± 0.0009240916650843922
1m012 0.005664952047148578 ± 0.0004312673044256114 -0.008346621166215144 ± 0.0007348664192273029
1m013 -0.0014274690905561683 ± 0.00043541683215359386 0.0022804782281842404 ± 0.0007281224844010012
1m014 0.003707327584200889 ± 0.00047516139873966627 -0.005501661626963999 ± 0.0008018081738138129

B band

Telescope a b
1m001 0.004175815110471496 ± 0.0004777203330014147 -0.00535782195111683 ± 0.0008191444765644996
1m003 -0.01523830092171476 ± 0.0006262809442429832 0.023317868660900992 ± 0.0010605268372192705
1m004 -0.02921181968947498 ± 0.0008051187432256742 0.045301973375972 ± 0.0013649788519055628
1m005 0.020704312702169533 ± 0.0005597542488654725 -0.03219742849361546 ± 0.0009406218426790819
1m006 -0.00549491354851794 ± 0.000430556278899436 0.008494504665349595 ± 0.0007278284958083668
1m008 -0.004806567502356087 ± 0.0005357969091102969 0.004958028331129685 ± 0.0009109923592714405
1m009 -0.006077323406509686 ± 0.0005955721309926824 0.009585095765108841 ± 0.0009968683432225855
1m010 0.018544688760144756 ± 0.0007615644433857684 -0.028942225367428853 ± 0.0012861441918137467
1m011 -0.02163759083534493 ± 0.0006589488227508183 0.03391315931691288 ± 0.0011226776997971012
1m012 0.003405474780052887 ± 0.0004857704361980028 -0.005416418614304406 ± 0.0008117183544171544
1m013 0.01655989928593596 ± 0.0005293215334977591 -0.025643578008209184 ± 0.0008986845787380647
1m014 0.009909376779915005 ± 0.0005592940716768443 -0.013001063787418957 ± 0.0009479233795874628

g band

Telescope a b
1m001 0.0028238839533281674 ± 0.00031023776296209985 -0.005044088868255013 ± 0.0005433821787475604
1m003 -0.012179248252515262 ± 0.0004973415502987182 0.019700148573461456 ± 0.0008597168059198863
1m004 -0.013649782369490698 ± 0.0005461700379048159 0.022807993624867864 ± 0.0009503559152918284
1m005 0.012377275495561396 ± 0.0003862733552476398 -0.01963579733649561 ± 0.0006690396635575871
1m006 -0.005285538132118105 ± 0.0005242212817478074 0.007413974877360958 ± 0.000908192856093594
1m008 -0.003039845457220158 ± 0.00039730678048147594 0.003464164613348743 ± 0.000685696407987777
1m009 -0.0031139038840231397 ± 0.00046205012456153045 0.005500750964412632 ± 0.0008009814330760708
1m010 0.006154947780919887 ± 0.0005665118654929972 -0.009186976795091317 ± 0.000992345578001705
1m011 -0.01502003689457904 ± 0.0005595277058724887 0.024013429141220927 ± 0.000957974967525168
1m012 0.002562808018927513 ± 0.0004316362966897689 -0.0038738593569397077 ± 0.0007438049151870958
1m013 0.010599357302553554 ± 0.0004349258647335782 -0.017655587076679267 ± 0.0007490689456088346
1m014 0.009720050442921112 ± 0.00039027480502249086 -0.014974767725195084 ± 0.0006744033438459045

V band

Telescope a b
1m001 0.0022986125942024427 ± 0.0004115774448941764 -0.004164795012566944 ± 0.0007149037597424534
1m003 -0.011014256344230297 ± 0.00046764064651222664 0.018658523545850438 ± 0.0008209348821581804
1m004 -0.00032453108391226394 ± 0.00038142754702712904 0.0013371653795863528 ± 0.0006559340668929111
1m005 0.0016324472405492491 ± 0.0002656383809916076 -0.002559994877508632 ± 0.0004574290570185835
1m006 -0.004672209530447858 ± 0.00035809168435809715 0.006628378817039772 ± 0.0006219174415418066
1m008 -0.002168752675303618 ± 0.0003816065539223025 0.0030980602159191087 ± 0.0006502504291381434
1m009 0.0023575408999868997 ± 0.00035284873812112066 -0.004364194092385735 ± 0.0006123857929877755
1m010 0.0014798866230500665 ± 0.0004784791943970455 -0.0011976086636181988 ± 0.0008321800720094143
1m011 -0.009275530951738832 ± 0.0004571365442977895 0.014800128157508778 ± 0.0007865050882549275
1m012 0.00534595492447305 ± 0.00037360430640287663 -0.00830366064596863 ± 0.0006421304076153814
1m013 0.004158167700693642 ± 0.00034128182852769624 -0.0075227592611896805 ± 0.0005964550868564852
1m014 0.004581782356912237 ± 0.00035572542437899883 -0.007649589805205725 ± 0.0006258087543670066

r band

Telescope a b
1m001 -0.0013637115785657926 ± 0.00033250125403177773 0.0023367715036903903 ± 0.0005834540058415367
1m003 0.0009684282499081705 ± 0.0002985115902481158 -0.002302689921758994 ± 0.0005300186078472689
1m004 -0.004583892245610007 ± 0.00031422474542623473 0.008349191866199254 ± 0.0005441415069517754
1m005 -0.0003536629709790616 ± 0.0002549220972712435 0.0004842358525298122 ± 0.0004528495353282278
1m006 0.0018215039954416743 ± 0.00022380488510729917 -0.00389816691543325 ± 0.0003886469567551602
1m008 0.0018245972413566986 ± 0.00028990160802267427 -0.003426740659304043 ± 0.0005053849538030335
1m009 -0.0021275139503279996 ± 0.0002874642763818976 0.0031840124598919873 ± 0.000500097232466668
1m010 0.0009921197156657618 ± 0.00026453212291546247 -0.0007539530899622933 ± 0.00045779509880146407
1m011 0.0020812814078828568 ± 0.000340861556920946 -0.004231644616217162 ± 0.0005996044894626071
1m012 0.001159268752036694 ± 0.00025277528810619895 -0.001390613289587298 ± 0.0004370853357585923
1m013 0.00019377501260577366 ± 0.00016503441256345182 -0.00044272764118760845 ± 0.00029354729487059703
1m014 -0.0018931221468655307 ± 0.0002923788801612834 0.0033582041612216897 ± 0.0005178933524572281

i band

Telescope a b
1m001 -0.0013006455273108825 ± 0.0004495298111160413 0.0021506179271951684 ± 0.0007971867548234037
1m003 0.0026665046974566602 ± 0.00042453445721166833 -0.005431796769014594 ± 0.0007474433760189473
1m004 -0.0030086389327413647 ± 0.0004679906213163451 0.00497383504586576 ± 0.0008072102737690986
1m005 -0.0004379039915143868 ± 0.00037555135229593993 0.00040196658615435435 ± 0.0006553655202176582
1m006 -1.712662715941141e-05 ± 0.0003485884242597001 -0.00036920890448730595 ± 0.0006161910144365605
1m008 0.00011969061176799712 ± 0.0004416268403507097 -0.00032509028123426764 ± 0.0007719531696207012
1m009 -0.002021303621053183 ± 0.00044835447484876197 0.0036178349413386007 ± 0.0007798045353772044
1m010 0.0011476117104262783 ± 0.00045774027075327895 -0.0008472271472724232 0.0007979424766556795
1m011 0.003421245271737868 ± 0.0005929856005328429 -0.006807084389972141 ± 0.001025903359466427
1m012 0.002681128821325511 ± 0.00045640214596417636 -0.003964324554395679 0.0007966039421517745
1m013 4.0347776246156e-05 ± 0.0003319308389247456 -0.0001918975545511185 ± 0.0005809527714801721
1m014 -0.0011133128694334913 ± 0.0003453338623725695 0.002014243884830949 ± 0.0006062761446005188

z band

Telescope a b
1m001 -0.0015995825607583794 ± 0.0019452265505484072 0.002947866834276909 ± 0.0035193001472409516
1m003 0.002719912151441477 ± 0.0017738327675096976 -0.006216584681514447 ± 0.0031951973483253463
1m004 -0.03509547108881672 ± 0.0029424154782438615 0.06419293261779485 ± 0.005100206289662776
1m005 0.0008152317109679905 ± 0.002010011660926415 -0.0024897598813421774 ± 0.003633740224406747
1m006 0.004477116603241019 ± 0.002289336830300889 -0.010390156271718333 ± 0.00406205370933045
1m008 0.0009650299178140787 ± 0.0022614828972865927 -0.00013692314768718746 ± 0.004042747255656449
1m009 0.0001339560555866677 ± 0.0026014616111071074 9.677839868777935e-05 ± 0.004668853153056469
1m010 -0.0010109657041484877 ± 0.0024667733141644464 0.00486356658089716 ± 0.004470596384123714
1m011 0.007799391458842309 ± 0.0025268368096575326 -0.01713932205787789 ± 0.004527678589434023
1m012 0.006581398811924039 ± 0.003053860177210436 -0.01449990027306963 ± 0.005423557083632083
1m013 0.00229334812983406 ± 0.0013656344938311991 -0.004280758363215684 ± 0.0025025465629703162
1m014 -0.005158974235190732 ± 0.002273919014810923 0.009859427898408605 ± 0.004097408957484347

About

PyTICS - Telescope Intercalibration using Comparison Stars

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published