majoplot 0.1.11__py3-none-any.whl → 0.1.13__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.
majoplot/domain/base.py CHANGED
@@ -205,7 +205,10 @@ class Data:
205
205
  @property
206
206
  def x_for_plot(self)->NDArray[np.floating]:
207
207
  if self._x_for_plot is None:
208
- self._x_for_plot = self.points_for_plot[:,0]
208
+ try:
209
+ self._x_for_plot = self.points_for_plot[:,0]
210
+ except IndexError:
211
+ return np.asarray(np.nan)
209
212
  return self._x_for_plot
210
213
 
211
214
  @property
@@ -217,13 +220,16 @@ class Data:
217
220
  @property
218
221
  def y_for_plot(self)->NDArray[np.floating]:
219
222
  if self._y_for_plot is None:
220
- self._y_for_plot = self.points_for_plot[:,1]
223
+ try:
224
+ self._y_for_plot = self.points_for_plot[:,1]
225
+ except IndexError:
226
+ return np.asarray(np.nan)
221
227
  return self._y_for_plot
222
228
 
223
229
  @property
224
230
  def ylim(self)->tuple[np.float64,np.float64]:
225
231
  if self._ylim is None:
226
- self._ylim = (min(self.y_for_plot), max(self.y_for_plot))
232
+ self._ylim = (np.min(self.y_for_plot), np.max(self.y_for_plot))
227
233
  return self._ylim
228
234
 
229
235
  @property
@@ -7,8 +7,7 @@ FIGSIZE = (8, 6)
7
7
 
8
8
  T = "Temperature (K)"
9
9
  H = "Magnetic Field (Oe)"
10
- R = "Resistivity (Ω·m)"
11
- _headers = (T,R)
10
+ R = "Resistance (Ohms)"
12
11
  RI ={
13
12
  1: {"R":"Bridge 1 Resistance (Ohms)", "I":"Bridge 1 Excitation (uA)"},
14
13
  2: {"R":"Bridge 2 Resistance (Ohms)", "I":"Bridge 2 Excitation (uA)"},
@@ -53,17 +52,10 @@ class RT:
53
52
  for H_stage, points in split_datas:
54
53
  for i in range(1,4):
55
54
  _headerTRI = (T,RI[i]["R"],RI[i]["I"])
55
+ _headers = (T,RI[i]["R"])
56
56
  s_points = [ [point[headers[x]] for x in _headerTRI] for point in points]
57
- # clear null Resistance points
57
+ # clear null R points
58
58
  s_points = np.array([point for point in s_points if point[1]])
59
- # calculate resistivity
60
- cross_section = raw_labels[f"sample{i}_cross_section"].value * 1e-6
61
- if cross_section <= 0:
62
- cross_section = np.nan
63
- length = raw_labels[f"sample{i}_length"].value * 1e-3
64
- if length <= 0:
65
- length = np.nan
66
- r_points = np.column_stack([s_points[:,0], s_points[:,1] * cross_section / length])
67
59
  # record
68
60
  Imin = np.min(s_points[:,2])
69
61
  Imax = np.max(s_points[:,2])
@@ -84,8 +76,8 @@ class RT:
84
76
  datas.append(Data(
85
77
  labels=labels,
86
78
  _headers=_headers,
87
- points=r_points,
88
- ignore_outliers=IgnoreOutlierSpec(min_gap_base=1e-8,min_gap_multiple=10),
79
+ points=s_points[:,0:2],
80
+ ignore_outliers=IgnoreOutlierSpec(min_gap_base=1e-4,min_gap_multiple=10),
89
81
  ))
90
82
 
91
83
  return datas
@@ -100,6 +92,8 @@ class RT:
100
92
  major_grid=None,
101
93
  major_tick=TickSpec(),
102
94
  legend=LegendSpec(fontsize=5),
95
+ linewidth=1,
96
+ marker_size=2,
103
97
  )
104
98
 
105
99
 
