Example #1
0
def main():
    parser = get_minimal_parser()

    # add configuration specific to this tool.
    parser.description = dedent("""
        Run CADET simulator for a given input HDF5 file.
    """)
    parser.add_argument(
        'input_file',
        default=None,
        help='The name of the h5 file containing CADET inputs to run CADET on.'
    )

    args = parser.parse_args()

    if not isabs(args.log_dir):
        log_dir = join(args.output_dir, args.log_dir)
    else:
        log_dir = args.log_dir

    initialize_logging('run-cadet-sim',
                       verbose=args.verbose,
                       log_file=args.log,
                       log_dir=log_dir)

    run_cadet_simulator(args.input_file)
Example #2
0
 def test_setuplogging_with_file(self):
     log_file = abspath(join(HERE, "temp.log"))
     initialize_logging(log_file=log_file)
     try:
         self.assert_log_file_found(expected_file=log_file)
     finally:
         attempt_remove_file(log_file)
Example #3
0
 def test_setuplogging_with_prefix(self):
     initialize_logging(prefix="TEMP")
     try:
         self.assert_log_file_found()
     finally:
         log_file = get_log_file()
         attempt_remove_file(log_file)
def main():
    parser = get_minimal_parser()

    # add configuration specific to this tool.
    parser.description = dedent("""
        Run Chromatography simulation for a given experiment.
        The experiment data is read from the provided excel file.
    """)
    parser.add_argument(
        'input_file',
        default=None,
        help='The name of the excel file containing CADET inputs.')
    parser.add_argument('--expt-id',
                        default=None,
                        help='The name of the experiment to simulate.')
    parser.add_argument('--skip-cadet',
                        action='store_true',
                        help=('Skip running CADET analysis if the file '
                              'already exisits.'))
    parser.add_argument('--skip-plot',
                        action='store_true',
                        help=('Skip plotting the chromatograms.'))
    parser.add_argument(
        '--skip-anim',
        action='store_true',
        help=('Skip animations for each component concentrations.'))
    parser.add_argument('-o',
                        '--output',
                        default=None,
                        help='The name of CADET simulation file.')
    args = parser.parse_args()

    if not isabs(args.log_dir):
        log_dir = join(args.output_dir, args.log_dir)
    else:
        log_dir = args.log_dir

    initialize_logging('run-chrom-sim',
                       verbose=args.verbose,
                       log_file=args.log,
                       log_dir=log_dir)

    t0 = time.time()
    run_chromatography_simulation(args.input_file,
                                  args.output,
                                  expt_id=args.expt_id,
                                  skip_cadet=args.skip_cadet,
                                  skip_plot=args.skip_plot,
                                  skip_animation=args.skip_anim)
    elapsed_time = time.time() - t0
    msg = 'Elapsed time : {:0.2f} seconds'.format(elapsed_time)
    logger.info(msg)
    print(msg)
Example #5
0
    def _setup_logging(self):
        from kromatography.utils.app_utils import get_preferences, \
            initialize_logging

        if self.verbose:
            verbose = True
        else:
            preferences = get_preferences()
            verbose = preferences.app_preferences.console_logging_level <= 10

        self.log_filepath = initialize_logging(verbose=verbose)
Example #6
0
    for sim in sims:
        output_file = prepare_simulation_for_run(sim)
        yield run_cadet_simulator, (output_file,), {"use_slurm": use_slurm}


if __name__ == "__main__":
    from traits.api import Any, Button
    from traitsui.api import View, Item

    from kromatography.model.tests.sample_data_factories import \
        make_sample_simulation, make_sample_simulation_group2
    from kromatography.utils.app_utils import initialize_logging
    from kromatography.model.factories.job_manager import \
        create_start_job_manager

    initialize_logging(verbose=True)

    sim = make_sample_simulation(name='Run_1')
    NUM_JOBS = 1
    NUM_WORK_ITEMS_PER_JOB = 2
    NUM_SIM = NUM_JOBS * NUM_WORK_ITEMS_PER_JOB

    t0 = time()
    # runner1 = sim.run()
    # group = make_sample_simulation_group2(size=2)
    # runner2 = group.run(wait=True)

    class SimpleGroupUI(HasStrictTraits):
        group = Any
        job_manager = Any
        button = Button("Run sims")
Example #7
0
 def setUp(self):
     self.log_file = abspath(join(HERE, "temp.log"))
     initialize_logging(log_file=self.log_file)
Example #8
0
 def test_setuplogging_default_has_file(self):
     initialize_logging()
     self.assert_log_file_found()