diff --git a/tools/analyse-short-astro-text/analyse_short_astro_text_astro_tool.xml b/tools/analyse-short-astro-text/analyse_short_astro_text_astro_tool.xml index 3bc3687d..07f6cd59 100644 --- a/tools/analyse-short-astro-text/analyse_short_astro_text_astro_tool.xml +++ b/tools/analyse-short-astro-text/analyse_short_astro_text_astro_tool.xml @@ -9,7 +9,7 @@ matplotlib numpy scipy - astropy + astropy pytorch-cpu accelerate transformers diff --git a/tools/analyse-short-astro-text/pipeline_astrobert.py b/tools/analyse-short-astro-text/pipeline_astrobert.py index f6b5897d..3b4cff21 100644 --- a/tools/analyse-short-astro-text/pipeline_astrobert.py +++ b/tools/analyse-short-astro-text/pipeline_astrobert.py @@ -88,12 +88,12 @@ def get_astroBERT_cleaned_result(text_id, body_text_0): df_tmp1 = df_tmp0[df_tmp0["Phrase"]==phrase_] if len(df_tmp1) == 1: dict_out["TEXT_ID"].append(text_id) + dict_out["Phrase"].append(df_tmp1.Phrase.values[0]) dict_out["word"].append(df_tmp1.word.values[0]) - dict_out["Score"].append(df_tmp1.score.values[0]) - dict_out["entity_group"].append(entity_to_study) dict_out["start"].append(df_tmp1.start.values[0]) dict_out["end"].append(df_tmp1.end.values[0]) - dict_out["Phrase"].append(df_tmp1.Phrase.values[0]) + dict_out["Score"].append(df_tmp1.score.values[0]) + dict_out["entity_group"].append(entity_to_study) else: df_tmp1.sort_values(by=['start']) @@ -137,3 +137,6 @@ def get_astroBERT_cleaned_result(text_id, body_text_0): dict_out["entity_group"].append(entity_to_study) return pd.DataFrame(dict_out) + + +def clean_ra_dec \ No newline at end of file diff --git a/tools/analyse-short-astro-text/pipeline_sources.py b/tools/analyse-short-astro-text/pipeline_sources.py index 047aa981..5c8ee6c6 100644 --- a/tools/analyse-short-astro-text/pipeline_sources.py +++ b/tools/analyse-short-astro-text/pipeline_sources.py @@ -209,36 +209,28 @@ def rule_based_source_detector(atel_, atel_text): if source_.replace(" ","").lower() not in atel_sources: atel_sources.append(source_) + atel_sources = list(set(atel_sources)) if len(atel_sources) != 0: - atel_sources = list(set(atel_sources)) - if "at2018xyz" in atel_sources: - atel_sources.remove("at2018xyz") - if "asassn18xx" in atel_sources: - atel_sources.remove("asassn18xx") - - if len(atel_sources) != 0: - - otype_list = [] - mainid_list = [] - ra_list = [] - dec_list = [] - for source_name in atel_sources: - - dict_otype = query_simbad(source_name) - if dict_otype[source_name]["MAIN_ID"] == None: - dict_otype = query_tns(source_name) - if dict_otype[source_name]["MAIN_ID"] == None: - dict_otype = query_fink(source_name) - - mainid_list.append(dict_otype[source_name]["MAIN_ID"]) - otype_list.append(dict_otype[source_name]["OTYPES"]) - ra_list.append(dict_otype[source_name]["RA"]) - dec_list.append(dict_otype[source_name]["DEC"]) - - dict_data = {"ATELNO": [atel_] * len(atel_sources), "Raw Source Name": atel_sources, "Main ID Name": mainid_list, "OTYPE": otype_list, "RA": ra_list, "Dec": dec_list} - - df_save = pd.DataFrame(dict_data) - df_save.replace({None: "NotKnown"}, inplace=True) - return df_save + otype_list = [] + mainid_list = [] + ra_list = [] + dec_list = [] + for source_name in atel_sources: + + dict_otype = query_simbad(source_name) + if dict_otype[source_name]["MAIN_ID"] == None: + dict_otype = query_tns(source_name) + if dict_otype[source_name]["MAIN_ID"] == None: + dict_otype = query_fink(source_name) + + mainid_list.append(dict_otype[source_name]["MAIN_ID"]) + otype_list.append(dict_otype[source_name]["OTYPES"]) + ra_list.append(dict_otype[source_name]["RA"]) + dec_list.append(dict_otype[source_name]["DEC"]) + + dict_data = {"ATELNO": [atel_] * len(atel_sources), "Raw Source Name": atel_sources, "Main ID Name": mainid_list, "OTYPE": otype_list, "RA": ra_list, "Dec": dec_list} + df_save = pd.DataFrame(dict_data) + df_save.replace({None: "NotKnown"}, inplace=True) + return df_save return pd.DataFrame()