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,
)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.
hide
PDSReader
pid = "FUV2015_225_12_13"pds = PDSReader(get_data_path(pid))pds.data.shapepds.band_rangepds.line_rangehide
UVPDS
uv = UVPDS(pid)uv.xarrayuv.calibrateduv.wavelengthsuv.piduv.integration_durationuv.file_iduv.default_wave_min, uv.default_wave_maxuv.n_bandsuv.n_integrationsuv.pds.band_range, uv.pds.line_rangeshow_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.timestringpds.euvpds.euv.wavelengthspds.fuv.wavelengthsExamples 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.xarrayarr.sum(["spatial", "samples"]).hvplot(ylim=(0, 5e5), xlim=(100, 200), title="Total counts")pid = "FUV2004_163_19_22"data = UVPDS(pid)
arr = data.xarraysummed = arr.sel(samples=15, drop=True).sum(["spatial"]) / (64 * 30)s = summed.to_pandas()import hvplot.pandaskwargs = {"ylim": (0, 0.02), "xlim": (110, 190), "width": 500}blackman = s.rolling(window=14, win_type="blackmanharris").mean().hvplot(**kwargs, label='blackmanharris')
blackmangaussian = s.rolling(window=10, win_type="gaussian").mean(std=3).hvplot(**kwargs, label="gaussian")
gaussiangaussian * blackmanpid = "FUV2005_195_19_52"data = UVPDS(pid)
arr = data.xarraydata.shapes16 = 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.