majoplot 0.1.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.
Files changed (33) hide show
  1. majoplot-0.1.0/.gitignore +208 -0
  2. majoplot-0.1.0/LICENSE +21 -0
  3. majoplot-0.1.0/PKG-INFO +81 -0
  4. majoplot-0.1.0/README.md +54 -0
  5. majoplot-0.1.0/README.zh-CN.md +38 -0
  6. majoplot-0.1.0/doc.zh-CN/Label.md +15 -0
  7. majoplot-0.1.0/doc.zh-CN/interactive_steps.md +43 -0
  8. majoplot-0.1.0/doc.zh-CN/main_design.md +26 -0
  9. majoplot-0.1.0/doc.zh-CN/note_of_labtalk.md +76 -0
  10. majoplot-0.1.0/pyproject.toml +60 -0
  11. majoplot-0.1.0/src/majoplot/__init__.py +0 -0
  12. majoplot-0.1.0/src/majoplot/__main__.py +25 -0
  13. majoplot-0.1.0/src/majoplot/app/__init__.py +0 -0
  14. majoplot-0.1.0/src/majoplot/app/cli.py +259 -0
  15. majoplot-0.1.0/src/majoplot/app/gui.py +6 -0
  16. majoplot-0.1.0/src/majoplot/config.json +11 -0
  17. majoplot-0.1.0/src/majoplot/domain/base.py +433 -0
  18. majoplot-0.1.0/src/majoplot/domain/importers/PPMS_Resistivity.py +128 -0
  19. majoplot-0.1.0/src/majoplot/domain/importers/VSM.py +109 -0
  20. majoplot-0.1.0/src/majoplot/domain/importers/XRD.py +62 -0
  21. majoplot-0.1.0/src/majoplot/domain/muti_axes_spec.py +172 -0
  22. majoplot-0.1.0/src/majoplot/domain/scenarios/PPMS_Resistivity/RT.py +119 -0
  23. majoplot-0.1.0/src/majoplot/domain/scenarios/VSM/MT.py +131 -0
  24. majoplot-0.1.0/src/majoplot/domain/scenarios/VSM/MT_insert.py +135 -0
  25. majoplot-0.1.0/src/majoplot/domain/scenarios/VSM/MT_reliability_analysis.py +145 -0
  26. majoplot-0.1.0/src/majoplot/domain/scenarios/XRD/Compare.py +104 -0
  27. majoplot-0.1.0/src/majoplot/domain/utils.py +87 -0
  28. majoplot-0.1.0/src/majoplot/gui/__init__.py +0 -0
  29. majoplot-0.1.0/src/majoplot/gui/main.py +529 -0
  30. majoplot-0.1.0/src/majoplot/infra/plotters/matplot.py +337 -0
  31. majoplot-0.1.0/src/majoplot/infra/plotters/origin.py +1006 -0
  32. majoplot-0.1.0/src/majoplot/infra/plotters/origin_utils/originlab_type_library.py +403 -0
  33. majoplot-0.1.0/uv.lock +540 -0
@@ -0,0 +1,208 @@
1
+ playground/**
2
+ # Byte-compiled / optimized / DLL files
3
+ __pycache__/
4
+ *.py[codz]
5
+ *$py.class
6
+
7
+ # C extensions
8
+ *.so
9
+
10
+ # Distribution / packaging
11
+ .Python
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ wheels/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py.cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ #Pipfile.lock
97
+
98
+ # UV
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ #uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ #poetry.lock
110
+ #poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ #pdm.lock
117
+ #pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ #pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi
127
+
128
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
129
+ __pypackages__/
130
+
131
+ # Celery stuff
132
+ celerybeat-schedule
133
+ celerybeat.pid
134
+
135
+ # SageMath parsed files
136
+ *.sage.py
137
+
138
+ # Environments
139
+ .env
140
+ .envrc
141
+ .venv
142
+ env/
143
+ venv/
144
+ ENV/
145
+ env.bak/
146
+ venv.bak/
147
+
148
+ # Spyder project settings
149
+ .spyderproject
150
+ .spyproject
151
+
152
+ # Rope project settings
153
+ .ropeproject
154
+
155
+ # mkdocs documentation
156
+ /site
157
+
158
+ # mypy
159
+ .mypy_cache/
160
+ .dmypy.json
161
+ dmypy.json
162
+
163
+ # Pyre type checker
164
+ .pyre/
165
+
166
+ # pytype static type analyzer
167
+ .pytype/
168
+
169
+ # Cython debug symbols
170
+ cython_debug/
171
+
172
+ # PyCharm
173
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
174
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
175
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
176
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
177
+ #.idea/
178
+
179
+ # Abstra
180
+ # Abstra is an AI-powered process automation framework.
181
+ # Ignore directories containing user credentials, local state, and settings.
182
+ # Learn more at https://abstra.io/docs
183
+ .abstra/
184
+
185
+ # Visual Studio Code
186
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
187
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
188
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
189
+ # you could uncomment the following to ignore the entire vscode folder
190
+ # .vscode/
191
+
192
+ # Ruff stuff:
193
+ .ruff_cache/
194
+
195
+ # PyPI configuration file
196
+ .pypirc
197
+
198
+ # Cursor
199
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
200
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
201
+ # refer to https://docs.cursor.com/context/ignore-files
202
+ .cursorignore
203
+ .cursorindexingignore
204
+
205
+ # Marimo
206
+ marimo/_static/
207
+ marimo/_lsp/
208
+ __marimo__/
majoplot-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 ponyofshadows
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,81 @@
1
+ Metadata-Version: 2.4
2
+ Name: majoplot
3
+ Version: 0.1.0
4
+ Summary: Automates scenario-specific data preprocessing and plotting workflows for condensed-matter physics labs (OriginLab COM backend + Matplotlib for preview).
5
+ Project-URL: Homepage, https://github.com/ponyofshadows/majoplot
6
+ Project-URL: Source, https://github.com/ponyofshadows/majoplot
7
+ Project-URL: Issues, https://github.com/ponyofshadows/majoplot/issues
8
+ Author: ponyofshadows
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: com,condensed-matter,materials-science,origin,originlab,plotting,ppms,vsm,xrd
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: Microsoft :: Windows
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
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 :: Visualization
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: matplotlib>=3.8
24
+ Requires-Dist: numpy>=2.0
25
+ Requires-Dist: pywin32>=311; platform_system == 'Windows'
26
+ Description-Content-Type: text/markdown
27
+
28
+ English | [中文文档](https://github.com/ponyofshadows/balancer/blob/master/README.zh-CN.md)
29
+
30
+ # majoplot
31
+
32
+ **Majoplot** is designed to automate repetitive data-processing tasks commonly encountered in **condensed-matter physics laboratories**.
33
+ Since figures generated by **Origin** can retain embedded data when pasted into PowerPoint slides—making it a convenient tool for data presentation—Majoplot uses **OriginLab as its primary plotting backend**.
34
+
35
+ ---
36
+
37
+ ## Main Features
38
+
39
+ * Preview raw data generated by instruments such as **VSM, PPMS, and XRD** within a single interface
40
+ * Batch-generate figures and automatically organize them into appropriate **Folders** inside an **OPJU project**
41
+
42
+ ---
43
+
44
+ ## Notes
45
+
46
+ This program **does not include OriginLab**.
47
+ To use OriginLab as the plotting backend, you must **obtain a valid OriginLab license** and **install OriginLab on your system** separately.
48
+
49
+ ---
50
+
51
+ ## Installation
52
+
53
+ Make sure **Python (including pip)** is installed on your system.
54
+
55
+ ```bash
56
+ # (Not recommended) Install globally via pip
57
+ # pip install majoplot
58
+
59
+ # (Recommended) Install via uv
60
+ uv tool install majoplot
61
+ ## If the uv tool script directory is not in your PATH, run:
62
+ ## python -m uv tool install majoplot
63
+ ```
64
+
65
+ ---
66
+
67
+ ## Usage
68
+
69
+ 1. Open a command-line window in any directory and run the following command to launch the graphical interface:
70
+
71
+ ```bash
72
+ # If installed globally via pip
73
+ # python -m majoplot
74
+
75
+ # If installed via uv
76
+ uv run majoplot
77
+ ## If the uv tool script directory is not in PATH, run:
78
+ ## python -m uv run majoplot
79
+ ```
80
+
81
+ Then simply follow the instructions provided by the graphical user interface.
@@ -0,0 +1,54 @@
1
+ English | [中文文档](https://github.com/ponyofshadows/balancer/blob/master/README.zh-CN.md)
2
+
3
+ # majoplot
4
+
5
+ **Majoplot** is designed to automate repetitive data-processing tasks commonly encountered in **condensed-matter physics laboratories**.
6
+ Since figures generated by **Origin** can retain embedded data when pasted into PowerPoint slides—making it a convenient tool for data presentation—Majoplot uses **OriginLab as its primary plotting backend**.
7
+
8
+ ---
9
+
10
+ ## Main Features
11
+
12
+ * Preview raw data generated by instruments such as **VSM, PPMS, and XRD** within a single interface
13
+ * Batch-generate figures and automatically organize them into appropriate **Folders** inside an **OPJU project**
14
+
15
+ ---
16
+
17
+ ## Notes
18
+
19
+ This program **does not include OriginLab**.
20
+ To use OriginLab as the plotting backend, you must **obtain a valid OriginLab license** and **install OriginLab on your system** separately.
21
+
22
+ ---
23
+
24
+ ## Installation
25
+
26
+ Make sure **Python (including pip)** is installed on your system.
27
+
28
+ ```bash
29
+ # (Not recommended) Install globally via pip
30
+ # pip install majoplot
31
+
32
+ # (Recommended) Install via uv
33
+ uv tool install majoplot
34
+ ## If the uv tool script directory is not in your PATH, run:
35
+ ## python -m uv tool install majoplot
36
+ ```
37
+
38
+ ---
39
+
40
+ ## Usage
41
+
42
+ 1. Open a command-line window in any directory and run the following command to launch the graphical interface:
43
+
44
+ ```bash
45
+ # If installed globally via pip
46
+ # python -m majoplot
47
+
48
+ # If installed via uv
49
+ uv run majoplot
50
+ ## If the uv tool script directory is not in PATH, run:
51
+ ## python -m uv run majoplot
52
+ ```
53
+
54
+ Then simply follow the instructions provided by the graphical user interface.
@@ -0,0 +1,38 @@
1
+ [English](https://github.com/ponyofshadows/balancer/blob/master/README.md) | 中文文档
2
+
3
+ # majoplot
4
+
5
+ Majoplot旨在尽量自动化凝聚态物理实验室的数据处理过程中的重复操作。Origin图像可携带绘图数据粘贴到PowerPoint幻灯片中,是一个不错的数据展示工具,因此Majoplot使用OriginLab作为主要的绘图后端。
6
+
7
+ ## 主要功能:
8
+ - 在同一个界面预览VSM, PPMS, XRD等仪器产生的原始数据
9
+ - 批量绘制图像,自动归档到OPJU的合适Floder中
10
+
11
+
12
+ ## 注意
13
+ 本程序不包含OriginLab,如果要使用OriginLab后端作图,需要自行获取OriginLab许可证和安装它到自己的系统中。
14
+
15
+ ## 安装
16
+ 首先需要在系统中安装Python(包括pip)。
17
+ ```bash
18
+ #(不推荐)通过pip安装到全局
19
+ #pip install majoplot
20
+
21
+ # (推荐) 通过uv安装
22
+ uv tool install majoplot
23
+ ## 如果uv启动脚本所在路径没被添加到环境变量/Path,则需要运行:
24
+ ## python -m uv tool install majoplot
25
+ ```
26
+
27
+ # 使用方法
28
+ 1. 在任意路径启打开一个命令行窗口,运行以下命令以启动图形界面
29
+ ```bash
30
+ # 如果是通过pip安装到全局
31
+ # python -m majoplot
32
+
33
+ # 如果是通过uv安装
34
+ uv run majoplot
35
+ ## 如果uv启动脚本所在路径没被添加到环境变量/Path,则需要运行:
36
+ ## python -m uv run majoplot
37
+ ```
38
+ 然后跟着图形界面的指引走就行。
@@ -0,0 +1,15 @@
1
+ # LabelDict
2
+ 随着内容的扩张,我应该把标签系统做成一个pythonic的类。
3
+ 使用标签系统是为了在保持Data类的泛用性的同时表达实例的多样性。我不知道有没有更好的范式来做这件事。
4
+ - 它应该是一个Mapping,从标签名到值的映射。而且标签名是有序的。
5
+ - LabelDict应该包含一个Label:Value Mapping,一个用于生成摘要的Labels Tuple,一个SubGroup ID,用于应对后面提到的聚类上限问题。
6
+ - 标签名是简单的字符串。同标签名的多个标签是可比较和排序的
7
+ - 标签值包括数值、单位、单位后置Bool三部分,是可哈希的。数值可以是有理数或字符串
8
+ - 多个LabelDict可根据一个GroupRule(=Labels Tuple+一个整数成员上限,<=0代表无上限)聚类,机制是
9
+ 1. 挑选拥有Labels Tuple中所有Labels的LabelDict
10
+ 2. Labels的值比较相等的放同一Group,成员的SubGroup ID 都被设为0,除非达到成员数量上限
11
+ 3. 如果达到成员数量上限,则放新的SubGroup,SubGroup ID += 1,后面依此类推.
12
+ > 这里可见SubGroup ID只是成员上限规则的派生量,同一Group不同SubGroup在聚类后会得到Label,Value完全相同的LabelDicts,必然会在下一轮分类中分到同一个Group,这时就重算SubGroup ID,所以完全不存在逻辑问题。
13
+ - 可以为一个LabelDict生成摘要(简单摘要只包含逗号分隔的带单位值,完全摘要还包含LabelName),如果SubGroupID不是默认的0,摘要中会带上它。
14
+
15
+ 如果一个标签所有实例都会拥有,且不参与group。则我认为应该直接作为属性。
@@ -0,0 +1,43 @@
1
+ # CLI/GUI交互逻辑
2
+
3
+ ## 导入数据和得到Figure对象
4
+ 1. 选择数据导入器(对应一种仪器设备)
5
+ 2. 选择作图场景 (对应一种测试项目)
6
+ 3. 选择原始数据文件
7
+ 4. 点击导入,计算得到Figure对象。
8
+ > 导入同名的原始数据可能会在保存时覆盖以前的图像
9
+
10
+ ## 预览Figure图像
11
+ - 选中一个Figure,用户能看到由matplotlib生成的预览图像
12
+ - 用户可以删除任一个Figure
13
+ - 用户可以修改任一个Figure的归档信息(opju文件名/opju下Floder名)
14
+ - 可以为当前所有Figure指定统一的归档信息
15
+ - 指定opju文件名,可选择附加或覆盖
16
+ - 指定Floder名,只能覆盖
17
+
18
+ ## 保存到OPJU
19
+ - 输入保存到的OPJU文件的目标路径
20
+ - 选择保存模式(默认为附加模式,可改成覆盖模式)
21
+ - 点击保存,得到写入后的OPJU
22
+
23
+ # GUI设计
24
+ 只需要一个界面就能展示所有功能:
25
+ ## 最左边的数据导入区
26
+ - 选择数据导入器(Importer)的选框,选项依据`domain.importers/`下的内容生成
27
+ - 选择作图场景(Scenario)的选框,选项依据`domain.scenarios/[current_selected_importer]/`下的内容生成
28
+ - 导入原始数据的按钮,按下后弹出文件管理器,供用户选择原始数据文件,用户确定后选定的文件会调用相应的Importer和Scenario进行处理,得到Figure对象
29
+ - 原始数据导入历史列表:可以看到当前App实例启动以来用户导入过的所有原始数据文件名
30
+ ## 中间的Figure预览区
31
+ 这又分为左右(3:7)两个子区域:
32
+ - 左边的是当前的Figure列表,右边的是当前选中的Figure的Matplotlib预览图,预览图在选中某个Figure项时生成,会缓存5张
33
+ - 在左边的Figure列表中,可以点击任意一个Figure,弹出一个操作框,有以下组件:
34
+ - 删除按钮:点击后删除这个Figure
35
+ - `proj_name:floder_path`的键值对编辑框,和对应保存按钮,proj名以及Figure在proj中的子Floder路径本来是Scenario处理流程默认生成的,但用户可以修改。
36
+ - 单独保存按钮,按下后弹出文件管理器选择单独保存的路径(文件夹),会依据当前`proj_name:floder_path`配置进行保存。
37
+ ## 右边的OPJU保存区
38
+ - 一个proj_name输入框
39
+ - 一个floder_path输入框
40
+ - 一个将输入框的proj_name:floder_path对应用到所有Figure的配置的按钮
41
+ - 一个将输入框的proj_name:floder_path对覆盖应用所有Figure的配置的按钮
42
+ - OPJU文件路径(一个文件夹)指定按钮和对应路径文本显示框。用户点击这个按钮会弹出文件管理器以选择一个合适的路径
43
+ - 保存模式选框,用户可选择附加保存(会附加到当前路径下对应OPJU文件的对应Floder中)或覆盖保存(如果同名OPJU文件存在会直接清空再写入)。 按钮按下后保存全部Figure到OPJU。保存时会应用每个Figure各自的`proj_name:floder_path`配置。
@@ -0,0 +1,26 @@
1
+ # 程序架构:
2
+ ```
3
+ ┌─────────────┐
4
+ │ View │ ◄───── QML 用户界面(绑定 ViewModel)
5
+ └────▲────────┘
6
+ │ 调用属性/槽函数
7
+ ┌────┴────────┐
8
+ │ ViewModel │ ◄──── Python QObject,注入 Application 服务
9
+ └────▲────────┘
10
+ │ 注入服务对象(使用Infra实现)
11
+ ┌────┴──────────────┐
12
+ │ Application Layer │ ◄──── 编排用例逻辑,使用接口(不依赖 Infra 实现);拥有状态、数据池。
13
+ └────┬──────────────┘
14
+ │ 通过接口调用功能(如 Plotter)
15
+
16
+ ┌────┴──────────────┐
17
+ │ Domain Layer │ ◄──── 定义接口(如 Plotter)、数据结构(如 FigureSpec)
18
+ └────┬──────────────┘
19
+ ▲ ▲
20
+ │ 实现接口 │ 使用数据结构
21
+ ┌────┴───────────────┐
22
+ │ Infrastructure │ ◄──── 实现接口,如 MatplotlibPlotter、OriginPlotter
23
+ └────────────────────┘
24
+ ```
25
+ 原则:
26
+ ***被调用者应完全不知道调用者的存在***
@@ -0,0 +1,76 @@
1
+ # Labtalk指令笔记
2
+ 虽然很不情愿,但我还是学习了这个古老的、古怪特性非常多的系统。
3
+
4
+ 以下笔记主要基于ChatGPT的对话和在OriginLab中的实测。
5
+
6
+ ## 开始
7
+ - 启动Origin,点击菜单栏的Window - Script Window (Shift + Alt + 3),打开Labtalk 窗口
8
+ - 输入`type Hello World`回车,得到输出。
9
+ > 在不是分号结尾的行上按Enter会运行该行的命令
10
+ > origin命令和变量名不区分大小写
11
+ > type后的内容可以是纯字符串、用""括起来的字符串、类型为字符串的变量。
12
+ ## 注释
13
+ - `\\`或`#`开头的行为注释,用`\**\`包裹的行也为注释。
14
+ ## [获取帮助](https://www.originlab.com/doc/en/LabTalk)
15
+ - 使用`help`加上关键字获得x-function相关帮助
16
+ - 关键字+`-h`获得x-function的简短帮助
17
+ 但不如直接在官网搜
18
+ ## 变量
19
+ - Labtalk变量在第一次赋值时被声明,从这时起其类型就固定不变。
20
+ - 通过`del -v`(v = variable)删除变量。
21
+ - labtalk变量能在Variables窗口查看,可以通过这个窗口发现: String变量能和其它类型变量“同名”。实际上`$`后缀是String变量真实名称的一部分,只是变量窗口不显示,所以并没有真的同名。
22
+
23
+ - 不同的变量类型:
24
+ - 可以用`a = 123`的方式赋值Double类型变量
25
+ - 可以用`b$ = 123`的方式赋值String类型变量,调用String变量时也要加`$`后缀
26
+ - `int a = 123`赋值整数变量
27
+ - 数组`a[1] = 123`编号从1开始
28
+ - 字符串数组`a$[1] = 123`
29
+
30
+
31
+ - 字符串与数值之间的转换函数
32
+ - `$()` to String
33
+
34
+ - 如何把命令的运行结果赋值给变量
35
+
36
+ ## Project Explorer Folder
37
+ 文件路径操作基于`pe_cd`,`pe_mkdir`等类shell命令:
38
+ ```labtalk
39
+
40
+ \\ 跳转到根文件夹,根文件夹名字在GUI显示与OPJU文件同名,但在Labtalk中用`/`表示它即可。
41
+ pe_cd
42
+ \\ 或
43
+ pe_cd /
44
+ \\ 或
45
+ pe_cd path:="/"
46
+
47
+ \\ 查看当前目录
48
+ pe_path
49
+ \\ 列出当前目录下的项目
50
+ pe_dir
51
+
52
+ \\ 新建目录(如果存在会加数字后缀)
53
+ pe_mkdir miaomiao
54
+ \\ 新建目录(如果存在则无输出)
55
+ pe_mkdir miaomiao chk:=1
56
+ \\ 新建目录然后立即cd进去
57
+ pe_mkdir miaomiao chk:=1 cd:=1
58
+
59
+ \\ 删除Floder 无论空还是非空都会弹出提示框
60
+ pe_rmdir miaomiao
61
+
62
+ \\ 删除page
63
+ win -cd Book1
64
+ \\ 或
65
+ win -close Book1
66
+
67
+ \\ 移动Floder或Page
68
+ pe_move move:="MT" path:="/miaomiao2";
69
+
70
+ \\ 重命名Floder或Page
71
+ pe_rename name1 name2
72
+
73
+ \\ 重命名page
74
+ win -rename name1 name2
75
+ ```
76
+
@@ -0,0 +1,60 @@
1
+ [project]
2
+ name = "majoplot"
3
+ version = "0.1.0"
4
+ description = "Automates scenario-specific data preprocessing and plotting workflows for condensed-matter physics labs (OriginLab COM backend + Matplotlib for preview)."
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ license = { text = "MIT" }
8
+
9
+ authors = [
10
+ { name = "ponyofshadows" }
11
+ ]
12
+
13
+ keywords = [
14
+ "originlab",
15
+ "origin",
16
+ "com",
17
+ "plotting",
18
+ "vsm",
19
+ "ppms",
20
+ "xrd",
21
+ "condensed-matter",
22
+ "materials-science"
23
+ ]
24
+
25
+ classifiers = [
26
+ "Intended Audience :: Science/Research",
27
+ "Topic :: Scientific/Engineering :: Physics",
28
+ "Topic :: Scientific/Engineering :: Visualization",
29
+ "License :: OSI Approved :: MIT License",
30
+ "Programming Language :: Python :: 3",
31
+ "Programming Language :: Python :: 3.11",
32
+ "Programming Language :: Python :: 3.12",
33
+ "Programming Language :: Python :: 3.13",
34
+ "Operating System :: Microsoft :: Windows",
35
+ "Operating System :: OS Independent",
36
+ ]
37
+
38
+ dependencies = [
39
+ # Matplotlib backend
40
+ "matplotlib>=3.8",
41
+ "numpy>=2.0",
42
+
43
+ # Origin COM backend (Windows only)
44
+ "pywin32>=311; platform_system=='Windows'",
45
+ ]
46
+
47
+ [project.urls]
48
+ Homepage = "https://github.com/ponyofshadows/majoplot"
49
+ Source = "https://github.com/ponyofshadows/majoplot"
50
+ Issues = "https://github.com/ponyofshadows/majoplot/issues"
51
+
52
+ [project.scripts]
53
+ majoplot = "majoplot.__main__:main"
54
+
55
+ [build-system]
56
+ requires = ["hatchling>=1.25"]
57
+ build-backend = "hatchling.build"
58
+
59
+ [tool.hatch.build.targets.wheel]
60
+ packages = ["src/majoplot"]
File without changes
@@ -0,0 +1,25 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+
5
+ from .app.cli import run_cli
6
+ from .app.gui import run_gui
7
+
8
+
9
+ def main(argv: list[str] | None = None) -> None:
10
+ parser = argparse.ArgumentParser(prog="majoplot")
11
+ group = parser.add_mutually_exclusive_group()
12
+ group.add_argument("--gui", "-g", action="store_true", help="Launch GUI (default)")
13
+ group.add_argument("--cli", "-c", action="store_true", help="Launch CLI")
14
+ args, _ = parser.parse_known_args(argv)
15
+
16
+ if args.cli:
17
+ run_cli()
18
+ return
19
+
20
+ # default GUI (also for --gui/-g)
21
+ run_gui()
22
+
23
+
24
+ if __name__ == "__main__":
25
+ main()
File without changes