tyssue.geometry package#

Submodules#

tyssue.geometry.base_geometry module#

class tyssue.geometry.base_geometry.BaseGeometry[source]#

Bases: object

static center(eptm)[source]#

Transates the epithelium vertices so that the center of mass is at the center of the coordinate system, and updates the geometry

static dist_to_point(vert_df, point, coords)[source]#

Returns the distance of all vertices from point over the coordinates

Parameters
  • vert_df (a pandas.DataFrame with the points coordinates) – in the columns given by the coords argument

  • point (a doublet (in 2D) or triplet (in 3D) giving the reference point) – coordinates

  • coords (list of 2 or 3 strings giving the column names) –

Returns

distance – as the input vert_df

Return type

a pandas.Series with the same length

static scale(sheet, delta, coords)[source]#

Scales the coordinates coords by a factor delta

static update_all(sheet)[source]#
static update_centroid(sheet)[source]#

Updates the face_df coords columns as the face’s vertices center of mass. Also updates the edge_df fx, fy, fz columns with their upcasted values

static update_dcoords(sheet)[source]#

Update the edge vector coordinates on the coords basis (default_coords by default). Modifies the corresponding columns (i.e [‘dx’, ‘dy’, ‘dz’]) in sheet.edge_df.

Also updates the upcasted coordinates of the source and target vertices

static update_length(sheet)[source]#

Updates the edge_df length column on the coords basis

static update_perimeters(sheet)[source]#

Updates the perimeter of each face.

static update_ucoords(sheet)[source]#
tyssue.geometry.base_geometry.update_periodic_dcoords(sheet)[source]#

Updates the coordinates for periodic boundary conditions.

tyssue.geometry.bulk_geometry module#

class tyssue.geometry.bulk_geometry.BulkGeometry[source]#

Bases: SheetGeometry

Geometry functions for 3D cell arangements

classmethod update_all(eptm)[source]#

Updates the eptm geometry by updating: * the edge vector coordinates * the edge lengths * the face centroids * the normals to each edge associated face * the face areas * the cell areas * the vertices heights (depends on geometry) * the face volumes (depends on geometry)

static update_areas(eptm)[source]#

Updates the normal coordniate of each (srce, trgt, face) face.

static update_centroid(eptm)[source]#

Updates the face_df coords columns as the face’s vertices center of mass. Also updates the edge_df fx, fy, fz columns with their upcasted values

static update_dcoords(eptm)[source]#

Update the edge vector coordinates on the coords basis (default_coords by default). Modifies the corresponding columns (i.e [‘dx’, ‘dy’, ‘dz’]) in sheet.edge_df.

Also updates the upcasted coordinates of the source and target vertices

static update_ucoords(eptm)[source]#
static update_vol(eptm)[source]#
static validate_face_norms(eptm)[source]#
class tyssue.geometry.bulk_geometry.ClosedMonolayerGeometry[source]#

Bases: MonolayerGeometry

classmethod update_all(eptm)[source]#

Updates the eptm geometry by updating: * the edge vector coordinates * the edge lengths * the face centroids * the normals to each edge associated face * the face areas * the cell areas * the vertices heights (depends on geometry) * the face volumes (depends on geometry)

static update_lumen_vol(eptm)[source]#
class tyssue.geometry.bulk_geometry.MonoLayerGeometry[source]#

Bases: MonolayerGeometry

class tyssue.geometry.bulk_geometry.MonolayerGeometry[source]#

Bases: RNRGeometry

static basal_apical_axis(eptm, cell)[source]#

Returns a unit vector allong the apical-basal axis of the cell

classmethod cell_projected_pos(eptm, cell, psi=0)[source]#

Returns the positions of the cell vertices transformed such that the cell center sits at the coordinate system’s origin and the basal-apical axis is the new z axis.

class tyssue.geometry.bulk_geometry.RNRGeometry[source]#

Bases: BulkGeometry

