Mondaic
This API reference is not for the latest stable Salvus version.

salvus.flow.simple_config.receiver.cartesian

Receivers in a cartesian reference system.

Functions

parse()

def parse(
    dict_receivers: Union[List[Dict], Dict]
) -> Sequence[
    Union[
        salvus.flow.simple_config.receiver.cartesian.Point2D,
        salvus.flow.simple_config.receiver.cartesian.Point3D,
    ]
]:
    ...

Parse a dictionary or a list of dictionaries to receiver objects.

Parameters
  • dict_receivers Union[List[Dict], Dict] — Parse a list of receivers (or just a single receivers) as a dictionary to the proper objects.
Returns Sequence[Union[salvus.flow.simple_config.receiver.cartesian.Point2D, salvus.flow.simple_config.receiver.cartesian.Point3D]]

Classes

Point2D

class Point2D(salvus.flow.simple_config.receiver._BaseReceiver):
    def __init__(
        self,
        x: float,
        y: float,
        network_code: str = "XX",
        station_code: str,
        location_code: str = "",
        fields: List[str],
    ):
        ...

Receiver in a 2-D Cartesian domain.

Initialize the spatial locations and metadata.

Parameters
  • x float — X-coordinate of receiver.
  • y float — Y-coordinate of receiver.
  • network_code str — Network code.
  • station_code str — Station code.
  • location_code str — Location code.
  • fields List[str] — Fields to record.
Attributes
name str

Full receiver name as NETWORK_CODE.STATION_CODE.LOCATION_CODE.

Methods
from_json()
def from_json(d: Dict, skip_validation: bool = False) -> _BaseReceiver:
    ...

Initialize a receiver object from a dictionary.

Parameters
  • d Dict — Dictionary containing the init parameters and a few other things.
  • skip_validation bool — For the cartesian Point2D and Point3D this method contains a special fast implementation that skips all validation steps. Useful for reading large quantities of pre-validated receivers.
Returns _BaseReceiver
apply()
def apply(self, d: Union[Dict, _DeepSetter]) -> None:
    ...

Set the contents with a dictionary.

Parameters
  • d Union[Dict, _DeepSetter] — The dictionary to set.
Returns None
copy()
def copy(self) -> _DeepSetter:
    ...

Return a deep copy of the object.

Returns _DeepSetter
get_dictionary()
def get_dictionary(self) -> Dict:
    ...

Get the contents of this object as a dictionary.

Returns Dict
to_json()
def to_json(self, external_file_hash: Optional[str] = None) -> Dict:
    ...

Serialize the object to dictionary that can be written to JSON.

Parameters
  • external_file_hash Optional[str] — Hash of any external files associated with this object. Can be passed here in which case it will be stored in a centralized location in the JSON file.
Returns Dict
validate()
def validate(self) -> None:
    ...

Validates the current state of the configuration against its schema.

Returns None

Point3D

class Point3D(salvus.flow.simple_config.receiver._BaseReceiver):
    def __init__(
        self,
        x: float,
        y: float,
        z: float,
        network_code: str = "XX",
        station_code: str,
        location_code: str = "",
        fields: List[str],
    ):
        ...

Receiver in a 3-D Cartesian domain.

Initialize the spatial locations and metadata.

Parameters
  • x float — X-coordinate of receiver.
  • y float — Y-coordinate of receiver.
  • z float — Z-coordinate of receiver.
  • network_code str — Network code.
  • station_code str — Station code.
  • location_code str — Location code.
  • fields List[str] — Fields to record.
Attributes
name str

Full receiver name as NETWORK_CODE.STATION_CODE.LOCATION_CODE.

Methods
from_json()
def from_json(d: Dict, skip_validation: bool = False) -> _BaseReceiver:
    ...

Initialize a receiver object from a dictionary.

Parameters
  • d Dict — Dictionary containing the init parameters and a few other things.
  • skip_validation bool — For the cartesian Point2D and Point3D this method contains a special fast implementation that skips all validation steps. Useful for reading large quantities of pre-validated receivers.
Returns _BaseReceiver
apply()
def apply(self, d: Union[Dict, _DeepSetter]) -> None:
    ...

Set the contents with a dictionary.

Parameters
  • d Union[Dict, _DeepSetter] — The dictionary to set.
Returns None
copy()
def copy(self) -> _DeepSetter:
    ...

Return a deep copy of the object.

Returns _DeepSetter
get_dictionary()
def get_dictionary(self) -> Dict:
    ...

Get the contents of this object as a dictionary.

Returns Dict
to_json()
def to_json(self, external_file_hash: Optional[str] = None) -> Dict:
    ...

Serialize the object to dictionary that can be written to JSON.

Parameters
  • external_file_hash Optional[str] — Hash of any external files associated with this object. Can be passed here in which case it will be stored in a centralized location in the JSON file.
Returns Dict
validate()
def validate(self) -> None:
    ...

Validates the current state of the configuration against its schema.

Returns None

SideSetHorizontalPointCollection2D

class SideSetHorizontalPointCollection2D(
    salvus.flow.simple_config.receiver.cartesian._CartesianSideSet2DLine
):
    def __init__(
        self,
        x: Union[List[float], numpy.ndarray],
        offset: float = 0.0,
        side_set_name: str,
        network_code: str = "XX",
        station_code: str,
        location_code: str = "",
        fields: List[str],
    ):
        ...

Specialized version of CartesianSideSetReceiver2D only requiring one or more x coordinates and a side set.

It will vertically project the receiver up or down along the y-axis until it finds the intersection with the given side set.

The station codes will be suffixed by 0…N, thus a station code of “AB” would turn into “AB0” to “ABN”.

Parameters
  • x Union[List[float], numpy.ndarray] — x coordinates.
  • offset float — Offset the final receivers along the y-axis. Allows placing receivers above/below side sets.
  • side_set_name str — Name of the side set at which to attach the receivers.
  • network_code str — Network code.
  • station_code str — Station code.
  • location_code str — Location code.
  • fields List[str] — Fields to record.
Methods
to_list()
def to_list(self) -> List[salvus.flow.simple_config.receiver._Base]:
    ...

Convert to a list of receivers.

Returns List[salvus.flow.simple_config.receiver._Base]

SideSetPoint2D

class SideSetPoint2D(
    salvus.flow.simple_config.side_set_base._SideSetBase,
    salvus.flow.simple_config.receiver._SideSetReceiver,
):
    def __init__(
        self,
        point: numpy.ndarray,
        direction: Union[numpy.ndarray, str],
        offset: float = 0.0,
        side_set_name: str,
        network_code: str = "XX",
        station_code: str,
        location_code: str = "",
        fields: List[str],
    ):
        ...

Cartesian side set receiver in 2D.

The intersection between the specified line and the side set in the mesh will be the location of the receiver. The line is specified by a point and a direction.

If the line intersects the side set multiple times, the closest intersection to the specified point will be chosen, assuming all intersections are in different elements. If multiple intersections occur within one element the gradient based optimization will only manage to find one. Please choose a different line in that case.

This will be evaluated at the time it is added to a simulation object as it needs access to a mesh.

Parameters
  • point numpy.ndarray — A point on the line.
  • direction Union[numpy.ndarray, str] — The direction from the point finishing the definition of the line. Can be specified either as a 2D vector or as a string containing "x" or "y", denoting the coordinate axes.
  • offset float — Offset the final receiver along the chosen direction. Allows placing receivers above/below side sets.
  • side_set_name str — The name of the side set to intersect the line with.
  • network_code str — Network code.
  • station_code str — Station code.
  • location_code str — Location code.
  • fields List[str] — Fields to record.
Attributes
name str

Full receiver name as NETWORK_CODE.STATION_CODE.LOCATION_CODE.

Methods
from_json()
def from_json(d: Dict) -> Any:
    ...

