diff --git a/gcn_classic_to_json/notices/SWIFT_BAT_GRB_LC/__init__.py b/gcn_classic_to_json/notices/SWIFT_BAT_GRB_LC/__init__.py new file mode 100644 index 0000000..44cc8b7 --- /dev/null +++ b/gcn_classic_to_json/notices/SWIFT_BAT_GRB_LC/__init__.py @@ -0,0 +1,62 @@ +import numpy as np + +from ... import utils +from ..SWIFT_BAT_GRB_POS_ACK import parse_swift_bat + +start_tracker_status = ["locked", "not locked"] + + +def parse(bin): + bin[9:12] # Unused. According to docs: '12 bytes for the future' + bin[19] # Unused. Flags are either internal or equivalent to bin[18] + + soln_status_bits = np.flip(np.unpackbits(bin[18:19].view(dtype="u1"))) + + if soln_status_bits[11]: + grb_status = ( + "It is probably not a GRB or transient due to very low image significance" + ) + elif soln_status_bits[7]: + grb_status = ( + "It is probably not a GRB or transient due to low image significance" + ) + elif soln_status_bits[9]: + grb_status = ( + "It is probably not a GRB or transient due to negative background slope" + ) + elif soln_status_bits[6]: + grb_status = ( + "It is probably not a GRB or transient due to high background level" + ) + elif soln_status_bits[1]: + grb_status = "It is a GRB" + else: + grb_status = "It is not a GRB" + + integ_time = bin[15] * 4 / 1000 + + lat, lon = bin[16:17].view(">i2") + + return { + **parse_swift_bat(bin), + "latitude": lat * 1e-2, + "longitude": lon * 1e-2, + "trigger_type": "image" if soln_status_bits[4] else "rate", + "rate_duration": integ_time if not soln_status_bits[4] else None, + "rate_energy_range": integ_time if not soln_status_bits[4] else None, + "instrument_phi": 1e-2 * bin[12], + "instrument_theta": 1e-2 * bin[13], + "rate_snr": bin[21] * 1e-2, + "image_snr": bin[20] * 1e-2, + "delta_time": bin[14] * 1e-2, + "trigger_index": bin[17], + "url": "http://gcn.gsfc.nasa.gov/gcn/notices_s/" + + utils.binary_to_string(bin[22:39]), + "grb_status": grb_status, + "point_source": bool(soln_status_bits[0]), + "flaring_known_source": bool(soln_status_bits[2]), + "star_tracker_status": start_tracker_status[soln_status_bits[10]], + "bright_star_nearby": bool(soln_status_bits[13]), + "removed_from_catalog": bool(soln_status_bits[15]), + "galaxy_nearby": bool(soln_status_bits[16]), + } diff --git a/gcn_classic_to_json/notices/SWIFT_BAT_GRB_LC/example.json b/gcn_classic_to_json/notices/SWIFT_BAT_GRB_LC/example.json new file mode 100644 index 0000000..70335c6 --- /dev/null +++ b/gcn_classic_to_json/notices/SWIFT_BAT_GRB_LC/example.json @@ -0,0 +1,29 @@ +{ + "mission": "SWIFT", + "instrument": "BAT", + "id": [ + 1227767 + ], + "trigger_time": "2024-05-11T18:06:53.220Z", + "ra": 336.66450000000003, + "dec": 8.5135, + "rate_snr": 14.89, + "latitude": -11.14, + "longitude": 151.31, + "trigger_type": "rate", + "rate_duration": 2.048, + "rate_energy_range": 2.048, + "instrument_phi": -173.54, + "instrument_theta": 28.38, + "image_snr": 8.52, + "delta_time": -24.0, + "trigger_index": 262, + "url": "http://gcn.gsfc.nasa.gov/gcn/notices_s/sw01227767000msb.lc", + "grb_status": "It is a GRB", + "point_source": true, + "flaring_known_source": false, + "star_tracker_status": "locked", + "bright_star_nearby": false, + "removed_from_catalog": false, + "galaxy_nearby": false +} diff --git a/gcn_classic_to_json/notices/SWIFT_BAT_GRB_POS_ACK/__init__.py b/gcn_classic_to_json/notices/SWIFT_BAT_GRB_POS_ACK/__init__.py index a7c8b60..8a5ebe5 100644 --- a/gcn_classic_to_json/notices/SWIFT_BAT_GRB_POS_ACK/__init__.py +++ b/gcn_classic_to_json/notices/SWIFT_BAT_GRB_POS_ACK/__init__.py @@ -1,10 +1,96 @@ +import numpy as np + from ... import utils +energy_ranges = [[15, 25], [15, 50], [25, 100], [50, 350]] +start_tracker_status = ["locked", "not locked"] -def parse(bin): + +def parse_swift_bat(bin): return { + "mission": "SWIFT", + "instrument": "BAT", + "id": [bin[4]], "trigger_time": utils.datetime_to_iso8601(bin[5], bin[6]), "ra": 1e-4 * bin[7], "dec": 1e-4 * bin[8], + "rate_snr": bin[21] * 1e-2, + } + + +def parse(bin): + bin[15] # Unused. According to docs: '4 bytes for the future' + bin[19] # Unused. Flags are either internal or equivalent to bin[18] + bin[26:36] # Unused. According to docs: '40 bytes for the future' + bin[36] # Unused. Flags Equivalent to bin[18] + bin[38] # Intentionally omitted. Sun/Moon parameters + + integ_time = bin[14] * 4 / 1000 + + lat, lon = bin[16:17].view(">i2") + + soln_status_bits = np.flip(np.unpackbits(bin[18:19].view(dtype="u1"))) + soln_status_bits[8] # Unused. According to docs: 'ground_catalog_source'. + soln_status_bits[12] # Unused. According to docs: 'blocked_catalog_source'. + # These seems to be cross-referenced with a ground catalog with the name of the source printed in the text notices. + # But since the name of this source isn't stored in the these packets, I don't see a reason to include it. + if soln_status_bits[11]: + grb_status = ( + "It is probably not a GRB or transient due to very low image significance" + ) + elif soln_status_bits[7]: + grb_status = ( + "It is probably not a GRB or transient due to low image significance" + ) + elif soln_status_bits[9]: + grb_status = ( + "It is probably not a GRB or transient due to negative background slope" + ) + elif soln_status_bits[6]: + grb_status = ( + "It is probably not a GRB or transient due to high background level" + ) + elif soln_status_bits[1]: + grb_status = "It is a GRB" + else: + grb_status = "It is not a GRB" + + calalog_num = bin[25] + + energy_range_idx = np.flip(bin[37:38].view(dtype="i1"))[0] + energy_range = energy_ranges[energy_range_idx] + + return { + **parse_swift_bat(bin), + "alert_tense": "test" if soln_status_bits[30] else "current", + "alert_type": "retraction" if soln_status_bits[5] else "initial", + "latitude": lat * 1e-2, + "longitude": lon * 1e-2, + "trigger_type": "image" if soln_status_bits[4] else "rate", + "image_duration": integ_time if soln_status_bits[4] else None, + "image_energy_range": energy_range if soln_status_bits[4] else None, + "rate_duration": integ_time if not soln_status_bits[4] else None, + "rate_energy_range": energy_range if not soln_status_bits[4] else None, "ra_dec_error": 1e-4 * bin[11], + "instrument_phi": 1e-2 * bin[12], + "instrument_theta": 1e-2 * bin[13], + "rate_snr": bin[21] * 1e-2, + "image_snr": bin[20] * 1e-2, + "n_events": bin[9], + "image_peak": bin[10], + "background_events": bin[22], + "background_start_time": utils.datetime_to_iso8601(bin[5], bin[23]), + "backgroun_duration": bin[24] * 1e-2, + "trigger_index": bin[17], + "catalog_number": calalog_num if soln_status_bits[3] else None, + "grb_status": grb_status, + "point_source": bool(soln_status_bits[0]), + "flaring_known_source": bool(soln_status_bits[2]), + "star_tracker_status": start_tracker_status[soln_status_bits[10]], + "bright_star_nearby": bool(soln_status_bits[13]), + "originally_subtresh": bool(soln_status_bits[14]), + "removed_from_catalog": bool(soln_status_bits[15]), + "galaxy_nearby": bool(soln_status_bits[16]), + "temporal_coincidence": bool(soln_status_bits[28]), + "spatial_coincidence": bool(soln_status_bits[29]), } diff --git a/gcn_classic_to_json/notices/SWIFT_BAT_GRB_POS_ACK/example.json b/gcn_classic_to_json/notices/SWIFT_BAT_GRB_POS_ACK/example.json index d493ebb..32cb6ec 100644 --- a/gcn_classic_to_json/notices/SWIFT_BAT_GRB_POS_ACK/example.json +++ b/gcn_classic_to_json/notices/SWIFT_BAT_GRB_POS_ACK/example.json @@ -1,6 +1,44 @@ { + "mission": "SWIFT", + "instrument": "BAT", + "id": [ + 1227767 + ], "trigger_time": "2024-05-11T18:06:53.220Z", "ra": 336.66450000000003, "dec": 8.5135, - "ra_dec_error": 0.05 + "rate_snr": 14.89, + "alert_tense": "current", + "alert_type": "initial", + "latitude": -11.14, + "longitude": 151.31, + "trigger_type": "rate", + "image_duration": null, + "image_energy_range": null, + "rate_duration": 2.048, + "rate_energy_range": [ + 25, + 100 + ], + "ra_dec_error": 0.05, + "instrument_phi": -173.54, + "instrument_theta": 28.38, + "image_snr": 8.52, + "n_events": 7538, + "image_peak": 281, + "background_events": 74677, + "background_start_time": "2024-05-11T18:06:22.570Z", + "backgroun_duration": 24.0, + "trigger_index": 262, + "catalog_number": null, + "grb_status": "It is a GRB", + "point_source": true, + "flaring_known_source": false, + "star_tracker_status": "locked", + "bright_star_nearby": false, + "originally_subtresh": false, + "removed_from_catalog": false, + "galaxy_nearby": false, + "temporal_coincidence": false, + "spatial_coincidence": true } diff --git a/gcn_classic_to_json/notices/SWIFT_BAT_GRB_POS_TEST/__init__.py b/gcn_classic_to_json/notices/SWIFT_BAT_GRB_POS_TEST/__init__.py new file mode 100644 index 0000000..87bc64d --- /dev/null +++ b/gcn_classic_to_json/notices/SWIFT_BAT_GRB_POS_TEST/__init__.py @@ -0,0 +1,44 @@ +import numpy as np + +from ... import utils +from ..SWIFT_BAT_GRB_POS_ACK import parse_swift_bat + +grb_status = ["It is not a GRB", "It is a GRB"] + + +def parse(bin): + bin[15] # Unused. According to docs: '4 bytes for the future' + bin[16] # Unused. According to docs: 'always be 0.00,0.00 for this notice' + bin[19] # Unused. Flags are either internal or equivalent to bin[18] + bin[25:36] # Unused. According to docs: '44 bytes for the future' + bin[36:38] # Intentionally Omitted. Flags are redundant with rest of notice + bin[38] # Intentionally omitted. Sun/Moon parameters + + integ_time = bin[14] * 4 / 1000 + + soln_status_bits = np.flip(np.unpackbits(bin[18:19].view(dtype="u1"))) + soln_status_bits[8] # Unused. According to docs: 'ground_catalog_source'. + soln_status_bits[12] # Unused. According to docs: 'blocked_catalog_source'. + # These seems to be cross-referenced with a ground catalog with the name of the source printed in the text notices. + # But since the name of this source isn't stored in the these packets, I don't see a reason to include it. + + return { + **parse_swift_bat(bin), + "alert_tense": "test", + "ra_dec_error": 1e-4 * bin[11], + "instrument_phi": 1e-2 * bin[12], + "instrument_theta": 1e-2 * bin[13], + "image_duration": integ_time if soln_status_bits[4] else None, + "rate_duration": integ_time if not soln_status_bits[4] else None, + "image_snr": bin[20] * 1e-2, + "n_events": bin[9], + "image_peak": bin[10], + "background_events": bin[22], + "background_start_time": utils.datetime_to_iso8601(bin[5], bin[23]), + "backgroun_duration": bin[24] * 1e-2, + "trigger_index": bin[17], + "grb_status": grb_status[soln_status_bits[1]], + "point_source": bool(soln_status_bits[0]), + "flaring_known_source": bool(soln_status_bits[2]), + "bright_star_nearby": bool(soln_status_bits[13]), + } diff --git a/gcn_classic_to_json/notices/SWIFT_BAT_GRB_POS_TEST/example.json b/gcn_classic_to_json/notices/SWIFT_BAT_GRB_POS_TEST/example.json new file mode 100644 index 0000000..1361daa --- /dev/null +++ b/gcn_classic_to_json/notices/SWIFT_BAT_GRB_POS_TEST/example.json @@ -0,0 +1,28 @@ +{ + "mission": "SWIFT", + "instrument": "BAT", + "id": [ + 99999 + ], + "trigger_time": "2024-05-12T07:26:09.000Z", + "ra": 180.0, + "dec": -35.0, + "rate_snr": 16.78, + "alert_tense": "test", + "ra_dec_error": 0.05, + "instrument_phi": 123.54, + "instrument_theta": 12.34, + "image_duration": null, + "rate_duration": 0.064, + "image_snr": 12.98, + "n_events": 1000, + "image_peak": 500, + "background_events": 100, + "background_start_time": "2024-05-12T07:25:42.000Z", + "backgroun_duration": 12.0, + "trigger_index": 12, + "grb_status": "It is a GRB", + "point_source": true, + "flaring_known_source": false, + "bright_star_nearby": false +} diff --git a/gcn_classic_to_json/notices/SWIFT_BAT_QL_POS/__init__.py b/gcn_classic_to_json/notices/SWIFT_BAT_QL_POS/__init__.py new file mode 100644 index 0000000..5a25040 --- /dev/null +++ b/gcn_classic_to_json/notices/SWIFT_BAT_QL_POS/__init__.py @@ -0,0 +1,34 @@ +import numpy as np + +from ..SWIFT_BAT_GRB_POS_ACK import parse_swift_bat + + +def parse(bin): + bin[12:17] # Unused. According to docs: '20 bytes for the future' + bin[19] # Intentionally Omitted. According to docs: 'miscellaneous bits' + bin[20] # Unused. According to docs: '4 bytes for the future' + bin[22:38] # Unused. According to docs: '64 bytes for the future' + + lat, lon = bin[10:11].view(">i2") + + at_slew_bits = np.flip(np.unpackbits(bin[18:19].view(dtype="u1"))) + + at_slew_flag_descriptions = { + 0: "This burst is worthy of becoming the new Automated target.", + 1: "This burst is of sufficient merit to request a s/c slew.", + } + + comments = "".join( + [val for (key, val) in at_slew_flag_descriptions.items() if (at_slew_bits[key])] + ) + + return { + **parse_swift_bat(bin), + "latitude": lat * 1e-2, + "longitude": lon * 1e-2, + "ra_dec_error": 1e-4 * bin[11], + "roll": bin[9] * 1e-4, + "trigger_index": bin[17], + "merit_value": bin[38] * 1e-2, + "additional_info": comments if comments else None, + } diff --git a/gcn_classic_to_json/notices/SWIFT_BAT_QL_POS/example.json b/gcn_classic_to_json/notices/SWIFT_BAT_QL_POS/example.json new file mode 100644 index 0000000..e2b1557 --- /dev/null +++ b/gcn_classic_to_json/notices/SWIFT_BAT_QL_POS/example.json @@ -0,0 +1,18 @@ +{ + "mission": "SWIFT", + "instrument": "BAT", + "id": [ + 1227767 + ], + "trigger_time": "2024-05-11T18:06:53.340Z", + "ra": 336.66450000000003, + "dec": 8.5135, + "rate_snr": 14.89, + "latitude": -11.14, + "longitude": 151.31, + "ra_dec_error": 0.05, + "roll": 0.0, + "trigger_index": 262, + "merit_value": 100.0, + "additional_info": "This burst is worthy of becoming the new Automated target.This burst is of sufficient merit to request a s/c slew." +} diff --git a/gcn_classic_to_json/notices/SWIFT_BAT_SCALEDMAP/__init__.py b/gcn_classic_to_json/notices/SWIFT_BAT_SCALEDMAP/__init__.py new file mode 100644 index 0000000..6f9b75a --- /dev/null +++ b/gcn_classic_to_json/notices/SWIFT_BAT_SCALEDMAP/__init__.py @@ -0,0 +1,61 @@ +import numpy as np + +from ... import utils +from ..SWIFT_BAT_GRB_POS_ACK import parse_swift_bat + +start_tracker_status = ["locked", "not locked"] + + +def parse(bin): + bin[9:14] # Unused. According to docs: '20 bytes for the future' + bin[ + 17 + ] # Unused. According to docs: 'trig_index. This field is not yet (if ever) assigned.' + bin[19] # Unused. Flags are either internal or equivalent to bin[18] + + integ_time = bin[15] * 4 / 1000 # misc_bit has to be defined + + lat, lon = bin[16:17].view(">i2") + + soln_status_bits = np.flip(np.unpackbits(bin[18:19].view(dtype="u1"))) + + if soln_status_bits[11]: + grb_status = ( + "It is probably not a GRB or transient due to very low image significance" + ) + elif soln_status_bits[7]: + grb_status = ( + "It is probably not a GRB or transient due to low image significance" + ) + elif soln_status_bits[9]: + grb_status = ( + "It is probably not a GRB or transient due to negative background slope" + ) + elif soln_status_bits[6]: + grb_status = ( + "It is probably not a GRB or transient due to high background level" + ) + elif soln_status_bits[1]: + grb_status = "It is a GRB" + else: + grb_status = "It is not a GRB" + + return { + **parse_swift_bat(bin), + "alert_type": "retraction" if soln_status_bits[5] else "initial", + "latitude": lat * 1e-2, + "longitude": lon * 1e-2, + "foreground_duration": bin[14] * 1e-3, + "image_duration": integ_time if soln_status_bits[4] else None, + "rate_duration": integ_time if not soln_status_bits[4] else None, + "image_snr": bin[20] * 1e-2, + "grb_status": grb_status, + "point_source": bool(soln_status_bits[0]), + "flaring_known_source": bool(soln_status_bits[2]), + "star_tracker_status": start_tracker_status[soln_status_bits[10]], + "bright_star_nearby": bool(soln_status_bits[13]), + "originally_subtresh": bool(soln_status_bits[14]), + "removed_from_catalog": bool(soln_status_bits[15]), + "url": "http://gcn.gsfc.nasa.gov/gcn/notices_s/" + + utils.binary_to_string(bin[22:39]), + } diff --git a/gcn_classic_to_json/notices/SWIFT_BAT_SCALEDMAP/example.json b/gcn_classic_to_json/notices/SWIFT_BAT_SCALEDMAP/example.json new file mode 100644 index 0000000..5e3bfb3 --- /dev/null +++ b/gcn_classic_to_json/notices/SWIFT_BAT_SCALEDMAP/example.json @@ -0,0 +1,26 @@ +{ + "mission": "SWIFT", + "instrument": "BAT", + "id": [ + 1230423 + ], + "trigger_time": "2024-05-23T14:43:11.900Z", + "ra": 10.916400000000001, + "dec": 14.3419, + "rate_snr": 8.540000000000001, + "alert_type": "initial", + "latitude": 8.9, + "longitude": 279.27, + "foreground_duration": 4.095, + "image_duration": null, + "rate_duration": 4.096, + "image_snr": 8.5, + "grb_status": "It is a GRB", + "point_source": true, + "flaring_known_source": false, + "star_tracker_status": "locked", + "bright_star_nearby": false, + "originally_subtresh": false, + "removed_from_catalog": false, + "url": "http://gcn.gsfc.nasa.gov/gcn/notices_s/sw01230423000msbsm.fits" +} diff --git a/gcn_classic_to_json/notices/SWIFT_BAT_TRANS/__init__.py b/gcn_classic_to_json/notices/SWIFT_BAT_TRANS/__init__.py new file mode 100644 index 0000000..a609821 --- /dev/null +++ b/gcn_classic_to_json/notices/SWIFT_BAT_TRANS/__init__.py @@ -0,0 +1,81 @@ +import numpy as np + +from ... import utils +from ..SWIFT_BAT_GRB_POS_ACK import parse_swift_bat + +energy_ranges = [[15, 25], [15, 50], [25, 100], [50, 350]] +start_tracker_status = ["locked", "not locked"] + + +def parse(bin): + bin[15] # Unused. According to docs: '4 bytes for the future' + bin[19] # Unused. Flags are either internal or equivalent to bin[18] + bin[26:36] # Unused. According to docs: '40 bytes for the future' + bin[36] # Unused. Flags Equivalent to bin[18] + bin[38] # Intentionally omitted. Sun/Moon parameters + + integ_time = bin[14] * 4 / 1000 + + lat, lon = bin[16:17].view(">i2") + + soln_status_bits = np.flip(np.unpackbits(bin[18:19].view(dtype="u1"))) + + soln_status_bits[8] # Unused. According to docs: 'ground_catalog_source'. + soln_status_bits[12] # Unused. According to docs: 'blocked_catalog_source'. + # These seems to be cross-referenced with a ground catalog with the name of the source printed in the text notices. + # But since the name of this source isn't stored in the these packets, I don't see a reason to include it. + if soln_status_bits[11]: + grb_status = ( + "It is probably not a GRB or transient due to very low image significance" + ) + elif soln_status_bits[7]: + grb_status = ( + "It is probably not a GRB or transient due to low image significance" + ) + elif soln_status_bits[9]: + grb_status = ( + "It is probably not a GRB or transient due to negative background slope" + ) + elif soln_status_bits[6]: + grb_status = ( + "It is probably not a GRB or transient due to high background level" + ) + elif soln_status_bits[1]: + grb_status = "It is a GRB" + else: + grb_status = "It is not a GRB" + + calalog_num = bin[25] + + energy_range_idx = np.flip(bin[37:38].view(dtype="i1"))[0] + energy_range = energy_ranges[energy_range_idx] + + return { + **parse_swift_bat(bin), + "ra_dec_error": bin[11] * 1e-4, + "instrument_phi": bin[12] * 1e-4, + "instrument_theta": bin[13] * 1e-4, + "latitude": lat * 1e-2, + "longitude": lon * 1e-2, + "trigger_type": "image" if soln_status_bits[4] else "rate", + "image_duration": integ_time if soln_status_bits[4] else None, + "image_energy_range": energy_range if soln_status_bits[4] else None, + "rate_duration": integ_time if not soln_status_bits[4] else None, + "rate_energy_range": energy_range if not soln_status_bits[4] else None, + "rate_snr": bin[21] * 1e-2, + "image_snr": bin[20] * 1e-2, + "n_events": bin[9], + "image_peak": bin[10], + "background_events": bin[22], + "background_start_time": utils.datetime_to_iso8601(bin[5], bin[23]), + "backgroun_duration": bin[24] * 1e-2, + "trigger_index": bin[17], + "catalog_number": calalog_num if soln_status_bits[3] else None, + "grb_status": grb_status, + "point_source": bool(soln_status_bits[0]), + "flaring_known_source": bool(soln_status_bits[2]), + "star_tracker_status": start_tracker_status[soln_status_bits[10]], + "bright_star_nearby": bool(soln_status_bits[13]), + "temporal_coincidence": bool(soln_status_bits[28]), + "spatial_coincidence": bool(soln_status_bits[29]), + } diff --git a/gcn_classic_to_json/notices/SWIFT_BAT_TRANS/example.json b/gcn_classic_to_json/notices/SWIFT_BAT_TRANS/example.json new file mode 100644 index 0000000..b694396 --- /dev/null +++ b/gcn_classic_to_json/notices/SWIFT_BAT_TRANS/example.json @@ -0,0 +1,39 @@ +{ + "mission": "SWIFT", + "instrument": "BAT", + "id": [ + 1236151 + ], + "trigger_time": "2024-06-10T07:36:36.410Z", + "ra": 117.1755, + "dec": -67.804, + "rate_snr": 7.54, + "ra_dec_error": 0.05, + "instrument_phi": 0.6051000000000001, + "instrument_theta": 0.1106, + "latitude": -11.02, + "longitude": 68.08, + "trigger_type": "rate", + "image_duration": null, + "image_energy_range": null, + "rate_duration": 2.048, + "rate_energy_range": [ + 15, + 25 + ], + "image_snr": 6.59, + "n_events": 2700, + "image_peak": 127, + "background_events": 26505, + "background_start_time": "2024-06-10T07:35:58.390Z", + "backgroun_duration": 24.0, + "trigger_index": 244, + "catalog_number": 10324, + "grb_status": "It is probably not a GRB or transient due to low image significance", + "point_source": true, + "flaring_known_source": true, + "star_tracker_status": "locked", + "bright_star_nearby": false, + "temporal_coincidence": false, + "spatial_coincidence": false +} diff --git a/gcn_classic_to_json/test/test_notices.py b/gcn_classic_to_json/test/test_notices.py index c8fa286..864bb0d 100644 --- a/gcn_classic_to_json/test/test_notices.py +++ b/gcn_classic_to_json/test/test_notices.py @@ -11,12 +11,6 @@ files = importlib.resources.files(notices) -def keys_passing_except_for(*failing): - return list(set(notices.keys) - set(failing)) + [ - pytest.param(item, marks=pytest.mark.xfail) for item in failing - ] - - class NDArrayNanny(np.ndarray): """A ndarray subclass that tracks which elements have been accessed. @@ -44,10 +38,7 @@ def __getitem__(self, i): return super().__getitem__(i) -@pytest.mark.parametrize( - "key", - keys_passing_except_for("SWIFT_BAT_GRB_POS_ACK"), -) +@pytest.mark.parametrize("key", notices.keys) def test_all_fields_used(key, monkeypatch): """Check that every field in the binary packet is used in the conversion."""