idmtools.analysis.tags_analyzer module

Example of a tags analyzer to get all the tags from your experiment simulations into one csv file.

Copyright 2021, Bill & Melinda Gates Foundation. All rights reserved.

class idmtools.analysis.tags_analyzer.TagsAnalyzer(uid=None, working_dir=None, parse=True, output_path='output_tag')[source]

Bases: IAnalyzer

Provides an analyzer for CSV output.


# Example TagsAnalyzer for any experiment
# In this example, we will demonstrate how to use a TagsAnalyzer to put your sim tags in a csv file

# First, import some necessary system and idmtools packages.
from idmtools.analysis.analyze_manager import AnalyzeManager
from idmtools.analysis.tags_analyzer import TagsAnalyzer
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 since the Work Item we are analyzing was run on COMPS
    with Platform('CALCULON') as platform:

        # Arg option for analyzer init are uid, working_dir, data in the method map (aka select_simulation_data),
        # and filenames
        # Initialize the analyser class which just requires an experiment id
        analyzers = [TagsAnalyzer(output_path="output_tag")]

        # Set the experiment id you want to analyze
        experiment_id = '31285dfc-4fe6-ee11-9f02-9440c9bee941'  # comps exp id with partial succeed sims

        # Specify the id Type, in this case an Experiment on COMPS
        manager = AnalyzeManager(partial_analyze_ok=True,
                                 ids=[(experiment_id, ItemType.EXPERIMENT)],
__init__(uid=None, working_dir=None, parse=True, output_path='output_tag')[source]

Initialize our Tags Analyzer.

  • uid

  • working_dir

  • parse

  • output_path

See also



Initialize the item before mapping data. Here we create a directory for the output.



map(data: Dict[str, Any], simulation: IWorkflowItem | Simulation)[source]

Map our data for our Workitems/Simulations. In this case, we just extract the tags and build a dataframe from those.

  • data – List of files. This should be empty for us.

  • simulation – Item to extract


Data frame with the tags built.

reduce(all_data: Dict[IWorkflowItem | Simulation, DataFrame])[source]

Reduce the dictionary of items->Tags dataframe to a single dataframe and write to a csv file.


all_data – Map of Item->Tags dataframe