Skip to content

Commit

Permalink
Merge 8c8fcb9 into 88df245
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Apr 24, 2019
2 parents 88df245 + 8c8fcb9 commit 39f65a2
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 16 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ language: c
env:
matrix:
- PYTHON_VERSION=2.7
- PYTHON_VERSION=3.3
- PYTHON_VERSION=3.4
- PYTHON_VERSION=3.5
- PYTHON_VERSION=3.6
- PYTHON_VERSION=3.7
global:
- SETUP_XVFB=True
- CONDA_CHANNELS=conda-forge
Expand Down
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
1.3 (unreleased)
----------------

- No changes yet.
- Fixed an issue that occurred during the convolution if not all
SEDs had the same number of wavelengths. [#66]

1.2 (2018-06-16)
----------------
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ environment:
- PYTHON_VERSION: "2.7"
- PYTHON_VERSION: "3.5"
- PYTHON_VERSION: "3.6"
- PYTHON_VERSION: "3.7"

platform:
-x64
Expand Down
10 changes: 5 additions & 5 deletions sedfitter/convolve/convolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ def _convolve_model_dir_1(model_dir, filters, overwrite=False):
os.mkdir(model_dir + '/convolved')

# Find all SED files to convolve
sed_files = (glob.glob(model_dir + '/seds/*.fits.gz') +
glob.glob(model_dir + '/seds/*/*.fits.gz') +
glob.glob(model_dir + '/seds/*.fits') +
glob.glob(model_dir + '/seds/*/*.fits'))
sed_files = sorted(glob.glob(model_dir + '/seds/*.fits.gz') +
glob.glob(model_dir + '/seds/*/*.fits.gz') +
glob.glob(model_dir + '/seds/*.fits') +
glob.glob(model_dir + '/seds/*/*.fits'))

par_table = load_parameter_table(model_dir)

Expand Down Expand Up @@ -95,7 +95,7 @@ def _convolve_model_dir_1(model_dir, filters, overwrite=False):
try:
assert binned_nu is not None
np.testing.assert_array_almost_equal_nulp(s.nu.value, binned_nu.value, 100)
except AssertionError:
except (ValueError, AssertionError):
log.info('Rebinning filters')
binned_filters = [f.rebin(s.nu) for f in filters]
binned_nu = s.nu
Expand Down
8 changes: 4 additions & 4 deletions sedfitter/convolve/monochromatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ def convolve_model_dir_monochromatic(model_dir, overwrite=False, max_ram=8,
os.mkdir(model_dir + '/convolved')

# Find all SED files to convolve
sed_files = (glob.glob(model_dir + '/seds/*.fits.gz') +
glob.glob(model_dir + '/seds/*/*.fits.gz') +
glob.glob(model_dir + '/seds/*.fits') +
glob.glob(model_dir + '/seds/*/*.fits'))
sed_files = sorted(glob.glob(model_dir + '/seds/*.fits.gz') +
glob.glob(model_dir + '/seds/*/*.fits.gz') +
glob.glob(model_dir + '/seds/*.fits') +
glob.glob(model_dir + '/seds/*/*.fits'))

par_table = load_parameter_table(model_dir)

Expand Down
17 changes: 13 additions & 4 deletions sedfitter/tests/test_full_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,26 @@ def generate_random_models_1(models_dir, aperture_dependent=False):

sed.name = 'model_{0:04d}'.format(i)
sed.distance = 1 * u.kpc
sed.wav = np.logspace(-2., 3., 100) * u.micron

# Make at least one SED have a different size as a regression test for a
# bug that caused the convolution to crash if SEDs did not all have the
# same size. Note that technically speaking the monochromatic
# 'convolution' will be wrong in this case, but this doesn't matter
# since the monochromatic convolution is not really going to be
# supported going forward.
n_wav = 100 if i < 4 else 105

sed.wav = np.logspace(-2., 3., n_wav) * u.micron
sed.nu = sed.wav.to(u.Hz, equivalencies=u.spectral())

if aperture_dependent:
sed.apertures = np.logspace(1., 6., 10) * u.au
sed.flux = np.cumsum(np.random.random((10, 100)), axis=0) * u.mJy
sed.flux = np.cumsum(np.random.random((10, n_wav)), axis=0) * u.mJy
else:
sed.apertures = None
sed.flux = (1 + np.random.random((1, 100))) * u.mJy
sed.flux = (1 + np.random.random((1, n_wav))) * u.mJy

sed.error = sed.flux * np.random.random(100) / 100.
sed.error = sed.flux * np.random.random(n_wav) / 100.

sed.write(os.path.join(models_dir, 'seds', sed.name + '_sed.fits'))

Expand Down

0 comments on commit 39f65a2

Please sign in to comment.