Dataset API

class acispy.dataset.Dataset(msids, states, model)[source]
add_averaged_field(field, n=10)[source]

Add a new field from an average of another.

Parameters
  • field (string or (type, name) tuple) – The field to be averaged.

  • n (integer, optional) – The number of samples to average over. Default: 5

Examples

>>> ds.add_averaged_field(("msids", "1dpicacu"), n=10)
add_derived_field(ftype, fname, function, units, display_name=None, depends=None)[source]

Add a new derived field.

Parameters
  • ftype (string) – The type of the field to add.

  • fname (string) – The name of the field to add.

  • function (function) – The function which computes the field.

  • units (string) – The units of the field.

  • times (array or tuple) – The timing data for the field in seconds from the beginning of the mission. Can supply an array of times or a field specification. If the latter, then the times for this field will be used.

  • display_name (string, optional) – The name to use when displaying the field in plots.

Examples

>>> def _dpaa_power(ds):
...     return (ds["msids", "1dp28avo"]*ds["msids", "1dpicacu"]).to("W")
>>> ds.add_derived_field("msids", "dpa_a_power", _dpaa_power,
...                      "W", display_name="DPA-A Power")
add_diff_data_model_field(msid, ftype_model='model')[source]

Create a field which gives the difference between the data and the model for a particular MSID.

Parameters
  • msid (string) – The MSID to take the diff of data and model of.

  • ftype_model (string, optional) – The model type (e.g., “model”, “model0”, etc.) of the model field to be diffed with the MSID.

dates(*args)[source]

Return the timing information in date and time for a field.

Examples

>>> ds.dates("states", "pitch")
map_state_to_msid(state, msid, ftype='msids')[source]

Create a new derived field by interpolating a state to the times of a MSID or model component.

Parameters
  • state (string) – The state to be interpolated.

  • msid (string) – The msid or model component to interpolate the state to.

  • ftype (string, optional) – The field type to use. “msids” or “model”. Default: “msids”

Examples

>>> ds.map_state_to_msid("ccd_count", "1dpamzt")
plot(fields, field2=None, lw=2, ls='-', ls2='-', lw2=2, fontsize=18, color=None, color2='magenta', figsize=10, 8, plot=None, fig=None, subplot=None, plot_bad=False)[source]

Make a single-panel plot of a quantity (or multiple quantities) vs. date and time from this Dataset.

Multiple quantities can be plotted on the left y-axis together if they have the same units, otherwise a quantity with different units can be plotted on the right y-axis.

Parameters
  • fields (tuple of strings or list of tuples of strings) – A single field or list of fields to plot on the left y-axis.

  • field2 (tuple of strings, optional) – A single field to plot on the right y-axis. Default: None

  • lw (float or list of floats, optional) – The width of the lines in the plots. If a list, the length of a the list must be equal to the number of fields. If a single number, it will apply to all plots. Default: 2 px.

  • ls (string, optional) – The line style of the lines plotted on the left y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • ls2 (string, optional) – The line style of the line plotted on the right y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • lw2 (float, optional) – The width of the line plotted on the right y-axis.

  • fontsize (integer, optional) – The font size for the labels in the plot. Default: 18 pt.

  • color (list of strings, optional) – The colors for the lines plotted on the left y-axis. Can be a single color or more than one in a list. Default: Use the default Matplotlib order of colors.

  • color2 (string, optional) – The color for the line plotted on the right y-axis. Default: “magenta”

  • fig (Figure, optional) – A Figure instance to plot in. Default: None, one will be created if not provided.

  • figsize (tuple of integers, optional) – The size of the plot in (width, height) in inches. Default: (10, 8)

  • plot (DatePlot or CustomDatePlot, optional) – An existing DatePlot to add this plot to. Default: None, one will be created if not provided.

  • plot_bad (boolean, optional) – If True, “bad” values will be plotted but the ranges of bad values will be marked with translucent blue rectangles. If False, bad values will be removed from the plot. Default: False

times(*args)[source]

Return the timing information in seconds from the beginning of the mission for a field.

Examples

>>> ds.times("msids", "1deamzt")
write_msids(filename, fields, mask=None, overwrite=False)[source]

Write MSIDs (or MSID-like quantities such as model values) to an ASCII table file. This assumes that all of the quantities have been interpolated to a common set of times.

Parameters
  • filename (string) – The filename to write the quantities to.

  • fields (list of (type, name) field specifications) – The quantities to be written to the ASCII table.

  • overwrite (boolean, optional) – If True, an existing file with the same name will be overwritten.

write_states(filename, overwrite=False)[source]

Write commanded states to an ASCII table file. An error will be thrown if there are no commanded states present.

Parameters
  • filename (string) – The filename to write the states to.

  • overwrite (boolean, optional) – If True, an existing file with the same name will be overwritten.

class acispy.dataset.EngArchiveData(tstart, tstop, msids, get_states=True, filter_bad=False, stat='5min', state_keys=None, interpolate=None, interpolate_times=None)[source]

Fetch MSIDs from the engineering archive and states from the commanded states database.

