Skip to content
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
12 changes: 7 additions & 5 deletions simple_app/app_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def coordinate_query():

# submit query
results: pd.DataFrame = db.query_region(c, fmt='pandas', radius=radius) # query
results = reference_handle(results, db_file)
stringed_results = one_df_query(results)
return render_template('coordinate_query.html', form=form, query=query, results=stringed_results,
version_str=version_str)
Expand All @@ -131,7 +132,7 @@ def full_text_search():

# search through the tables using the given query
results: Dict[str, pd.DataFrame] = db.search_string(query, fmt='pandas', verbose=False)
resultsout = multi_df_query(results, limmaxrows)
resultsout = multi_df_query(results, db_file, limmaxrows)

return render_template('full_text_search.html', form=form, version_str=version_str,
results=resultsout, query=query)
Expand Down Expand Up @@ -169,6 +170,7 @@ def raw_query():
except (ResourceClosedError, OperationalError, IndexError, SqliteWarning, BadSQLError):
results = pd.DataFrame()

results = reference_handle(results, db_file, True)
stringed_results = one_df_query(results)
return render_template('raw_query.html', form=form, results=stringed_results, version_str=version_str)

Expand Down Expand Up @@ -197,11 +199,11 @@ def solo_result(query: str):
except KeyError:
abort(404, f'"{query}" does match any result in SIMPLE!')
return
everything = Inventory(resultdict)
everything = Inventory(resultdict, db_file)

# create camd and spectra plots
scriptcmd, divcmd = camd_plot(query, everything, all_bands, all_results_full, all_parallaxes, all_spectral_types,
photometric_filters, all_photometry, js_callbacks, night_sky_theme)
photometric_filters, all_photometry, js_callbacks, night_sky_theme, db_file)
scriptspectra, divspectra, nfail, failstr = spectra_plot(query, db_file, night_sky_theme, js_callbacks)

query = query.upper()
Expand Down Expand Up @@ -286,7 +288,7 @@ def create_file_for_download(key: str):

# search for a given object and a given key
resultdict: dict = db.inventory(query)
everything = Inventory(resultdict, return_markdown=False)
everything = Inventory(resultdict, db_file, return_markdown=False)

# writes table to csv
if key in resultdict:
Expand Down Expand Up @@ -331,7 +333,7 @@ def create_spectra_files_for_download():

# search for a given object and specifically its spectra
resultdict: dict = db.inventory(query)
everything = Inventory(resultdict, return_markdown=False)
everything = Inventory(resultdict, db_file, return_markdown=False)
results: pd.DataFrame = getattr(everything, 'spectra')

# write all spectra for object to zipped file
Expand Down
10 changes: 6 additions & 4 deletions simple_app/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ def colour_absolute_magnitude_diagram() -> Tuple[figure, Toggle, Toggle, Select,

def camd_plot(query: str, everything: Inventory, all_bands: np.ndarray, all_results: pd.DataFrame,
all_parallaxes: pd.DataFrame, all_spectral_types: pd.DataFrame, photometric_filters: pd.DataFrame,
all_photometry: pd.DataFrame, js_callbacks: JSCallbacks, night_sky_theme: Theme) -> Tuple[Optional[str],
all_photometry: pd.DataFrame, js_callbacks: JSCallbacks, night_sky_theme: Theme, db_file: str) -> Tuple[Optional[str],
Optional[str]]:
"""
Creates CAMD plot into html
Expand All @@ -546,6 +546,8 @@ def camd_plot(query: str, everything: Inventory, all_bands: np.ndarray, all_resu
The javascript callbacks for bokeh
night_sky_theme: Theme
The theme for bokeh
db_file: str
The connection string to the database

Returns
-------
Expand All @@ -560,7 +562,7 @@ def camd_plot(query: str, everything: Inventory, all_bands: np.ndarray, all_resu

# retrieve photometry for given object
try:
this_photometry: pd.DataFrame = everything.list_concat('Photometry', False)
this_photometry: pd.DataFrame = everything.list_concat('Photometry', db_file, False)

if len(this_photometry) < 4:
raise KeyError('Not enough photometric entries')
Expand All @@ -571,7 +573,7 @@ def camd_plot(query: str, everything: Inventory, all_bands: np.ndarray, all_resu

# look for spectral type
try:
this_spectral_type: pd.DataFrame = everything.list_concat('SpectralTypes', False)
this_spectral_type: pd.DataFrame = everything.list_concat('SpectralTypes', db_file, False)

except KeyError:
this_spectral_type = pd.DataFrame.from_dict(dict(spectral_type_code=[np.nan, ], adopted=[np.nan, ]))
Expand All @@ -590,7 +592,7 @@ def camd_plot(query: str, everything: Inventory, all_bands: np.ndarray, all_resu

# attempt to retrieve parallaxes to process absolute magnitudes
try:
this_parallaxes: pd.DataFrame = everything.list_concat('Parallaxes', False)
this_parallaxes: pd.DataFrame = everything.list_concat('Parallaxes', db_file, False)

except KeyError:
pass
Expand Down
681 changes: 0 additions & 681 deletions simple_app/static/js/bokeh-3.0.2.min.js

This file was deleted.

736 changes: 736 additions & 0 deletions simple_app/static/js/bokeh-3.7.3.min.js

Large diffs are not rendered by default.

Loading