Calibration of Flight Model #1

of Cassini-RPWS

High Frequency Receiver (HFR) / KRONOS

Bob Manning

DESPA, Observatoire de Paris, Meudon

16/12/1999

Table of contents

Table of contents	2

Introduction.	4

Preliminary discussion.	4

Receivers modeling.	6

Attenuators	8

DBcal	8

Calibration methods.	11

GSE	11

Specific discussion of bands ABC :	12

Specific discussion of bands H1/2 :	13

Phases	15

Back to measurements in physical units.	16

Appendices.	18

Data tables.	18

a123.dat	18

ahf.dat	18

a1hf1.dat	19

a1hf2.dat	19

dbcal_08.dat	20

dbcal_16.dat	20

dbcal_32.dat	20

dbcalhf.dat	21

phase8_abc.dat	22

phase16_abc.dat	22

phase32_abc.dat	22

phase_hf1.dat	23

phase_hf2.dat	23

phase1248_hf.dat	23

Matlab Programs.	24

a1hf2find.m	24

a1hf1find.m	25

dbcal_2.m	25

phaseabc.m	26

phase_hf_fit.m	27

readdata.m	29

physique.m	29

phasemag.m	33

correl_phase.m	34

fixsign.m	34

ntodb.m	35

fitlogeq.m	35

fitlog.m	35

llogntox.m	37

llogxton.m	37

Various files.	38

dbcal32.txt	38

dbcal.txt	39

dbcal_2.txt	42

correction_sinx_x_abc.txt	44

integration_times.txt	45

corr_integrate_times.txt	46

Files newcode	49

IDL programs.	51

help_cal.pro	51

cal.pro	51

agc_db.pro	52

auto_db.pro	52

read_constants.pro	52

constants.xdr	54

prep_df.pro	54

read_phases.pro	57

phases.xdr	58

Introduction.

This document summarizes the procedures used for the calibration of the flight model of the receiver KRONOS/HFR on Cassini-RPWS. It contains all the informations allowing to convert raw data from telemetry to calibrated measurements in physical units.

Four types of files are found in the appendices :

1)	data tables (*.dat), complete if not too long, with indications of the order in which data are organized.

2)	Matlab programs (*.m) used for this document.

3)	a few other useful files.

4)	IDL programs (*.pro) putting in practice the above tables for actual data calibration (amplitudes and phases).

Preliminary discussion.

The figure below is a very simplified sketch of the HFR, which main purpose is to identify calibration needs :

There are thus eight analog physical receivers. On the one hand, there are the 2x3 ABC receivers covering contiguous frequency ranges of relative width fmax/fmin=4.5 each. These bands are more finely analyzed by the digital analyzer (ADSP) in 8, 16, or 32 logarithmically spaced channels.

On the other hand, there are the two high frequency (HF) heterodyne receivers covering each a broad frequency range thanks to tunable oscillators and quartz filters, not shown on the figure. These receivers select an instantaneous band of 25 kHz width, a finer analysis of which is possible with the ADSP.

The calibrations mainly concern the analog part of the receivers (but the "gain" of the digital part must also be known). The receivers have a variable gain, as a function of the frequency as well as of the input level. A more complete sketch of one receiver (of ABC type, i.e. without the additional frequency shifting circuit) connected to the Ex dipole is shown below for clarity :

There is a preamplifier for each monopole antenna. Telecommand allows to select either one, of both in differential mode. A 30 dB attenuator may also be selected. This front-end part of the receiver has a fixed transfer function independent of the input level but may exhibit frequency dependent variations.

The following stage of the receiver has a variable gain, and is called AGC (for Automatic Gain Control). It has two purposes : amplify the signal up to a detectable level, and provide a way to measure the signal with an accuracy little dependent on the input level. The signal is amplified to a constant level of 0.5 Veff. This is the optimal level for the subsequent digitization. After detection, a error-amplifying circuit retroacts on the variable gain stage so that the above fixed output level is reached (on average). The input voltage to the correction circuit is digitized in order to know the instantaneous gain. The gain response will be discussed in the next section.

The bandpass filter being part of the feedback loop restricts the frequency range to the one which will be subsequently analyzed digitally.

Digitization is performed with the ADC (Analog to Digital Converter).

The philosophy chosen for calibration and retrieval of measurement values in physical units consists of modeling separately the analog parts depending or not on signal amplitude, i.e. the AGC or the front-end of the receiver. The contribution of the digital part is taken into account automatically by the same measurements.

Receivers modeling.

Below is an example of plot of the output of a receiver as a function of the input signal. It shows a nearly linear dependency between the input voltage log(V) in dB and the continuous AGC output in telemetry points.

It has been shown that this curve is well described by the formula :

N = A2 log10{[10(A1-x)/10 + 10 A4/10]1/4 –1} + A3	(1)

In this expression, N is the telemetry level (number of points) and x represents the attenuation of the input signal in dB. We can see that A2 defines the general slope of the curve, in points/dB/40. A1 plays the role of the receiver's gain, in dB. A4 represents either the receiver noise, or the constant level of an external perturbating noise. The coefficient A3 does not have any clear significance. It could correspond to an internal receiver offset, but such an offset should not actually exist. However taking it into account may improve the quality of the fits.

A Matlab program was written to fit the values of the four coefficients A1 to A4. It has a graphical interface which allows to select the points to fit. An example is given in the figure below :

This curve was built as follows : a very stable noise generator (see discussion below) was used to feed the instrument through a programmable attenuator. 64 steps of 2 dB each have been measured. The "+" symbols represent all the raw telemetry values. The "*" symbols represent the points selected interactively for the fit. The solid line is the fitted curve. The blue dots, which refer to the ordinate scale on the right, are the residuals between the raw values and the fit. The values found for parameters A1-A4 are displayed.

The AGC is characterized mostly by A2 and A3. A1 corresponds to the overall receiver gain, and thus to the horizontal position of the curve – a gain modification would only shift the curve to the right or to the felt. A4 concerns the conditions at the receiver input, not the AGC.

For the ABC receivers, the A1 coefficients are considered to be constant in the corresponding frequency ranges. Our measures characterize thus average values over the whole frequency bands. Gain variations inside a band are taken into account via the "dBcal" tables (see below). For the HF receivers, it is necessary to measure the gain at each channel center frequency.

Note that on the above two curves, the abscissa (dB attenuation) does not have any absolute reference. Actually, the "0 dB" level corresponds to a level that we will name below dBV0, minus the value of possible fixed (and known) attenuators which are part of the circuit.

Attenuators

Calibrations of the log responses (1) can be made with or without the internal fixed selectable attenuators. We have found that calibrations "with" give better results because the effect of electrical perturbations at the receiver input is reduced. We use mainly the calibrations with a variable input level in order to determine the coefficients A2 et A3 characterizing the AGCs.

For ABC receivers, the coefficients A1 (characterizing the gain) are obtained through fits with "attenuator ON", and modified for the case "attenuator OFF" through a direct measurement of the attenuation performed at a constant adequate level. For these receivers, the characteristics of attenuators are thus very easy to take into account. This is because the attenuators simply consist of two resistors cabled as shown on the above synoptic sketch. Thus we found that the attenuations do not vary with frequency in the ABC bands. The values found are 30.1 dB for the Ex receiver and 30.0 dB for the Ez receiver.

For the HF receivers, implementation is more difficult, and attenuation is consequently frequency-dependent. This results in one set of coefficients A1 per frequency, with and without attenuator.

DBcal

The previous sections only concern the analog front end of our receivers. Moreover, gain variations inside the analyzed bands are not taken into account, but only an average gain is determined. These variations will be taken into account during the analysis of the outputs of the digital analysis part, the "autos" (autocorrelations).

Let us remind that the receiver's AGC sends to the digital processor (ADSP) a signal with constant power in the band to be analyzed. The processor performs a finer spectral analysis of the signal in the band. Its "auto" outputs give the measured power in each sub-band, with a quasi-logarithmical coding of the form :

N = 2E * (M + 8)	(2)

the information being transmitted as 8-bit words [e4 e3 e2 e1 e0 m2 m1 m0].

When we send a signal with flat spectrum (white noise) at the receiver's input, we get a series of output "autos" approximately equal but not quite, because they include the variations of gain with frequency, for the analog part as well as for the digital part of the receiver. But, if the signal contains spectral variations within the band analyzed, some "autos" output will increase while others will necessarily decrease. This is illustrated in the next figure (raw "autos" outputs converted to dB, versus channel number, with variable SNR) :

