From c66b848a22ae4daa1bfef042ea39aa0434e1297c Mon Sep 17 00:00:00 2001 From: David Rodriguez Date: Tue, 30 Apr 2024 16:43:28 -0400 Subject: [PATCH 1/3] Updating column name to access_url --- simple_app/plots.py | 4 ++-- simple_app/utils.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/simple_app/plots.py b/simple_app/plots.py index f9b31f0..1c302a6 100644 --- a/simple_app/plots.py +++ b/simple_app/plots.py @@ -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, [] @@ -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: diff --git a/simple_app/utils.py b/simple_app/utils.py index 0de5f76..44237e3 100644 --- a/simple_app/utils.py +++ b/simple_app/utils.py @@ -104,7 +104,7 @@ 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'Link' url_links.append(source_link) @@ -112,7 +112,7 @@ def spectra_handle(df: pd.DataFrame, drop_source: bool = True): 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') From 689ef6d4b9b2b9a6ab1a6236ed74f6f8a4a9bea4 Mon Sep 17 00:00:00 2001 From: David Rodriguez Date: Tue, 30 Apr 2024 16:48:30 -0400 Subject: [PATCH 2/3] Editing instructions and codespace code to refer to the file as SIMPLE.sqlite --- .devcontainer/devcontainer.json | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 420212b..7d746b2 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -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": {}, diff --git a/README.md b/README.md index fb32356..aee796e 100644 --- a/README.md +++ b/README.md @@ -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 From 14eaab74fd0a0ea3ad981aa9322dd0d751c86268 Mon Sep 17 00:00:00 2001 From: David Rodriguez Date: Tue, 30 Apr 2024 16:52:21 -0400 Subject: [PATCH 3/3] Update for spectra writer to use access_url column --- simple_app/app_simple.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple_app/app_simple.py b/simple_app/app_simple.py index 3d4e687..26ba205 100644 --- a/simple_app/app_simple.py +++ b/simple_app/app_simple.py @@ -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')