-
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.
[WIP] Implemented estimation of particle size, peak picking and migra…
…ted functionality from 'xrd' package (#7) * chore: migrated functionality of xrd package - parsers for brml and xy included together with the corresponding tests - they could still need some more refactoring * chore: added docstrings * feat: Scherrer Analysis, Peak picking, fromXY - we parse now the anode metal from BRML to be able to automatically do the Scherrer analysis - for this, there is also a constant object that tabulates wavelengths of common anodes - for this, we now also support peak picking - and there is also a function to create the annotation, potentially also with assignment - additionally, there is now also a fromXY function
- Loading branch information
1 parent
21b4126
commit 8d5e7e0
Showing
21 changed files
with
8,861 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
import { Analysis } from '../..'; | ||
import { addPeak } from '../addPeak'; | ||
|
||
test('addPeak', () => { | ||
let analysis = new Analysis(); | ||
|
||
analysis.pushSpectrum( | ||
{ | ||
x: { | ||
data: [ | ||
10, | ||
10.87014232, | ||
11.74028464, | ||
12.61042695, | ||
13.48056927, | ||
14.35071159, | ||
15.22085391, | ||
16.09099623, | ||
16.96113855, | ||
17.83128086, | ||
18.70142318, | ||
19.5715655, | ||
20.44170782, | ||
21.31185014, | ||
22.18199246, | ||
23.05213477, | ||
23.92227709, | ||
24.79241941, | ||
25.66256173, | ||
26.53270405, | ||
27.40284637, | ||
28.27298868, | ||
29.143131, | ||
30.01327332, | ||
30.88341564, | ||
31.75355796, | ||
32.62370028, | ||
33.49384259, | ||
34.36398491, | ||
35.23412723, | ||
36.10426955, | ||
36.97441187, | ||
37.84455419, | ||
38.7146965, | ||
39.58483882, | ||
40.45498114, | ||
41.32512346, | ||
42.19526578, | ||
43.0654081, | ||
43.93555041, | ||
44.80569273, | ||
45.67583505, | ||
46.54597737, | ||
47.41611969, | ||
48.28626201, | ||
49.15640432, | ||
50.02654664, | ||
50.89668896, | ||
51.76683128, | ||
52.6369736, | ||
53.50711592, | ||
54.37725823, | ||
55.24740055, | ||
56.11754287, | ||
56.98768519, | ||
57.85782751, | ||
58.72796983, | ||
59.59811214, | ||
60.46825446, | ||
61.33839678, | ||
62.2085391, | ||
63.07868142, | ||
63.94882374, | ||
64.81896605, | ||
65.68910837, | ||
66.55925069, | ||
67.42939301, | ||
68.29953533, | ||
69.16967764, | ||
], | ||
units: 'xUnits', | ||
label: 'X axis [xUnits]', | ||
}, | ||
y: { | ||
data: [ | ||
0.0, | ||
2.81944455e-1, | ||
-1.76789118e-1, | ||
-2.61612632e-1, | ||
-2.13420693e-1, | ||
7.70339438e-1, | ||
1.76926027e-1, | ||
-6.15719808e-2, | ||
-1.52426047e-2, | ||
1.34201582e-1, | ||
-3.21258697e-1, | ||
8.91666765e-2, | ||
9.81981592e-2, | ||
5.38614167e-1, | ||
-1.22550072e-1, | ||
1.74433215e-1, | ||
1.79804788e-1, | ||
-3.28079254e-1, | ||
-5.09646976e-2, | ||
9.961077e-2, | ||
2.17736107e-1, | ||
-1.29382215e-1, | ||
7.7247087e-1, | ||
9.54841237e-1, | ||
4.17728884e-1, | ||
-6.33157697e-1, | ||
4.16611111e-1, | ||
-6.30172049e-1, | ||
9.11546241e-1, | ||
6.21294848, | ||
5.51802847e1, | ||
1.19177215e1, | ||
3.63359221, | ||
5.64039691, | ||
5.52718888e-1, | ||
3.03098156e-1, | ||
1.73733837, | ||
3.64738026e1, | ||
2.36578407, | ||
8.18592954e-1, | ||
7.72784579e-1, | ||
1.11845869e-1, | ||
-2.7079057e-1, | ||
6.17881315e-1, | ||
6.42247963e-1, | ||
1.65546523, | ||
3.60457562e-1, | ||
7.88020263e-2, | ||
-2.94264172e-2, | ||
1.03134295, | ||
7.89296257e-1, | ||
1.92793644e-1, | ||
-3.58884917e-1, | ||
-1.53114319e-1, | ||
-5.190557e-1, | ||
-3.43872664e-1, | ||
-2.11089013e-1, | ||
1.87279872, | ||
4.18782812, | ||
3.79396248e1, | ||
4.58652209, | ||
3.57686663e-1, | ||
1.59368518e-1, | ||
-3.93749997e-1, | ||
7.90297702e-1, | ||
6.35900771e-1, | ||
1.89104455e-1, | ||
-5.00912467e-2, | ||
-1.17836305e-1, | ||
], | ||
units: 'yUnits', | ||
label: 'Y axis [yUnits]', | ||
}, | ||
}, | ||
{ | ||
title: 'My testpattern', | ||
dataType: 'XRD', | ||
}, | ||
); | ||
|
||
let spectrum = analysis.getSpectrum(); | ||
const peak = { | ||
x: 5, | ||
y: 10, | ||
fwhm: 1, | ||
}; | ||
addPeak(spectrum, peak); | ||
|
||
expect(spectrum).toHaveProperty('peaks'); | ||
expect(spectrum.peaks).toHaveLength(1); | ||
expect(spectrum.peaks[0]).toStrictEqual(peak); | ||
|
||
const peak2 = { | ||
x: 5.9, | ||
y: 1000.1, | ||
fwhm: 0.5, | ||
}; | ||
addPeak(spectrum, peak2); | ||
expect(spectrum.peaks).toHaveLength(2); | ||
expect(spectrum.peaks[1]).toStrictEqual(peak2); | ||
}); |
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,169 @@ | ||
import { Analysis } from '../..'; | ||
import { autoPeakPicking } from '../autoPeakPicking'; | ||
|
||
test('autoPeakPicking', () => { | ||
let analysis = new Analysis(); | ||
|
||
analysis.pushSpectrum( | ||
{ | ||
x: { | ||
data: [ | ||
10, | ||
10.87014232, | ||
11.74028464, | ||
12.61042695, | ||
13.48056927, | ||
14.35071159, | ||
15.22085391, | ||
16.09099623, | ||
16.96113855, | ||
17.83128086, | ||
18.70142318, | ||
19.5715655, | ||
20.44170782, | ||
21.31185014, | ||
22.18199246, | ||
23.05213477, | ||
23.92227709, | ||
24.79241941, | ||
25.66256173, | ||
26.53270405, | ||
27.40284637, | ||
28.27298868, | ||
29.143131, | ||
30.01327332, | ||
30.88341564, | ||
31.75355796, | ||
32.62370028, | ||
33.49384259, | ||
34.36398491, | ||
35.23412723, | ||
36.10426955, | ||
36.97441187, | ||
37.84455419, | ||
38.7146965, | ||
39.58483882, | ||
40.45498114, | ||
41.32512346, | ||
42.19526578, | ||
43.0654081, | ||
43.93555041, | ||
44.80569273, | ||
45.67583505, | ||
46.54597737, | ||
47.41611969, | ||
48.28626201, | ||
49.15640432, | ||
50.02654664, | ||
50.89668896, | ||
51.76683128, | ||
52.6369736, | ||
53.50711592, | ||
54.37725823, | ||
55.24740055, | ||
56.11754287, | ||
56.98768519, | ||
57.85782751, | ||
58.72796983, | ||
59.59811214, | ||
60.46825446, | ||
61.33839678, | ||
62.2085391, | ||
63.07868142, | ||
63.94882374, | ||
64.81896605, | ||
65.68910837, | ||
66.55925069, | ||
67.42939301, | ||
68.29953533, | ||
69.16967764, | ||
], | ||
units: 'xUnits', | ||
label: 'X axis [xUnits]', | ||
}, | ||
y: { | ||
data: [ | ||
0.0, | ||
2.81944455e-1, | ||
-1.76789118e-1, | ||
-2.61612632e-1, | ||
-2.13420693e-1, | ||
7.70339438e-1, | ||
1.76926027e-1, | ||
-6.15719808e-2, | ||
-1.52426047e-2, | ||
1.34201582e-1, | ||
-3.21258697e-1, | ||
8.91666765e-2, | ||
9.81981592e-2, | ||
5.38614167e-1, | ||
-1.22550072e-1, | ||
1.74433215e-1, | ||
1.79804788e-1, | ||
-3.28079254e-1, | ||
-5.09646976e-2, | ||
9.961077e-2, | ||
2.17736107e-1, | ||
-1.29382215e-1, | ||
7.7247087e-1, | ||
9.54841237e-1, | ||
4.17728884e-1, | ||
-6.33157697e-1, | ||
4.16611111e-1, | ||
-6.30172049e-1, | ||
9.11546241e-1, | ||
6.21294848, | ||
5.51802847e1, | ||
1.19177215e1, | ||
3.63359221, | ||
5.64039691, | ||
5.52718888e-1, | ||
3.03098156e-1, | ||
1.73733837, | ||
3.64738026e1, | ||
2.36578407, | ||
8.18592954e-1, | ||
7.72784579e-1, | ||
1.11845869e-1, | ||
-2.7079057e-1, | ||
6.17881315e-1, | ||
6.42247963e-1, | ||
1.65546523, | ||
3.60457562e-1, | ||
7.88020263e-2, | ||
-2.94264172e-2, | ||
1.03134295, | ||
7.89296257e-1, | ||
1.92793644e-1, | ||
-3.58884917e-1, | ||
-1.53114319e-1, | ||
-5.190557e-1, | ||
-3.43872664e-1, | ||
-2.11089013e-1, | ||
1.87279872, | ||
4.18782812, | ||
3.79396248e1, | ||
4.58652209, | ||
3.57686663e-1, | ||
1.59368518e-1, | ||
-3.93749997e-1, | ||
7.90297702e-1, | ||
6.35900771e-1, | ||
1.89104455e-1, | ||
-5.00912467e-2, | ||
-1.17836305e-1, | ||
], | ||
units: 'yUnits', | ||
label: 'Y axis [yUnits]', | ||
}, | ||
}, | ||
{ | ||
title: 'My testpattern', | ||
dataType: 'XRD', | ||
}, | ||
); | ||
|
||
let spectrum = analysis.getSpectrum(); | ||
autoPeakPicking(spectrum); | ||
expect(spectrum.peaks).toHaveLength(3); | ||
}); |
Oops, something went wrong.