Parameters
  • tstart (string) – The start time in YYYY:DOY:HH:MM:SS format

  • tstop (string) – The stop time in YYYY:DOY:HH:MM:SS format

  • msids (list of strings, optional) – List of MSIDs to pull from the engineering archive.

  • get_states (boolean, optional) – Whether or not to retrieve commanded states from kadi. Default: True

  • filter_bad (boolean, optional) – Whether or not to filter out bad values of MSIDs. Default: False.

  • stat (string, optional) – return 5-minute or daily statistics (‘5min’ or ‘daily’), or None for raw data. Default: ‘5min’

  • state_keys (list of strings, optional) – The states to pull from kadi. If not specified, a default set will be pulled.

  • interpolate (string, optional) – Whether or not to interpolate to a common set of times, either “nearest” or “linear” interpolation. If the interpolate_times argument is not set, then the default is to interpolate at 328 second intervals. Default: None, indicating no interpolation.

  • interpolate_times (array_like of times, optional) – An array-like object of times to interpolate the MSID data to. Default: None, which means that if interpolate is not None the MSIDs will be interpolated at 328 second intervals.

Examples

>>> from acispy import EngArchiveData
>>> tstart = "2016:091:12:05:00.100"
>>> tstop = "2016:100:13:07:45.234"
>>> msids = ["1deamzt", "1pin1at"]
>>> ds = EngArchiveData(tstart, tstop, msids)
add_averaged_field(field, n=10)

Add a new field from an average of another.

Parameters
  • field (string or (type, name) tuple) – The field to be averaged.

  • n (integer, optional) – The number of samples to average over. Default: 5

Examples

>>> ds.add_averaged_field(("msids", "1dpicacu"), n=10)
add_derived_field(ftype, fname, function, units, display_name=None, depends=None)

Add a new derived field.

Parameters
  • ftype (string) – The type of the field to add.

  • fname (string) – The name of the field to add.

  • function (function) – The function which computes the field.

  • units (string) – The units of the field.

  • times (array or tuple) – The timing data for the field in seconds from the beginning of the mission. Can supply an array of times or a field specification. If the latter, then the times for this field will be used.

  • display_name (string, optional) – The name to use when displaying the field in plots.

Examples

>>> def _dpaa_power(ds):
...     return (ds["msids", "1dp28avo"]*ds["msids", "1dpicacu"]).to("W")
>>> ds.add_derived_field("msids", "dpa_a_power", _dpaa_power,
...                      "W", display_name="DPA-A Power")
add_diff_data_model_field(msid, ftype_model='model')

Create a field which gives the difference between the data and the model for a particular MSID.

Parameters
  • msid (string) – The MSID to take the diff of data and model of.

  • ftype_model (string, optional) – The model type (e.g., “model”, “model0”, etc.) of the model field to be diffed with the MSID.

dates(*args)

Return the timing information in date and time for a field.

Examples

>>> ds.dates("states", "pitch")
map_state_to_msid(state, msid, ftype='msids')

Create a new derived field by interpolating a state to the times of a MSID or model component.

Parameters
  • state (string) – The state to be interpolated.

  • msid (string) – The msid or model component to interpolate the state to.

  • ftype (string, optional) – The field type to use. “msids” or “model”. Default: “msids”

Examples

>>> ds.map_state_to_msid("ccd_count", "1dpamzt")
plot(fields, field2=None, lw=2, ls='-', ls2='-', lw2=2, fontsize=18, color=None, color2='magenta', figsize=10, 8, plot=None, fig=None, subplot=None, plot_bad=False)

Make a single-panel plot of a quantity (or multiple quantities) vs. date and time from this Dataset.

Multiple quantities can be plotted on the left y-axis together if they have the same units, otherwise a quantity with different units can be plotted on the right y-axis.

Parameters
  • fields (tuple of strings or list of tuples of strings) – A single field or list of fields to plot on the left y-axis.

  • field2 (tuple of strings, optional) – A single field to plot on the right y-axis. Default: None

  • lw (float or list of floats, optional) – The width of the lines in the plots. If a list, the length of a the list must be equal to the number of fields. If a single number, it will apply to all plots. Default: 2 px.

  • ls (string, optional) – The line style of the lines plotted on the left y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • ls2 (string, optional) – The line style of the line plotted on the right y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • lw2 (float, optional) – The width of the line plotted on the right y-axis.

  • fontsize (integer, optional) – The font size for the labels in the plot. Default: 18 pt.

  • color (list of strings, optional) – The colors for the lines plotted on the left y-axis. Can be a single color or more than one in a list. Default: Use the default Matplotlib order of colors.

  • color2 (string, optional) – The color for the line plotted on the right y-axis. Default: “magenta”

  • fig (Figure, optional) – A Figure instance to plot in. Default: None, one will be created if not provided.

  • figsize (tuple of integers, optional) – The size of the plot in (width, height) in inches. Default: (10, 8)

  • plot (DatePlot or CustomDatePlot, optional) – An existing DatePlot to add this plot to. Default: None, one will be created if not provided.

  • plot_bad (boolean, optional) – If True, “bad” values will be plotted but the ranges of bad values will be marked with translucent blue rectangles. If False, bad values will be removed from the plot. Default: False

times(*args)

Return the timing information in seconds from the beginning of the mission for a field.

Examples

>>> ds.times("msids", "1deamzt")
write_msids(filename, fields, mask=None, overwrite=False)

Write MSIDs (or MSID-like quantities such as model values) to an ASCII table file. This assumes that all of the quantities have been interpolated to a common set of times.

Parameters
  • filename (string) – The filename to write the quantities to.

  • fields (list of (type, name) field specifications) – The quantities to be written to the ASCII table.

  • overwrite (boolean, optional) – If True, an existing file with the same name will be overwritten.

write_states(filename, overwrite=False)

Write commanded states to an ASCII table file. An error will be thrown if there are no commanded states present.

Parameters
  • filename (string) – The filename to write the states to.

  • overwrite (boolean, optional) – If True, an existing file with the same name will be overwritten.

class acispy.dataset.TracelogData(filenames, tbegin=None, tend=None, other_msids=None, get_states=True, state_keys=None)[source]

Fetch MSIDs from a tracelog file and states from the commanded states database.

Parameters
  • filenames (string or list of strings) – The path to the tracelog file or list of tracelog files

  • tbegin (string) – The start time in YYYY:DOY:HH:MM:SS format. Default: None, which will read from the beginning of the tracelog.

  • tend (string) – The stop time in YYYY:DOY:HH:MM:SS format. Default: None, which will read from the beginning of the tracelog.

  • get_states (boolean, optional) – Whether or not to retrieve commanded states from kadi. Default: True

  • state_keys (list of strings, optional) – The states to pull from kadi. If not specified, a default set will be pulled.

Examples

>>> from acispy import TracelogData
>>> ds = TracelogData("acisENG10d_00985114479.70.tl")
add_averaged_field(field, n=10)

Add a new field from an average of another.

Parameters
  • field (string or (type, name) tuple) – The field to be averaged.

  • n (integer, optional) – The number of samples to average over. Default: 5

Examples

>>> ds.add_averaged_field(("msids", "1dpicacu"), n=10)
add_derived_field(ftype, fname, function, units, display_name=None, depends=None)

Add a new derived field.

Parameters
  • ftype (string) – The type of the field to add.

  • fname (string) – The name of the field to add.

  • function (function) – The function which computes the field.

  • units (string) – The units of the field.

  • times (array or tuple) – The timing data for the field in seconds from the beginning of the mission. Can supply an array of times or a field specification. If the latter, then the times for this field will be used.

  • display_name (string, optional) – The name to use when displaying the field in plots.

Examples

>>> def _dpaa_power(ds):
...     return (ds["msids", "1dp28avo"]*ds["msids", "1dpicacu"]).to("W")
>>> ds.add_derived_field("msids", "dpa_a_power", _dpaa_power,
...                      "W", display_name="DPA-A Power")
add_diff_data_model_field(msid, ftype_model='model')

Create a field which gives the difference between the data and the model for a particular MSID.

Parameters
  • msid (string) – The MSID to take the diff of data and model of.

  • ftype_model (string, optional) – The model type (e.g., “model”, “model0”, etc.) of the model field to be diffed with the MSID.

dates(*args)

Return the timing information in date and time for a field.

Examples

>>> ds.dates("states", "pitch")
map_state_to_msid(state, msid, ftype='msids')

Create a new derived field by interpolating a state to the times of a MSID or model component.

Parameters
  • state (string) – The state to be interpolated.

  • msid (string) – The msid or model component to interpolate the state to.

  • ftype (string, optional) – The field type to use. “msids” or “model”. Default: “msids”

Examples

>>> ds.map_state_to_msid("ccd_count", "1dpamzt")
plot(fields, field2=None, lw=2, ls='-', ls2='-', lw2=2, fontsize=18, color=None, color2='magenta', figsize=10, 8, plot=None, fig=None, subplot=None, plot_bad=False)

Make a single-panel plot of a quantity (or multiple quantities) vs. date and time from this Dataset.

Multiple quantities can be plotted on the left y-axis together if they have the same units, otherwise a quantity with different units can be plotted on the right y-axis.

Parameters
  • fields (tuple of strings or list of tuples of strings) – A single field or list of fields to plot on the left y-axis.

  • field2 (tuple of strings, optional) – A single field to plot on the right y-axis. Default: None

  • lw (float or list of floats, optional) – The width of the lines in the plots. If a list, the length of a the list must be equal to the number of fields. If a single number, it will apply to all plots. Default: 2 px.

  • ls (string, optional) – The line style of the lines plotted on the left y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • ls2 (string, optional) – The line style of the line plotted on the right y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • lw2 (float, optional) – The width of the line plotted on the right y-axis.

  • fontsize (integer, optional) – The font size for the labels in the plot. Default: 18 pt.

  • color (list of strings, optional) – The colors for the lines plotted on the left y-axis. Can be a single color or more than one in a list. Default: Use the default Matplotlib order of colors.

  • color2 (string, optional) – The color for the line plotted on the right y-axis. Default: “magenta”

  • fig (Figure, optional) – A Figure instance to plot in. Default: None, one will be created if not provided.

  • figsize (tuple of integers, optional) – The size of the plot in (width, height) in inches. Default: (10, 8)

  • plot (DatePlot or CustomDatePlot, optional) – An existing DatePlot to add this plot to. Default: None, one will be created if not provided.

  • plot_bad (boolean, optional) – If True, “bad” values will be plotted but the ranges of bad values will be marked with translucent blue rectangles. If False, bad values will be removed from the plot. Default: False

times(*args)

Return the timing information in seconds from the beginning of the mission for a field.

Examples

>>> ds.times("msids", "1deamzt")
write_msids(filename, fields, mask=None, overwrite=False)

Write MSIDs (or MSID-like quantities such as model values) to an ASCII table file. This assumes that all of the quantities have been interpolated to a common set of times.

Parameters
  • filename (string) – The filename to write the quantities to.

  • fields (list of (type, name) field specifications) – The quantities to be written to the ASCII table.

  • overwrite (boolean, optional) – If True, an existing file with the same name will be overwritten.

write_states(filename, overwrite=False)

Write commanded states to an ASCII table file. An error will be thrown if there are no commanded states present.

Parameters
  • filename (string) – The filename to write the states to.

  • overwrite (boolean, optional) – If True, an existing file with the same name will be overwritten.

class acispy.dataset.EngineeringTracelogData(tbegin=None, tend=None, other_msids=None, get_states=True, state_keys=None)[source]

Fetch MSIDs from the engineering tracelog file and states from the commanded states database.

Parameters
  • tbegin (string) – The start time in YYYY:DOY:HH:MM:SS format. Default: None, which will read from the beginning of the tracelog.

  • tend (string) – The stop time in YYYY:DOY:HH:MM:SS format. Default: None, which will read from the beginning of the tracelog.

  • get_states (boolean, optional) – Whether or not to retrieve commanded states from kadi. Default: True

  • state_keys (list of strings, optional) – The states to pull from kadi. If not specified, a default set will be pulled.

add_averaged_field(field, n=10)

Add a new field from an average of another.

Parameters
  • field (string or (type, name) tuple) – The field to be averaged.

  • n (integer, optional) – The number of samples to average over. Default: 5

Examples

>>> ds.add_averaged_field(("msids", "1dpicacu"), n=10)
add_derived_field(ftype, fname, function, units, display_name=None, depends=None)

Add a new derived field.

Parameters
  • ftype (string) – The type of the field to add.

  • fname (string) – The name of the field to add.

  • function (function) – The function which computes the field.

  • units (string) – The units of the field.

  • times (array or tuple) – The timing data for the field in seconds from the beginning of the mission. Can supply an array of times or a field specification. If the latter, then the times for this field will be used.

  • display_name (string, optional) – The name to use when displaying the field in plots.

Examples

>>> def _dpaa_power(ds):
...     return (ds["msids", "1dp28avo"]*ds["msids", "1dpicacu"]).to("W")
>>> ds.add_derived_field("msids", "dpa_a_power", _dpaa_power,
...                      "W", display_name="DPA-A Power")
add_diff_data_model_field(msid, ftype_model='model')

Create a field which gives the difference between the data and the model for a particular MSID.

Parameters
  • msid (string) – The MSID to take the diff of data and model of.

  • ftype_model (string, optional) – The model type (e.g., “model”, “model0”, etc.) of the model field to be diffed with the MSID.

dates(*args)

Return the timing information in date and time for a field.

Examples

>>> ds.dates("states", "pitch")
map_state_to_msid(state, msid, ftype='msids')

Create a new derived field by interpolating a state to the times of a MSID or model component.

Parameters
  • state (string) – The state to be interpolated.

  • msid (string) – The msid or model component to interpolate the state to.

  • ftype (string, optional) – The field type to use. “msids” or “model”. Default: “msids”

Examples

>>> ds.map_state_to_msid("ccd_count", "1dpamzt")
plot(fields, field2=None, lw=2, ls='-', ls2='-', lw2=2, fontsize=18, color=None, color2='magenta', figsize=10, 8, plot=None, fig=None, subplot=None, plot_bad=False)

Make a single-panel plot of a quantity (or multiple quantities) vs. date and time from this Dataset.

Multiple quantities can be plotted on the left y-axis together if they have the same units, otherwise a quantity with different units can be plotted on the right y-axis.

Parameters
  • fields (tuple of strings or list of tuples of strings) – A single field or list of fields to plot on the left y-axis.

  • field2 (tuple of strings, optional) – A single field to plot on the right y-axis. Default: None

  • lw (float or list of floats, optional) – The width of the lines in the plots. If a list, the length of a the list must be equal to the number of fields. If a single number, it will apply to all plots. Default: 2 px.

  • ls (string, optional) – The line style of the lines plotted on the left y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • ls2 (string, optional) – The line style of the line plotted on the right y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • lw2 (float, optional) – The width of the line plotted on the right y-axis.

  • fontsize (integer, optional) – The font size for the labels in the plot. Default: 18 pt.

  • color (list of strings, optional) – The colors for the lines plotted on the left y-axis. Can be a single color or more than one in a list. Default: Use the default Matplotlib order of colors.

  • color2 (string, optional) – The color for the line plotted on the right y-axis. Default: “magenta”

  • fig (Figure, optional) – A Figure instance to plot in. Default: None, one will be created if not provided.

  • figsize (tuple of integers, optional) – The size of the plot in (width, height) in inches. Default: (10, 8)

  • plot (DatePlot or CustomDatePlot, optional) – An existing DatePlot to add this plot to. Default: None, one will be created if not provided.

  • plot_bad (boolean, optional) – If True, “bad” values will be plotted but the ranges of bad values will be marked with translucent blue rectangles. If False, bad values will be removed from the plot. Default: False

times(*args)

Return the timing information in seconds from the beginning of the mission for a field.

Examples

>>> ds.times("msids", "1deamzt")
write_msids(filename, fields, mask=None, overwrite=False)

Write MSIDs (or MSID-like quantities such as model values) to an ASCII table file. This assumes that all of the quantities have been interpolated to a common set of times.

Parameters
  • filename (string) – The filename to write the quantities to.

  • fields (list of (type, name) field specifications) – The quantities to be written to the ASCII table.

  • overwrite (boolean, optional) – If True, an existing file with the same name will be overwritten.

write_states(filename, overwrite=False)

Write commanded states to an ASCII table file. An error will be thrown if there are no commanded states present.

Parameters
  • filename (string) – The filename to write the states to.

  • overwrite (boolean, optional) – If True, an existing file with the same name will be overwritten.

class acispy.dataset.DEAHousekeepingTracelogData(tbegin=None, tend=None, other_msids=None, get_states=True, state_keys=None)[source]

Fetch MSIDs from the DEA housekeeping tracelog file and states from the commanded states database.

Parameters
  • tbegin (string) – The start time in YYYY:DOY:HH:MM:SS format. Default: None, which will read from the beginning of the tracelog.

  • tend (string) – The stop time in YYYY:DOY:HH:MM:SS format. Default: None, which will read from the beginning of the tracelog.

  • get_states (boolean, optional) – Whether or not to retrieve commanded states from kadi. Default: True

  • state_keys (list of strings, optional) – The states to pull from kadi. If not specified, a default set will be pulled.

add_averaged_field(field, n=10)

Add a new field from an average of another.

Parameters
  • field (string or (type, name) tuple) – The field to be averaged.

  • n (integer, optional) – The number of samples to average over. Default: 5

Examples

>>> ds.add_averaged_field(("msids", "1dpicacu"), n=10)
add_derived_field(ftype, fname, function, units, display_name=None, depends=None)

Add a new derived field.

Parameters
  • ftype (string) – The type of the field to add.

  • fname (string) – The name of the field to add.

  • function (function) – The function which computes the field.

  • units (string) – The units of the field.

  • times (array or tuple) – The timing data for the field in seconds from the beginning of the mission. Can supply an array of times or a field specification. If the latter, then the times for this field will be used.

  • display_name (string, optional) – The name to use when displaying the field in plots.

Examples

>>> def _dpaa_power(ds):
...     return (ds["msids", "1dp28avo"]*ds["msids", "1dpicacu"]).to("W")
>>> ds.add_derived_field("msids", "dpa_a_power", _dpaa_power,
...                      "W", display_name="DPA-A Power")
add_diff_data_model_field(msid, ftype_model='model')

Create a field which gives the difference between the data and the model for a particular MSID.

Parameters
  • msid (string) – The MSID to take the diff of data and model of.

  • ftype_model (string, optional) – The model type (e.g., “model”, “model0”, etc.) of the model field to be diffed with the MSID.

dates(*args)

Return the timing information in date and time for a field.

Examples

>>> ds.dates("states", "pitch")
map_state_to_msid(state, msid, ftype='msids')

Create a new derived field by interpolating a state to the times of a MSID or model component.

Parameters
  • state (string) – The state to be interpolated.

  • msid (string) – The msid or model component to interpolate the state to.

  • ftype (string, optional) – The field type to use. “msids” or “model”. Default: “msids”

Examples

>>> ds.map_state_to_msid("ccd_count", "1dpamzt")
plot(fields, field2=None, lw=2, ls='-', ls2='-', lw2=2, fontsize=18, color=None, color2='magenta', figsize=10, 8, plot=None, fig=None, subplot=None, plot_bad=False)

Make a single-panel plot of a quantity (or multiple quantities) vs. date and time from this Dataset.

Multiple quantities can be plotted on the left y-axis together if they have the same units, otherwise a quantity with different units can be plotted on the right y-axis.

Parameters
  • fields (tuple of strings or list of tuples of strings) – A single field or list of fields to plot on the left y-axis.

  • field2 (tuple of strings, optional) – A single field to plot on the right y-axis. Default: None

  • lw (float or list of floats, optional) – The width of the lines in the plots. If a list, the length of a the list must be equal to the number of fields. If a single number, it will apply to all plots. Default: 2 px.

  • ls (string, optional) – The line style of the lines plotted on the left y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • ls2 (string, optional) – The line style of the line plotted on the right y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • lw2 (float, optional) – The width of the line plotted on the right y-axis.

  • fontsize (integer, optional) – The font size for the labels in the plot. Default: 18 pt.

  • color (list of strings, optional) – The colors for the lines plotted on the left y-axis. Can be a single color or more than one in a list. Default: Use the default Matplotlib order of colors.

  • color2 (string, optional) – The color for the line plotted on the right y-axis. Default: “magenta”

  • fig (Figure, optional) – A Figure instance to plot in. Default: None, one will be created if not provided.

  • figsize (tuple of integers, optional) – The size of the plot in (width, height) in inches. Default: (10, 8)

  • plot (DatePlot or CustomDatePlot, optional) – An existing DatePlot to add this plot to. Default: None, one will be created if not provided.

  • plot_bad (boolean, optional) – If True, “bad” values will be plotted but the ranges of bad values will be marked with translucent blue rectangles. If False, bad values will be removed from the plot. Default: False

times(*args)

Return the timing information in seconds from the beginning of the mission for a field.

Examples

>>> ds.times("msids", "1deamzt")
write_msids(filename, fields, mask=None, overwrite=False)

Write MSIDs (or MSID-like quantities such as model values) to an ASCII table file. This assumes that all of the quantities have been interpolated to a common set of times.

Parameters
  • filename (string) – The filename to write the quantities to.

  • fields (list of (type, name) field specifications) – The quantities to be written to the ASCII table.

  • overwrite (boolean, optional) – If True, an existing file with the same name will be overwritten.

write_states(filename, overwrite=False)

Write commanded states to an ASCII table file. An error will be thrown if there are no commanded states present.

Parameters
  • filename (string) – The filename to write the states to.

  • overwrite (boolean, optional) – If True, an existing file with the same name will be overwritten.

class acispy.dataset.TenDayTracelogData(tbegin=None, tend=None, other_msids=None, get_states=True, state_keys=None)[source]

Fetch MSIDs from both the engineering and DEA housekeeping tracelog files in one dataset.

