<jupyter_start><jupyter_text>Import packages<jupyter_code>from phantasy import disable_warnings
disable_warnings()
from phantasy import MachinePortal
from phantasy.tools import plot_orbit<jupyter_output><empty_output><jupyter_text>Load machine/lattice<jupyter_code>mp = MachinePortal("FRIB_VA", "LEBT")
lat = mp.work_lattice_conf<jupyter_output><empty_output><jupyter_text>Sync device live settings<jupyter_code>lat.sync_settings()
path, fm = lat.run()
# fm.generate_latfile(latfile='test1.lat')<jupyter_output><empty_output><jupyter_text>Show the simulated envelope<jupyter_code>p1 = plot_orbit(('pos', 'xrms'), ('pos', 'yrms'), flame_model=fm)<jupyter_output><empty_output><jupyter_text>Change initial beam condition1. Read from another FLAME lattice file```pythonfrom flame_utils import ModelFlame, generate_sourcefm1 = ModelFlame(lat_file='some_lat_file')bs1 = fm1.bmstates1 = generate_source(state=bs1)```2. Manually prepare beam condition, i.e. source configuration, see below<jupyter_code>from numpy import array
s1 = {'index': 0,
 'properties': {'IonChargeStates': array([ 0.13865546]),
  'IonEk': 11969.995341581,
  'IonEs': 931494320.0,
  'NCharge': array([ 10111.]),
  'P0': array([  1.08055458e-14,  -3.81040863e-18,   1.33339836e-14,
          -5.69478990e-18,  -1.49954832e-15,   0.00000000e+00,
           1.00000000e+00]),
  'S0': array([  6.81917302e+02,  -2.52846423e-01,   3.83669247e+01,
          -1.26756931e-02,   2.80851875e-01,  -1.06898705e-16,
           0.00000000e+00,  -2.52846423e-01,   9.44804331e-05,
          -6.25559687e-03,   1.77946925e-06,  -9.79349148e-05,
           4.48060691e-20,   0.00000000e+00,   3.83669247e+01,
          -6.25559687e-03,   8.92535761e+02,  -3.39508360e-01,
           8.36844956e-02,   0.00000000e+00,   0.00000000e+00,
          -1.26756931e-02,   1.77946925e-06,  -3.39508360e-01,
           1.29900589e-04,  -3.00943030e-05,   0.00000000e+00,
           0.00000000e+00,   2.80851875e-01,  -9.79349148e-05,
           8.36844956e-02,  -3.00943030e-05,   1.68488662e-04,
           9.87582187e-15,   0.00000000e+00,  -1.06898705e-16,
           4.48060691e-20,   0.00000000e+00,   0.00000000e+00,
           9.87582187e-15,   1.00000000e-19,   0.00000000e+00,
           0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
           0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
           0.00000000e+00]),
  'matrix_variable': 'S',
  'name': 'S',
  'type': 'source',
  'vector_variable': 'P'}}<jupyter_output><empty_output><jupyter_text>Update beam initial condition<jupyter_code>fm.configure(econf=s1)<jupyter_output><empty_output><jupyter_text>Show the updated envelope<jupyter_code>p2 = plot_orbit(('pos', 'xrms'), ('pos', 'yrms'), flame_model=fm)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15203193033381712, 'fraction_numerical': 0.24274310595065313, 'mean_word_length': 3.9056939501779357, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 20, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '500773', 'license': 'MIT', 'n_tokens_mistral': 1556, 'n_tokens_neox': 1159, 'n_words': 155, 'path': '02_Online_model/online_model_with_flame.ipynb', 'repo_name': 'archman/notebook-warehouse', 'size': '2756'}