Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating column name to access_url #175

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading