karabo.data package
Submodules
karabo.data.casa module
Module to access CASA Measurement Set metadata.
Details see MS v2.0: https://casacore.github.io/casacore-notes/229.html
- class MSAntennaTable(name: List[str], station: List[str], type: List[str], mount: List[str], position: ndarray[Any, dtype[float64]], offset: ndarray[Any, dtype[float64]], dish_diameter: ndarray[Any, dtype[float64]], flag_row: ndarray[Any, dtype[bool_]])
Bases:
_CasaTableABC
Utility class to extract antenna metadata from CASA Measurement Sets.
ANTENNA_ID is the row-nr (dim0).
- Args:
name: Antenna name. station: Station name. type: Antenna type. mount: Mount type:alt-az, equatorial, X-Y, orbiting, bizarre. position: Antenna X,Y,Z phase reference positions [m], dim1=3. offset: Axes offset of mount to FEED REFERENCE point [m], dim1=3. dish_diameter: Diameter of dish. flag_row: True if data in this row are invalid, else False.
- baseline_dists() ndarray[Any, dtype[float64]]
Computes the baseline euclidean distances in [m].
This function assumes that self.position is in ITRF.
- Returns:
Baseline distances nxn where n is the number of antennas.
- dish_diameter: ndarray[Any, dtype[float64]]
- flag_row: ndarray[Any, dtype[bool_]]
- mount: List[str]
- name: List[str]
- offset: ndarray[Any, dtype[float64]]
- position: ndarray[Any, dtype[float64]]
- station: List[str]
- type: List[str]
- class MSFieldTable(name: List[str], code: List[str], time: ndarray[Any, dtype[float64]], num_poly: ndarray[Any, dtype[int32]], delay_dir: ndarray[Any, dtype[float64]], phase_dir: ndarray[Any, dtype[float64]], reference_dir: ndarray[Any, dtype[float64]], source_id: ndarray[Any, dtype[int32]], flag_row: ndarray[Any, dtype[bool_]])
Bases:
_CasaTableABC
Utility class to extract field metadata from CASA Measurement Sets.
FIELD_ID is the row-nr (dim0).
- Args:
name: Name of field. code: Special characteristics of field. time: Time origin for the directions and rates [s]. num_poly: Series order. delay_dir: Direction of delay center [rad], shape=(2,`num_poly`+1).
Can be expressed as a polynomial in time.
- phase_dir: Phase center [rad, shape=(2,`num_poly`+1).
Can be expressed as a polynomial in time.
- reference_dir: Reference center [rad], shape=(2,`num_poly`+1).
Can be expressed as a polynomial in time.
- source_id: Points to an entry in the optional SOURCE subtable, a value of −1
indicates there is no corresponding source defined.
flag_row: True if data in this row are invalid, else False.
- code: List[str]
- delay_dir: ndarray[Any, dtype[float64]]
- flag_row: ndarray[Any, dtype[bool_]]
- name: List[str]
- num_poly: ndarray[Any, dtype[int32]]
- phase_dir: ndarray[Any, dtype[float64]]
- reference_dir: ndarray[Any, dtype[float64]]
- source_id: ndarray[Any, dtype[int32]]
- time: ndarray[Any, dtype[float64]]
- class MSMainTable(time: ndarray[Any, dtype[float64]], antenna1: ndarray[Any, dtype[int32]], antenna2: ndarray[Any, dtype[int32]], feed1: ndarray[Any, dtype[int32]], feed2: ndarray[Any, dtype[int32]], data_desc_id: ndarray[Any, dtype[int32]], processor_id: ndarray[Any, dtype[int32]], field_id: ndarray[Any, dtype[int32]], interval: ndarray[Any, dtype[float64]], exposure: ndarray[Any, dtype[float64]], time_centroid: ndarray[Any, dtype[float64]], scan_number: ndarray[Any, dtype[int32]], array_id: ndarray[Any, dtype[int32]], observation_id: ndarray[Any, dtype[int32]], state_id: ndarray[Any, dtype[int32]], uvw: ndarray[Any, dtype[float64]])
Bases:
_CasaTableABC
Utility class to extract main table metadata from CASA Measurement Sets.
Each row (dim0) of the main table represents a measurement.
- The loading of this dataclass can get out of hand if the measurement set has many
measurement sets. There we suggest to access the according column via get_col or directly from casacore to avoid eager loading.
- Args:
time: Mid-point (not centroid) of data interval [s]. antenna1: First antenna (index to sub-table). antenna2: Second antenna (index to sub-table). feed1: Feed for antenna1. feed2: Feed for antenna2. data_desc_id: Index to the DATA_DESCRIPTION sub-table. processor_id: Index to the PROCESSOR sub-table. field_id: Field identifier. interval: Data sampling interval. This is the nominal data interval and does not
include the effects of bad data or partial integration [s].
exposure: Effective data interval, including bad data and partial averaging [s]. time_centroid: Time centroid [s]. scan_number: Arbitrary scan number to identify data taken in the same logical
scan. Not required to be unique.
array_id: Subarray identifier, which identifies data in separate subarrays. observation_id: Observation identifier which identifies data from separate
observations.
state_id: State identifier. uvw: Coordinates for the baseline from ANTENNA2 to ANTENNA1, i.e. the baseline
is equal to the difference POSITION2 - POSITION1. The UVW given are for the TIME_CENTROID, and correspond in general to the reference type for the PHASE_DIR of the relevant field. I.e. J2000 if the phase reference direction is given in J2000 coordinates. However, any known reference is valid. Note that the choice of baseline direction and UVW definition (W towards source direction; V in plane through source and system’s pole; U in direction of increasing longitude coordinate) also determines the sign of the phase of the recorded data.
- antenna1: ndarray[Any, dtype[int32]]
- antenna2: ndarray[Any, dtype[int32]]
- array_id: ndarray[Any, dtype[int32]]
- data_desc_id: ndarray[Any, dtype[int32]]
- exposure: ndarray[Any, dtype[float64]]
- feed1: ndarray[Any, dtype[int32]]
- feed2: ndarray[Any, dtype[int32]]
- field_id: ndarray[Any, dtype[int32]]
- interval: ndarray[Any, dtype[float64]]
- classmethod ms_version(ms_path: str | Path) Literal['1.0', '2.0']
Gets the CASA MS version of ms_path.
- Args:
ms_path: Measurement set path.
- Returns:
Version of CASA Measurement Set.
- observation_id: ndarray[Any, dtype[int32]]
- processor_id: ndarray[Any, dtype[int32]]
- scan_number: ndarray[Any, dtype[int32]]
- state_id: ndarray[Any, dtype[int32]]
- time: ndarray[Any, dtype[float64]]
- time_centroid: ndarray[Any, dtype[float64]]
- uvw: ndarray[Any, dtype[float64]]
- class MSMeta(observation: MSObservationTable, polarization: MSPolarizationTable, antenna: MSAntennaTable, field: MSFieldTable, spectral_window: MSSpectralWindowTable, ms_version: Literal['1.0', '2.0'])
Bases:
object
Utility class to extract metadata from CASA Measurement Sets.
- Args:
observation: Observations. polarization: Polarizations. antenna: Antennas. field: Fields. spectral_window: Spectral Windows. ms_version: CASA MS version.
- antenna: MSAntennaTable
- field: MSFieldTable
- classmethod from_ms(ms_path: str | Path) Self
Gets CASA Measurement Sets metadata from ms_path.
- Note: each subtable ID like obs_id are set to 0 as default! This should be
fine for Karabo creates MS visibilities. However, for external ones, be sure to set the ID’s accordingly.
- Args:
ms_path: Measurement set path.
- Returns:
Dataclass containing CASA Measurement Sets metadata.
- ms_version: Literal['1.0', '2.0']
- observation: MSObservationTable
- polarization: MSPolarizationTable
- spectral_window: MSSpectralWindowTable
- class MSObservationTable(telescope_name: List[str], time_range: ndarray[Any, dtype[float64]], observer: List[str], log: Dict[str, Any] | None, schedule_type: List[str], schedule: Dict[str, Any] | None, project: List[str], release_date: ndarray[Any, dtype[float64]], flag_row: ndarray[Any, dtype[bool_]])
Bases:
_CasaTableABC
Utility class to extract observational metadata from CASA Measurement Sets.
OBSERVATION_ID is the row-nr (dim0).
- Args:
telescope_name: Telescope name. time_range: Start, end times [s] (div by 86400 to get mjd-utc). observer: Name of observer(s). log: Observing log. schedule_type: Schedule type. schedule: Project schedule. project: Project identification string. release_date: Target release date [s]. flag_row: Row flag.
- flag_row: ndarray[Any, dtype[bool_]]
- log: Dict[str, Any] | None
- observer: List[str]
- project: List[str]
- release_date: ndarray[Any, dtype[float64]]
- schedule: Dict[str, Any] | None
- schedule_type: List[str]
- telescope_name: List[str]
- time_range: ndarray[Any, dtype[float64]]
- class MSPolarizationTable(num_corr: ndarray[Any, dtype[int32]], corr_type: ndarray[Any, dtype[int32]], corr_product: ndarray[Any, dtype[int32]], flag_row: ndarray[Any, dtype[bool_]])
Bases:
_CasaTableABC
Utility class to extract polarization metadata from CASA Measurement Sets.
POLARIZATION_ID is the row-nr (dim0).
- Args:
num_corr: Number of correlations. corr_type: Polarization of correlation; dim1=`num_corr`. corr_product: Receptor cross-products; dim1=2, dim2=`num_corr`. flag_row: True if data in this row are invalid, else False.
- corr_product: ndarray[Any, dtype[int32]]
- corr_type: ndarray[Any, dtype[int32]]
- flag_row: ndarray[Any, dtype[bool_]]
- classmethod get_stokes_type(corr_type: List[int]) List[str]
- classmethod get_stokes_type(corr_type: int) str
Gets the stokes type(s) from corr type(s).
- Args:
corr_type: Correlation type(s).
- Returns:
Stokes type(s).
- num_corr: ndarray[Any, dtype[int32]]
- class MSSpectralWindowTable(name: List[str], ref_frequency: ndarray[Any, dtype[float64]], chan_freq: ndarray[Any, dtype[float64]], chan_width: ndarray[Any, dtype[float64]], meas_freq_ref: ndarray[Any, dtype[int32]], effective_bw: ndarray[Any, dtype[float64]], resolution: ndarray[Any, dtype[float64]], total_bandwidth: ndarray[Any, dtype[float64]], net_sideband: ndarray[Any, dtype[int32]], if_conv_chain: ndarray[Any, dtype[int32]], freq_group: ndarray[Any, dtype[int32]], freq_group_name: List[str], flag_row: ndarray[Any, dtype[bool_]])
Bases:
_CasaTableABC
Utility class to extract spectral window metadata from CASA Measurement Sets.
SPECTRAL_WINDOW_ID is the row-nr (dim0).
- Args:
name: Spectral window name; user specified. ref_frequency: The reference frequency [Hz]. A frequency representative of
this spectral window, usually the sky frequency corresponding to the DC edge of the baseband. Used by the calibration system if a fixed scaling frequency is required or in algorithms to identify the observing band.
- chan_freq: Center frequencies [Hz] for each channel in the data matrix;
dim1=`n_channels`. These can be frequency-dependent, to accommodate instruments such as acousto-optical spectrometers. Note that the channel frequencies may be in ascending or descending frequency order.
chan_width: Channel width [Hz] of each spectral channel; dim1=`n_channels`. meas_freq_ref: Frequency measure reference for CHAN_FREQ. This allows a
row-based reference for this column in order to optimize the choice of measure reference when Doppler tracking is used.
- effective_bw: The effective noise bandwidth of each spectral channel [Hz];
dim1=`n_channels`.
- resolution: The effective spectral resolution [Hz] of each channel;
dim1=`n_channels`.
total_bandwidth: The total bandwidth [Hz] for this spectral window. net_sideband: The net sideband for this spectral window. if_conv_chain: Identification of the electronic signal path for the case of
multiple (simultaneous) IFs. (e.g. VLA: AC=0, BD=1, ATCA: Freq1=0, Freq2=1).
- freq_group: The frequency group to which the spectral window belongs. This is
used to associate spectral windows for joint calibration purposes.
freq_group_name: The frequency group name; user specified. flag_row: True if the row does not contain valid data.
- chan_freq: ndarray[Any, dtype[float64]]
- chan_width: ndarray[Any, dtype[float64]]
- effective_bw: ndarray[Any, dtype[float64]]
- flag_row: ndarray[Any, dtype[bool_]]
- freq_group: ndarray[Any, dtype[int32]]
- freq_group_name: List[str]
- if_conv_chain: ndarray[Any, dtype[int32]]
- meas_freq_ref: ndarray[Any, dtype[int32]]
- name: List[str]
- net_sideband: ndarray[Any, dtype[int32]]
- ref_frequency: ndarray[Any, dtype[float64]]
- resolution: ndarray[Any, dtype[float64]]
- total_bandwidth: ndarray[Any, dtype[float64]]
karabo.data.external_data module
- class ContainerContents(remote_url: str, regexr_pattern: str)
Bases:
DownloadObject
- get_all(verbose: bool = True) List[str]
Gets all objects with the according cache paths as a list.
- get_container_content() str
Gets the remote container-content as str.
- get_file_paths() List[str]
Applies regexr_pattern to container-objects.
- is_available() bool
Checks if the container itself is available, not specific files. Is dependent on the regexr_pattern.
- class DiffuseEmissionHaslam408DownloadObject
Bases:
SingleFileDownloadObject
- class DownloadObject(remote_base_url: str)
Bases:
object
Download handler for remote files & dirs.
Important: There is a remote file-naming-convention, to be able to provide updates of cached dirs/files & to simplify maintainability. The convention for each object is <dirname><file|dir>_v<version>, where the version should be an integer, starting from 1. <dirname> should be the same as <file|dir>. The additional <dirname> is to have a single directory for each object, so that additional file/dir versions don’t disturb the overall remote structure.
The version of a downloaded object is determined by the current version of Karabo, meaning that they’re hard-coded. Because Karabo relies partially on remote-objects, we don’t guarantee their availability for deprecated Karabo versions.
- URL_SEP: Final = '/'
- static download(url: str, local_file_path: Path | str, verify: bool = True, verbose: bool = True) int
Downloads url to local_file_path through a GET-request.
- Args:
url: Resource to download. local_file_path: Local file-path. verify: Validate the server’s certificate? verbose: Verbose?
- Returns:
Status-code (currently, always 200, otherwise RuntimeError).
- get_object(remote_file_path: str, verify: bool = True, verbose: bool = True) str
Gets the requested file-path of this object and downloads the resource, cache it on disk if not already done.
- Args:
remote_file_path: Remote file-path, relative to it’s base url. verify: Validate the server’s certificate if download is needed? verbose: Verbose download if it’s needed?
- Returns:
Local file-path of the remote-hosted object.
- static is_url_available(url: str) bool
Checks whether the url is available or not.
- Returns:
True if available, else False
- class ExampleHDF5Map
Bases:
SingleFileDownloadObject
- class GLEAMSurveyDownloadObject
Bases:
SingleFileDownloadObject
- class HISourcesSmallCatalogDownloadObject
Bases:
SingleFileDownloadObject
- class MALSSurveyV3DownloadObject
Bases:
SingleFileDownloadObject
- class MGCLSContainerDownloadObject(regexr_pattern: str)
Bases:
ContainerContents
- class MIGHTEESurveyDownloadObject
Bases:
SingleFileDownloadObject
- class SingleFileDownloadObject(remote_file_path: str, remote_base_url: str)
Bases:
DownloadObject
Abstract single object download handler.
- get(verify: bool = True, verbose: bool = True) str
- is_available() bool
karabo.data.obscore module
ObsCore Data Model.
https://ivoa.net/documents/ObsCore/
Recommended IVOA documents: https://www.ivoa.net/documents/index.html
- class FitsHeaderAxes(x: ~karabo.data.obscore.FitsHeaderAxis = <factory>, y: ~karabo.data.obscore.FitsHeaderAxis = <factory>, freq: ~karabo.data.obscore.FitsHeaderAxis = <factory>)
Bases:
object
Fits file axes description.
Needed for file-parsing for axis-position and unit-transformation.
- Args:
x: X/RA axis (default: axis=1, unit=deg) of image. y: Y/DEC axis (default: axis=2, unit=deg) of image. freq: Freq axis (default: axis=3, unit=Hz) of image.
- freq: FitsHeaderAxis
- class FitsHeaderAxis(axis: int, unit: UnitBase)
Bases:
object
Fits header axis dataclass.
Descriptive dataclass for .fits axis and unit allocation infos.
- Args:
axis: Axis number. unit: Unit of value CRVAL and increment CDELT of axis in the .fits file.
- axis: int
- cdelt(header: Header) Quantity
CDELT{axis} increment at reference point in CTYPE{`axis} unit.
- Args:
header: Header to extract increment from.
- Returns:
Value as astropy Quantity.
- crpix(header: Header) float
CRPIX{axis} location at reference point along axis.
- Args:
header: Header to extract location from.
- Returns:
Location of axis.
- crval(header: Header) Quantity
CRVAL{axis} value at reference point in CTYPE{`axis} unit.
- Args:
header: Header to extract value from.
- Returns:
Value as astropy Quantity.
- ctype(header: Header) str
CTYPE{axis} unit type of axis.
This is just a str, not an astropy unit-name.
- Args:
header: Header to extract unit from.
- Returns:
Unit as str.
- naxis(header: Header) int
NAXIS{axis} length of axis.
- Args:
header: Header to extract length from.
- Returns:
Length of axis.
- unit: UnitBase
- class ObsCoreMeta(dataproduct_type: Literal['image', 'cube', 'spectrum', 'sed', 'timeseries', 'visibility', 'event', 'measurements'] | None = None, dataproduct_subtype: str | None = None, calib_level: Literal[0, 1, 2, 3, 4] | None = None, obs_collection: str | None = None, obs_id: str | None = None, obs_publisher_did: str | None = None, obs_title: str | None = None, obs_creator_did: str | None = None, target_class: str | None = None, access_url: str | None = None, access_format: str | None = None, access_estsize: int | None = None, target_name: str | None = None, s_ra: float | None = None, s_dec: float | None = None, s_fov: float | None = None, s_region: str | None = None, s_resolution: float | None = None, s_xel1: int | None = None, s_xel2: int | None = None, s_pixel_scale: float | None = None, t_min: float | None = None, t_max: float | None = None, t_exptime: float | None = None, t_resolution: float | None = None, t_xel: int | None = None, em_min: float | None = None, em_max: float | None = None, em_res_power: float | None = None, em_xel: int | None = None, em_ucd: str | None = None, o_ucd: str | None = None, pol_states: str | None = None, pol_xel: int | None = None, facility_name: str | None = None, instrument_name: str | None = None)
Bases:
object
IVOA ObsCore v1.1 metadata (TAP column names).
This doesn’t describe a full ObsCoreDM, but the mandatory and the non-mandatory fields defined in the SRCNet Rucio database. The actual JSON to send to a specific ObsTAP service has to be created by yourself.
The args-docstring provides just a rough idea of the according values. A more detailed description is provided by the ObsCore-v1.1 documentation.
- Args:
- dataproduct_type: Logical data product type (image etc.). image, cube,
spectrum, sed, timeseries, visibility, event or measurements.
- dataproduct_subtype: Data product specific type defined by the ObsTAP provider.
This is not a useful value for global discovery, but within an archive.
- calib_level: Calibration level {0, 1, 2, 3, 4} (mandatory).
0: Raw instrumental data.
1: Instrumental data in a standard format (FITS, VOTable, etc.)
2: Calibrated, science ready measurements without instrument signature.
- 3: Enhanced data products like mosaics, drizzled images or heavily
processed survey fields. May represent a combination of data from multiple primary obs.
4: Analysis data products generated after scientific data manipulation.
- obs_collection: Name of the data collection (mandatory). Either registered
shortname, full registered IVOA identifier or a data provider defined shortname. Often used pattern: <facility-name>/<instrument-name>.
- obs_id: Observation ID (mandatory).
All data-products from a single observation should share the same obs_id. This is just a unique str-ID with no form. Must be unique to a provider.
- obs_publisher_did: Dataset identifier given by the publisher (mandatory).
IVOA dataset identifier. Must be a unique value within the namespace controlled by the dataset publisher (data center). ObsCoreMeta.get_ivoid may help creating this value.
obs_title: Brief description of dataset in free format.
obs_creator_did: IVOA dataset identifier given by the creator.
- target_class: Class of the target/object as in SSA.
Either SIMBAD-DB (see https://simbad.cds.unistra.fr/guide/otypes.htx Object type code), OR NED-DB types (see https://ned.ipac.caltech.edu/help/ui/nearposn-list_objecttypes).
access_url: URL used to access (download) dataset.
access_format: File content format (MIME type) (fits, jpeg, zip, etc.).
access_estsize: [kbyte] Estimated size of dataset from access_url.
- target_name: Astronomical object observed, if any. This is typically the name
of an astronomical object, but could be the name of a survey field.
s_ra: [deg] Central right ascension, ICRS.
s_dec: [deg] Central declination, ICRS.
- s_fov: [deg] Region covered by the data product. For a circular region, this
is the diameter. For most data products, the value should be large enough to include the entire area of the observation. For detailed spatial coverage, the s_region attribute can be used.
- s_region: Sky region covered by the data product (expressed in ICRS frame).
It’s a ‘spoly` (spherical polygon) type, which is described in https://pgsphere.github.io/doc/funcs.html#funcs.spoly. Use spoly, scircle or spoint to create the formatted str. E.g. for spoly: {(204.712d,+47.405d),(204.380d,+48.311d),(202.349d,+49.116d), (200.344d,+48.458d),(199.878d,+47.521d),(200.766d,+46.230d), (202.537d,+45.844d),(204.237d,+46.55d)}.
- s_resolution: [arcsec] Smallest resolvable spatial resolution of data as FWHM.
If spatial frequency sampling is complex (e.g. interferometry), a typical value for spatial resolution estimate should be given.
s_xel1: Number of elements along the first spatial axis.
s_xel2: Number of elements along the second spatial axis.
- s_pixel_scale: Sampling period in world coordinate units along the spatial axis.
It’s the distance in WCS units between two pixel centers.
t_min: [d] Observation start time in Modified Julian Day (MJD).
t_max: [d] Observation stop time in Modified Julian Day (MJD).
- t_exptime: [s] Total exposure time. For simple exposures: t_max - t_min.
For data where the exposure is not constant over the entire data product, the median exposure time per pixel is a good way to characterize the typical value.
- t_resolution: [s] Minimal interpretable interval between two points along time.
This can be an average or representative value. For products with no sampling along the time axis, it could be set to exposure time or null.
t_xel: Number of elements along the time axis.
em_min: [m] Minimal spectral value observed, expressed as a vacuum wavelength.
em_max: [m] Maximum spectral value observed, expressed as a vacuum wavelength.
em_res_power: Spectral resolving power λ / δλ.
em_xel: Number of elements along the spectral axis.
- em_ucd: Nature of the spectral axis. This is an em (electromagnetic spectrum)
UCD (UCD-string see o_ucd), e.g. em.freq, em.wl or em.energy. Note: For ObsTAP implementation, the spectral axis coordinates are constrained as a wavelength quantity expressed in meters.
- o_ucd: UCD (semantic annotation(s)) of observable (e.g. phot.flux.density).
A UCD is a string containing ; separated words, which can be separated into atoms. The UCD-list is evolving over time and far too extensive to describe here. Please have a look at the recommended version of IVOA UCDlist document at https://www.ivoa.net/documents/index.html.
- pol_states: List of polarization states or NULL if not applicable.
Allowed: I, Q, U, V, RR, LL, RL, LR, XX, YY, XY, YX, POLI, POLA.
pol_xel: Number of polarization samples in pol_states.
facility_name: Name of the facility used for this observation.
instrument_name: Name of the instrument used for this observation.
- access_estsize: int | None = None
- access_format: str | None = None
- access_url: str | None = None
- calib_level: Literal[0, 1, 2, 3, 4] | None = None
- check_ObsCoreMeta(*, verbose: bool = False) bool
Checks whether ObsCoreMeta is ready for serialization.
This doesn’t perform a full check if all field-values are valid. Currently supported checks: - Presence of mandatory fields - Polarization fields - Axes fields
- Args:
verbose: Verbose?
- Returns:
True if ready, else False.
- dataproduct_subtype: str | None = None
- dataproduct_type: Literal['image', 'cube', 'spectrum', 'sed', 'timeseries', 'visibility', 'event', 'measurements'] | None = None
- em_max: float | None = None
- em_min: float | None = None
- em_res_power: float | None = None
- em_ucd: str | None = None
- em_xel: int | None = None
- facility_name: str | None = None
- classmethod from_image(img: Image, *, fits_axes: FitsHeaderAxes | None = None) Self
Update fields from Image.
- This function may not adjust each field for your needs. In addition, there
is no possibility to fill some mandatory fields because there is just no information available. Thus, you have to take care of some fields by yourself.
- Note: This function assumes the presence of NAXIS, CRPIX, CRVAL & CDELT
for each axis-number specified in fits_axes to be present and correctly specified for your .fits file in img. Otherwise, this function might fail or produce corrupt values.
- Args:
img: Image instance. fits_axes: FitsAxes instance to specify axis-number and according unit
to extract and transform information from the .fits file of img correctly.
- Returns:
ObsCoreMeta instance.
- classmethod from_visibility(vis: Visibility, *, calibrated: bool | None = None, tel: Telescope | None = None, obs: Observation | None = None) Self
Suggests fields from Visibility.
This function may not adjust each field for your needs. In addition, there is no possibility to fill all mandatory fields because there is just no information available. Thus, you have to take care of some fields by yourself.
- Supported formats: CASA Measurement Sets & OSKAR-vis binary. CASA MS format
is preferred since it provides more metadata information compared to OSKAR binaries.
- Args:
vis: Visibility instance. calibrated: Calibrated visibilities? tel: Telescope to determine smallest spatial resolution. This parameter
has just an effect if the underlying vis-format of vis is an OSKAR-vis binary.
- obs: Observation to determine smallest spatial resolution. This
parameter has just an effect if the underlying vis-format of vis is an OSKAR-vis binary.
- Returns:
ObsCoreMeta instance.
- classmethod get_ivoid(*, authority: str, path: str | None, query: str | None, fragment: str | None) str
Gets the IVOA identifier for ObsCoreMeta.obs_creator_did.
- IVOID according to IVOA ‘REC-Identifiers-2.0’. Do NOT specify RFC 3986
delimiters in the input-args, they’re added automatically.
Please set up an Issue if this is not up-to-date anymore.
- Args:
- authority: Organization (usually a data provider) that has been granted
the right by the IVOA to create IVOA-compliant identifiers for resources it registers.
- path: Resource key. It’s ‘a resource that is unique within the namespace
of an authority identifier.
query: According to RFC 3986. fragment: According to RFC 3986.
- Returns:
IVOID.
- get_pol_states() List[Literal['I', 'Q', 'U', 'V', 'RR', 'LL', 'RL', 'LR', 'XX', 'YY', 'XY', 'YX', 'POLI', 'POLA']] | None
Parses the polarization states to _PolStatesListType.
- Returns:
List of polarization states if field-value is not None.
- instrument_name: str | None = None
- o_ucd: str | None = None
- obs_collection: str | None = None
- obs_creator_did: str | None = None
- obs_id: str | None = None
- obs_publisher_did: str | None = None
- obs_title: str | None = None
- pol_states: str | None = None
- pol_xel: int | None = None
- s_dec: float | None = None
- s_fov: float | None = None
- s_pixel_scale: float | None = None
- s_ra: float | None = None
- s_region: str | None = None
- s_resolution: float | None = None
- s_xel1: int | None = None
- s_xel2: int | None = None
- classmethod scircle(point: tuple[float, float], radius: float, *, ndigits: int = 3, suffix: str = 'd') str
Converts point & radius to scircle str for s_region.
scircle: https://pgsphere.github.io/doc/funcs.html
E.g. <(0d,90d),60d>
- Args:
point: RA,DEC [deg] point. radius: Radius [deg]. ndigits: Number of digits to round. suffix: Suffix for each number (e.g. “d” for deg).
- Returns:
scircle str.
- set_fields(**kwargs: Any) None
Set fields from kwargs if they’re valid.
- Args:
kwargs: Field names and values to set.
- set_pol_states(pol_states: List[Literal['I', 'Q', 'U', 'V', 'RR', 'LL', 'RL', 'LR', 'XX', 'YY', 'XY', 'YX', 'POLI', 'POLA']] | List[int] | None) None
Sets pol_states from a pythonic interface to a str according to ObsCore.
Overwrites if pol_states already exists.
- Args:
pol_states: Polarization states.
- classmethod spoint(point: tuple[float, float], *, ndigits: int = 3, suffix: str = 'd') str
Converts point to spoint str for s_region.
spoint: https://pgsphere.github.io/doc/funcs.html
E.g. (10d,20d)
- Args:
point: RA,DEC [deg] point. ndigits: Number of digits to round. suffix: Suffix for each number (e.g. “d” for deg).
- Returns:
spoint str.
- classmethod spoly(poly: Sequence[tuple[float, float]], *, ndigits: int = 3, suffix: str = 'd') str
Converts poly to spoly str for s_region.
spoly: https://pgsphere.github.io/doc/funcs.html
E.g. {(0,0),(1,0),(1,1)}
- Args:
args: Consecutive RA,DEC [deg] poly tuples. ndigits: Number of digits to round. suffix: Suffix for each number (e.g. “d” for deg).
- Returns:
spoly str.
- t_exptime: float | None = None
- t_max: float | None = None
- t_min: float | None = None
- t_resolution: float | None = None
- t_xel: int | None = None
- target_class: str | None = None
- target_name: str | None = None
- to_dict(fpath: Path | str | None = None, *, ignore_none: bool = True) Dict[str, Any]
Converts this dataclass into a dict.
- Args:
fpath: File-path to write dump. ignore_none: Ignore non-mandatory None fields?
- Returns:
Dataclass as dict.
karabo.data.src module
- class RucioMeta(namespace: str, name: str, lifetime: int, dataset_name: str | None = None, meta: Dict[str, Any] | ObsCoreMeta | None = None)
Bases:
object
Metadata dataclass to handle SKA SRC Ingestion for Rucio.
- This dataclass may go through some changes in the future in case
the Rucio service is also changing.
See https://gitlab.com/ska-telescope/src/ska-src-ingestion/-/tree/main.
- Args:
namespace: The Rucio scope in which the new file should be located.
- name: The name of the file within Rucio - the scope:name together is the
Data Identifier (DID).
lifetime: The lifetime in seconds for the new file to be retained.
- dataset_name: The Rucio dataset name the file will be attached to.
The dataset scope will be the same as that specified in namespace.
- meta: An object containing science metadata fields, which will be set against
the ingested file. This should be either a dict of ObsCoreMeta or an instance of ObsCoreMeta.
- dataset_name: str | None = None
- classmethod get_ivoid(*, authority: str = 'test.skao', path: str = '/~', namespace: str, name: str, fragment: str | None = None) str
Gets the IVOA identifier for ObsCoreMeta.obs_creator_did.
- SRCNet Rucio IVOID according to IVOA ‘REC-Identifiers-2.0’. Do NOT specify
RFC 3986 delimiters in the input-args, they’re added automatically.
Please set up an Issue if this is not up-to-date anymore.
- Args:
- authority: Organization (usually a data provider) that has been granted
the right by the IVOA to create IVOA-compliant identifiers for resources it registers.
- path: Resource key. It’s ‘a resource that is unique within the namespace
of an authority identifier.
namespace: RucioMeta.namespace. name: RucioMeta.name (filename in Rucio). fragment: According to RFC 3986.
- Returns:
IVOID.
- classmethod get_meta_fname(fname: TFilePathType) TFilePathType
Gets the metadata-filename of fname.
- It’s according to the Rucio metadata specification (if up-to-date). The
specification states that metadata is expected to be provided by two files: fname: data_name and metadata: data_name.<metadata_suffix>, where the suffix is set to meta.
- Args:
fname: Filename to create metadata filename from.
- Returns:
Metadata filename (or filepath if fname was also a filepath).
- lifetime: int
- meta: Dict[str, Any] | ObsCoreMeta | None = None
- name: str
- namespace: str
- to_dict(fpath: Path | str | None = None, *, ignore_none: bool = True) Dict[str, Any]
Converts this dataclass into a dict.
- Args:
- fpath: File-path to write dump. Consider using get_meta_fname
to get an fpath according to the Rucio specification.
ignore_none: Ignore None fields?
- Returns:
Dataclass as dict.