コード例 #1
0
ファイル: warppba.py プロジェクト: JiayangY/sirepo
def background_percent_complete(report, run_dir, is_running):
    files = _h5_file_list(run_dir)
    if len(files) < 2:
        return PKDict(
            percentComplete=0,
            frameCount=0,
        )
    file_index = len(files) - 1
    last_update_time = int(os.path.getmtime(str(files[file_index])))
    # look at 2nd to last file if running, last one may be incomplete
    if is_running:
        file_index -= 1
    data = simulation_db.read_json(
        run_dir.join(template_common.INPUT_BASE_NAME))
    Fr, info = field_reader.read_field_circ(str(files[file_index]), 'E/r')
    plasma_length = float(data.models.electronPlasma.length) / 1e3
    zmin = float(data.models.simulationGrid.zMin) / 1e6
    percent_complete = (info.imshow_extent[1] / (plasma_length - zmin))
    if percent_complete < 0:
        percent_complete = 0
    elif percent_complete > 1.0:
        percent_complete = 1.0
    return PKDict(
        lastUpdateTime=last_update_time,
        percentComplete=percent_complete * 100,
        frameCount=file_index + 1,
    )
コード例 #2
0
ファイル: warppba.py プロジェクト: e-carlin/sirepo
def background_percent_complete(report, run_dir, is_running):
    files = _h5_file_list(run_dir)
    if len(files) < 2:
        return {
            'percentComplete': 0,
            'frameCount': 0,
        }
    file_index = len(files) - 1
    last_update_time = int(os.path.getmtime(str(files[file_index])))
    # look at 2nd to last file if running, last one may be incomplete
    if is_running:
        file_index -= 1
    data = simulation_db.read_json(run_dir.join(template_common.INPUT_BASE_NAME))
    Fr, info = field_reader.read_field_circ(str(files[file_index]), 'E/r')
    plasma_length = float(data['models']['electronPlasma']['length']) / 1e3
    zmin = float(data['models']['simulationGrid']['zMin']) / 1e6
    percent_complete = (info.imshow_extent[1] / (plasma_length - zmin))
    if percent_complete < 0:
        percent_complete = 0
    elif percent_complete > 1.0:
        percent_complete = 1.0
    return {
        'lastUpdateTime': last_update_time,
        'percentComplete': percent_complete * 100,
        'frameCount': file_index + 1,
    }
コード例 #3
0
ファイル: warp.py プロジェクト: roussel-ryan/sirepo
def background_percent_complete(report, run_dir, is_running, schema):
    files = _h5_file_list(run_dir)
    if len(files) < 2:
        return {
            'percentComplete': 0,
            'frameCount': 0,
        }
    file_index = len(files) - 1
    last_update_time = int(os.path.getmtime(str(files[file_index])))
    # look at 2nd to last file if running, last one may be incomplete
    if is_running:
        file_index -= 1
    data = simulation_db.read_json(run_dir.join(template_common.INPUT_BASE_NAME))
    Fr, info = field_reader.read_field_circ(str(files[file_index]), 'E/r')
    plasma_length = float(data['models']['electronPlasma']['length']) / 1e3
    zmin = float(data['models']['simulationGrid']['zMin']) / 1e6
    percent_complete = (info.imshow_extent[1] / (plasma_length - zmin))
    if percent_complete < 0:
        percent_complete = 0
    elif percent_complete > 1.0:
        percent_complete = 1.0
    return {
        'lastUpdateTime': last_update_time,
        'percentComplete': percent_complete * 100,
        'frameCount': file_index + 1,
    }
コード例 #4
0
ファイル: warppba.py プロジェクト: JiayangY/sirepo
def _adjust_z_width(data_list, data_file):
    # match boundaries with field report
    Fr, info = field_reader.read_field_circ(data_file.filename, 'E/r')
    extent = info.imshow_extent
    return [
        numpy.append(data_list[0], [extent[0], extent[1]]),
        numpy.append(data_list[1], [extent[2], extent[3]]),
        numpy.append(data_list[2], [0, 0]),
    ]
コード例 #5
0
ファイル: warppba.py プロジェクト: e-carlin/sirepo
def _adjust_z_width(data_list, data_file):
    # match boundaries with field report
    Fr, info = field_reader.read_field_circ(data_file.filename, 'E/r')
    extent = info.imshow_extent
    return [
        numpy.append(data_list[0], [extent[0], extent[1]]),
        numpy.append(data_list[1], [extent[2], extent[3]]),
        numpy.append(data_list[2], [0, 0]),
    ]