Skip to content

Commit

Permalink
environment and requirements micro-update
Browse files Browse the repository at this point in the history
  • Loading branch information
Will-Cooper committed Mar 1, 2024
1 parent 2a9489c commit 4184d64
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
36 changes: 18 additions & 18 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
7 changes: 5 additions & 2 deletions simple_app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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] = {}
Expand Down

0 comments on commit 4184d64

Please sign in to comment.