Reading UVIS data

IO

Tools related to input/output

⚠️ Demo cells below are marked #| eval: false — they require live PDS index fetches, cached data products, or interactive plotting backends that are unavailable during a clean docs render. Open this notebook in JupyterLab to step through it cell-by-cell against your local data.

import datetime as dt
from pathlib import Path

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import xarray as xr
from astropy import units as u

import hvplot.pandas  # noqa: F401
import hvplot.xarray  # noqa: F401
import holoviews as hv

from pyuvis import (
    PDSReader,
    UVPDS,
    UVISObs,
    HSP,
    FUV_CDF,
    EUV_CDF,
    sens_df,
)

hide

PDSReader

pid = "FUV2015_225_12_13"
pds = PDSReader(get_data_path(pid))
pds.data.shape
pds.band_range
pds.line_range

hide

UVPDS

uv = UVPDS(pid)
uv.xarray
uv.calibrated
uv.wavelengths
uv.pid
uv.integration_duration
uv.file_id
uv.default_wave_min, uv.default_wave_max
uv.n_bands
uv.n_integrations
uv.pds.band_range, uv.pds.line_range
show_doc(UVPDS.plot)
uv.plot()
uv.plot(precise=True)
(uv.plot().opts(axiswise=False) + uv.plot(precise=True)).cols(1)
uv.plot(calibrated=True)

pds = UVISObs(“FUV2005_172_03_35”)

pds.timestring
pds.euv
pds.euv.wavelengths
pds.fuv.wavelengths

Examples from the UVIS User’s guide

Get the current user guide PDF by using get_user_guide()

get_user_guide()
pid = "FUV2005_172_03_35"
data = UVPDS(pid)
arr = data.xarray
arr.sum(["spatial", "samples"]).hvplot(ylim=(0, 5e5), xlim=(100, 200), title="Total counts")
pid = "FUV2004_163_19_22"
data = UVPDS(pid)
arr = data.xarray
summed = arr.sel(samples=15, drop=True).sum(["spatial"]) / (64 * 30)
s = summed.to_pandas()
import hvplot.pandas
kwargs = {"ylim": (0, 0.02), "xlim": (110, 190), "width": 500}
blackman = s.rolling(window=14, win_type="blackmanharris").mean().hvplot(**kwargs, label='blackmanharris')
blackman
gaussian = s.rolling(window=10, win_type="gaussian").mean(std=3).hvplot(**kwargs, label="gaussian")
gaussian
gaussian * blackman
pid = "FUV2005_195_19_52"
data = UVPDS(pid)
arr = data.xarray
data.shape
s16 = arr.sel(samples=16).sum("spatial")
s32 = arr.sel(samples=32).sum("spatial")
ratio = s32 / s16
(
    s16.hvplot(ylim=(0, 400), title="Sample #16")
    + s32.hvplot(ylim=(0, 400), title="Sample #32")
    + ratio.hvplot(title="Ratio", shared_axes=False)
).cols(1)
arr.sum(["spatial", "samples"]).hvplot()
pid = "EUV2002_198_03_26_54_UVIS_C33ST_SPICARAST002_PRIME"
pid = "FUV2005_195_19_52"

NetCDF readers

The NetCDF readers can be used for the UVIS team internally distributed netCDF files.