-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement spline based resampling; Implement L1 L2 norms
Closes #146
- Loading branch information
1 parent
35da5bd
commit d7ae3d8
Showing
3 changed files
with
79 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import ramanchada2 as rc2 | ||
import numpy as np | ||
from scipy.interpolate import CubicSpline | ||
|
||
|
||
def test_resample_spline(): | ||
spe = rc2.spectrum.from_test_spe(2, laser_wl=['785'], sample=['PST']).normalize() | ||
spe_tr = spe.trim_axes(method='x-axis', boundaries=(400, 2000)) | ||
res_spe = spe.resample_spline_filter((400, 2000), 1000, spline='akima', cumulative=False) | ||
aaa = CubicSpline(spe_tr.x, spe_tr.y)(np.linspace(400, 2000, 1000, endpoint=False)) | ||
assert np.all(res_spe.x == np.linspace(400, 2000, 1000, endpoint=False)) | ||
assert np.allclose(aaa, res_spe.y, rtol=.05) |