|
1 | 1 | # This code is part of X-ray: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS). |
2 | | -# Last modified by David J Turner (djturner@umbc.edu) 5/20/26, 9:55 AM. Copyright (c) The Contributors. |
| 2 | +# Last modified by David J Turner (djturner@umbc.edu) 5/20/26, 10:14 AM. Copyright (c) The Contributors. |
3 | 3 |
|
4 | 4 | import contextlib |
5 | 5 | import gc |
@@ -1865,9 +1865,23 @@ def parse_spectrum(row: pd.Series, combined_obs: bool): |
1865 | 1865 | ann_lums = {int(an_id): None for an_id in fit_ann_inv_ent['ann_id'].values} |
1866 | 1866 | ann_res = {int(an_id): None for an_id in fit_ann_inv_ent['ann_id'].values} |
1867 | 1867 |
|
1868 | | - # The passing of 'tel' isn't strictly necessary, as the set-idents should be unique identifiers, but |
1869 | | - # it is a useful visual reminder that we are in the telescope loop |
1870 | | - rel_ann_sp = self.get_annular_spectra(set_id=fit_ann_inv_ent.iloc[0]['set_ident'], telescope=tel) |
| 1868 | + # If we trust that XGA has loaded in previously created annular spectra properly, which we |
| 1869 | + # must, then it is entirely reasonable to try to retrieve the annular spectra instance with the |
| 1870 | + # current fit's spectrum set ID. |
| 1871 | + # Hopefully the annular spectrum will be retrieved, but if it isn't present we can catch the |
| 1872 | + # error, and move on from trying to load this particular fit result. There are several reasons |
| 1873 | + # that the annular spectrum may not have been loaded in, files are missing, damaged, or moved, or |
| 1874 | + # the way the source was set up this time means that extra observations are associated - whatever |
| 1875 | + # the cause, we need to catch it and move on. |
| 1876 | + try: |
| 1877 | + # The passing of 'tel' isn't strictly necessary, as the set-idents should be unique identifiers, but |
| 1878 | + # it is a useful visual reminder that we are in the telescope loop |
| 1879 | + rel_ann_sp = self.get_annular_spectra(set_id=fit_ann_inv_ent.iloc[0]['set_ident'], telescope=tel) |
| 1880 | + |
| 1881 | + # If we can't fetch the spectrum, we catch the error, and move on to the next annular spectrum |
| 1882 | + # result to be loaded in. |
| 1883 | + except NoProductAvailableError: |
| 1884 | + break |
1871 | 1885 |
|
1872 | 1886 | assign_res = True |
1873 | 1887 | for row_ind, row in fit_ann_inv_ent.iterrows(): |
|
0 commit comments