# coding: utf-8

from __future__ import division, print_function

"""
Frequency map a potential. Before calling this module, you'll need to generate
a grid of initial conditions or make sure the grid you have is in the correct
format. You also need to have a text file containing the name of the potential
that you used to generate the initial conditions (the name has to be one specified
in the ``potential_registry``).

For example, you might do::

    python scripts/make_grid.py -E -0.14 --potential=triaxial-NFW \
    --ic-func=tube_grid_xz --dx=5 --dz=5

and then run this module on::

    python scripts/freqmap/freqmap.py --path=output/freqmap/triaxial-NFW/E-0.140_tube_grid_xz/

"""

__author__ = "adrn <adrn@astro.columbia.edu>"

# Standard library
import sys

# project
from streammorphology.util import main, get_parser, callback
from streammorphology.freqmap import worker, parser_arguments, dtype

parser = get_parser()
for args,kwargs in parser_arguments:
    parser.add_argument(*args, **kwargs)

args = parser.parse_args()

dargs = dict(args._get_kwargs())
main(worker=worker, callback=callback, path=dargs.pop('path'),
     cache_filename='allfreqs.dat', cache_dtype=dtype, str_index=dargs.pop('index'),
     mpi=dargs.pop('mpi'), overwrite=dargs.pop('overwrite'), seed=dargs.pop('seed'),
     verbose=dargs.pop('verbose'), quiet=dargs.pop('quiet'),
     **dargs)

sys.exit(0)

@@ -799,21 +799,16 @@
 logy
-.util
  import 
 main
@@ -807,34 +807,24 @@
 ort 
-main, get_parser, callback
+ExperimentRunner
 %0Afro
@@ -861,509 +861,66 @@
 ort 
-worker, parser_arguments, dtype%0A%0Aparser = get_parser()%0Afor args,kwargs in parser_arguments:%0A    parser.add_argument(*args, **kwargs)%0A%0Aargs = parser.parse_args()%0A%0Adargs = dict(args._get_kwargs())%0Amain(worker=worker, callback=callback, path=dargs.pop('path'),%0A     cache_filename='allfreqs.dat', cache_dtype=dtype, str_index=dargs.pop('index'),%0A     mpi=dargs.pop('mpi'), overwrite=dargs.pop('overwrite'), seed=dargs.pop('seed'),%0A     verbose=dargs.pop('verbose'), quiet=dargs.pop('quiet'),%0A     **dargs
+Freqmap%0A%0Arunner = ExperimentRunner(ExperimentClass=Freqmap
 )%0A%0As

update script call