Skip to content

Commit

Permalink
Merge pull request #92 from MJWeberg/main
Browse files Browse the repository at this point in the history
catalog and template bugfix
  • Loading branch information
MJWeberg committed Jun 17, 2024
2 parents 1b3f96a + fafd21e commit 9a10575
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 127 deletions.
2 changes: 1 addition & 1 deletion eispac/core/match_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def match_templates(eis_obs):
# or "s__11_188_675.3c.template.h5"
for t in range(num_templates):
line_id_str = all_templates[t].name.split('.')[0]
line_id_str.replace('__', '_') # single character elements are padded
line_id_str = line_id_str.replace('__', '_') # single character elements are padded
line_id_parts = line_id_str.split('_')
template_waves[t] = float(line_id_parts[2]+'.'+line_id_parts[3])

Expand Down
24 changes: 17 additions & 7 deletions eispac/download/eis_obs_struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ def mk_list_exp(self):
"""
exp_rows = self.cur.fetchall()

unknown_main_row = {'stud_acr':'unknown_trigger', 'study_id':0, 'jop_id':0,
'obstitle':' ',
'obs_dec':'Triggered raster (see previous obs) ',
'sci_obj':'AR? ', 'target':'Flare? '}

self.eis_str = []
for e_row in exp_rows:
if e_row['rast_id'] <= 0:
Expand All @@ -100,11 +105,16 @@ def mk_list_exp(self):
ll_row = item

# Get needed row from from main
main_string = """stud_acr, study_id, jop_id, obstitle,
obs_dec, sci_obj, target"""
self.cur.execute("select " + main_string + """ from eis_main
where tl_id = ?""", (e_row['tl_id'],))
m_row, = self.cur.fetchall()
if e_row['tl_id'] == 1:
# Triggered rasters (NOT IN MAIN!)
m_row = unknown_main_row
m_row['obstitle'] = f"Triggered {e_row['rast_acr']} (rast_acr) "
else:
main_string = """stud_acr, study_id, jop_id, obstitle,
obs_dec, sci_obj, target"""
self.cur.execute("select " + main_string + """ from eis_main
where tl_id = ?""", (e_row['tl_id'],))
m_row, = self.cur.fetchall()
self.eis_str.append(EIS_Struct(e_row, ll_row, rast_row, m_row))

def mk_list_main(self):
Expand Down Expand Up @@ -311,8 +321,8 @@ def __init__(self, exp_row, ll_row, rast_row, main_row):
"""
# Query results from experiment database
self.filename = exp_row['filename']
self.date_obs = tai2utc(exp_row['date_obs'])
self.date_end = tai2utc(exp_row['date_end'])
self.date_obs = tai2utc(exp_row['date_obs'])[0:19]
self.date_end = tai2utc(exp_row['date_end'])[0:19]
self.xcen = -9999 if exp_row['xcen'] is None else exp_row['xcen']
self.ycen = -9999 if exp_row['ycen'] is None else exp_row['ycen']
self.fovx = exp_row['fovx']
Expand Down
Loading

0 comments on commit 9a10575

Please sign in to comment.