FoldOptLib.helper package¶
Submodules¶
FoldOptLib.helper.utils module¶
- FoldOptLib.helper.utils.axial_plane_stereonet(strike, dip)[source]¶
Calculate the axial plane in a stereonet given the strike and dip angles. credit: https://mplstereonet.readthedocs.io/en/latest/examples/axial_plane.html
Parameters: strike (np.ndarray): The strike angles in degrees. dip (np.ndarray): The dip angles in degrees.
Returns: tuple: The axial strike and dip angles in degrees.
- FoldOptLib.helper.utils.calculate_intersection_lineation(axial_surface, folded_foliation)[source]¶
Calculate the intersection lineation of the axial surface and the folded foliation.
Parameters: axial_surface (np.ndarray): The normal vector of the axial surface. folded_foliation (np.ndarray): The normal vector of the folded foliation.
Returns: np.ndarray: The normalised intersection lineation vector.
- FoldOptLib.helper.utils.calculate_semivariogram(fold_frame, fold_rotation, lag=None, nlag=None)[source]¶
- FoldOptLib.helper.utils.create_dataset(vec: ndarray, points: ndarray, name: str = 's0', coord: int = 0) DataFrame [source]¶
Make a dataset from one unit vector and xyz points of the folded feature data.
- Parameters:
vec (np.ndarray) – The unit vector to be used as the gradient.
points (np.ndarray) – The xyz coordinates of the data points.
name (str, optional) – The name of the feature, by default ‘s0’.
coord (int, optional) – The coordinate, by default 0.
- Returns:
A DataFrame where each row represents a data point with its coordinates (X, Y, Z), gradient (gx, gy, gz), feature name, and coordinate.
- Return type:
pd.DataFrame
- FoldOptLib.helper.utils.create_dict(x=None, y=None, z=None, strike=None, dip=None, feature_name=None, coord=None, **kwargs)[source]¶
- FoldOptLib.helper.utils.create_gradient_dict(x=None, y=None, z=None, nx=None, ny=None, nz=None, feature_name=None, coord=None, **kwargs)[source]¶
- FoldOptLib.helper.utils.fourier_series(x, c0, c1, c2, w)[source]¶
- Parameters:
x –
c0 –
c1 –
c2 –
w –
- FoldOptLib.helper.utils.get_fold_curves(geological_feature, fold_frame=0)[source]¶
Calculate the fold axis and limb rotation angle curves of a geological feature.
Parameters: geological_feature: The geological feature to calculate the fold rotation angle curves for. fold_frame (optional): The fold frame coordinate to use, default 0 for fold limb rotation angle. for fold axis rotation angle use 1. If not provided, the function will use a default axis.
Returns: tuple: The x values and the corresponding fold curve values.
- FoldOptLib.helper.utils.normal_vector_to_strike_and_dip(normal_vector)[source]¶
Calculate the strike and dip angles given a normal vector.
Parameters: normal_vector (np.ndarray): The normal vector.
Returns: np.ndarray: The strike and dip angles in degrees.
- FoldOptLib.helper.utils.rotate_vector(v, angle, dimension=2)[source]¶
Rotate a vector by a given angle around the origin using a rotation matrix. :param v: The vector to rotate. :type v: ndarray :param angle: The angle to rotate the vector by in radians. :type angle: float :param dimension: The dimension of the vector (2 or 3). Default is 2. :type dimension: int
- Returns:
The rotated vector.
- Return type:
ndarray
- FoldOptLib.helper.utils.save_load_object(obj=None, file_path=None, mode='save')[source]¶
Saves or loads a python object to/from a file using the dill library.
Parameters: obj (Any, optional): The python object to be saved. file_path (str, optional): The file path where the object should be saved or loaded from. mode (str, optional): The mode of operation. Must be either ‘save’ or ‘load’. Defaults to ‘save’.
Returns: Any: The loaded python object, if mode is set to ‘load’. None: Otherwise.
Raises: ValueError: If mode is not set to either ‘save’ or ‘load’.