Skip to content

Commit bba1552

Browse files
committed
2 parents af48776 + e462b9e commit bba1552

File tree

4 files changed

+43
-4
lines changed

4 files changed

+43
-4
lines changed

CHANGES.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,21 @@
44
Change History
55
##############
66

7-
:1.1.15: expected by *tba* :
7+
:1.1.16: expected by *tba* :
8+
9+
:1.1.15: expected by *2019-11-29* : bug fixes
10+
11+
* `#259 <https://github.com/prjemian/spec2nexus/issues/259>`_
12+
resolve AssertionError from setup_lorentzian_swait
13+
14+
* `#258 <https://github.com/prjemian/spec2nexus/issues/258>`_
15+
swait record does not units, some other fields
16+
17+
* `#255 <https://github.com/prjemian/spec2nexus/issues/255>`_
18+
plans: resolve indentation error
19+
20+
* `#252 <https://github.com/prjemian/spec2nexus/issues/252>`_
21+
synApps: add asyn record support
822

923
:1.1.14: released *2019-09-03* : bug fixes, more synApps support
1024

apstools/devices.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
77
.. autosummary::
88
9+
~ApsCycleComputedRO
910
~ApsMachineParametersDevice
1011
~ApsPssShutter
1112
~ApsPssShutterWithStatus
@@ -129,6 +130,7 @@
129130
from ophyd import Signal, EpicsMotor, EpicsSignal, EpicsSignalRO
130131
from ophyd.mca import EpicsMCARecord
131132
from ophyd.scaler import EpicsScaler, ScalerCH
133+
from ophyd.sim import SignalRO
132134

133135
from ophyd.areadetector.filestore_mixins import FileStoreBase
134136
from ophyd.areadetector.filestore_mixins import FileStorePluginBase
@@ -174,6 +176,23 @@ def use_EPICS_scaler_channels(scaler):
174176
scaler.channels.configuration_attrs = configuration_attrs
175177

176178

179+
class ApsCycleComputedRO(SignalRO):
180+
"""
181+
compute the APS cycle name based on the calendar and the usual practice
182+
183+
Absent any facility PV that provides the name of the current operating
184+
cycle, this can be approximated by python computation (as long as the
185+
present scheduling pattern is maintained)
186+
187+
This signal is read-only.
188+
"""
189+
190+
def get(self):
191+
dt = datetime.now()
192+
aps_cycle = f"{dt.year}-{int((dt.month-0.1)/4) + 1}"
193+
return aps_cycle
194+
195+
177196
class ApsOperatorMessagesDevice(Device):
178197
"""general messages from the APS main control room"""
179198
operators = Component(EpicsSignalRO, "OPS:message1", string=True)
@@ -218,6 +237,7 @@ class ApsMachineParametersDevice(Device):
218237
"""
219238
current = Component(EpicsSignalRO, "S:SRcurrentAI")
220239
lifetime = Component(EpicsSignalRO, "S:SRlifeTimeHrsCC")
240+
aps_cycle = Component(ApsCycleComputedRO)
221241
machine_status = Component(EpicsSignalRO, "S:DesiredMode", string=True)
222242
# In [3]: APS.machine_status.enum_strs
223243
# Out[3]:

apstools/plans.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def addDeviceDataAsStream(devices, label):
7878
devices = [devices]
7979
for d in devices:
8080
yield from bps.read(d)
81-
yield from bps.save()
81+
yield from bps.save()
8282

8383

8484
def execute_command_list(filename, commands, md={}):

apstools/synApps/swait.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
DynamicDeviceComponent as DDC,
4747
FormattedComponent as FC)
4848
from ophyd import EpicsSignal, Signal
49+
from ophyd.signal import EpicsSignalBase
4950

5051
from ._common import EpicsRecordDeviceCommonAll, EpicsRecordFloatFields
5152
from .. import utils as APS_utils
@@ -90,7 +91,7 @@ def _swait_channels(channel_list):
9091
return defn
9192

9293

93-
class SwaitRecord(EpicsRecordFloatFields, EpicsRecordDeviceCommonAll):
94+
class SwaitRecord(EpicsRecordDeviceCommonAll):
9495
"""
9596
synApps swait record: used as $(P):userCalc$(N)
9697
@@ -99,6 +100,10 @@ class SwaitRecord(EpicsRecordFloatFields, EpicsRecordDeviceCommonAll):
99100
~reset
100101
101102
"""
103+
precision = Cpt(EpicsSignal, ".PREC")
104+
high_operating_range = Cpt(EpicsSignal, ".HOPR")
105+
low_operating_range = Cpt(EpicsSignal, ".LOPR")
106+
102107
calculated_value = Cpt(EpicsSignal, ".VAL")
103108
calculation = Cpt(EpicsSignal, ".CALC")
104109

@@ -224,7 +229,7 @@ def _setup_peak_swait_(calc, desc, swait, ref_signal, center=0, width=1, scale=1
224229
"""
225230
# consider a noisy background, as well (needs a couple calcs)
226231
assert(isinstance(swait, SwaitRecord))
227-
assert(isinstance(ref_signal, Signal))
232+
assert(isinstance(ref_signal, EpicsSignalBase))
228233
assert(width > 0)
229234
assert(0.0 <= noise <= 1.0)
230235
swait.reset()

0 commit comments

Comments
 (0)