Parameters
  • tbegin (string) – The start time in YYYY:DOY:HH:MM:SS format. Default: None, which will read from the beginning of the tracelog.

  • tend (string) – The stop time in YYYY:DOY:HH:MM:SS format. Default: None, which will read from the beginning of the tracelog.

  • get_states (boolean, optional) – Whether or not to retrieve commanded states from kadi. Default: True

  • state_keys (list of strings, optional) – The states to pull from kadi. If not specified, a default set will be pulled.

add_averaged_field(field, n=10)

Add a new field from an average of another.

Parameters
  • field (string or (type, name) tuple) – The field to be averaged.

  • n (integer, optional) – The number of samples to average over. Default: 5

Examples

>>> ds.add_averaged_field(("msids", "1dpicacu"), n=10)
add_derived_field(ftype, fname, function, units, display_name=None, depends=None)

Add a new derived field.

Parameters
  • ftype (string) – The type of the field to add.

  • fname (string) – The name of the field to add.

  • function (function) – The function which computes the field.

  • units (string) – The units of the field.

  • times (array or tuple) – The timing data for the field in seconds from the beginning of the mission. Can supply an array of times or a field specification. If the latter, then the times for this field will be used.

  • display_name (string, optional) – The name to use when displaying the field in plots.

Examples

>>> def _dpaa_power(ds):
...     return (ds["msids", "1dp28avo"]*ds["msids", "1dpicacu"]).to("W")
>>> ds.add_derived_field("msids", "dpa_a_power", _dpaa_power,
...                      "W", display_name="DPA-A Power")
add_diff_data_model_field(msid, ftype_model='model')

Create a field which gives the difference between the data and the model for a particular MSID.

Parameters
  • msid (string) – The MSID to take the diff of data and model of.

  • ftype_model (string, optional) – The model type (e.g., “model”, “model0”, etc.) of the model field to be diffed with the MSID.

dates(*args)

Return the timing information in date and time for a field.

Examples

>>> ds.dates("states", "pitch")
map_state_to_msid(state, msid, ftype='msids')

Create a new derived field by interpolating a state to the times of a MSID or model component.

Parameters
  • state (string) – The state to be interpolated.

  • msid (string) – The msid or model component to interpolate the state to.

  • ftype (string, optional) – The field type to use. “msids” or “model”. Default: “msids”

Examples

>>> ds.map_state_to_msid("ccd_count", "1dpamzt")
plot(fields, field2=None, lw=2, ls='-', ls2='-', lw2=2, fontsize=18, color=None, color2='magenta', figsize=10, 8, plot=None, fig=None, subplot=None, plot_bad=False)

Make a single-panel plot of a quantity (or multiple quantities) vs. date and time from this Dataset.

Multiple quantities can be plotted on the left y-axis together if they have the same units, otherwise a quantity with different units can be plotted on the right y-axis.

Parameters
  • fields (tuple of strings or list of tuples of strings) – A single field or list of fields to plot on the left y-axis.

  • field2 (tuple of strings, optional) – A single field to plot on the right y-axis. Default: None

  • lw (float or list of floats, optional) – The width of the lines in the plots. If a list, the length of a the list must be equal to the number of fields. If a single number, it will apply to all plots. Default: 2 px.

  • ls (string, optional) – The line style of the lines plotted on the left y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • ls2 (string, optional) – The line style of the line plotted on the right y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • lw2 (float, optional) – The width of the line plotted on the right y-axis.

  • fontsize (integer, optional) – The font size for the labels in the plot. Default: 18 pt.

  • color (list of strings, optional) – The colors for the lines plotted on the left y-axis. Can be a single color or more than one in a list. Default: Use the default Matplotlib order of colors.

  • color2 (string, optional) – The color for the line plotted on the right y-axis. Default: “magenta”

  • fig (Figure, optional) – A Figure instance to plot in. Default: None, one will be created if not provided.

  • figsize (tuple of integers, optional) – The size of the plot in (width, height) in inches. Default: (10, 8)

  • plot (DatePlot or CustomDatePlot, optional) – An existing DatePlot to add this plot to. Default: None, one will be created if not provided.

  • plot_bad (boolean, optional) – If True, “bad” values will be plotted but the ranges of bad values will be marked with translucent blue rectangles. If False, bad values will be removed from the plot. Default: False

times(*args)

Return the timing information in seconds from the beginning of the mission for a field.

Examples

>>> ds.times("msids", "1deamzt")
write_msids(filename, fields, mask=None, overwrite=False)

Write MSIDs (or MSID-like quantities such as model values) to an ASCII table file. This assumes that all of the quantities have been interpolated to a common set of times.

Parameters
  • filename (string) – The filename to write the quantities to.

  • fields (list of (type, name) field specifications) – The quantities to be written to the ASCII table.

  • overwrite (boolean, optional) – If True, an existing file with the same name will be overwritten.

write_states(filename, overwrite=False)

Write commanded states to an ASCII table file. An error will be thrown if there are no commanded states present.

Parameters
  • filename (string) – The filename to write the states to.

  • overwrite (boolean, optional) – If True, an existing file with the same name will be overwritten.

class acispy.dataset.MaudeData(tstart, tstop, msids, get_states=True, user=None, password=None, other_msids=None, state_keys=None)[source]

Fetch MSID data from Maude.