@@ -112,13 +106,14 @@ class RT:
112
106
  title=None,
113
107
  figsize=FIGSIZE,
114
108
  linestyle_cycle= ("-",),
109
+ linemarker_cycle = ("o",),
115
110
  linecolor_cycle = (
116
- "#2d0b59", "#3b0f6f", "#4a136e", "#5a176e", "#6a1c6e",
117
- "#7a216f", "#8b2770", "#9b2d71", "#ac3372", "#bd3973",
118
- "#ce4074", "#df4775", "#f04f76", "#f86a5a", "#fb8c3c",
119
- "#fdbb2d", "#fcfdbf",
111
+ "#515151", "#F14040", "#1A6FDF", "#37AD6B", "#B177DE",
112
+ "#CC9900", "#00CBCC", "#7D4E4E", "#8E8E00", "#FB6501",
113
+ "#6699CC", "#6FB802", "#FD0000FF", "#15ff00", "#FF9447",
114
+ "#fdbb2d", "#fcfdbf","#2B2E83", "#E6007A", "#00FFFF",
115
+ "#6DFFA7", "#FDBAFD","#FAB3d1",
120
116
  ),
121
- linemarker_cycle = ("o","s","^","v","d","*","x","+"),
122
117
  alpa_cycle = (1.0,),
123
118
  )
124
119
 
@@ -7,14 +7,20 @@ FIGSIZE = (8, 6)
7
7
 
8
8
  T = "Temperature (K)"
9
9
  H = "Magnetic Field (Oe)"
10
- R = "Resistance (Ohms)"
10
+ R = "Resistivity (Ω·m)"
11
11
  RI ={
12
12
  1: {"R":"Bridge 1 Resistance (Ohms)", "I":"Bridge 1 Excitation (uA)"},
13
13
  2: {"R":"Bridge 2 Resistance (Ohms)", "I":"Bridge 2 Excitation (uA)"},
14
14
  3: {"R":"Bridge 3 Resistance (Ohms)", "I":"Bridge 3 Excitation (uA)"},
15
15
  }
16
16
 
17
- class RT_Resistance:
17
+ ResistivityI ={
18
+ 1: {"R":"Bridge 1 Resistivity (Ω·m)", "I":"Bridge 1 Excitation (uA)"},
19
+ 2: {"R":"Bridge 2 Resistivity (Ω·m)", "I":"Bridge 2 Excitation (uA)"},
20
+ 3: {"R":"Bridge 3 Resistivity (Ω·m)", "I":"Bridge 3 Excitation (uA)"},
21
+ }
22
+
23
+ class RT_Resistivity:
18
24
  data_summary_label_names = ["H"]
19
25
  axes_label_names = ("date", "raw_data", "bridge", "sample_name")
20
26
  figure_label_names = ("date", "raw_data", "bridge", "sample_name")
@@ -52,10 +58,18 @@ class RT_Resistance:
52
58
  for H_stage, points in split_datas:
53
59
  for i in range(1,4):
54
60
  _headerTRI = (T,RI[i]["R"],RI[i]["I"])
55
- _headers = (T,RI[i]["R"])
61
+ _headers = (T,ResistivityI[i]["R"])
56
62
  s_points = [ [point[headers[x]] for x in _headerTRI] for point in points]
57
- # clear null R points
63
+ # clear null Resistance points
58
64
  s_points = np.array([point for point in s_points if point[1]])
65
+ # calculate resistivity
66
+ cross_section = raw_labels[f"sample{i}_cross_section"].value * 1e-6
67
+ if cross_section <= 0:
68
+ cross_section = np.nan
69
+ length = raw_labels[f"sample{i}_length"].value * 1e-3
70
+ if length <= 0:
71
+ length = np.nan
72
+ r_points = np.column_stack([s_points[:,0], s_points[:,1] * cross_section / length])
59
73
  # record
60
74
  Imin = np.min(s_points[:,2])
61
75
  Imax = np.max(s_points[:,2])