The six curves represent the output levels (converted in dB) of the Cx receiver (C band, Ex sensor – Flight Model #2), when fed by the sum of a white noise and of a sinusoid at 174 kHz. The curve labeled "S/N = 0" corresponds to a white noise input only. The curve labeled "S/N = 0dB" corresponds to a mixture of white noise plus sinusoidal signal with approximately equal powers. The other curves result from increasing attenuation applied to the noise in order to increase progressively the Signal-
to-Noise Ratio (SNR).

The values for white noise alone, recorded in the best possible experimental conditions, serve as a reference called "dBcal" values (see below).

The next figure displays the same data when both AGC and dBcal are taken into account. The noise level for the cases "S/N = 0" and "S/N = 0dB" are the same and the signal level in channel #19 (corresponding to the frequency of the sinusoid) is the same in every case, except of course for "S/N = 0". Note that this example suffers two imperfections : (i) the calibration coefficients used are those of FM#1 (while the FM#2 was used for obtaining the displayed curves), and (ii) a few electrical perturbations affected the experiment.

Calibration methods.

GSE

The heart of the calibration equipment is the so-called "stimuli" of the GSE (Ground Support Equipment). The stimuli are very stable and reliable generators of noise or sinusoidal signals, followed by programmable attenuators (as stable and reliable). The whole system is physically located in a bay dedicated to this application and can be entirely controlled by an external computer (PC).

The noise generator of the stimuli used is of the type "pseudo-random". Its output is a logic signal of amplitude Vc and consists of a series of '0's and '1's, with a seemingly random occurrence. The maximum frequency of switching between consecutive values if the clock frequency Fs. Vc is approximately constant but Fs changes depending on the bandwidth used. A different clock frequency is used for calibrating each receiver.

The total output power is equal to Vc2/4. The distribution of the power inside the band varies as sin2(x)/x2, with a first zero at Fs, which implies x = *f/Fs. As the sum of sin2(x)/x2 between zero and infinity is equal to /2, and as sin2(x)/x2 1 for x 0, the noise spectral density at low frequencies is Vc2/4/Fs/2 (in Volts squared per Hertz).

We refer to this spectral density as V0 or dBV0 in our formulas. A way to measure it precisely is to measure the peak-to-peak voltage with a digital oscilloscope. The results are :

Band	Vc	Fs (kHz)	dBV0

A	1,86	40	-43,6

B	1,86	180	-50,2

C	1,835	800	-56,8

H1	1,805	4800	-64,7

H2	1,55-1,7	40000	-75,2/-74,4 -74,3

Measurements performed with an accurate voltmeter gave identical results for the bands A,B,C,H1. Measurements are difficult for band H2, so that we use the method described below for better determining the spectral density in this band.

We have a good confidence for the determination of dBV0 in the H1 band. In addition, we recorded pairs of test files with identical stimulation conditions except for the H1/H2 clock, and an adequate frequency coverage ("flucthf1.020" and "flucthf.022" files). The analysis of these files shows a difference of 9,6 dB between the two generators at low frequencies. The difference in clock frequency contributes for a difference of 9,2 dB, so that we find in addition a 0,4 dB decrease of the level (i.e. ~1,7 V pour Vc), which seems reasonable. The dBV0 value for H2 band becomes thus -74,3.

The figure below displays the spectrum relative to the value of dBV0 calculated for the generator tuned to band C. The vertical dotted line at 320 kHz marks the maximum frequency of the C band.

Specific discussion of bands ABC :

It must be noted that the average power in the useful (effective) band is thus not equal to dBV0. This is especially important for bands ABC, for which the whole band is analyzed simultaneously. This correction is described in the file "correction_sinx_x_abc.txt" given in appendix. The resulting final dBV0 values for ABC are thus :

dBV0(A) = -44.61

dBV0(B) = -51.14

dBV0(C) = -57.76

In the previous section, we have explained that the dBcal's correspond to "autos" outputs in the presence of white noise, i.e. with a flat spectrum. For the bands ABC, we have determined these dBcal coefficients using measurements performed with the noise generator in position "H1". This brings in a worst case error of 0,06 dB. We have used the file "fluctabc.004", with the processing described in "dbcal32.txt" (see appendix).

This latter processing corresponds to the case of 32 channels in ABC bands. For the cases of 16 and 8 channels, we have used the specific files "32filabc.002", "16filabc.001", and "8filtabc.001", with the processing using "dbcal_2.m" and continued with "dbcal_2.txt" (see appendix).

A final step is to incorporate the dBV0 in the coefficients found for the A1 values. With the polarities used, it is necessary to subtract them, i.e. to increase them in absolute value.

Final values of A1, A2, and A3 coefficients are found in the file "a123.dat" given in appendix with annotations. dBcal's are listed in files "dBcal_08.dat", "dBcal_16.dat," and "dBcal_32.dat" also reproduced in appendix.

Specific discussion of bands H1/2 :

We have explained above that the fitted coefficients A2 and A3 are those which characterize the AGC part of the receivers. A1 corresponds to the receiver's gain and A4 to ambient noise, internal or external. But the receivers H1/2 are designed so that the AGC part works at constant frequency whatever the observing frequency. We consider thus that unique values can be used for A2 and A3 (for X and for Z), but that A1 must be determined for each center frequency of observation.

In order to obtain the best values for A2 and A3, we have performed several fittings over the whole frequency band, at selected "clean" frequencies (with little electrical perturbations). The results of these fittings is listed in the file "ahf.dat" in appendix. We have taken average values for A2 X and Z : 96,76 and 94,81. For A3 we have chosen "0" for both receivers. This choice is not critical because it can be compensated by small variations of A1.

Then the frequency-dependent A1 are determined through measurements with white noise input (and correction for sin(x)/x). We have adopted the following scheme : we have two files ("flucthf.021" and "flucthf.022") for which white noise has been injected at an adequate level and observed at all HF2 frequencies, starting from 25 kHz. The receiver was in direction-finding mode in order to measure the response of both X inputs, with and without the internal attenuator. We have used the program "a1h2find.m" (given in appendix) in order to determine the A1 coefficients which would give the expected noise spectrum in sin(x)/x. The value found above for dBV0 (-74.3 dBV) was subtracted from the A1 in order to simplify the processing. This value should thus not be used again in this case.

The curve of the spectral variation of A1 versus HF2 frequency is given below. The observed undulations correspond to variations of the response of anti-image frequency filters.

Next, A1 values must be determined for HF1 frequencies, i.e. every 25 kHz instead of 50 kHz for HF2. It appeared to be more interesting to interpolate the A1 values found for HF2 than to recalculate a whole new set of coefficients with different experimental data, in order to avoid small discrepancies at common frequencies. This has been done with the routine "a1hf1find.m".

As H1/2 instantaneously analyze only relatively narrow spectral bands, the dBcal's do not need to be corrected for input spectral power variations of the form sin(x)/x within the band because the level does not vary practically over the 25 kHz width of the filter. The processing of dBcal's for a number of sub-band channels of 1, 2, 4, and 8 is identical to that applied to ABC (with data files "1filthf.001", "2filthf.001", "4filthf.001", and "8filthf.001").

Phases

It is quite easy to measure the phase shifts introduced by the receivers, i.e. the one found at the input of digitizers with identical input signals on +X and Z or -X and Z antennas, due to phase advances or delays in the analog parts of the receiver. These phase shifts are obtained as the arctangent of cross-correlation outputs with adequate input conditions. This is done by the program "phasemag.m" listed in appendix.

Data files used for ABC are "llgar20.020", "llgbr20.020", and "llgcr20.020" for the measurements without the internal attenuator, and "logata20.020", "logatb20.020", and "logatc20.020" with the attenuator. Phase differences due to the presence of the attenuator are negligible (~0,1 ), so that a single table can be used in both cases. Slightly larger differences exist between +X and –X(+180°) sensors, up to 3 .

We have used the Matlab program phaseabc.m to determine phase shift values. This program calls the subroutine phasemag.m". Note that the values for the +/-X dipole mode are simply arithmetic averages of the values found for +X and -X separately.

The files mentioned above only correspond to the 32 channel case. Files for 16 and 8 channels have all been recorded with the +X sensor only. Their analysis has shown that the phase shifts found for the 16 channel case are very close to arithmetic averages 2 by 2 of the 32 channel ones. So, this scheme was chosen to calculate the phases in files "phasenn_ABC.dat".

For HF1/2, two distinct calculations are necessary : one for the overall variations versus frequency (as for the A1 coefficients), and the other for 1, 2, 4, or 8 filters. We have proceeded as follows :

We had two filed in HF2 ("flucthf.021" and "flucthf.022") covering the whole frequency range, resp. with and without the internal attenuator, with direction finding ON, and only one filter per 25 kHz band. As for ABC we have used the program "phasemag.m" to determine the phase shift. We have interpolated the results to obtain the values for frequencies 2*n*25 kHz, and simply duplicated the 25 kHz values for 0 Hz. Then, we have found interesting to fit the results with a smoothed spline curve, which has been done with the program "phase_hf_fit.m". An exempla of result from this fitting is displayed on the figure below :

These phases are tabulated in the files "phase_hf1.dat" and "phase_hf2.dat".

To compute the phase shifts inside the 25 kHz band, we have four files recorded in nearly identical conditions except for the number of filters in the band : "1filt.001", "2filt.001", "4filt.001", and "8filt.001". We have computed each phase shift with respect to that obtained for 1 filter taken as a reference. The resulting table is in "phase1248_hf.dat".

The two types of phase shifts must be added together.

Back to measurements in physical units.

The conversion of raw TM data to measurements in physical units follows the general method described in the programs "physique.m" and "phasemag.m" or "correl_phase.m".

In a first stage, one must determine the total power in the band, or more exactly the spectral density of the white noise which would correspond to the same AGC level. This is done using the following formula (x is in dBV/ Hz), which is simply the inverse of formula (1) :

X = -A1 + 40 log10[10(N- A3)/A2 + 1]	(3)

For the case when there is no auto-correlation measurement, for example for HF1/2 with a number of filters =1, this formula gives the signal amplitude in physical units. But in general, and especially for ABC, the spectrum in the band is not white noise, thus it will be necessary to analyze the autos. As described above, the available dBcal are the auto outputs in case of a white noise. The problem is thus to compare the measured auto with these dBcal.

dBcal are expressed in dB, while auto are expressed using the 8-bit quasi-
logarithmic coding described above. We must then convert the auto in dB, as done by the program "ntodb.m" in appendix, and then perform the following calculation to obtain the spectral power in each channel :

dBV/ Hz = X + dBauto – dBcal	(4)

Cross-correlation data are transmitted with the same coding as autos. To compute the true correlation ratio ( ), the real and imaginary cross-correlation outputs must be compared to the two corresponding auto outputs (X and Z), according to the following calculation :

real = Ncross-real / (Nauto-X Nauto-Z)1/2

imag = Ncross-imag / (Nauto-X Nauto-Z)1/2	(5)

where N is calculated according to formula (2) [cf. "correl_phase.m" in appendix]. Also,

total = ( real2 + imag2)1/2

with

real = total * cos( + )

imag = total * sin( + )

where represents the phase to be measured and the phase shift introduced by the receivers. To determine , one has to compute the arctangent of imag/ real and then subtract the taken from the phase shift tables.

Appendices.

Data tables.

a123.dat

A1 A2 A3 A1 (att.ON)

------ ----- ---- ------

166.37 73.20 -0.01 136.27 Ex band A

164.84 73.16 3.21 134.84 Ez " "

168.48 85.61 0.08 138.38 Ex band B

168.70 85.03 1.31 138.70 Ez " "

168.43 82.58 0.01 138.33 Ex band C

169.46 82.30 0.00 139.46 Ez " "

0 94.81 0 0 Ex band HF

0 96.76 0 0 Ez " "

ahf.dat

- with tests logh2_20.20

X (dipole) --

n 5n+8 F(kHz) A1 A2 A3 A4

3 23 1175 76.65 96.74 0.00 -13.98

7 43 2175 76.30 96.55 0.00 -11.76

9 53 2675 76.00 96.50 0.00 -11.12

11 63 3175 75.79 96.70 0.00 -11.50

14 78 3925 75.45 96.89 0.00 -11.24

17 93 4675 75.36 97.15 0.00 -10.08

19 103 5175 75.46 97.11 0.00 -7.71

24 128 6425 76.18 97.06 0.01 -7.90

29 153 7675 72.86 93.51 16.05 -7.02

35 183 9175 79.80 97.31 0.00 -5.92

40 208 10425 77.74 96.21 12.65 6e4

49 253 12675 84.51 96.81 0.00 -9.40

53 273 13675 81.16 96.61 7.83 1.9e5

57 293 14675 79.88 96.11 11.43 2.7e4

62 318 15925 82.38 96.89 6.65 -3.72

-----

mean 1-8 & 10-15 = 96.76

mean 1-15 = 96.54

Z--

n 5n+8 F(kHz) A1 A2 A3 A4

3 23 1175 77.12 94.86 0.0 -13.31

7 43 2175 76.66 94.55 0.01 -11.30

9 53 2675 76.11 94.88 0.01 -10.68

11 63 3175 75.90 94.71 0.0 -11.05

14 78 3925 75.58 94.55 0.0 -10.54

17 93 4675 75.30 95.00 0.0 -9.54

19 103 5175 75.48 94.54 0.01 -6.85

24 128 6425 75.98 94.67 0.01 -6.49

29 153 7675 77.13 95.05 0.01 -7.62

35 183 9175 79.61 95.27 0.01 -6.21

40 208 10425 76.06 93.25 16.9 1.6e+006

49 253 12675 80.27 93.22 9.3 -6.93

53 273 13675 79.45 94.16 8.9 4e+004

57 293 14675 78.48 92.96 12.7 -4.64

62 318 15925 83.44 95.88 0.01 -4.41

-----

mean 1-10 = 94.81

mean 1-15 = 94.50

a1hf1.dat

+Ex -Ex +/-Ex Ez +Ex -Ex +/-Ex Ez

------ ------ ------ ------ ------ ------ ------ ------

168.78 165.78 167.27 168.21 144.70 141.78 143.23 144.24 f0 0

168.78 165.78 167.27 168.21 144.70 141.78 143.23 144.24 f1 25

167.38 165.72 166.55 166.27 142.08 140.43 141.25 141.06 f2 50

165.99 165.66 165.82 164.33 139.46 139.08 139.27 137.87 f3 75
:

:

:

:

:

174.83 174.75 174.79 175.08 149.40 149.72 149.56 149.42 f171 4275

174.81 174.75 174.78 175.08 149.45 149.72 149.58 149.42 f172 4300

------------------------------ ------------------------------

int. attenuator OFF	int. attenuator ON

a1hf2.dat

+Ex -Ex +/-Ex Ez +Ex -Ex +/-Ex Ez

------ ------ ------ ------ ------ ------ ------ ------

168.78 165.78 167.27 168.21 144.70 141.78 143.23 144.24 f0 25

165.99 165.66 165.82 164.33 139.46 139.08 139.27 137.87 f1 75

172.83 172.48 172.65 171.58 146.38 146.09 146.23 145.20 f2 125

175.46 175.08 175.27 174.68 148.83 148.48 148.65 148.18 f3 175
:

:

:

:

:

175.77 175.98 175.88 176.34 156.61 158.02 157.31 156.80 f320 6025

175.77 175.98 175.88 176.34 156.61 158.02 157.31 156.80 f321 6075

------------------------------ ------------------------------

int. attenuator OFF	int. attenuator ON

dbcal_08.dat

70.26 70.87 70.57 70.51 71.41 71.58 71.49 71.24 69.66 69.63 69.65 69.21 C0

69.92 70.26 70.09 70.21 71.92 71.98 71.95 71.84 69.14 69.11 69.12 68.84 .

69.39 69.74 69.56 69.76 71.53 71.48 71.50 71.46 68.42 68.31 68.36 68.20 .

69.06 69.40 69.23 69.29 70.58 70.55 70.57 70.56 67.73 67.68 67.70 67.65

68.87 68.99 68.93 69.08 69.39 69.40 69.40 69.40 67.16 67.16 67.16 67.20

68.85 68.89 68.87 68.92 68.43 68.43 68.43 68.42 66.94 66.93 66.94 67.10

68.93 68.82 68.88 68.81 67.38 67.38 67.38 67.37 66.71 66.68 66.69 66.87 .

67.70 67.53 67.61 67.52 65.87 65.82 65.84 65.92 65.08 65.16 65.12 65.21 C7

+X -X +/-X Z +X -X +/-X Z +X -X +/-X Z

----------------------- ----------------------- -----------------------

A B C

dbcal_16.dat

73.01 73.58 73.30 73.23 73.74 73.91 73.82 73.49 75.33 75.29 75.31 74.79 C0

72.71 73.36 73.04 73.03 74.38 74.54 74.46 74.29 75.31 75.29 75.30 74.82 .

72.64 73.04 72.84 72.90 74.54 74.63 74.59 74.46 74.85 74.80 74.83 74.48 .

72.48 72.76 72.62 72.77 74.49 74.52 74.51 74.44 74.50 74.48 74.49 74.21

72.22 72.57 72.40 72.54 74.26 74.28 74.27 74.20 74.10 74.03 74.07 73.86

72.02 72.37 72.20 72.29 73.87 73.76 73.81 73.77 73.71 73.54 73.63 73.48

71.83 72.25 72.04 72.17 73.40 73.34 73.37 73.37 73.41 73.32 73.37 73.31

71.68 71.94 71.81 71.94 72.76 72.76 72.76 72.76 73.05 73.02 73.04 72.98

71.42 71.68 71.55 71.72 72.25 72.26 72.25 72.25 72.74 72.75 72.75 72.76

71.49 71.46 71.48 71.61 71.86 71.87 71.86 71.86 72.59 72.58 72.59 72.65

71.46 71.49 71.48 71.58 71.28 71.27 71.28 71.26 72.51 72.42 72.47 72.62

71.48 71.52 71.50 71.53 70.66 70.67 70.67 70.66 72.36 72.44 72.40 72.54

71.65 71.47 71.56 71.49 70.11 70.08 70.10 70.10 72.49 72.46 72.48 72.55

71.61 71.56 71.59 71.47 69.61 69.64 69.63 69.61 72.33 72.29 72.31 72.47

71.32 71.10 71.21 71.07 69.10 69.07 69.09 69.10 71.44 71.47 71.45 71.60 .

69.69 69.56 69.63 69.59 67.91 67.84 67.87 67.96 69.73 69.85 69.79 69.85 C15

+X -X +/-X Z +X -X +/-X Z +X -X +/-X Z

----------------------- ----------------------- -----------------------

A B C

dbcal_32.dat

75.39 76.01 75.71 75.63 75.34 75.58 75.46 75.18 77.09 77.10 77.09 76.57 C0

75.39 75.92 75.66 75.61 75.92 76.04 75.98 75.72 77.25 77.16 77.21 76.75 .

75.24 75.91 75.57 75.55 76.18 76.33 76.26 76.04 77.21 77.15 77.18 76.73 .

75.15 75.77 75.42 75.46 76.36 76.54 76.45 76.29 77.03 77.06 77.05 76.63

75.11 75.57 75.28 75.32 76.56 76.65 76.61 76.46 76.88 76.87 76.88 76.49

75.03 75.39 75.18 75.23 76.55 76.64 76.59 76.47 76.67 76.59 76.63 76.28

74.92 75.20 75.06 75.14 76.50 76.49 76.50 76.42 76.42 76.35 76.38 76.06

74.92 75.20 75.06 75.12 76.36 76.45 76.40 76.33 76.12 76.16 76.14 75.87

74.80 75.11 74.96 75.06 76.29 76.29 76.29 76.20 75.94 75.89 75.91 75.69

74.63 75.03 74.83 74.94 76.07 76.12 76.10 76.05 75.73 75.63 75.68 75.46

74.52 74.88 74.71 74.84 75.90 75.85 75.88 75.84 75.55 75.38 75.47 75.28

74.41 74.76 74.59 74.74 75.74 75.55 75.65 75.61 75.31 75.17 75.23 75.15

74.33 74.75 74.54 74.70 75.48 75.33 75.40 75.39 75.16 75.08 75.12 75.03

74.24 74.67 74.46 74.62 75.17 75.19 75.18 75.18 75.00 74.92 74.96 74.89

74.15 74.45 74.30 74.47 75.01 75.00 75.01 74.99 74.85 74.82 74.83 74.77

74.03 74.25 74.14 74.32 74.80 74.82 74.81 74.82 74.72 74.68 74.70 74.65

73.97 74.22 74.09 74.27 74.50 74.52 74.51 74.51 74.57 74.59 74.58 74.55

73.83 74.11 73.97 74.14 74.17 74.18 74.17 74.16 74.57 74.58 74.57 74.58

73.89 73.89 73.89 74.04 73.92 73.92 73.92 73.91 74.37 74.42 74.40 74.44

73.93 73.87 73.90 74.02 73.63 73.65 73.64 73.64 74.36 74.30 74.33 74.40

73.90 73.96 73.93 74.04 73.33 73.35 73.34 73.33 74.37 74.22 74.29 74.41

73.88 73.88 73.88 73.97 73.09 73.06 73.08 73.08 74.26 74.24 74.25 74.42

73.86 73.86 73.86 73.92 72.72 72.76 72.74 72.74 74.24 74.25 74.24 74.39

73.84 73.91 73.88 73.88 72.52 72.49 72.50 72.51 74.17 74.30 74.24 74.39

74.06 73.81 73.94 73.93 72.24 72.23 72.23 72.23 74.25 74.28 74.27 74.42

74.07 73.97 74.02 73.96 72.07 72.02 72.05 72.04 74.28 74.20 74.24 74.41

74.21 74.08 74.14 74.02 71.87 71.89 71.88 71.86 74.12 74.17 74.14 74.30

74.03 74.05 74.04 73.92 71.62 71.65 71.64 71.63 73.96 73.85 73.91 74.09

73.98 73.72 73.85 73.70 71.27 71.29 71.28 71.29 73.56 73.54 73.55 73.70

73.59 73.41 73.50 73.37 70.87 70.79 70.83 70.86 72.89 72.98 72.93 73.05

72.67 72.54 72.61 72.54 70.19 70.19 70.19 70.28 72.01 72.10 72.06 72.15 .

71.60 71.47 71.54 71.53 69.33 69.19 69.24 69.39 70.75 70.91 70.83 70.93 C31

+X -X +/-X Z +X -X +/-X Z +X -X +/-X Z

----------------------- ----------------------- -----------------------

A B C

dbcalhf.dat

68.23 68.23 72.16 72.11 75.14 75.12 77.26 77.36 C0

0 0 72.10 72.19 75.48 75.39 78.14 78.00 C1

0 0 0 0 75.65 75.70 77.69 77.57 C2

0 0 0 0 74.81 75.00 78.15 78.05 C3

0 0 0 0 0 0 78.22 78.23 C4

0 0 0 0 0 0 77.90 77.96 C5

0 0 0 0 0 0 77.54 77.62 C6

0 0 0 0 0 0 76.99 77.27 C7

X Z X Z X Z X Z

------------ ------------ ------------ ------------

1 2 4 8

phase8_abc.dat

A B C

--------------------- -------------------- --------------------

+X -X +/-X +X -X +/-X +X -X +/-X

---- ------- ---- ---- ------- ---- ---- ------- ----

2.30 -177.23 2.53 1.61 -176.08 2.77 3.52 -176.30 3.61 C0

1.65 -176.81 2.42 1.57 -176.51 2.53 3.63 -176.35 3.64 C1

1.01 -176.68 2.17 1.61 -176.73 2.44 3.83 -176.20 3.81 C2

0.43 -176.73 1.85 1.86 -176.86 2.50 3.90 -176.46 3.72 C3

0.02 -176.90 1.56 2.19 -176.74 2.72 3.55 -176.71 3.42 C4

-0.09 -177.01 1.45 2.70 -176.54 3.08 3.06 -177.37 2.84 C5

0.65 -176.30 2.17 3.48 -175.91 3.78 2.57 -177.82 2.38 C6

2.78 -174.35 4.22 4.92 -174.52 5.20 2.20 -178.22 1.99 C7

phase16_abc.dat

A B C

--------------------- -------------------- --------------------

+X -X +/-X +X -X +/-X +X -X +/-X

---- ------- ---- ---- ------- ---- ---- ------- ----

2.46 -177.33 2.57 1.59 -176.06 2.77 3.50 -176.35 3.58 C0

2.14 -177.13 2.50 1.64 -176.10 2.77 3.54 -176.25 3.65 C1

1.82 -176.88 2.47 1.59 -176.40 2.60 3.57 -176.29 3.64 .

1.48 -176.74 2.37 1.54 -176.63 2.46 3.70 -176.40 3.65 .

1.17 -176.65 2.26 1.57 -176.65 2.46 3.78 -176.13 3.83

0.85 -176.70 2.07 1.65 -176.82 2.42 3.88 -176.28 3.80

0.55 -176.68 1.94 1.78 -176.84 2.47 3.93 -176.43 3.75

0.31 -176.78 1.76 1.94 -176.88 2.53 3.87 -176.49 3.69

0.10 -176.86 1.62 2.09 -176.76 2.67 3.66 -176.56 3.55

-0.07 -176.94 1.50 2.28 -176.72 2.78 3.45 -176.85 3.30

-0.14 -177.03 1.42 2.54 -176.66 2.94 3.21 -177.26 2.98

-0.05 -177.00 1.47 2.87 -176.43 3.22 2.90 -177.49 2.71

0.28 -176.64 1.82 3.23 -176.15 3.54 2.65 -177.65 2.50

1.02 -175.96 2.53 3.74 -175.68 4.03 2.49 -177.98 2.25

2.20 -174.85 3.68 4.52 -174.91 4.81 2.29 -178.12 2.09 .

3.36 -173.85 4.76 5.32 -174.14 5.59 2.10 -178.32 1.89 C15

phase32_abc.dat

A B C

--------------------- -------------------- --------------------

+X -X +/-X +X -X +/-X +X -X +/-X

---- ------- ---- ---- ------- ---- ---- ------- ----

2.53 -177.39 2.57 1.56 -176.09 2.74 3.49 -176.34 3.57 C0

2.40 -177.27 2.56 1.62 -176.03 2.80 3.51 -176.35 3.58 C1

2.21 -177.20 2.50 1.65 -176.06 2.80 3.54 -176.25 3.64 .

2.07 -177.06 2.50 1.63 -176.15 2.74 3.54 -176.24 3.65 .

1.92 -176.95 2.49 1.62 -176.32 2.65 3.55 -176.22 3.67

1.72 -176.82 2.45 1.55 -176.47 2.54 3.60 -176.36 3.62

1.57 -176.73 2.42 1.54 -176.64 2.45 3.67 -176.41 3.63

1.39 -176.75 2.32 1.54 -176.62 2.46 3.72 -176.39 3.67

1.26 -176.68 2.29 1.56 -176.61 2.48 3.75 -176.19 3.78

1.09 -176.63 2.23 1.59 -176.68 2.45 3.82 -176.08 3.87

0.93 -176.71 2.11 1.61 -176.72 2.44 3.84 -176.18 3.83

0.77 -176.69 2.04 1.69 -176.91 2.39 3.92 -176.37 3.77

0.61 -176.63 1.99 1.74 -176.86 2.44 3.91 -176.44 3.74

0.49 -176.72 1.88 1.81 -176.82 2.49 3.94 -176.43 3.76

0.37 -176.77 1.80 1.89 -176.86 2.51 3.93 -176.48 3.73

0.25 -176.80 1.73 2.00 -176.90 2.55 3.82 -176.51 3.66

0.15 -176.82 1.67 2.06 -176.76 2.65 3.67 -176.53 3.57

0.05 -176.91 1.57 2.12 -176.75 2.69 3.65 -176.59 3.53

0.04 -176.90 1.53 2.23 -176.75 2.74 3.49 -176.80 3.35

0.09 -176.98 1.46 2.34 -176.69 2.82 3.41 -176.91 3.25

0.13 -177.06 1.41 2.48 -176.68 2.90 3.29 -177.15 3.07

0.15 -176.99 1.43 2.60 -176.64 2.98 3.13 -177.36 2.88

0.10 -177.01 1.45 2.79 -176.51 3.14 2.97 -177.47 2.75

0.00 -177.00 1.50 2.95 -176.35 3.30 2.83 -177.51 2.66

0.15 -176.77 1.69 3.12 -176.26 3.43 2.70 -177.57 2.57

0.41 -176.51 1.95 3.34 -176.05 3.65 2.60 -177.74 2.43

0.76 -176.18 2.29 3.55 -175.85 3.85 2.53 -177.90 2.32

1.28 -175.74 2.77 3.93 -175.51 4.21 2.44 -178.07 2.19

1.86 -175.16 3.35 4.31 -175.14 4.59 2.34 -178.07 2.14

2.54 -174.54 4.00 4.73 -174.67 5.03 2.23 -178.17 2.03 .

3.12 -174.15 4.49 5.22 -174.29 5.46 2.15 -178.29 1.93 .

3.61 -173.56 5.02 5.43 -173.98 5.72 2.06 -178.34 1.86 C31

phase_hf1.dat

Attenuator OFF Attenuator ON

---------------------- ----------------------

+X -X +/-X +X -X +/-X

11.96 -167.00 12.48 11.65 -167.00 12.32 f0 0

11.96 -167.00 12.48 11.65 -167.00 12.32 f1 25

12.49 -166.40 13.05 12.15 -166.53 12.81 f2 50

13.02 -165.79 13.62 12.65 -166.05 13.30 f3 75

:

:

:

14.00 -165.18 14.41 10.41 -171.23 9.59 f171 4275

13.90 -165.22 14.34 10.46 -171.23 9.62 f172 4300

phase_hf2.dat

Attenuator OFF Attenuator ON

---------------------- ----------------------

+X -X +/-X +X -X +/-X

11.96 -167.00 12.48 11.65 -167.00 12.32 f0 25

13.02 -165.79 13.62 12.65 -166.05 13.30 f1 75

15.53 -161.39 17.07 14.45 -160.64 16.91 f2 125

16.53 -163.47 16.53 16.47 -163.48 16.49 f3 175

:

:

:

17.74 -148.37 24.68 25.80 -144.89 30.46 f171 4275

17.93 -148.00 24.96 25.90 -144.76 30.56 f172 4300

phase1248_hf.dat

1f 2f 4f 8f

---- ---- ----- -----

0.00 -.84 -1.51 -2.19

0 .48 -0.34 -0.74

0 0 0.34 -1.04

0 0 0.97 0.25

0 0 0 0.46

0 0 0 0.31

0 0 0 0.80

0 0 0 1.56

Matlab Programs.

a1hf2find.m

disp('lire file e:\cassini\calmv1\flucthf.021')

readdata

f=fstarth2:fsteph2:fstarth2+(nstepsh2-1)*fsteph2;

x=f*pi/40000;

dbsx=20*log10(sin(x)./x);

dbv0=-74.3+dbsx;

save dbv0

agcx=mean(agch21');

agcpx=agcx(1:2:end);

agcmx=agcx(2:2:end);

agcpmx=mean([agcpx;agcmx]);

agcz=mean(agch22');

agcz=(agcz(1:2:end)+agcz(2:2:end))/2;

a1pxoff = 40*[log10(10.^(agcpx/96.76)+1)]-dbv0+30+26;

a1mxoff = 40*[log10(10.^(agcmx/96.76)+1)]-dbv0+30+26;

a1pmxoff = 40*[log10(10.^(agcpmx/96.76)+1)]-dbv0+30+26;

a1zoff = 40*[log10(10.^(agcz/94.81)+1)]-dbv0+30+26;

a1hf2new=[a1pxoff' a1mxoff' a1pmxoff' a1zoff'];

save a1hf2new.dat -ascii a1hf2new

disp('lire file e:\cassini\calmv1\flucthf.022')

readdata

agcx=mean(agch21');

agcpx=agcx(1:2:end);

agcmx=agcx(2:2:end);

agcpmx=mean([agcpx;agcmx]);

agcz=mean(agch22');

agcz=(agcz(1:2:end)+agcz(2:2:end))/2;

load dbv0

load a1hf2new.dat

a1pxon = 40*[log10(10.^(agcpx/96.76)+1)]-dbv0+6+26;

a1mxon = 40*[log10(10.^(agcmx/96.76)+1)]-dbv0+6+26;

a1pmxon = 40*[log10(10.^(agcpmx/96.76)+1)]-dbv0+6+26;

a1zon = 40*[log10(10.^(agcz/94.81)+1)]-dbv0+6+26;

a1hf2new=[a1hf2new a1pxon' a1mxon' a1pmxon' a1zon'];

a1hf2new=[a1hf2new;a1hf2new(321,:)];

save a1hf2new.dat -ascii a1hf2new

a1hf1find.m

load a1hf2new.dat

k=1:86;

a1hf1new(2*k,:)=a1hf2new(k,:);

a1hf1new(2*k+1,:)=(a1hf2new(k,:)+a1hf2new(k+1,:))/2;

a1hf1new(1,:)=a1hf1new(2,:); % cas 0 Hz

save a1hf1new.dat -ascii a1hf1new

dbcal_2.m

disp('lire file 32filabc.002')

readdata

autoa1=reshape(autoa1,32,110);

autoa2=reshape(autoa2,32,110);

autob1=reshape(autob1,32,110);

autob2=reshape(autob2,32,110);

autoc1=reshape(autoc1,32,110);

autoc2=reshape(autoc2,32,110);

a=mean(autoa1');

b=mean(autob1');

c=mean(autoc1');

ax32=ntodb(a);

bx32=ntodb(b);

cx32=ntodb(c);

a=mean(autoa2');

b=mean(autob2');

c=mean(autoc2');

az32=ntodb(a);

bz32=ntodb(b);

cz32=ntodb(c);

abc32=[ax32' az32';bx32' bz32';cx32' cz32'];

plot(abc32);pause

save abc32

disp('lire file 16filabc.001')

readdata

autoa1=reshape(autoa1,16,100);

autoa2=reshape(autoa2,16,100);

autob1=reshape(autob1,16,100);

autob2=reshape(autob2,16,100);

autoc1=reshape(autoc1,16,100);

autoc2=reshape(autoc2,16,100);

a=mean(autoa1');

b=mean(autob1');

c=mean(autoc1');

ax16=ntodb(a);

bx16=ntodb(b);

cx16=ntodb(c);

a=mean(autoa2');

b=mean(autob2');

c=mean(autoc2');

az16=ntodb(a);

bz16=ntodb(b);

cz16=ntodb(c);

abc16=[ax16' az16';bx16' bz16';cx16' cz16'];

plot(abc16);pause

save abc16

disp('lire file 8filtabc.001')

readdata

autoa1=reshape(autoa1,8,100);

autoa2=reshape(autoa2,8,100);

autob1=reshape(autob1,8,100);

autob2=reshape(autob2,8,100);

autoc1=reshape(autoc1,8,100);

autoc2=reshape(autoc2,8,100);

a=mean(autoa1');

b=mean(autob1');

c=mean(autoc1');

ax8=ntodb(a);

bx8=ntodb(b);

cx8=ntodb(c);

a=mean(autoa2');

b=mean(autob2');

c=mean(autoc2');

az8=ntodb(a);

bz8=ntodb(b);

cz8=ntodb(c);

abc8=[ax8' az8';bx8' bz8';cx8' cz8'];

plot(abc8);pause

save abc8

load abc32

load abc16

ax32=abc32(1:32,1);

az32=abc32(1:32,2);

bx32=abc32(33:64,1);

bz32=abc32(33:64,2);

cx32=abc32(65:96,1);

cz32=abc32(65:96,2);

ax16=abc16(1:16,1);

az16=abc16(1:16,2);

bx16=abc16(17:31,1);

bz16=abc16(17:31,2);

cx16=abc16(32:48,1);

cz16=abc16(32:48,2);

phaseabc.m

%Determination of phase shift between +X and -X inputs in ABC bands

%with and without internal attenuator.	- 3.12.99

disp('lire e:\cassini\calmv1\llgcr20.020')

readdata

[ang,mag]=phasemag(crosscr,crossci);

ang=reshape(ang,32,512);

angp=ang(:,1:2:512);

angm=ang(:,2:2:512);

angcp=mean(angp(:,40:70)');

angcm=mean(angm(:,40:70)');

save temp1 angcp angcm

disp('lire e:\cassini\calmv1\llgbr20.020')

readdata

[ang,mag]=phasemag(crossbr,crossbi);

ang=reshape(ang,32,512);

angm=ang(:,2:2:512);

angp=ang(:,1:2:512);

angbm=mean(angm(:,40:70)');

angbp=mean(angp(:,40:70)');

save temp angbp angbm

disp('lire e:\cassini\calmv1\llgar20.020')

readdata

[ang,mag]=phasemag(crossar,crossai);

ang=reshape(ang,32,512);

angp=ang(:,1:2:512);

angm=ang(:,2:2:512);

angam=mean(angm(:,40:70)');

angap=mean(angp(:,40:70)');

load temp

load temp1

angapm=mean([angap;angam+180]);

angbpm=mean([angbp;angbm+180]);

angcpm=mean([angcp;angcm+180]);

phase32_abc_new=[angap' angam' angapm' angbp' angbm' angbpm' angcp' angcm' angcpm'];

fid=fopen('phase32_abc_new.dat','w')

fprintf(fid,'%8.2f%10.2f%8.2f%8.2f%10.2f%8.2f%8.2f%10.2f%8.2f\r\n',phase32_abc
_new')

fclose(fid)

phase16_abc_new=(phase32_abc_new(1:2:32,:)+phase32_abc_new(2:2:32,:))/2;

phase8_abc_new=(phase16_abc_new(1:2:16,:)+phase16_abc_new(2:2:16,:))/2;

fid=fopen('phase16_abc_new.dat','w')

fprintf(fid,'%8.2f%10.2f%8.2f%8.2f%10.2f%8.2f%8.2f%10.2f%8.2f\r\n',phase16_abc
_new')

fclose(fid)

fid=fopen('phase8_abc_new.dat','w')

fprintf(fid,'%8.2f%10.2f%8.2f%8.2f%10.2f%8.2f%8.2f%10.2f%8.2f\r\n',phase8_abc_
new')

fclose(fid)

phase_hf_fit.m

load phase_hf1.dat

load phase_hf2.dat

hf1tofit=phase_hf1(7:172,:);

%hf2tofit=phase_hf2(4:322,:);

hf2tofit=phase_hf2(4:200,:);

coefpoff=polyfit([1:166]',hf1tofit(:,1),7);

coefmoff=polyfit([1:166]',hf1tofit(:,2),7);

coefpmoff=polyfit([1:166]',hf1tofit(:,3),7);

coefpon=polyfit([1:166]',hf1tofit(:,4),7);

coefmon=polyfit([1:166]',hf1tofit(:,5),7);

coefpmon=polyfit([1:166]',hf1tofit(:,6),7);

poff=polyval(coefpoff,1:166)';

moff=polyval(coefmoff,1:166)';

pmoff=polyval(coefpmoff,1:166)';

pon=polyval(coefpon,1:166)';

mon=polyval(coefmon,1:166)';

pmon=polyval(coefpmon,1:166)';

all=[poff moff pmoff pon mon pmon];

phase_hf1_new=[phase_hf1(1:6,:);all];

coefpoff=polyfit([1:197]',hf2tofit(:,1),9);

coefmoff=polyfit([1:197]',hf2tofit(:,2),9);

coefpmoff=polyfit([1:197]',hf2tofit(:,3),9);

coefpon=polyfit([1:197]',hf2tofit(:,4),9);

coefmon=polyfit([1:197]',hf2tofit(:,5),9);

coefpmon=polyfit([1:197]',hf2tofit(:,6),9);

poff=polyval(coefpoff,1:197)';

moff=polyval(coefmoff,1:197)';

pmoff=polyval(coefpmoff,1:197)';

pon=polyval(coefpon,1:197)';

mon=polyval(coefmon,1:197)';

pmon=polyval(coefpmon,1:197)';

all=[poff moff pmoff pon mon pmon];

phase_hf2_new=[phase_hf2(1:3,:);all];

hf2tofit=phase_hf2(201:322,:);

coefpoff=polyfit([1:122]',hf2tofit(:,1),9);

coefmoff=polyfit([1:122]',hf2tofit(:,2),9);

coefpmoff=polyfit([1:122]',hf2tofit(:,3),9);

coefpon=polyfit([1:122]',hf2tofit(:,4),9);

coefmon=polyfit([1:122]',hf2tofit(:,5),9);

coefpmon=polyfit([1:122]',hf2tofit(:,6),9);

poff=polyval(coefpoff,1:122)';

moff=polyval(coefmoff,1:122)';

pmoff=polyval(coefpmoff,1:122)';

pon=polyval(coefpon,1:122)';

mon=polyval(coefmon,1:122)';

pmon=polyval(coefpmon,1:122)';

all=[poff moff pmoff pon mon pmon];

phase_hf2_new=[phase_hf2_new;all];

readdata.m

(too long)

physique.m

%dbvolt.m -> physique.m	16.12.99

%

% conversion of auto/agc results from readdata in dBvolts.

% READDATA or READNORMAL must have run before.

load a123.dat

if att,

a123(:,1)=a123(:,4);

end

if banda | bandb | bandc,

if nchanabc==8, load dbcal_08.dat; dbcal=dbcal_08; end

if nchanabc==16, load dbcal_16.dat; dbcal=dbcal_16; end

if nchanabc==32, load dbcal_32.dat; dbcal=dbcal_32; end

end

if bandh1 | bandh2, load dbcalhf.dat; end

if bandh1, load a1hf1.dat; end

if bandh2, load a1hf2.dat; end

dba1=[];dba2=[];dbb1=[];dbb2=[];dbc1=[];dbc2=[];

dbh11=[];dbh12=[];dbh21=[];dbh22=[];

if ~exist('npktnormal'), npktnormal=npacket; end % compatibility READDATA/READNORMAL

if banda & nagca1,

a=a123(1,:);

x1=-a(1)+40*(log10(10.^((agca1(:)-a(3))./a(2))+1));

agca1=reshape(agca1,nagca1,npktnormal);

autoa1=reshape(autoa1,nchanabc,nautoa1*npktnormal/nchanabc);

nn=nautoa1*npktnormal/nchanabc;

for j=1:nchanabc,

if dfabc,

dba1(j,1:2:nn)=ntodb(autoa1(j,1:2:nn))-dbcal(j,1)+x1(1:2:nn)';

dba1(j,2:2:nn)=ntodb(autoa1(j,2:2:nn))-dbcal(j,2)+x1(1:2:nn)';

else

dba1(j,:)=ntodb(autoa1(j,:))-dbcal(j,3)+x1';

end

end

dba1=reshape(dba1,nautoa1,npktnormal);

autoa1=reshape(autoa1,nautoa1,npktnormal);

end

if banda & nagca2,

a=a123(2,:);

x2=-a(1)+40*(log10(10.^((agca2(:)-a(3))./a(2))+1));

agca2=reshape(agca2,nagca2,npktnormal);

autoa2=reshape(autoa2,nchanabc,nautoa2*npktnormal/nchanabc);

for j=1:nchanabc,

dba2(j,:)=ntodb(autoa2(j,:))-dbcal(j,4)+x2';

end

dba2=reshape(dba2,nautoa2,npktnormal);

autoa2=reshape(autoa2,nautoa2,npktnormal);

end

if bandb & nagcb1,

a=a123(3,:);

x1=-a(1)+40*(log10(10.^((agcb1(:)-a(3))./a(2))+1));

agcb1=reshape(agcb1,nagcb1,npktnormal);

autob1=reshape(autob1,nchanabc,nautob1*npktnormal/nchanabc);

nn=nautob1*npktnormal/nchanabc;

for j=1:nchanabc,

if dfabc,

dbb1(j,1:2:nn)=ntodb(autob1(j,1:2:nn))-dbcal(j,5)+x1(1:2:nn)';

dbb1(j,2:2:nn)=ntodb(autob1(j,2:2:nn))-dbcal(j,6)+x1(1:2:nn)';

else

dbb1(j,:)=ntodb(autob1(j,:))-dbcal(j,7)+x1';

end

end

dbb1=reshape(dbb1,nautob1,npktnormal);

autob1=reshape(autob1,nautob1,npktnormal);

end

if bandb & nagcb2,

a=a123(4,:);

x2=-a(1)+40*(log10(10.^((agcb2(:)-a(3))./a(2))+1));

agcb2=reshape(agcb2,nagcb2,npktnormal);

autob2=reshape(autob2,nchanabc,nautob2*npktnormal/nchanabc);

for j=1:nchanabc,

dbb2(j,:)=ntodb(autob2(j,:))-dbcal(j,8)+x2';

end

dbb2=reshape(dbb2,nautob2,npktnormal);

autob2=reshape(autob2,nautob2,npktnormal);

end

if bandc & nagcc1,

a=a123(5,:);

x1=-a(1)+40*(log10(10.^((agcc1(:)-a(3))./a(2))+1));

agcc1=reshape(agcc1,nagcc1,npktnormal);

autoc1=reshape(autoc1,nchanabc,nautoc1*npktnormal/nchanabc);

nn=nautoc1*npktnormal/nchanabc;

for j=1:nchanabc,

if dfabc,

dbc1(j,1:2:nn)=ntodb(autoc1(j,1:2:nn))-dbcal(j,9)+x1(1:2:nn)';

dbc1(j,2:2:nn)=ntodb(autoc1(j,2:2:nn))-dbcal(j,10)+x1(1:2:nn)';

else

dbc1(j,:)=ntodb(autoc1(j,:))-dbcal(j,11)+x1';

end

end

dbc1=reshape(dbc1,nautoc1,npktnormal);

autoc1=reshape(autoc1,nautoc1,npktnormal);

end

if bandc & nagcc2,

a=a123(6,:);

x2=-a(1)+40*(log10(10.^((agcc2(:)-a(3))./a(2))+1));

agcc2=reshape(agcc2,nagcc2,npktnormal);

autoc2=reshape(autoc2,nchanabc,nautoc2*npktnormal/nchanabc);

for j=1:nchanabc,

dbc2(j,:)=ntodb(autoc2(j,:))-dbcal(j,12)+x2';

end

dbc2=reshape(dbc2,nautoc2,npktnormal);

autoc2=reshape(autoc2,nautoc2,npktnormal);

end

if bandh1,

nstart=fstarth1/25;

dstep=fsteph1/25;

nstop=nstart+(nstepsh1-1)*dstep;

freqh1=fstarth1:fsteph1:(fstarth1+fsteph1*(nstepsh1-1));

if nagch11,

dbcal=dbcalhf(1:nchanh1,1+2*floor(3.6*log10(nchanh1)));

a2=a123(7,2);

a3=a123(7,3);

agch11=reshape(agch11,nagch11/rch1/rcall,npktnormal*rch1*rcall);

k=anth11+att*4;

x1=agch11;

for j=1:nagch11/rch1/rcall,

if dfh1,

k=j+2-2*floor((j+1)/2)+att*4;

end

n=nstart+1+floor((j-1)/(1+dfh1))*dstep;

x1(j,:)=-a1hf1(n,k) ...

+40*(log10(10.^((agch11(j,:)-a3)./a2)+1));

end

if nautoh11,

dbh11=ntodb(autoh11);

dbh11=reshape(dbh11,nchanh1,nagch11*npktnormal);

dbh11=dbh11-repmat(dbcal,1,nagch11*npktnormal);

dbh11=dbh11+repmat(x1(:)',nchanh1,1);

if dfh1,

dbh11=reshape(dbh11,2*nchanh1,nagch11*npktnormal/2);

dbh11=[reshape(dbh11(1:nchanh1,:),1,nautoh11*npktnormal/2); ...

reshape(dbh11(nchanh1+1:nchanh1*2,:),1,nautoh11*npktnormal/2)];

end

dbh11=reshape(dbh11,max(nagch11,nautoh11)/rch1/rcall,npktnormal*rch1*rcall);

else,

dbh11=zeros(1,nagch11*npktnormal);

dbh11=dbh11+x1(:)';

dbh11=reshape(dbh11,nagch11/rch1/rcall,npktnormal*rch1*rcall);

end

end

if nagch12,

dbcal=dbcalhf(1:nchanh1,2+2*floor(3.6*log10(nchanh1)));

a2=a123(8,2);

a3=a123(8,3);

agch12=reshape(agch12,nagch12/rch1/rcall,npktnormal*rch1*rcall);

x2=agch12;

for j=1:nagch12/rch1/rcall,

n=nstart+1+floor((j-1)/(1+dfh1))*dstep;

x2(j,:)=-a1hf1(n,4*(att+1)) ...

+40*(log10(10.^((agch12(j,:)-a3)./a2)+1));

end

if nautoh12,

dbh12=ntodb(autoh12);

dbh12=reshape(dbh12,nchanh1,nagch12*npktnormal);

dbh12=dbh12-repmat(dbcal,1,nagch12*npktnormal);

dbh12=dbh12+repmat(x1(:)',nchanh1,1);

if dfh1,

dbh12=reshape(dbh12,2*nchanh1,nagch12*npktnormal/2);

dbh12=[reshape(dbh12(1:nchanh1,:),1,nautoh12*npktnormal/2); ...

reshape(dbh12(nchanh1+1:nchanh1*2,:),1,nautoh12*npktnormal/2)];

end

dbh12=reshape(dbh12,max(nagch12,nautoh12)/rch1/rcall,npktnormal*rch1*rcall);

else,

dbh12=zeros(1,nagch12*npktnormal);

dbh12=dbh12+x1(:)';

dbh12=reshape(dbh12,nagch12/rch1/rcall,npktnormal*rch1*rcall);

end

end

end

if bandh2,

nstart=(fstarth2-25)/50;

dstep=fsteph2/50;

nstop=nstart+(nstepsh2-1)*dstep;

freqh2=fstarth2:fsteph2:(fstarth2+fsteph2*(nstepsh2-1));

if nagch21,

dbcal=dbcalhf(1:nchanh2,1+2*floor(3.6*log10(nchanh2)));

a2=a123(7,2);

a3=a123(7,3);

agch21=reshape(agch21,nagch21/rch2/rcall,npktnormal*rch2*rcall);

k=anth21+att*4;

x1=agch21;

for j=1:nagch21/rch2/rcall,

if dfh2,

k=j+2-2*floor((j+1)/2)+att*4;

end

n=min(nstart+1+floor((j-1)/(1+dfh2))*dstep,322);

x1(j,:)=-a1hf2(n,k) ...

+40*(log10(10.^((agch21(j,:)-a3)./a2)+1));

end

if nautoh21,

dbh21=ntodb(autoh21);

dbh21=reshape(dbh21,nchanh2,nagch21*npktnormal);

dbh21=dbh21-repmat(dbcal,1,nagch21*npktnormal);

dbh21=dbh21+repmat(x1(:)',nchanh2,1);

if dfh1,

dbh21=reshape(dbh21,2*nchanh2,nagch21*npktnormal/2);

dbh21=[reshape(dbh21(1:nchanh2,:),1,nautoh21*npktnormal/2); ...

reshape(dbh21(nchanh2+1:nchanh2*2,:),1,nautoh21*npktnormal/2)];

end

dbh21=reshape(dbh21,max(nagch21,nautoh21)/rch2/rcall,npktnormal*rch1*rcall);

else,

dbh21=zeros(1,nagch21*npktnormal);

dbh21=dbh21+x1(:)';

dbh21=reshape(dbh21,nagch21/rch2/rcall,npktnormal*rch2*rcall);

end

end

if nagch22,

dbcal=dbcalhf(1:nchanh2,2+2*floor(3.6*log10(nchanh2)));

a2=a123(8,2);

a3=a123(8,3);

agch22=reshape(agch22,nagch22/rch2/rcall,npktnormal*rch2*rcall);

x2=agch22;

for j=1:nagch22/rch2/rcall,

n=min(nstart+1+floor((j-1)/(1+dfh2))*dstep,322);

x2(j,:)=-a1hf2(n,4*(att+1)) ...

+40*(log10(10.^((agch22(j,:)-a3)./a2)+1));

end

if nautoh22,

dbh22=ntodb(autoh22);

dbh22=reshape(dbh22,nchanh2,nagch22*npktnormal);

dbh22=dbh22-repmat(dbcal,1,nagch22*npktnormal);

dbh22=dbh22+repmat(x1(:)',nchanh2,1);

if dfh1,

dbh22=reshape(dbh22,2*nchanh2,nagch22*npktnormal/2);

dbh22=[reshape(dbh22(1:nchanh2,:),1,nautoh22*npktnormal/2); ...

reshape(dbh22(nchanh2+1:nchanh1*2,:),1,nautoh22*npktnormal/2)];

end

dbh22=reshape(dbh22,max(nagch22,nautoh22)/rch2/rcall,npktnormal*rch2*rcall);

else,

dbh22=zeros(1,nagch22*npktnormal);

dbh22=dbh22+x1(:)';

dbh22=reshape(dbh22,nagch22/rch2/rcall,npktnormal*rch2*rcall);

end

end

end

phasemag.m

function [phase,mag] = phasemag(crossr,crossi)

% phasemag.m -- 27.09.99

% Transforms cross reals and imaginaries Kronos

% in phase (degrees) and magnitude.

er=fix(abs(crossr)/8);

ei=fix(abs(crossi)/8);

mr=abs(crossr)-er*8;

mi=abs(crossi)-ei*8;

nr=2.^er.*(mr+8);

ni=2.^ei.*(mi+8);

nr=nr.*sign(crossr);

ni=ni.*sign(crossi);

phase=atan2(ni,nr)*180/pi;

nri=sqrt(nr.^2+ni.^2);

siz=size(crossr);

e=zeros(siz);

for j=1:32,

nrimag=nri>16;

e=e+nrimag;

nri=nri-nri.*nrimag/2;

end

m=nri-8;

mag=e*8+m;

return

correl_phase.m

function [ph,tauxr,tauxi] = corr_ph(auto1,auto2,crossr,crossi)

%

%function [ph,tauxr,tauxi] = corr_ph(auto1,auto2,crossr,crossi)

%calculates the phase shift (in degrees) and cross-correlation ratios

lx=crossr;

ly=crossi;

ex=fix(abs(lx)/8);

ey=fix(abs(ly)/8);

mx=abs(lx)-ex*8;

my=abs(ly)-ey*8;

nx=2.^ex.*(mx+8);

ny=2.^ey.*(my+8);

nx=nx.*sign(lx);

ny=ny.*sign(ly);

ph=atan2(ny,nx)*180/pi;

lx=auto1;

ly=auto2;

ex=fix(abs(lx)/8);

ey=fix(abs(ly)/8);

mx=abs(lx)-ex*8;

my=abs(ly)-ey*8;

nxa=2.^ex.*(mx+8);

nya=2.^ey.*(my+8);

tauxr=nx./sqrt(nxa.*nya);

tauxi=ny./sqrt(nxa.*nya);

fixsign.m

% fixsign.m -- 27.09.99

% to be called after READDATA to correct signs of cross-correlations.

nca=ncrossa;

ncab=nca+ncrossb;

ncabc=ncab+ncrossc;

ncabch1=ncabc+ncrossh1;

ncabch12=ncabc+ncrossh2;

x1=flipud(reshape(xi,8,npacket*nsign));

x2=flipud(reshape(xr,8,npacket*nsign));

x=[x1;x2];

x=reshape(x,nsign*16,npacket);

if ncrossa,

crossar=abs(crossar).*x(2:2:2*nca,:);

crossai=abs(crossai).*x(1:2:2*nca,:);

end

if ncrossb,

crossbr=abs(crossbr).*x(2*nca+2:2:2*(ncab),:);

crossbi=abs(crossbi).*x(2*nca+1:2:2*(ncab),:);

end

if ncrossc,

crosscr=abs(crosscr).*x(2*ncab+2:2:2*ncabc,:);

crossci=abs(crossci).*x(2*ncab+1:2:2*ncabc,:);

end

if ncrossh1,

crossh1r=abs(crossh1r).*x(2*ncabc+2:2:2*ncabch1,:);

crossh1i=abs(crossh1i).*x(2*ncabc+1:2:2*ncabch1,:);

end

if ncrossh2,

crossh2r=abs(crossh2r).*x(2*ncabch1+2:2:2*ncabch12,:);

crossh2i=abs(crossh2i).*x(2*ncabch1+1:2:2*ncabch12,:);

end

ntodb.m

function [db] = ntodb(counts)

% ntodb.m -- 27.09.99

e=fix(counts/8);

m=counts-8*e;

db=10*log10(2 .^e .*(m+8));

fitlogeq.m

function err = fitlogeq(a)

%	FITLOGEQ(a) returns the residuals between the input log response points

%	and the computed response curve with current values of coefficients

%	A1, A2, A3, A4. It is called by FITLOG as an argument of FMINS.

global data plothandle err nx1 nx2 z

t = data(:,1);

y = data(:,2);

z=a(2).*log10((10.^((a(1)-t)/10)+10.^(-a(4)/10)).^.25-1)+a(3);

set(plothandle,'ydata',z)

drawnow

err = norm(z(nx1:nx2)-y(nx1:nx2));

fitlog.m

function err = fitlog(data)

% Fit of log response ...

% equation in FITLOGEQ.M

% function to call

% -> data must be of the form [n,2] where the first column contains

% attenuations and the second one the telemetry points to be fitted.

% Derived from "FITDEMO Nonlinear curve fit with simplex algorithm".

close

figure

global data

%	Let's plot the data.

t = data(:,1);

y = data(:,2);

axis([0 130 0 260])

hold on

plot(t,y,'c+','EraseMode','none')

title('Loi Log')

xlabel('dB attenuation')

ylabel('points télémesure')

siz=prod(size(data))/2;

xmin=data(1,1);xmax=data(siz,1);

disp('cliquez sur le premier point pour le fit')

[x1,y1]=ginput(1);

disp('cliquez sur le dernier point pour le fit')

[x2,y2]=ginput(1);

if x1<xmin, x1=xmin; end

if x2>xmax, x2=xmax; end

nx1=ceil(siz*(x1-xmin)/(xmax-xmin))+1;

nx2=floor(siz*(x2-xmin)/(xmax-xmin));

%data=data(nx1:nx2,:);

plot(t,y,'c+',t(nx1:nx2),y(nx1:nx2),'rx','EraseMode','none')

title('Loi Log')

xlabel('dB attenuation')

ylabel('points télémesure')

global plothandle err nx1 nx2 z

plothandle = plot(t,y,'y-','EraseMode','xor');

a0 = [100 100 0 -20]';

trace = 0;

tol = .1;

a = fmins('fitlogeq',a0,[trace tol]);

hold off

echo off

s = ['a = fmins(''fitlogeq'',[100 100 0 -20]'',[0 .1]);'];

uicontrol('Units','normal','Position',[.15 .01 .1 .06],'String','Again','callback',s)

t1=sprintf('A1 = %6.2f',a(1));

t2=sprintf('A2 = %6.2f',a(2));

t3=sprintf('A3 = %6.2f',a(3));

t4=sprintf('A4 = %6.2f',a(4));

terr=sprintf('erreur = %6.2f',err);

text(60,235,t1);

text(60,220,t2);

text(60,205,t3);

text(60,190,t4);

text(60,165,terr);

disp('End')

llogntox.m

function [x]=llogntox(n,a)

% x = a1 - 40*[log10(10^((n-a3)/a2)+1)]

% n == points de telemesure

% x == entree deduite en dB (a V0 pres)

x = a(1) - 40*[log10(10.^((n-a(3))/a(2))+1)];

llogxton.m

function [n]=llogxton(x,a)

% x == entree en dB

% n == points de telemesure

n=a(2).*log10((10.^((a(1)-x)/10)+10.^(-a(4)/10)).^.25-1)+a(3);

Various files.

dbcal32.txt

» readdata

which data file? fluctabc.004

bench1 =

old

Analysis data

Bands A B C

ABC integrate time = 1.000 sec

no. of channels = 32

direction finding ON

internal attenuator OFF

90 packets

» axp=mean(autoa1(1:32,:)');

» bxp=mean(autob1(1:32,:)');

» cxp=mean(autoc1(1:32,:)');

» cxm=mean(autoc1(33:64,:)');

» bxm=mean(autob1(33:64,:)');

» axm=mean(autoa1(33:64,:)');

» axp=ntodb(axp);

» bxp=ntodb(bxp);

» cxp=ntodb(cxp);

» cxm=ntodb(cxm);

» bxm=ntodb(bxm);

» axm=ntodb(axm);

» hold off

» plot([axp bxp cxp],'r')

» hold on

» plot([axm bxm cxm],'b')

» title('dBcals deduced from file fluctabc.004 - + & - Ex')

» ylabel('dB')

» print -dpsc ___1.ps

» ax=mean(reshape(autoa1,32,180)');

» bx=mean(reshape(autob1,32,180)');

» cx=mean(reshape(autoc1,32,180)');

» cz=mean(reshape(autoc2,32,180)');

» bz=mean(reshape(autob2,32,180)');

» az=mean(reshape(autoa2,32,180)');

» ax=ntodb(ax);

» bx=ntodb(bx);

» cx=ntodb(cx);

» cz=ntodb(cz);

» bz=ntodb(bz);

» az=ntodb(az);

» dbcal=[axp' axm' ax' az'

bxp' bxm' bx' bz'

cxp' cxm' cx' cz']

dbcal =

75.3941 76.0089 75.7124 75.6301

75.3941 75.9166 75.6632 75.6107

75.2363 75.9062 75.5744 75.5463

75.1506 75.7690 75.4203 75.4579

:

:

:

70.7538 70.9125 70.8339 70.9269

dbcal.txt

» readdata

which data file? llgar20.020

bench1 =

old

Analysis data

Bands A repeat count ALL = 1

ABC integrate time = 1.000 sec

no. of channels = 32

antenna 1 -> +/-Ex autos ON

antenna 2 -> +Ez cross ON

direction finding ON repeat count = 4

internal attenuator OFF

64 packets

» physique

» size(dba1)

256 64

» d1=reshape(dba1,64,256);

» d2=reshape(d1',4,256*16);

» d2=mean(d2);

» d3=reshape(d2,64,64);

» d3=d3';

» d4=reshape(d3,32,128);

» dpx=d4(:,1:2:128);

» dmx=d4(:,2:2:128);

» plot(mean(dpx(:,1:35)'-dmx(:,1:35)'))

» title('mean(dpx(:,1:35)''-dmx(:,1:35)''')

» x=1:32;

» y=mean(dpx(:,1:35)'-dmx(:,1:35)');

» c=polyfit(x,y,5);

» y1=polyval(c,x);

» plot(x,y,x,y1)

» title('diff. dBcal32 bande A - (+X)-(-X) - file llgar20.020')

» ylabel('dB');xlabel('canaux');grid on

» yy=[y' y1'];

» save dbcal_diff_A.dat -ascii yy

»

» load dbcal_32.dat

» size(dbcal_32)

96 2

» dpxc_32=dbcal_32(1:32,1);

» dmxc_32=dpxc_32+y1';

» dpmxc_32=(dpxc_32+dmxc_32)/2;

» coeffs_c_32=[dpxc_32 dmxc_32 dpmxc_32 dbcal_32(1:32,2)];

» save dbcoeffs_a_32.dat -ascii coeffs_c_32

» plot([dpxc_32 dmxc_32 dpmxc_32])

» ylabel('dB');xlabel('canaux');grid on

» title('dBcal +X, -X, +/-X, Bande A, 32 canaux')

» load dbcal_16.dat

» size(dbcal_16)

48 2

» dpxc_16=dbcal_16(1:16,1);

» yb=(y1(1:2:32)+y1(2:2:32))/2;

» dmxc_16=dpxc_16+yb';

» dpmxc_16=(dpxc_16+dmxc_16)/2;

» coeffs_c_16=[dpxc_16 dmxc_16 dpmxc_16 dbcal_16(1:16,2)];

» save dbcoeffs_a_16.dat -ascii coeffs_c_16

» plot([dpxc_16 dmxc_16 dpmxc_16])

» ylabel('dB');xlabel('canaux');grid on

» title('dBcal +X, -X, +/-X, Bande A, 16 canaux')

» load dbcal_08.dat

» size(dbcal_08)

8 6

» dpxc_08=dbcal_08(:,1);

» yc=(yb(1:2:16)+yb(2:2:16))/2;

» dmxc_08=dpxc_08+yc';

» dpmxc_08=(dpxc_08+dmxc_08)/2;

» coeffs_c_08=[dpxc_08 dmxc_08 dpmxc_08 dbcal_08(:,4)];

» save dbcoeffs_a_08.dat -ascii coeffs_c_08

» plot([dpxc_08 dmxc_08 dpmxc_08])

» ylabel('dB');xlabel('canaux');grid on

» title('dBcal +X, -X, +/-X, Bande A, 08 canaux')

» readdata

which data file? llgbr20.020

bench1 =

old

Analysis data

Bands B repeat count ALL = 1

ABC integrate time = 1.000 sec

no. of channels = 32

antenna 1 -> +/-Ex autos ON

antenna 2 -> +Ez cross ON

direction finding ON repeat count = 4

attenuateur interne OFF

64 packets

» physique

» d1=reshape(dbb1,64,256);

» d2=reshape(d1',4,256*16);

» d2=mean(d2);

» d3=reshape(d2,64,64);

» d3=d3';

» d4=reshape(d3,32,128);

» dpx=d4(:,1:2:128);

» dmx=d4(:,2:2:128);

» y=mean(dpx(:,4:34)'-dmx(:,4:34)');

» x=1:32;

» plot(x,y)

» plot(dpx'-dmx')

» c=polyfit(x,y,5);

» y1=polyval(c,x);

» plot(x,y,x,y1)

» ylabel('dB');xlabel('canaux');grid on

» title('diff. dBcal32 bande B - (+X)-(-X) - file llgbr20.020')

» yy=[y' y1'];

» save dbcal_diff_B.dat -ascii yy

» load dbcal_32.dat

» size(dbcal_32)

32 6

» dpxc_32=dbcal_32(:,2);

» dmxc_32=dpxc_32+y1';

» dpmxc_32=(dpxc_32+dmxc_32)/2;

» coeffs_c_32=[dpxc_32 dmxc_32 dpmxc_32 dbcal_32(:,5)];

» save dbcoeffs_b_32.dat -ascii coeffs_c_32

» plot([dpxc_32 dmxc_32 dpmxc_32])

» ylabel('dB');xlabel('canaux');grid on

» title('dBcal +X, -X, +/-X, Bande B, 32 canaux')

» load dbcal_16.dat

» size(dbcal_16)

16 6

» dpxc_16=dbcal_16(:,2);

» yb=(y1(1:2:32)+y1(2:2:32))/2;

» dmxc_16=dpxc_16+yb';

» dpmxc_16=(dpxc_16+dmxc_16)/2;

» coeffs_c_16=[dpxc_16 dmxc_16 dpmxc_16 dbcal_16(1:16,5)];

» save dbcoeffs_b_16.dat -ascii coeffs_c_16

» plot([dpxc_16 dmxc_16 dpmxc_16])

» ylabel('dB');xlabel('canaux');grid on

» title('dBcal +X, -X, +/-X, Bande B, 16 canaux')

» load dbcal_08.dat

» size(dbcal_08)

8 6

» dpxc_08=dbcal_08(:,1);

» yc=(yb(1:2:16)+yb(2:2:16))/2;

» dmxc_08=dpxc_08+yc';

» dpmxc_08=(dpxc_08+dmxc_08)/2;

» coeffs_c_08=[dpxc_08 dmxc_08 dpmxc_08 dbcal_08(:,5)];

» save dbcoeffs_b_08.dat -ascii coeffs_c_08

» plot([dpxc_08 dmxc_08 dpmxc_08])

» ylabel('dB');xlabel('canaux');grid on

» title('dBcal +X, -X, +/-X, Bande B, 8 canaux')

»

» readdata

which data file? llgcr20.020

bench1 =

old

Analysis data

Bands C repeat count ALL = 1

ABC integrate time = 1.000 sec

no. of channels = 32

antenna 1 -> +/-Ex autos ON

antenna 2 -> +Ez cross ON

direction finding ON repeat count = 4

attenuateur interne OFF

64 packets

» d1=reshape(dbc1,64,256);

??? Undefined function or variable 'dbc1'.

» physique

» d1=reshape(dbc1,64,256);

» d2=reshape(d1',4,256*16);

» d2=mean(d2);

» d3=reshape(d2,64,64);

» d3=d3';

» d4=reshape(d3,32,128);

» dpx=d4(:,1:2:128);

» dmx=d4(:,2:2:128);

» plot(dpx'-dmx')

» plot(dpx(1:32,:)'-dmx(1:32,:)')

» plot(dpx(:,1:32)'-dmx(:,1:32)')

» y=mean(dpx(:,1:32)'-dmx(:,1:32)');

» x=1:32;

» c=polyfit(x,y,5);

» y1=polyval(c,x);

» plot(x,y,x,y1)

» ylabel('dB');xlabel('canaux');grid on

» title('diff. dBcal32 bande C - (+X)-(-X) - file llgcr20.020')

» load dbcal_32.dat

» dpxc_32=dbcal_32(:,3);

» dmxc_32=dpxc_32+y1';

» dpmxc_32=(dpxc_32+dmxc_32)/2;

» coeffs_c_32=[dpxc_32 dmxc_32 dpmxc_32 dbcal_32(:,6)];

» save dbcoeffs_c_32.dat -ascii coeffs_c_32

» plot([dpxc_32 dmxc_32 dpmxc_32])

» ylabel('dB');xlabel('canaux');grid on

» title('dBcal +X, -X, +/-X, Bande C, 32 canaux')

» load dbcal_16.dat

» dpxc_16=dbcal_16(:,3);

» yb=(y1(1:2:32)+y1(2:2:32))/2;

» dmxc_16=dpxc_16+yb';

» dpmxc_16=(dpxc_16+dmxc_16)/2;

» coeffs_c_16=[dpxc_16 dmxc_16 dpmxc_16 dbcal_16(1:16,6)];

» save dbcoeffs_c_16.dat -ascii coeffs_c_16

» plot([dpxc_16 dmxc_16 dpmxc_16])

» ylabel('dB');xlabel('canaux');grid on

» title('dBcal +X, -X, +/-X, Bande C, 16 canaux')

» load dbcal_08.dat

» yc=(yb(1:2:16)+yb(2:2:16))/2;

» dpxc_08=dbcal_08(:,3);

» dmxc_08=dpxc_08+yc';

» dpmxc_08=(dpxc_08+dmxc_08)/2;

» coeffs_c_08=[dpxc_08 dmxc_08 dpmxc_08 dbcal_08(:,6)];

» save dbcoeffs_c_08.dat -ascii coeffs_c_08

» plot([dpxc_08 dmxc_08 dpmxc_08])

» ylabel('dB');xlabel('canaux');grid on

» title('dBcal +X, -X, +/-X, Bande C, 8 canaux')

dbcal_2.txt

» dbcal_2 --> continuation of processing described in dbcal32.txt

readdata

which data file? 32filabc.002

bench1 =

old

Analysis data

Bands A B C repeat count ALL = 10

ABC integrate time = 1.000 sec

no. of channels = 32

antenna 1 -> +/-Ex autos ON

antenna 2 -> +Ez cross ON

direction finding OFF repeat count = 1

internal attenuator ON

11 packets

readdata

which data file? 16filabc.001

bench1 =

old

Analysis data

Bands A B C repeat count ALL = 100

ABC integrate time = 1.000 sec

no. of channels = 16

antenna 1 -> +/-Ex autos ON

antenna 2 -> +Ez cross ON

direction finding OFF repeat count = 1

internal attenuator ON

1 packets

readdata

which data file? 8filtabc.001

bench1 =

old

Analysis data

Bands A B C repeat count ALL = 100

ABC integrate time = 1.000 sec

no. of channels = 8

antenna 1 -> +/-Ex autos ON

antenna 2 -> +Ez cross ON

direction finding OFF repeat count = 1

internal attenuator ON

1 packets

--> continuation of processing done in dbcal_2.m

» plot([[ax32;bx32;cx32] dbcal32(:,1)])

» ylabel('dB');xlabel('canaux');grid on

» title('[[ax32;bx32;cx32] dbcal32(:,1)]')

» x32=[ax32;bx32;cx32];

» z32=[az32;bz32;cz32];

» deltax32=x32-dbcal32(:,1);

» deltaz32=z32-dbcal32(:,4);

» plot([deltax32 deltaz32])

» ylabel('dB');xlabel('canaux');grid on

» title('[deltax32 deltaz32]')

» diffp_m32=dbcal32(:,1)-dbcal32(:,2);

» plot(diffp_m32)

» ylabel('dB');xlabel('canaux');grid on

» title('diffp_m32=dbcal32(:,1)-dbcal32(:,2)')

» dbcal16=zeros(48,4);

» dbcal8=zeros(24,4);

» x16=[ax16;bx16;cx16];

» z16=[az16;bz16;cz16];

» x8=[ax8';bx8';cx8'];

» z8=[az8';bz8';cz8'];

» deltax16=(deltax32(1:2:96)+deltax32(2:2:96))/2;

» deltaz16=(deltaz32(1:2:96)+deltaz32(2:2:96))/2;

» deltax8 = (deltax16(1:2:48)+deltax16(2:2:48))/2;

» deltaz8 = (deltaz16(1:2:48)+deltaz16(2:2:48))/2;

» diffp_m16=(diffp_m32(1:2:96)+diffp_m32(2:2:96))/2;

» diffp_m8 = (diffp_m16(1:2:48)+diffp_m16(2:2:48))/2;

» dbcal16(:,1)=x16-deltax16;

» dbcal16(:,2)=x16-deltax16-diffp_m16;

» dbcal16(:,3)=x16-deltax16-diffp_m16/2;

» dbcal16(:,4)=z16-deltaz16;

» dbcal8(:,1)=x8-deltax8;

» dbcal8(:,2)=x8-deltax8-diffp_m8;

» dbcal8(:,2)=x8-deltax8-diffp_m8/2;

» dbcal8(:,2)=x8-deltax8-diffp_m8;

» dbcal8(:,3)=x8-deltax8-diffp_m8/2;

» dbcal8(:,4)=z8-deltaz8;

»

» dbcal_32=[dbcal32(1:32,:) dbcal32(33:64,:) dbcal32(65:96,:)];

» dbcal_16=[dbcal16(1:16,:) dbcal16(17:32,:) dbcal16(33:48,:)];

» dbcal_08=[dbcal8(1:8,:) dbcal8(9:16,:) dbcal8(17:24,:)];

» dbcal_32=round(dbcal_32*100)/100;

» dbcal_16=round(dbcal_16*100)/100;

» dbcal_08=round(dbcal_08*100)/100;

» save dbcal_32.dat -ascii dbcal_32

» save dbcal_16.dat -ascii dbcal_16

» save dbcal_08.dat -ascii dbcal_08

correction_sinx_x_abc.txt

Calculation of the correction to apply to Vo in log response calibrations

of ABC receivers due to the sin(x)/x shape of the spectrum of noise generators.

» fca=40;

» fcb=180;

» fcc=800;

» fra=3.6:.02:3.6*4.5;

» frb=4.5*fra;

» frc=4.5*frb;

» arga=pi*fra/fca;

» argb=pi*frb/fcb;

» argc=pi*frc/fcc;

» pa=(sin(arga)./arga).^2;

» pb=(sin(argb)./argb).^2;

» pc=(sin(argc)./argc).^2;

» meana=10*log10(.02*sum(pa)/3.6/3.5)

meana = -0.9686

» meanb=10*log10(.02*sum(pb)/3.6/3.5)

meanb = -0.9686

» meanc=10*log10(.02*sum(pc)/3.6/3.5)

meanc = -0.9927

% calculation of average level of noise generators.

» dbv0a=10*log10(1.86^2/2/fca/1000)+meana

dbv0a = -44.6093

» dbv0b=10*log10(1.86^2/2/fcb/1000)+meanb

dbv0b = -51.1414

» dbv0c=10*log10(1.835^2/2/fcc/1000)+meanc

dbv0c = -57.7611

integration_times.txt

== discussion of acquisition and computation times for each configuration.

Calculation of ABC measurement times

====================================

» ncycles=ones(3,1)*[81 18 4] % sampling rate in multiples of 200 ns

81 18 4

81 18 4

81 18 4

» scale=[1128;513;245]; % of files iscale(8,16,32).dat, canal 0

» nn=230;

» q=(2*256*(nn-1)./scale+1)/2 % == onboard calculations

52.4716

114.7768

239.7816

» ntaps=floor(q*ones(1,3)) % filter lengths (canal 0)

52 52 52

114 114 114

239 239 239

» nsamples=2*ntaps;

» tacq=.0002*ncycles.*nsamples

A B C

1.6848 0.3744 0.0832 | 8

3.6936 0.8208 0.1824 | 16

7.7436 1.7208 0.3824 | 32

» ttotal=[2.532 1.2214 .936;5.572 2.879 2.246;13.476 7.452 6.119]

2.5320 1.2214 0.9360 % measured by P. Fedou

5.5720 2.8790 2.2460

13.4760 7.4520 6.1190

» tcalcul=ttotal-tacq % == quite homogeneous (except B16)

0.8472 0.8470 0.8528

1.8784 2.0582 2.0636

5.7324 5.7312 5.7366

» nblocks=[407 873 1164;179 367 478;76 140 172] % of file blocks.dat,

407 873 1164 values for 1 sec

179 367 478

76 140 172

» nblocks.*ttotal/1000

1.0305 1.0663 1.0895 % =~ 1 sec.

0.9974 1.0566 1.0736

1.0242 1.0433 1.0525

idem for HF

============

» scale=[512;1024;2047]; % of file hfscale.dat

512

1024

2047

» nn=80;

» q=(2*256*(nn-1)./scale+1)/2

40.0000

20.2500

10.3798

» ntap=floor(q);

» ntaps=flipud([80;ntap])

10

20

40

80

» nsamples=2*ntaps;

» tacq=.0002*ncycles.*nsamples

0.0680

0.1360

0.2720

0.5440

» ttotal=[.2472;.4178;.8102;1.7761]

0.2472

0.4178

0.8102

1.7761

» tcalcul=ttotal-tacq

0.1792

0.2818

0.5382

1.2321

corr_integrate_times.txt

» load blocks.tmp = number of analyses averaged by the ADSP as a function of the band

number of filters, and integration time.

» abc=blocks(1:36);hf=blocks(37:56);

» abc=reshape(abc,3,12)

51 102 204 407 109 218 436 873 145 291 582 1164 8f

22 45 90 179 46 92 183 367 60 119 239 478 16f

9 19 38 76 17 35 70 140 21 43 86 172 32f

.125 .25 .5 1 .125 .25 .5 1 .125 .25 .5 1 sec

--------------------- --------------------- ---------------------

A B C

» abcnn=reshape(abc',4,9)

51 109 145 22 46 60 9 17 21 .125s

102 218 291 45 92 119 19 35 43 .25

204 436 582 90 183 239 38 70 86 .5

407 873 1164 179 367 478 76 140 172 1

A B C A B C A B C

--------------------- --------------------- ---------------------

8f 16f 32f

Normalize wrt … 1 sec, ideally ratios of 2 :

» abcnn(1,:)=abcnn(1,:)*8;

» abcnn(2,:)=abcnn(2,:)*4;

» abcnn(3,:)=abcnn(3,:)*2;

» abcnn

408 872 1160 176 368 480 72 136 168

408 872 1164 180 368 476 76 140 172

408 872 1164 180 366 478 76 140 172

407 873 1164 179 367 478 76 140 172

Compare with ideal matrix :

» norm=ones(4,1)*abcnn(4,:)

407 873 1164 179 367 478 76 140 172

407 873 1164 179 367 478 76 140 172

407 873 1164 179 367 478 76 140 172

407 873 1164 179 367 478 76 140 172

» abcn=abcnn./norm

1.0025 0.9989 0.9966 0.9832 1.0027 1.0042 0.9474 0.9714 0.9767

1.0025 0.9989 1.0000 1.0056 1.0027 0.9958 1.0000 1.0000 1.0000

1.0025 0.9989 1.0000 1.0056 0.9973 1.0000 1.0000 1.0000 1.0000

1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000

» dbabc=10*log10(abcn);

» dbabc=reshape(dbabc,12,3)';

» dbabc=reshape(dbabc,3,4,3)

dbabc(:,:,1) =

0.0107 0.0107 0.0107 0 A- 8

-0.0734 0.0242 0.0242 0 A-16

-0.2348 0 0 0 A-32

dbabc(:,:,2) =

-0.0050 -0.0050 -0.0050 0 B- 8

0.0118 0.0118 -0.0118 0 B-16

-0.1259 0 0 0 B-32

dbabc(:,:,3) =

-0.0149 0 0 0 C- 8

0.0181 -0.0182 0 0 C-16

-0.1022 0 0 0 C-32

» ----- ----- ----- -----

.125s .25s .5s 1s

idem for HF

===========

» hf=reshape(hf,4,5)

41 85 171 345 692 1f

25 50 102 205 412 2f

13 26 53 106 213 4f

6 12 24 48 96 8f

10 20 40 80 160 ms

Normalize wrt … 80 msec, ideally ratios of 2 :

» test=[8 4 2 1 .5];

» test=ones(4,1)*test

8.0000 4.0000 2.0000 1.0000 0.5000

8.0000 4.0000 2.0000 1.0000 0.5000

8.0000 4.0000 2.0000 1.0000 0.5000

8.0000 4.0000 2.0000 1.0000 0.5000

» hfn=hf.*test

328.0000 340.0000 342.0000 345.0000 346.0000

200.0000 200.0000 204.0000 205.0000 206.0000

104.0000 104.0000 106.0000 106.0000 106.5000

48.0000 48.0000 48.0000 48.0000 48.0000

Compare with ideal matrix :

» norm=hfn(:,4)*ones(1,5)

345 345 345 345 345

205 205 205 205 205

106 106 106 106 106

48 48 48 48 48

» dbhf=10*log10(hfn./norm)

-0.2195 -0.0634 -0.0379 0 0.0126 1 filt.

-0.1072 -0.1072 -0.0212 0 0.0211 2 "

-0.0827 -0.0827 0 0 0.0204 4 "

0 0 0 0 0 8 "

----- ----- ----- ----- -----

10ms 20ms 40ms 80ms 160ms

"worst case error" equals case 10 ms, 1 filter == -.22 dB

__________________________________________________________

But... results of trials on files flucthf.001 to flucthf.010...

» a1=[157.1 156.8 156.7 156.8 156.6];

» a2=[167.9 167.8 167.7 167.6 167.5];

» a3=[175.4 175.9 176.1 176.0 175.9];

» a4=[183.9 184.3 182.2 182.2 182.2];

» d1=(ntodb(a1)-ntodb(a1(4)));

» d2=(ntodb(a2)-ntodb(a2(4)));

» d3=(ntodb(a3)-ntodb(a3(4)));

» d4=(ntodb(a4)-ntodb(a4(4)));

» [d1;d2;d3;d4]

0.1006 0 -0.0341 0 -0.0684 1

0.0827 0.0553 0.0278 0 -0.0279 2

-0.1660 -0.0272 0.0540 0 -0.0272 4

0.4911 0.6782 0 0 0 8

» ----- ----- ----- ----- -----

10ms 20ms 40ms 80ms 160ms

These results are not in very good agreement with theoretical predictions above, but probably the tests were not well controlled and long enough to reach the required accuracy.

Files newcode

used for data decompression (meander)

newcode1.dat newcode2.dat newcode3.dat

040f 0000 0000

0508 0000 0000

0511 040a 0000

0000 0000 0000

0514 0000 0000

0502 0502 0000

050b 050a 0407

0000 0000 0000

040c 040f 0000

0505 0505 0404

050e 0407 0305

0000 0000 0000

0000 0000 0000

0000 0000 0000

0000 0000 0000

0000 0000 0000

040d 0000 0000

0506 0506 0000

050f 0408 0400

0000 0000 0000

0512 040b 0000

0500 0500 0306

0509 0508 0405

0000 0000 0000

0515 040d 0000

0503 0503 0402

050c 050b 0408

0000 0000 0000

0000 0000 0000

0000 0000 0000

0000 0000 0000

0000 0000 0000

040e 0000 0000

0507 0507 0000

0510 0409 0307

0000 0000 0000

0513 040c 0000

0501 0501 0401

050a 0509 0406

0000 0000 0000

040b 040e 0000

0504 0504 0403

050d 0406 0409

0000 0000 0000

IDL programs.

The programs involved in data calibration (from raw auto and cross values to physical units) are "cal.pro", which calls the routines "agc_db.pro" and "auto_db.pro" and uses the save_set "constants.xdr". This save set is built with the program "read_constants.pro" and the above data tables "a….dat" and "dbcal….dat".

help_cal.pro

pro HELP_CAL

print,'Function CAL, agc, auto, bande, ant, freq, nfilters, filter'

print,'Function AGC_dB, agc, a1, a2, a3'

print,'Function AUTO_dB, auto'

return

end

cal.pro

Function CAL, agc, auto, bande, ant, freq, nfilters, filter	;, att

; Conversion of [tables of] couples (agc,auto) or (agc,cross) into values

; in physical units (dB / Volts.Hz^-1/2)

; band = 0-4 (A,B,C,H1,H2)

; ant = 0-3 (+X,-X,D,Z)

; freq = frequency (kHz), H1 & H2 only; =0 pour ABC

; nfilters = 1,2,4,8,16,32 (filters/band)

; filter = 1-32 (# of filter in the band)

; att = 0-1 (Off,On)

common KRONOSCAL, a1h1,a1h2,ai,dbcal_abc,dbcal_h

if n_elements(ai) eq 0 then restore,'constants.xdr'

ncal=n_elements(agc)

if n_elements(att) eq 0 then att=intarr(ncal)

a123=fltarr(3,ncal)

iant=byte(ant/3)

for i=0L,ncal-1L do a123(*,i)=ai(*,iant(i),bande(i),att(i))

ifreq=freq

test=where(bande eq 3)

if test(0) ne -1 then begin

testfreq=where(bande eq 3 and ifreq gt 4300)

if testfreq(0) ne -1 then ifreq(testfreq)=4300

ntest=n_elements(test)

for i=0L,ntest-1L do a123(0,test(i))= $

a1h1(ant(test(i)),fix(ifreq(test(i))/25),att(test(i)))

endif

test=where(bande eq 4)

if test(0) ne -1 then begin

testfreq=where(bande eq 4 and ifreq gt 16075)

if testfreq(0) ne -1 then ifreq(testfreq)=16075

ntest=n_elements(test)

for i=0L,ntest-1L do a123(0,test(i))= $

a1h2(ant(test(i)),fix((ifreq(test(i))-25)/50),att(test(i)))

endif

dBcal=fltarr(ncal)

test=where(bande le 2)

ntest=n_elements(test)

if test(0) ne -1 then for i=0L,ntest-1L do dBcal(test(i))= $

dBcal_abc(filter(test(i)),ant(test(i)),bande(test(i)), $

fix(alog(nfilters(test(i))*1.)/alog(2.)+0.5)-3)

test=where(bande gt 2)

ntest=n_elements(test)

if test(0) ne -1 then for i=0L,ntest-1L do dBcal(test(i))= $

dBcal_h(filter(test(i)),iant(test(i)), $

fix(alog(nfilters(test(i))*1.)/alog(2.)+0.5))

dB=fltarr(ncal)

test=where(agc ne 255)

if test(0) ne -1 then $

dB(test)=AGC_dB(agc(test),a123(0,test),a123(1,test),a123(2,test))

test=where(auto ne 255)

if test(0) ne -1 then $

dB(test)=dB(test)+AUTO_dB(auto(test))-dBcal(test)

test=where((agc ne 255 or auto ne 255) and ant ne 2)

if test(0) ne -1 then dB(test)=dB(test)+3.	; +3 dB in monopole

return, dB

; dB = 0 si agc = auto = 0

end

agc_db.pro

Function AGC_dB, agc, a1, a2, a3

dB = -a1 + 40.*alog10( 1. + 10.^((agc-a3)/a2) )

return, dB

end

auto_db.pro

Function AUTO_dB, auto

dB = 10.*alog10( (8.+(auto and '07'x)) *2.^(ishft(auto and 'f8'x, -3)) )

return, dB

end

read_constants.pro

; READ_CONSTANTS.pro

; reads a_i & dB_cal values from files db_cal.dat, a1hf1.dat & a1hf2.dat

buf=[	166.37,73.20,-0.01,	$	; A band, Ex, Att Off

164.84,73.16, 3.21,	$	; A band, Ez, "

168.48,85.61, 0.08,	$	; B band, Ex, "

168.70,85.03, 1.31,	$	; B band, Ez, "

168.43,82.58, 0.01,	$	; C band, Ex, "

169.46,82.30, 0.00,	$	; C band, Ez, "

0. ,94.81, 0. ,	$	; H1 band, Ex, "

0. ,96.76, 0. ,	$	; H1 band, Ez, "

0. ,94.81, 0. ,	$ ; H2 band, Ex	H2 = H1

0. ,96.76, 0. ] ; H2 band, Ez

ai=fltarr(3,2,5,2)	; a123, Ex/z, 5 bands, att off/on

ai(*,*,*,0)=reform(buf,3,2,5)

ai(*,*,*,1)=ai(*,*,*,0)

ai(0,*,*,1)=reform([136.27,134.84,138.38,138.70,138.33,139.46,0,0,0,0],2,5)

a1h1=fltarr(4,173,2)	; +x/-x/+-x/z, 0,25,50...4300 kHz, att off/on

a1h2=fltarr(4,322,2)	; +x/-x/+-x/z, 25,75...16075 kHz, att off/on

buf=fltarr(8)

openr,u,'a1hf1.dat',/get_lun

for i=0,172 do begin

readf,u,buf

a1h1(*,i,0)=buf(0:3) & a1h1(*,i,1)=buf(4:7)

endfor

close,u & free_lun,u

openr,u,'a1hf2.dat',/get_lun

for i=0,321 do begin

readf,u,buf

a1h2(*,i,0)=buf(0:3) & a1h2(*,i,1)=buf(4:7)

endfor

close,u & free_lun,u

dbcal_abc=fltarr(32,4,3,3)	; #filt, +x/-x/+-x/z, ABC, 8/16/32

buf=fltarr(12)

openr,u,'dbcal_08.dat',/get_lun

for i=0,7 do begin

readf,u,buf

dbcal_abc(i,*,0,0)=buf(0:3) & dbcal_abc(i,*,1,0)=buf(4:7)

dbcal_abc(i,*,2,0)=buf(8:11)

endfor

close,u & free_lun,u

openr,u,'dbcal_16.dat',/get_lun

for i=0,15 do begin

readf,u,buf

dbcal_abc(i,*,0,1)=buf(0:3) & dbcal_abc(i,*,1,1)=buf(4:7)

dbcal_abc(i,*,2,1)=buf(8:11)

endfor

close,u & free_lun,u

openr,u,'dbcal_32.dat',/get_lun

for i=0,31 do begin

readf,u,buf

dbcal_abc(i,*,0,2)=buf(0:3) & dbcal_abc(i,*,1,2)=buf(4:7)

dbcal_abc(i,*,2,2)=buf(8:11)

endfor

close,u & free_lun,u

dbcal_h=fltarr(8,2,4)	; #filt, x/z, 1/2/4/8

buf=fltarr(8)

openr,u,'dbcalhf.dat',/get_lun

for i=0,7 do begin

readf,u,buf

dbcal_h(i,*,*)=buf

endfor

close,u & free_lun,u

save,a1h1,a1h2,ai,dbcal_abc,dbcal_h,file='constants.xdr',/xdr,/verb

; A1H1	FLOAT = Array(4, 173, 2)

;	+x/-x/+-x/z, 0,25,50...4300 kHz, att off/on

; A1H2	FLOAT = Array(4, 322, 2)

;	+x/-x/+-x/z, 25,75...16075 kHz, att off/on

; AI	FLOAT = Array(3, 2, 5, 2)

;	a123, Ex/z, 5 bands, att off/on

; DBCAL_ABC	FLOAT = Array(32, 4, 3, 3)

;	#filt, +x/-x/+-x/z, ABC, 8/16/32

; DBCAL_H	FLOAT = Array(8, 2, 4)

;	#filt, x/z, 1/2/4/8

end

constants.xdr

IDL> restore,'constants.xdr'

IDL> help

A1H1 FLOAT = Array[4, 173, 2]

A1H2 FLOAT = Array[4, 322, 2]

AI FLOAT = Array[3, 2, 5, 2]

DBCAL_ABC FLOAT = Array[32, 4, 3, 3]

DBCAL_H FLOAT = Array[8, 2, 4]

The program "prep_df.pro" below is an example of reading and calibrating data in direction-finding mode, including calibration of phases. The part in italics is simply the loading and selection of raw data. The following part performs the calibration of amplitudes by calling "cal.pro", and than correction of phases using the save_set "phases.xdr". This save set is built with the program "read_phases.pro" and the above data tables "phase….dat".

prep_df.pro

pro PREP_DF, aaaajjj, hd, hf, bande, vv,xts,xf,msec

; reads "analysis" data (Kronos ~NewBench) from a list of files

; (from 'liste.scratch'), calibrate, and fills the array VV

; = VV*[+X,Z,-X,Z] Re,Im(VV*)[+X,Z] Re,Im(VV*)[-X,Z]

; af full temporal resolution, with corrected phases

; xts & xf = time (sec) and frequency (kHz)

; msec = integration time of measurements

; band : A=0, B=1, C=2, H1=3, H2=4

; do first (in the program directory)

; dir/out=liste.scratch/col=1/nohead/notrail [dir_Kronos] (VMS)

; ls -1 /dir/sous_dir/dir_Kronos/* > liste.scratch (Unix)

common KRONOSCAL, a1h1,a1h2,ai,dbcal_abc,dbcal_h	; ,v0

LIT_HFR_LISTE, aaaajjj, hd, hf, bande, bande, z

print & print,'selection of DF data ...'

test=where(z.bande eq bande and z.df gt 10 and z.agc1 ne 255b and $

z.agc2 ne 255b and z.auto1 ne 255b and z.auto2 ne 255b and $

z.cross1 ne -999 and z.cross2 ne -999)

if test(0) ne -1 then z=z(test) else stop

help,z

; preparation tableaux xts & xf

nz = n_elements(z)

xts = dblarr(nz) & xf=fltarr(nz)

for i=0L,nz-1L do xts(i)=total(transpose(z(i).time)#[3600.0,60.0,1.0,0.01])

if bande le 2 then begin

nfilt=z(0).filters & freq_ABC,nfilt,freq

for i=0L,nz-1L do begin

if z(i).filters ne nfilt then begin

nfilt=z(i).filters & freq_ABC,nfilt,freq

endif

xf(i)=freq(bande*nfilt+z(i).filter)

endfor

endif else xf=z.channel+25*z.filter/z.filters

; remplissage tableau data (vv)

df1=where(z.df eq 11) & ndf=n_elements(df1) & df2=lonarr(ndf)

for i=0L,ndf-1L do begin

ii=df1(i) & i1=min([ii+1L,nz-1L]) & i2=min([ii+z(ii).filters,nz-1L])

jj=where(xf(i1:i2) eq xf(ii) and xts(i1:i2) eq xts(ii) $

and z(i1:i2).df eq 12)

jj=jj(0) & if jj ne -1 then jj=jj+i1

df2(i)=jj

endfor

test=where(df2 ne -1)

if n_elements(test) lt ndf then if test(0) ne -1 then begin

df1=df1(test) & df2=df2(test) & ndf=n_elements(df1)

endif

z1=z(df1) & z2=z(df2)

xf=xf(df1) & xts=xts(df1) & msec=z1.msec*10

vv=fltarr(ndf,8)

; VV*[+X,Z,-X,Z] Re,Im(VV*)[+X,Z] Re,Im(VV*)[-X,Z]

restore,'phases.xdr'

; AXX+

buf=cal(z1.agc1,z1.auto1,z1.bande,z1.df-11b,z1.channel,z1.filters,z1.filter)

vv(*,0)=10.^(buf/10.)

; AZZ(+)

buf=cal(z1.agc2,z1.auto2,z1.bande,z1.df-8b,z1.channel,z1.filters,z1.filter)

vv(*,1)=10.^(buf/10.)

; AXX-

buf=cal(z2.agc1,z2.auto1,z2.bande,z2.df-11b,z2.channel,z2.filters,z2.filter)

vv(*,2)=10.^(buf/10.)

; AZZ(-)

buf=cal(z2.agc2,z2.auto2,z2.bande,z2.df-9b,z2.channel,z2.filters,z2.filter)

vv(*,3)=10.^(buf/10.)

; Re(+XZ) & Im(+XZ)

ax=10.^(auto_db(z1.auto1)/10.) & az=10.^(auto_db(z1.auto2)/10.)

cr=z1.cross1 & cr=cr/abs(cr)*(10.^(auto_db(abs(cr))/10.))

ci=z1.cross2 & ci=ci/abs(ci)*(10.^(auto_db(abs(ci))/10.))

cr=cr/sqrt(ax*az)

ci=ci/sqrt(ax*az)

cm=sqrt(cr^2+ci^2)

thph=atan(ci,cr)*!radeg

ph=fltarr(ndf) & att=intarr(ndf)	; hyp. = sans attenuation

if bande le 2 then for i=0L,ndf-1L do ph(i)=phases_abc(z1(i).filter, $

(z1(i).df mod 10)-1b,z1(i).bande, $

fix(alog(z1(i).filters*1.)/alog(2.)+0.5)-3)

if bande eq 3 then begin

freq=z1.channel

test=where(freq gt 4300)

if test(0) ne -1 then freq(test)=4300

for i=0L,ndf-1L do ph(i)=ph_h1((z1(i).df mod 10)-1b,fix(freq(i)/25),0)+ $

phases_h(z1(i).filter,fix(alog(z1(i).filters*1.)/alog(2.)+0.5))

endif

if bande eq 4 then begin

freq=z1.channel

test=where(freq gt 16075)

if test(0) ne -1 then freq(test)=16075

for i=0L,ndf-1L do $

ph(i)=ph_h2((z1(i).df mod 10)-1b,fix((freq(i)-25)/50),0)+ $

phases_h(z1(i).filter,fix(alog(z1(i).filters*1.)/alog(2.)+0.5))

endif

th=(thph-ph)/!radeg

cr=cm*cos(th)

ci=cm*sin(th)

; Re(+XZ)

vv(*,4)=cr

; Im(+XZ)

vv(*,5)=ci

; Re(-XZ) & Im(-XZ)

ax=10.^(auto_db(z2.auto1)/10.) & az=10.^(auto_db(z2.auto2)/10.)

cr=z2.cross1 & cr=cr/abs(cr)*(10.^(auto_db(abs(cr))/10.))

ci=z2.cross2 & ci=ci/abs(ci)*(10.^(auto_db(abs(ci))/10.))

cr=cr/sqrt(ax*az)

ci=ci/sqrt(ax*az)

cm=sqrt(cr^2+ci^2)

thph=atan(ci,cr)*!radeg

ph=fltarr(ndf) & att=intarr(ndf)	; hyp. = sans attenuation

if bande le 2 then for i=0L,ndf-1L do ph(i)=phases_abc(z2(i).filter, $

(z2(i).df mod 10)-1b,z2(i).bande, $

fix(alog(z2(i).filters*1.)/alog(2.)+0.5)-3)

if bande eq 3 then begin

freq=z2.channel

test=where(freq gt 4300)

if test(0) ne -1 then freq(test)=4300

for i=0L,ndf-1L do ph(i)=ph_h1((z2(i).df mod 10)-1b,fix(freq(i)/25),0)+ $

phases_h(z2(i).filter,fix(alog(z2(i).filters*1.)/alog(2.)+0.5))

endif

if bande eq 4 then begin

freq=z2.channel

test=where(freq gt 16075)

if test(0) ne -1 then freq(test)=16075

for i=0L,ndf-1L $

do ph(i)=ph_h2((z2(i).df mod 10)-1b,fix((freq(i)-25)/50),0)+ $

phases_h(z2(i).filter,fix(alog(z2(i).filters*1.)/alog(2.)+0.5))

endif

th=(thph-ph)/!radeg

cr=cm*cos(th)

ci=cm*sin(th)

; Re(-XZ)

vv(*,6)=cr

; Im(-XZ)

vv(*,7)=ci

help, vv,xts,xf,msec

return

end

read_phases.pro

; READ_PHASES.pro

; reads phases values from files phase8/16/32_abc.dat,

; phase_hf1/2.dat & phase1248_hf.dat

ph_h1=fltarr(3,173,2)	; +x/-x/+-x(ref=z), 0,25,50...4300 kHz, att off/on

ph_h2=fltarr(3,322,2)	; +x/-x/+-x(ref=z), 25,75...16075 kHz, att off/on

buf=fltarr(6)

openr,u,'phase_hf1.dat',/get_lun

for i=0,172 do begin

readf,u,buf

ph_h1(*,i,0)=buf(0:2) & ph_h1(*,i,1)=buf(3:5)

endfor

close,u & free_lun,u

openr,u,'phase_hf2.dat',/get_lun

for i=0,321 do begin

readf,u,buf

ph_h2(*,i,0)=buf(0:2) & ph_h2(*,i,1)=buf(3:5)

endfor

close,u & free_lun,u

phases_abc=fltarr(32,3,3,3)	; #filt, +x/-x/+-x(ref=z), ABC, 8/16/32

buf=fltarr(9)

openr,u,'phase8_abc.dat',/get_lun

for i=0,7 do begin

readf,u,buf

phases_abc(i,*,0,0)=buf(0:2) & phases_abc(i,*,1,0)=buf(3:5)

phases_abc(i,*,2,0)=buf(6:8)

endfor

close,u & free_lun,u

openr,u,'phase16_abc.dat',/get_lun

for i=0,15 do begin

readf,u,buf

phases_abc(i,*,0,1)=buf(0:2) & phases_abc(i,*,1,1)=buf(3:5)

phases_abc(i,*,2,1)=buf(6:8)

endfor

close,u & free_lun,u

openr,u,'phase32_abc.dat',/get_lun

for i=0,31 do begin

readf,u,buf

phases_abc(i,*,0,2)=buf(0:2) & phases_abc(i,*,1,2)=buf(3:5)

phases_abc(i,*,2,2)=buf(6:8)

endfor

close,u & free_lun,u

phases_h=fltarr(8,4)	; #filt, 1/2/4/8

buf=fltarr(4)

openr,u,'phase1248_hf.dat',/get_lun

for i=0,7 do begin

readf,u,buf

phases_h(i,*)=buf

endfor

close,u & free_lun,u

save,ph_h1,ph_h2,phases_abc,phases_h,file='phases.xdr',/xdr,/verb

; PH_H1 FLOAT = Array(3, 173, 2)

;	+x/-x/+-x(ref=z), 0,25,50...4300 kHz, att off/on

; PH_H2 FLOAT = Array(3, 322, 2)

;	+x/-x/+-x(ref=z), 25,75...16075 kHz, att off/on

; PHASES_ABC FLOAT = Array(32, 3, 3, 3)

;	#filt, +x/-x/+-x(ref=z), ABC, 8/16/32

; PHASES_H FLOAT = Array(8, 4)

;	#filt, 1/2/4/8

end

phases.xdr

IDL> restore,'phases.xdr'

IDL> help

PHASES_ABC FLOAT = Array[32, 3, 3, 3]

PHASES_H FLOAT = Array[8, 4]

PH_H1 FLOAT = Array[3, 173, 2]

PH_H2 FLOAT = Array[3, 322, 2]