PSD scientific software test document

J. Knödlseder
19-10-1999
Draft version


1. Scope
This document describes the tests that have been undertaken to verify the scientific software of the PSD subassembly of the SPI telescope aboard INTEGRAL.


2. Test setup
The tests have been performed on two versions of PSD laboratory models that are available at Berkeley. Configuration commands and housekeeping data were verified on the first model, while scientific data, in particular concerning the efficiency of the PSD subassembly, were taken on the second model.
The first model consists of ... (TBD). It has two input channels corresponding to detector numbers 0 and 1. During the tests a pulse generator has been connected to one of the channels in order to stimulate the system. The PSD system has been monitored using a memory-spy connected via an IDE interface (i.e. a PC connected via an IDE port to the PSD laboratory model, running the software ENGGSE version (TBD)). A second PC, containing a V50 interface board, was used as GSE. The PSD low- and high-speed links were connected to this interface board allowing for the emission of configuration commands, the reception of housekeeping data, and the reception of scientific data. The GSE software was MB version (TBD).
The second model consists of ... (TBD). It has one input channel that has been connected to a Germanium detector in order to stimulate the PSD with realistic data. In addition to the pulse shape discrimination, this model also determines the precise energy of the analysed event. Identical to the first model, the system was also monitored using a memory-spy and controlled via a GSE computer.


3. Configuration commands
The following configuration commands have a direct impact on the PSD scientific software (i.e. they are directly interpreted within the PSD scientific software):
0x06 : ADC gain and offset settings
0x07 - 0x09 : Library selection and control settings (3 blocks)
0x0b - 0x11 : Library description and control (7 blocks)
Their impact on the PSD has been tested by sending specific command patterns and by comparing the observed response to the expected one. In the following the test philosophies and procedures are listed for all 3 types of configuration commands.

3.1. ADC gain and offset settings
The PSD system converts detector pulses into digital data using 4 synchronised ADCs. These ADCs sample the pulse at a frequency of 25 MHz, each offset by 10 ns. Gain offsets between the ADCs may therefore lead to irregularities in the digitised pulse shape. To remove these irregularities a gain correction has been foreseen for each ADC. Since all detectors are treated by the same ADCs, only global gain correction is necessary. The gain correction is performed within the PSD scientific software in order to allow for an optimum pulse shape discrimination. However, curves transmitted via telemetry present the raw data and are not gain corrected.
ADC gain and offset corrections are controlled by the configuration command 0x06. For each of the 4 channels a gain factor and offset is specified by a signed 8-bit field . The following conversion applies:
gain = 1.0 + gain-8-bit-field * 0.001
offset = offset-8-bit-field * 0.05
Internally, floated gain and offset values are stored in variables. The settings have been controlled by examining these variables using the memory-spy. The aim of the following test was to control if the configuration command 0x06 is interpreted correctly. Tests 06-1-x aimed in testing the extrema of the conversion value ranges, tests 06-2-x aimed in testing the independence of the 4 gain and offset fields. During all tests it has been verified that the PSD information field contains no error code.

Performed tests and results:
Number
Aim
Config-file
status
06-1-1
Standard calibration (0 in all fields)
gain0101.cfg
OK
06-1-2
Set all fields to 1 (gain = 1.001, offset = 0.05)
gain0102.cfg
OK
06-1-3
Set all fields to -1 (gain = 0.999, offset = -0.05)
gain0103.cfg
OK
06-1-4
Set all fields to 127 (gain = 1.127, offset = 6.35)
gain0104.cfg
OK
06-1-5
Set all fields to -128 (gain = 0.872, offset = -6.4)
gain0105.cfg
OK
06-2-1
Gains: 1.016, 1.032, 1.048, 1.064; Offsets: 1.2, 2.0, 2.8, 3.6
gain0201.cfg
OK
06-2-2
Gains: 0.984, 0.968, 0.952, 0.936; Offsets: -0.4, -1.2, -2.0, -2.8
gain0202.cfg
OK

