Example #1
0
def _compute_range_across_files(run_dir, data):
    res = {}
    for v in _SCHEMA.enum.ParticleColumn:
        res[_map_field_name(v[0])] = []
    for filename in _ion_files(run_dir):
        sdds_util.process_sdds_page(filename, 0, _compute_sdds_range, res)
    return res
Example #2
0
def _compute_range_across_files(run_dir):
    data = simulation_db.read_json(run_dir.join(template_common.INPUT_BASE_NAME))
    if 'fieldRange' in data.models.particleAnimation:
        return data.models.particleAnimation.fieldRange
    res = {}
    for v in _SCHEMA.enum.ParticleColumn:
        res[_map_field_name(v[0])] = []
    for filename in _ion_files(run_dir):
        sdds_util.process_sdds_page(filename, 0, _compute_sdds_range, res)
    data.models.particleAnimation.fieldRange = res
    simulation_db.write_json(run_dir.join(template_common.INPUT_BASE_NAME), data)
    return res
Example #3
0
def _compute_range_across_files(run_dir, data):
    res = PKDict({
        _X_FIELD: [],
    })
    for v in _SCHEMA.enum.BeamColumn:
        res[_map_field_name(v[0])] = []
    for v in _SCHEMA.enum.CoolingRatesColumn:
        res[_map_field_name(v[0])] = []
    sdds_util.process_sdds_page(
        str(run_dir.join(_BEAM_EVOLUTION_OUTPUT_FILENAME)), 0,
        _compute_sdds_range, res)
    if run_dir.join(_FORCE_TABLE_FILENAME).exists():
        res2 = PKDict()
        for v in _SCHEMA.enum.ForceTableColumn:
            res2[_map_field_name(v[0])] = []
            sdds_util.process_sdds_page(
                str(run_dir.join(_FORCE_TABLE_FILENAME)), 0,
                _compute_sdds_range, res2)
        res.update(res2)
    #TODO(pjm): particleAnimation dp/p collides with beamEvolutionAnimation dp/p
    ion_files = _ion_files(run_dir)
    if ion_files:
        res2 = PKDict()
        for v in _SCHEMA.enum.ParticleColumn:
            res2[_map_field_name(v[0])] = []
        for filename in ion_files:
            sdds_util.process_sdds_page(filename, 0, _compute_sdds_range, res2)
        res.update(res2)
    # reverse field mapping back to enum values
    for k in _FIELD_MAP:
        v = _FIELD_MAP[k]
        if v in res:
            res[k] = res[v]
            del res[v]
    return res