Skip to content

Commit

Permalink
Merge pull request #175 from dr-rodriguez/spectrum_access_url_change
Browse files Browse the repository at this point in the history
Updating column name to access_url
  • Loading branch information
dr-rodriguez authored Apr 30, 2024
2 parents 938df6e + 14eaab7 commit 7f7e079
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"forwardPorts": [8000],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pip install -r requirements.txt && wget -O SIMPLE.db https://raw.githubusercontent.com/SIMPLE-AstroDB/SIMPLE-binary/main/SIMPLE.db && python -m simple_app.app_simple -d"
"postCreateCommand": "pip install -r requirements.txt && wget -O SIMPLE.sqlite https://raw.githubusercontent.com/SIMPLE-AstroDB/SIMPLE-binary/main/SIMPLE.sqlite && python -m simple_app.app_simple -d"

// Configure tool-specific properties.
// "customizations": {},
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ conda env create -f environment.yml
### Refresh the database
Get a fresh copy of the database from the binary repo.
```bash
wget https://raw.githubusercontent.com/SIMPLE-AstroDB/SIMPLE-binary/main/SIMPLE.db
wget https://raw.githubusercontent.com/SIMPLE-AstroDB/SIMPLE-binary/main/SIMPLE.sqlite
```

### Running
Expand Down
2 changes: 1 addition & 1 deletion simple_app/app_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def create_spectra_files_for_download():
results: pd.DataFrame = getattr(everything, 'spectra')

# write all spectra for object to zipped file
zipped = write_spec_files(results.spectrum.values)
zipped = write_spec_files(results.access_url.values)
if zipped is not None:
response = Response(zipped, mimetype='application/zip')
response = control_response(response, app_type='zip')
Expand Down
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 7f7e079

Please sign in to comment.