NAME

camssim - (1) Simulates motion of the Extensible Optical Bench (EOB) for testing CAMS-correction. (2) Generates RAW coordinates associated with given HXI ACT coordinates and the simulated motion.

USAGE

camssim infile1 infile2 outroothxi outrootcams

DESCRIPTION

'camssim' generates a set of sinusoidal motions of the Hitomi Extended Optical Bench (EOB), for both rotation and translation motions. From these simulated motions, 'camssim' calculates the amount by which each of the two CAMS units moves and, optionally the amount by which an HXI unit moves. 'camssim' has two different parts:

1. Generates simulated CAMS output files based on simulated EOB motion. The output files are compatible with all CAMS analysis tools and can be used to study in-flight motion. 'camssim' supports three types of statistical errors in the CAMS measurements but does not simulate CAMS malfunction, and always outputs two files with matched time columns and no missing data. Any simulation of missing data (filtering or modifying the file) should be done directly by the user .

2. Applies the simulated EOB motion to an HXI event file containing either real or simulated data. The simulated EOB motion calculated as described below is applied to the HXI ACTX and ACTY coordinates (no EOB motion) to generate RAWX and RAWY (with EOB motion).

The motion is simulated as a combination of six sinusoids, two in each perpendicular linear direction (X and Y) and two in rotation (twist). The amplitudes of the six motions can be set independently, and two different frequencies can be set. The linear motions can also be chosen (using the 'typemotion' parameter) to be in phase, 90 degrees out of phase, or 180 degrees out of phase.

The six independent amplitudes can be set as parameters 'xamp1,' 'xamp2,' 'yamp1', 'yamp2' (in mm, for translation) and 'ramp1,' 'ramp2' (in mrad, for twist). The two independent frequencies can also be set as parameters 'freq1' and 'freq2.' The output values (in the coordinates of the CAMS units) are 'delta_x', the resulting motion in the X-direction, 'delta_y', the motion in the Y-direction, and 'gamma', the twist angle. Using these definitions, the three possible types of motion are as follows, with time as the independent variable.

Linear Motion all in phase (typemotion=1).
delta_x = xamp1*cos(freq1*time) + xamp2*sin(freq2*time)
delta_y = yamp1*cos(freq1*time) + yamp2*sin(freq2*time)
gamma = ramp1*cos(freq1*time) + ramp2*sin(freq2*time)
Linear Motion X 180 degrees out of phase with Y and gamma (typemotion=2).
delta_x = -xamp1*cos(freq1*time) - xamp2*sin(freq2*time)
delta_y = yamp1*cos(freq1*time) + yamp2*sin(freq2*time)
gamma = ramp1*cos(freq1*time) + ramp2*sin(freq2*time)
Circular Motion. X and Y are 90 degrees out of phase (typemotion=3).
delta_x = xamp1*cos(freq1*time) + xamp2*cos(freq2*time)
delta_y = yamp1*sin(freq1*time) + yamp2*sin(freq2*time)
gamma = ramp1*cos(freq1*time) + ramp2*sin(freq2*time)

It is also possible to add random error to the simulated CAMS measurements. Calling "randn" a normally-distributed random number and "freqerr" the frequency of the time-dependent part, and using the three input parameters 'randerr,' 'sinerr' and 'consterr', representing respectively the amplitudes of a random error, a time-varying error, and a constant error respectively. The errors are derived as:

error_x1 = randerr*randn + consterr*sin(freqerr*time) + sinerr
error_y1 = randerr*randn + sinerr*sin(freqerr*time) + consterr
error_x2 = randerr*randn + sinerr*sin(freqerr*time) + consterr
error_y2 = randerr*randn + sinerr*sin(freqerr*time) + consterr
The errors are applied to the output CAMS X/Y positions (delta_x, delta_y), but not to the rotation angle.

PARAMETERS

infile1 [filename]
Input HXI1 event file with ACTX and ACTY coordinate columns to be converted to RAWX and RAWY by applying the simulated motion. Set to "NONE" if this output is not required.

infile2 [filename]
Input HXI2 event file with ACTX and ACTY coordinate columns to be converted to RAWX and RAWY by applying the simulated motion. Set to "NONE" if this output is not required.

outroothxi [string]
Root of the name of the output HXI file(s). The output file name is outroothxi-n.fits, where n is either 1 or 2. If both 'infile1' and 'infile2' are given as valid files, then there are two output HXI files with suffixes n=1 and n=2, providing the output corresponding to 'infile1' and 'infile2,' respectively. If only one of 'infile1' or 'infile2' is given as a valid file, then there is only one output file, corresponding to whichever input file is given.

outrootcams [string]
Root of the name of then output CAMS files. The output file names are outrootcams-1.fits for CAMS1 and outrootcams-2.fits for CAMS2.

(hxiteldef1 = CALDB) [string]
Name of the HXI1 TelDef file. If the parameter is set to CALDB, the file is read from the calibration database.

(hxiteldef2 = CALDB) [string]
Name of the HXI2 TelDef file. If the parameter is set to CALDB, the file is read from the calibration database.

(cams1teldef = CALDB) [string]
Name of the CAMS1 TelDef file. If the parameter is set to CALDB, the file is read from the calibration database.

(cams2teldef = CALDB) [string]
Name of the CAMS2 TelDef file. If the parameter is set to CALDB, the file is read from the calibration database.

(freq1 = 1.0) [real]
Frequency (Hz) of the 1st sinusoid in the simulated motion.

(freq2 = 1.0) [real]
Frequency (Hz) of the 2nd sinusoid in the simulated motion.

(xamp1 = 1.0) [real]
Amplitude (mm) of the X-motion (translation) for 1st sinusoid.

(xamp2 = 1.0) [real]
Amplitude (mm) of the X-motion (translation) for 2nd sinusoid.

(yamp1 = 1.0) [real]
Amplitude (mm) of the Y-motion (translation) for 1st sinusoid.

(yamp2 = 1.0) [real]
Amplitude (mm) of the Y-motion (translation) for 2nd sinusoid.

(ramp1 = 0.0) [real]
Amplitude (mrad) of the twist motion for 1st sinusoid.

(ramp2 = 0.0) [real]
Amplitude (mrad) of the twist motion for 2nd sinusoid.

(typemotion = 1) [int 1|2|3]
Type of motion 1 = X-Y in phase, 2 = X-Y out of phase, 3 = X-Y 90 degrees out of phase.

(deltatcams = 1.0) [real]
Time interval (s) in which the CAMS records five measurements.

(randerr = 0.240) [real]
Magnitude of CAMS error: random component (mm).

(consterr = 0.0) [real]
Magnitude of CAMS error: constant component (mm).

(sinerr = 0.0)[real]
Magnitude of CAMS error: sinusoidal component (mm).

(freqerr = 0.0) [real]
Frequency of the sinusoidal error component (Hz).

(seed = 0) [integer]
Random number generator seed; uses system time for seed=0.

(buffer = -1) [integer]
Rows to buffer (-1=auto, 0=none, >0=numrows).

(clobber = no) [boolean]
Overwrites the existing output file if set to yes (yes/[no]).

(chatter = 1) [integer]
Chatter level for output. Set to 0 to suppress output, or to 1, 2, or 3 for increasing the chatter of the output.

(logfile = !DEFAULT) [string]
Log filename. If set to DEFAULT uses the name of the task and, if preceded by '!', overwrite the file if it exists. If set to NONE no log file is created.

(debug = no) [boolean]
Diagnostic output is printed out on the screen if set to yes (yes/[no]).

(history = yes) [boolean]
Records tool parameters in HISTORY ([yes]/no).

(mode = ql) [string]
Mode to query the parameter file. Acceptable values include: "ql (query and learn/remember), "hl" (hidden and learn/remember), "q" (query but don't remember), "h" (hidden).

EXAMPLES

    1. Generate HXI1 and HXI2 files from input event files and default parameters:
    camssim infile1="hxi1_events.fits" infile2="hxi2_events.fits" 
    outroothxi="outputhxi" \
    outrootcams="outputcams" clobber=yes
    
    2. Generate HXI1 file from input event files, no twist motion and user-supplied amplitudes and frequencies. The X and Y motions are to be 90 degrees out of phase.
    camssim infile1="hxi1_events.fits" infile2="hxi2_events.fits" 
    outroothxi="outputhxi" \
    outrootcams="outputcams" freq1=10.0 freq2=0.5 xamp1=2.5 xamp2=3.6 \
    yamp1=1.5 yamp2=2.1 ramp1=0.0 ramp2=0.0 typemotion=3 clobber=yes
    
    3. Generate HXI1 file from input event files, same parameters as Example 2, but include user-supplied CAMS error parameters
    camssim infile1="hxi1_events.fits" infile2="hxi2_events.fits" 
    outroothxi="outputhxi" \
    outrootcams="outputcams" freq1=10.0 freq2=0.5 xamp1=2.5 xamp2=3.6 \
    yamp1=1.5 yamp2=2.1 ramp1=0.0 ramp2=0.0 typemotion=3 clobber=yes randerr=0.5 \
    consterr=0.1 sinerr=0.95 freqerr=60.0
    

SEE ALSO

cams2det cams2att

LAST MODIFIED

February 2016