static update_centroid(eptm)[source]#

Updates the face_df coords columns as the face’s vertices center of mass. Also updates the edge_df fx, fy, fz columns with their upcasted values

tyssue.geometry.multisheetgeometry module#

class tyssue.geometry.multisheetgeometry.MultiSheetGeometry[source]#

Bases: object

Geometry class for stacked 2D sheets

classmethod update_all(msheet)[source]#
static update_heights(msheet)[source]#

tyssue.geometry.planar_geometry module#

class tyssue.geometry.planar_geometry.AnnularGeometry[source]#

Bases: PlanarGeometry

classmethod update_all(eptm)[source]#

Updates the sheet geometry by updating: * the edge vector coordinates * the edge lengths * the face centroids * the normals to each edge associated face * the face areas

static update_lumen_volume(eptm)[source]#
class tyssue.geometry.planar_geometry.PlanarGeometry[source]#

Bases: BaseGeometry

Geomtetry methods for 2D planar cell arangements

static face_projected_pos(sheet, face, psi)[source]#

returns the sheet vertices position translated to center the face face at (0, 0) and rotated in the (x, y) plane by and angle psi radians

classmethod get_phis(sheet)[source]#
classmethod update_all(sheet)[source]#

Updates the sheet geometry by updating: * the edge vector coordinates * the edge lengths * the face centroids * the normals to each edge associated face * the face areas

static update_areas(sheet)[source]#

Updates the normal coordinate of each (srce, trgt, face) face.

static update_normals(sheet)[source]#
class tyssue.geometry.planar_geometry.WeightedPerimeterPlanarGeometry[source]#

Bases: PlanarGeometry

Geometry methods for 2D planar cell arangements with a calculation of perimeter is based on weight of each junction.

Meaning if all junction of a cell have the same weight, perimeter is calculated as a usual perimeter calculation: .. math:

p = \sum_{ij} l_{ij}

Otherwise, weight parameter allowed more or less importance of a junction in the perimeter calculation .. math:

p = \sum_{ij} w_{ij} \, l_{ij}
static normalize_weights(sheet)[source]#

Normalize weight of each cell. Sum of all weights of one cell equals to one.

classmethod update_all(eptm)[source]#

Updates the sheet geometry by updating: * the edge vector coordinates * the edge lengths * the face centroids * the normals to each edge associated face * the face areas

static update_perimeters(eptm)[source]#

Updates the perimeter of each face according to the weight of each junction.

tyssue.geometry.sheet_geometry module#

class tyssue.geometry.sheet_geometry.ClosedSheetGeometry[source]#

Bases: SheetGeometry

Geometry for a closed 2.5D sheet.

Apart from the geometry update from a normal sheet, the enclosed volume is also computed. The value is stored in sheet.settings[“lumen_vol”]

classmethod update_all(sheet)[source]#

Updates the sheet geometry by updating: * the edge vector coordinates * the edge lengths * the face centroids * the normals to each edge associated face * the face areas * the vertices heights (depends on geometry) * the face volumes (depends on geometry)

static update_lumen_vol(sheet)[source]#
class tyssue.geometry.sheet_geometry.EllipsoidGeometry[source]#

Bases: ClosedSheetGeometry

static scale(eptm, scale, coords)[source]#

Scales the coordinates coords by a factor delta

static update_height(eptm)[source]#

Update the height of the sheet vertices, based on the geometry specified in the sheet settings:

sheet.settings[‘geometry’] can be set to

  • cylindrical: the vertex height is

    measured with respect to the distance to the the axis specified in sheet.settings[‘height_axis’] (e.g z)

  • flat: the vertex height is

    measured with respect to the position on the axis specified in sheet.settings[‘height_axis’]

  • ‘spherical’: the vertex height is measured with respect to its

    distance to the coordinate system centers

  • ‘rod’: the vertex height is measured with respect to its

    distance to the coordinate height axis if between the focii, and from the closest focus otherwise. The focii positions are updated before the height update.

