jLM.CMEPostProcessing#
Post-processing for the Well-stirred CME model
Functions
|
Calculates curvature values for each of the edges in the graph to make sure that multiple edges are shown properly on a graph plot. |
|
Close a Lattice Microbes File |
|
Converts a color given in one of the supported color formats to R-G-B values. |
|
Converts a color given in one of the supported color formats to R-G-B-A values. |
|
|
|
Compares two community structures using various distance measures. |
|
Calculates the convex hull of a given point set. |
|
Graph disjoint union. |
|
Get the average and variance of the specie trace over time |
|
Get the histogram for a specie |
Get the number of trajectories (replicates) in the file |
|
|
Compute the specie density(occupancy) among a slice of the simulation domain as a function over time for the given direciton |
|
Get the nD phase space associated with the traces of species. |
|
Extract data for a particular specie for the specified replicate(s) |
|
Exract the species names |
|
Extract the timestep times |
|
Get trajectory data for a specific replicate and species |
|
Returns the folder that contains the C API headers of the Python interface of igraph. |
|
Converts a color given by its HSL coordinates (hue, saturation, lightness) to RGB coordinates. |
|
Converts a color given by its HSLA coordinates (hue, saturation, lightness, alpha) to RGBA coordinates. |
|
Converts a color given by its HSV coordinates (hue, saturation, value) to RGB coordinates. |
|
Converts a color given by its HSVA coordinates (hue, saturation, value, alpha) to RGB coordinates. |
|
Graph intersection. |
|
Returns whether two sequences of integers can be the degree sequences of a bipartite graph. |
|
Deprecated since 0.9 in favour of L{is_graphical()}. |
|
Returns whether a list of degrees can be a degree sequence of some graph, with or without multiple and loop edges, depending on the allowed edge types in the remaining arguments. |
|
Deprecated since 0.9 in favour of L{is_graphical()}. |
|
Loads a graph from the given filename. |
|
Returns the mean of an iterable. |
|
Returns the median of an unsorted or sorted numeric vector. |
|
Open a Lattice Microbes File for reading |
|
Returns the pth percentile of an unsorted or sorted numeric vector. |
|
Plots the given object to the given target. |
|
Plot a specific species average over time and variance |
|
Plot species from an output file |
|
Plot the reaction scheme as a network |
|
Plot a specific specie density(occupancy) among a slice of the simulation domain as a function of a direction over time |
|
Plot the 2D or 3D phase space associated with the given species over the replicates indicated |
|
Plot a specific species trace |
|
Plot species from an output file |
|
Fitting a power-law distribution to empirical data |
|
Returns the qth quantile of an unsorted or sorted numeric vector. |
|
Loads a graph from the given filename. |
|
Rescales a list of numbers into a given range. |
|
Converts a color given by its RGB coordinates to HSL coordinates (hue, saturation, lightness). |
|
Converts a color given by its RGB coordinates to HSV coordinates (hue, saturation, value). |
|
Converts a color given by its RGBA coordinates to HSLA coordinates (hue, saturation, lightness, alpha). |
|
Converts a color given by its RGBA coordinates to HSVA coordinates (hue, saturation, value, alpha). |
|
Saves a graph to the given file. |
|
Set the logger to write to the console as the code is working |
|
Set up file handler to print log to file |
|
Set the level of the logger for the application |
|
Sets the handler to be called when igraph is performing a long operation. @param handler: the progress handler function. It must accept two arguments, the first is the message informing the user about what igraph is doing right now, the second is the actual progress information (a percentage). |
|
Sets the random number generator used by igraph. @param generator: the generator to be used. It must be a Python object with at least three attributes: C{random}, C{randint} and C{gauss}. Each of them must be callable and their signature and behaviour must be identical to C{random.random}, C{random.randint} and C{random.gauss}. Optionally, the object can provide a function named C{getrandbits} with a signature identical to C{randpm.getrandbits} that provides a given number of random bits on demand. By default, igraph uses the C{random} module for random number generation, but you can supply your alternative implementation here. If the given generator is C{None}, igraph reverts to the default PCG32 generator implemented in the C layer, which might be slightly faster than calling back to Python for random numbers, but you cannot set its seed or save its state. |
|
Sets the handler to be called when igraph tries to display a status message. |
|
Show a specific species average over time and variance |
|
Show species from an output file :param filename: The name of an HDF5 output file generated by LatticeMicrobes :param species: A list of species to plot :param kwargs: Additional arguments to be passed on to matplotlib.plot. |
|
Show a specific specie density(occupancy) among a slice of the simulation domain as a function of a direction over time |
|
Show a specific species trace |
|
Show species trace from a particular replicate |
|
Calculates the split-join distance between two community structures. |
|
Prints a summary of object o to a given stream |
|
Compute undirected UMAP weights from directed distance graph. |
|
Graph union. |
|
Saves a graph to the given file. |
Classes
|
Class representing the parameters of the ARPACK module. |
|
Advanced gradient that consists of more than two base colors. |
|
igraph BFS iterator object |
|
Class representing a bounding box (a rectangular area) that encloses some objects. |
|
Class implementing the default visualisation of a graph. |
|
A palette suitable for coloring vertices when plotting a clustering. |
|
Class representing a clustering of an arbitrary ordered set. |
|
The cohesive block structure of a graph. |
|
Class representing igraph configuration details. |
|
Class representing a cover of an arbitrary ordered set. |
|
A cut of a given graph. |
|
igraph DFS iterator object |
|
alias of |
|
The hierarchical clustering (dendrogram) of some dataset. |
|
Dyad census of a graph. |
|
Class representing a single edge in a graph. |
|
Class representing a sequence of edges in the graph. |
|
Result of fitting a power-law to a vector of samples |
|
A flow of a given graph. |
|
Base class for gradient palettes |
|
Generic graph. |
|
Low-level representation of a graph. |
|
Summary representation of a graph. |
|
Generic histogram class for real numbers |
|
Represents the layout of a graph. |
|
A matching of vertices in a graph. |
|
Graph drawer that uses a pyplot.Axes as context |
|
Simple matrix data type. |
|
Base class of color palettes. |
|
alias of |
|
Class representing a point on the 2D plane. |
|
A palette that returns colors from a pre-calculated list of colors |
|
A palette that varies the hue of the colors along a scale. |
|
Class representing a rectangle. |
|
Running mean calculator. |
|
Triad census of a graph. |
|
A dictionary-like class that can be used to assign unique IDs to names (say, vertex names). |
|
Class representing a single vertex in a graph. |
|
The clustering of the vertex set of a graph. |
|
The cover of the vertex set of a graph. |
|
The dendrogram resulting from the hierarchical clustering of the vertex set of a graph. |
|
Class representing a sequence of vertices in the graph. |
Exceptions
|
- jLM.CMEPostProcessing.closeLMFile(f)[source]#
Close a Lattice Microbes File
- Parameters:
f – A previously opened lattice microbes file
- jLM.CMEPostProcessing.getAvgVarTrace(f, specie, doublingTime=None)[source]#
Get the average and variance of the specie trace over time
- Parameters:
f – The HDF5 file handle to extract from or the name of a file to open
specie – The specie to extract
doublingTime – An optional doubling time parameter that will normalize average each trace by time in the cell cycle assuming exponentially growing cell (2log2 * x/2^(t/DT)), effectively normalizing against cell size. Default: no averaging is performed
- Returns:
avg, var, time
- jLM.CMEPostProcessing.getHistogram(f, species)[source]#
Get the histogram for a specie
- Parameters:
f – The HDF5 file handle to extract from or the name of a file to open
specie – An array of specie/s to extract. returns a nD histogram of the data.
- Returns:
bins, edges (len(bins)+1)
- jLM.CMEPostProcessing.getNumTrajectories(f)[source]#
Get the number of trajectories (replicates) in the file
- Parameters:
f – The HDF5 file handle to extract from or the name of a file to open
- Returns:
Number of trajectories/replicates in the file
- Return type:
int
- jLM.CMEPostProcessing.getOccupancyKymograph(f, species=None, replicate=1)[source]#
Compute the specie density(occupancy) among a slice of the simulation domain as a function over time for the given direciton
- Parameters:
filename – Name of file to extract data from
specie – A particular specie to plot density for
replicate – The replicate to show trace for
- jLM.CMEPostProcessing.getPhaseSpace(f, species, replicate)[source]#
Get the nD phase space associated with the traces of species.
If a single replicate is specified, a single trace will be returned, otherwise a 2/3D density matrix will be returned.
- Parameters:
f – The HDF5 file handle to extract from or the name of a file to open
specie – An iterable of 2 more specie names
replicate – The replicate for which to extract the phase space
- Returns:
A numpy array of a trace from a single replicate (specie1, specie2, …)
- jLM.CMEPostProcessing.getSpecieTrace(f, specie, replicate=None, doublingTime=None)[source]#
Extract data for a particular specie for the specified replicate(s)
- Parameters:
f – The HDF5 file handle to extract from or the name of a file to open
specie – The specie to extract data
replicate – The number of the replicate to extract from. If None (default), returns data for all replicates
doublingTime – An optional doubling time parameter that will normalize average each trace by time in the cell cycle assuming exponentially growing cell (2log2 * x/2^(t/DT)), effectively normalizing against cell size. Default: no averaging is performed
- Returns:
The species time trace in a numpy array If replicate is None: A dictionary with replicate numbers as keys and time traces as values
- Return type:
If replicate is specified
- jLM.CMEPostProcessing.getSpecies(f)[source]#
Exract the species names
- Parameters:
f – The HDF5 file handle to extract from or the name of a file to open
- jLM.CMEPostProcessing.getTimesteps(f)[source]#
Extract the timestep times
- Parameters:
f – The HDF5 file handle to extract from or the name of a file to open
- Returns:
The timestep times in a numpy array
- jLM.CMEPostProcessing.getTrajectory(f, replicate, specie)[source]#
Get trajectory data for a specific replicate and species
- Parameters:
f – The HDF5 file handle to extract from or the name of a file to open
replicate – The replicate number (0-indexed for compatibility with your usage)
specie – The species name to extract
- Returns:
The species trajectory data
- Return type:
numpy.ndarray
- jLM.CMEPostProcessing.openLMFile(filename)[source]#
Open a Lattice Microbes File for reading
- Parameters:
filename – Name of the file
- Returns:
a handle to the file
- jLM.CMEPostProcessing.plotAvgVar(f, species=None, filename=None, **kwargs)[source]#
Plot a specific species average over time and variance
- Parameters:
f – An h5py object handle
species – A list of species to show
filename – A filename to print to (default None, gives the same behavior as showAvgVar(…))
kwargs –
- Additional arguments to be passed on to matplotlib.plot.
These are any arguments that are valid with matplotlib.plot
- Returns:
A handle to the figure object created which allows customization of plot attributes
- jLM.CMEPostProcessing.plotAvgVarFromFile(filename, species, outfile, **kwargs)[source]#
Plot species from an output file
- Parameters:
filename – The name of an HDF5 output file generated by LatticeMicrobes
species – A list of species to plot
kwargs – Additional arguments to be passed on to matplotlib.plot. These are any arguments that are valid with matplotlib.plot
outfile – A filename to plot to
- jLM.CMEPostProcessing.plotCMEReactionNetwork(sim, filename, withRxnNodes=False, collapseReversible=False)[source]#
Plot the reaction scheme as a network
- Parameters:
sim – An CMESimulation object
filename – A file to which to output
withRxnNodes – Plot the graph with reactions as nodes (default: false)
collapseReversible – Collapsee reversible reactions into one node (default: false)
- jLM.CMEPostProcessing.plotOccupancyKymograph(f, species=None, replicate=1, filename=None)[source]#
Plot a specific specie density(occupancy) among a slice of the simulation domain as a function of a direction over time
- Parameters:
f – The name of the LM file
specie – A particular specie to plot density for
filename – A filename to print to (default None, gives the same behavior as showAvgVar(…))
replicate – The replicate to show trace for the kymograph from the file
- jLM.CMEPostProcessing.plotPhaseSpace(f, species=None, replicate=1, withHistogram=False)[source]#
Plot the 2D or 3D phase space associated with the given species over the replicates indicated
- Parameters:
f – An h5py object handle
specie – An iterable of 2 or 3 specie names indicating whether to plot in 2D or 3D space
replicate – The replicate to show trace for
withHistogram – If set to true, a heatmap of the phase space over all replicates will be plotted in the background. (NOTE: this only works in 2D.)
- jLM.CMEPostProcessing.plotTrace(f, species=None, replicate=1, filename=None, **kwargs)[source]#
Plot a specific species trace
- Parameters:
f – An h5py object handle
species – A specie name or a list of species to show; can be a single string or a iterable list of species
filename – A filename to print to (default None, gives the same behavior as showAvgVar(…))
replicate – The replicate to show trace for. Can be an integer or an iterable list of replicte numbers
kwargs –
- Additional arguments to be passed on to matplotlib.plot.
These are any arguments that are valid with matplotlib.plot
- Returns:
A handle to the figure object created which allows customization of plot attributes
- jLM.CMEPostProcessing.plotTraceFromFile(filename, species, replicate, outfile, **kwargs)[source]#
Plot species from an output file
- Parameters:
filename – The patch to an HDF5 output file generated by LatticeMicrobes
species – A list of species to plot
replicate – The replicate to show trace for
kwargs – Additional arguments to be passed on to matplotlib.plot. These are any arguments that are valid with matplotlib.plot
outfile – A filename to plot to
- jLM.CMEPostProcessing.showAvgVar(f, species, **kwargs)[source]#
Show a specific species average over time and variance
- Parameters:
f – An h5py object handle
species – A list of species to show
kwargs – Additional arguments to be passed on to matplotlib.plot. These are any arguments that are valid with matplotlib.plot
- jLM.CMEPostProcessing.showAvgVarFromFile(filename, species, **kwargs)[source]#
Show species from an output file :param filename: The name of an HDF5 output file generated by LatticeMicrobes :param species: A list of species to plot :param kwargs: Additional arguments to be passed on to matplotlib.plot. These are any arguments that are valid with matplotlib.plot
- jLM.CMEPostProcessing.showOccupancyKymograph(f, species=None, replicate=1)[source]#
Show a specific specie density(occupancy) among a slice of the simulation domain as a function of a direction over time
- Parameters:
f – An h5py object handle
specie – A particular specie to plot density for
replicate – The replicate to show trace for
- jLM.CMEPostProcessing.showTrace(f, species, replicate, **kwargs)[source]#
Show a specific species trace
- Parameters:
f – An h5py object handle
species – A list of species to show
replicate – The replicate to show trace for
kwargs – Additional arguments to be passed on to matplotlib.plot. These are any arguments that are valid with matplotlib.plot
- jLM.CMEPostProcessing.showTraceFromFile(filename, species, replicate, **kwargs)[source]#
Show species trace from a particular replicate
- Parameters:
filename – The patch to an HDF5 output file generated by LatticeMicrobes
species – A list of species to plot
replicate – The replicate to show trace for
kwargs – Additional arguments to be passed on to matplotlib.plot. These are any arguments that are valid with matplotlib.plot