@@ -76,8 +90,8 @@ class RT_Resistance:
76
90
  datas.append(Data(
77
91
  labels=labels,
78
92
  _headers=_headers,
79
- points=s_points[:,0:2],
80
- ignore_outliers=IgnoreOutlierSpec(min_gap_base=1e-4,min_gap_multiple=10),
93
+ points=r_points,
94
+ ignore_outliers=IgnoreOutlierSpec(min_gap_base=1e-8,min_gap_multiple=10),
81
95
  ))
82
96
 
83
97
  return datas
@@ -92,6 +106,8 @@ class RT_Resistance:
92
106
  major_grid=None,
93
107
  major_tick=TickSpec(),
94
108
  legend=LegendSpec(fontsize=5),
109
+ linewidth=1,
110
+ marker_size=2,
95
111
  )
96
112
 
97
113
 
@@ -105,12 +121,13 @@ class RT_Resistance:
105
121
  figsize=FIGSIZE,
106
122
  linestyle_cycle= ("-",),
107
123
  linecolor_cycle = (
108
- "#2d0b59", "#3b0f6f", "#4a136e", "#5a176e", "#6a1c6e",
109
- "#7a216f", "#8b2770", "#9b2d71", "#ac3372", "#bd3973",
110
- "#ce4074", "#df4775", "#f04f76", "#f86a5a", "#fb8c3c",
111
- "#fdbb2d", "#fcfdbf",
124
+ "#515151", "#F14040", "#1A6FDF", "#37AD6B", "#B177DE",
125
+ "#CC9900", "#00CBCC", "#7D4E4E", "#8E8E00", "#FB6501",
126
+ "#6699CC", "#6FB802", "#FD0000FF", "#15ff00", "#FF9447",
127
+ "#fdbb2d", "#fcfdbf","#2B2E83", "#E6007A", "#00FFFF",
128
+ "#6DFFA7", "#FDBAFD","#FAB3d1",
112
129
  ),
113
- linemarker_cycle = ("o","s","^","v","d","*","x","+"),
130
+ linemarker_cycle = ("o"),
114
131
  alpa_cycle = (1.0,),
115
132
  )
116
133
 