3.2. Library selection and control
Due to possible differences between the SPI Germanium detectors and the associated electronics, reference pulse templates are available for each individual detector. Additionally, for a typical size number of 30 templates of 64 bins each, 2 different library sets may reside in the PSD memory for each detector, and may be selected by configuration commands 0x07-0x09. In addition, the number of template bins and the number of templates that are used for fitting are also specified by these commands. For the following tests, one set of 33 library templates has been loaded in the PSD for all 19 detectors. The second set is undefined (i.e. the corresponding memory blocks are not set to specific values). Note that the first set has the set number 0. The maximum number of templates in a library is fixed to 38. The number of bins in a template has to be comprised within [6,64].
If one of the configuration commands 0x07, 0x08 or 0x09 is sent to the PSD, the scientific routine "correlate" is called which examines the content of the configuration blocks. During this examination housekeeping (HK) error codes comprised between 0x41 and 0x48 (inclusive) may occur (note that HK-error 0x41 should indeed never occur since it notifies about a negative set number - however, the configuration command only allows for possible values in this field). The aim of the following tests was to verify all boundary limits of the configuration commands and to check if the correct HK-error messages are emitted. If one of the boundary limit was violated for a specific detector, no PSD information should be sent for this detector (i.e. PSD error code 0x8000). This has also been verified. In addition to these test, also valid configuration sets have been tested to see their impact of the PSD system.

3.2.1. Configuration command 0x07
Some of the tests have been performed twice, once with a signal on channel 0, once one channel 1. This allows to test detector dependent configurations. The corresponding results are given in the format xxxx / xxxx. PSD-errors “ - ” mean that no error code has occurred. For test numbers 07-4-x the software was modified so that always detector 6 is analysed.

Performed tests and results:
Number
Aim
Config-file
HK-error
PSD-error
status
07-1-1
Select 1 template too much
lib16434.cfg
0x46
0x8000
OK
07-1-2
Select 5 templates too much
lib16438.cfg
0x46
0x8000
OK
07-1-3
Select 1 template more than max. in memory
lib16439.cfg
0x46
0x8000
OK
07-1-4
Select less than number of loaded templates
lib16416.cfg
-
-
OK
07-1-5
Select 0 templates
lib16400.cfg
0x45
0x8000
OK
07-1-6
Channel 0: 34, Channel 1: 33 templates
lib1a434.cfg
0x46
0x8000 / -
OK
07-2-1
Select 1 bin too much
lib16533.cfg
0x44
0x8000
OK
07-2-2
Select 2 bins too much
lib16633.cfg
0x44
0x8000
OK
07-2-3
Select 1 bin and 1 template too much
lib16534.cfg
0x44
0x8000
OK
07-2-4
Channel 0: 5 bins , Channel 1: 64 bins
lib1a533.cfg
0x43
0x8000 / -
OK
07-2-5
Channel 0: 6 bins, Channel 1: 64 bins
lib1a633.cfg
-
- / -
OK
07-3-1
Set 1 (not defined, template number was 0x00)
set11.cfg
0x47
0x8000
OK
07-3-2
Set 2 (not allowed, too large)
set12.cfg
0x42
0x8000
OK
07-3-3

emp16433.cfg
-
-
OK
07-4-1
34 templates (has no impact on detector 6)
lib16434.cfg
0x46
-
OK
07-4-2
65 bins (has an impact on detector 6)
lib16533.cfg
0x44
0x8000
OK

3.2.2. Configuration command 0x08
For test numbers 08-1-x the software was modified so that always detector 6 is analysed. For test numbers 08-2-x the software was modified so that always detector 7 is analysed.

Performed tests and results:
Number
Aim
Config-file
HK-error
PSD-error
status
08-1-1
Select 0 templates
lib26400.cfg
0x45
0x8000
OK
08-1-2
Select 1 template too much
lib26434.cfg
0x46
0x8000
OK
08-1-3
Select 39 templates
lib26439.cfg
0x46
0x8000
OK
08-1-4
Select 33 templates, 64 bins (correct)
lib26433.cfg
-
-
OK
08-2-1
Set 1 (not defined, template number was 0xff)
set21.cfg
0x48
0x8000
OK
08-2-2
Set 2 (not allowed, too large)
set22.cfg
0x42
0x8000
OK

3.2.3. Configuration command 0x09
For test numbers 09-1-x the software was modified so that always detector 13 is analysed.

