zkbt / chromatic

Tools for visualizing spectrosopic light curves, with flux as a function of wavelength and time.
MIT License
14 stars 4 forks source link

Plot a histogram of the flux value for one wavelength of a Rainbow`. #115

Closed zkbt closed 2 years ago

zkbt commented 2 years ago

We should add a visualization function that plots a histogram of flux values for one wavelength row of a Rainbow dataset. It should produce a plot with the following features:

  1. Its calling sequence should look like s = SimulatedRainbow(); s.plot_histogram(i) where i refers to which wavelength row we want to plot. It should have flux bin values on the x-axis and the number of occurrences (= histogram) of flux values within a particular bin on the y-axis. We should use plt.hist with density=True, so that the distributions are normalized to integrate to one.
  2. By default it should allow plt.hist to choose its own bin settings (number of bins, locations of bins, width of bins), but it should also be possible to provide keyword arguments specifying each of these explicitly.
  3. The color of the histogram plot could be set by rainbow.get_wavelength_color() so that it would automatically match the other colors where each wavelength appears (for example, in .plot).
  4. There should be a keyword option, possibly called expected=True that would allow the user to specify whether or not to overplot the theoretical normal distribution provided by the uncertainty (= $\sigma$) flux-like array (and maybe the model one if provided)?
zkbt commented 2 years ago

(Let's focus on one wavelength at a time, but eventually this could get looped into a thing that would plot all the wavelengths together somehow!)

zkbt commented 2 years ago

@mone0982 , I think step (1) above is very closely related to code you already have, so whenever you get a chance to work on this, I'd start there first! The other bits get kind of more complicated in various different ways, which we can talk about when we get there.

mone0982 commented 2 years ago

Hi @zkbt, I just pushed what I have so far for the plot_histogram function to add_histogram_plots...it's working with what I have, but I have a couple questions:

What do you mean by 'bin location'? I haven't been able to find documentation about bin location with respect to plot.hist.

I am having trouble using the rainbow.get_wavelength_color() thing you suggested to make the histogram's color correspond to the wavelength of what is being plotted. I have tried "rainbow.get_wavelength_color(i)" with 'i' being the row/wavelength I am plotting but am getting an error with that. It's likely that I just don't really understand how the get_wavelength_color thing works.

Let me know your thoughts/suggestions, or we can just talk about this when we meet next! Thanks!