@@ -0,0 +1,167 @@
1
+ from __future__ import annotations
2
+
3
+ from ...base import *
4
+
5
+
6
+ FIGSIZE = (8, 6)
7
+
8
+ T = "Temperature (K)"
9
+ H = "Magnetic Field (Oe)"
10
+ R = "Resistance (Ohms)"
11
+ RI ={
12
+ 1: {"R":"Bridge 1 Resistance (Ohms)", "I":"Bridge 1 Excitation (uA)"},
13
+ 2: {"R":"Bridge 2 Resistance (Ohms)", "I":"Bridge 2 Excitation (uA)"},
14
+ 3: {"R":"Bridge 3 Resistance (Ohms)", "I":"Bridge 3 Excitation (uA)"},
15
+ }
16
+ RI_normalized ={
17
+ 1: {"R":"Bridge 1 Normalized Resistance", "I":"Bridge 1 Excitation (uA)"},
18
+ 2: {"R":"Bridge 2 Normalied Resistance", "I":"Bridge 2 Excitation (uA)"},
19
+ 3: {"R":"Bridge 3 Normalized Resistance", "I":"Bridge 3 Excitation (uA)"},
20
+ }
21
+
22
+ class RT_normalized:
23
+ data_summary_label_names = ["H"]
24
+ axes_label_names = ("date", "raw_data", "bridge", "sample_name")
25
+ figure_label_names = ("date", "raw_data", "bridge", "sample_name")
26
+ figure_summary_label_names = ("raw_data","bridge","sample_name")
27
+ max_axes_in_one_figure = 1
28
+ project_to_child_folder_label_names = {"date":"sample_name"}
29
+ parent_folder_name = "RT"
30
+
31
+ @classmethod
32
+ def preprocess(cls, raw_datas:list[Data])->list[Data]:
33
+ datas = []
34
+ for raw_data in raw_datas:
35
+ raw_labels = raw_data.labels
36
+ headers = raw_data.headers
37
+ raw_points = raw_data.points
38
+
39
+ # Split by H
40
+ split_datas = []
41
+
42
+ last_H_stage = round(raw_points[0][headers[H]])
43
+ current_points = [ last_H_stage, [ raw_points[0] ] ]
44
+
45
+ for point in raw_points[1:]:
46
+ cur_H_stage = round(point[headers[H]])
47
+ if cur_H_stage != last_H_stage:
48
+ split_datas.append(current_points)
49
+ last_H_stage = cur_H_stage
50
+ current_points = [ last_H_stage, [ point ] ]
51
+ else:
52
+ current_points[1].append(point)
53
+ else:
54
+ split_datas.append(current_points)
55
+
56
+ # 3 bridges
57
+ for H_stage, points in split_datas:
58
+ for i in range(1,4):
59
+ _headerTRI = (T,RI[i]["R"],RI[i]["I"])
60
+ _headers = (T,RI_normalized[i]["R"])
61
+ s_points = [ [point[headers[x]] for x in _headerTRI] for point in points]
62
+ # clear null R points
63
+ s_points = np.array([point for point in s_points if point[1]])
64
+ # record
65
+ Imin = np.min(s_points[:,2])
66
+ Imax = np.max(s_points[:,2])
67
+ if (Imax - Imin) / Imax < 0.03:
68
+ Irange = f"{np.mean(s_points[:,1]):.1e}"
69
+ else:
70
+ Irange = f"{Imin:.1e}~{Imax:.1e}"
71
+
72
+ labels = LabelDict()
73
+ labels["instrument"] = raw_labels["instrument"]
74
+ labels["raw_data"] = raw_labels["raw_data"]
75
+ labels["date"] = raw_labels["date"]
76
+ labels["bridge"] = LabelValue(i,unit="Bridge",unit_as_postfix=False)
77
+ labels["sample_name"] = raw_labels[f"sample{i}_name"]
78
+ labels["sample_units"] = raw_labels[f"sample{i}_units"]
79
+ labels["H"] = LabelValue(H_stage, unit="Oe")
80
+ labels["I_range"] = LabelValue(Irange,unit="μA")
81
+ labels.summary_names = cls.data_summary_label_names
82
+ datas.append(Data(
83
+ labels=labels,
84
+ _headers=_headers,
85
+ points=s_points[:,0:2],
86
+ ignore_outliers=IgnoreOutlierSpec(min_gap_base=1e-4,min_gap_multiple=5),
87
+ ))
88
+ # find common range
89
+ comm_left_margin = -273.15
90
+ comm_right_margin = 3890
91
+ for data in datas:
92
+ if data.points.size < 20:
93
+ break
94
+ data_left_margin, data_right_margin = data.xlim
95
+ if data_left_margin > comm_left_margin:
96
+ comm_left_margin = data_left_margin
97
+ if data_right_margin < comm_right_margin:
98
+ comm_right_margin = data_right_margin
99
+ comm_right_margin = round(comm_right_margin)
100
+ comm_left_margin = round(comm_left_margin)
101
+
102
+ for data in datas:
103
+ points = data.points
104
+ mask = (points[:,0] > comm_left_margin) & (points[:, 0] < comm_right_margin)
105
+ points = points[mask,:]
106
+ data.points = points
107
+ data._ignore_outliers_spec_cache = None
108
+ data._points_for_plot = None
109
+ data._x_for_plot = None
110
+ data._y_for_plot = None
111
+ data._xlim = None
112
+ data._ylim = None
113
+
114
+ # normalize
115
+ for data in datas:
116
+ data: Data
117
+ ymax = np.max(np.abs(data.ylim))
118
+ data.points = np.column_stack( [data.points[:,0], np.asarray(data.points[:,1] / ymax)])
119
+ data.ignore_outliers = None
120
+ data._ignore_outliers_spec_cache = None
121
+ data._points_for_plot = None
122
+ data._x_for_plot = None
123
+ data._y_for_plot = None
124
+ data._xlim = None
125
+ data._ylim = None
126
+
127
+ return datas
128
+
129
+
130
+
131
+ @classmethod
132
+ def make_axes_spec(cls, axes_labels, data_pool)->AxesSpec:
133
+ return AxesSpec(
134
+ x_axis_title=T,
135
+ y_axis_title=R,
136
+ major_grid=None,
137
+ major_tick=TickSpec(),
138
+ legend=LegendSpec(fontsize=5),
139
+ linewidth=1,
140
+ marker_size=2,
141
+ )
142
+
143
+
144
+ @classmethod
145
+ def make_figure_spec(cls,figure_labels, axes_pool:Iterable[Axes])->FigureSpec:
146
+ figure_name = figure_labels.brief_summary
147
+
148
+ return FigureSpec(
149
+ name=figure_name,
150
+ title=None,
151
+ figsize=FIGSIZE,
152
+ linestyle_cycle= ("-",),
153
+
154
+ linecolor_cycle = (
155
+ "#515151", "#F14040", "#1A6FDF", "#37AD6B", "#B177DE",
156
+ "#CC9900", "#00CBCC", "#7D4E4E", "#8E8E00", "#FB6501",
157
+ "#6699CC", "#6FB802", "#FD0000FF", "#15ff00", "#FF9447",
158
+ "#fdbb2d", "#fcfdbf","#2B2E83", "#E6007A", "#00FFFF",
159
+ "#6DFFA7", "#FDBAFD","#FAB3d1",
160
+ ),
161
+ linemarker_cycle = ("o",),
162
+ alpa_cycle = (1.0,),
163
+ )
164
+
165
+ @classmethod
166
+ def make_muti_axes_spec(cls, axes_pool:list[Axes])->MutiAxesSpec|FAIL|None:
167
+ return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: majoplot
3
- Version: 0.1.11
3
+ Version: 0.1.13
4
4
  Summary: Automates scenario-specific data preprocessing and plotting workflows for condensed-matter physics labs (OriginLab COM backend + Matplotlib for preview).
