Added examples

This commit is contained in:
Andrey Mukhin
2023-07-05 15:19:46 +03:00
parent fd708d8170
commit 71bed55454
8 changed files with 263 additions and 27 deletions

View File

@@ -4,34 +4,64 @@ This pacakge is used to generate region masks separating any focused X-ray flux
## Installation
This package is to be used with Python 3.x.x
```python
```bash
pip install git+http://heagit.cosmos.ru/nustar/nuwavdet.git
```
## Main use
To update the package to the current version one should delete the previous version
```bash
pip uninstall nuwavdet
```
To use the package in your project, import it in by writing:
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
```
The main functionality of the pacakge is presented with a single function
To verify the installation we suggest running a simple script:
```python
process(obs_path, thresh)
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
process('D:\\Data\\obs_cl.evt', (3, 2))
nw.process('D:\\Data\\obs_cl.evt', (3, 2))
```
Outputs of the function are:
1. 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 1 corresponds to masked pixel and 0 otherwise.
3. custom bad pixel table with flagged pixels in RAW coordinates. It can be exported as fits file or each separate table can be acessed directly.
4. array with the sum of wavelet planes used in the processing.
The detailed script description of the data extraction with the script is presented in the examples folder of the repository.
Metadata about the observation file:
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
@@ -47,14 +77,8 @@ Useful algorythm-related data:
## Other uses
You can process the cl.evt file by creating an Observation class object:
Other possbile usecases are shown in the examples folder.
```python
obs = nw.Observation(path_to_evt_file)
```
## Contact information
Additionally, the energy band in KeV to get events from can be passed as an argument. The default value is [3,20].
```python
obs = nuwavsource.Observation(path_to_evt_file,E_borders=[E_min,E_max])
```
If you have any questions or issues with the code, feel free to contact Andrey Mukhin: amukhin@cosmos.ru