Parameters
  • tstart (string) – The start time in YYYY:DOY:HH:MM:SS format

  • tstop (string) – The stop time in YYYY:DOY:HH:MM:SS format

  • msids (list of strings, optional) – List of MSIDs to pull from the engineering archive.

  • get_states (boolean, optional) – Whether or not to retrieve commanded states from kadi. Default: True

  • user (string, optional) – OCCWEB username to access the MAUDE database with. Default: None, which will use the username in the ${HOME}/.netrc file.

  • password (string, optional) – OCCWEB password to access the MAUDE database with. Default: None, which will use the password in the ${HOME}/.netrc file.

  • state_keys (list of strings, optional) – The states to pull from kadi. If not specified, a default set will be pulled.

add_averaged_field(field, n=10)

Add a new field from an average of another.

Parameters
  • field (string or (type, name) tuple) – The field to be averaged.

  • n (integer, optional) – The number of samples to average over. Default: 5

Examples

>>> ds.add_averaged_field(("msids", "1dpicacu"), n=10)
add_derived_field(ftype, fname, function, units, display_name=None, depends=None)

Add a new derived field.

Parameters
  • ftype (string) – The type of the field to add.

  • fname (string) – The name of the field to add.

  • function (function) – The function which computes the field.

  • units (string) – The units of the field.

  • times (array or tuple) – The timing data for the field in seconds from the beginning of the mission. Can supply an array of times or a field specification. If the latter, then the times for this field will be used.

  • display_name (string, optional) – The name to use when displaying the field in plots.

Examples

>>> def _dpaa_power(ds):
...     return (ds["msids", "1dp28avo"]*ds["msids", "1dpicacu"]).to("W")
>>> ds.add_derived_field("msids", "dpa_a_power", _dpaa_power,
...                      "W", display_name="DPA-A Power")
add_diff_data_model_field(msid, ftype_model='model')

Create a field which gives the difference between the data and the model for a particular MSID.

Parameters
  • msid (string) – The MSID to take the diff of data and model of.

  • ftype_model (string, optional) – The model type (e.g., “model”, “model0”, etc.) of the model field to be diffed with the MSID.

dates(*args)

Return the timing information in date and time for a field.

Examples

>>> ds.dates("states", "pitch")
map_state_to_msid(state, msid, ftype='msids')

Create a new derived field by interpolating a state to the times of a MSID or model component.

Parameters
  • state (string) – The state to be interpolated.

  • msid (string) – The msid or model component to interpolate the state to.

  • ftype (string, optional) – The field type to use. “msids” or “model”. Default: “msids”

Examples

>>> ds.map_state_to_msid("ccd_count", "1dpamzt")
plot(fields, field2=None, lw=2, ls='-', ls2='-', lw2=2, fontsize=18, color=None, color2='magenta', figsize=10, 8, plot=None, fig=None, subplot=None, plot_bad=False)

Make a single-panel plot of a quantity (or multiple quantities) vs. date and time from this Dataset.

Multiple quantities can be plotted on the left y-axis together if they have the same units, otherwise a quantity with different units can be plotted on the right y-axis.

Parameters
  • fields (tuple of strings or list of tuples of strings) – A single field or list of fields to plot on the left y-axis.

  • field2 (tuple of strings, optional) – A single field to plot on the right y-axis. Default: None

  • lw (float or list of floats, optional) – The width of the lines in the plots. If a list, the length of a the list must be equal to the number of fields. If a single number, it will apply to all plots. Default: 2 px.

  • ls (string, optional) – The line style of the lines plotted on the left y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • ls2 (string, optional) – The line style of the line plotted on the right y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • lw2 (float, optional) – The width of the line plotted on the right y-axis.

  • fontsize (integer, optional) – The font size for the labels in the plot. Default: 18 pt.

  • color (list of strings, optional) – The colors for the lines plotted on the left y-axis. Can be a single color or more than one in a list. Default: Use the default Matplotlib order of colors.

  • color2 (string, optional) – The color for the line plotted on the right y-axis. Default: “magenta”

  • fig (Figure, optional) – A Figure instance to plot in. Default: None, one will be created if not provided.

  • figsize (tuple of integers, optional) – The size of the plot in (width, height) in inches. Default: (10, 8)

  • plot (DatePlot or CustomDatePlot, optional) – An existing DatePlot to add this plot to. Default: None, one will be created if not provided.

  • plot_bad (boolean, optional) – If True, “bad” values will be plotted but the ranges of bad values will be marked with translucent blue rectangles. If False, bad values will be removed from the plot. Default: False

times(*args)

Return the timing information in seconds from the beginning of the mission for a field.

Examples

>>> ds.times("msids", "1deamzt")
write_msids(filename, fields, mask=None, overwrite=False)

Write MSIDs (or MSID-like quantities such as model values) to an ASCII table file. This assumes that all of the quantities have been interpolated to a common set of times.

Parameters
  • filename (string) – The filename to write the quantities to.

  • fields (list of (type, name) field specifications) – The quantities to be written to the ASCII table.

  • overwrite (boolean, optional) – If True, an existing file with the same name will be overwritten.

write_states(filename, overwrite=False)

Write commanded states to an ASCII table file. An error will be thrown if there are no commanded states present.

Parameters
  • filename (string) – The filename to write the states to.

  • overwrite (boolean, optional) – If True, an existing file with the same name will be overwritten.

class acispy.dataset.TelemData(tstart, tstop, msids, recent_source='maude', filter_bad=False, stat='5min', user=None, password=None, get_states=True, state_keys=None)[source]

Fetch MSID data from the Ska engineering archive as well as either Maude or one of the tracelog files, in order to ensure the most recent data is obtained.