In all the cases, this distance is shifted by an amount of sheet.vert_df[‘basal_shift’]

class tyssue.geometry.sheet_geometry.MidlineBoundaryGeometry[source]#

Bases: ClosedSheetGeometry

classmethod update_all(eptm)[source]#

Updates the sheet geometry by updating: * the edge vector coordinates * the edge lengths * the face centroids * the normals to each edge associated face * the face areas * the vertices heights (depends on geometry) * the face volumes (depends on geometry)

static update_delta_boundary(eptm)[source]#
class tyssue.geometry.sheet_geometry.SheetGeometry[source]#

Bases: PlanarGeometry

Geometry definitions for 2D sheets in 3D

static face_projected_pos(sheet, face, psi=0)[source]#

Returns the position of a face vertices projected on a plane perpendicular to the face normal, and translated so that the face center is at the center of the coordinate system

Parameters
  • sheet (a :class:Sheet object) –

  • face (int,) – the index of the face on which to rotate the sheet

  • psi (float,) – Optional angle giving the rotation along the z axis

Returns

rot_pos – The rotated, relative positions of the face’s vertices

Return type

pd.DataFrame

static face_rotation(sheet, face, psi=0)[source]#

Returns a 3D rotation matrix such that the face normal points in the z axis

Parameters
  • sheet (a :class:Sheet object) –

  • face (int,) – the index of the face on which to rotate the sheet

  • psi (float,) – Optional angle giving the rotation along the new z axis

Returns

rotation – The rotation matrix

Return type

(3, 3) np.ndarray

classmethod face_rotations(sheet, method='normal', output_as='edge')[source]#

Returns the (sheet.Ne, 3, 3) array of rotation matrices such that each rotation returns a coordinate system (u, v, w) where the face vertices are mostly in the u, v plane.

If method is ‘normal’, face is oriented with it’s normal along w if method is ‘svd’, the u, v, w is determined through singular value decompostion of the face vertices relative positions.

svd is slower but more effective at reducing face dimensionality.

Parameters

output_as (string, default 'edge' Return the (sheet.Ne, 3, 3),) – else ‘face’ Return the (sheet.Nf, 3, 3)

classmethod get_phis(sheet, method='normal')[source]#

Returns the angle of the vertices in the plane perpendicular to each face normal. For not-too-deformed faces, sorting vertices by this gives clockwize orientation.

I think not-too-deformed means starconvex here.

The ‘method’ argument is passed to face_rotations

static normal_rotations(sheet, output_as='edge')[source]#

Returns the (sheet.Ne, 3, 3) array of rotation matrices such that each rotation aligns the coordinate system along each face normals

Parameters

output_as (string, default 'edge' Return the (sheet.Ne, 3, 3),) – else ‘face’ Return the (sheet.Nf, 3, 3)

classmethod reset_scafold(sheet)[source]#

Re-centers and (in the case of a rod sheet) resets the a-b parameters and tip masks

static svd_rotations(sheet, output_as='edge')[source]#

Returns the (sheet.Ne, 3, 3) array of rotation matrices such that each rotation aligns the coordinate system according to each face vertex SVD

Parameters

output_as (string, default 'edge' Return the (sheet.Ne, 3, 3),) – else ‘face’ Return the (sheet.Nf, 3, 3)

classmethod update_all(sheet)[source]#

Updates the sheet geometry by updating: * the edge vector coordinates * the edge lengths * the face centroids * the normals to each edge associated face * the face areas * the vertices heights (depends on geometry) * the face volumes (depends on geometry)

static update_areas(sheet)[source]#

Updates the normal coordniate of each (srce, trgt, face) face.

classmethod update_height(sheet)[source]#

Update the height of the sheet vertices, based on the geometry specified in the sheet settings:

sheet.settings[‘geometry’] can be set to

  • cylindrical: the vertex height is

    measured with respect to the distance to the the axis specified in sheet.settings[‘height_axis’] (e.g z)

  • flat: the vertex height is

    measured with respect to the position on the axis specified in sheet.settings[‘height_axis’]

  • ‘spherical’: the vertex height is measured with respect to its

    distance to the coordinate system centers

  • ‘rod’: the vertex height is measured with respect to its

    distance to the coordinate height axis if between the focii, and from the closest focus otherwise. The focii positions are updated before the height update.

In all the cases, this distance is shifted by an amount of sheet.vert_df[‘basal_shift’]

static update_normals(sheet)[source]#

Updates the face_df coords columns as the face’s vertices center of mass.

static update_vol(sheet)[source]#

Note that this is an approximation of the sheet geometry module.

class tyssue.geometry.sheet_geometry.WeightedPerimeterEllipsoidLameGeometry[source]#

Bases: ClosedSheetGeometry

EllipsoidLameGeometry correspond to a super-egg geometry with a calculation of perimeter is based on weight of each junction.

Meaning if all junction of a cell have the same weight, perimeter is calculated as a usual perimeter calculation .. math:

p = \sum l_{ij}

Otherwise, weight parameter allowed more or less importance of a junction in the perimeter calculation .. math:

p = \sum w_{ij} \, l_{ij}

In this geometry, a sphere surrounding the tissue, meaning a force is apply only at the extremity of the tissue; eptm.vert_df[‘delta_rho’] is computed as the difference between the vertex radius in a spherical frame of reference and eptm.settings[‘barrier_radius’]

static normalize_weights(sheet)[source]#

Normalize weight of each cell. Sum of all weights of one cell equals to one.

classmethod update_all(eptm)[source]#

Updates the sheet geometry by updating: * the edge vector coordinates * the edge lengths * the face centroids * the normals to each edge associated face * the face areas * the vertices heights (depends on geometry) * the face volumes (depends on geometry)

static update_height(eptm)[source]#

Update the height of the sheet vertices, based on the geometry specified in the sheet settings:

sheet.settings[‘geometry’] can be set to

  • cylindrical: the vertex height is

    measured with respect to the distance to the the axis specified in sheet.settings[‘height_axis’] (e.g z)

  • flat: the vertex height is

    measured with respect to the position on the axis specified in sheet.settings[‘height_axis’]

  • ‘spherical’: the vertex height is measured with respect to its

    distance to the coordinate system centers

  • ‘rod’: the vertex height is measured with respect to its

    distance to the coordinate height axis if between the focii, and from the closest focus otherwise. The focii positions are updated before the height update.

In all the cases, this distance is shifted by an amount of sheet.vert_df[‘basal_shift’]

static update_perimeters(eptm)[source]#

Updates the perimeter of each face according to the weight of each junction.

tyssue.geometry.sheet_geometry.face_svd_(faces)[source]#

tyssue.geometry.utils module#

tyssue.geometry.utils.rotation_matrices(angle, direction)[source]#

Return an (N, 3, 3) array of rotation matrices along N angles and N directions

Parameters
  • angle (np.ndarray of shape (N,)) – array of rotation angles

  • directions (np.ndarray of shape (N, 3)) – array of rotation vectors

Returns

rots – the array of rotation matrices

Return type

np.ndarray of shape (N, 3, 3)

tyssue.geometry.utils.rotation_matrix(angle, direction)[source]#

Returns the 3X3 rotation matrix around direction by angle

adapted from http://www.lfd.uci.edu/~gohlke/code/transformations.py.html

tyssue.geometry.utils.update_spherical(eptm)[source]#

Computes the spherical coordinates (rho, theta, phi) of an epithelium.

rho is the distance to the coordinate system’s origin, theta is the co-latitude (0 ≤ θ < π) and phi is the longitude (0 ≤ ϕ < 2π).

Module contents#