Ejemplo n.º 1
0
    def plot(self, time_range, ax=None, **kwargs):
        """
        Plot Temporal Model.

        Parameters
        ----------
        time_range : `~astropy.time.Time`
            times to plot the model
        ax : `~matplotlib.axes.Axes`, optional
            Axis to plot on
        **kwargs : dict
            Keywords forwarded to `~matplotlib.pyplot.errorbar`

        Returns
        -------
        ax : `~matplotlib.axes.Axes`, optional
            axis
        """
        time_min, time_max = time_range
        time_axis = TimeMapAxis.from_time_bounds(time_min=time_min,
                                                 time_max=time_max,
                                                 nbin=100)
        time_axis.time_format = "mjd"

        m = RegionNDMap.create(region=None, axes=[time_axis])
        kwargs.setdefault("marker", "None")
        kwargs.setdefault("ls", "-")
        kwargs.setdefault("xerr", None)
        m.quantity = self(time_axis.time_mid)
        ax = m.plot(ax=ax, **kwargs)
        ax.set_ylabel("Norm / A.U.")
        return ax
Ejemplo n.º 2
0
def test_time_map_axis_from_time_bounds():
    t_min = Time("2006-02-12", scale="utc")
    t_max = t_min + 12 * u.h

    axis = TimeMapAxis.from_time_bounds(time_min=t_min, time_max=t_max, nbin=3)
    assert_allclose(axis.center, [0.083333, 0.25, 0.416667] * u.d, rtol=1e-5)