Skip to content

cumulative number of observations plots #239

Description

@jrob93

Minor issue but I've noticed that some diagnostic plots showing the cumulative number of observations for a given object are slightly off. Affected notebooks are:

  • notebooks/adler_demo.ipynb
  • notebooks/notebooks/adler_demo/adler_demo.ipynb
  • notebooks/notebooks/adler_demo/adler_demo_dp1.ipynb
  • notebooks/notebooks/adler_demo/adler_demo_mpc_obs_sbn.ipynb

The fixed plotting code should be something like:

# cumulative data in filter
x_plot = "midPointMjdTai"
df_plot = df_obs.sort_values(x_plot)

fig = plt.figure()
gs = gridspec.GridSpec(1, 1)
ax1 = plt.subplot(gs[0, 0])

bins = np.arange(tmin-1, tmax + 1)

values, base = np.histogram(df_plot[x_plot], bins=bins)
cumulative = np.cumsum(values)
ax1.plot(base[:-1] - base[1], cumulative, label="filter={}".format(filt))

data_mask = np.diff(cumulative) > 0
data_nights = base[1:-1][data_mask]
N_data = cumulative[1:][data_mask]

ax1.scatter(data_nights - base[1], N_data, label = "nights with\nnew data")

ax1.set_xlabel("nights since first observation")
ax1.set_ylabel("number")
ax1.legend()

plt.show()

and look like:
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions