snudda.place.region_mesh¶
- class snudda.place.region_mesh.RegionMesh(filename, d_view=None, role='master', use_cache=True, pickle_version=-1, raytrace_borders=True, d_min=1.5e-05, bin_width=0.0001, logfile_name=None, log_file=None, random_seed=112, verbose=False)[source]¶
Handles neuron placement within a 3D mesh.
Constructor.
- Parameters
filename (str) – Path to wavefront mesh file
d_view – ipyparallel direct view object
role (str) – Role, ie. “master” or “worker”
use_cache (bool) – The meshes voxel representation is cached, use the cache?
pickle_version (int) – Which version of pickle to use? (-1 latest)
raytrace_borders (bool) – Raytrace positions in border regions? Slower, but more accurate.
d_min (float) – Closest distance between soma
bin_width (float) – Mesh size
logfile_name (str) – Path to logfile
log_file – File pointer to log file
random_seed (int) – Random seed value
verbose (bool) – Flag to be verbose?
- define_density(neuron_type, density_function)[source]¶
Defines density for neuron type.
- Parameters
neuron_type (str) – Neuron type
density_function (str) – density_function is either None, or a function of pos = [x,y,z] (in SI units)
- get_subset(centre, radius=None, num_neurons=None, shape='cube', return_idx_flag=False)[source]¶
Returns subset of positions, either within a radius, or the closest num_neurons neurons.
- Parameters
centre (float,float,float) – Centre of space
radius (float) – Radius if sphere, half-side if cube
num_neurons (int) – Number of neurons (if None, all within radius are returned)
shape (str) – “sphere” or “cube”
return_idx_flag (bool) – Return the indexes instead of coordinates (default False)
- plot_neurons(plot_idx=None, pdf_name=None)[source]¶
Plot neurons.
- Parameters
plot_idx (list) – Neuron ID to plot
pdf_name (str) – Name of file to save figure to (default None)
- plot_struct(pdf_name=None)[source]¶
Plot structure.
- Parameters
pdf_name (str) – Save file name (default None)
- setup_place_neurons(d_min=None)[source]¶
Initialises variables for neuron placement.
- Parameters
d_min (float) – Minimal distance between neuron somas, in SI units (meters)
- setup_voxel_list()[source]¶
Setup voxel list, these are voxels that needs to be checked for neurons close by.
- update_padding_mask()[source]¶
Updates padding mask. We add neurons outside our region of interest, to avoid artificially inflating neuron density at the edges (which would happen without the padding region).
- verify_inside(num_points=1000)[source]¶
Verify the check-inside method against the ray-casting method to make sure they give same results.
- write_log(text, flush=True, is_error=False)[source]¶
Writes to log file. Use setup_log first. Text is only written to screen if self.verbose=True, or is_error = True, or force_print = True.
test (str) : Text to write flush (bool) : Should all writes be flushed to disk directly? is_error (bool) : Is this an error, always written. force_print (bool) : Force printing, even if self.verbose=False.