Skip to content

Commit

Permalink
Fix indents
Browse files Browse the repository at this point in the history
  • Loading branch information
rosteen committed Apr 18, 2024
1 parent ad52eb1 commit d44823c
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from astropy.nddata import (
NDDataArray, StdDevUncertainty
)
from glue.core.link_helpers import LinkSame
from traitlets import Any, Bool, Dict, Float, List, Unicode, observe
from packaging.version import Version
from photutils.aperture import CircularAperture, EllipticalAperture, RectangularAperture
Expand Down Expand Up @@ -330,7 +329,7 @@ def collapse_to_spectrum(self, add_data=True, **kwargs):
uncertainty = collapsed_nddata.uncertainty

if pass_spectral_axis:
wcs_args = [0,0,0]
wcs_args = [0, 0, 0]
spec_indices = np.arange(spectral_cube.shape[self.spectral_axis_index])
wcs_args[self.spectral_axis_index] = spec_indices
wcs_args.reverse()
Expand Down Expand Up @@ -430,7 +429,8 @@ def get_aperture(self):
# Cylindrical aperture
slice_mask = aperture.to_mask(method=aper_method).to_image(im_shape)
# Turn 2D slice_mask into 3D array that is the same shape as the flux cube
mask_weights = np.stack([slice_mask] * len(flux_cube.spectral_axis), axis=self.spectral_axis_index)
mask_weights = np.stack([slice_mask] * len(flux_cube.spectral_axis),
axis=self.spectral_axis_index)

return mask_weights

Expand Down
2 changes: 1 addition & 1 deletion jdaviz/configs/default/plugins/export/tests/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_not_implemented(self, cubeviz_helper, spectral_cube_wcs):
"""

data = Spectrum(flux=np.ones((500, 500, 2)) * u.nJy,
wcs=spectral_cube_wcs)
wcs=spectral_cube_wcs)
cubeviz_helper.load_data(data)

cubeviz_helper.app.get_viewer('flux-viewer').apply_roi(CircularROI(xc=255,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

def test_line_lists(specviz_helper):
spec = Spectrum(flux=np.random.rand(100)*u.Jy,
spectral_axis=np.arange(6000, 7000, 10)*u.AA)
spectral_axis=np.arange(6000, 7000, 10)*u.AA)
specviz_helper.load_data(spec)

lt = QTable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def _fit_1D(initial_model, spectrum, run_fitter, filter_non_finite=True, window=

# Build return spectrum
output_spectrum = Spectrum(spectral_axis=spectrum.spectral_axis,
flux=output_values,
mask=spectrum.mask)
flux=output_values,
mask=spectrum.mask)

return output_model, output_spectrum

Expand Down Expand Up @@ -216,8 +216,8 @@ def collect_result(results):
# Build output 3D spectrum
funit = spectrum.flux.unit
output_spectrum = Spectrum(wcs=spectrum.wcs,
flux=output_flux_cube * funit,
mask=spectrum.mask)
flux=output_flux_cube * funit,
mask=spectrum.mask)

return fitted_models, output_spectrum

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def test_cube_fitting_backend(cubeviz_helper, unc, tmp_path):
uncertainties = None

spectrum = Spectrum(flux=flux_cube*u.Jy, wcs=cube_wcs,
uncertainty=uncertainties, mask=mask)
uncertainty=uncertainties, mask=mask)

# Initial model for fit.
g1f = models.Gaussian1D(0.7*u.Jy, 4.65*u.um, 0.3*u.um, name='g1')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def test_invalid_subset(specviz_helper, spectrum1d):

# 5000-7000
sp2 = Spectrum(spectral_axis=spectrum1d.spectral_axis - 1000*spectrum1d.spectral_axis.unit,
flux=spectrum1d.flux * 1.25)
flux=spectrum1d.flux * 1.25)
specviz_helper.load_data(sp2, data_label="left_spectrum")

# apply subset that overlaps on left_spectrum, but not right_spectrum
Expand Down
4 changes: 2 additions & 2 deletions jdaviz/configs/specviz/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def _apply_redshift_to_spectra(spectra, redshift):
mask = spectra.mask
uncertainty = spectra.uncertainty
output_spectra = Spectrum(flux, spectral_axis=spaxis,
redshift=redshift, mask=mask,
uncertainty=uncertainty)
redshift=redshift, mask=mask,
uncertainty=uncertainty)

return output_spectra

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def test_invalid_subset(specviz_helper, spectrum1d):

# 5000-7000
sp2 = Spectrum(spectral_axis=spectrum1d.spectral_axis - 1000*spectrum1d.spectral_axis.unit,
flux=spectrum1d.flux * 1.25)
flux=spectrum1d.flux * 1.25)
specviz_helper.load_data(sp2, data_label="left_spectrum")

# apply subset that overlaps on left_spectrum, but not right_spectrum
Expand Down
2 changes: 1 addition & 1 deletion jdaviz/configs/specviz/plugins/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,5 @@ def combine_lists_to_1d_spectrum(wl, fnu, dfnu, wave_units, flux_units):
unc = None

spec = Spectrum(flux=fnuall * flux_units, spectral_axis=wlall * wave_units,
uncertainty=unc)
uncertainty=unc)
return spec
8 changes: 4 additions & 4 deletions jdaviz/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def multi_order_spectrum_list(spectrum1d, spectral_orders=10):
uncertainty = StdDevUncertainty(np.abs(np.random.randn(len(spec_axis.value))) * u.Jy)
meta = dict(header=dict(FILENAME="jdaviz-test-multi-order-file.fits"))
spectrum1d = Spectrum(spectral_axis=spec_axis, flux=flux,
uncertainty=uncertainty, meta=meta)
uncertainty=uncertainty, meta=meta)

sc.append(spectrum1d)

Expand All @@ -217,9 +217,9 @@ def _create_spectrum1d_cube_with_fluxunit(fluxunit=u.Jy, shape=(2, 2, 4), with_u
uncert = StdDevUncertainty(np.abs(np.random.normal(flux) * u.Jy))

return Spectrum(flux=flux,
uncertainty=uncert,
wcs=w,
meta=wcs_dict)
uncertainty=uncert,
wcs=w,
meta=wcs_dict)
else:
return Spectrum(flux=flux, wcs=w, meta=wcs_dict)

Expand Down
8 changes: 4 additions & 4 deletions jdaviz/core/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,10 @@ def _handle_display_units(data, use_display_units):
new_uncert = None

data = Spectrum(spectral_axis=data.spectral_axis.to(spectral_unit,
u.spectral()),
flux=data.flux.to(flux_unit,
u.spectral_density(data.spectral_axis)),
uncertainty=new_uncert)
u.spectral()),
flux=data.flux.to(flux_unit,
u.spectral_density(data.spectral_axis)),
uncertainty=new_uncert)
else: # pragma: nocover
raise NotImplementedError(f"converting {data.__class__.__name__} to display units is not supported") # noqa
return data
Expand Down

0 comments on commit d44823c

Please sign in to comment.