pySTDLM.PostProcessing#

Functions

closeLMFile(f)

Close a Lattice Microbes File

getAvgVarTrace(f, specie[, doublingTime])

Get the average and variance of the specie trace over time

getHistogram(f, species)

Get the histogram for a specie

getOccupancyKymograph(f[, species, replicate])

Compute the specie density(occupancy) among a slice of the simulation domain as a function over time for the given direciton

getPhaseSpace(f, species, replicate)

Get the nD phase space associated with the traces of species.

getSpecieTrace(f, specie[, replicate, ...])

Extract data for a particular specie for the specified replicate

getSpecies(f)

Exract the species names

getTimesteps(f)

Extract the timestep times

openLMFile(filename)

Open a Lattice Microbes File for reading

plotAvgVar(f[, species, filename])

Plot a specific species average over time and variance

plotAvgVarFromFile(filename, species, ...)

Plot species from an output file

plotOccupancyKymograph(f[, species, ...])

Plot a specific specie density(occupancy) among a slice of the simulation domain as a function of a direction over time

plotPhaseSpace(f[, species, replicate, ...])

Plot the 2D or 3D phase space associated with the given species over the replicates indicated

plotTrace(f[, species, replicate, filename])

Plot a specific species trace

plotTraceFromFile(filename, species, ...)

Plot species from an output file

setLMLogConsole([level])

Set the logger to write to the console as the code is working

setLMLogFile(filename[, level])

Set up file handler to print log to file

setLMLoggerLevel(level)

Set the level of the logger for the application

showAvgVar(f, species, **kwargs)

Show a specific species average over time and variance

showAvgVarFromFile(filename, species, **kwargs)

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.

showOccupancyKymograph(f[, species, replicate])

Show a specific specie density(occupancy) among a slice of the simulation domain as a function of a direction over time

showTrace(f, species, replicate, **kwargs)

Show a specific species trace

showTraceFromFile(filename, species, ...)

Show species trace from a particular replicate

Classes

Axes3D(fig[, rect, elev, azim, roll, ...])

3D Axes object.

pySTDLM.PostProcessing.closeLMFile(f)[source]#

Close a Lattice Microbes File

Parameters:

f – A previously opened lattice microbes file

pySTDLM.PostProcessing.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

pySTDLM.PostProcessing.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)

pySTDLM.PostProcessing.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

pySTDLM.PostProcessing.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, …)

pySTDLM.PostProcessing.getSpecieTrace(f, specie, replicate=1, doublingTime=None)[source]#

Extract data for a particular specie for the specified replicate

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 (default: 1)

  • 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

pySTDLM.PostProcessing.getSpecies(f)[source]#

Exract the species names

Parameters:

f – The HDF5 file handle to extract from or the name of a file to open

pySTDLM.PostProcessing.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

pySTDLM.PostProcessing.openLMFile(filename)[source]#

Open a Lattice Microbes File for reading

Parameters:

filename – Name of the file

Returns:

a handle to the file

pySTDLM.PostProcessing.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

pySTDLM.PostProcessing.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

pySTDLM.PostProcessing.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

pySTDLM.PostProcessing.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.)

pySTDLM.PostProcessing.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

pySTDLM.PostProcessing.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

pySTDLM.PostProcessing.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

pySTDLM.PostProcessing.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

pySTDLM.PostProcessing.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

pySTDLM.PostProcessing.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

pySTDLM.PostProcessing.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