Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: name 'speclite' is not defined #436

Closed
Lucia-Fonseca opened this issue Feb 24, 2021 · 3 comments · Fixed by #437
Closed

NameError: name 'speclite' is not defined #436

Lucia-Fonseca opened this issue Feb 24, 2021 · 3 comments · Fixed by #437
Assignees
Labels
bug Something isn't working

Comments

@Lucia-Fonseca
Copy link
Member

Lucia-Fonseca commented Feb 24, 2021

Describe the bug
The problem occurs when the SkyPy pipeline tries to execute the skypy.galaxies.spectrum.kcorrect.stellar_mass function (line 18 in galaxies.yaml):

cosmology: !astropy.cosmology.FlatLambdaCDM
  H0: 70
  Om0: 0.3
tables:
  SF:
    z, M_B: !skypy.galaxies.schechter_lf
      redshift: !numpy.geomspace [0.01, 3.01, 3]
      M_star: -20.485
      phi_star: 0.00312608
      alpha: -1.29
      m_lim: 30
      sky_area: 10 deg2
    coeff: !skypy.galaxies.spectrum.dirichlet_coefficients
      redshift: $SF.z
      alpha0: [2.079, 3.524, 1.917, 1.992, 2.536]
      alpha1: [2.265, 3.862, 1.921, 1.685, 2.480]
      weight: [3.47e+09, 3.31e+06, 2.13e+09, 1.64e+10, 1.01e+09]
    sm: !skypy.galaxies.spectrum.kcorrect.stellar_mass
      coefficients: $SF.coeff
      magnitudes: $SF.M_B
      filter: bessell-B

To Reproduce

  1. From a fresh environment, I installed SkyPy 0.4 and the latest version of Python 3.8.5
  2. In a Jupyter notebook, I imported SkyPy.pipeline.Pipeline
  3. I ran the code
   >>> from skypy.pipeline import Pipeline
   >>> sim = Pipeline.read('galaxies.yaml')
   >>> sim.execute()
  1. Got error NameError: name 'speclite' is not defined.

Expected behaviour
I would expect SkyPy to install all dependencies. However, since this is an optional package, I would expect to raise and ImportError.

System Details
macOS-11.2.1
Python 3.8.5 (default, Sep 4 2020, 02:22:02)
SkyPy 0.4

Solution
I installed the speclite package
python3 -m pip install speclite
and the error disappeared.

@Lucia-Fonseca Lucia-Fonseca added the bug Something isn't working label Feb 24, 2021
@rrjbca
Copy link
Contributor

rrjbca commented Feb 24, 2021

@Lucia-Fonseca could you please add an explanation of how to reproduce the bug? Ideally a step by step including what skypy version you have installed, what python script / config files you used, the traceback and (how) were you able to resolve the error?

@rrjbca
Copy link
Contributor

rrjbca commented Feb 24, 2021

@Lucia-Fonseca what is the contents of galaxies.yml? Can you provide a minimal working example?

@rrjbca
Copy link
Contributor

rrjbca commented Feb 25, 2021

Minimal working example:

>>> from skypy.utils.photometry import mag_ab
>>> import numpy as np
>>> mag_ab(np.linspace(1,10,100), np.ones(100), 'bessell-B')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "skypy/utils/photometry.py", line 91, in mag_ab
    filters = speclite.filters.load_filters(*filters)
NameError: name 'speclite' is not defined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants