mmpp 0.5.3__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.
- mmpp/__init__.py +193 -0
- mmpp/batch_operations.py +551 -0
- mmpp/cli.py +44 -0
- mmpp/core.py +2062 -0
- mmpp/fft/__init__.py +24 -0
- mmpp/fft/compute_fft.py +935 -0
- mmpp/fft/core.py +815 -0
- mmpp/fft/electromagnetic_analysis.py +750 -0
- mmpp/fft/main.py +599 -0
- mmpp/fft/modes.py +2330 -0
- mmpp/fft/plot.py +277 -0
- mmpp/fonts/Arial/ARIALN.TTF +0 -0
- mmpp/fonts/Arial/ARIALNB.TTF +0 -0
- mmpp/fonts/Arial/ARIALNBI.TTF +0 -0
- mmpp/fonts/Arial/ARIALNI.TTF +0 -0
- mmpp/fonts/Arial/ARLRDBD.TTF +0 -0
- mmpp/fonts/Arial/Arimo Bold Italic for Powerline.ttf +0 -0
- mmpp/fonts/Arial/Arimo Bold for Powerline.ttf +0 -0
- mmpp/fonts/Arial/Arimo Italic for Powerline.ttf +0 -0
- mmpp/fonts/Arial/Arimo for Powerline.ttf +0 -0
- mmpp/fonts/Arial/arial.ttf +0 -0
- mmpp/fonts/Arial/arialbd.ttf +0 -0
- mmpp/fonts/Arial/arialbi.ttf +0 -0
- mmpp/fonts/Arial/ariali.ttf +0 -0
- mmpp/fonts/Arial/ariblk.ttf +0 -0
- mmpp/logging_config.py +206 -0
- mmpp/paper.mplstyle +811 -0
- mmpp/plotting.py +1718 -0
- mmpp/simulation.py +435 -0
- mmpp-0.5.3.dist-info/METADATA +517 -0
- mmpp-0.5.3.dist-info/RECORD +34 -0
- mmpp-0.5.3.dist-info/WHEEL +5 -0
- mmpp-0.5.3.dist-info/entry_points.txt +2 -0
- mmpp-0.5.3.dist-info/top_level.txt +1 -0
mmpp/__init__.py
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"""
|
|
2
|
+
mmpp - Micro Magnetic Post Processing Library
|
|
3
|
+
|
|
4
|
+
A Python library for simulation and analysis of micromagnetic simulations
|
|
5
|
+
with advanced post-processing capabilities.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
__version__ = "0.5.3"
|
|
9
|
+
__author__ = "Mateusz Zelent"
|
|
10
|
+
__email__ = "mateusz.zelent@amu.edu.pl"
|
|
11
|
+
|
|
12
|
+
# Import main classes with error handling for missing dependencies
|
|
13
|
+
try:
|
|
14
|
+
from .core import MMPP, ScanResult, ZarrJobResult
|
|
15
|
+
|
|
16
|
+
_CORE_AVAILABLE = True
|
|
17
|
+
except ImportError:
|
|
18
|
+
_CORE_AVAILABLE = False
|
|
19
|
+
|
|
20
|
+
# Create dummy classes for graceful degradation
|
|
21
|
+
class MMPP:
|
|
22
|
+
def __init__(self, *args, **kwargs):
|
|
23
|
+
raise ImportError(
|
|
24
|
+
"Core dependencies not available. Install with: pip install mmpp[dev]"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
class ScanResult:
|
|
28
|
+
def __init__(self, *args, **kwargs):
|
|
29
|
+
raise ImportError(
|
|
30
|
+
"Core dependencies not available. Install with: pip install mmpp[dev]"
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
class ZarrJobResult:
|
|
34
|
+
def __init__(self, *args, **kwargs):
|
|
35
|
+
raise ImportError(
|
|
36
|
+
"Core dependencies not available. Install with: pip install mmppp[dev]"
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# Try to import plotting classes
|
|
41
|
+
try:
|
|
42
|
+
from .plotting import MMPPlotter, PlotConfig, PlotterProxy, fonts
|
|
43
|
+
|
|
44
|
+
_PLOTTING_AVAILABLE = True
|
|
45
|
+
except ImportError:
|
|
46
|
+
_PLOTTING_AVAILABLE = False
|
|
47
|
+
|
|
48
|
+
# Create dummy classes for graceful degradation
|
|
49
|
+
class MMPPlotter:
|
|
50
|
+
def __init__(self, *args, **kwargs):
|
|
51
|
+
raise ImportError(
|
|
52
|
+
"Plotting dependencies not available. Install with: pip install mmpp[plotting]"
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
class PlotConfig:
|
|
56
|
+
def __init__(self, *args, **kwargs):
|
|
57
|
+
raise ImportError(
|
|
58
|
+
"Plotting dependencies not available. Install with: pip install mmpp[plotting]"
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
class PlotterProxy:
|
|
62
|
+
def __init__(self, *args, **kwargs):
|
|
63
|
+
raise ImportError(
|
|
64
|
+
"Plotting dependencies not available. Install with: pip install mmpp[plotting]"
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# Create dummy font manager
|
|
68
|
+
class DummyFontManager:
|
|
69
|
+
def __init__(self):
|
|
70
|
+
pass
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
def paths(self):
|
|
74
|
+
return []
|
|
75
|
+
|
|
76
|
+
@property
|
|
77
|
+
def available(self):
|
|
78
|
+
return []
|
|
79
|
+
|
|
80
|
+
def add_path(self, path):
|
|
81
|
+
print("Font management not available - install matplotlib")
|
|
82
|
+
return False
|
|
83
|
+
|
|
84
|
+
def set_default_font(self, font):
|
|
85
|
+
print("Font management not available - install matplotlib")
|
|
86
|
+
return False
|
|
87
|
+
|
|
88
|
+
def __repr__(self):
|
|
89
|
+
return "FontManager: Not available (matplotlib not installed)"
|
|
90
|
+
|
|
91
|
+
fonts = DummyFontManager()
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
try:
|
|
95
|
+
from .simulation import SimulationManager
|
|
96
|
+
|
|
97
|
+
_SIMULATION_AVAILABLE = True
|
|
98
|
+
except ImportError:
|
|
99
|
+
_SIMULATION_AVAILABLE = False
|
|
100
|
+
|
|
101
|
+
# Create dummy class for graceful degradation
|
|
102
|
+
class SimulationManager:
|
|
103
|
+
def __init__(self, *args, **kwargs):
|
|
104
|
+
raise ImportError(
|
|
105
|
+
"Simulation dependencies not available. Install with: pip install mmpp[dev]"
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def open(base_path: str, **kwargs):
|
|
110
|
+
"""
|
|
111
|
+
Open and initialize an MMPP instance for the given directory path.
|
|
112
|
+
|
|
113
|
+
This is the main entry point for using the mmpp library. It creates
|
|
114
|
+
an MMPP instance that scans the provided directory for zarr files
|
|
115
|
+
and builds a database for analysis.
|
|
116
|
+
|
|
117
|
+
Parameters:
|
|
118
|
+
-----------
|
|
119
|
+
base_path : str
|
|
120
|
+
Path to the directory containing zarr simulation files
|
|
121
|
+
**kwargs : dict
|
|
122
|
+
Additional keyword arguments passed to MMPP constructor:
|
|
123
|
+
- max_workers : int, optional (default: 8)
|
|
124
|
+
Maximum number of worker threads for scanning
|
|
125
|
+
- database_name : str, optional (default: "mmpy_database")
|
|
126
|
+
Name of the database file (without extension)
|
|
127
|
+
- force : bool, optional (default: False)
|
|
128
|
+
If True, force rescan even if database exists
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
--------
|
|
132
|
+
MMPP
|
|
133
|
+
An initialized MMPP instance ready for analysis
|
|
134
|
+
|
|
135
|
+
Examples:
|
|
136
|
+
---------
|
|
137
|
+
>>> import mmpp as mp
|
|
138
|
+
>>> db = mp.open("/path/to/simulation/data")
|
|
139
|
+
>>> results = db.find(f0=2.15e+09)
|
|
140
|
+
>>> results.plot("time", "my") # Current API
|
|
141
|
+
>>> results.mpl.plot("time", "my") # Short alias
|
|
142
|
+
"""
|
|
143
|
+
if not _CORE_AVAILABLE:
|
|
144
|
+
raise ImportError(
|
|
145
|
+
"Core MMPP functionality not available. Install with: pip install mmpp[dev]"
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
# Extract force parameter for special handling
|
|
149
|
+
force = kwargs.pop("force", False)
|
|
150
|
+
|
|
151
|
+
# Create MMPP instance
|
|
152
|
+
mmpp_instance = MMPP(base_path, **kwargs)
|
|
153
|
+
|
|
154
|
+
# If force is True, trigger a rescan
|
|
155
|
+
if force:
|
|
156
|
+
mmpp_instance.force_rescan()
|
|
157
|
+
elif mmpp_instance.dataframe is None:
|
|
158
|
+
# If no database exists, perform initial scan
|
|
159
|
+
mmpp_instance.scan()
|
|
160
|
+
|
|
161
|
+
return mmpp_instance
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
# Make main classes available at package level
|
|
165
|
+
__all__ = [
|
|
166
|
+
"MMPP",
|
|
167
|
+
"ScanResult",
|
|
168
|
+
"ZarrJobResult",
|
|
169
|
+
"MMPPlotter",
|
|
170
|
+
"PlotConfig",
|
|
171
|
+
"PlotterProxy",
|
|
172
|
+
"SimulationManager",
|
|
173
|
+
"open",
|
|
174
|
+
"fonts", # Font management
|
|
175
|
+
]
|
|
176
|
+
|
|
177
|
+
# Feature availability flags
|
|
178
|
+
__features__ = {
|
|
179
|
+
"core": _CORE_AVAILABLE,
|
|
180
|
+
"plotting": _PLOTTING_AVAILABLE,
|
|
181
|
+
"simulation": _SIMULATION_AVAILABLE,
|
|
182
|
+
"mmpp": _CORE_AVAILABLE,
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
# Auto-load paper style if available
|
|
186
|
+
if _PLOTTING_AVAILABLE:
|
|
187
|
+
try:
|
|
188
|
+
from .plotting import load_paper_style
|
|
189
|
+
|
|
190
|
+
load_paper_style(verbose=False)
|
|
191
|
+
except Exception:
|
|
192
|
+
# Silently fail if style loading fails
|
|
193
|
+
pass
|