Performed tests and results:
Number
Aim
Config-file
HK-error
PSD-error
status
09-1-1
Select 5 bins
lib30533.cfg
0x43
0x8000
OK
09-1-2
Select 6 bins
lib30633.cfg
-
-
OK
09-1-3
Select 33 templates, 64 bins (correct)
lib36433.cfg
-
-
OK
09-1-4
Select 0 templates
lib36400.cfg
0x45
0x8000
OK
09-1-5
Select 1 template
lib36401.cfg
-
0x0010
OK
09-1-6
Select 34 templates
lib36434.cfg
0x46
0x8000
OK


3.3. Library description and control
The test concerning these set of configuration commands are twofold. On the one hand they should demonstrate that library upload works correctly. One the other hand they should verify the functionality of the library parameter block that is loaded by setting the curve number to 0xff. Note that always a complete set of 7 commands (0x0b - 0x11) has to be sent before the data are copied into the EEPROM. EEPROM write is verified by the memory-spy. Note that the library parameter block is only considered after one of the library selection and control commands (0x07 - 0x09) has been sent. Therefore the tests that seek verifying the impact of the library parameter block on the PSD analysis imply sending of the configuration file “ lib16433.cfg ” after completion.

3.3.1. Library upload
For each library vector upload, the detector number, the curve number, the library set number, and the number of bins to upload has to be specified. It has been controlled that all boundary checks on this parameters are correct. Further, it has been verified that the library vector is written correctly in the correct EEPROM memory location (this has been controlled using the memory-spy).
Library upload can in principle lead to the HK-error codes 0x30-0x37. However, errors 0x30, 0x32, and 0x34, which signal that the detector number, the curve number, or the library set number are too small, respectively, should never occur if the software is working correctly.

Performed tests and results (in the specified order):
Number
Aim
Config-file
Config-file
HK-error
PSD-error
status
tpl-1-1
Detector=0, curve=0, set=0
tpl00001.cfg
lib16433.cfg
-
-
OK
tpl-1-2
Detector=18, curve=0, set=0
tpl00002.cfg
lib16433.cfg
-
-
OK
tpl-1-3
Detector=19, curve=0, set=0
tpl00003.cfg
lib16433.cfg
0x35 / -
-
OK
tpl-2-1
Detector=0, curve=37, set=0
tpl00101.cfg
lib16433.cfg
-
-
OK
tpl-2-2
Detector=0, curve=38, set=0
tpl00102.cfg
lib16433.cfg
0x31 / -
-
OK
tpl-3-1
Detector=0, curve=0, set=1
tpl00201.cfg
lib16433.cfg
-
-
OK
tpl-3-2
Detector=0, curve=0, set=2
tpl00202.cfg
lib16433.cfg
0x33 / -
-
OK
tpl-4-1
All=0, 0 bins
tpl00301.cfg
lib16433.cfg
0x36 / -
-
OK
tpl-4-2
All=0, 1 bin
tpl00302.cfg
lib16433.cfg
-
-
OK
tpl-4-3
All=0, 10 bins
tpl00303.cfg
lib16433.cfg
-
-
OK
tpl-4-4
All=0, 65 bins
tpl00304.cfg
lib16433.cfg
0x37 / -
-
OK

3.3.2. Library parameter block
A library parameter block contains PSD algorithm parameters. Some of these parameters are critical to the algorithm and should be comprised within a specific range. The parameter range is checked during upload, and boundary violations are signaled via HK-error codes. It has been verified that all boundary violations are signaled correctly. Further, it has been verified that the library parameter block is written correctly in the correct EEPROM memory location (this has been controlled using the memory-spy).
Library parameter block upload can in principle lead to the HK-error codes 0x38-0x3f. However, errors 0x38 and 0x3e, which signal that the number of templates or the mean time index are too small, respectively, should never occur if the software is working correctly.

