sciSOM.Plotting package¶
Submodules¶
sciSOM.Plotting.SOM_plots module¶
- sciSOM.Plotting.SOM_plots.SOM_gird_avg_wavefrom_per_cell(input_data, weight_cube, output_img_name='avg_waveform.png', save_fig=False, is_struct_array=True)[source]¶
Generates image of the average waveform for each cell in the SOM grid.
This function take in a nunr file from NeuroScope and converts it into a useful format to us Then it uses the data in the nunr file to identify which data samples belong to each PE Finally it takes this data and plots it such that we can overlay any data we want.
- Parameters:
input_data (
ndarray) – waveforms (peaks, peaklets)nunr_file_input (str) – text file output from neuroscope
grid_x_dim (int) – SOM x-dimension
grid_y_dim (int) – SOM y-dimension
x_dim_data_cube (int) – x-dimension of the input data cube for the SOM
output_img_name (
str) – name of file to save the image to + pathis_struct_array (
bool) – does the data need to be accessed as peaks[‘data’]?weight_cube (
ndarray)save_fig (
bool)
- sciSOM.Plotting.SOM_plots.SOM_location_recall(weight_cube, normalized_data)[source]¶
Takes the data, the weight cube and the classification map and assignes each data point a label based on their cluster.
- Parameters:
array_to_fill (np.ndarray) – structured array to fill with the classification
data_in_SOM_fmt (np.ndarray) – data to classify in the SOM format
weight_cube (
ndarray) – SOM weight cubereference_map (np.ndarray) – reference map for the SOM
normalized_data (
ndarray)
- Returns:
array_to_fill – structured array with the SOM classification added
- Return type:
ndarray
- sciSOM.Plotting.SOM_plots.calculate_density_matrix(weight_cube, dataset)[source]¶
Calculate density matrix for a given som weight cube and dataset.
This function is not working as intended, need to review it It is not acutally using the information of the u_matrix
- Parameters:
weight_cube (
ndarray) – SOM weight cubedataset (
ndarray) – Data in the same form given to the SOM as input for training
- Returns:
density_matrix – The density matrix for the given dataset
- Return type:
ndarray
- sciSOM.Plotting.SOM_plots.calculate_distance_btw_adjacent_prototypes(weight_cube)[source]¶
Calculate the distance (fences) for each adjacent neuron in an SOM.
(Need to review this function, dont fully remember what is going on in the implementation)
- Parameters:
weight_cube (
ndarray) – The weight cube for the SOM- Returns:
distance_btw_proto – The distance matrix for neurons in the SOM
- Return type:
np.ndarray
- sciSOM.Plotting.SOM_plots.display_density_matrix(density_matrix)[source]¶
Display the density matrix as an image.
- Parameters:
density_matrix (
ndarray) – The density matrix to display
- sciSOM.Plotting.SOM_plots.plot_SOM_gird_neurons(weight_cube)[source]¶
This function take in a nunr file from NeuroScope and converts it into a useful format to us Then it uses the data in the nunr file to identify which data samples belong to each PE Finally it takes this data and plots it such that we can overlay any data we want.
- Return type:
Parameters:¶
- weight_cubenp.ndarray
Weight cube after an SOM has been trained
Returns:¶
: None
- type weight_cube:
ndarray- param weight_cube:
- sciSOM.Plotting.SOM_plots.plot_mU_matrix(weight_cube, data, set_costum_min_max=False, fence_vmin=None, fence_vmax=None, density_vmin=None, density_vmax=None, log_density=False, fence_on=True)[source]¶
Plots the mU-matrix; defined here as the data density per cell and the lines between cells representing the distance between adjacent cells.
This implementation mimicks the major aspects of the mU-matrix in NueroScope (refer to [cite figure such as such of mU-matrix paper]).
Complete information on the NeuroScope implementation of the mU-matrix is given in respective NeuroScope documentation, available upon request from [Erzsébet Merényi](erzsebet@rice.edu| [
Prof. Merényi was not consulted on the implementation of sciSOM functions that intend to mimic NeuroScope functionalities of the same name, nor did she have opportunity to inspect proof of faithfulness to the same-name module in NeuroScope or correctness of the corresponding sciSOM code. Therefore, Dr. Merényi and the NeuroScope group take no responsibility for the likeness and the correctness of the functions implemented to mimic (partial) NeuroScope capabilities in sciSOM. Parameters: ——————- weight_cube : np.ndarray
Weight cube after an SOM has been trained
- datanp.ndarray
Data used to train the SOM or data to be mapped to the SOM
- set_costum_min_maxbool
If True, the user can set the vmin and vmax for fences
- fence_vminfloat
Minimum value for the fences
- fence_vmaxfloat
Maximum value for the fences
- density_vminfloat
Minimum value for the density matrix (not implemented yet)
- density_vmaxfloat
Maximum value for the density matrix (not implemented yet)
- log_densitybool
If True applies a log to the density matrix calculation
- fence_onbool
If False removes fences from mU matrix image
Returns:¶
: None
- type weight_cube:
ndarray- param weight_cube:
- type data:
ndarray- param data:
- type set_costum_min_max:
- param set_costum_min_max:
- type fence_vmin:
- param fence_vmin:
- type fence_vmax:
- param fence_vmax:
- type density_vmin:
- param density_vmin:
- type density_vmax:
- param density_vmax:
- type log_density:
- param log_density:
- type fence_on:
- param fence_on: