Metadata-Version: 2.4
Name: majis-ql-icu
Version: 1.0.0
Summary: Majis Internal Calibration Unit Quick Look
Author: Paolo Haffoud
Author-email: Benoît Seignovert <benoit.seignovert@univ-nantes.fr>, Timothé Berland <timothe.berland@etu.emse.fr>
Maintainer-email: Benoît Seignovert <benoit.seignovert@univ-nantes.fr>
License-Expression: BSD-3-Clause
Project-URL: Documentation, https://majis_sgs.io.ias.u-psud.fr/quick-look/majis-ql-icu/
Project-URL: Repository, https://git.ias.u-psud.fr/majis_sgs/quick-look/majis-ql-icu/
Keywords: esa,juice,majis,quick-look,icu
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Natural Language :: English
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Astronomy
Requires-Python: >=3.14
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: numpy>=2
Requires-Dist: matplotlib>=3.10
Requires-Dist: scipy>=1.18.0
Requires-Dist: python-dotenv>1.2
Requires-Dist: majis-pds4-products-reader>=1.1.1
Requires-Dist: majis-common-logging>=2.0.0
Requires-Dist: majis_instrument_utils>=2.2.0
Dynamic: license-file

💡 MAJIS QL - Internal Calibration Unit
=======================================

[![Quality Gate Status](https://quality.forge.ias.u-psud.fr/api/project_badges/measure?project=majis_sgs_quick-look_majis-ql-icu_46a5cff9-652d-4986-a38c-e59da192f1b0&metric=alert_status&token=sqb_f5ad5ced10313d4f2ac4c6dc483f541a64a6ac14)](https://quality.forge.ias.u-psud.fr/dashboard?id=majis_sgs_quick-look_majis-ql-icu_46a5cff9-652d-4986-a38c-e59da192f1b0)

Documentation: https://majis_sgs.io.ias.u-psud.fr/quick-look/majis-ql-icu

This package contains a collection of [notebooks](docs/notebooks/) to analysis
Majis Internal Calibration Unit (ICU) observations performed during
the different mission payload checkouts (PC) to check the behavior
of the instrument and its stability over time.

These analyses consist of 7 different types:
- 🖼️ [background](docs/notebooks/backgrounds.ipynb) checks with the shutter open and the lamp and blackbody OFF
- 👻 [darks](docs/notebooks/darks.ipynb) checks with the shutter close and the lamp and blackbody OFF
- 🔦 [lamp observations](docs/notebooks/lamp.ipynb) with the QHT lamp ON
- 💡 [blackbody observations](docs/notebooks/lamp.ipynb) with the IR emitter ON
- 🗿 [slit profile](docs/notebooks/slit_profile.ipynb) and [edges](docs/notebooks/slit_edges.ipynb) analysis from the lamp and blackbody observations
- 🌈 [straylight profile](docs/notebooks/straylight_profile.ipynb) and [spectra](docs/notebooks/straylight_spectrum.ipynb) analysis with the shutter close and the lamp/blackbody ON.
- 🦠 [contamination](docs/notebooks/contamination.ipynb) checks in the 3 µm IR range
- 🪃 [read-reset](docs/notebooks/read_reset.ipynb) behavior checks on the saturated observations

The full collection of the observations types though the different PC can
be found [here](docs/notebooks/obs_list.ipynb).


Installation
------------
This package is not (yet) available on PyPI, it have to be pull from IAS nexus registry:

If you use `uv` you can add it to your `pyproject.toml` like this:
```toml
dependencies = [
    "majis-ql-icu>=1.0.0",
]

[tool.uv.sources]
majis-ql-icu = { index = "ias" }

[[tool.uv.index]]
name = "ias"
url = "https://repositories.forge.ias.u-psud.fr/repository/pipy-ias/simple"
explicit = true
```

CLI usage
---------
```bash
uv run icu --help
```
```text
ICU command line interface

positional arguments:
  PC*_ICU_*             ICU name(s), eg. `PC1_N_ICU_HOT`. Multiple values can be provided. If no value is provided all the data containing the following pattern `PC*_ICU_*` will be considered.

options:
  -h, --help            show this help message and exit
  -d, --data folder     Majis data root folder. It can be defined globally with `DATA_MAJIS_ICU` env variable. Default without `DATA_MAJIS_ICU` is the current working directory.
  -e, --exclude [PC*_ICU_* ...]
                        Exclude some ICU present in the Majis data root folder if no explicit ICU is provided. Default: []
  -o, --output folder   Custom output folder. Default: `output/`. If the folder does not exists, it will be created.
  --only background|dark|lamp|blackbody|lamp-vs-blackbody|slit|straylight|contamination|read-reset [background|dark|lamp|blackbody|lamp-vs-blackbody|slit|straylight|contamination|read-reset ...]
                        Run only a subsetDefault: []
```

Example of usage:
```bash
uv run icu --data /data/majis/
```
```text
⚙️ ICU setup:
- Data folder: data/icu
- Output folder: output
- Analysis list: background, dark, lamp, blackbody, lamp-vs-blackbody, slit, straylight, contamination, read-reset
📋 List of ICU available (N):
- PC1_N_ICU_HOT
- ...
🖼️ Generating background spectra:
- ...          ✅
👻 Generating dark spectra:
- ...          ✅
🔦 Generating lamp images:
- ...          ✅
🔦 Generating lamp spectra:
- ...          ✅
💡 Generating blackbody images:
- ...          ✅
💡 Generating blackbody spectra:
- ...          ✅
🔍 Generating lamp vs. blackbody spectra comparisons:
- ...          ✅
🗿 Generating slit profile comparisons:
- ...          ✅
🔪 Generating slit edges comparisons:
- ...          ✅
📸 Generating straylight images:
- ...          ✅
👽 Generating straylight spatial profiles:
- ...          ✅
🌈 Generating straylight spectra:
- ...          ✅
🦠 Generating contamination map and spectrum:
- ...          ✅
🦠 Generating contamination all spectra ✅
🪃 Generating read-reset images:
- ...          ✅
🪃 Generating read-reset spectra comparisons:
- ...          ✅
```


Local development
-----------------
This project is maintained with [`uv`](https://docs.astral.sh/uv/) package manager.
You need to install it first to perform any local development.

Clone this repo
```bash
git clone -b dev-ql-icu https://git.ias.u-psud.fr/majis_sgs/quick-look/majis-ql-icu
cd majis-ql-icu
```

Install the package and its the required dependencies:
```bash
uv sync
```

Run the linter
```bash
uv run ruff format
uv run ruff check
```

Run unit tests (not much at the moment):
```bash
uv run pytest
```

Run all the notebooks used in the docs:
```bash
uv run pytest --nbval-lax docs/notebooks/ --no-cov
```

To build the documentation html:
```bash
uv run jupyter-book build docs/
```
