Reference

MainWindow

The MainWindow module is the main class that provides interaction between gui and user. This class integrates all other functionality.

Reference

class MainWindow.Main(args=['/usr/local/bin/sphinx-build', '-b', 'html', '-d', '_build/doctrees', '.', '_build/html'])

PyQwtWidgetGui

The PyQwtWidgetGui module provides the plotting widget base class. This class ensures:
  • proper ratio of scales cm/min, bpm/cm
  • appearance of all derived plot

Reference

class PyQwtWidgetGui.PyQwtWidgetGui(parent=None)

Base class plotting widget based on PyQwt.

Parameters:parent
clearPlot()

When a plot is cleared a signal is emitted in order to allow the FhrPlot to reinit

findClosestXPoint(point, nDirection=None)

Not used so far.

getMarginsXPx()

Get margins of x axis of this plot - length (in pixels) between end of an axis and end of plot widget.

Return type:int,int
getMarginsYPx()

Get margins of y axis of this plot - length (in pixels) between end of an axis and end of plot widget.

Return type:int,int
plot(x, y, timeString=None)

Plot data. Numpy arrays should be used instead of list, the plotting speed is about 20x faster. Time string is used for plotting time on X axis. Prior plotting either minutes or hours are located based on user preference.

Parameters:
  • x (numpy array | list()) – x axis values
  • y (numpy array | list()) – y axis values
  • timeSeries (list()) – time strings for x axis labels
runTimeLocator()

Locates time points at the X axis. The points could be minutes or hours. If both equal to -1 the time is guessed.

setXAxis(centerPoint=None, bReplot=True)

Set scale of X axis. First get width of this plot. Then use preset cm/min ratio and use it to compute X axis scale.

Parameters:centerPoint (int) – user’s clicked point at PyQwtNavigationPlot
setYAxis(height=None, bReplot=True)

Set scale of Y axis. First get height of this plot. Then use preset bmp/cm ratio and use it to compute y axis scale

Parameters:height (int) – height of the widget
sizePlotArea()

Return sizeof canvas, i.e. the size of actual plot. When this class is initialized use build in function QWidget.size() instead of getMarginsXPx()

Return type:QSize(width, height)
updateAxis()

Update X and Y axis. Replot after both axes were set.

xAxisViewMaxSample()

Returns a maximum sample that will be plotted. The calculation of max samples is based on preset dpi and bpm/cm ratio

Return type:int
xlabel(text='')

set the x axis label

ylabel(text='')

set the y axis label. The font is based on application font

class PyQwtWidgetGui.TimeScaleDraw(plot)

Subclass of QwtScaleDraw because of time axis. Note: function axisScaleDiv will invalidate manually set ticks.

Parameters:plot (PyQwtWidgetGui) – parent
getTimeString()

Get a time axis.

Return type:list()
setTimeString(timeString, nFs)

Set a time string used for X axis.

Parameters:
  • timeString (list()) – list of time strings, e.g [‘11:41:50’,‘11:41:51’]
  • nFs – sampling frequency
class PyQwtWidgetGui.EnumPlotSpeed

Plot/paper speed enum - defines cm/min ratio.

class PyQwtWidgetGui.EnumPlotBpm

Plot/paper bpm size enum - defines bpm/cm ratio.

LoadWriteData

Load and write data in several formats.
  • text files
  • matlab files
  • csv files [not supported yet]

txt: mb: loading csv directly from TXT/CSV file generated from BDI

Reference

class LoadWriteData.EnumVariableName

Class EnumVariableName contains description and names of variables in a matlab file that can be used in python

Examples of variables in mat-file (others not supported yet):

Parameters:
  • fhr (numeric vector) – fetal heart rate signal
  • uc (numeric vector) – uterine contractions signal
  • timestamp (numeric vector) – time stamp giving samples that are valid
Example of matlab file:
fhr = [150,150,151,152,150]
uc = [7,10,10,9,8]
timestamp = [1,2,3,10,11] % timestamp represents timesamples; that is during time: 4,5,6,7,8,9 there is no recording.
Do not substitute with artifacts! The timestamp is used for situations when the recording was stopped and started again.

save(‘temp.mat’,’fhr’,’uc’,’timestamp’)

View file in ctgViewerLite
1) open via menu bar in ctgViewerLite
2) call ctgViewerLite from command prompt, see REFERENCE NEEDED: for details
3) call ctgViewerLite from matlab, see REFERENCE NEEDED: for details
class LoadWriteData.LoadData

Load data from various types of files

readBdiTxtFile(inFile)

load data from txt file (generated from BDI file), the structure of csv is expected as: timestamp, fhr, uc (fields: 1, 4, 11)

readCsvFile(inFile)

load data from csv file, the structure of csv is expected as: timestamp, fhr, uc

readMatlabFile(sFile)

read a signal in matlab format, for specification of matlab file see EnumVariableName

readPhysionetHeader(inFile)

Read a file header in physionet format

Parameters:inFile (string) – filename to read

:return lHeader :rtype lHeader list of dict

readPhysionetHeaderSignalName(inFile)

Read a physionet header when the name of signal is provided

Parameters:inFile (string) – filename of signal, which header is desired

:return list of parameters

readPhysionetSignal16(inFile, lHeader=None)

read a signal in physionet format, only format 16 is supported

writeCsvFile(inFile, data, sHeader=None)

write data into csv file. the function is not using the python csv module because of unable to setup float precision

Table Of Contents

Previous topic

Development