Parameters
  • tstart (string) – The start time in YYYY:DOY:HH:MM:SS format

  • tstop (string) – The stop time in YYYY:DOY:HH:MM:SS format

  • msids (list of strings, optional) – List of MSIDs to pull from the engineering archive.

  • recent_source (string, optional) – Which source to use to get the most recent tracelog data. Options are “maude” or “tracelog”. Default: “tracelog”

  • filter_bad (boolean, optional) – Whether or not to filter out bad values of MSIDs. Default: False.

  • stat (string, optional) – return 5-minute or daily statistics (‘5min’ or ‘daily’), or None for raw data. Default: ‘5min’

  • user (string, optional) – OCCWEB username to access the MAUDE database with. Default: None, which will use the username in the ${HOME}/.netrc file.

  • password (string, optional) – OCCWEB password to access the MAUDE database with. Default: None, which will use the password in the ${HOME}/.netrc file.

  • get_states (boolean, optional) – Whether or not to retrieve commanded states from kadi. Default: True

  • state_keys (list of strings, optional) – The states to pull from kadi. If not specified, a default set will be pulled.

add_averaged_field(field, n=10)

Add a new field from an average of another.

Parameters
  • field (string or (type, name) tuple) – The field to be averaged.

  • n (integer, optional) – The number of samples to average over. Default: 5

Examples

>>> ds.add_averaged_field(("msids", "1dpicacu"), n=10)
add_derived_field(ftype, fname, function, units, display_name=None, depends=None)

Add a new derived field.

Parameters
  • ftype (string) – The type of the field to add.

  • fname (string) – The name of the field to add.

  • function (function) – The function which computes the field.

  • units (string) – The units of the field.

  • times (array or tuple) – The timing data for the field in seconds from the beginning of the mission. Can supply an array of times or a field specification. If the latter, then the times for this field will be used.

  • display_name (string, optional) – The name to use when displaying the field in plots.

Examples

>>> def _dpaa_power(ds):
...     return (ds["msids", "1dp28avo"]*ds["msids", "1dpicacu"]).to("W")
>>> ds.add_derived_field("msids", "dpa_a_power", _dpaa_power,
...                      "W", display_name="DPA-A Power")
add_diff_data_model_field(msid, ftype_model='model')

Create a field which gives the difference between the data and the model for a particular MSID.

Parameters
  • msid (string) – The MSID to take the diff of data and model of.

  • ftype_model (string, optional) – The model type (e.g., “model”, “model0”, etc.) of the model field to be diffed with the MSID.

dates(*args)

Return the timing information in date and time for a field.

Examples

>>> ds.dates("states", "pitch")
map_state_to_msid(state, msid, ftype='msids')

Create a new derived field by interpolating a state to the times of a MSID or model component.

Parameters
  • state (string) – The state to be interpolated.

  • msid (string) – The msid or model component to interpolate the state to.

  • ftype (string, optional) – The field type to use. “msids” or “model”. Default: “msids”

Examples

>>> ds.map_state_to_msid("ccd_count", "1dpamzt")
plot(fields, field2=None, lw=2, ls='-', ls2='-', lw2=2, fontsize=18, color=None, color2='magenta', figsize=10, 8, plot=None, fig=None, subplot=None, plot_bad=False)

Make a single-panel plot of a quantity (or multiple quantities) vs. date and time from this Dataset.

Multiple quantities can be plotted on the left y-axis together if they have the same units, otherwise a quantity with different units can be plotted on the right y-axis.

Parameters
  • fields (tuple of strings or list of tuples of strings) – A single field or list of fields to plot on the left y-axis.

  • field2 (tuple of strings, optional) – A single field to plot on the right y-axis. Default: None

  • lw (float or list of floats, optional) – The width of the lines in the plots. If a list, the length of a the list must be equal to the number of fields. If a single number, it will apply to all plots. Default: 2 px.

  • ls (string, optional) – The line style of the lines plotted on the left y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • ls2 (string, optional) – The line style of the line plotted on the right y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • lw2 (float, optional) – The width of the line plotted on the right y-axis.

  • fontsize (integer, optional) – The font size for the labels in the plot. Default: 18 pt.

  • color (list of strings, optional) – The colors for the lines plotted on the left y-axis. Can be a single color or more than one in a list. Default: Use the default Matplotlib order of colors.

  • color2 (string, optional) – The color for the line plotted on the right y-axis. Default: “magenta”

  • fig (Figure, optional) – A Figure instance to plot in. Default: None, one will be created if not provided.

  • figsize (tuple of integers, optional) – The size of the plot in (width, height) in inches. Default: (10, 8)

  • plot (DatePlot or CustomDatePlot, optional) – An existing DatePlot to add this plot to. Default: None, one will be created if not provided.

  • plot_bad (boolean, optional) – If True, “bad” values will be plotted but the ranges of bad values will be marked with translucent blue rectangles. If False, bad values will be removed from the plot. Default: False

times(*args)

Return the timing information in seconds from the beginning of the mission for a field.

Examples

>>> ds.times("msids", "1deamzt")
write_msids(filename, fields, mask=None, overwrite=False)

Write MSIDs (or MSID-like quantities such as model values) to an ASCII table file. This assumes that all of the quantities have been interpolated to a common set of times.

Parameters
  • filename (string) – The filename to write the quantities to.

  • fields (list of (type, name) field specifications) – The quantities to be written to the ASCII table.

  • overwrite (boolean, optional) – If True, an existing file with the same name will be overwritten.

write_states(filename, overwrite=False)

Write commanded states to an ASCII table file. An error will be thrown if there are no commanded states present.

Parameters
  • filename (string) – The filename to write the states to.

  • overwrite (boolean, optional) – If True, an existing file with the same name will be overwritten.