5
5
  Project-URL: Homepage, https://github.com/ponyofshadows/majoplot
6
6
  Project-URL: Source, https://github.com/ponyofshadows/majoplot
@@ -4,14 +4,15 @@ majoplot/config.json,sha256=Fsh4B6pg6et-beyNUQ-pOu3CWd48FYIriqnOUgsaGig,183
4
4
  majoplot/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  majoplot/app/cli.py,sha256=L3ADrNasVBFZdmh5r6exuxJEcXJKx7_MROOM4DtjxxM,10033
6
6
  majoplot/app/gui.py,sha256=CpRg6LRI3dM2ALswnwz89KSKjONHRlfs69eO8P2VWYE,142
7
- majoplot/domain/base.py,sha256=JlkzZHSnXkh_C_l-ZxHrV7TbFcCEShD0mFnlu3lMUlc,14391
7
+ majoplot/domain/base.py,sha256=ZfW_KTSoELKvK3GZPBmZKcyhogZRVwnJx1M-T0nIN4Q,14585
8
8
  majoplot/domain/muti_axes_spec.py,sha256=pF4Yy2x12QSFny5x18gave-f-ZYuJMW-czwwsJ-6Ths,6313
9
9
  majoplot/domain/utils.py,sha256=X4Wdab6kSBA3eBVuRzpz62Wj-1WTWZp4e9TcYMkGeb8,3332
10
10
  majoplot/domain/importers/PPMS_Resistivity.py,sha256=ME58Thg_N4tFQYPfnP1ZkiOP_vzYAevF-qSuxqWoAoc,7867
11
11
  majoplot/domain/importers/VSM.py,sha256=sEZsz_3n67jtPLy1-grP9A8K1RPVnwuQLMUSrLOtZUk,3576
