maxwell-bloch-studio 10.0.0__tar.gz
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.
- maxwell_bloch_studio-10.0.0/LICENSE +21 -0
- maxwell_bloch_studio-10.0.0/PKG-INFO +218 -0
- maxwell_bloch_studio-10.0.0/README.md +182 -0
- maxwell_bloch_studio-10.0.0/pyproject.toml +57 -0
- maxwell_bloch_studio-10.0.0/setup.cfg +4 -0
- maxwell_bloch_studio-10.0.0/src/maxwell_bloch_studio.egg-info/PKG-INFO +218 -0
- maxwell_bloch_studio-10.0.0/src/maxwell_bloch_studio.egg-info/SOURCES.txt +56 -0
- maxwell_bloch_studio-10.0.0/src/maxwell_bloch_studio.egg-info/dependency_links.txt +1 -0
- maxwell_bloch_studio-10.0.0/src/maxwell_bloch_studio.egg-info/entry_points.txt +3 -0
- maxwell_bloch_studio-10.0.0/src/maxwell_bloch_studio.egg-info/requires.txt +11 -0
- maxwell_bloch_studio-10.0.0/src/maxwell_bloch_studio.egg-info/top_level.txt +2 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/__init__.py +21 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/__main__.py +5 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/api.py +151 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/app/__init__.py +2 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/app/main_window.py +1219 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/app/parameter_tabs.py +202 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/app/plot.py +620 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/app/settings_manager.py +344 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/app/solver_adapter.py +79 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/app/solver_controller.py +167 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/app/update_checker.py +133 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/app/update_pipeline.py +414 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/app/velocity_bar_controller.py +546 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/config/__init__.py +1 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/config/app_metadata.py +49 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/config/app_style.py +105 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/config/splash_state.py +4 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/config/ui_defaults.py +15 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/io/__init__.py +2 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/io/data_io.py +515 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/io/legacy_keys.py +119 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/io/parameter_io.py +236 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/main.py +68 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/paths.py +36 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/resources/equations_reference.pdf +0 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/resources/example_script.py +57 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/resources/icons/app_icon.png +0 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/resources/icons/app_image.png +0 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/resources/settings.json +857 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/resources/user_guide.pdf +0 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/sample.py +72 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/ui/__init__.py +1 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/ui/dialogs.py +207 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/ui/python_example.py +97 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/ui/solver_step_viewer.py +363 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/ui/splash_screen.py +184 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/ui/widgets/__init__.py +1 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/ui/widgets/_common.py +27 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/ui/widgets/initial_conditions.py +248 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/ui/widgets/pulse_function.py +910 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/ui/widgets/sample_properties.py +255 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/ui/widgets/scaling_parameters.py +372 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/ui/widgets/step_function.py +1053 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/utils/__init__.py +2 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/utils/constants_si.py +45 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/utils/helper_funcs.py +381 -0
- maxwell_bloch_studio-10.0.0/src/mbstudio/utils/units.py +20 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vahid Anari
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: maxwell-bloch-studio
|
|
3
|
+
Version: 10.0.0
|
|
4
|
+
Summary: Desktop app for simulating and fitting Maxwell-Bloch models of astrophysical maser light curves
|
|
5
|
+
Author-email: Vahid Anari <vahid.anari8@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/vahid-anari/maxwell-bloch-studio
|
|
8
|
+
Project-URL: Repository, https://github.com/vahid-anari/maxwell-bloch-studio
|
|
9
|
+
Project-URL: Issues, https://github.com/vahid-anari/maxwell-bloch-studio/issues
|
|
10
|
+
Keywords: maxwell-bloch,maser,superradiance,astrophysics,light-curve,fitting,pyside6,gui
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Environment :: X11 Applications :: Qt
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: PySide6<7,>=6.5
|
|
26
|
+
Requires-Dist: numpy>=1.24
|
|
27
|
+
Requires-Dist: matplotlib>=3.7
|
|
28
|
+
Requires-Dist: psutil>=5.9
|
|
29
|
+
Requires-Dist: pygments>=2.0
|
|
30
|
+
Requires-Dist: sciwidgets~=0.5.0
|
|
31
|
+
Requires-Dist: mbsolver~=0.2.0
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: build; extra == "dev"
|
|
34
|
+
Requires-Dist: twine; extra == "dev"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# Maxwell Bloch Studio
|
|
38
|
+
|
|
39
|
+
A PySide6 desktop application for simulating, visualizing, and fitting one-dimensional Maxwell-Bloch models to astronomical maser light-curve data. The application combines an interactive Qt interface, configurable physical and numerical parameters, Numba-accelerated time evolution, and publication-oriented plotting/export tools.
|
|
40
|
+
|
|
41
|
+
## Screenshot
|
|
42
|
+
|
|
43
|
+
<img src="https://raw.githubusercontent.com/vahid-anari/maxwell-bloch-studio/main/assets/main_window.png" width="1512" alt="Maxwell Bloch Studio main window">
|
|
44
|
+
|
|
45
|
+
## Features
|
|
46
|
+
|
|
47
|
+
- Interactive GUI for Maxwell-Bloch model configuration and visualization.
|
|
48
|
+
- Numba-accelerated numerical solver using Runge-Kutta time stepping, from the [mbsolver](https://github.com/vahid-anari/mbsolver) package.
|
|
49
|
+
- Interface built with [sciwidgets](https://github.com/vahid-anari/sciwidgets) (sliders, parameter panels, plot canvas).
|
|
50
|
+
- Light-curve import from velocity-tagged text files.
|
|
51
|
+
- Support for period-tagged source folders, e.g. multiple folded periods for the same source.
|
|
52
|
+
- Adjustable source, sample, initial-condition, pump-profile, and plotting parameters.
|
|
53
|
+
- Built-in visualization of fitted flux, inversion/population, pump terms, and other solver quantities.
|
|
54
|
+
- Parameter saving/loading using JSON files.
|
|
55
|
+
- Export to PDF, PNG, or SVG, with PDF exports including metadata and parameter reports.
|
|
56
|
+
- Local user guide and equations reference.
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
The app needs Python 3.10 or newer. The easiest way is [pipx](https://pipx.pypa.io),
|
|
61
|
+
which installs the app in its own environment and puts the command on your path:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pipx install maxwell-bloch-studio
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
If you work in a conda or virtual environment, install it there with pip instead:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install maxwell-bloch-studio
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Running the application
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
maxwell-bloch-studio
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
(`mbstudio` is a shorter name for the same command, and `python -m mbstudio` works too.)
|
|
80
|
+
Use the menu bar to load data folders, adjust parameters, run the solver and export plots.
|
|
81
|
+
|
|
82
|
+
## Updating
|
|
83
|
+
|
|
84
|
+
The app tells you when a new version is available. To update:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pipx upgrade maxwell-bloch-studio
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
or `pip install -U maxwell-bloch-studio` in the environment where you installed it.
|
|
91
|
+
|
|
92
|
+
## Using the solver from Python
|
|
93
|
+
|
|
94
|
+
Parameter files saved by the app can be solved in your own scripts. Install the
|
|
95
|
+
app with `pip` in the Python you run the script with (a `pipx` install is kept
|
|
96
|
+
separate from your own Python):
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
import mbstudio
|
|
100
|
+
|
|
101
|
+
f = mbstudio.ParamsFile("run_1.json") # File → Save Parameters As…
|
|
102
|
+
params = f.params() # a fresh dict, safe to change
|
|
103
|
+
params["solve.sample"]["l"] = 1.0e13 # change anything
|
|
104
|
+
res = mbstudio.solve(params) # same numbers as the app
|
|
105
|
+
|
|
106
|
+
res["time"] # time grid
|
|
107
|
+
res["intensity"][-1] # intensity at the exit of the medium
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
For the parameter file of a data folder, `f.velocities` lists the velocity
|
|
111
|
+
components and `f.params(12.3)` picks one. `f.metadata` and `f.app_version`
|
|
112
|
+
tell who saved the file, when, and with which version.
|
|
113
|
+
|
|
114
|
+
`params` is a plain dictionary keyed by the names the app uses
|
|
115
|
+
(`"solve.grid.nt"`, `"solve.sample"`, `"solve.pump.pulse1"`, …). η and θ₀ are
|
|
116
|
+
computed from the sample values (ν, Γ, T₀, L, n₀), as in the app;
|
|
117
|
+
`mbstudio.scaling(nu=…, gamma=…, t0=…, l=…, n0=…)` returns them and the other
|
|
118
|
+
derived quantities. The result holds `time`, `intensity` and `w` (one row per
|
|
119
|
+
stored z plane), `lambda_n` (pump), `A0` (boundary field), `t1` and `t2`, in the
|
|
120
|
+
solver's dimensionless units; the app's flux scaling and offsets are not applied.
|
|
121
|
+
|
|
122
|
+
A commented example script listing all keys ships with the app: open
|
|
123
|
+
*Help → Use from Python…* to copy or save it, or read
|
|
124
|
+
[`example_script.py`](https://github.com/vahid-anari/maxwell-bloch-studio/blob/main/src/mbstudio/resources/example_script.py).
|
|
125
|
+
To build the parameters in code instead, use the
|
|
126
|
+
[mbsolver](https://github.com/vahid-anari/mbsolver) package directly.
|
|
127
|
+
|
|
128
|
+
## Input data format
|
|
129
|
+
|
|
130
|
+
The application expects light-curve files as plain text files with at least two whitespace-separated columns:
|
|
131
|
+
|
|
132
|
+
```text
|
|
133
|
+
time flux
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Blank lines and lines beginning with `#` are ignored.
|
|
137
|
+
|
|
138
|
+
Supported file-name patterns are:
|
|
139
|
+
|
|
140
|
+
```text
|
|
141
|
+
Source_v=12.3.txt
|
|
142
|
+
Source_p1_v=12.3.txt
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
where:
|
|
146
|
+
|
|
147
|
+
- `Source` is the source name,
|
|
148
|
+
- `p1`, `p2`, etc. are optional period labels,
|
|
149
|
+
- `v=12.3` is the velocity-component label.
|
|
150
|
+
|
|
151
|
+
Matching parameter files can be stored as:
|
|
152
|
+
|
|
153
|
+
```text
|
|
154
|
+
Source_params.json
|
|
155
|
+
Source_p1_params.json
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
When period-tagged files are present, the application lets the user select the period set to load.
|
|
159
|
+
|
|
160
|
+
## Exporting results
|
|
161
|
+
|
|
162
|
+
Plots can be exported from the GUI as:
|
|
163
|
+
|
|
164
|
+
- PDF
|
|
165
|
+
- PNG
|
|
166
|
+
- SVG
|
|
167
|
+
|
|
168
|
+
PDF exports include the plot plus a report page containing metadata and the current parameter state.
|
|
169
|
+
|
|
170
|
+
## Documentation
|
|
171
|
+
|
|
172
|
+
The user guide and the equations reference (PDF) are installed with the app;
|
|
173
|
+
open them from the Help and Info menus.
|
|
174
|
+
|
|
175
|
+
## Development
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
git clone https://github.com/vahid-anari/maxwell-bloch-studio.git
|
|
179
|
+
cd maxwell-bloch-studio
|
|
180
|
+
pip install -e .
|
|
181
|
+
mbstudio
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
`python main.py` in the repository root also starts the app from the source
|
|
185
|
+
folder. The code lives in `src/mbstudio/`:
|
|
186
|
+
|
|
187
|
+
```text
|
|
188
|
+
src/mbstudio/
|
|
189
|
+
├── main.py # application entry point
|
|
190
|
+
├── app/ # main window, plotting, solver controller, update pipeline
|
|
191
|
+
├── ui/ # physics parameter widgets, dialogs, splash screen, step viewer
|
|
192
|
+
├── io/ # data and parameter import/export
|
|
193
|
+
├── config/ # app metadata, style and UI defaults
|
|
194
|
+
├── utils/ # units, constants, helper functions
|
|
195
|
+
└── resources/ # settings.json, icons, user guide and equations PDFs
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The numerical solver is the [mbsolver](https://github.com/vahid-anari/mbsolver)
|
|
199
|
+
package; the widgets come from [sciwidgets](https://github.com/vahid-anari/sciwidgets).
|
|
200
|
+
|
|
201
|
+
## Earlier name
|
|
202
|
+
|
|
203
|
+
Up to version 9.1 the app was called **Maxwell Bloch Solver** (`pip install
|
|
204
|
+
maxwell-bloch-solver`, command `mbsolver`). The name `mbsolver` now belongs to
|
|
205
|
+
the solver package. To move over:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
pipx uninstall maxwell-bloch-solver
|
|
209
|
+
pipx install maxwell-bloch-studio
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
(with pip: `pip uninstall maxwell-bloch-solver`, then `pip install
|
|
213
|
+
maxwell-bloch-studio`). Saved settings and parameter files carry over; in
|
|
214
|
+
scripts, change `import mbsolver` to `import mbstudio`.
|
|
215
|
+
|
|
216
|
+
## License
|
|
217
|
+
|
|
218
|
+
This project is released under the MIT License. See [`LICENSE`](https://github.com/vahid-anari/maxwell-bloch-studio/blob/main/LICENSE) for details.
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Maxwell Bloch Studio
|
|
2
|
+
|
|
3
|
+
A PySide6 desktop application for simulating, visualizing, and fitting one-dimensional Maxwell-Bloch models to astronomical maser light-curve data. The application combines an interactive Qt interface, configurable physical and numerical parameters, Numba-accelerated time evolution, and publication-oriented plotting/export tools.
|
|
4
|
+
|
|
5
|
+
## Screenshot
|
|
6
|
+
|
|
7
|
+
<img src="https://raw.githubusercontent.com/vahid-anari/maxwell-bloch-studio/main/assets/main_window.png" width="1512" alt="Maxwell Bloch Studio main window">
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- Interactive GUI for Maxwell-Bloch model configuration and visualization.
|
|
12
|
+
- Numba-accelerated numerical solver using Runge-Kutta time stepping, from the [mbsolver](https://github.com/vahid-anari/mbsolver) package.
|
|
13
|
+
- Interface built with [sciwidgets](https://github.com/vahid-anari/sciwidgets) (sliders, parameter panels, plot canvas).
|
|
14
|
+
- Light-curve import from velocity-tagged text files.
|
|
15
|
+
- Support for period-tagged source folders, e.g. multiple folded periods for the same source.
|
|
16
|
+
- Adjustable source, sample, initial-condition, pump-profile, and plotting parameters.
|
|
17
|
+
- Built-in visualization of fitted flux, inversion/population, pump terms, and other solver quantities.
|
|
18
|
+
- Parameter saving/loading using JSON files.
|
|
19
|
+
- Export to PDF, PNG, or SVG, with PDF exports including metadata and parameter reports.
|
|
20
|
+
- Local user guide and equations reference.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
The app needs Python 3.10 or newer. The easiest way is [pipx](https://pipx.pypa.io),
|
|
25
|
+
which installs the app in its own environment and puts the command on your path:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pipx install maxwell-bloch-studio
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If you work in a conda or virtual environment, install it there with pip instead:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install maxwell-bloch-studio
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Running the application
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
maxwell-bloch-studio
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
(`mbstudio` is a shorter name for the same command, and `python -m mbstudio` works too.)
|
|
44
|
+
Use the menu bar to load data folders, adjust parameters, run the solver and export plots.
|
|
45
|
+
|
|
46
|
+
## Updating
|
|
47
|
+
|
|
48
|
+
The app tells you when a new version is available. To update:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pipx upgrade maxwell-bloch-studio
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
or `pip install -U maxwell-bloch-studio` in the environment where you installed it.
|
|
55
|
+
|
|
56
|
+
## Using the solver from Python
|
|
57
|
+
|
|
58
|
+
Parameter files saved by the app can be solved in your own scripts. Install the
|
|
59
|
+
app with `pip` in the Python you run the script with (a `pipx` install is kept
|
|
60
|
+
separate from your own Python):
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
import mbstudio
|
|
64
|
+
|
|
65
|
+
f = mbstudio.ParamsFile("run_1.json") # File → Save Parameters As…
|
|
66
|
+
params = f.params() # a fresh dict, safe to change
|
|
67
|
+
params["solve.sample"]["l"] = 1.0e13 # change anything
|
|
68
|
+
res = mbstudio.solve(params) # same numbers as the app
|
|
69
|
+
|
|
70
|
+
res["time"] # time grid
|
|
71
|
+
res["intensity"][-1] # intensity at the exit of the medium
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
For the parameter file of a data folder, `f.velocities` lists the velocity
|
|
75
|
+
components and `f.params(12.3)` picks one. `f.metadata` and `f.app_version`
|
|
76
|
+
tell who saved the file, when, and with which version.
|
|
77
|
+
|
|
78
|
+
`params` is a plain dictionary keyed by the names the app uses
|
|
79
|
+
(`"solve.grid.nt"`, `"solve.sample"`, `"solve.pump.pulse1"`, …). η and θ₀ are
|
|
80
|
+
computed from the sample values (ν, Γ, T₀, L, n₀), as in the app;
|
|
81
|
+
`mbstudio.scaling(nu=…, gamma=…, t0=…, l=…, n0=…)` returns them and the other
|
|
82
|
+
derived quantities. The result holds `time`, `intensity` and `w` (one row per
|
|
83
|
+
stored z plane), `lambda_n` (pump), `A0` (boundary field), `t1` and `t2`, in the
|
|
84
|
+
solver's dimensionless units; the app's flux scaling and offsets are not applied.
|
|
85
|
+
|
|
86
|
+
A commented example script listing all keys ships with the app: open
|
|
87
|
+
*Help → Use from Python…* to copy or save it, or read
|
|
88
|
+
[`example_script.py`](https://github.com/vahid-anari/maxwell-bloch-studio/blob/main/src/mbstudio/resources/example_script.py).
|
|
89
|
+
To build the parameters in code instead, use the
|
|
90
|
+
[mbsolver](https://github.com/vahid-anari/mbsolver) package directly.
|
|
91
|
+
|
|
92
|
+
## Input data format
|
|
93
|
+
|
|
94
|
+
The application expects light-curve files as plain text files with at least two whitespace-separated columns:
|
|
95
|
+
|
|
96
|
+
```text
|
|
97
|
+
time flux
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Blank lines and lines beginning with `#` are ignored.
|
|
101
|
+
|
|
102
|
+
Supported file-name patterns are:
|
|
103
|
+
|
|
104
|
+
```text
|
|
105
|
+
Source_v=12.3.txt
|
|
106
|
+
Source_p1_v=12.3.txt
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
where:
|
|
110
|
+
|
|
111
|
+
- `Source` is the source name,
|
|
112
|
+
- `p1`, `p2`, etc. are optional period labels,
|
|
113
|
+
- `v=12.3` is the velocity-component label.
|
|
114
|
+
|
|
115
|
+
Matching parameter files can be stored as:
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
Source_params.json
|
|
119
|
+
Source_p1_params.json
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
When period-tagged files are present, the application lets the user select the period set to load.
|
|
123
|
+
|
|
124
|
+
## Exporting results
|
|
125
|
+
|
|
126
|
+
Plots can be exported from the GUI as:
|
|
127
|
+
|
|
128
|
+
- PDF
|
|
129
|
+
- PNG
|
|
130
|
+
- SVG
|
|
131
|
+
|
|
132
|
+
PDF exports include the plot plus a report page containing metadata and the current parameter state.
|
|
133
|
+
|
|
134
|
+
## Documentation
|
|
135
|
+
|
|
136
|
+
The user guide and the equations reference (PDF) are installed with the app;
|
|
137
|
+
open them from the Help and Info menus.
|
|
138
|
+
|
|
139
|
+
## Development
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
git clone https://github.com/vahid-anari/maxwell-bloch-studio.git
|
|
143
|
+
cd maxwell-bloch-studio
|
|
144
|
+
pip install -e .
|
|
145
|
+
mbstudio
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
`python main.py` in the repository root also starts the app from the source
|
|
149
|
+
folder. The code lives in `src/mbstudio/`:
|
|
150
|
+
|
|
151
|
+
```text
|
|
152
|
+
src/mbstudio/
|
|
153
|
+
├── main.py # application entry point
|
|
154
|
+
├── app/ # main window, plotting, solver controller, update pipeline
|
|
155
|
+
├── ui/ # physics parameter widgets, dialogs, splash screen, step viewer
|
|
156
|
+
├── io/ # data and parameter import/export
|
|
157
|
+
├── config/ # app metadata, style and UI defaults
|
|
158
|
+
├── utils/ # units, constants, helper functions
|
|
159
|
+
└── resources/ # settings.json, icons, user guide and equations PDFs
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The numerical solver is the [mbsolver](https://github.com/vahid-anari/mbsolver)
|
|
163
|
+
package; the widgets come from [sciwidgets](https://github.com/vahid-anari/sciwidgets).
|
|
164
|
+
|
|
165
|
+
## Earlier name
|
|
166
|
+
|
|
167
|
+
Up to version 9.1 the app was called **Maxwell Bloch Solver** (`pip install
|
|
168
|
+
maxwell-bloch-solver`, command `mbsolver`). The name `mbsolver` now belongs to
|
|
169
|
+
the solver package. To move over:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
pipx uninstall maxwell-bloch-solver
|
|
173
|
+
pipx install maxwell-bloch-studio
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
(with pip: `pip uninstall maxwell-bloch-solver`, then `pip install
|
|
177
|
+
maxwell-bloch-studio`). Saved settings and parameter files carry over; in
|
|
178
|
+
scripts, change `import mbsolver` to `import mbstudio`.
|
|
179
|
+
|
|
180
|
+
## License
|
|
181
|
+
|
|
182
|
+
This project is released under the MIT License. See [`LICENSE`](https://github.com/vahid-anari/maxwell-bloch-studio/blob/main/LICENSE) for details.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "maxwell-bloch-studio"
|
|
7
|
+
version = "10.0.0"
|
|
8
|
+
description = "Desktop app for simulating and fitting Maxwell-Bloch models of astrophysical maser light curves"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "Vahid Anari", email = "vahid.anari8@gmail.com" }]
|
|
14
|
+
keywords = [
|
|
15
|
+
"maxwell-bloch", "maser", "superradiance", "astrophysics",
|
|
16
|
+
"light-curve", "fitting", "pyside6", "gui",
|
|
17
|
+
]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 4 - Beta",
|
|
20
|
+
"Intended Audience :: Science/Research",
|
|
21
|
+
"Environment :: X11 Applications :: Qt",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Topic :: Scientific/Engineering :: Physics",
|
|
29
|
+
"Topic :: Scientific/Engineering :: Astronomy",
|
|
30
|
+
]
|
|
31
|
+
dependencies = [
|
|
32
|
+
"PySide6>=6.5,<7",
|
|
33
|
+
"numpy>=1.24",
|
|
34
|
+
"matplotlib>=3.7",
|
|
35
|
+
"psutil>=5.9",
|
|
36
|
+
"pygments>=2.0",
|
|
37
|
+
"sciwidgets~=0.5.0",
|
|
38
|
+
"mbsolver~=0.2.0",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.optional-dependencies]
|
|
42
|
+
dev = ["build", "twine"]
|
|
43
|
+
|
|
44
|
+
[project.gui-scripts]
|
|
45
|
+
maxwell-bloch-studio = "mbstudio.main:main"
|
|
46
|
+
mbstudio = "mbstudio.main:main"
|
|
47
|
+
|
|
48
|
+
[project.urls]
|
|
49
|
+
Homepage = "https://github.com/vahid-anari/maxwell-bloch-studio"
|
|
50
|
+
Repository = "https://github.com/vahid-anari/maxwell-bloch-studio"
|
|
51
|
+
Issues = "https://github.com/vahid-anari/maxwell-bloch-studio/issues"
|
|
52
|
+
|
|
53
|
+
[tool.setuptools.packages.find]
|
|
54
|
+
where = ["src"]
|
|
55
|
+
|
|
56
|
+
[tool.setuptools.package-data]
|
|
57
|
+
"mbstudio.resources" = ["*.json", "*.pdf", "*.py", "icons/*.png"]
|