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

Add functions for Rainbow #411

Merged
merged 35 commits into from
Sep 18, 2024
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0ea387c
Added various functions for Rainbow fit
erusseil Sep 5, 2024
d60af0d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 5, 2024
86b0285
Fixed the parameters limits in incorrect order. Rise time is now the …
erusseil Sep 9, 2024
fdf47e3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 9, 2024
3275a17
bolometric resolved
erusseil Sep 9, 2024
c19db66
Documentation
erusseil Sep 10, 2024
15881f8
Merge branch 'extended' of https://github.com/erusseil/light-curve-py…
erusseil Sep 10, 2024
4939027
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 10, 2024
90ff12e
Merge pull request #1 from erusseil/extended
erusseil Sep 11, 2024
88a1aa2
Merge branch 'master' into extended_PR
erusseil Sep 11, 2024
1f56966
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 11, 2024
56a00b4
Merge branch 'light-curve:master' into extended_PR
erusseil Sep 11, 2024
7c98d4d
Removed bolometric exp and no temperature. Clean the comments
erusseil Sep 12, 2024
4c57e54
Merge branch 'extended_PR' of https://github.com/erusseil/light-curve…
erusseil Sep 12, 2024
ea240a3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 12, 2024
d4f3dbd
flake8 requirement
erusseil Sep 12, 2024
5df330c
flake8 requirement
erusseil Sep 12, 2024
5fe1e8a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 12, 2024
0609c30
renamed Tsigmoid back to s igmoid
erusseil Sep 12, 2024
87301d5
Merge branch 'extended_PR' of https://github.com/erusseil/light-curve…
erusseil Sep 12, 2024
fec93f1
Removed typo
erusseil Sep 12, 2024
f67e9ff
Changed parameter order
erusseil Sep 12, 2024
01c09a7
flake8 requirement
erusseil Sep 12, 2024
2448f09
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 12, 2024
88a6ebd
Remove reference temperature for temperature
erusseil Sep 12, 2024
c0d32d0
Merge branch 'extended_PR' of https://github.com/erusseil/light-curve…
erusseil Sep 12, 2024
c8c8947
removed useless ipynb files
erusseil Sep 13, 2024
2459dcb
Chnged lower bound sigmoid t_color
erusseil Sep 13, 2024
c597313
Added tests for all temp/bolometric + Improved linexp initial guess
erusseil Sep 13, 2024
8c30990
flake8 requirement
erusseil Sep 13, 2024
cbd735a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 13, 2024
349d745
changed idx calculation for negative flux cases
erusseil Sep 13, 2024
48e9610
Merge branch 'extended_PR' of https://github.com/erusseil/light-curve…
erusseil Sep 13, 2024
f458f79
Fixed tests
erusseil Sep 14, 2024
dacebdc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 14, 2024
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
Prev Previous commit
Next Next commit
flake8 requirement
erusseil committed Sep 13, 2024
commit 8c3099070764df303fe888a653948d9c0095114d
67 changes: 32 additions & 35 deletions light-curve/tests/light_curve_py/features/test_rainbow.py
Original file line number Diff line number Diff line change
@@ -48,47 +48,44 @@ def test_noisy_all_functions_combination():
t = np.sort(rng.uniform(59985.0, 60090.0, 1000))
band = rng.choice(list(band_wave_aa), size=len(t))


bazin_parameters = [
60000.0, # reference_time
1.0, # amplitude
5.0, # rise_time
30.0, # fall_time
]
60000.0, # reference_time
1.0, # amplitude
5.0, # rise_time
30.0, # fall_time
]

sigmoid_parameters = [
60000.0, # reference_time
1.0, # amplitude
5.0, # rise_time
60000.0, # reference_time
1.0, # amplitude
5.0, # rise_time
]

linexp_parameters = [
60000.0, # reference_time
1, # amplitude
-20, # rise_time
60000.0, # reference_time
1, # amplitude
-20, # rise_time
]

doublexp_parameters = [
60000.0, # reference_time
1, # amplitude
3, # time1
5, # time2
0.02 # p
60000.0, # reference_time
1, # amplitude
3, # time1
5, # time2
0.02 # p
]


bolometric_names = ['bazin', 'sigmoid', 'linexp', 'doublexp']
bolometric_params = [bazin_parameters, sigmoid_parameters, linexp_parameters, doublexp_parameters]


Tsigmoid_parameters = [
5e3, # Tmin
15e3, # Tmax
4.0 # t_color
5e3, # Tmin
15e3, # Tmax
4.0 # t_color
]

constant_parameters = [
1e4 # T
1e4 # T
]

temperature_names = ['constant', 'sigmoid']
@@ -106,22 +103,22 @@ def test_noisy_all_functions_combination():
flux = feature.model(t, band, *expected)

# The linexp function can reach unphysical negative flux values
protected_flux = np.where(flux>1e-3, flux, 1e-3)
protected_flux = np.where(flux > 1e-3, flux, 1e-3)

# S/N = 10 for minimum flux, scale for Poisson noise
flux_err = np.sqrt(protected_flux * np.min(protected_flux)) / 10.0
flux += rng.normal(0.0, flux_err)

actual = feature(t, flux, sigma=flux_err, band=band)

#import matplotlib.pyplot as plt
#plt.figure()
#plt.scatter(t, flux, s=5, label="data")
#plt.errorbar(t, flux, yerr=flux_err, ls="none", capsize=1)
#plt.plot(t, feature.model(t, band, *expected), "x", label="expected")
#plt.plot(t, feature.model(t, band, *actual), "*", label="actual")
#plt.ylim(-.05, flux.max()+0.1)
#plt.legend()
#plt.show()

np.testing.assert_allclose(actual[:-1], expected[:-1], rtol=0.1)
# import matplotlib.pyplot as plt
# plt.figure()
# plt.scatter(t, flux, s=5, label="data")
# plt.errorbar(t, flux, yerr=flux_err, ls="none", capsize=1)
# plt.plot(t, feature.model(t, band, *expected), "x", label="expected")
# plt.plot(t, feature.model(t, band, *actual), "*", label="actual")
# plt.ylim(-.05, flux.max()+0.1)
# plt.legend()
# plt.show()

np.testing.assert_allclose(actual[:-1], expected[:-1], rtol=0.1)