idmtools.analysis.add_analyzer module¶
-
class
idmtools.analysis.add_analyzer.
AddAnalyzer
(filenames=None, output_path='output')¶ Bases:
idmtools.entities.ianalyzer.IAnalyzer
A simple base class to add analyzers.
Examples
# Example AddAnalyzer for EMOD Experiment # In this example, we will demonstrate how to create an AddAnalyzer to analyze an experiment's output file # First, import some necessary system and idmtools packages. from idmtools.analysis.analyze_manager import AnalyzeManager from idmtools.analysis.add_analyzer import AddAnalyzer from idmtools.core import ItemType from idmtools.core.platform_factory import Platform if __name__ == '__main__': # Set the platform where you want to run your analysis # In this case we are running in COMPS, but this can be changed to run 'Local' with Platform('COMPS2') as platform: # Arg option for analyzer init are uid, working_dir, data in the method map (aka select_simulation_data), # and filenames # In this case, we want to provide a filename to analyze filenames = ['StdOut.txt'] # Initialize the analyser class with the name of file to save to and start the analysis analyzers = [AddAnalyzer(filenames=filenames)] # Set the experiment you want to analyze experiment_id = 'f227704e-0c34-ea11-a2be-f0921c167861' # comps2 staging exp id # Specify the id Type, in this case an Experiment manager = AnalyzeManager(ids=[(experiment_id, ItemType.EXPERIMENT)], analyzers=analyzers) manager.analyze()
-
filter
(item)¶ Decide whether the analyzer should process a simulation.
- Parameters
item – An
IItem
to be considered for processing with this analyzer.- Returns
A Boolean indicating whether simulation should be analyzed by this analyzer.
-
initialize
()¶ Call once after the analyzer has been added to the
AnalyzeManager
.Add everything depending on the working directory or unique ID here instead of in __init__.
-
map
(data, item)¶ In parallel for each simulation, consume raw data from filenames and emit selected data.
- Parameters
data – A dictionary associating filename with content for simulation data.
item –
IItem
object that the passed data is associated with.
- Returns
Selected data for the given item.
-