# Cosmic¶

## Simulate comic¶

### The code¶

That case is equivalent to an observation without cosmic rejection.
Simply, we add the cosmic image to the simulated image.

### Add cosmic to simulation with rejection¶

We assume a perfect rejection then the only difference with the case without cosmic is the error.
In the case of a simulation with cosmic and rejection, the fluctuation and the errors of a pixel value are computed in considering the cosmic.

### Implementation¶

We add 3 new parameters in the aXeSIM configuration file:

COSMAP _string_
REJECT _string_
NBIT _string_


"COSMAP" is the name of the cosmic image (in the \$AXE_CONFIG_PATH).
"REJECT" accept for now two value, 'None' for no rejection and 'Perfect' for a perfect rejection.
"NBIT" is the number of bit used to encode the pixel value.
If "NBIT" is set and >0, the saturation value is define as 2**NBIT - 1.

The pixels hit by cosmic are flagged in the the "DQ" extension with the value 8192.
The saturated pixels are flagged in the the "DQ" extension with the value 256.

We also add a new argument, norm, to the simdispim function.
If norm=True, the product of the simulation is normalized by the exosure time.

## TODO¶

• include Chris Code in the simulation code?