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

Spectrum refactoring, Spectrum2DCollection #305

Merged
merged 37 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
136fca5
Create a Mixin for some Spectrum1DCollection methods, rewrite select()
ajjackson Jul 10, 2024
e825e69
Tidying up: rename and move private metadata-handling methods
ajjackson Jul 12, 2024
067339a
More refactoring in preparation for Spectrum2DCollection
ajjackson Jul 12, 2024
28a5b1e
Update Spectrum methods to use Quantity rather than *ureg.
ajjackson Jul 12, 2024
a47778f
Pylinting
ajjackson Aug 7, 2024
f98c053
Reimplement spectrum group_by with toolz, FP style
ajjackson Aug 8, 2024
5b29747
Tidy up a bit
ajjackson Aug 8, 2024
1159b5c
Standardise import order
ajjackson Aug 8, 2024
e4b4626
More cleanup: inline one function, replace another with partial
ajjackson Aug 8, 2024
01469f8
Remove some unused private methods/features from spectra
ajjackson Aug 8, 2024
44ed62b
Drop unused import
ajjackson Aug 8, 2024
a7ce9db
Refactor __getitem__ and move into SpectrumCollectionMixin
ajjackson Aug 8, 2024
0e05e0e
Tidying: indentation, more pedantic typing
ajjackson Aug 8, 2024
79ff127
More linting
ajjackson Aug 8, 2024
a041d72
Generalise more Spectrum1DCollection methods to mixin class
ajjackson Aug 8, 2024
35544a1
Move detailed from_dict docstring to child class
ajjackson Aug 8, 2024
c445fb9
Begin implementing Spectrum2DCollection
ajjackson Aug 9, 2024
e9bff3d
Spectrum2DCollection; initial implementation and rough tests
ajjackson Sep 4, 2024
ae3648b
Linting
ajjackson Sep 16, 2024
4659cad
More linting
ajjackson Sep 16, 2024
e32aa45
Refactor spectrum item data access to methods
ajjackson Sep 16, 2024
fb87b7d
Implement Spectrum2DCollection z_data; test slicing with ref data
ajjackson Sep 17, 2024
6235aab
Spectrum2DCollection; more testing, fix sum()
ajjackson Sep 17, 2024
e5c9756
Fix numpy/pint warnings
ajjackson Sep 17, 2024
56dfcb9
Linting
ajjackson Sep 17, 2024
ade79e1
Apply suggestions from code review
ajjackson Sep 19, 2024
3ecad2c
Response to review: docstring improvements
ajjackson Sep 19, 2024
8631bc4
Numpy style docstring
ajjackson Sep 19, 2024
eb808ba
More tweaks from review: improve clarity
ajjackson Sep 19, 2024
19f36ab
Factor out metadata length check to common method
ajjackson Sep 19, 2024
5dda596
Remove unnecessary parens
ajjackson Sep 19, 2024
b647cb7
Easier-to-read dict comprehension with less set magic
ajjackson Sep 19, 2024
aaaa25a
Use keyfilter from toolz
ajjackson Sep 20, 2024
87f32a0
Simplify _get_item_metadata
ajjackson Sep 20, 2024
b682432
Drop unused import
ajjackson Sep 20, 2024
0f7ec81
More tidying for legibility
ajjackson Sep 26, 2024
ef314a0
Remove redundant .keys() when iterating over dict
ajjackson Sep 26, 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
904 changes: 608 additions & 296 deletions euphonic/spectra.py

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ def run_setup():
'seekpath>=1.1.0',
'spglib>=1.9.4',
'pint>=0.22',
'threadpoolctl>=3.0.0'
'threadpoolctl>=3.0.0',
'toolz>=0.12.1',
],
extras_require={
'matplotlib': ['matplotlib>=3.8.0'],
Expand Down
1 change: 1 addition & 0 deletions tests_and_analysis/minimum_euphonic_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ matplotlib==3.8
h5py==3.6
PyYAML==6.0
threadpoolctl==3.0.0
toolz==0.12.1
267 changes: 267 additions & 0 deletions tests_and_analysis/test/data/spectrum2d/quartz_fuzzy_map_0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
{
"__euphonic_class__": "Spectrum2D",
"__euphonic_version__": "1.3.2+33.gd8680c2.dirty",
"metadata": {
"common": "yes",
"direction": 0
},
"x_data": [
0.0,
0.1111111111111111,
0.2222222222222222,
0.3333333333333333,
0.4444444444444444,
0.5555555555555556,
0.6666666666666666,
0.7777777777777777,
0.8888888888888888,
1.0
],
"x_data_unit": "1 / angstrom",
"x_tick_labels": [
[
0,
"$\\Gamma$"
ajjackson marked this conversation as resolved.
Show resolved Hide resolved
],
[
9,
""
]
],
"y_data": [
0.0,
5.2631578947368425,
10.526315789473685,
15.789473684210527,
21.05263157894737,
26.315789473684212,
31.578947368421055,
36.8421052631579,
42.10526315789474,
47.36842105263158,
52.631578947368425,
57.89473684210527,
63.15789473684211,
68.42105263157896,
73.6842105263158,
78.94736842105263,
84.21052631578948,
89.47368421052633,
94.73684210526316,
100.0
],
"y_data_unit": "millielectron_volt",
"z_data": [
[
0.0,
0.0,
0.0,
0.042222222222222223,
0.0,
0.021111111111111094,
0.04222222222222224,
0.0,
0.06333333333333335,
0.021111111111111094,
0.04222222222222224,
0.04222222222222215,
0.0,
0.0,
0.0,
0.0,
0.04222222222222215,
0.0,
0.04222222222222224
],
[
0.06333333333333331,
0.0,
0.0,
0.042222222222222223,
0.0,
0.021111111111111094,
0.04222222222222224,
0.021111111111111094,
0.04222222222222224,
0.021111111111111094,
0.04222222222222224,
0.04222222222222215,
0.0,
0.0,
0.0,
0.0,
0.04222222222222215,
0.0,
0.04222222222222224
],
[
0.0211111111111111,
0.0422222222222222,
0.0,
0.042222222222222223,
0.0,
0.021111111111111094,
0.04222222222222224,
0.04222222222222219,
0.0,
0.04222222222222219,
0.04222222222222224,
0.04222222222222215,
0.0,
0.0,
0.0,
0.021111111111111074,
0.021111111111111074,
0.0,
0.04222222222222224
],
[
0.0,
0.06333333333333331,
0.0,
0.042222222222222223,
0.0,
0.04222222222222219,
0.02111111111111112,
0.04222222222222219,
0.0,
0.04222222222222219,
0.04222222222222224,
0.04222222222222215,
0.0,
0.0,
0.0,
0.021111111111111074,
0.021111111111111074,
0.0,
0.02111111111111112
],
[
0.0,
0.0211111111111111,
0.0422222222222222,
0.021111111111111112,
0.021111111111111112,
0.04222222222222219,
0.0,
0.06333333333333328,
0.0,
0.06333333333333328,
0.02111111111111112,
0.021111111111111074,
0.02111111111111112,
0.0,
0.0,
0.021111111111111074,
0.0,
0.021111111111111164,
0.02111111111111112
],
[
0.0,
0.0211111111111111,
0.0211111111111111,
0.042222222222222223,
0.021111111111111112,
0.04222222222222219,
0.02111111111111112,
0.04222222222222219,
0.0,
0.06333333333333328,
0.02111111111111112,
0.021111111111111074,
0.02111111111111112,
0.0,
0.02111111111111112,
0.0,
0.0,
0.021111111111111164,
0.02111111111111112
],
[
0.0,
0.0211111111111111,
0.0211111111111111,
0.042222222222222223,
0.021111111111111112,
0.04222222222222219,
0.02111111111111112,
0.021111111111111094,
0.02111111111111112,
0.06333333333333328,
0.04222222222222224,
0.0,
0.02111111111111112,
0.0,
0.02111111111111112,
0.0,
0.0,
0.021111111111111164,
0.02111111111111112
],
[
0.0,
0.0,
0.0422222222222222,
0.021111111111111112,
0.042222222222222223,
0.04222222222222219,
0.04222222222222224,
0.0,
0.04222222222222224,
0.04222222222222219,
0.04222222222222224,
0.0,
0.0,
0.04222222222222224,
0.0,
0.0,
0.0,
0.021111111111111164,
0.04222222222222224
],
[
0.0,
0.0,
0.0422222222222222,
0.021111111111111112,
0.042222222222222223,
0.04222222222222219,
0.04222222222222224,
0.0,
0.08444444444444447,
0.0,
0.04222222222222224,
0.0,
0.0,
0.04222222222222224,
0.0,
0.0,
0.0,
0.021111111111111164,
0.06333333333333335
],
[
0.0,
0.0211111111111111,
0.0211111111111111,
0.021111111111111112,
0.042222222222222223,
0.04222222222222219,
0.04222222222222224,
0.0,
0.04222222222222224,
0.04222222222222219,
0.04222222222222224,
0.0,
0.02111111111111112,
0.0,
0.02111111111111112,
0.0,
0.0,
0.021111111111111164,
0.04222222222222224
]
],
"z_data_unit": "1 / millielectron_volt"
}
Loading
Loading