|
Topological Material Analysis 0.5
Analyse the structures of materials using tools from TDA
|
Functions | |
| check_params () | |
| Check the parameters for the computation. | |
| read_configuration (str configuration_file, str configuration) | |
| import a specified structure from a configuration file | |
| read_computation_settings (str settings_file, settings_name) | |
| import a specified settings from a file | |
| load_configuration_settings () | |
| Load the configuration settings. | |
| load_computation_settings () | |
| Load the computation settings. | |
| write_dgm_csv (dgm, file_path, plot_name="") | |
| Save a digram as a csv file, with the option to save a plot as well. | |
| save_plots () | |
| Save plots to a directory. | |
| save_dgms_as_csv () | |
| Save the persistence diagrams as csv files. | |
| read_sample (str structure_file, str configuration) | |
| import a specified sample range from a configuration file | |
| read_oineus_settings (str structure_file, str setting_name) | |
| import settings for kernel/image/cokernel | |
| sample_at (str file_path, str format, sample_index, int repeat_x, int repeat_y, int repeat_z, atom_list, radius_list) | |
| Sample a structure at a particular time, with cell repetitions. | |
| sample_all_diffusion (str file_path, str format, int sample_step=1) | |
| Sample all the diffusion paths from a given file. | |
| weighted_alpha_diode (points) | |
| Use diode to fill the weighted alpha shapes. | |
| convert_simps_to_oineus (list simplices) | |
| Diode is set to create simplices for dionysus, so we need to convert them to the correct type for oineus. | |
| oineus_compare (x, y) | |
| Comparison to compare list of simplicies to get them in the order for oineus. | |
| sub_complex (pandas.DataFrame points, float z_upper, float z_lower) | |
| Given the points, and the upper and lower thresholds in the 'z'-component. | |
| oineus_filtration (pandas.DataFrame points, oineus.ReductionParams params) | |
| Given a set of points, compute the oineus.filtration of the alpha complex. | |
| oineus_pair (pandas.DataFrame points, list sub) | |
| Given a set of points, and the points that are in the subset L, construct the complexes and map between them. | |
| oineus_process (pandas.DataFrame points, oineus.ReductionParams params) | |
| Given some points with weights, and the number of threads to use, obtain the persistent homology of the weighted alpha complex of these points, using oineus. | |
| oineus_kernel_image_cokernel (pandas.DataFrame points, oineus.ReductionParams params, float upper_threshold, float lower_threshold) | |
| Given points, and parameters for oineus, calculate the kernel/image/cokernel persistence as desired. | |
| calculate_APF (dgm) | |
| Calcualte the APF from a diagram. | |
| compute () | |
| test () | |
| define various functions needed for later | |
| plot_APF (numpy.array APF, str name) | |
| Plot an accumulated persistence function. | |
| plot_APFs (list APFs, list APF_names, str fig_name) | |
| Plot a set accumulated persistence function, with automatic colour differentiation. | |
| plot_PD (dgm, str name) | |
| Plot a persistence diagram, with a specific colour. | |
| plot_PDs (dgms, str name) | |
| Plot several persistence diagrams, with automatic colour choices. | |
| plot_kernel_image_cokernel_PD (kicr, int d, bool codomain, bool kernel, bool image, bool cokernel, str name) | |
| Plot kernel, image, cokernel on same figure. | |
| generate_plots () | |
| Generate plots for a single configuration. | |
| get_representative_loops (pandas.DataFrame dgm, R, filt) | |
| Get representative of each homology class in dimension 1. | |
| get_0_and_1_cycles (loop, filt) | |
| Get the vertices and edges of a loop. | |
| loop_composition (verts, filt, points, atom_types) | |
| Get the composition of a given representative. | |
| generate_visulisation_df (pandas.DataFrame dgm, R, filt, points, atom_types) | |
| generate the pandas.DataFrame containing the information about the points so we can display it | |
| get_neighbour_cells (pandas.DataFrame points, list cycle_vertices, filt) | |
| Get the neighbouring cells of a given cycle. | |
| generate_display (pandas.DataFrame points, pandas.DataFrame dgm, int id, filt, neighbours=False) | |
| Display a representative of a cycle. | |
| toma_functions.calculate_APF | ( | dgm | ) |
Calcualte the APF from a diagram.
| dgm | the diargam you want to calculate the APF for |
| toma_functions.check_params | ( | ) |
Check the parameters for the computation.
Check the parameters for the computation
This function checks the parameters for the computation and loads them into the session state.
| toma_functions.compute | ( | ) |
| toma_functions.convert_simps_to_oineus | ( | list | simplices | ) |
Diode is set to create simplices for dionysus, so we need to convert them to the correct type for oineus.
| simplices | a list of simplices from diode |
| toma_functions.generate_display | ( | pandas.DataFrame | points, |
| pandas.DataFrame | dgm, | ||
| int | id, | ||
| filt, | |||
| neighbours = False ) |
Display a representative of a cycle.
| points | pandas.DataFrame of the atoms |
| dgm | pandas.DataFrame of the representatives of cycles |
| id | int corresponding to the id of the cycle you want to visualise |
| toma_functions.generate_plots | ( | ) |
Generate plots for a single configuration.
Generate plots for a single configuration
This function generates persistence diagrams and APF plots for a single configuration. It creates empty lists to store the plots, then populates them based on enabled options.
The following plots can be generated:
The plots are stored in st.session_state for later display.
| toma_functions.generate_visulisation_df | ( | pandas.DataFrame | dgm, |
| R, | |||
| filt, | |||
| points, | |||
| atom_types ) |
generate the pandas.DataFrame containing the information about the points so we can display it
| dgm | pandas.DataFrame of the diagram, with columns birth, death, birth simplex, death simplex, cycle rep |
| toma_functions.get_0_and_1_cycles | ( | loop, | |
| filt ) |
Get the vertices and edges of a loop.
| loop | list containing the ids of the edges in the loop |
| filt | oineus filtration |
| toma_functions.get_neighbour_cells | ( | pandas.DataFrame | points, |
| list | cycle_vertices, | ||
| filt ) |
Get the neighbouring cells of a given cycle.
| points | pandas.DataFrame of the points (atoms) in the structure |
| cycle_vertices | list of the vertices in the cycle |
| filt | oineus filtration |
| toma_functions.get_representative_loops | ( | pandas.DataFrame | dgm, |
| R, | |||
| filt ) |
Get representative of each homology class in dimension 1.
| dgm | pandas.DataFrame containing the diagram and the birth and death simplex id |
| filt | oineus filtration |
| toma_functions.load_computation_settings | ( | ) |
Load the computation settings.
Load computation settings from the session state
This function reads computation settings from st.session_state and loads them into the session state. It uses read_computation_settings() to parse the settings file and extract:
| toma_functions.load_configuration_settings | ( | ) |
Load the configuration settings.
Load configuration settings from the session state
This function reads configuration settings from st.session_state and loads them into the session state. It uses read_configuration() to parse the config file and extract:
The settings are read from:
The parsed settings are stored back in st.session_state as:
| toma_functions.loop_composition | ( | verts, | |
| filt, | |||
| points, | |||
| atom_types ) |
Get the composition of a given representative.
| loop | list containing the ids of the edges in the loop |
| points | pandas.DataFrame of the points (atoms) in the structure |
| atom_types | list of the atom types we are considering (restricting to) |
| toma_functions.oineus_compare | ( | x, | |
| y ) |
Comparison to compare list of simplicies to get them in the order for oineus.
| x | simplex to compare |
| y | simplex to compare |
| toma_functions.oineus_filtration | ( | pandas.DataFrame | points, |
| oineus.ReductionParams | params ) |
Given a set of points, compute the oineus.filtration of the alpha complex.
| points | pandas.DataFrame containing points and their weights |
| params | oineus.ReductionParams which contains the settings for oineus |
| toma_functions.oineus_kernel_image_cokernel | ( | pandas.DataFrame | points, |
| oineus.ReductionParams | params, | ||
| float | upper_threshold, | ||
| float | lower_threshold ) |
Given points, and parameters for oineus, calculate the kernel/image/cokernel persistence as desired.
| points | pandas.DataFrame of the points, with columns 'x','y','z','w' corresponding to the coordinates and weights respectively |
| kernel | boolean parameter to set if kernel persistence is calculated |
| image | boolean parameter to set if image persistence is calculated |
| cokernel | boolean parameter to set if cokernel persistence is calculated |
| n_threads | number of threads to use in oineus |
| upper_threshold | float, z-coordinate above which points are in the subcomplex |
| lower_threshold | float z-coordinate below which points are in the subcomplex |
| toma_functions.oineus_pair | ( | pandas.DataFrame | points, |
| list | sub ) |
Given a set of points, and the points that are in the subset L, construct the complexes and map between them.
The subcomplex L will consists of all simplices whose vertex are in the subset.
| points | pandas.DataFrame containing the points and their weights |
| sub | a list containing the indices of the points on which we construct the subcomplex |
| toma_functions.oineus_process | ( | pandas.DataFrame | points, |
| oineus.ReductionParams | params ) |
Given some points with weights, and the number of threads to use, obtain the persistent homology of the weighted alpha complex of these points, using oineus.
| points | pandas.DataFrame of the points, with colums 'x','y','z','w' |
| params | oineus.ReudctionParams |
| toma_functions.plot_APF | ( | numpy.array | APF, |
| str | name ) |
Plot an accumulated persistence function.
| APF | - numpy.array with 2 columns of coordinates which define the APF |
| name | - title for the plot |
| toma_functions.plot_APFs | ( | list | APFs, |
| list | APF_names, | ||
| str | fig_name ) |
Plot a set accumulated persistence function, with automatic colour differentiation.
| APFs | - accumlated persistence functions to plot |
| toma_functions.plot_kernel_image_cokernel_PD | ( | kicr, | |
| int | d, | ||
| bool | codomain, | ||
| bool | kernel, | ||
| bool | image, | ||
| bool | cokernel, | ||
| str | name ) |
Plot kernel, image, cokernel on same figure.
| kicr | oineus::KerImCokReduced |
| d | the dimension to extract (either 1 or 2) |
| kernel | bool to plot kernel |
| image | bool to plot image |
| cokernel | bool to plot cokernel |
| toma_functions.plot_PD | ( | dgm, | |
| str | name ) |
Plot a persistence diagram, with a specific colour.
Points at infinity are plotted at a height of 1.1 times the last finite point to die.
| dgm | - pandas.DataFrame of the diagram |
| name | - name to use as title of the plot |
| toma_functions.plot_PDs | ( | dgms, | |
| str | name ) |
Plot several persistence diagrams, with automatic colour choices.
Points at infinity are plotted at a height of 1.1 times the last finite point to die.
| dgms | - list of diagrams |
| name | - title to use for the plot |
@results a plotly.express figure
| toma_functions.read_computation_settings | ( | str | settings_file, |
| settings_name ) |
import a specified settings from a file
| settings_file | path to the file to use for configurations |
| settings_name | name of the structure to use |
| toma_functions.read_configuration | ( | str | configuration_file, |
| str | configuration ) |
import a specified structure from a configuration file
| configuration_file | path to the file to use for configurations |
| configuration | name of the structure to use |
| toma_functions.read_oineus_settings | ( | str | structure_file, |
| str | setting_name ) |
import settings for kernel/image/cokernel
| file_path | path to the ini file containing the settings |
| settings_name | name of the settings to use |
| toma_functions.read_sample | ( | str | structure_file, |
| str | configuration ) |
import a specified sample range from a configuration file
| file_path | path to the file to use for configurations |
| sample_range | name of the structure to use |
| toma_functions.sample_all_diffusion | ( | str | file_path, |
| str | format, | ||
| int | sample_step = 1 ) |
Sample all the diffusion paths from a given file.
| file_path | : str, path to the file to use for configurations |
| format | : str, format of the file |
| backbone_list | : list, list of backbone atoms to use |
| flow_list | : list, list of flow atoms to use |
| toma_functions.sample_at | ( | str | file_path, |
| str | format, | ||
| sample_index, | |||
| int | repeat_x, | ||
| int | repeat_y, | ||
| int | repeat_z, | ||
| atom_list, | |||
| radius_list ) |
Sample a structure at a particular time, with cell repetitions.
| atoms | initial configuration |
| sample_index | time to sample at |
| repeat_x | repetition in x dir |
| repeat_y | repetition in y dir |
| repeat_z | repetition in z dir @parm atom_list list of atoms in the config |
| radius_list | list of radii to use for the atoms |
| toma_functions.save_dgms_as_csv | ( | ) |
Save the persistence diagrams as csv files.
Save the persistence diagrams as csv files, reading the file path from the session state.
| toma_functions.save_plots | ( | ) |
Save plots to a directory.
Save plots to a directory
This function saves plots to a specified directory. It uses the following from st.session_state:
| toma_functions.sub_complex | ( | pandas.DataFrame | points, |
| float | z_upper, | ||
| float | z_lower ) |
Given the points, and the upper and lower thresholds in the 'z'-component.
| points | pandas.DataFrame containing of the points. |
| z_upper | float giving the upper threshold, any point above this is in the subcomplex |
| z_lower | float giving the lower threshold, any point below this is in the subcomplex |
| toma_functions.test | ( | ) |
define various functions needed for later
| toma_functions.weighted_alpha_diode | ( | points | ) |
Use diode to fill the weighted alpha shapes.
| points | pandas.DataFrame with columns 'x', 'y', 'z' for coordinates, and column 'w' with the weights. |
| toma_functions.write_dgm_csv | ( | dgm, | |
| file_path, | |||
| plot_name = "" ) |
Save a digram as a csv file, with the option to save a plot as well.
| dgm | the diagram to be saved, and plotted |
| dir | directory in which to save the files |
| name | name of the structure |
| save_plot | save the plots as well |