Recreate the object from a dictionary serialization of its initialization parameters.

Parameters
  • d Dict — Dictionary containing its init parameters and a few other things.
Returns Any
to_json()
def to_json(self, external_file_hash: Optional[str] = None) -> Dict:
    ...

Serialize the object to dictionary that can be written to JSON.

Parameters
  • external_file_hash Optional[str] — Hash of any external files associated with this object. Can be passed here in which case it will be stored in a centralized location in the JSON file.
Returns Dict

SideSetPoint3D

class SideSetPoint3D(
    salvus.flow.simple_config.side_set_base._SideSetBase,
    salvus.flow.simple_config.receiver._SideSetReceiver,
):
    def __init__(
        self,
        point: numpy.ndarray,
        direction: Union[numpy.ndarray, str],
        offset: float = 0.0,
        side_set_name: str,
        network_code: str = "XX",
        station_code: str,
        location_code: str = "",
        fields: List[str],
    ):
        ...

Cartesian side set receiver in 3D.

The intersection between the specified line and the side set in the mesh will be the location of the receiver. The line is specified by a point and a direction.

If the line intersects the side set multiple times, the closest intersection to the specified point will be chosen, assuming all intersections are in different elements. If multiple intersections occur within one element the gradient based optimization will only manage to find one. Please choose a different line in that case.

This will be evaluated at the time it is added to a simulation object as it needs access to a mesh.

Parameters
  • point numpy.ndarray — A point on the line.
  • direction Union[numpy.ndarray, str] — The direction from the point finishing the definition of the line. Can be specified either as a 3D vector or as a string containing "x", "y", or "z", denoting the coordinate axes.
  • offset float — Offset the final receiver along the chosen direction. Allows placing receivers above/below side sets.
  • side_set_name str — The name of the side set to intersect the line with.
  • network_code str — Network code.
  • station_code str — Station code.
  • location_code str — Location code.
  • fields List[str] — Fields to record.
Attributes
name str

Full receiver name as NETWORK_CODE.STATION_CODE.LOCATION_CODE.

Methods
from_json()
def from_json(d: Dict) -> Any:
    ...

Recreate the object from a dictionary serialization of its initialization parameters.

Parameters
  • d Dict — Dictionary containing its init parameters and a few other things.
Returns Any
to_json()
def to_json(self, external_file_hash: Optional[str] = None) -> Dict:
    ...

Serialize the object to dictionary that can be written to JSON.

Parameters
  • external_file_hash Optional[str] — Hash of any external files associated with this object. Can be passed here in which case it will be stored in a centralized location in the JSON file.
Returns Dict

SideSetVerticalPointCollection2D

class SideSetVerticalPointCollection2D(
    salvus.flow.simple_config.receiver.cartesian._CartesianSideSet2DLine
):
    def __init__(
        self,
        y: Union[List[float], numpy.ndarray],
        offset: float = 0.0,
        side_set_name: str,
        network_code: str = "XX",
        station_code: str,
        location_code: str = "",
        fields: List[str],
    ):
        ...

Specialized version of CartesianSideSetReceiver2D only requiring one or more y coordinates and a side set.

It will horizontally project the receiver left or right along the x-axis until it finds the intersection with the given side set.

The station codes will be suffixed by 0…N, thus a station code of “AB” would turn into “AB0” to “ABN”.

Parameters
  • y Union[List[float], numpy.ndarray] — y coordinates.
  • offset float — Offset the final receivers along the y-axis. Allows placing receivers above/below side sets.
  • side_set_name str — Name of the side set at which to attach the receivers.
  • network_code str — Network code.
  • station_code str — Station code.
  • location_code str — Location code.
  • fields List[str] — Fields to record.
Methods
to_list()
def to_list(self) -> List[salvus.flow.simple_config.receiver._Base]:
    ...

Convert to a list of receivers.

Returns List[salvus.flow.simple_config.receiver._Base]

Submodules