This is an ASYN port driver that takes a stream of data and pushes it to an EPICS waveform record
Usage: fourierTransform
This command computes the fast fourier transform on a window of data from the buffer that contains the global maximum value. It gives the user the option to either output the data to the console or write it to a csv file titled output.csv and generate a graph from the csv data using a python script (plot.py). In order to generate the graph the user must run the python script after running the fourierTransform command and selecting the option to display the graph (option 2).
NOTE: The output.csv file reads data directly from screenlog.0 which records all the keystrokes of the user. To successfully create the graph, fourierTransform must be typed without making any errors or using backspaces on the console.
Usage: maxBeamLossLocation
E.g. maxBeamLossLocation 0
This command computes and displays the physical location where the maximum beam loss is detected by a beam loss monitor based on values of the starting and ending positions of the monitor as well as the size of the buffer or data that the beam loss monitor reads. The user must enter the index of the waveform, such as 0 for WAVEFORM_0.
A minimum threshold value can be set for detecting maximum beam loss by writing to $(P):THRESHOLD_${channel}.
The waveformExtraction command must be executed before executing this command.
Usage: resetRegisters
This command sets relevant registers to values required by the port driver to function properly. Execute this command before executing any other commands.
Usage: waveformExtraction
E.g. waveformExtraction 0
This command extracts the relevant portion of the waveform data required for the detection of maximum beam loss location.
The relevant portion is determined in three steps. First, we extract data corresponding to the complete length of the fiber and discard the excess data.
Second, we remove the data representing the vertical parts of the optical fiber on either side since this data mostly represents noise. This is done by using
$(P):Z_OFFSET_START_${channel} and $(P):Z_OFFSET_END_${channel}. Finally, we extract another subset of this data which represents the portion the user wants to
focus on for the maximum beam loss location detection. This is done by utilizing the values entered by the user in the $(P):ROI_START_${channel} and
$(P):ROI_END_${channel} process variables.
This command saves the extracted waveform data in the following PVs:
$(P):ROI_BEAM_LOSS_${channel}=> contains the waveform data in the region of interest.$(P):ROI_Z_${channel}=> contains the z values corresponding to the physical locations of the waveform data values.
This command must be called before calling maxBeamLossLocation.
This command uses the following PVs for the extraction:
$(P):CLK_FREQUENCY$(P):SLOPE_${channel}$(P):OFFSET_${channel}$(P):Z_OFFSET_START_${channel}$(P):Z_OFFSET_END_${channel}$(P):FIBER_SPEED_OF_LIGHT$(P):ROI_START_${channel}$(P):ROI_END_${channel}$(P):FIBER_LENGTH_${channel}
The following diagram can be used as a reference to visualize the fiber and the PVs:

Usage: waveformStatus
This command provides a health-check for the various streams our port driver is connected to by displaying relevant data about the waveforms, such as their streaming status, their date and time of initialization, the time each stream takes to read data from hardware, etc.
Usage: waveformStreamInit "" ""
E.g. waveformStreamInit "/Stream0" "WAVEFORM_0"
This command initializes a thread that connects to your specified stream, reads from the stream and proceeds to write the data it receives to the waveform record you specify.
To import this WaveformReader as a module, follow the steps listed here.
This WaveformReader has three pydm screens associated with it:
- raw_waveform_data.ui => This displays the entire data buffer that we retrieve from the hardware.
- complete_waveform_data.ui => This displays the waveform from Z_OFFSET_START to Z_OFFSET_END, i.e., the waveform data obtained after removing the redundant data representing the vertical parts on either end of the fiber.
- extracted_waveform_data.ui => This displays the waveform from ROI_START to ROI_END, i.e., a subset of the complete_waveform_data obtained by extracting the waveform data between starting and ending locations entered by the user.
To open the displays use the following commands:
- pydm -m '{"P":"MPLN:UNDH:MP06:6", "channel":0}' raw_waveform_data.ui
- pydm -m '{"P":"MPLN:UNDH:MP06:6", "channel":"0"}' complete_waveform_data.ui
- pydm -m '{"P":"MPLN:UNDH:MP06:6", "channel":"0"}' extracted_waveform_data.ui
You can change the channel depending on which waveform you want to display.
Here are sample screenshots of the three screens:


