-
Notifications
You must be signed in to change notification settings - Fork 37
Matlab Routines
In addition to the general routines for reading in and visualizing output from simulations, iDynoMiCS includes a basic set of routines useful for post-processing 2D simulations in particular. These routines are located in the iDynoMiCS\results_analysis_matlab\routines_2d directory. The following routines are available for you to examine simulation outputs.
showRunInfo(nFile): This routine will print out information about the simulation, including the names of bulk compartments, solutes, agent species, and reactions, and will also print a list of the iterates for which outputs were saved. If nFile is not given, the last iterate is used.
plotAgents(nFile): This routine will plot all the agents for a particular iterate using the ‘agent_State’ file, useful for examining the location of each species within the biofilm. Each agent is represented by a circle colored for each species, but note that the sizes of the circles DO NOT correspond to the actual size of the agents. If you want a plot of the agents with the correct agent sizes, use the makePic command described above to create a rendered file with POV-Ray.
plotContour(nFile,fieldName): This routine plots a contour for a particular field given in the ‘env_State’ file, thus may be used to plot solute concentration fields, biomass concentration fields, and fields for reaction rates. The routine also recognizes two additional options for fieldName: allbio will plot a contour for all biomass in the system, and ‘interface’ will plot a contour that shows the location of the biofilm/liquid interface.
plotMix(nFile,fieldName): This routine is a mix of the plotAgents and plotContour routines. It will plot the field given by fieldName, and then plot the agents on top of the contour so that you may see how the agents affect the gradients in the particular field.
plotProfile(nFile,hloc,vtop): This routine plots a 1D profile of the solute concentration fields, reaction rates, and biomass concentrations perpendicular to the substratum. nFile once again specifies the iterate to plot. hloc specifies the horizontal position at which the profile is to be plotted (distance in micrometers from the origin), but hloc may also be used to plot instead the horizontal average of each quantity (hloc = avg) or the average along with standard deviation (hloc = std). vtop is optional and may be used to specify the vertical limit of the plotted region; setting vtop to ‘edge’ limits the plot to show only the region within the biofilm.
plotTime(type): This routine plots one of several different quantities as a function of time. The possible arguments for type are:
- bulks: plots the bulk concentration in each bulk compartment
- bulk_rates: plots the rate of change of bulk concentrations in each bulk compartment
- N: plots the numbers of each species
- interface: plots the mean and maximum biofilm thickness
- simpsonIndex: plots the diversity index (0 is more homogeneous, 1 is more diverse)
- simpsonIndex_noeps: also plots the diversity index, but excludes any species with EPS in the name
For performance reasons, it is useful to manually unzip the agent_Sum.zip and env_Sum.zip files before using this routine.
**Note **: Typing ‘help’ and then the command name (eg. help plotAgents) in Matlab will also give you a description for what each argument does.
The above routines are all built using the more base-level routines located in the iDynoMiCS\results_analysis_matlab\routines_2d\utilities directory. Each file has a short description you may access using the help command in Matlab, and if you have additional analyses you would like to carry out these files might be helpful as you construct your own post-processing routines.
Of particular note are three routines useful for extracting data from the simulation output files:
getAgentData(nFile,type): this file is similar to the previous loadAgents routine, but using the type argument allows one to load the agent information as individuals, on the species level, placed onto a solute-style grid, or placed onto a solute-style grid but separated into active, inert, and EPS components. Type help getAgentData for a more complete description.
getEnvData(nFile): this is similar to the previous loadSolute routine, but returns the information in the solute output files split by type (solute, reaction, biomass, etc.). This routine may also return biofilm height and biomass pressure information. Again, type help getEnvData for a more complete description.
getBulkData(nFile): this routine loads bulk concentration information that is stored in the env_Sum files, and may also return biofilm height information. Remember: help is your friend.
If you examine the above 2D plotting scripts you will see that they make extensive use of these get*Data routines, and that you may make similar use of the scripts in constructing your own post-processing routines.