# nuwavdet This pacakge is used to generate region masks separating any focused X-ray flux from background signal in NuSTAR observations. ## Installation This package is to be used with Python 3.x.x ```bash pip install git+http://heagit.cosmos.ru/nustar/nuwavdet.git ``` To update the package to the current version one should delete the previous version ```bash pip uninstall nuwavdet ``` And simply repeat the intallation procedure again from the repository. ## Installation verification If the installation was successful the package can be used with the following import: ```python from nuwavdet import nuwavdet as nw ``` To verify the installation we suggest running a simple script: ```python from nuwavdet import nuwavdet as nw print(nw.binary_array(2)) ``` The output of the script should be ```bash [[False False] [False True] [ True False] [ True True]] ``` ## Main use The main functionality of the package is presented with a single function ```python nw.process(obs_path, thresh) ``` Inputs are string with path to the _cl.evt file to use and a tuple of thresholds, e.g. ```python nw.process('D:\\Data\\obs_cl.evt', (3, 2)) ``` The detailed script description of the data extraction with the script is presented in the examples folder of the repository. The function nw.process returns severl python objects: 1. python-dictionary with some metadata and properties of the observation after mask generation procedure. 2. region array with mask in DET1 coordinate frame. Note that this mask is for numpy mask application so True (1) corresponds to masked pixel and False (0) otherwise. 3. custom bad pixel table with flagged pixels in RAW coordinates. It can be exported as fits file for further application to the nupipeline as fpma_userbpfile or fpmb_userbpfile. 4. array with the sum of wavelet planes for potential alternative applications. Metadata about the observation returned by the nw.process is: Observation metadata: 1. OBS_ID 2. Detector 3. Coordinates in equatorial (ra,dec) and galactical (lon,lat) systems 4. Time of the observation in seconds 5. Exposure Useful algorythm-related data: 6. Average count rate of unmasked area 7. Fraction of unmasked area 8. Modified Cash-statistic per bin before and after masking the detected sources ## Other uses Other possbile usecases are shown in the examples folder. ## Contact information If you have any questions or issues with the code, feel free to contact Andrey Mukhin: amukhin@cosmos.ru