diff --git a/environment.yml b/environment.yml index b6e093a..cfc1a9d 100644 --- a/environment.yml +++ b/environment.yml @@ -1,10 +1,10 @@ name: simple channels: - - http://ssb.stsci.edu/astroconda - defaults - conda-forge + - http://ssb.stsci.edu/astroconda dependencies: - - python=3.8 + - python=3.9.16 - pip - pip: - -r requirements.txt diff --git a/requirements.txt b/requirements.txt index 890a5be..f1e4551 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,18 +1,18 @@ -astrodbkit2 -astropy -bokeh -flask -flask-cors -flask-wtf -markdown2 -multiprocess -numpy -pandas -pysqlite3 -pytest -requests -specutils -sqlalchemy -tqdm -werkzeug -wtforms +astrodbkit2>=0.5.1 +astropy>=5.2.0 +bokeh==3.0.2 +flask>=3.0.1 +flask-cors>=4.0.0 +flask-wtf>=1.2.1 +markdown2>=2.4.12 +multiprocess>=0.70.16 +numpy>=1.24.0 +pandas>=2.0.0 +pysqlite3>=0.5.2 +pytest>=8.0.0 +requests>=2.31.0 +specutils>=1.12.0 +sqlalchemy>=2.0.25 +tqdm>=4.66.1 +werkzeug>=3.0.1 +wtforms>=3.1.2 diff --git a/simple_app/utils.py b/simple_app/utils.py index 5580251..ecbfaa4 100644 --- a/simple_app/utils.py +++ b/simple_app/utils.py @@ -721,7 +721,7 @@ def absolute_magnitudes(df: pd.DataFrame, all_bands: np.ndarray) -> pd.DataFrame The output dataframe with absolute mags calculated """ - def pogson_law(m: Union[float, np.ndarray]) -> Union[float, np.ndarray]: + def pogson_law(m: Union[float, pd.Series]) -> Union[float, np.ndarray]: """ Distance modulus equation. Calculates the absolute magnitude only for sources with a positive parallax, otherwise returns a NaN @@ -735,7 +735,10 @@ def pogson_law(m: Union[float, np.ndarray]) -> Union[float, np.ndarray]: _ Absolute magnitude """ - return np.where(df.parallax > 0, m + 5 * np.log10(df.parallax, where=df.parallax > 0) - 10, np.nan) + mask = df.parallax > 0 + _abs_mag = np.full_like(m, fill_value=np.nan) + _abs_mag[mask] = m[mask] + 5 * np.log10(df.parallax[mask]) - 10 + return _abs_mag # create absolute magnitude for each apparent magnitude d_magnitudes: Dict[str, np.ndarray] = {}