Skip to content

Commit

Permalink
automatic update
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoda-esg-bot committed Nov 27, 2024
1 parent d07dbe0 commit c840c85
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<requirement type="package" version="3.9.2">matplotlib</requirement>
<requirement type="package" version="1.26.4">numpy</requirement>
<requirement type="package" version="1.14.1">scipy</requirement>
<requirement type="package" version="6.1.6">astropy</requirement>
<requirement type="package" version="7.0.0">astropy</requirement>
<requirement type="package" version="2.5.1">pytorch-cpu</requirement>
<requirement type="package" version="0.33.0">accelerate</requirement>
<requirement type="package" version="4.43.2">transformers</requirement>
Expand Down
9 changes: 6 additions & 3 deletions tools/analyse-short-astro-text/pipeline_astrobert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down Expand Up @@ -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
52 changes: 22 additions & 30 deletions tools/analyse-short-astro-text/pipeline_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit c840c85

Please sign in to comment.