Skip to content

Commit

Permalink
Updating column name to access_url
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-rodriguez committed Apr 30, 2024
1 parent 938df6e commit c66b848
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions simple_app/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def normalise() -> np.ndarray:
db = SimpleDB(db_file) # open database
t_spectra: Table = db.query(db.Spectra).\
filter(db.Spectra.c.source == query).\
table(spectra=['spectrum'])
table(spectra=['access_url'])

# initialise plot
n_fail, fail_string_list = 0, []
Expand All @@ -153,7 +153,7 @@ def normalise() -> np.ndarray:

# checking each spectra in table
for spec in t_spectra:
spectrum: Spectrum1D = spec['spectrum']
spectrum: Spectrum1D = spec['access_url']

# checking spectrum has good units and not only NaNs
try:
Expand Down
4 changes: 2 additions & 2 deletions simple_app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ def spectra_handle(df: pd.DataFrame, drop_source: bool = True):

# convert links to spectra files from plaintext to hyperlinks
url_links = []
for source in df.spectrum.values:
for source in df.access_url.values:
source_link = f'<a href="{source}" target="_blank">Link</a>'
url_links.append(source_link)

# removing excess columns which aren't pretty on the website
df.drop(columns=[col for col in df.columns if
any([sub_string in col for sub_string in ('wave', 'flux', 'original')])],
inplace=True)
drop_cols = ['spectrum', 'local_spectrum', 'regime']
drop_cols = ['access_url', 'local_spectrum', 'regime']
if drop_source:
drop_cols.append('source')
df.drop(columns=drop_cols, inplace=True, errors='ignore')
Expand Down

0 comments on commit c66b848

Please sign in to comment.