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

Support plotting absolute times #15

Open
ddobie opened this issue Oct 9, 2024 · 1 comment
Open

Support plotting absolute times #15

ddobie opened this issue Oct 9, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@ddobie
Copy link

ddobie commented Oct 9, 2024

We're now starting to build proper timing solutions for ULPs, which means measuring pulse ToAs. This package is commonly used for doing this sort of work, but right now only supports plotting lightcurves/dynamic spectra with time relative to the observation start. This is quite annoying, because it means having to go back and figure out the observation start time.

It would be preferable to have a switch that allows users to plot absolute times (e.g. either MJD or ISOT).

I've started working on a PR that would do this, but it relies on astropy's time_support (https://docs.astropy.org/en/stable/visualization/matplotlib_integration.html#plotting-times). Unfortunately, as far as I can tell, this breaks when trying to use plt.imshow() and plt.errorbar(). I've raised an issue for that: astropy/astropy#17152

@ddobie ddobie added the enhancement New feature or request label Oct 9, 2024
@ddobie ddobie self-assigned this Oct 9, 2024
@ddobie
Copy link
Author

ddobie commented Nov 20, 2024

@joshoewahp here is the code snippet I was playing with:

from matplotlib import pyplot as plt
from astropy.time import Time
from astropy.visualization import time_support

time_support()

plt.figure(figsize=(5,3))
plt.plot(Time([58000, 59000, 62000], format='mjd'), [1.2, 3.3, 2.3])


plt.figure(figsize=(5,3))
plt.errorbar(Time([58000, 59000, 62000], format='mjd'), [1.2, 3.3, 2.3])

data = [[1.2, 3.3, 2.3],[2.2, 4.3, 1.3],[2.4, 0.3, 3.3]]
times = Time([58000, 59000, 62000], format='mjd')

plt.figure(figsize=(5,3))
im = plt.imshow(
    data,
    extent=[times[0], times[-1], 0, 1],
    aspect="auto",
    origin="lower",
)

plt.show()

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

No branches or pull requests

1 participant