spinifex.h5parm_tools
Functions
|
helper function to generate arrays of station names and positions |
|
|
|
Add antenna metadata to a solset |
|
Add asolution table to an existing solset |
|
Add source metadata to a solset |
|
Check if given h5file is suitable as h5parm |
|
create an empty h5parm file |
|
Create new empty solset in your h5parm file. A solset has an antenna and source table. Default name is sol###" |
|
Find the best name for your new solset in an h5parm file. Default name is sol### |
|
Find the best name for your new soltab in an h5parm file. Default name is [soltab_type]### |
|
writes a dictionary of RM values per station to a new or existing h5parm file |
|
writes a dictionary of RM values per station to a new or existing h5parm file |
Module Contents
- spinifex.h5parm_tools._get_station_metadata(rms: dict[str, Any]) tuple[list[Any], list[Any]][source]
helper function to generate arrays of station names and positions
Parameters
- rmsdict[RM|DTEC]
dictionary with RM object per station
Returns
- tuple
station_names and station_positions (ITRF xyz)
- spinifex.h5parm_tools.add_antenna_info(solset: h5py.Dataset, antenna_names: numpy.typing.NDArray[numpy.floating[Any]], antenna_pos: numpy.typing.NDArray[numpy.floating[Any]]) None[source]
Add antenna metadata to a solset
Parameters
- solseth5py.Dataset
A solset in an h5parm
- antenna_namesNDArray[np.floating[Any]]
array with antenna names
- antenna_posNDArray[np.floating[Any]]
array ant x 3 with ITRF antenna positions
- spinifex.h5parm_tools.add_soltab(solset: h5py.Dataset, soltab_type: str, val: numpy.typing.NDArray[numpy.floating[Any]], weight: numpy.typing.NDArray[numpy.floating[Any]], soltab_axes: list[Any], axes_values: dict[str, Any], soltab_name: str | None = None) h5py.Dataset[source]
Add asolution table to an existing solset
Parameters
- solseth5py.Dataset
solset
- soltab_typestr
type of the solutions
- valNDArray[np.floating[Any]]
array with solutions values, must match the shape of the axes
- weightNDArray[np.floating[Any]]
array of weights, must match the shape of val
- soltab_axeslist
ordered list of axes as they are defined for val/wegiht
- axes_valuesdict[Any]
dictionary with the values for each axis in soltab_axes
- soltab_namestr|None, optional
name of the solution table, if None or existing will default to <soltab_type>###, by default None
Returns
- h5py.Dataset
the solution table
- spinifex.h5parm_tools.add_source_info(solset: h5py.Dataset, source_names: numpy.typing.NDArray[numpy.str_], source_dirs: numpy.typing.NDArray[numpy.floating[Any]]) None[source]
Add source metadata to a solset
Parameters
- solseth5py.Dataset
A solset in an h5parm
- source_namesNDArray[np.str_]
array with source names
- source_dirsNDArray[np.floating[Any]]
array source x 2 with Ra,DEC directions of the sources
- spinifex.h5parm_tools.check_h5parm(h5file: h5py.File) bool[source]
Check if given h5file is suitable as h5parm
Parameters
- h5fileh5py.File
possible h5parm file
Returns
- bool
True if the file is conform h5parm definition
- spinifex.h5parm_tools.create_empty_h5parm(h5parm_name: str) None[source]
create an empty h5parm file
Parameters
- h5parm_namestr
name of the file
Raises
- TypeError
error if h5parm_name is existing and not a valid h5parm
- spinifex.h5parm_tools.create_solset(h5file: h5py.File, solset_name: str | None = None) h5py.Dataset[source]
Create new empty solset in your h5parm file. A solset has an antenna and source table. Default name is sol###”
Parameters
- h5fileh5py.File
the h5parm file, must be writable
- solset_namestr, optional
name of the solset, if None the first available from sol### will be used, by default None
Returns
- h5py.Dataset
pointer to the new solset
- spinifex.h5parm_tools.get_minimal_solset_name(h5file: h5py.File) str[source]
Find the best name for your new solset in an h5parm file. Default name is sol###
Parameters
- h5fileh5py.File
the h5parm file
Returns
- str
frst available name for the solset
- spinifex.h5parm_tools.get_minimal_soltab_name(solset: h5py.Dataset, soltab_type: str) str[source]
Find the best name for your new soltab in an h5parm file. Default name is [soltab_type]###
Parameters
- solseth5py.Dataset
the solset in an h5parm
- soltab_typestr
type of the solution table
Returns
- str
frst available name for the soltab
- spinifex.h5parm_tools.write_rm_to_h5parm(rms: dict[str, spinifex.get_rm.RM], h5parm_name: str, solset_name: str | None = None, soltab_name: str | None = None, add_to_existing_solset: bool = False) None[source]
writes a dictionary of RM values per station to a new or existing h5parm file
Parameters
- rmsdict[RM]
rm values per station
- h5parm_namestr
name of the h5parm file
- solset_namestr | None, optional
name of the solset if None it will default to sol###, by default None
- soltab_namestr | None, optional
name of the soltab if None it will default to ‘rotationmeasure###’
- add_to_existing_solsetbool = False
whether to append to an existing solset, if it exists. If True, the user is responsible for having consistent antennas and sources.
Raises
- TypeError
error if h5parm_name is existing and not a valid h5parm
- spinifex.h5parm_tools.write_tec_to_h5parm(dtec: dict[str, spinifex.get_dtec.DTEC], h5parm_name: str, solset_name: str | None = None, soltab_name: str | None = None, add_to_existing_solset: bool = False) None[source]
writes a dictionary of RM values per station to a new or existing h5parm file
Parameters
- dtecdict[DTEC]
electron density profiles per station
- h5parm_namestr
name of the h5parm file
- solset_namestr | None, optional
name of the solset if None it will default to sol###, by default None
- soltab_namestr | None, optional
name of the soltab if None it will default to ‘rotationmeasure###’
- add_to_existing_solsetbool = False
whether to append to an existing solset, if it exists. If True, the user is responsible for having consistent antennas and sources.
Raises
- TypeError
error if h5parm_name is existing and not a valid h5parm