Data#

class jetset.data_loader.Data(data_table=None, n_rows=None, meta_data=None, import_dictionary=None, cosmo=None)[source]#

Bases: object

Structured observational data table with metadata validation.

Notes

Normalizes expected columns, validates required metadata fields, and converts incoming units/scales into the internal linear observer-frame representation used by JetSeT.

Attributes Summary

metadata

Return table metadata dictionary.

table

Return the internal Astropy table.

Methods Summary

from_asdc(asdc_sed_file, obj_name, z, ...)

Create Data from an ASDC-style text SED file.

from_file(data_table[, format, ...])

Create Data from a file.

save_file(name[, format])

Write the internal table to disk.

set_field(field, value[, unit])

Assign a column and optionally set/override its unit.

set_meta_data(m, v)

Set and validate a metadata field.

Attributes Documentation

metadata#

Return table metadata dictionary.

table#

Return the internal Astropy table.

Methods Documentation

classmethod from_asdc(asdc_sed_file, obj_name, z, restframe, data_scale)[source]#

Create Data from an ASDC-style text SED file.

Parameters:
  • asdc_sed_file (str) – Input ASDC SED file path.

  • obj_name (str) – Source name stored in metadata.

  • z (float) – Source redshift.

  • restframe ({"obs", "src"}) – Frame declaration of the imported data.

  • data_scale ({"lin-lin", "log-log"}) – Scale declaration of the imported data.

Returns:

New data container built from the ASDC content.

Return type:

Data

classmethod from_file(data_table, format='ascii.ecsv', import_dictionary=None, guess=None)[source]#

Create Data from a file.

Parameters:
  • data_table (str) – File path to read.

  • format (str, optional) – Astropy table format passed to Table.read.

  • import_dictionary (dict, optional) – Optional column renaming map.

  • guess (bool, optional) – Forwarded to Table.read.

Returns:

New normalized data container.

Return type:

Data

save_file(name, format='ascii.ecsv')[source]#

Write the internal table to disk.

Parameters:
  • name (str) – Output file path.

  • format (str, optional) – Astropy output format.

set_field(field, value, unit=None)[source]#

Assign a column and optionally set/override its unit.

Parameters:
  • field (str) – Column name.

  • value (array-like) – Values to assign to the column.

  • unit (astropy.units.Unit or str, optional) – Unit to set after assignment. If omitted, preserves the existing unit when available.

set_meta_data(m, v)[source]#

Set and validate a metadata field.

Parameters:
  • m (str) – Metadata key.

  • v (object) – Metadata value.