12
12
  majoplot/domain/importers/XRD.py,sha256=_CN3jKLn4vZ3Oa2cm3IcH05R_mrao2so3VTVKVEND98,2840
13
- majoplot/domain/scenarios/PPMS_Resistivity/RT.py,sha256=7bu2nVYbIGLSmhFkL85vdOzkHixiFlp_C-IpfC35CFo,5027
14
- majoplot/domain/scenarios/PPMS_Resistivity/RT_Resistance.py,sha256=04u09JUWxczWyapaElQ42cEdyLMGSb2HJ4NJ7Tww4T0,4587
13
+ majoplot/domain/scenarios/PPMS_Resistivity/RT.py,sha256=GnktsRmNrshuVQoQD8CvVloStS1Ljjz3qazYL0N1WqE,4685
14
+ majoplot/domain/scenarios/PPMS_Resistivity/RT_Resistivity.py,sha256=eTQrIocFh8H6i3HT66JutYRz3I7QlHosYekSeIN-J6k,5436
15
+ majoplot/domain/scenarios/PPMS_Resistivity/RT_normalized.py,sha256=I4QjrZ4AaXikXI_lR_spmfBBaHKBpvNT_6lYI1goidY,6455
15
16
  majoplot/domain/scenarios/VSM/ChiT.py,sha256=NcPxf1-OIFrRNBo1uDaU0LzpaKXU_EUDDo9_78Pk2Vs,6643
16
17
  majoplot/domain/scenarios/VSM/ChiT_onlyZFC.py,sha256=IFhw6kCha0OxDZ5AgWeCb9UwSFJ1JOrjxQ3N2lH4Kis,6568
17
18
  majoplot/domain/scenarios/VSM/MT.py,sha256=lnqEi6sw6pzIOaGoqkC5OWJQzROWXL32-YvtOH__Rvg,4550
@@ -24,8 +25,8 @@ majoplot/gui/main.py,sha256=v5pyi-Gb26o_lmVM4GaM_Tt_-1rTTKVRekgOcBochA0,20291
24
25
  majoplot/infra/plotters/matplot.py,sha256=DE3nCfFjL9FxNbuEgggJyXlolkP1nWKmNwJElt1bgHw,12281
25
26
  majoplot/infra/plotters/origin.py,sha256=xB80d216pmo_mXo5Lx8sGQrjQC6N0NljzzoMNG37w1g,39034
26
27
  majoplot/infra/plotters/origin_utils/originlab_type_library.py,sha256=zxOxF7nB57zwnXSaFSoCUV64ZTHhDBDRv57exatiBoU,37398
27
- majoplot-0.1.11.dist-info/METADATA,sha256=t37ChgeAnwgtB4EIiSIGchpk5ZFivgwoiZfJJ-vbL_8,2878
28
- majoplot-0.1.11.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
29
- majoplot-0.1.11.dist-info/entry_points.txt,sha256=zEiPXZtNyJQMvVS-Zl9psx8SpTafOcs8F9S8xGtOaBM,52
30
- majoplot-0.1.11.dist-info/licenses/LICENSE,sha256=fj2NqLupbHWfA5W-8tqCpT5yjO8A4F1HcKnt_maww20,1070
31
- majoplot-0.1.11.dist-info/RECORD,,
28
+ majoplot-0.1.13.dist-info/METADATA,sha256=z6mKTNCFXhMsqJKYLdSE-_wUw6374459dfEfg-En0-w,2878
29
+ majoplot-0.1.13.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
30
+ majoplot-0.1.13.dist-info/entry_points.txt,sha256=zEiPXZtNyJQMvVS-Zl9psx8SpTafOcs8F9S8xGtOaBM,52
31
+ majoplot-0.1.13.dist-info/licenses/LICENSE,sha256=fj2NqLupbHWfA5W-8tqCpT5yjO8A4F1HcKnt_maww20,1070
32
+ majoplot-0.1.13.dist-info/RECORD,,