Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply functionality to apply livetime correction to science products #155

Open
hayesla opened this issue Jan 15, 2025 · 2 comments
Open

Comments

@hayesla
Copy link
Contributor

hayesla commented Jan 15, 2025

It would be nice to have a way to apply the livetime correction to CompressedPixelData and Spectrogram data products. For example, we want to correct for it before a simple plot.

It looks like this is done for the quicklook data, but would need to be implemented for science data products. I imagine its just using get_livetime_fraction ? https://github.com/TCDSolar/stixpy/blob/main/stixpy/calibration/livetime.py#L96

I guess it would also make sense for it to be in .get_data()

?

Any thoughts @samaloney ?

@hayesla hayesla changed the title Apply functionality to apply livetime correction to plot_timeseries etc. Apply functionality to apply livetime correction to science products Jan 15, 2025
@hayesla
Copy link
Contributor Author

hayesla commented Jan 15, 2025

looking at it, it seems like there needs to be some mapping to triggers to detectors?

@samaloney
Copy link
Member

samaloney commented Jan 15, 2025

Yea it's already done for the imaging but needs to be made a bit more robust and tested see here

# Map the triggers to all 32 detectors
triggers = pixel_data.data["triggers"][:, trigger_to_detector].astype(float)[...]
_, livefrac, _ = get_livetime_fraction(triggers / pixel_data.data["timedel"].to("s").reshape(-1, 1))
pixel_data.data["livefrac"] = livefrac

I'm not really happy with the get_data method but not sure what to replace it with inside maybe a NDCube now which could make things easier but need to prototype it so should hold up adding it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants