mmg-toolbox 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mmg_toolbox/__init__.py +48 -0
- mmg_toolbox/__main__.py +12 -0
- mmg_toolbox/beamline_metadata/__init__.py +0 -0
- mmg_toolbox/beamline_metadata/hdfmap_generic.py +35 -0
- mmg_toolbox/data/xray_edges.json +1 -0
- mmg_toolbox/diffraction/__init__.py +0 -0
- mmg_toolbox/diffraction/diffcalc.py +507 -0
- mmg_toolbox/nexus/__init__.py +9 -0
- mmg_toolbox/nexus/instrument_model.py +379 -0
- mmg_toolbox/nexus/nexus_functions.py +243 -0
- mmg_toolbox/nexus/nexus_names.py +62 -0
- mmg_toolbox/nexus/nexus_reader.py +48 -0
- mmg_toolbox/nexus/nexus_scan.py +163 -0
- mmg_toolbox/nexus/nexus_transformations.py +331 -0
- mmg_toolbox/nexus/nexus_writer.py +460 -0
- mmg_toolbox/plotting/__init__.py +0 -0
- mmg_toolbox/plotting/exp_plot_manager.py +296 -0
- mmg_toolbox/plotting/matplotlib.py +272 -0
- mmg_toolbox/plotting/scan_plot_manager.py +214 -0
- mmg_toolbox/scripts/__init__.py +8 -0
- mmg_toolbox/scripts/example_script.py +27 -0
- mmg_toolbox/scripts/experiment_multiline.py +24 -0
- mmg_toolbox/scripts/scripts.py +69 -0
- mmg_toolbox/scripts/spectra_script.py +118 -0
- mmg_toolbox/tkguis/__init__.py +15 -0
- mmg_toolbox/tkguis/__main__.py +6 -0
- mmg_toolbox/tkguis/apps/__init__.py +0 -0
- mmg_toolbox/tkguis/apps/config_editor.py +246 -0
- mmg_toolbox/tkguis/apps/data_viewer.py +90 -0
- mmg_toolbox/tkguis/apps/edit_text.py +49 -0
- mmg_toolbox/tkguis/apps/experiment.py +46 -0
- mmg_toolbox/tkguis/apps/file_browser.py +47 -0
- mmg_toolbox/tkguis/apps/log_viewer.py +24 -0
- mmg_toolbox/tkguis/apps/multi_scan_analysis.py +25 -0
- mmg_toolbox/tkguis/apps/namespace_select.py +72 -0
- mmg_toolbox/tkguis/apps/nexus.py +87 -0
- mmg_toolbox/tkguis/apps/peak_fit_analysis.py +25 -0
- mmg_toolbox/tkguis/apps/python_editor.py +47 -0
- mmg_toolbox/tkguis/apps/scans.py +37 -0
- mmg_toolbox/tkguis/apps/script_runner.py +20 -0
- mmg_toolbox/tkguis/cli.py +43 -0
- mmg_toolbox/tkguis/experiment_management.py +4 -0
- mmg_toolbox/tkguis/misc/__init__.py +0 -0
- mmg_toolbox/tkguis/misc/beamline_metadata.py +65 -0
- mmg_toolbox/tkguis/misc/config.py +190 -0
- mmg_toolbox/tkguis/misc/functions.py +266 -0
- mmg_toolbox/tkguis/misc/jupyter.py +63 -0
- mmg_toolbox/tkguis/misc/logging.py +41 -0
- mmg_toolbox/tkguis/misc/matplotlib.py +168 -0
- mmg_toolbox/tkguis/misc/screen_size.py +55 -0
- mmg_toolbox/tkguis/misc/search.py +61 -0
- mmg_toolbox/tkguis/misc/styles.py +196 -0
- mmg_toolbox/tkguis/widgets/__init__.py +0 -0
- mmg_toolbox/tkguis/widgets/folder_treeview.py +625 -0
- mmg_toolbox/tkguis/widgets/hdf_viewer.py +294 -0
- mmg_toolbox/tkguis/widgets/image_slider.py +284 -0
- mmg_toolbox/tkguis/widgets/log_viewer.py +185 -0
- mmg_toolbox/tkguis/widgets/multi_scan_analysis.py +206 -0
- mmg_toolbox/tkguis/widgets/nexus_data_viewer.py +123 -0
- mmg_toolbox/tkguis/widgets/nexus_details.py +221 -0
- mmg_toolbox/tkguis/widgets/nexus_image.py +429 -0
- mmg_toolbox/tkguis/widgets/nexus_plot.py +420 -0
- mmg_toolbox/tkguis/widgets/nexus_string_views.py +88 -0
- mmg_toolbox/tkguis/widgets/nexus_treeview.py +148 -0
- mmg_toolbox/tkguis/widgets/peak_fit_analysis.py +734 -0
- mmg_toolbox/tkguis/widgets/python_editor.py +567 -0
- mmg_toolbox/tkguis/widgets/roi_editor.py +96 -0
- mmg_toolbox/tkguis/widgets/scan_range_selector.py +127 -0
- mmg_toolbox/tkguis/widgets/scan_selector.py +452 -0
- mmg_toolbox/tkguis/widgets/script_runner.py +181 -0
- mmg_toolbox/tkguis/widgets/simple_plot.py +129 -0
- mmg_toolbox/tkguis/widgets/size_tester.py +47 -0
- mmg_toolbox/tkguis/widgets/title_window.py +177 -0
- mmg_toolbox/tkguis/widgets/treeview.py +192 -0
- mmg_toolbox/utils/__init__.py +0 -0
- mmg_toolbox/utils/dat_file_reader.py +65 -0
- mmg_toolbox/utils/env_functions.py +194 -0
- mmg_toolbox/utils/experiment.py +231 -0
- mmg_toolbox/utils/file_functions.py +201 -0
- mmg_toolbox/utils/file_reader.py +36 -0
- mmg_toolbox/utils/fitting.py +1401 -0
- mmg_toolbox/utils/misc_functions.py +239 -0
- mmg_toolbox/utils/nb_runner.py +145 -0
- mmg_toolbox/utils/polarisation.py +265 -0
- mmg_toolbox/utils/rotations.py +69 -0
- mmg_toolbox/utils/units.py +37 -0
- mmg_toolbox/utils/xray_utils.py +106 -0
- mmg_toolbox/xas/__init__.py +12 -0
- mmg_toolbox/xas/nxxas_loader.py +312 -0
- mmg_toolbox/xas/spectra.py +385 -0
- mmg_toolbox/xas/spectra_analysis.py +445 -0
- mmg_toolbox/xas/spectra_container.py +353 -0
- mmg_toolbox-0.4.0.dist-info/METADATA +280 -0
- mmg_toolbox-0.4.0.dist-info/RECORD +98 -0
- mmg_toolbox-0.4.0.dist-info/WHEEL +5 -0
- mmg_toolbox-0.4.0.dist-info/entry_points.txt +2 -0
- mmg_toolbox-0.4.0.dist-info/licenses/LICENSE +201 -0
- mmg_toolbox-0.4.0.dist-info/top_level.txt +1 -0
mmg_toolbox/__init__.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Magnetic Materials Group Toolbox
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
from mmg_toolbox.utils.file_reader import data_file_reader
|
|
7
|
+
from mmg_toolbox.utils.experiment import Experiment
|
|
8
|
+
|
|
9
|
+
__version__ = '0.4.0'
|
|
10
|
+
__date__ = '22/10/2025'
|
|
11
|
+
__author__ = 'Dan Porter'
|
|
12
|
+
|
|
13
|
+
__all__ = ['start_gui', 'version_info', 'title', 'module_info', 'data_file_reader', 'Experiment']
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def start_gui(*args: str):
|
|
17
|
+
from mmg_toolbox.tkguis import run
|
|
18
|
+
run(*args)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def version_info():
|
|
22
|
+
return 'mmg_toolbox version %s (%s)' % (__version__, __date__)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def title():
|
|
26
|
+
return 'mmg_toolbox version %s' % __version__
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def module_info():
|
|
30
|
+
out = 'Python version %s' % sys.version
|
|
31
|
+
out += '\n%s' % version_info()
|
|
32
|
+
# Modules
|
|
33
|
+
import numpy
|
|
34
|
+
out += '\n numpy version: %s' % numpy.__version__
|
|
35
|
+
try:
|
|
36
|
+
import matplotlib
|
|
37
|
+
out += '\nmatplotlib version: %s' % matplotlib.__version__
|
|
38
|
+
except ImportError:
|
|
39
|
+
out += '\nmatplotlib version: None'
|
|
40
|
+
try:
|
|
41
|
+
import hdfmap
|
|
42
|
+
out += '\nhdfmap version: %s (%s)' % (hdfmap.__version__, hdfmap.__date__)
|
|
43
|
+
except ImportError:
|
|
44
|
+
out += '\nhdfmap version: Not available'
|
|
45
|
+
import tkinter
|
|
46
|
+
out += '\n tkinter version: %s' % tkinter.TkVersion
|
|
47
|
+
out += '\n'
|
|
48
|
+
return out
|
mmg_toolbox/__main__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Generic metadata from NeXus files for use by HdfMap
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
class HdfMapNexus:
|
|
6
|
+
"""HdfMap Eval commands for any nexus file"""
|
|
7
|
+
instrument = 'NXinstrument_name?("beamline")'
|
|
8
|
+
sample = 'NXsample_name?("none")'
|
|
9
|
+
date = 'NXentry_start_time'
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class HdfMapMMGMetadata(HdfMapNexus):
|
|
13
|
+
"""HdfMap Eval commaands for all MMG beamlines"""
|
|
14
|
+
cmd = '(cmd|user_command|scan_command)'
|
|
15
|
+
temp = '(T_sample|itc3_device_sensor_temp|lakeshore336_cryostat|lakeshore336_sample?(300))'
|
|
16
|
+
beamline = 'beamline|instrument_name'
|
|
17
|
+
endstation = 'end_station|instrument_name'
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class HdfMapXASMetadata(HdfMapMMGMetadata):
|
|
21
|
+
"""HdfMap Eval commands for I06 & I10 metadata"""
|
|
22
|
+
pol = 'polarisation?("lh")'
|
|
23
|
+
iddgap = 'iddgap'
|
|
24
|
+
rowphase = 'idutrp if iddgap == 100 else iddtrp'
|
|
25
|
+
mode = '"tey"' # currently grabs the last NXdata.mode, not the first
|
|
26
|
+
rot = '(scmth|xabs_theta|ddiff_theta|em_pitch|hfm_pitch?(0))'
|
|
27
|
+
field = 'sqrt(field_x?(0)**2 + field_y?(0)**2 + field_z?(0)**2)'
|
|
28
|
+
field_x = 'field_x?(0)'
|
|
29
|
+
field_y = 'field_y?(0)'
|
|
30
|
+
field_z = '(magnet_field|ips_demand_field|field_z?(0))'
|
|
31
|
+
energy = '(fastEnergy|pgm_energy|energye|energyh|energy)'
|
|
32
|
+
monitor = '(C2|ca62sr|mcs16|macr16|mcse16|macj316|mcsh16|macj216)'
|
|
33
|
+
tey = '(C1|ca61sr|mcs17|macr17|mcse17|macj317|mcsh17|macj217)'
|
|
34
|
+
tfy = '(C3|ca63sr|mcs18|macr18|mcse18|macj318|mcsh18|macaj218)'
|
|
35
|
+
|