Skip to content

heasarc_get_lightcurves KeyError #553

@jkrick

Description

@jkrick

Running light_curve_collector I am getting this error. Haven't looked into it yet deeply, but did Heasarc change column names?

cc: @zoghbi-a


KeyError Traceback (most recent call last)
Cell In[8], line 13
10 heasarc_catalogs = {"FERMIGTRIG": max_fermi_error_radius, "SAXGRBMGRB": max_sax_error_radius}
12 # get heasarc light curves in the above curated list of catalogs
---> 13 df_lc_HEASARC = heasarc_get_lightcurves(sample_table, catalog_error_radii=heasarc_catalogs)
15 # add the resulting dataframe to all other archives
16 df_lc.append(df_lc_HEASARC)

File ~/fornax-demo-notebooks/light_curves/code_src/heasarc_functions.py:122, in heasarc_get_lightcurves(sample_table, catalog_error_radii)
116 hresulttable = vstack([hr.to_table() for hr in hresult])
118 # add results to multiindex_df
119 # really just need to mark this spot with a vertical line in the plot, it's not actually a light curve
120 # so making up a flux and an error, but the time stamp and mission are the real variables we want to keep
121 df_heasarc = pd.DataFrame(dict(flux=np.full(len(hresulttable), 0.1), err=np.full(len(hresulttable), 0.1),
--> 122 time=hresulttable['time'], objectid=hresulttable['objectid'],
123 band=np.full(len(hresulttable), heasarc_cat),
124 label=hresulttable['label'])).set_index(["objectid", "label", "band", "time"])
126 # Append to existing MultiIndex light curve object
127 df_lc.append(df_heasarc)

File /opt/envs/py-light_curve_collector/lib/python3.12/site-packages/astropy/table/table.py:2093, in Table.getitem(self, item)
2091 def getitem(self, item):
2092 if isinstance(item, str):
-> 2093 return self.columns[item]
2094 elif isinstance(item, (int, np.integer)):
2095 return self.Row(self, item)

File /opt/envs/py-light_curve_collector/lib/python3.12/site-packages/astropy/table/table.py:264, in TableColumns.getitem(self, item)
253 """Get items from a TableColumns object.
254
255 ::
(...) 261 tc[1:3] # <TableColumns names=('b', 'c')>
262 """
263 if isinstance(item, str):
--> 264 return OrderedDict.getitem(self, item)
265 elif isinstance(item, (int, np.integer)):
266 return list(self.values())[item]

KeyError: 'time'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions