Skip to content

Commit 3f04412

Browse files
committed
changing names of pymc3 variables -> pymc
1 parent e563bca commit 3f04412

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

MonoTools/lightcurve.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,7 @@ def get_tess_lc(self,sector,search=['all'],use_fast=True,use_eleanor=False,**kwa
12061206
#QLP orbit files stored in folder:
12071207
orbits=[7+sector*2,8+sector*2]
12081208
qlpfiles=['/'.join(self.savefileloc.split('/')[:-1])+"/orbit-"+str(int(orbits[n]))+"_qlplc.h5" for n in range(2)]
1209+
print(qlpfiles)
12091210
import h5py
12101211
if os.path.isfile(qlpfiles[0]) and os.path.isfile(qlpfiles[1]):
12111212
f1=h5py.File(qlpfiles[0])
@@ -1591,14 +1592,31 @@ def read_from_file(self, f, fname, sect, **kwargs):
15911592
return None
15921593
elif f[0][0].header['TELESCOP'].lower()=='tess':
15931594
if 'ORIGIN' in f[0][0].header and f[0][0].header['ORIGIN']=='MIT/QLP':
1594-
print([type(fi[1].columns) for fi in f])
15951595
fs='elec' if int(sect)<56 else 'norm1'
1596+
fluxnames={'raw_flux':['SAP_FLUX'],
1597+
'flux':['SYS_RM_FLUX','DET_FLUX','KSPSAP_FLUX'],
1598+
'xl_ap_flux':['DET_FLUX_LAG','KSPSAP_FLUX_LAG','SAP_FLUX_LAG'],
1599+
'xs_ap_flux':['DET_FLUX_SML','KSPSAP_FLUX_SML','SAP_FLUX_SML']}
1600+
ifluxes={}
1601+
for ifname in fluxnames:
1602+
ifluxes[ifname]=[]
1603+
found=np.tile(False,len(f))
1604+
for ifi,fi in enumerate(f):
1605+
found[ifi]=False;icname=0
1606+
while not found[ifi] and icname<len(fluxnames[ifname]):
1607+
if fluxnames[ifname][icname] in fi[1].data.columns.names:
1608+
ifluxes[ifname]+=[fi[1].data[fluxnames[ifname][icname]]]
1609+
found[ifi]=True
1610+
icname+=1
1611+
if np.all(found):
1612+
#Only stacking together if we have all
1613+
ifluxes[ifname]=np.hstack(ifluxes[ifname])
1614+
else:
1615+
assert ifname is not 'flux', "QLP flux extraction failed - must at least have a flux measurement..."
15961616
ilc.load_lc(np.hstack([fi[1].data['TIME'] for fi in f]),
1597-
fluxes={'flux':np.hstack([fi[1].data['SAP_FLUX'] for fi in f]),
1598-
'xl_ap_flux':np.hstack([fi[1].data['KSPSAP_FLUX_LAG'] for fi in f]),
1599-
'xs_ap_flux':np.hstack([fi[1].data['KSPSAP_FLUX_SML'] for fi in f])},
1600-
flux_errs={'flux_err':np.hstack([fi[1].data['KSPSAP_FLUX_ERR'] for fi in f])},
1601-
src='qlp',mission='tess', jd_base=2457000, flx_system='elec', sect=sect,
1617+
fluxes=ifluxes,
1618+
flux_errs={'flux_err':np.hstack([fi[1].data['KSPSAP_FLUX_ERR'] if 'KSPSAP_FLUX_ERR' in fi[1].data.columns.names else fi[1].data['DET_FLUX_ERR'] for fi in f])},
1619+
src='qlp',mission='tess', jd_base=2457000, flx_system=fs, sect=sect,
16021620
cent1=np.hstack([fi[1].data['SAP_X'] for fi in f]), cent2=np.hstack([fi[1].data['SAP_Y'] for fi in f]))
16031621
return ilc
16041622

0 commit comments

Comments
 (0)