Please go to our new site www.PsychLab.com

Respiration analysis

The purpose of this analysis is to establish a value for respiration rate in breaths per minute, using 15 second time epochs chosen relative to event markers in the record (in this case, tones).

Start PSYLAB6 so that the toolbar shows (click 'design' if it starts with the simplified user menu). Position the toolbar at the top left of the screen (it is recommended to use at least 600x800 screen resolution to allow room for all the PSYLAB panels). Click on the fourth button in on the toolbar to open the macro window. Position the macro window to the bottom right of the screen. Click on 'Record' in the macro window to activate record mode. Now click the Open data button on the toolbar and select a raw data file from the file selection panel. Click OK.

The selected file will be shown so that the entire record is seen in Review#1. The amount of detail seen in this Review will depend upon the Toolbar menu, Options, Initial display density setting. In the example data used here, Density is set at 2500, meaning that the Review resolves the time scale into 2500 parts. It is just possible to see the brief events in the bottom channel at this resolution. The example data included a lot of channels irrelevant to this analysis, so for clarity most have been omitted leaving only SC, Pulse, IBI, Respiration and Event showing.

Back to PSYLAB Hardware
Back to PSYLAB Software
Back to Home page

Notice the 0s and 1s next to each channel. These indicate which channels will be used when a process function is selected. For this analysis, these must be set so that they all show 0 except the Respiration channel, which is 1. To change them, point to them and click.

 The next step is to section the record into blocks. To do this, double click on Review#1 until the Review menu appears, then select Set Blocks. There are only three relevant events in this record, but we will set the block selection system to produce 4 concurrent blocks for each event, each 15 seconds wide.

The block selection panel should be set to

Block width 15 seconds,

Pre-event interval 0,

Event levels to detect 1 to 255,

Number of blocks per event 4,

Event channel 18,

Detect event on onset,

Deep search.

Block selection panel detail

In this case, sample data are recorded at 20 per second so a block width of 15 seconds is 300 samples. The pre-event interval is set to 0. Also, to select ANY change in the event channel, we simply click on Add in the Ranges box, which generates ' 1 to 255' in the text panel. This means that any event value greater than 0 will be detected.

When all the block settings are OK, click the 'View Blocks' button. The system will scan for blocks, and as long as it finds some it will require that the settings you selected are stored in a Block file. Any file name may be given, the extension .BLO is automatically added. The block system only prompts for this file name if Macro Record is on, however block settings can be recorded at any time if required using the File menu in the block settings panel. When the file has been saved, the block panel closes, Multiblock Review#2 appears and a new line is generated in the macro ' Review#1,SetBlocks@C:\CPI\RESP1.BLO'.

Twelve blocks are shown, 4 blocks for each of the 3 events. The next stage is to set up the settings of the process functions. Again, double click to get the Review menu, but this time on Multiblock Review#2. The menu shows slightly different options, select Process, Set Parameters. The Process Parameters panel appears. If it is not in a nice position on screen, move it. The position of all panels is saved when PSYLAB6 terminates only if 'Save Settings' is clicked in the Toolbar, File Data menu. It is not advised to use 'Save settings on exit', as it results in default settings getting frequently changed which can alter the way existing processes run.

 

Process settings detail

Select Wave parameters is the only section of concern for this particular analysis. The settings shown were found to be appropriate for respiration wave-form data recorded at 20 per second. Things to note are: The Wave detection characteristics are set to 2,2,2. Minimum allowable amplitude is set to 3% which disallows noise but allows small respiration fluctuations. Compression is set to 2, which was appropriate for data recorded at 20 per second. Use higher compression for faster data rates.

When the Process settings are correctly set, double click again on Review#2 and select Process, Wave. Review#3 appears showing the respiration wave with wave markers on each in-breath. Each positive cycle has two markers, the onset is above the wave-form, the offset is below it at the peak.

Results format program detail

To get information from the Review into the Results window, click OK on Review#3. This presents the Results window with a panel allowing selection of various aspects produced by the Wave function. Select whatever header information is required (in this example just 'block no') and select 'Total count of all waves'. Click buttons 2, 5 and 6. This generates the following RFP:

 select by review#

HEADER

 output   ' terminate last line

 output block

 return

REVIEW#3

 gosub HEADER   '  new line between each wave

 c1 = channel  ' put channel no into variable c1

 b1 = block  ' put block no into variable b1

 output dat5(c1)  ' wave count

 end

Saving the RFP generates a new line in the macro: ShowResults@C:\CPI\RESP1.RFP If the OK button on Review#3 is clicked again, data appears in the Results section of the Results window as follows:

1              5          

This is block number 1, number of waves 5. However, the aim is to generate a number which relates to breaths per minute, but the number 5 is breaths per quarter minute. The RFP must be edited to get the required result:

 select by review#

HEADER

 output   ' terminate last line

 output block

 return

REVIEW#3

 gosub HEADER   '  new line between each wave

 c1 = channel  ' put channel no into variable c1

 b1 = block  ' put block no into variable b1

 d1 = dat5(c1) * 4

 print using 000 d1  ' breaths per minute

 end

The function 'dat5(c1)' is the count of waves; line 'd1 = dat5(c1) * 4' multiplies the count by 4 and puts the result in variable d1. 'Print using 000 d1' puts the value of d1 into the results file. 'Print using' is similar to 'output', but it allows placeholders to be used to specify exact field format. As we know the number of breaths will never exceed 999, an will never be fractional, 000 is an appropriate field definition. If the number were fractional, the format would have been 00.00 for example.

The RFP generated by the Wave selection panel is more complicated than it needs to be in this application. The RFP could be tidied up if wished as follows:

 select by review#

 

REVIEW#3

 c1 = channel  ' put channel no into variable c1

 d1 = dat5(c1) * 4

 print using 000 block

 print using 000 d1  ' breaths per minute

 output

 end

When the OK button on Review#3 is pressed now, it produces ' 001 020;, block 1, breaths per minute 20. If the advance button on Review#3 is clicked, then the OK button again, we get:

001  020

002  016

We could go on clicking advance and OK through all the blocks in the record, but the purpose of the macro is to automate this. So far, the macro has recorded each action, using our filenames to refer to the block and process settings and the RFP. It appears as follows:

OpenRawData

Review#1,SetBlocks@C:\CPI\RESP1.BLO

Review#2,Process@C:\CPI\RESP1.PRO

Review#2,Process=00000000000100000000000000000000

Review#2, 76 ' wave

ShowResults@C:\CPI\RESP1.RFP

Review#3, 51 ' button 4 OK

Review#3, 53 ' button 3 >

Review#3, 51 ' button 4 OK

The last two lines are the 'advance and OK' operations we would have to repeat for the whole set of blocks. If we now switch off macro record, we can edit the macro so that it will automatically repeat these lines for all the blocks:

OpenRawData

Review#1,SetBlocks@C:\CPI\RESP1.BLO

Review#2,Process@C:\CPI\RESP1.PRO

Review#2,Process=00000000000100000000000000000000

Review#2, 76 ' wave

ShowResults@C:\CPI\RESP1.RFP

Review#3, 51 ' button 4 OK

for all blocks

Review#3, 53 ' button 3 >

Review#3, 51 ' button 4 OK

next block

We have now completed the steps needed to allow automatic analysis of the record for respiration rate. Save the macro file, then click the run button on the macro window to produce data for all the blocks. It will unload all the Reviews and start from the point of loading in raw data. The results produced from the example data were as follows:

001  020

002  016

003  012

004  020

005  016

006  004

007  012

008  016

009  012

010  016

011  016

012  012