Performed tests and results (in the specified order):
Number
Aim
Config-file
Config-file
HK-error
PSD-error
status
par-1-1
Upload standard parameter block
par00000.cfg
lib16433.cfg
-
-
OK
par-1-2
Number of templates = 0
par00001.cfg
lib16433.cfg
- / 0x47
- / 0x8000
OK
par-1-3
Number of templates = 30
par00002.cfg
lib16433.cfg
- / 0x46
0x8000
OK
par-1-4
Number of templates = 30
par00002.cfg
lib16430.cfg
-
0x8000 / -
OK
par-1-5
Number of templates = 38
par00003.cfg
lib16433.cfg
-
-
OK
par-1-6
Number of templates = 38
par00003.cfg
lib16438.cfg
-
-
OK
par-1-7
Number of templates = 39
par00004.cfg
lib16433.cfg
0x39 / -
- / -
OK
par-2-1
Upload standard parameter block
par00000.cfg
lib16433.cfg
-
-
OK
par-2-2
Number of start bins = 0
par00100.cfg
lib16433.cfg
0x3a / -
-
OK
par-2-3
Number of start bins = 1
par00101.cfg
lib16433.cfg
-
-
OK
par-2-4
Number of start bins = 95
par00102.cfg
lib16433.cfg
0x3d / -
-
OK
par-2-5
Number of start bins = 96
par00103.cfg
lib16433.cfg
0x3b / -
-
OK
par-3-1
Number of end bins = 0
par00200.cfg
lib16433.cfg
0x3c / -
-
OK
par-3-2
Number of end bins = 1
par00201.cfg
lib16433.cfg
-
-
OK
par-3-3
Number of end bins = 71
par00202.cfg
lib16433.cfg
-
-
OK
par-3-4
Number of end bins = 72
par00203.cfg
lib16433.cfg
0x3d / -
-
OK
par-4-1
Upload standard parameter block
par00000.cfg
lib16433.cfg
-
-
OK
par-4-2
Mean time bin = 0
par00300.cfg
lib16433.cfg
-
- / 0x000d
OK
par-4-3
Mean time bin = 95
par00301.cfg
lib16433.cfg
-
0x000d / -
OK
par-4-4
Mean time bin = 96
par00302.cfg
lib16433.cfg
0x3f / -
-
OK


4. Scientific PSD performance
Scientific PSD performance has been tested using the PSD laboratory model connected to a Germanium detector. As calibration source a 228Th source has been used that emits various gamma-ray lines within 500 keV and 2.6 MeV. The most high energetic gamma-ray line at 2615 keV eventually leads to pair production in the detector. Hence both escape lines (1593 keV for double escape, 2104 keV for single escape) are also visible in the spectrum. Since the events leading to the 1593 keV double escape line most probable only underwent one interaction in the detector (a pair-production), this line may been used to determine the efficiency fs of properly classifying single interactions as singles. All other gamma-ray lines, in particular those at higher energies, mostly are composed of multiple events, hence may be used to determine the efficiency fm of properly classifying multiple interactions as multiples. From these two measurements, the sensitivity improvement is calculated using
SI = fm / sqrt(beta*(1-fs) + (1-beta)*fm)
where beta = 0.95 is the assumed fraction of single-site interactions in the SPI instrumental background. Note that this formula is only approximate, but can be used for relative algorithm comparisons.
For the actual tests, no ADC gain correction has been applied. Additionally, the library used has not been built with the threshold criterion that is used in the PSD software : the library was built using a threshold estimated from the noise level in the pulse, while the PSD software uses a constant area fraction threshold of 0.006. More reliable tests with a more consistently prepared library are warranted.

Scientific PSD performance as measured on October, 18th 1999 at SSL. A maximum peak threshold of 0.20 has been applied, the maximum peak spacing was set to 2. Note that fs and fm in this table give the fraction of single and multiple events in the line. For comparison, the same procedure has been applied to the file "toms2.arc" taken using the UCSD algorithm. Bold numbers highlight the superior value.
line (keV)
fs
fm
SI
fs (UCSD)
fm (UCSD)
SI (UCSD)
511
0.592
0.408
1.636
0.445
0.555
1.691
583
0.497
0.503
1.942
0.362
0.638
1.908
860
0.453
0.547
2.078
0.312
0.688
2.033
1173
0.524
0.476
1.858
0.413
0.587
1.774
1333
0.595
0.405
1.626
0.356
0.644
1.922
1460
0.571
0.429
1.703
0.464
0.536
1.640
1593
0.956
0.044

0.916
0.084

1625
0.605
0.395
1.590
0.431
0.569
1.727
2104
0.650
0.350
1.435
0.414
0.586
1.772


5. PSD timing
Algorithm timings have been measured on the PSD laboratory model with an oscilloscope (a bit is set on entry of the scientific code and cleared on exit; this bit-flip is visualised on an oscilloscope). The following table gives some values for different choices of template bins and number of templates. The bold numbers highlight the standard values.
Bins
Templates
Time (μs)
64
25
830
64
30
940
64
33
1000
64
38
1100
40
38
950
50
38
1020