Skip to content

Commit a39196e

Browse files
committed
Merge branch 'main' of https://github.com/sandialabs/pyscan into docs
2 parents 98e3580 + ea71d69 commit a39196e

17 files changed

+117
-2366
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## [0.7.4](https://github.com/sandialabs/pyscan/compare/v0.7.3...v0.7.4) (2024-10-01)
2+
3+
4+
### Bug Fixes
5+
6+
* **measurement:** fixed sparse experiment to use scan naming convention rather than loop. ([423ce39](https://github.com/sandialabs/pyscan/commit/423ce39cb05f751a09a313682c46c2254cc6472e))
7+
* **plotting:** updating loop nomenclature to scan in plot_generator. ([af27aa6](https://github.com/sandialabs/pyscan/commit/af27aa626df4cf0bc3b78f8cb6847ca9a5ec9c49))
8+
9+
10+
111
## [0.7.3](https://github.com/sandialabs/pyscan/compare/v0.7.2...v0.7.3) (2024-09-24)
212

313

pyscan/VERSION.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "0.7.3"
2+
"version": "0.7.4"
33
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Passed with test_instrument_driver version v0.1.0 tested on pyscan version v0.7.0 at 2024-08-20 12:26:41
1+
Passed with test_instrument_driver version v0.1.0 tested on pyscan version v0.7.0 at 2024-09-05 16:00:29
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Passed with test_voltage version v0.1.0 tested on pyscan version v0.7.0 at 2024-08-20 12:26:41
1+
Passed with test_voltage version v0.1.0 tested on pyscan version v0.7.0 at 2024-09-05 16:00:29

pyscan/measurement/abstract_experiment.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,11 @@ def default_trigger_function(self):
290290

291291
# legacy naming convention
292292
class MetaSweep(AbstractExperiment):
293-
''' Present for backwards compatibility. Renamed to :class:`.AbstractExperiment`.
294293
'''
295-
pass
294+
Present for backwards compatibility. Renamed to :class:`.AbstractExperiment`.
295+
'''
296+
def __init__(self, runinfo, devices, data_dir):
297+
warning_msg = ("Use of legacy nomenclature detected but no longer supported.\n"
298+
+ "You entered MetaSweep, use AbstractExperiment instead.")
299+
raise DeprecationWarning(f"\033[93m*** WARNING! ***: {warning_msg} \033[0m")
300+
assert False, f"\033[93m*** WARNING! ***: {warning_msg} \033[0m"

pyscan/measurement/experiment.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,4 +267,12 @@ def run(self):
267267

268268
# legacy naming convention
269269
class Sweep(Experiment):
270-
pass
270+
'''
271+
Present for backwards compatibility. Renamed to :class:`.Experiment`.
272+
'''
273+
274+
def __init__(self, runinfo, devices, data_dir=None, verbose=False, time=False):
275+
warning_msg = ("Use of legacy nomenclature detected but no longer supported.\n"
276+
+ "You entered Sweep, use Experiment instead.")
277+
raise DeprecationWarning(f"\033[93m*** WARNING! ***: {warning_msg} \033[0m")
278+
assert False, f"\033[93m*** WARNING! ***: {warning_msg} \033[0m"

pyscan/measurement/run_info.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,43 +195,55 @@ def has_average_scan(self):
195195

196196
return self._has_average_scan
197197

198-
# These property's are strictly for backwards compatibility with old pyscan naming convention.
198+
####################### LEGACY SECTION ########################
199+
# This section is set up to alert users who try to use legacy nomenclature
200+
# of the updated naming convention that they must use instead.
199201
@property
200202
def loop0(self):
203+
legacy_warning()
201204
return self.scan0
202205

203206
@loop0.setter
204207
def loop0(self, value):
208+
legacy_warning()
205209
self.scan0 = value
206210

207211
@property
208212
def loop1(self):
213+
legacy_warning()
209214
return self.scan1
210215

211216
@loop1.setter
212217
def loop1(self, value):
218+
legacy_warning()
213219
self.scan1 = value
214220

215221
@property
216222
def loop2(self):
223+
legacy_warning()
217224
return self.scan2
218225

219226
@loop2.setter
220227
def loop2(self, value):
228+
legacy_warning()
221229
self.scan2 = value
222230

223231
@property
224232
def loop3(self):
233+
legacy_warning()
225234
return self.scan3
226235

227236
@loop3.setter
228237
def loop3(self, value):
238+
legacy_warning()
229239
self.scan3 = value
230240

231241
@property
232242
def loops(self):
233-
''' Returns array of all scans
234243
'''
244+
Returns array of all scans
245+
'''
246+
legacy_warning()
235247
return [self.scan0, self.scan1, self.scan2, self.scan3]
236248

237249

@@ -252,3 +264,10 @@ def drop(array, index):
252264
'''
253265

254266
return list(array[0:index]) + list(array[index + 1:])
267+
268+
269+
def legacy_warning():
270+
warning_msg = ("Use of legacy nomenclature detected but no longer supported.\n"
271+
+ "You entered 'loop', use 'scan' instead.")
272+
raise DeprecationWarning(f"\033[93m*** WARNING! ***: {warning_msg} \033[0m")
273+
assert False, f"\033[93m*** WARNING! ***: {warning_msg} \033[0m"

pyscan/measurement/sparse_experiment.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66

77

88
class SparseExperiment(AbstractExperiment):
9-
'''Experiment class that takes data after each loop0 iteration if
9+
'''Experiment class that takes data after each scan0 iteration if
1010
runinfo.sparse_points[self.runinfo.indicies] = 1, allowing the experiment
1111
to skip taking data points. Inherits from :class:`pyscan.measurement.abstract_experiment.AbstractExperiment`.
1212
1313
Parameters
1414
----------
1515
runinfo: :class:`pyscan.measurement.runinfo.Runinfo`
16-
Runinfo instance. The Runinfo loop containing the dependent variable
16+
Runinfo instance. The Runinfo scan containing the dependent variable
1717
that you want to average should be an instance of
1818
:class:`AverageScan<pyscan.measurement.scans.AverageScan>`.
1919
There should be only one dependent variable to be averaged.
20-
The loops representing independent variables can be instances of
20+
The scans representing independent variables can be instances of
2121
:class:`PropertyScan<pyscan.measurement.scans.PropertyScan>`.
2222
devices :
2323
ItemAttribute instance containing all experiment devices
@@ -47,29 +47,29 @@ def run(self):
4747

4848
self.runinfo.running = True
4949

50-
# Use for loop, but break if self.runinfo.running=False
51-
for m in range(self.runinfo.loop3.n):
52-
self.runinfo.loop3.i = m
53-
self.runinfo.loop3.iterate(m, self.devices)
54-
sleep(self.runinfo.loop3.dt)
50+
# Use for scan, but break if self.runinfo.running=False
51+
for m in range(self.runinfo.scan3.n):
52+
self.runinfo.scan3.i = m
53+
self.runinfo.scan3.iterate(m, self.devices)
54+
sleep(self.runinfo.scan3.dt)
5555

56-
for k in range(self.runinfo.loop2.n):
57-
self.runinfo.loop2.i = k
58-
self.runinfo.loop2.iterate(k, self.devices)
59-
sleep(self.runinfo.loop2.dt)
56+
for k in range(self.runinfo.scan2.n):
57+
self.runinfo.scan2.i = k
58+
self.runinfo.scan2.iterate(k, self.devices)
59+
sleep(self.runinfo.scan2.dt)
6060

61-
for j in range(self.runinfo.loop1.n):
62-
self.runinfo.loop1.i = j
63-
self.runinfo.loop1.iterate(j, self.devices)
64-
sleep(self.runinfo.loop1.dt)
61+
for j in range(self.runinfo.scan1.n):
62+
self.runinfo.scan1.i = j
63+
self.runinfo.scan1.iterate(j, self.devices)
64+
sleep(self.runinfo.scan1.dt)
6565

66-
for i in range(self.runinfo.loop0.n):
67-
self.runinfo.loop0.i = i
66+
for i in range(self.runinfo.scan0.n):
67+
self.runinfo.scan0.i = i
6868
sample = self.runinfo.sparse_points[self.runinfo.indicies]
6969

7070
if (sample) or (np.all(np.array(self.runinfo.indicies) == 0)):
71-
self.runinfo.loop0.iterate(i, self.devices)
72-
sleep(self.runinfo.loop0.dt)
71+
self.runinfo.scan0.iterate(i, self.devices)
72+
sleep(self.runinfo.scan0.dt)
7373

7474
data = self.runinfo.measure_function(self)
7575
if np.all(np.array(self.runinfo.indicies) == 0):
@@ -100,7 +100,7 @@ def run(self):
100100
break
101101

102102
if self.runinfo.verbose:
103-
print('Scan {}/{} Complete'.format(m + 1, self.runinfo.loop3.n))
103+
print('Scan {}/{} Complete'.format(m + 1, self.runinfo.scan3.n))
104104
if self.runinfo.running is False:
105105
self.runinfo.complete = 'stopped'
106106
break

pyscan/plotting/plot_generator.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ def get_x(self):
8080
'''
8181

8282
if self.x_name is None:
83-
self.x_name = first_string(list(self.expt.runinfo.loop0.scan_dict.keys()))
83+
self.x_name = first_string(list(self.expt.runinfo.scan0.scan_dict.keys()))
8484

85-
self.other_x = set_difference(list(self.expt.runinfo.loop0.scan_dict.keys()), self.x_name)
85+
self.other_x = set_difference(list(self.expt.runinfo.scan0.scan_dict.keys()), self.x_name)
8686
self.x = self.expt[self.x_name]
8787

8888
def get_xlabel(self):
@@ -106,8 +106,8 @@ def get_y(self):
106106
self.other_y = ''
107107
else:
108108
if self.y_name is None:
109-
self.y_name = first_string(list(self.expt.runinfo.loop1.scan_dict.keys()))
110-
self.other_y = set_difference(list(self.expt.runinfo.loop1.scan_dict.keys()), self.y_name)
109+
self.y_name = first_string(list(self.expt.runinfo.scan1.scan_dict.keys()))
110+
self.other_y = set_difference(list(self.expt.runinfo.scan1.scan_dict.keys()), self.y_name)
111111
self.y = self.expt[self.y_name]
112112

113113
def get_ylabel(self):
@@ -153,23 +153,23 @@ def get_title(self):
153153
if not self.expt.runinfo.running:
154154
return '{}, {}'.format(self.data_name, self.expt.runinfo.long_name)
155155
elif self.expt.runinfo.ndim == 4:
156-
return '{}/{}, {}, {}'.format(self.expt.runinfo.loop4.i,
157-
self.expt.runinfo.loop4.n,
156+
return '{}/{}, {}, {}'.format(self.expt.runinfo.scan4.i,
157+
self.expt.runinfo.scan4.n,
158158
self.data_name,
159159
self.expt.runinfo.long_name)
160160
elif self.expt.runinfo.ndim == 3:
161-
return '{}/{}, {}, {}'.format(self.expt.runinfo.loop3.i,
162-
self.expt.runinfo.loop3.n,
161+
return '{}/{}, {}, {}'.format(self.expt.runinfo.scan3.i,
162+
self.expt.runinfo.scan3.n,
163163
self.data_name,
164164
self.expt.runinfo.long_name)
165165
elif self.expt.runinfo.ndim == 2:
166-
return '{}/{}, {}, {}'.format(self.expt.runinfo.loop2.i,
167-
self.expt.runinfo.loop2.n,
166+
return '{}/{}, {}, {}'.format(self.expt.runinfo.scan2.i,
167+
self.expt.runinfo.scan2.n,
168168
self.data_name,
169169
self.expt.runinfo.long_name)
170170
elif self.expt.runinfo.ndim == 1:
171-
return '{}/{}, {}, {}'.format(self.expt.runinfo.loop1.i,
172-
self.expt.runinfo.loop1.n,
171+
return '{}/{}, {}, {}'.format(self.expt.runinfo.scan1.i,
172+
self.expt.runinfo.scan1.n,
173173
self.data_name,
174174
self.expt.runinfo.long_name)
175175

0 commit comments

Comments
 (0)