mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-05 12:20:02 +02:00
more element
This commit is contained in:
parent
101f029eef
commit
18d5c5e26d
@ -1746,14 +1746,16 @@ class Detector(CppDetectorApi):
|
|||||||
return self.getDetectorType()
|
return self.getDetectorType()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def rx_frameindex(self):
|
def rx_frameindex(self):
|
||||||
"""Current frame index received in receiver during acquisition."""
|
"""Current frame index received in receiver during acquisition."""
|
||||||
return element_if_equal(self.getRxCurrentFrameIndex())
|
return self.getRxCurrentFrameIndex()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def rx_missingpackets(self):
|
def rx_missingpackets(self):
|
||||||
"""Gets the number of missing packets for each port in receiver."""
|
"""Gets the number of missing packets for each port in receiver."""
|
||||||
return element_if_equal(self.getNumMissingPackets())
|
return self.getNumMissingPackets()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -1851,65 +1853,71 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@parallel.setter
|
@parallel.setter
|
||||||
def parallel(self, value):
|
def parallel(self, value):
|
||||||
self.setParallelMode(value)
|
ut.set_using_dict(self.setParallelMode, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def partialreset(self):
|
def partialreset(self):
|
||||||
"""[Eiger] Sets up detector to do partial or complete reset at start of acquisition. 0 complete reset, 1 partial reset. Default is complete reset.
|
"""[Eiger] Sets up detector to do partial or complete reset at start of acquisition. 0 complete reset, 1 partial reset. Default is complete reset.
|
||||||
Note
|
Note
|
||||||
-----
|
-----
|
||||||
Advanced Function!
|
Advanced Function!
|
||||||
"""
|
"""
|
||||||
return element_if_equal(self.getPartialReset())
|
return self.getPartialReset()
|
||||||
|
|
||||||
@partialreset.setter
|
@partialreset.setter
|
||||||
def partialreset(self, value):
|
def partialreset(self, value):
|
||||||
self.setPartialReset(value)
|
ut.set_using_dict(self.setPartialReset, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def tengiga(self):
|
def tengiga(self):
|
||||||
"""[Eiger][Ctb][Moench][Mythen3] 10GbE Enable."""
|
"""[Eiger][Ctb][Moench][Mythen3] 10GbE Enable."""
|
||||||
return element_if_equal(self.getTenGiga())
|
return self.getTenGiga()
|
||||||
|
|
||||||
@tengiga.setter
|
@tengiga.setter
|
||||||
def tengiga(self, value):
|
def tengiga(self, value):
|
||||||
self.setTenGiga(value)
|
ut.set_using_dict(self.setTenGiga, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def overflow(self):
|
def overflow(self):
|
||||||
"""[Eiger] Enable or disable show overflow flag in 32 bit mode. Default is disabled. """
|
"""[Eiger] Enable or disable show overflow flag in 32 bit mode. Default is disabled. """
|
||||||
return element_if_equal(self.getOverFlowMode())
|
return self.getOverFlowMode()
|
||||||
|
|
||||||
@overflow.setter
|
@overflow.setter
|
||||||
def overflow(self, value):
|
def overflow(self, value):
|
||||||
self.setOverFlowMode(value)
|
ut.set_using_dict(self.setOverFlowMode, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def flowcontrol10g(self):
|
def flowcontrol10g(self):
|
||||||
"""[Eiger][Jungfrau] Enable or disable 10GbE Flow Control."""
|
"""[Eiger][Jungfrau] Enable or disable 10GbE Flow Control."""
|
||||||
return element_if_equal(self.getTenGigaFlowControl())
|
return self.getTenGigaFlowControl()
|
||||||
|
|
||||||
@flowcontrol10g.setter
|
@flowcontrol10g.setter
|
||||||
def flowcontrol10g(self, enable):
|
def flowcontrol10g(self, enable):
|
||||||
self.setTenGigaFlowControl(enable)
|
ut.set_using_dict(self.setTenGigaFlowControl, enable)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def interruptsubframe(self):
|
def interruptsubframe(self):
|
||||||
"""[Eiger] Enable last subframe interrupt at required exposure time. Disabling will wait for last sub frame to finish exposing. Default is disabled."""
|
"""[Eiger] Enable last subframe interrupt at required exposure time. Disabling will wait for last sub frame to finish exposing. Default is disabled."""
|
||||||
return element_if_equal(self.getInterruptSubframe())
|
return self.getInterruptSubframe()
|
||||||
|
|
||||||
@interruptsubframe.setter
|
@interruptsubframe.setter
|
||||||
def interruptsubframe(self, value):
|
def interruptsubframe(self, value):
|
||||||
self.setInterruptSubframe(value)
|
ut.set_using_dict(self.setInterruptSubframe, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def gappixels(self):
|
def gappixels(self):
|
||||||
"""[Eiger][Jungfrau] Include Gap pixels in client data call back in Detecor api. Will not be in detector streaming, receiver file or streaming. Default is disabled. """
|
"""[Eiger][Jungfrau] Include Gap pixels in client data call back in Detecor api. Will not be in detector streaming, receiver file or streaming. Default is disabled. """
|
||||||
return element_if_equal(self.getRxAddGapPixels())
|
return self.getRxAddGapPixels()
|
||||||
|
|
||||||
@gappixels.setter
|
@gappixels.setter
|
||||||
def gappixels(self, value):
|
def gappixels(self, value):
|
||||||
self.setRxAddGapPixels(value)
|
ut.set_using_dict(self.setRxAddGapPixels, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def measuredperiod(self):
|
def measuredperiod(self):
|
||||||
@ -1921,8 +1929,8 @@ class Detector(CppDetectorApi):
|
|||||||
Can be measured with minimum 2 frames in an acquisition.
|
Can be measured with minimum 2 frames in an acquisition.
|
||||||
:setter: Not implemented
|
:setter: Not implemented
|
||||||
"""
|
"""
|
||||||
res = self.getMeasuredPeriod()
|
return ut.reduce_time(self.getMeasuredPeriod())
|
||||||
return element_if_equal([it.total_seconds() for it in res])
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def measuredsubperiod(self):
|
def measuredsubperiod(self):
|
||||||
@ -1932,8 +1940,7 @@ class Detector(CppDetectorApi):
|
|||||||
-----
|
-----
|
||||||
:setter: Not implemented
|
:setter: Not implemented
|
||||||
"""
|
"""
|
||||||
res = self.getMeasuredSubFramePeriod()
|
return ut.reduce_time(self.getMeasuredSubFramePeriod())
|
||||||
return element_if_equal([it.total_seconds() for it in res])
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Jungfrau specific
|
Jungfrau specific
|
||||||
@ -1953,7 +1960,7 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@auto_comp_disable.setter
|
@auto_comp_disable.setter
|
||||||
def auto_comp_disable(self, value):
|
def auto_comp_disable(self, value):
|
||||||
self.setAutoCompDisable(value)
|
ut.set_using_dict(self.setAutoCompDisable, value)
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -1981,7 +1988,7 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@storagecells.setter
|
@storagecells.setter
|
||||||
def storagecells(self, n_cells):
|
def storagecells(self, n_cells):
|
||||||
self.setNumberOfAdditionalStorageCells(n_cells)
|
ut.set_using_dict(self.setNumberOfAdditionalStorageCells, n_cells)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
@ -1998,10 +2005,9 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@storagecell_start.setter
|
@storagecell_start.setter
|
||||||
def storagecell_start(self, value):
|
def storagecell_start(self, value):
|
||||||
self.setStorageCellStart(value)
|
ut.set_using_dict(self.setStorageCellStart, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
|
||||||
def storagecell_delay(self):
|
def storagecell_delay(self):
|
||||||
"""
|
"""
|
||||||
[Jungfrau] Additional time delay between 2 consecutive exposures in burst mode, accepts either a value in seconds or datetime.timedelta
|
[Jungfrau] Additional time delay between 2 consecutive exposures in burst mode, accepts either a value in seconds or datetime.timedelta
|
||||||
@ -2024,7 +2030,7 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@storagecell_delay.setter
|
@storagecell_delay.setter
|
||||||
def storagecell_delay(self, t):
|
def storagecell_delay(self, t):
|
||||||
self.setStorageCellDelay(t)
|
ut.set_time_using_dict(self.setStorageCellDelay, t)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
@ -2040,7 +2046,7 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@temp_threshold.setter
|
@temp_threshold.setter
|
||||||
def temp_threshold(self, value):
|
def temp_threshold(self, value):
|
||||||
self.setThresholdTemperature(value)
|
ut.set_using_dict(self.setThresholdTemperature, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
@ -2057,9 +2063,16 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@temp_event.setter
|
@temp_event.setter
|
||||||
def temp_event(self, value):
|
def temp_event(self, value):
|
||||||
|
modules = []
|
||||||
|
if isinstance(value, dict):
|
||||||
|
if any(value.values()):
|
||||||
|
raise ValueError("Value needs to be 0 for reset. Setting not allowed")
|
||||||
|
modules = list(value.keys())
|
||||||
|
else:
|
||||||
if value != 0:
|
if value != 0:
|
||||||
raise ValueError("Value needs to be 0 for reset. Setting not allowed")
|
raise ValueError("Value needs to be 0 for reset. Setting not allowed")
|
||||||
self.resetTemperatureEvent()
|
|
||||||
|
self.resetTemperatureEvent(modules)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
@ -2076,7 +2089,7 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@temp_control.setter
|
@temp_control.setter
|
||||||
def temp_control(self, value):
|
def temp_control(self, value):
|
||||||
self.setTemperatureControl(value)
|
ut.set_using_dict(self.setTemperatureControl, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
@ -2090,7 +2103,7 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@selinterface.setter
|
@selinterface.setter
|
||||||
def selinterface(self, i):
|
def selinterface(self, i):
|
||||||
self.selectUDPInterface(i)
|
ut.set_using_dict(self.selectUDPInterface, i)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
---------------------------<<<Gotthard2 specific>>>---------------------------
|
---------------------------<<<Gotthard2 specific>>>---------------------------
|
||||||
@ -2168,7 +2181,7 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@veto.setter
|
@veto.setter
|
||||||
def veto(self, value):
|
def veto(self, value):
|
||||||
self.setVeto(value)
|
ut.set_using_dict(self.setVeto, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
@ -2228,7 +2241,7 @@ class Detector(CppDetectorApi):
|
|||||||
Example
|
Example
|
||||||
---------
|
---------
|
||||||
|
|
||||||
d.vetofile = '/path/to/file.txt' #set for all chips
|
d.vetofile = -1, '/path/to/file.txt' #set for all chips
|
||||||
d.vetofile = 3, '/path/to/file.txt' # set for chip 3
|
d.vetofile = 3, '/path/to/file.txt' # set for chip 3
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -2236,15 +2249,9 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@vetofile.setter
|
@vetofile.setter
|
||||||
def vetofile(self, args):
|
def vetofile(self, args):
|
||||||
if isinstance(args, str):
|
if not isinstance(args, tuple):
|
||||||
chip_index = -1
|
args = (args,)
|
||||||
fname = args
|
ut.set_using_dict(self.setVetoFile, *args)
|
||||||
elif isinstance(args, (tuple, list)):
|
|
||||||
chip_index, fname = args
|
|
||||||
else:
|
|
||||||
raise ValueError("unknow argument to vetofile")
|
|
||||||
|
|
||||||
self.setVetoFile(chip_index, fname)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def vetophoton(self):
|
def vetophoton(self):
|
||||||
@ -2263,8 +2270,9 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@vetophoton.setter
|
@vetophoton.setter
|
||||||
def vetophoton(self, args):
|
def vetophoton(self, args):
|
||||||
chip_index, n_photons, photon_energy, fname = args
|
if not isinstance(args, tuple):
|
||||||
self.setVetoPhoton(chip_index, n_photons, photon_energy, fname)
|
args = (args,)
|
||||||
|
ut.set_using_dict(self.setVetoPhoton, *args)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
@ -2279,8 +2287,9 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@vetoref.setter
|
@vetoref.setter
|
||||||
def vetoref(self, args):
|
def vetoref(self, args):
|
||||||
gain_index, value = args
|
if not isinstance(args, tuple):
|
||||||
self.setVetoReference(gain_index, value)
|
args = (args,)
|
||||||
|
ut.set_using_dict(self.setVetoReference, *args)
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -2347,7 +2356,8 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@counters.setter
|
@counters.setter
|
||||||
def counters(self, values):
|
def counters(self, values):
|
||||||
self.setCounterMask(list_to_bitmask(values))
|
values = ut.make_bitmask(values)
|
||||||
|
ut.set_using_dict(self.setCounterMask, values)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
<<<CTB>>>
|
<<<CTB>>>
|
||||||
@ -2388,18 +2398,20 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@samples.setter
|
@samples.setter
|
||||||
def samples(self, nsamples):
|
def samples(self, nsamples):
|
||||||
self.setNumberOfAnalogSamples(nsamples)
|
ut.set_using_dict(self.setNumberOfAnalogSamples, nsamples)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def runclk(self):
|
def runclk(self):
|
||||||
"""[Ctb][Moench] Run clock in MHz."""
|
"""[Ctb][Moench] Run clock in MHz."""
|
||||||
return element_if_equal(self.getRUNClock())
|
return self.getRUNClock()
|
||||||
|
|
||||||
@runclk.setter
|
@runclk.setter
|
||||||
def runclk(self, freq):
|
def runclk(self, freq):
|
||||||
self.setRUNClock(freq)
|
ut.set_using_dict(self.setRUNClock, freq)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def romode(self):
|
def romode(self):
|
||||||
"""
|
"""
|
||||||
[CTB] Readout mode of detector. Enum: readoutMode
|
[CTB] Readout mode of detector. Enum: readoutMode
|
||||||
@ -2415,31 +2427,34 @@ class Detector(CppDetectorApi):
|
|||||||
>>> d.romode
|
>>> d.romode
|
||||||
readoutMode.ANALOG_ONLY
|
readoutMode.ANALOG_ONLY
|
||||||
"""
|
"""
|
||||||
return element_if_equal(self.getReadoutMode())
|
return self.getReadoutMode()
|
||||||
|
|
||||||
@romode.setter
|
@romode.setter
|
||||||
def romode(self, mode):
|
def romode(self, mode):
|
||||||
self.setReadoutMode(mode)
|
ut.set_using_dict(self.setReadoutMode, mode)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def asamples(self):
|
def asamples(self):
|
||||||
"""[Ctb][Moench] Number of analog samples expected. """
|
"""[Ctb][Moench] Number of analog samples expected. """
|
||||||
return element_if_equal(self.getNumberOfAnalogSamples())
|
return element_if_equal(self.getNumberOfAnalogSamples())
|
||||||
|
|
||||||
@asamples.setter
|
@asamples.setter
|
||||||
def asamples(self, N):
|
def asamples(self, N):
|
||||||
self.setNumberOfAnalogSamples(N)
|
ut.set_using_dict(self.setNumberOfAnalogSamples, N)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def dsamples(self):
|
def dsamples(self):
|
||||||
"""[CTB] Number of digital samples expected. """
|
"""[CTB] Number of digital samples expected. """
|
||||||
return element_if_equal(self.getNumberOfDigitalSamples())
|
return self.getNumberOfDigitalSamples()
|
||||||
|
|
||||||
@dsamples.setter
|
@dsamples.setter
|
||||||
def dsamples(self, N):
|
def dsamples(self, N):
|
||||||
self.setNumberOfDigitalSamples(N)
|
ut.set_using_dict(self.setNumberOfDigitalSamples, N)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def dbitphase(self):
|
def dbitphase(self):
|
||||||
"""[Ctb][Jungfrau] Phase shift of clock to latch digital bits. Absolute phase shift.
|
"""[Ctb][Jungfrau] Phase shift of clock to latch digital bits. Absolute phase shift.
|
||||||
|
|
||||||
@ -2447,40 +2462,44 @@ class Detector(CppDetectorApi):
|
|||||||
-----
|
-----
|
||||||
[Ctb]Changing dbitclk also resets dbitphase and sets to previous values.
|
[Ctb]Changing dbitclk also resets dbitphase and sets to previous values.
|
||||||
"""
|
"""
|
||||||
return element_if_equal(self.getDBITPhase())
|
return self.getDBITPhase()
|
||||||
|
|
||||||
@dbitphase.setter
|
@dbitphase.setter
|
||||||
def dbitphase(self, value):
|
def dbitphase(self, value):
|
||||||
self.setDBITPhase(value)
|
ut.set_using_dict(self.setDBITPhase, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def dbitclk(self):
|
def dbitclk(self):
|
||||||
"""[Ctb] Clock for latching the digital bits in MHz."""
|
"""[Ctb] Clock for latching the digital bits in MHz."""
|
||||||
return element_if_equal(self.getDBITClock())
|
return self.getDBITClock()
|
||||||
|
|
||||||
@dbitclk.setter
|
@dbitclk.setter
|
||||||
def dbitclk(self, value):
|
def dbitclk(self, value):
|
||||||
self.setDBITClock(value)
|
ut.set_using_dict(self.setDBITClock, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def dbitpipeline(self):
|
def dbitpipeline(self):
|
||||||
"""[Ctb] Pipeline of the clock for latching digital bits. """
|
"""[Ctb] Pipeline of the clock for latching digital bits. """
|
||||||
return element_if_equal(self.getDBITPipeline())
|
return self.getDBITPipeline()
|
||||||
|
|
||||||
@dbitpipeline.setter
|
@dbitpipeline.setter
|
||||||
def dbitpipeline(self, value):
|
def dbitpipeline(self, value):
|
||||||
self.setDBITPipeline(value)
|
ut.set_using_dict(self.setDBITPipeline, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def maxdbitphaseshift(self):
|
def maxdbitphaseshift(self):
|
||||||
"""[CTB][Jungfrau] Absolute maximum Phase shift of of the clock to latch digital bits.
|
"""[CTB][Jungfrau] Absolute maximum Phase shift of of the clock to latch digital bits.
|
||||||
Note
|
Note
|
||||||
-----
|
-----
|
||||||
:setter: Not Implemented
|
:setter: Not Implemented
|
||||||
"""
|
"""
|
||||||
return element_if_equal(self.getMaxDBITPhaseShift())
|
return self.getMaxDBITPhaseShift()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def rx_dbitlist(self):
|
def rx_dbitlist(self):
|
||||||
"""
|
"""
|
||||||
[Ctb] List of digital signal bits read out.
|
[Ctb] List of digital signal bits read out.
|
||||||
@ -2498,31 +2517,34 @@ class Detector(CppDetectorApi):
|
|||||||
>>> d.rxdbitlist
|
>>> d.rxdbitlist
|
||||||
[]
|
[]
|
||||||
"""
|
"""
|
||||||
return element_if_equal(self.getRxDbitList())
|
return self.getRxDbitList()
|
||||||
|
|
||||||
@rx_dbitlist.setter
|
@rx_dbitlist.setter
|
||||||
def rx_dbitlist(self, value):
|
def rx_dbitlist(self, value):
|
||||||
self.setRxDbitList(value)
|
ut.set_using_dict(self.setRxDbitList, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def rx_dbitoffset(self):
|
def rx_dbitoffset(self):
|
||||||
"""[Ctb] Offset in bytes in digital data to skip in receiver."""
|
"""[Ctb] Offset in bytes in digital data to skip in receiver."""
|
||||||
return element_if_equal(self.getRxDbitOffset())
|
return self.getRxDbitOffset()
|
||||||
|
|
||||||
@rx_dbitoffset.setter
|
@rx_dbitoffset.setter
|
||||||
def rx_dbitoffset(self, value):
|
def rx_dbitoffset(self, value):
|
||||||
self.setRxDbitOffset(value)
|
ut.set_using_dict(self.setRxDbitOffset, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def maxadcphaseshift(self):
|
def maxadcphaseshift(self):
|
||||||
"""[Jungfrau][CTB][Moench] Absolute maximum Phase shift of ADC clock.
|
"""[Jungfrau][CTB][Moench] Absolute maximum Phase shift of ADC clock.
|
||||||
Note
|
Note
|
||||||
-----
|
-----
|
||||||
:setter: Not Implemented
|
:setter: Not Implemented
|
||||||
"""
|
"""
|
||||||
return element_if_equal(self.getMaxADCPhaseShift())
|
return self.getMaxADCPhaseShift()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@element
|
||||||
def adcphase(self):
|
def adcphase(self):
|
||||||
"""[Gotthard][Jungfrau][CTB][Moench] Sets phase shift of ADC clock.
|
"""[Gotthard][Jungfrau][CTB][Moench] Sets phase shift of ADC clock.
|
||||||
|
|
||||||
@ -2534,11 +2556,11 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
:getter: Not implemented for Gotthard
|
:getter: Not implemented for Gotthard
|
||||||
"""
|
"""
|
||||||
return element_if_equal(self.getADCPhase())
|
return self.getADCPhase()
|
||||||
|
|
||||||
@adcphase.setter
|
@adcphase.setter
|
||||||
def adcphase(self, value):
|
def adcphase(self, value):
|
||||||
self.setADCPhase(value)
|
ut.set_using_dict(self.setADCPhase, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def adcpipeline(self):
|
def adcpipeline(self):
|
||||||
|
@ -40,6 +40,14 @@ def list_to_bitmask(values):
|
|||||||
mask += 1 << v
|
mask += 1 << v
|
||||||
return mask
|
return mask
|
||||||
|
|
||||||
|
def make_bitmask(args):
|
||||||
|
if isinstance(args, list):
|
||||||
|
return list_to_bitmask(args)
|
||||||
|
elif isinstance(args, dict):
|
||||||
|
return {key: list_to_bitmask(value) for key, value in args.items()}
|
||||||
|
else:
|
||||||
|
raise ValueError("Cannot convert arg to bitmask")
|
||||||
|
|
||||||
|
|
||||||
def to_geo(value):
|
def to_geo(value):
|
||||||
if isinstance(value, _slsdet.xy):
|
if isinstance(value, _slsdet.xy):
|
||||||
|
@ -93,20 +93,6 @@ def test_element_if_equal_int_fails():
|
|||||||
assert element_if_equal([5, 6, 7]) == [5, 6, 7]
|
assert element_if_equal([5, 6, 7]) == [5, 6, 7]
|
||||||
|
|
||||||
|
|
||||||
def test_get_set_bits():
|
|
||||||
assert (get_set_bits(0) == [])
|
|
||||||
assert get_set_bits(7) == [0, 1, 2]
|
|
||||||
|
|
||||||
|
|
||||||
def test_list_to_mask():
|
|
||||||
assert (list_to_bitmask([0, 1, 2]) == 7)
|
|
||||||
assert (list_to_bitmask([]) == 0)
|
|
||||||
assert (list_to_bitmask([0]) == 1)
|
|
||||||
assert (list_to_bitmask([1]) == 2)
|
|
||||||
assert (list_to_bitmask([3]) == 8)
|
|
||||||
assert (list_to_bitmask([1, 1, 1]) == 2)
|
|
||||||
|
|
||||||
|
|
||||||
def test_make_timedelta_from_double():
|
def test_make_timedelta_from_double():
|
||||||
t = 1.7
|
t = 1.7
|
||||||
r = make_timedelta(t)
|
r = make_timedelta(t)
|
||||||
@ -242,6 +228,7 @@ def test_make_string_path_from_dict():
|
|||||||
1: "/something/else"
|
1: "/something/else"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class DummyClass:
|
class DummyClass:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.args = []
|
self.args = []
|
||||||
@ -257,35 +244,65 @@ class DummyClass:
|
|||||||
raise TypeError
|
raise TypeError
|
||||||
self.args.append((*args, i))
|
self.args.append((*args, i))
|
||||||
|
|
||||||
|
|
||||||
def test_set_using_dict_single_int():
|
def test_set_using_dict_single_int():
|
||||||
c = DummyClass()
|
c = DummyClass()
|
||||||
set_using_dict(c.call, 5)
|
set_using_dict(c.call, 5)
|
||||||
assert c.args == [(5, )]
|
assert c.args == [(5, )]
|
||||||
|
|
||||||
|
|
||||||
def test_set_using_dict_two_ints():
|
def test_set_using_dict_two_ints():
|
||||||
c = DummyClass()
|
c = DummyClass()
|
||||||
set_using_dict(c.call, 1, 2)
|
set_using_dict(c.call, 1, 2)
|
||||||
assert c.args == [(1, 2)]
|
assert c.args == [(1, 2)]
|
||||||
|
|
||||||
|
|
||||||
def test_set_using_dict_passing_dict():
|
def test_set_using_dict_passing_dict():
|
||||||
c = DummyClass()
|
c = DummyClass()
|
||||||
set_using_dict(c.call, {0: 5, 8: 3, 9: 7})
|
set_using_dict(c.call, {0: 5, 8: 3, 9: 7})
|
||||||
assert len(c.args) == 3
|
assert len(c.args) == 3
|
||||||
assert c.args == [(5, [0]), (3, [8]), (7, [9])]
|
assert c.args == [(5, [0]), (3, [8]), (7, [9])]
|
||||||
|
|
||||||
|
|
||||||
def test_set_using_dict_calling_int_id():
|
def test_set_using_dict_calling_int_id():
|
||||||
c = DummyClass()
|
c = DummyClass()
|
||||||
set_using_dict(c.call_int_id, {0: "hej", 8: 3, 9: 7})
|
set_using_dict(c.call_int_id, {0: "hej", 8: 3, 9: 7})
|
||||||
assert len(c.args) == 3
|
assert len(c.args) == 3
|
||||||
assert c.args == [("hej", 0), (3, 8), (7, 9)]
|
assert c.args == [("hej", 0), (3, 8), (7, 9)]
|
||||||
|
|
||||||
|
|
||||||
def test_set_using_dict_pass_multiple_args():
|
def test_set_using_dict_pass_multiple_args():
|
||||||
c = DummyClass()
|
c = DummyClass()
|
||||||
set_using_dict(c.call, "a", "b", "c")
|
set_using_dict(c.call, "a", "b", "c")
|
||||||
assert len(c.args) == 1
|
assert len(c.args) == 1
|
||||||
assert c.args == [("a", "b", "c")]
|
assert c.args == [("a", "b", "c")]
|
||||||
|
|
||||||
|
|
||||||
def test_set_using_dict_passing_dict_with_multiple_args():
|
def test_set_using_dict_passing_dict_with_multiple_args():
|
||||||
c = DummyClass()
|
c = DummyClass()
|
||||||
set_using_dict(c.call, {0: ("a", "b"), 1: ("c", "d")})
|
set_using_dict(c.call, {0: ("a", "b"), 1: ("c", "d")})
|
||||||
assert c.args == [("a", "b", [0]), ("c", "d", [1])]
|
assert c.args == [("a", "b", [0]), ("c", "d", [1])]
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_set_bits():
|
||||||
|
assert (get_set_bits(0) == [])
|
||||||
|
assert get_set_bits(7) == [0, 1, 2]
|
||||||
|
|
||||||
|
|
||||||
|
def test_list_to_mask():
|
||||||
|
assert (list_to_bitmask([0, 1, 2]) == 7)
|
||||||
|
assert (list_to_bitmask([]) == 0)
|
||||||
|
assert (list_to_bitmask([0]) == 1)
|
||||||
|
assert (list_to_bitmask([1]) == 2)
|
||||||
|
assert (list_to_bitmask([3]) == 8)
|
||||||
|
assert (list_to_bitmask([1, 1, 1]) == 2)
|
||||||
|
|
||||||
|
|
||||||
|
def test_make_bitmask_from_list_of_int():
|
||||||
|
assert make_bitmask([0, 1, 2]) == 0b111
|
||||||
|
assert make_bitmask([0, 1, 7]) == 0b10000011
|
||||||
|
assert make_bitmask([1, 1, 1]) == 0b10
|
||||||
|
|
||||||
|
|
||||||
|
def test_make_bitmask_from_dict():
|
||||||
|
assert make_bitmask({0: [0, 1], 1: [0, 1, 7]}) == {0: 0b11, 1: 0b10000011}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user