Beispiel #1
0
def _multibunch(tbt_datas, options):
    if tbt_datas.nbunches == 1:
        yield tbt_datas, options
        return
    for index in range(tbt_datas.nbunches):
        new_options = deepcopy(options)
        new_file_name = f"bunchid{tbt_datas.bunch_ids[index]}_{basename(new_options.files)}"
        new_options.files = join(dirname(options.files), new_file_name)
        yield tbt.TbtData([tbt_datas.matrices[index]], tbt_datas.date,
                          [tbt_datas.bunch_ids[index]],
                          tbt_datas.nturns), new_options
Beispiel #2
0
def _write_tbt_file(model, dir_path):
    ints = np.arange(NTURNS) - NTURNS / 2
    data_x = model.loc[:, "AMPX"].values[:, None] * np.cos(
        2 * np.pi * (model.loc[:, "MUX"].values[:, None] +
                     model.loc[:, "TUNEX"].values[:, None] * ints[None, :]))
    data_y = model.loc[:, "AMPY"].values[:, None] * np.cos(
        2 * np.pi * (model.loc[:, "MUY"].values[:, None] +
                     model.loc[:, "TUNEY"].values[:, None] * ints[None, :]))
    mats = dict(
        X=pd.DataFrame(data=np.random.randn(model.index.size, NTURNS) * NOISE +
                       data_x + COUPLING * data_y,
                       index=model.index),
        Y=pd.DataFrame(data=np.random.randn(model.index.size, NTURNS) * NOISE +
                       data_y + COUPLING * data_x,
                       index=model.index))
    tbt.write(os.path.join(dir_path, "test_file"),
              tbt.TbtData([mats], None, [0], NTURNS))