PGA module

class PGA.AffineTransformPerturbation(grid, values, centers, lengthscale, noise_func, noise_params)

Bases: object

generate_from_coef(x, coef)
generate_perturbed_curves(x, n)
rbf(x)
class PGA.Grassmann_PGAspace(Vh, M_mean, b_mean, karcher_mean, t)

Bases: object

PGA2gr_shape(pga_coord, original_shape_gr=None)
PGA2shape(pga_coord, M=None, b=None, original_shape_gr=None)
classmethod create_from_dataset(phys_shapes, n_modes=None, method='SPD')

Create PGA space by using the dataset of shapes and performing PGA.

Parameters:
  • phys_shapes – (n_shapes, n_landmarks, ndim) array of dataset of shapes

  • n_modes – dimensions of trancated PGA space, defaults to None (using full dimension)

  • method – _description_, defaults to ‘SPD’

Returns:

_description_

generate_perturbed_blade(blade, n_modes=None, coef=None, n=1)

Generates perturbed blades.

If coef are sampled (not given) checks for intersection in generated shape and resample if needed.

Parameters:
  • blade – array of grassmann shapes for baseline blade

  • n_modes – dimensions of trancated PGA space, defaults to None (using full dimension)

  • coef – perturbation coefficients (sampled if not given)

  • n – number of perturbations (if need to sample)

Returns:

array of perturbed blades (in grassmann coordinates) (shape=(n, n_shapes, n_landmarks, 2)) and array of PGA corresponding to perturbations (n, n_modes)

generate_perturbed_shapes(n_modes=None, n=1)

Samples PGA coefficients and corresponding shapes.

Coef are randomly sampled and shapes are checked for self-intersection and resample if needed.

Parameters:
  • n_modes – dimensions of trancated PGA space, defaults to None (using full dimension)

  • n – number of perturbed shapes, (defualt n=1)

Returns:

array of generated perturbed shapes (n, n_landmarks, 2) in physical space array of grassmann shapes (n, n_landmarks, 2) array of PGA coordinates corresponding to perturbations (n, n_modes)

gr_shapes2PGA(shapes_gr)
classmethod load_from_file(filename, n_modes=None)

Loading PGA space from the .npz file. Can load trancated space (n dimensions defined by n_modes)

Parameters:
  • filename – path to the file

  • n_modes – dimensions of trancated PGA space, defaults to None (using full dimension)

Returns:

PGA_space class instance

sample_coef(n_modes, n_samples=1)
save_to_file(filename)
shapes2PGA(shapes, method='SPD', n_modes=None)
class PGA.NoiseFunc(noise_func, noise_params)

Bases: object

ReLU(x)
ReLU_0(x)
sigmoid(x)
class PGA.SPD_PGAspace(Vh, shape_mean, b_mean, karcher_mean, t)

Bases: object

PGA2spd(pga_coord)
classmethod create_from_dataset(phys_shapes)

Create PGA space by using the dataset of shapes and performing PGA.

Parameters:
  • phys_shapes – (n_shapes, n_landmarks, ndim) array of dataset of shapes

  • n_modes – dimensions of trancated PGA space, defaults to None (using full dimension)

  • method – _description_, defaults to ‘SPD’

Returns:

_description_

classmethod load_from_file(filename, n_modes=None)

Loading PGA space from the .npz file. Can load trancated space (n dimensions defined by n_modes)

Parameters:
  • filename – path to the file

  • n_modes – dimensions of trancated PGA space, defaults to None (using full dimension)

Returns:

PGA_space class instance

recreate_data()
save_to_file(filename)
class PGA.SPD_TangentSpace(karcher_mean, t, shape_mean, b_mean)

Bases: object

classmethod create_from_dataset(phys_shapes)

Create PGA space by using the dataset of shapes and performing PGA.

Parameters:
  • phys_shapes – (n_shapes, n_landmarks, ndim) array of dataset of shapes

  • n_modes – dimensions of trancated PGA space, defaults to None (using full dimension)

  • method – _description_, defaults to ‘SPD’

Returns:

_description_

classmethod load_from_file(filename)

Loading SPD tangent space from the .npz file.

Parameters:

filename – path to the file

Returns:

SPD_TangentSpace class instance

recreate_data()
save_to_file(filename)
tan2spd(pga_coord)