PYME.Analysis.piecewiseMapping module¶
- PYME.Analysis.piecewiseMapping.GenerateBacklashCorrPMFromEventList(events, metadata, x0, y0, eventName=b'ProtocolFocus', dataPos=1, backlash=0, in_frames=True)¶
- PYME.Analysis.piecewiseMapping.GeneratePMFromEventList(events, metadata, x0, y0, eventName=b'ProtocolFocus', dataPos=1)¶
- Parameters
- events:
- metadata:
- x0: why?
- y0:
- eventName:
- dataPos: int
position in comma-separated event[‘EventDesc’] str of the float which makes ‘y’ for this mapping
- Returns
- map: piecewiseMap
- PYME.Analysis.piecewiseMapping.GeneratePMFromProtocolEvents(events, metadata, x0, y0, id='setPos', idPos=1, dataPos=2)¶
- PYME.Analysis.piecewiseMapping.bool_map_between_events(events, metadata, trigger_high, trigger_low, default=False)¶
generate a TTL output mapping [input time in units of frames] using events to trigger high/low
- Parameters
- events: list or structured ndarray
acquisition events
- metadata: PYME.IO.MetaDataHandler.MDHandlerBase
metadata with ‘Camera.CycleTime’ and ‘StartTime’ entries
- trigger_high: bytes
name of event to set output mapping high
- trigger_low: bytes
name of event to set output mapping low
- default: bool
start mapping low (False) or high (True) at t=0
- Returns
- bool_map: piecewiseMap
callable mapping object
- PYME.Analysis.piecewiseMapping.frames_to_times(fr, events, mdh)¶
Use events and metadata to convert frame numbers to seconds
2024/11/1 - This used to return the start time of the subsequent frame (i.e. approx but not exactly the end time of the frame). Changed to return the start time of the current frame, which should be more accurate with camera restarts
- Parameters
- fr: ndarray
frame numbers to map to time (in seconds since the epoch), e.g. localization data_souce[‘t’]
- events: ndarray
TODO - if events-related type fixing goes through, use events helpers to accept list here as well
- mdh: PYME.IO.MetaDataHandler
Metadata handler with ‘Camera.CycleTime’ and ‘StartTime’ entries
- Returns
- t: ndarray
times [seconds since the epoch] to map to frame numbers
- class PYME.Analysis.piecewiseMapping.piecewiseMap(y0, xvals, yvals, secsPerFrame=1, xIsSecs=True)¶
Bases:
object
- PYME.Analysis.piecewiseMapping.times_to_frames(t, events, mdh)¶
Use events and metadata to convert time-stamps to frame numbers
- Parameters
- t: ndarray
times [seconds since the epoch] to map to frame numbers
- events: ndarray
TODO - if events-related type fixing goes through, use events helpers to accept list here as well
- mdh: PYME.IO.MetaDataHandler
Metadata handler with ‘Camera.CycleTime’ and ‘StartTime’ entries
- Returns
- fr: ndarray
array of frame numbers corresponding to t input