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

156 switch nose to pytest #157

Merged
merged 4 commits into from
Aug 26, 2024
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
2 changes: 1 addition & 1 deletion config/auxtel.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ SPECTRACTOR_FIT_TIMEOUT_PER_ITER = 1200
# maximum time per gradient descent before TimeoutError in seconds
SPECTRACTOR_FIT_TIMEOUT = 7200
# library to compute atmospheric transmission: none, libradtran, getobsatmo
SPECTRACTOR_ATMOSPHERE_SIM = getobstamo
SPECTRACTOR_ATMOSPHERE_SIM = getobsatmo

[instrument]
# instrument name
Expand Down
2 changes: 1 addition & 1 deletion config/stardice.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SPECTRACTOR_DECONVOLUTION_FFM = False
# value of sigma clip parameter for the spectractor deconvolution process PSF2D and FFM
SPECTRACTOR_DECONVOLUTION_SIGMA_CLIP = 100
# library to compute atmospheric transmission: none, libradtran, getobsatmo
SPECTRACTOR_ATMOSPHERE_SIM = getobstamo
SPECTRACTOR_ATMOSPHERE_SIM = getobsatmo

[instrument]
# instrument name
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ configparser
coveralls
deprecated
pyyaml
pytest<8.1
pytest
pytest-cov
getCalspec>=2.0.0
lsst_utils
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool:pytest]
exclude=test_(extractor_ctio_planetary_nebula|astrometry|mcmc|multispectra)
addopts = --ignore=tests/test_astrometry.py --ignore=tests/test_mcmc.py --ignore=tests/test_extractor_ctio_planetary_nebula.py

[coverage:run]
omit=spectractor/fit/mcmc.py
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
version=current_version,
packages=['spectractor', 'spectractor.extractor', 'spectractor.simulation', 'spectractor.fit'],
install_requires=reqs,
test_suite='nose.collector',
tests_require=['nose'],
package_dir={'spectractor': './spectractor'},
package_data={'spectractor': ['../config/*.ini'],
'spectractor.extractor': ['dispersers/HoloPhAg/*.txt', 'dispersers/HoloPhP/*.txt',
Expand Down
4 changes: 2 additions & 2 deletions spectractor/extractor/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -1787,8 +1787,8 @@ def detect_lines(lines, lambdas, spec, spec_err=None, cov_matrix=None, fwhm_func
Y = -Gauss / Continuum
Ydata = 1 - spectr_data / Continuum

line.fit_eqwidth_mod = integrate.simps(Y, x_int) # sol1
line.fit_eqwidth_data = integrate.simps(Ydata, x_int) # sol2
line.fit_eqwidth_mod = integrate.simpson(Y, x=x_int) # sol1
line.fit_eqwidth_data = integrate.simpson(Ydata, x=x_int) # sol2

line.fit_popt = popt
line.fit_pcov = pcov
Expand Down
6 changes: 3 additions & 3 deletions tests/test_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def test_atmosphere():
ozone_grid=[400, 400, 1], aerosol_grid=[0.0, 0.1, 2])
atmospheric_grid = a.compute()
assert np.sum(atmospheric_grid) > 0
assert np.all(np.isclose(a.atmgrid[0, a.index_atm_data:], parameters.LAMBDAS))
assert not np.any(np.isclose(a.atmgrid[1, a.index_atm_data:], np.zeros_like(parameters.LAMBDAS), rtol=1e-6))
assert a.atmgrid.shape == (3, a.index_atm_data + len(parameters.LAMBDAS))
assert np.all(np.isclose(a.atmgrid[0, a.index_atm_data:], a.lambdas))
assert not np.any(np.isclose(a.atmgrid[1, a.index_atm_data:], np.zeros_like(a.lambdas), rtol=1e-6))
assert a.atmgrid.shape == (3, a.index_atm_data + len(a.lambdas))
a.save_file(a.image_filename.replace('.fits', '_atmsim.fits'))
assert os.path.isfile('tests/data/reduc_20170605_028_atmsim.fits')
a.load_file(a.image_filename.replace('.fits', '_atmsim.fits'))
Expand Down
Loading