tyssue.utils package

Submodules

tyssue.utils.decorators module

tyssue.utils.decorators.cell_lookup(func)[source]
tyssue.utils.decorators.do_undo(func)[source]

Decorator that creates a copy of the first argument (usually an epithelium object) and restores it if the function fails.

The first argument in *args should have backup() and restore() methods.

tyssue.utils.decorators.face_lookup(func)[source]
tyssue.utils.decorators.time_exe(func)[source]
tyssue.utils.decorators.validate(func)[source]

Decorator that validate the epithelium after the decorated function was applied. the first argument of func should be an epithelium instance, and is at least assumed to have a validate method.

tyssue.utils.testing module

tyssue.utils.testing.effector_tester(eptm, effector)[source]
tyssue.utils.testing.model_tester(eptm, model)[source]

tyssue.utils.utils module

tyssue.utils.utils.ar_calculation(sheet, coords=['x', 'y'])[source]

Calculates the aspect ratio of each face of the sheet

Parameters
  • eptm (a Sheet object) –

  • coords (list of str, optional, default ['x', 'y']) – the coordinates on which to compute the aspect ratio

Returns

AR

Return type

pandas series of aspect ratio for all faces.

Note

As is the case in ImageJ, the returned aspect ratio is always higher than 1

tyssue.utils.utils.combine_specs(*specs)[source]
tyssue.utils.utils.data_at_opposite(sheet, edge_data, free_value=None)[source]

Returns a pd.DataFrame with the values of the input edge_data at the opposite edges. For free edges, optionaly replaces Nan values with free_value

Parameters
  • sheet (a Sheet instance) –

  • edge_data (dataframe contain value of edge) –

Returns

opposite

Return type

pandas series contain value of opposite edge

tyssue.utils.utils.get_next(eptm)[source]

Returns the indices of the next edge for each edge

tyssue.utils.utils.get_sub_eptm(eptm, edges, copy=False)[source]

Define sub-epithelium corresponding to the edges.

Parameters
  • eptm (a Epithelium instance) –

  • edges (list of edges includes in the sub-epithelium) –

Returns

sub_eptm

Return type

a Epithelium instance

tyssue.utils.utils.modify_segments(eptm, modifiers)[source]

Modifies the datasets of a segmented epithelium according to the passed modifiers.

Parameters

Note

This functions assumes that the epithelium has a segment_index method as implemented in the tyssue.Monolayer.

Example

>>> modifiers = {
>>>     'apical' : {
>>>         'edge': {'line_tension': 1.},
>>>         'face': {'prefered_area': 0.2},
>>>     },
>>>     'basal' : {
>>>         'edge': {'line_tension': 3.},
>>>         'face': {'prefered_area': 0.1},
>>>     }
>>> modify_segments(monolayer, modifiers)
>>> monolayer.ver_df.loc[monolayer.apical_edges,
>>>                      'line_tension'].unique()[0] == 1.
True
tyssue.utils.utils.scaled_unscaled(func, scale, eptm, geom, args=(), kwargs={}, coords=None)[source]

Scales the epithelium by an homotetic factor scale, applies the function func, and scales back to original size.

Parameters
  • func (the function to apply to the scaled epithelium) –

  • scale (float, the scale to apply) –

  • eptm (a Epithelium instance) –

  • geom (a Geometry class) –

  • args (sequence, the arguments to pass to func) –

  • kwargs (dictionary, the keywords arguments) – to pass to func

  • coords (the coordinates on which the scaling applies) –

  • the execution of function fails (If) –

  • scaling is still reverted (the) –

Returns

res

Return type

the result of the function func

tyssue.utils.utils.set_data_columns(datasets, specs, reset=False)[source]

Sets the columns of the dataframes in the datasets dictionnary to the uniform values in the specs sub-dictionnaries.

Parameters
  • datasets (dict of dataframes) –

  • specs (dict of dicts) –

  • reset (bool, default False) –

  • each key in specs (For) –

  • value is a dictionnary whose (the) –

  • are column names for the corresponding dataframe in (keys) –

  • If there is no such column in the dataframe (datasets.) –

:param : :param it is created. If the columns allready exists and reset is True: :param : :param the new value is used.:

tyssue.utils.utils.single_cell(eptm, cell, copy=False)[source]

Define epithelium instance for all element to a define cell.

Parameters
  • eptm (a Epithelium instance) –

  • cell (identifier of a cell) –

  • copy (bool, default False) –

Returns

sub_etpm

Return type

class:’Epithelium’ instance corresponding to the cell

tyssue.utils.utils.spec_updater(specs, new)[source]

Add element to the new dictionary to the specs dictionary. Update value if the key already exist.

Parameters
  • specs (specification that will be modified) –

  • new (dictionary of new specification) –

tyssue.utils.utils.swap_apico_basal(organo)[source]

Swap apical and basal segments of an organoid

tyssue.utils.utils.to_nd(df, ndim)[source]

Give a new shape to an input data by duplicating its column.

Parameters
  • df (input data that will be reshape) –

  • ndim (dimension of the new reshape data.) –

Returns

df_nd

Return type

return array reshaped in ndim.

tyssue.utils.widgets module

tyssue.utils.widgets.parameter_settings(eptm)[source]

Module contents

Utilities