Skip to content

Commit e50e9e1

Browse files
committed
Correct some comments
1 parent 2455ae6 commit e50e9e1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

nuclearmasses/ame_mass_parse.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def read_file(self) -> pd.DataFrame:
7878
"""Read the file using it's known format
7979
8080
The AMEMassFile and other functions in this class have hopefully sanitized the
81-
column names, data types and locations of the date so we can not make the generic
81+
column names, data types and locations of the date so we can now make the generic
8282
call to parse the file.
8383
"""
8484
try:
@@ -104,7 +104,6 @@ def read_file(self) -> pd.DataFrame:
104104
# Isomeric states are sometimes included in this version of the file
105105
# For each row in the dataframe, if the previous row has equal A and Z, drop the current row
106106
df = df[~((df['A'] == df['A'].shift()) & (df['Z'] == df['Z'].shift()))]
107-
# Total binding energy is recorded in this years file so convert to per A to match the other years
108107

109108
if self.year == 1983 or self.year == 1993 or self.year == 1995:
110109
df["BindingEnergyPerA"] = df["BindingEnergyPerA"].astype(float) / df['A'].astype(float)

nuclearmasses/nubase_parse.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,21 +142,22 @@ def read_file(self) -> pd.DataFrame:
142142
)
143143
# We use the NUBASE data to define whether or not an isotope is experimentally measured,
144144
df['Experimental'] = ~df["NUBASEMassExcess"].astype("string").str.contains('#', na=False)
145+
# Once we have used the '#' to determine if it's experimental or not, we can remove all instances of it
145146
df.replace("#", "", regex=True, inplace=True)
146147

147148
df["TableYear"] = self.year
148149
df["N"] = pd.to_numeric(df["A"]) - pd.to_numeric(df["Z"])
149150
df["Symbol"] = pd.to_numeric(df["Z"]).map(self.z_to_symbol)
150151
# For the moment, we will ignore anything this is not the ground state
151152
df = df[df["State"] == 0]
152-
# As 'State' is now necessarily 0 and the Isomer columns are empty. Drop them.
153+
# As 'State' is now necessarily 0 and the Isomer columns are empty, drop them.
153154
df = df.drop(columns=['State', 'IsomerEnergy', 'IsomerEnergyError'])
154155

155156
# Convert stable isotopes into ones with enormous lifetimes with zero error so we can cast
156157
df.loc[df['HalfLifeValue'] == 'stbl', ['HalfLifeValue', 'HalfLifeUnit', 'HalfLifeError']] = [99.99, 'Zy', 0.0]
157158

158159
df['HalfLifeValue'] = df['HalfLifeValue'].astype("string").str.replace(r'[<>?~]','', regex=True)
159-
# We'll be lazy here an remove any characters in this column. Future us will parse this properly
160+
# We'll be lazy here and remove any characters in this column. Future us will parse this properly
160161
df['HalfLifeError'] = df['HalfLifeError'].astype("string").str.replace(r'[<>?~a-z]','', regex=True)
161162

162163
return df.astype(self._data_types())

0 commit comments

Comments
 (0)