SyMBac.general_drawing

SyMBac.general_drawing.convolve_rescale(image, kernel, rescale_factor, rescale_int)[source]

Convolves an image with a kernel, and rescales it to the correct size.

Parameters:
  • image (numpy.ndarray) – The image

  • kernel (2D numpy array) – The kernel

  • rescale_factor (int) – Typicall 1/resize_amount. So 1/3 will scale the image down by a factor of 3. We do this because we render the image and kernel at high resolution, so that we can do the convolution at high resolution.

  • rescale_int (bool) – If True, rescale the intensities between 0 and 1 and return a float32 numpy array of the convolved downscaled image.

Returns:

outupt – The output of the convolution rescale operation

Return type:

2D numpy array

SyMBac.general_drawing.find_farthest_vertices(vertex_list)[source]

Given a list of vertices, find the pair of vertices which are farthest from each other

Parameters:

vertex_list (list(2-tuple, 2-tuple ... )) – List of pairs of vertices [(x,y), (x,y), …]

Returns:

The two vertices maximally far apart

Return type:

array(2-tuple, 2-tuple)

SyMBac.general_drawing.gen_cell_props_for_draw(cell_timeseries_lists, ID_props)[source]
Parameters:
  • cell_timeseries_lists (list) – A list (single frame) from cell_timeseries, the output from run_simulation. E.g: cell_timeseries[x]

  • ID_props (list) – A list of properties for each cell in that frame, the output of generate_curve_props()

Returns:

cell_properties – The final property list used to actually draw a scene of cells. The input to draw_scene

Return type:

list

SyMBac.general_drawing.generate_curve_props(cell_timeseries)[source]

Generates individual cell curvature properties. 3 parameters for each cell, which are passed to a cosine function to modulate the cell’s curvature.

Parameters:

cell_timeseries (list(cell_properties)) – The output of run_simulation()

Returns:

outupt

Return type:

A numpy array of unique curvature properties for each cell in the simulation

SyMBac.general_drawing.get_centroid(vertices)[source]

Return the centroid of a list of vertices

Keyword arguments: vertices – A list of tuples containing x,y coordinates.

SyMBac.general_drawing.get_distance(vertex1, vertex2)[source]

Get euclidian distance between two sets of vertices.

Parameters:
  • vertex1 (2-tuple) – x,y coordinates of a vertex

  • vertex2 (2-tuple) – x,y coordinates of a vertex

Returns:

float

Return type:

absolute distance between two points

SyMBac.general_drawing.get_midpoint(vertex1, vertex2)[source]

Get the midpoint between two vertices

SyMBac.general_drawing.get_space_size(cell_timeseries_properties)[source]

Iterates through the simulation timeseries properties, finds the extreme cell positions and retrieves the required image size to fit all cells into

SyMBac.general_drawing.make_images_same_shape(real_image, synthetic_image, rescale_int=True)[source]

Makes a synthetic image the same shape as the real image

SyMBac.general_drawing.midpoint_intercept(vertex1, vertex2)[source]

Get the y-intercept of the line connecting two vertices

SyMBac.general_drawing.place_cell(length, width, angle, position, space)[source]

Creates a cell and places it in the pymunk space

Parameters:
  • length (float) – length of the cell

  • width (float) – width of the cell

  • angle (float) – rotation of the cell in radians counterclockwise

  • position (tuple) – x,y coordinates of the cell centroid

  • space (pymunk.space.Space) – Pymunk space to place the cell in

Return type:

nothing, updates space

SyMBac.general_drawing.vertices_slope(vertex1, vertex2)[source]

Get the slope between two vertices