mahos.meas.spectroscopy.SpectroscopyIO#

class mahos.meas.spectroscopy.SpectroscopyIO(logger=None)#
save_data(filename: str, data: SpectroscopyData, note: str = '') bool#

Save data to filename. return True on success.

load_data(filename: str) SpectroscopyData | None#

Load data from filename. return None if load is failed.

export_data(filename: str, data: SpectroscopyData | list[mahos.msgs.spectroscopy_msgs.SpectroscopyData], params: dict | None = None) bool#

Export the data to text or image files.

Parameters:
  • filename – supported extensions: text: .txt and .csv. image: .png, .pdf, and .eps.

  • data – single data or list of data

  • params.last_n (int) – use last n data. (0 to use all data. this is default.)

  • params.filter_n (float) – outlier filter’s order. data point exhibits value over n * sigma is considered outlier. (0 to disable filter. this is default.)

  • params.offset (list[float]) – offset along y-axis

  • params.xmin (float) – lower limit of x-axis

  • params.xmax (float) – upper limit of x-axis

  • params.ymin (float) – lower limit of y-axis

  • params.ymax (float) – upper limit of y-axis

  • params.figsize (tuple[float, float]) – matplotlib figure size (w, h)

  • params.fontsize (float) – matplotlib fontsize

  • params.dpi (float) – matplotlib dpi

  • params.label (list[str]) – matplotlib labels

  • params.color_fit (list[str]) – matplotlib colors for fit data

  • params.color (list[str]) – matplotlib colors for data

  • params.linewidth (list[float]) – matplotlib linewidths for data

  • params.linewidth_fit (list[float]) – matplotlib linewidths for fit data

  • params.marker (list[str]) – matplotlib markers for data

  • params.show_fit (bool) – set True to plot fit data

  • params.legend (str|None) – legend location (best|upper left|…). None to disable legend.