Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
a659cfd
2815 bug hi l1c goodtimes (#2818)
tmplummer Mar 9, 2026
c5ff9e6
ULTRA l1c fix exposure time calculation (#2820)
lacoak21 Mar 9, 2026
7be11cc
ULTRA update to goodtimes constants (#2825)
lacoak21 Mar 9, 2026
c48556e
Change CDF output variables to UTC string, matching algorithm documen…
maxinelasp Mar 10, 2026
3d6feab
IDEX l1b Trigger origin, level, and mode fix (#2828)
lacoak21 Mar 10, 2026
b28e48b
IDEX fix aid variable to be correct value (#2836)
lacoak21 Mar 11, 2026
a44f032
I-ALIRT - Add UKSA to list of stations for packet ingest (#2837)
laspsandoval Mar 11, 2026
6f7b405
Update GLOWS Fill Values (#2834)
sdhoyt Mar 11, 2026
698048a
ULTRA add code for ultra90 efficiencies (#2817)
lacoak21 Mar 12, 2026
f85aa17
ULTRA extended spin update variables to be ISTP compliant (#2826)
lacoak21 Mar 12, 2026
c951167
Glows time flags (#2819)
laspsandoval Mar 12, 2026
52aa402
2838-bug---hi-l2---combined-maps-filled-with-nans (#2839)
tmplummer Mar 12, 2026
121fd54
ENH: Re-organize IMAP documentation and add GitHub access roles info …
tech3371 Mar 16, 2026
0f3294d
MNT: update numpy version, fix mypy errors (#2850)
maxinelasp Mar 17, 2026
ac62cdd
GLOWS L1A Attributes: Merge updates from Marek (#2848)
maxinelasp Mar 19, 2026
88f1be9
2821 hi l1c use hi goodtimes in pset processing (#2829)
tmplummer Mar 23, 2026
b0fd87c
IDEX l1b cli logic (#2859)
lacoak21 Mar 23, 2026
8fc4fa8
2822 hi l1b goodtimes implement bad tdc cal culling algorithm (#2835)
tmplummer Mar 24, 2026
0fce0fb
Glows l2 spin angle (#2852)
maxinelasp Mar 24, 2026
408591a
Use pset midpoint in map projection at l2 (#2862)
lacoak21 Mar 24, 2026
a0a0092
2769 hi goodtimes fix esa step field in output txt file (#2863)
tmplummer Mar 24, 2026
50befbc
Lo: Update TOF3 conversion (#2864)
ahotasu Mar 24, 2026
4e1b2d2
ULTRA l1c counts nside update (#2857)
lacoak21 Mar 26, 2026
88244c9
IDEX l1a event messages (#2870)
lacoak21 Mar 27, 2026
cb6bfc4
IDEX l1b event msg product (#2876)
lacoak21 Mar 27, 2026
5468771
filter for only events we care about (#2882)
lacoak21 Mar 30, 2026
b01ad61
MNT: update github access role based on project document (#2877)
tech3371 Mar 30, 2026
48641ea
GLOWS L2 - Add ecliptic coordinates for histogram bin centers (#2871)
vmartinez-cu Mar 30, 2026
f257828
GLOWS Ancillary file rename (#2887)
maxinelasp Mar 30, 2026
b0f1dc4
GLOWS fix L1B error (#2893)
maxinelasp Mar 31, 2026
28fec45
CoDICE: Fixing attrs bugs for CAVA (#2891)
tech3371 Mar 31, 2026
561aa28
Fix GLOWS L2 - add per-bin zero handling for flux calculations (#2890)
vmartinez-cu Apr 1, 2026
cdfd0ae
A rotated NaN is still a NaN (#2901)
alastairtree Apr 1, 2026
ef88f77
Revert "A rotated NaN is still a NaN (#2901)" (#2902)
maxinelasp Apr 1, 2026
00039d0
Swap rejection and reflectron voltages in lookup table (#2872)
eayari21 Apr 1, 2026
e2b9a69
Mag L2 rotation - propogate FILLVALS (#2903)
maxinelasp Apr 2, 2026
cbff0a3
Allow customization of MAG L2 frames (#2881)
alastairtree Apr 2, 2026
36b3859
IDEX l1b handle empty event msg datasets (#2908)
lacoak21 Apr 2, 2026
a1a8f60
I-ALiRT - Hit data access (#2909)
laspsandoval Apr 2, 2026
8681161
Fix hi goodtimes CDF to txt convertor (#2888)
tmplummer Apr 3, 2026
3d5ceae
I-ALiRT - bugfix for CoDICE data structure (#2869)
laspsandoval Apr 6, 2026
d5f3d78
Glows L2 - Apply calibration (#2918)
vmartinez-cu Apr 7, 2026
c038f68
BUG: CoDICE sectored bug (#2929)
tech3371 Apr 7, 2026
8f74867
add sc status (#2922)
laspsandoval Apr 8, 2026
674f4e1
ULTRA l2 add backwards compatibility for old PSETS (#2928)
lacoak21 Apr 8, 2026
8595fda
BUG: ULTRA l2 downsample counts (#2939)
lacoak21 Apr 9, 2026
a61dbd5
ULTRA l1c theta limit check (#2941)
lacoak21 Apr 9, 2026
7d48939
ULTRA l1b upstream ion culling algorithm (#2931)
lacoak21 Apr 9, 2026
c899b14
ULTRA l1b spectral cull (#2940)
lacoak21 Apr 9, 2026
a5dec5a
2935 hi l1c backgrounds utilities (#2936)
tmplummer Apr 9, 2026
7f33698
check coverage (#2948)
laspsandoval Apr 9, 2026
2205563
ULTRA l1b priority 1,2,3,4 (#2917)
lacoak21 Apr 10, 2026
37806f0
update energy thresholds (#2999)
lacoak21 Apr 10, 2026
ea5ee40
2800 hi l1c backgrounds (#2937)
tmplummer Apr 10, 2026
924a306
CoDICE: L2 spin angle data in wrong bin (#2947)
tech3371 Apr 11, 2026
6ce6ce3
GLOWS L2 - Fix calibration bug (#2933)
vmartinez-cu Apr 13, 2026
ec8864b
Documentation for SPICE queries (#3005)
vineetbansal Apr 14, 2026
03b86fa
Lo L1C - Automatic Goodtimes (#2896)
sdhoyt Apr 15, 2026
010caaa
ULTRA l1b small bug in stat cull (#3002)
lacoak21 Apr 15, 2026
5a471b8
Fix hi l1a tests broken by upgrade to cdflib 1.3.9 (#3008)
tmplummer Apr 15, 2026
062ea48
Fix Lo L2 processing pointing set midpoint_j2000_et calculation (#3011)
pleasant-menlo Apr 15, 2026
9323eba
ULTRA priority de ancillary lookup table (#2998)
lacoak21 Apr 15, 2026
d7d593e
GLOWS L2 night flags (#2930)
laspsandoval Apr 16, 2026
53abe7c
Quicklooks doc (#2831)
anamanica Apr 17, 2026
0f461e8
Update glows_l1b_data.py, degrees=False correction (#2944)
mstrumik Apr 17, 2026
980821d
ULTRA l2 map duration descriptor (#3024)
lacoak21 Apr 20, 2026
57a7f71
NEW: Dependency config design and content
tech3371 Mar 3, 2026
a0fb2f0
doc updates from recent code changes
tech3371 Apr 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ repos:
hooks:
- id: mypy
exclude: .*(tests|docs).*
additional_dependencies: [ numpy==1.26.4 ]
additional_dependencies: [ numpy==2.3.5 ]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _code-documentation:
.. _algorithm-code-documentation:

Code Documentation
==================
Algorithm Code Documentation
============================

.. currentmodule:: imap_processing

Expand All @@ -15,7 +15,6 @@ Instruments
.. toctree::
:maxdepth: 1

cli
codice
glows
hi
Expand All @@ -26,6 +25,7 @@ Instruments
swapi
swe
ultra
quicklooks

Utilities
---------
Expand Down Expand Up @@ -62,12 +62,4 @@ variable ``IMAP_DATA_DIR``. For example to use a temporary directory

imap_cli --instrument codice --level 1 --data-dir /tmp/imap-data
# or equivalently with an environment variable
IMAP_DATA_DIR=/tmp/imap-data imap_cli --instrument codice --level 1

Tools
-----

.. toctree::
:maxdepth: 2

tools/index
IMAP_DATA_DIR=/tmp/imap-data imap_cli --instrument codice --level 1
154 changes: 154 additions & 0 deletions docs/source/algorithm-code-documentation/quicklooks.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
Quicklook Generation
===========================

This document provides a high-level overview of the workflow and usage
of the ``QuicklookGenerator`` system. It is intended to help developers
understand how quicklook plots are produced from IMAP instrument data files.

Overview
--------

Each instrument implements its own plotting logic
while sharing a common initialization, data-loading,
and dispatch workflow.

The system is built around four major components:

1. **Dataset loading** – converting a CDF file into an ``xarray.Dataset``.
2. **Instrument detection** – determining the correct quicklook
generator class.
3. **Abstract quicklook interface** – common API for all instruments.
4. **Instrument-specific subclasses** – actual plotting implementations.

Workflow
--------

1. **User supplies a CDF file path**::

quicklook = get_instrument_quicklook("path/to/file.cdf")

2. **The filename is parsed** using
``ScienceFilePath.extract_filename_components`` to extract the
``instrument`` field.

3. **The correct Quicklook subclass is selected** via the
``QuicklookGeneratorType`` enum. For example::

MAG → MagQuicklookGenerator

The pattern continues for each individual instrument.

4. **The chosen class is instantiated**, and the constructor:

- Loads the dataset using ``dataset_into_xarray``.
- Stores instrument metadata (such as the instrument name).
- Initializes plotting-related attributes.

5. **The user calls** ``two_dimensional_plot(variable="...")``.
This method is implemented by each subclass and acts as a routing
mechanism that decides *which* quicklook plot to generate.

Example for MAG::

mag_ql = MagQuicklookGenerator("imap_mag_20250101_v01.cdf")
mag_ql.two_dimensional_plot(variable="mag sensor co-ord")

6. **The requested plot function runs**, accessing data from the internal
``xarray.Dataset`` and generating figures using Matplotlib.

7. **Plots are displayed**, and the workflow ends. No data is returned—
the quicklook system produces visualizations only.

Core Components
---------------

Abstract Base Class: ``QuicklookGenerator``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``QuicklookGenerator`` abstract base class provides:

- Unified dataset loading via ``dataset_into_xarray``.
- Common metadata attributes (instrument, title, axis labels, etc.).
- Basic validation to ensure that a dataset is present.
- An abstract method ``two_dimensional_plot``, which each instrument
subclass must implement as a dispatch mechanism.

Time & Coordinate Handling
--------------------------

Instrument data often stores time in **J2000 nanoseconds**. These values
are converted to UTC timestamps using::

convert_j2000_to_utc(time_array)

This conversion internally uses:

- A fixed epoch: ``2000-01-01 11:58:55.816``
- NumPy ``timedelta64`` arithmetic
- Output as ``datetime64[ns]`` UTC timestamps

This routine is used across all instruments providing an ``epoch`` field.

Instrument Dispatch Logic
-------------------------

Users should begin quicklook generation by calling::

quicklook = get_instrument_quicklook(filename)

This function:

1. Extracts the instrument identifier from the filename.
2. Uses ``QuicklookGeneratorType`` to map the instrument to a class.
3. Returns an instantiated quicklook object.

Example::

>>> ql = get_instrument_quicklook("imap_swapi_20250101_v02.cdf")
>>> ql.two_dimensional_plot("count rates")

Adding Support for New Instruments
----------------------------------

To extend the quicklook system:

1. Create a new subclass::

class NewInstQuicklookGenerator(QuicklookGenerator):
...

2. Implement ``two_dimensional_plot`` as a dispatch method.
3. Add plot functions as needed.
4. Register the class in the ``QuicklookGeneratorType`` enum.
5. Ensure that ``ScienceFilePath.extract_filename_components`` correctly
identifies the instrument.

Instrument Team Support
-----------------------

To implement a new instrument-specific quicklook, instrument teams must
provide a minimal set of information that defines what plots are
required and how the underlying data should be interpreted.

Required Information
~~~~~~~~~~~~~~~~~~~~

1. **List of quicklook plots**
- A high-level description of each plot to be generated.
- Whether each plot is 1-D (line), 2-D (spectrogram), or multi-panel.

2. **Variables required for each plot**
- CDF variable names.
- Which CDF files contain the required variables.

3. **Time-axis requirements (if applicable)**
- Desired time range (full file, event-based selection, rolling window).

4. **Plot formatting preferences**
- Preferred units or scaling (linear, log).
- Desired titles, axis labels, and annotations.

5. **Special processing rules**
- Required calibrations or unit conversions.
- Masking rules for invalid ranges or quality flags.
- Any filtering or smoothing applied before plotting.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The internal format of CDF files are described in the `cdf specification <https:
Variables
---------

.. image:: ../../_static/cdf_variables.png
.. image:: ../_static/cdf_variables.png


Variables are the data stored within a file. They have a few key characteristics -
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CDFs
====
CDF Metadata
============

These pages describe CDF files, tools for using CDF files, and SPDF requirements for archiving.

Expand Down
8 changes: 0 additions & 8 deletions docs/source/code-documentation/cli.rst

This file was deleted.

5 changes: 4 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

intersphinx_mapping = {
"numpy": ("https://numpy.org/doc/stable/", None),
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
"pandas": ("https://pandas.pydata.org/docs/", None),
"pytest": ("https://pytest.org/en/stable/", None),
"python": ("https://docs.python.org/3/", None),
"xarray": ("https://docs.xarray.dev/en/stable/", None),
Expand All @@ -106,6 +106,7 @@
(r"py:.*", r".*space_packet_parser.*"),
(r"py:.*", r".*CoDICECompression.*"),
(r"py:.*", r".*SegmentedPacketOrder.*"),
(r"py:.*", r".*codice.utils.*"),
(r"py:.*", r".*RectangularSkyMap.*"),
(r"py:.*", r".*AbstractSkyMap.*"),
(r"py:.*", r".*MapDescriptor.*"),
Expand All @@ -122,6 +123,8 @@
(r"py:.*", r".*np.ndarray.*"),
(r"py:.*", r".*numpy._typing._array_like._ScalarType_co.*"),
(r"py:.*", r".*idex.l1a.TRIGGER_DESCRIPTION.*"),
(r"py:.*", r".*idex.l1b.TriggerOrigin.*"),
(r"py:.*", r".*idex.l1b.EventMessage.*"),
(r"py:.*", r".*idex.l2a.BaselineNoiseTime.*"),
(r"py:.*", r".*PacketProperties"),
(r"py:.*", r".*.spice.geometry.SpiceBody.*"),
Expand Down
Loading
Loading