Skip to content

AuditoryBiophysicsLab/ESME-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESME Workbench: Python API for simulation.exposures files

This is the python API for accessing the simulation.exposures file generated by The ESME Workbench (http://esme.bu.edu).

It requires Python 3.6.

The latest version of this API, and the workbench, can be found at http://esme.bu.edu/download .

Installation

pip install git+https://github.com/AuditoryBiophysicsLab/ESME-API@master

Usage

The esme module provides the class EsmeLog.

Constructing a new instance of the class with the filename of the simulation.exposures file reads the header of that file and populates class attributes appropriately via an internal method.

ex:

    from esme import EsmeLog
    sim = EsmeLog('/path/to/simulation.exposures') #  replace with your path

sim will now contain non-null header information, including sim.timestep_record_offsets -- a list of indicies of each time step record.

sim.timestep_record(offset) returns a struct containing:

  • a given time step's time
  • the position of every platform and animat in the scenario at that time step
  • a list of all animats that were exposed to sound at that time step as well as
    • the ID of the mode that exposed them
    • the sound level
    • the total energy accumulated at that time step.

ex:

    record = sim.timestep_record(sim.timestep_record_offsets[0])
    record5 = sim.timestep_record(sim.timestep_record_offsets[5])
    recordLast = sim.timestep_record(sim.timestep_record_offsets[-1])
    print(f"record 1 had {record.actor_count} actors and began at {record.start_time}")
    print(f"record 5 had {record5.actor_count} actors and began at {record5.start_time}")
    print(f"the last record had {recordLast.actor_count} actors and began at {recordLast.start_time}")

About

API for analysis of ESME simulation results

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages