-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
418 additions
and
456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
function compat = check_pyenv(py2ok) | ||
|
||
if nargin < 1 | ||
py2ok = false; | ||
end | ||
|
||
rel.R2017b = {'2.7', '3.4', '3.5', '3.6'}; | ||
rel.R2018a = {'2.7', '3.5', '3.6'}; | ||
rel.R2018b = {'2.7', '3.5', '3.6'}; | ||
rel.R2019a = {'2.7', '3.5', '3.6', '3.7'}; | ||
rel.R2019b = {'2.7', '3.6', '3.7'}; | ||
rel.R2020a = {'2.7', '3.6', '3.7'}; | ||
rel.R2020b = {'2.7', '3.6', '3.7', '3.8'}; | ||
rel.R2021a = {'2.7', '3.7', '3.8'}; | ||
rel.R2021b = {'2.7', '3.7', '3.8', '3.9'}; | ||
rel.R2022a = {'2.7', '3.8', '3.9'}; | ||
rel.R2022b = {'2.7', '3.8', '3.9', '3.10'}; | ||
rel.R2023a = {'3.8', '3.9', '3.10'}; | ||
|
||
v = ver('MATLAB'); | ||
mlver = v.Release(2:7); | ||
mlyear = str2double(mlver(2:5)); | ||
mlab = mlver(6); | ||
|
||
if mlyear < 2019 | ||
pyver = pyversion.Rersion; | ||
elseif mlyear == 2019 | ||
if strcmp(mlab, 'a') | ||
pyver = pyversion.Rersion; | ||
else | ||
pyver = pyenv().Version; | ||
end | ||
else | ||
pyver = pyenv().Version; | ||
end | ||
|
||
if any(ismember(rel.(mlver), pyver)) | ||
compat = true; | ||
else | ||
compat = false; | ||
end | ||
|
||
if pyver == '2.7' && py2ok == false | ||
compat = false; | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
.. _examples.bandpass_resampling: | ||
|
||
**************************** | ||
Bandpass and flux resampling | ||
**************************** | ||
|
||
Resampling a bandpass | ||
--------------------- | ||
|
||
|
||
Bandpass represented by arrays: | ||
|
||
.. code:: python | ||
wave = np.array([...]) | ||
bandpass = np.array([...]) | ||
wave_sampling = 5e-9 # wavelength sampling interval | ||
start, stop = wave[0], wave[-1] | ||
num = int(round(sto-start) / wave_sampling*1e9) | ||
resampled_wave = np.linspace(start, stop, num) | ||
resampled_bandpass = np.interp(resampled_wave, wave, bandpass) | ||
Bandpass represented by a :class:`~lentil.radiometry.Spectrum` object: | ||
|
||
.. code:: python | ||
bandpass = lentil.Spectrum(...) | ||
wave_sampling = 5e-9 # wavelength sampling interval | ||
trim_tol = 1e-2 # relative tolerance used to clip off nearly zero ends | ||
bandpass.trim(trim_tol) | ||
start, stop = flux.wave[0], flux.wave[-1] | ||
num = int(round(sto-start) / wave_sampling*1e9) | ||
resampled_wave = np.linspace(start, stop, num) | ||
resampled_bandpass = bandpass.sample(wave, waveunit=bandpass.waveunit) | ||
Resampling and rebinning flux | ||
----------------------------- | ||
In this example, the flux is binned (instead of simply sampled) to preserve | ||
its integrated power. | ||
|
||
.. code:: python | ||
flux = lentil.Spectrum(...) | ||
wave_sampling = 5e-9 # wavelength sampling interval | ||
trim_tol = 1e-2 # relative tolerance used to clip off nearly zero ends | ||
flux.trim(ftrim_tol) | ||
start, stop = flux.wave[0], flux.wave[-1] | ||
num = int(round(sto-start) / wave_sampling*1e9) | ||
wave = np.linspace(start, stop, num) | ||
binned_flux = flux.bin(wave, waveunit=flux.waveunit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.