From 2d0d60e1c5af2c583acbcaa4a98e06c47d4bad27 Mon Sep 17 00:00:00 2001 From: Athish Thiruvengadam Date: Thu, 19 Sep 2024 17:22:34 -0500 Subject: [PATCH 1/4] A series of bug fixes removed utils.py small fix updated trigger_date parsing and calet jsons creation editted conversion.py to deal with inputs that have no 'additional' dictionary Fixed ra/dec parsing to be seperate Updated alexis conversion updated poetry updated all modules for search_string --- gcn_classic_text_to_json/conversion.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gcn_classic_text_to_json/conversion.py b/gcn_classic_text_to_json/conversion.py index fbb7eca..da16417 100644 --- a/gcn_classic_text_to_json/conversion.py +++ b/gcn_classic_text_to_json/conversion.py @@ -123,14 +123,18 @@ def text_to_json(notice, keywords_dict): notice_ra = keywords_dict["standard"]["ra"] ra_data = notice[notice_ra].split() - if ra_data[0] != "Undefined": + if ra_data[0] == "Undefined": + output["ra"] = None + else: output["ra"] = float(ra_data[0][:-1]) if "dec" in keywords_dict["standard"]: notice_dec = keywords_dict["standard"]["dec"] dec_data = notice[notice_dec].split() - if dec_data[0] != "Undefined": + if dec_data[0] == "Undefined": + output["dec"] = None + else: output["dec"] = float(dec_data[0][:-1]) if "additional" in keywords_dict: From 12994cf6a61650e226396c044b4fdc364b463e8b Mon Sep 17 00:00:00 2001 From: Athish Thiruvengadam Date: Fri, 20 Sep 2024 15:45:51 -0500 Subject: [PATCH 2/4] LVC Text conversion updated general parsing function to deal with empty strings LVC conversion deals with all notice types Added $schema field --- gcn_classic_text_to_json/conversion.py | 3 + .../notices/alexis/README.md | 18 --- .../notices/alexis/__main__.py | 4 - .../notices/gecam/README.md | 26 ---- .../notices/gecam/__main__.py | 4 - .../{alexis/__init__.py => lvc/README.md} | 0 .../notices/{gecam => lvc}/__init__.py | 0 .../notices/{snews => lvc}/__main__.py | 2 +- .../notices/lvc/conversion.py | 143 ++++++++++++++++++ .../notices/sk_sn/README.md | 19 --- .../notices/sk_sn/__init__.py | 0 .../notices/sk_sn/__main__.py | 4 - .../notices/snews/README.md | 17 --- .../notices/snews/__init__.py | 0 14 files changed, 147 insertions(+), 93 deletions(-) delete mode 100644 gcn_classic_text_to_json/notices/alexis/README.md delete mode 100644 gcn_classic_text_to_json/notices/alexis/__main__.py delete mode 100644 gcn_classic_text_to_json/notices/gecam/README.md delete mode 100644 gcn_classic_text_to_json/notices/gecam/__main__.py rename gcn_classic_text_to_json/notices/{alexis/__init__.py => lvc/README.md} (100%) rename gcn_classic_text_to_json/notices/{gecam => lvc}/__init__.py (100%) rename gcn_classic_text_to_json/notices/{snews => lvc}/__main__.py (56%) create mode 100644 gcn_classic_text_to_json/notices/lvc/conversion.py delete mode 100644 gcn_classic_text_to_json/notices/sk_sn/README.md delete mode 100644 gcn_classic_text_to_json/notices/sk_sn/__init__.py delete mode 100644 gcn_classic_text_to_json/notices/sk_sn/__main__.py delete mode 100644 gcn_classic_text_to_json/notices/snews/README.md delete mode 100644 gcn_classic_text_to_json/notices/snews/__init__.py diff --git a/gcn_classic_text_to_json/conversion.py b/gcn_classic_text_to_json/conversion.py index da16417..9de01cd 100644 --- a/gcn_classic_text_to_json/conversion.py +++ b/gcn_classic_text_to_json/conversion.py @@ -33,6 +33,9 @@ def parse_trigger_links(link, prefix, regex_string): The webpage with the trigger links listed. prefix: string The prefix to be added to the incomplete link. + regex_string: string + Regex string to search for while looking through links. + The prefix to be added to the incomplete link. regex_string: string Regex string to search for while looking through links. diff --git a/gcn_classic_text_to_json/notices/alexis/README.md b/gcn_classic_text_to_json/notices/alexis/README.md deleted file mode 100644 index 6c3c351..0000000 --- a/gcn_classic_text_to_json/notices/alexis/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# ALEXIS text conversion - -Parses through the table associated with all ALEXIS triggers and creates a JSON with GCN schema keywords. Creates a `alexis_jsons` directory inside an `output` directory and saves jsons as `ALEXIS_{serial_number}.json` where serial_number is a random iterating number with no association to the notices. - -### Uses the following fields from the core schema for text notice fields -- `alert_datetime` → Date and Time UT -- `ra` → RA -- `dec` → Dec -- `ra_dec_error` → Error -- `containment_probability` → mentioned in mission description -- `systematic_included` → mentioned in mission description - -### Defines the following new fields for the text notice fields -- `map_duration` → Dur -- `notice_type` → Type -- `alpha` → Alpha -- `telescope_id` → Tele -- `energy_bandpass` → mentioned in mission description diff --git a/gcn_classic_text_to_json/notices/alexis/__main__.py b/gcn_classic_text_to_json/notices/alexis/__main__.py deleted file mode 100644 index 6faccf5..0000000 --- a/gcn_classic_text_to_json/notices/alexis/__main__.py +++ /dev/null @@ -1,4 +0,0 @@ -from . import conversion - -if __name__ == "__main__": - conversion.create_all_alexis_jsons() diff --git a/gcn_classic_text_to_json/notices/gecam/README.md b/gcn_classic_text_to_json/notices/gecam/README.md deleted file mode 100644 index 3a060a1..0000000 --- a/gcn_classic_text_to_json/notices/gecam/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# GECAM Text Conversion - -Parses through all webpages with GECAM text notices and creates a JSON with GCN schema keywords. Creates a `gecam_jsons` directory inside an `output` directory and saves jsons as `GECAM_{serial_number}_{record_number}.json` where serial_number is a random iterating number with no association to the notices and record_number is the current notice in the webpage. - -### Uses the following fields from the core schema for text notice fields -- `id` → TRIGGER_NUMBER -- `ra` → SRC_RA -- `dec` → SRC_DEC -- `ra_dec_error` → SRC_ERROR68 -- `alert_datetime` → NOTICE_DATE -- `trigger_time` → EVENT_DATE/EVENT_TIME -- `net_count_rate` → BURST_INTEN -- `rate_duration` → BURST_DUR -- `rate_snr` → TRIGGER_SIGNIF -- `rate_energy_range` → TRIGGER_ERANGE -- `classification` → SRC_CLASS -- `instrument_phi` → PHI -- `instrument_theta` → THETA -- `latitude` → SC_LAT -- `longitude` → SC_LON - -### Defines the following new fields for the text notice fields -- `notice_type` → NOTICE_TYPE -- `mission_type` → MISSION -- `trigger_duration` → TRIGGER_DUR -- `detector_status` → TRIGGER_DETS diff --git a/gcn_classic_text_to_json/notices/gecam/__main__.py b/gcn_classic_text_to_json/notices/gecam/__main__.py deleted file mode 100644 index 395914c..0000000 --- a/gcn_classic_text_to_json/notices/gecam/__main__.py +++ /dev/null @@ -1,4 +0,0 @@ -from . import conversion - -if __name__ == "__main__": - conversion.create_all_gecam_jsons() diff --git a/gcn_classic_text_to_json/notices/alexis/__init__.py b/gcn_classic_text_to_json/notices/lvc/README.md similarity index 100% rename from gcn_classic_text_to_json/notices/alexis/__init__.py rename to gcn_classic_text_to_json/notices/lvc/README.md diff --git a/gcn_classic_text_to_json/notices/gecam/__init__.py b/gcn_classic_text_to_json/notices/lvc/__init__.py similarity index 100% rename from gcn_classic_text_to_json/notices/gecam/__init__.py rename to gcn_classic_text_to_json/notices/lvc/__init__.py diff --git a/gcn_classic_text_to_json/notices/snews/__main__.py b/gcn_classic_text_to_json/notices/lvc/__main__.py similarity index 56% rename from gcn_classic_text_to_json/notices/snews/__main__.py rename to gcn_classic_text_to_json/notices/lvc/__main__.py index e2a387d..5bdf3ed 100644 --- a/gcn_classic_text_to_json/notices/snews/__main__.py +++ b/gcn_classic_text_to_json/notices/lvc/__main__.py @@ -1,4 +1,4 @@ from . import conversion if __name__ == "__main__": - conversion.create_all_snews_jsons() + conversion.create_all_lvc_jsons() diff --git a/gcn_classic_text_to_json/notices/lvc/conversion.py b/gcn_classic_text_to_json/notices/lvc/conversion.py new file mode 100644 index 0000000..e57a499 --- /dev/null +++ b/gcn_classic_text_to_json/notices/lvc/conversion.py @@ -0,0 +1,143 @@ +import email +import json +import os + +import requests + +from ... import conversion + +input = { + "standard": { + "alert_datetime": "NOTICE_DATE", + "trigger_datetime": ["TRIGGER_DATE", "TRIGGER_TIME"], + }, + "additional": { + "record_number": ("SEQUENCE_NUM", "int"), + "far": ("FAR", "float"), + "healpix_url": ("SKYMAP_FITS_URL", "string"), + "eventpage_url": ("EVENTPAGE_URL", "string"), + }, +} + +input_retract = { + "standard": { + "alert_datetime": "NOTICE_DATE", + "trigger_datetime": ["TRIGGER_DATE", "TRIGGER_TIME"], + }, + "additional": { + "record_number": ("SEQUENCE_NUM", "int"), + }, +} + + +def text_to_json_lvc(notice, input): + """Function calls text_to_json and then adds additional fields depening on whether notice is CBC or Burst. + + Parameters + ----------- + notice: dict + The text notice that is being parsed. + input: dict + Mapping between text notice keywords and JSON keywords + + Returns + ------- + dictionary + A dictionary compliant with the associated schema for the mission.""" + if notice["NOTICE_TYPE"].split()[1] == "Retraction": + output_dict = conversion.text_to_json(notice, input_retract) + output_dict["$schema"] = ( + "https://gcn.nasa.gov/schema/main/gcn/notices/classic/lvc/alert.schema.json" + ) + output_dict["id"] = [notice["TRIGGER_NUM"]] + output_dict["notice_type"] = "Retraction" + return output_dict + + output_dict = conversion.text_to_json(notice, input) + + output_dict["$schema"] = ( + "https://gcn.nasa.gov/schema/main/gcn/notices/classic/lvc/alert.schema.json" + ) + output_dict["mission"] = "LVK" + output_dict["messenger"] = "GW" + + output_dict["id"] = [notice["TRIGGER_NUM"]] + output_dict["notice_type"] = notice["NOTICE_TYPE"].split()[1] + + output_dict["group"] = notice["GROUP_TYPE"].split()[-1] + output_dict["search"] = notice["SEARCH_TYPE"].split()[-1] + output_dict["pipeline"] = notice["PIPELINE_TYPE"].split()[-1] + + if "CENTRAL_FREQ" in notice: + output_dict["central_frequency"] = float(notice["CENTRAL_FREQ"].split()[0]) + if "DURATION" in notice: + output_dict["duration"] = float(notice["DURATION"].split()[0]) + + if "CHIRP_MASS" in notice: + output_dict["chirp_mass"] = float(notice["CHIRP_MASS"].split()[0]) + if "ETA" in notice: + output_dict["eta"] = float(notice["ETA"].split()[0]) + if "MAX_DIST" in notice: + output_dict["max_dist"] = float(notice["MAX_DIST"].split()[0]) + + classification = {} + if "PROB_BNS" in notice: + classification["BNS"] = float(notice["PROB_BNS"].split()[0]) + if "PROB_NSBH" in notice: + classification["NSBH"] = float(notice["PROB_NSBH"].split()[0]) + if "PROB_BBH" in notice: + classification["BBH"] = float(notice["PROB_BBH"].split()[0]) + if "PROB_TERRES" in notice: + classification["Terrestrial"] = float(notice["PROB_TERRES"].split()[0]) + output_dict["p_astro"] = 1 - float(notice["PROB_TERRES"].split()[0]) + + if classification: + output_dict["classification"] = classification + + properties = {} + if "PROB_NS" in notice: + properties["HasNS"] = float(notice["PROB_NS"].split()[0]) + if "PROB_REMNANT" in notice: + properties["HasRemnant"] = float(notice["PROB_REMNANT"].split()[0]) + if "PROB_MassGap" in notice: + properties["HasMassGa[]"] = float(notice["PROB_MassGap"].split()[0]) + + if properties: + output_dict["properties"] = properties + + return output_dict + + +def create_all_lvc_jsons(): + """Creates a `lvc_json` directory and fills it with the json for all LVC triggers.""" + output_path = "./output/lvc_jsons/" + if not os.path.exists(output_path): + os.makedirs(output_path) + + archive_link = "https://gcn.gsfc.nasa.gov/lvc_events.html" + prefix = "https://gcn.gsfc.nasa.gov/" + search_string = "notices_l/.*lvc" + links_set = conversion.parse_trigger_links(archive_link, prefix, search_string) + links_list = list(links_set) + + for sernum in range(len(links_list)): + link = links_list[sernum] + data = requests.get(link).text + + start_idx = data.find("\n") + 1 + while True: + end_idx = data.find("\n \n ", start_idx) + notice_message = email.message_from_string(data[start_idx:end_idx].strip()) + comment = "\n".join(notice_message.get_all("COMMENTS")) + notice_dict = dict(notice_message) + notice_dict["COMMENTS"] = comment + + output = text_to_json_lvc(notice_dict, input) + + with open(f"{output_path}LVC_{sernum+1}.json", "w") as f: + json.dump(output, f) + + temp_start_idx = data.find("///////////", end_idx) + start_idx = data.find("\n", temp_start_idx) + if temp_start_idx == -1: + break diff --git a/gcn_classic_text_to_json/notices/sk_sn/README.md b/gcn_classic_text_to_json/notices/sk_sn/README.md deleted file mode 100644 index 719e9ac..0000000 --- a/gcn_classic_text_to_json/notices/sk_sn/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# SuperKamiokande_SuperNova Text Conversion - -Parses through all webpages with SK_SN text notices and creates a JSON with GCN schema keywords. Creates a `sk_sn_jsons` directory inside an `output` directory and saves jsons as `SK_SN_{serial_number}.json` where serial_number is a random iterating number with no association to the notices. - -### Uses the following fields from the core schema for text notice fields -- `id` → TRIGGER_NUMBER -- `ra` → SRC_RA -- `dec` → SRC_DEC -- `alert_datetime` → NOTICE_DATE -- `trigger_time` → DISCOVERY_DATE, DISCOVERY_TIME -- `ra_dec_error` → SRC_ERROR90 - -### Defines the following new fields for the text notice fields -- `ra_dec_error_68` → SRC_ERROR68 -- `ra_dec_error_95` → SRC_ERROR95 -- `n_events` → N_EVENTS -- `duration` → COLLECTION_DURATION -- `energy_limit` → ENERGY_LIMIT -- `distance_range` → DISTANCE diff --git a/gcn_classic_text_to_json/notices/sk_sn/__init__.py b/gcn_classic_text_to_json/notices/sk_sn/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/gcn_classic_text_to_json/notices/sk_sn/__main__.py b/gcn_classic_text_to_json/notices/sk_sn/__main__.py deleted file mode 100644 index f799020..0000000 --- a/gcn_classic_text_to_json/notices/sk_sn/__main__.py +++ /dev/null @@ -1,4 +0,0 @@ -from . import conversion as sk_sn_conversion - -if __name__ == "__main__": - sk_sn_conversion.create_all_sk_sn_jsons() diff --git a/gcn_classic_text_to_json/notices/snews/README.md b/gcn_classic_text_to_json/notices/snews/README.md deleted file mode 100644 index 96a204f..0000000 --- a/gcn_classic_text_to_json/notices/snews/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# SNEWS Text Conversion - -Parses through all webpages with SNEWS text notices and creates a JSON with GCN schema keywords. Creates a `snews_jsons` directory inside an `output` directory and saves jsons as `SNEWS_{serial_number}.json` where serial_number is a random iterating number with no association to the notices. - -### Uses the following fields from the core schema for text notice fields -- `id` → TRIGGER_NUM -- `ra` → EVENT_RA/EVT_RA -- `dec` → EVENT_DEC/EVT_DEC -- `alert_datetime` → NOTICE_DATE -- `trigger_time` → EVENT_DATE/EVT_DATE, EVENT_TIME/EVT_TIME -- `ra_dec_error` → EVENT_ERROR/EVT_ERROR -- `containment_probability` → EVENT_ERROR - -### Defines the following new fields for the text notice fields -- `n_events` → EVENT_FLUENCE/EVT_FLUENCE -- `duration` → EVENT_DUR/EVT_DUR -- `detector_quality` → EXPT diff --git a/gcn_classic_text_to_json/notices/snews/__init__.py b/gcn_classic_text_to_json/notices/snews/__init__.py deleted file mode 100644 index e69de29..0000000 From 8b9c38d1a594b8f4f154206c25ec54ab91c6c965 Mon Sep 17 00:00:00 2001 From: Athish Thiruvengadam Date: Wed, 23 Oct 2024 19:07:53 -0500 Subject: [PATCH 3/4] added missing files updated README --- .../notices/alexis/README.md | 18 +++++++++++++ .../notices/alexis/__main__.py | 4 +++ .../notices/gecam/README.md | 26 +++++++++++++++++++ .../notices/gecam/__main__.py | 4 +++ .../notices/lvc/README.md | 24 +++++++++++++++++ .../notices/sk_sn/README.md | 19 ++++++++++++++ .../notices/sk_sn/__init__.py | 0 .../notices/sk_sn/__main__.py | 4 +++ .../notices/snews/README.md | 17 ++++++++++++ .../notices/snews/__init__.py | 0 10 files changed, 116 insertions(+) create mode 100644 gcn_classic_text_to_json/notices/alexis/README.md create mode 100644 gcn_classic_text_to_json/notices/alexis/__main__.py create mode 100644 gcn_classic_text_to_json/notices/gecam/README.md create mode 100644 gcn_classic_text_to_json/notices/gecam/__main__.py create mode 100644 gcn_classic_text_to_json/notices/sk_sn/README.md create mode 100644 gcn_classic_text_to_json/notices/sk_sn/__init__.py create mode 100644 gcn_classic_text_to_json/notices/sk_sn/__main__.py create mode 100644 gcn_classic_text_to_json/notices/snews/README.md create mode 100644 gcn_classic_text_to_json/notices/snews/__init__.py diff --git a/gcn_classic_text_to_json/notices/alexis/README.md b/gcn_classic_text_to_json/notices/alexis/README.md new file mode 100644 index 0000000..6c3c351 --- /dev/null +++ b/gcn_classic_text_to_json/notices/alexis/README.md @@ -0,0 +1,18 @@ +# ALEXIS text conversion + +Parses through the table associated with all ALEXIS triggers and creates a JSON with GCN schema keywords. Creates a `alexis_jsons` directory inside an `output` directory and saves jsons as `ALEXIS_{serial_number}.json` where serial_number is a random iterating number with no association to the notices. + +### Uses the following fields from the core schema for text notice fields +- `alert_datetime` → Date and Time UT +- `ra` → RA +- `dec` → Dec +- `ra_dec_error` → Error +- `containment_probability` → mentioned in mission description +- `systematic_included` → mentioned in mission description + +### Defines the following new fields for the text notice fields +- `map_duration` → Dur +- `notice_type` → Type +- `alpha` → Alpha +- `telescope_id` → Tele +- `energy_bandpass` → mentioned in mission description diff --git a/gcn_classic_text_to_json/notices/alexis/__main__.py b/gcn_classic_text_to_json/notices/alexis/__main__.py new file mode 100644 index 0000000..6faccf5 --- /dev/null +++ b/gcn_classic_text_to_json/notices/alexis/__main__.py @@ -0,0 +1,4 @@ +from . import conversion + +if __name__ == "__main__": + conversion.create_all_alexis_jsons() diff --git a/gcn_classic_text_to_json/notices/gecam/README.md b/gcn_classic_text_to_json/notices/gecam/README.md new file mode 100644 index 0000000..3a060a1 --- /dev/null +++ b/gcn_classic_text_to_json/notices/gecam/README.md @@ -0,0 +1,26 @@ +# GECAM Text Conversion + +Parses through all webpages with GECAM text notices and creates a JSON with GCN schema keywords. Creates a `gecam_jsons` directory inside an `output` directory and saves jsons as `GECAM_{serial_number}_{record_number}.json` where serial_number is a random iterating number with no association to the notices and record_number is the current notice in the webpage. + +### Uses the following fields from the core schema for text notice fields +- `id` → TRIGGER_NUMBER +- `ra` → SRC_RA +- `dec` → SRC_DEC +- `ra_dec_error` → SRC_ERROR68 +- `alert_datetime` → NOTICE_DATE +- `trigger_time` → EVENT_DATE/EVENT_TIME +- `net_count_rate` → BURST_INTEN +- `rate_duration` → BURST_DUR +- `rate_snr` → TRIGGER_SIGNIF +- `rate_energy_range` → TRIGGER_ERANGE +- `classification` → SRC_CLASS +- `instrument_phi` → PHI +- `instrument_theta` → THETA +- `latitude` → SC_LAT +- `longitude` → SC_LON + +### Defines the following new fields for the text notice fields +- `notice_type` → NOTICE_TYPE +- `mission_type` → MISSION +- `trigger_duration` → TRIGGER_DUR +- `detector_status` → TRIGGER_DETS diff --git a/gcn_classic_text_to_json/notices/gecam/__main__.py b/gcn_classic_text_to_json/notices/gecam/__main__.py new file mode 100644 index 0000000..395914c --- /dev/null +++ b/gcn_classic_text_to_json/notices/gecam/__main__.py @@ -0,0 +1,4 @@ +from . import conversion + +if __name__ == "__main__": + conversion.create_all_gecam_jsons() diff --git a/gcn_classic_text_to_json/notices/lvc/README.md b/gcn_classic_text_to_json/notices/lvc/README.md index e69de29..e1fbbf4 100644 --- a/gcn_classic_text_to_json/notices/lvc/README.md +++ b/gcn_classic_text_to_json/notices/lvc/README.md @@ -0,0 +1,24 @@ +# LVC Text Conversion + +Parses through all the webpages with LVC text notices and creates a JSON with GCN schema keywords. Creates a `lvc_jsons` directory inside an `output` directory and saves jsons as `LVC_{serial_number}.json` where serial_number is a random iterating number with no association to the notices. + +### Uses the following fields from the core schema for text notice fields +- `id` → TRIGGER_NUM +- `alert_datetime` → NOTICE_DATE +- `trigger_time` → TRIGGER_DATE, TRIGGER_TIME +- `record_number` → SEQUENCE_NUM +- `healpix_url` → SKYMAP_FITS_URL +- `far` → FAR + +### Defines the following new fields for the text notice fields +- `eventpage_url` → EVENTPAGE_URL, +- `group` → GROUP_TYPE +- `search` → SEARCH_TYPE +- `pipeline` → PIPELINE_TYPE +- `central_frequency` → CENTRAL_FREQ +- `duration` → DURATION +- `chirp_mass` → CHIRP_MASS +- `eta` → ETA +- `max_dist` → MAX_DIST +- `classification` → PROB_BNS, PROB_NSBH, PROB_BBH, PROB_TERRES +- `properties` → PROB_NS, PROB_REMNANT, PROB_MassGap diff --git a/gcn_classic_text_to_json/notices/sk_sn/README.md b/gcn_classic_text_to_json/notices/sk_sn/README.md new file mode 100644 index 0000000..719e9ac --- /dev/null +++ b/gcn_classic_text_to_json/notices/sk_sn/README.md @@ -0,0 +1,19 @@ +# SuperKamiokande_SuperNova Text Conversion + +Parses through all webpages with SK_SN text notices and creates a JSON with GCN schema keywords. Creates a `sk_sn_jsons` directory inside an `output` directory and saves jsons as `SK_SN_{serial_number}.json` where serial_number is a random iterating number with no association to the notices. + +### Uses the following fields from the core schema for text notice fields +- `id` → TRIGGER_NUMBER +- `ra` → SRC_RA +- `dec` → SRC_DEC +- `alert_datetime` → NOTICE_DATE +- `trigger_time` → DISCOVERY_DATE, DISCOVERY_TIME +- `ra_dec_error` → SRC_ERROR90 + +### Defines the following new fields for the text notice fields +- `ra_dec_error_68` → SRC_ERROR68 +- `ra_dec_error_95` → SRC_ERROR95 +- `n_events` → N_EVENTS +- `duration` → COLLECTION_DURATION +- `energy_limit` → ENERGY_LIMIT +- `distance_range` → DISTANCE diff --git a/gcn_classic_text_to_json/notices/sk_sn/__init__.py b/gcn_classic_text_to_json/notices/sk_sn/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/gcn_classic_text_to_json/notices/sk_sn/__main__.py b/gcn_classic_text_to_json/notices/sk_sn/__main__.py new file mode 100644 index 0000000..f799020 --- /dev/null +++ b/gcn_classic_text_to_json/notices/sk_sn/__main__.py @@ -0,0 +1,4 @@ +from . import conversion as sk_sn_conversion + +if __name__ == "__main__": + sk_sn_conversion.create_all_sk_sn_jsons() diff --git a/gcn_classic_text_to_json/notices/snews/README.md b/gcn_classic_text_to_json/notices/snews/README.md new file mode 100644 index 0000000..96a204f --- /dev/null +++ b/gcn_classic_text_to_json/notices/snews/README.md @@ -0,0 +1,17 @@ +# SNEWS Text Conversion + +Parses through all webpages with SNEWS text notices and creates a JSON with GCN schema keywords. Creates a `snews_jsons` directory inside an `output` directory and saves jsons as `SNEWS_{serial_number}.json` where serial_number is a random iterating number with no association to the notices. + +### Uses the following fields from the core schema for text notice fields +- `id` → TRIGGER_NUM +- `ra` → EVENT_RA/EVT_RA +- `dec` → EVENT_DEC/EVT_DEC +- `alert_datetime` → NOTICE_DATE +- `trigger_time` → EVENT_DATE/EVT_DATE, EVENT_TIME/EVT_TIME +- `ra_dec_error` → EVENT_ERROR/EVT_ERROR +- `containment_probability` → EVENT_ERROR + +### Defines the following new fields for the text notice fields +- `n_events` → EVENT_FLUENCE/EVT_FLUENCE +- `duration` → EVENT_DUR/EVT_DUR +- `detector_quality` → EXPT diff --git a/gcn_classic_text_to_json/notices/snews/__init__.py b/gcn_classic_text_to_json/notices/snews/__init__.py new file mode 100644 index 0000000..e69de29 From 44abdf5d0509b24d36872f79018b52ddead7dee9 Mon Sep 17 00:00:00 2001 From: Athish Thiruvengadam Date: Wed, 23 Oct 2024 22:25:31 -0500 Subject: [PATCH 4/4] added another missing file --- gcn_classic_text_to_json/notices/gecam/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 gcn_classic_text_to_json/notices/gecam/__init__.py diff --git a/gcn_classic_text_to_json/notices/gecam/__init__.py b/gcn_classic_text_to_json/notices/gecam/__init__.py new file mode 100644 index 0000000..e69de29