diff --git a/requirements.txt b/requirements.txt index cc29057..996faa0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,87 +1,79 @@ -antiorm==1.2.1 -asdf==4.1.0 -asdf-astropy==0.7.0 -asdf_coordinates_schemas==0.3.0 -asdf_standard==1.1.1 -asdf_transform_schemas==0.5.0 -asdf_wcs_schemas==0.4.0 -astrodbkit==2.2 -astropy==5.3.4 -astroquery==0.4.9.post1 -attrs==25.1.0 +asdf==5.0.0 +asdf-astropy==0.8.0 +asdf_coordinates_schemas==0.4.0 +asdf_standard==1.4.0 +asdf_transform_schemas==0.6.0 +asdf_wcs_schemas==0.5.0 +astrodbkit==2.4 +astropy==7.1.0 +astropy-iers-data==0.2025.9.22.0.37.25 +astroquery==0.4.11 +attrs==25.3.0 backports.tarfile==1.2.0 -beautifulsoup4==4.13.3 +beautifulsoup4==4.13.5 blinker==1.9.0 -bokeh==3.7.3 -certifi==2025.1.31 -cffi==1.17.1 -charset-normalizer==3.4.1 -click==8.1.8 -contourpy==1.3.1 -cryptography==44.0.0 -db==0.1.1 -db-sqlite3==0.0.1 -dill==0.3.9 -distlib==0.3.9 -distro==1.9.0 -filelock==3.16.1 -Flask==3.1.0 -Flask-Cors==4.0.2 +bokeh==3.8.0 +certifi==2025.8.3 +cffi==2.0.0 +charset-normalizer==3.4.3 +click==8.3.0 +contourpy==1.3.3 +cryptography==46.0.1 +dill==0.4.0 +Flask==3.1.2 +flask-cors==6.0.1 Flask-WTF==1.2.2 -greenlet==3.1.1 -gwcs==0.21.0 +gitdb==4.0.12 +GitPython==3.1.41 +greenlet==3.2.4 +gwcs==0.26.0 html5lib==1.1 idna==3.10 -importlib_metadata==8.6.1 -iniconfig==2.0.0 -iniparse==0.5 +importlib_metadata==8.7.0 +iniconfig==2.1.0 itsdangerous==2.2.0 jaraco.classes==3.4.0 jaraco.context==6.0.1 -jaraco.functools==4.1.0 -jeepney==0.8.0 -Jinja2==3.1.5 +jaraco.functools==4.3.0 +jeepney==0.9.0 +Jinja2==3.1.6 jmespath==1.0.1 keyring==25.6.0 -markdown2==2.5.3 +markdown2==2.5.4 MarkupSafe==3.0.2 -more-itertools==10.6.0 -multiprocess==0.70.17 -narwhals==1.41.0 -ndcube==2.3.0 -numpy==1.26.4 -packaging==24.2 -pandas==2.0.3 -pathlib2==2.3.7.post1 -pillow==11.1.0 -platformdirs==4.3.6 -pluggy==1.5.0 -pycparser==2.22 +more-itertools==10.8.0 +multiprocess==0.70.18 +narwhals==2.5.0 +ndcube==2.3.2 +numpy==2.3.3 +packaging==25.0 +pandas==2.3.2 +pillow==11.3.0 +pluggy==1.6.0 +pycparser==2.23 pyerfa==2.0.1.5 -PyMySQL==1.1.1 -pyOpenSSL==24.3.0 -pysqlite3==0.5.4 -pytest==8.3.4 +Pygments==2.19.2 +pytest==8.4.2 python-dateutil==2.9.0.post0 -pytz==2024.2 -pyvo==1.6 +pytz==2025.2 +pyvo==1.7 PyYAML==6.0.2 -requests==2.32.3 -scipy==1.15.1 -SecretStorage==3.3.3 +requests==2.32.5 +scipy==1.16.2 +SecretStorage==3.4.0 semantic-version==2.10.0 six==1.17.0 -soupsieve==2.6 +smmap==5.0.2 +soupsieve==2.8 specutils==2.1.0 -SQLAlchemy==2.0.38 -tornado==6.4.2 +SQLAlchemy==2.0.43 +tornado==6.5.2 tqdm==4.67.1 -typing_extensions==4.12.2 -tzdata==2025.1 -urllib3==2.3.0 -virtualenv==20.28.0 +typing_extensions==4.15.0 +tzdata==2025.2 +urllib3==2.5.0 webencodings==0.5.1 Werkzeug==3.1.3 WTForms==3.2.1 -xyzservices==2025.1.0 -zipp==3.21.0 +xyzservices==2025.4.0 +zipp==3.23.0 diff --git a/simple_app/plots.py b/simple_app/plots.py index 77843db..541fc75 100644 --- a/simple_app/plots.py +++ b/simple_app/plots.py @@ -149,6 +149,7 @@ def normalise() -> np.ndarray: return flux # unable to normalise by first 0.01um # query the database for the spectra + # Using spectra= in table() reads with the astrodbkit loaders db = SimpleDB(db_file) # open database t_spectra: Table = db.query(db.Spectra).\ filter(db.Spectra.c.source == query).\ @@ -173,7 +174,14 @@ def normalise() -> np.ndarray: # checking each spectra in table for spec in t_spectra: - spectrum = Spectrum.read(spec['access_url']) + # When reading the table, astrodbkit should have already created Spectrum objects + spectrum = spec["access_url"] + if isinstance(spectrum, str): + print("Re-attempting spectra conversion") + try: + spectrum = Spectrum.read(spec["access_url"]) + except Exception as e: + print(f"Unable to read {spectrum}. Error: {e}") # checking spectrum has good units and not only NaNs or 0s try: diff --git a/simple_app/simports.py b/simple_app/simports.py index db3f5df..bc84f53 100644 --- a/simple_app/simports.py +++ b/simple_app/simports.py @@ -24,6 +24,7 @@ import numpy as np # numerical python import pandas as pd # running dataframes import pytest # testing +from specutils import Spectrum from sqlalchemy.exc import ResourceClosedError, OperationalError, ProgrammingError # errors from sqlalchemy from sqlite3 import Warning as SqliteWarning # errors from sqlite from tqdm import tqdm # progress bars