Welcome to LightWin’s documentation!
LightWin
- Installation
- Usage
- The
getmethod - Configuration
- Units and conventions
- Utility scripts
- Bibliography
- API Reference
- beam_calculation package
- config package
- core package
- accelerator package
- beam_parameters package
- commands package
- elements package
- list_of_elements package
- transfer_matrix package
- electric_field module
- instruction module
- instructions_factory module
- particle module
- evaluator package
- failures package
- optimisation package
- scripts package
- tracewin_utils package
- util package
- visualization package
- config_manager module
- constants module
- Examples
Todo
Precise that BeamParametersFactory and TransferMatrixFactory are mandatory.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/beam_calculator.py:docstring of lightwin.beam_calculation.beam_calculator, line 8.)
Todo
default_field_map_folder has a wrong default value. Should take
path to the .dat file, that is not known at this point. Maybe
handle this directly in the InstructionsFactory or
whatever.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/beam_calculator.py:docstring of lightwin.beam_calculation.beam_calculator.BeamCalculator._set_up_common_factories, line 3.)
Todo
update_reference_phase is currently unused, because it is not
useful once the propagation has been calculated. So… should I
keep it? Maybe it can be useful in post_optimisation_run_with_this,
or in scripts to convert the phase between the different
references, or when I want to save the .dat?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/beam_calculator.py:docstring of lightwin.beam_calculation.beam_calculator.BeamCalculator.run, line 3.)
Todo
Handle reference synchronous phase.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/beam_calculator.py:docstring of lightwin.beam_calculation.beam_calculator.BeamCalculator.reference_phase, line 3.)
Todo
Patch in transfer matrix to get proper input transfer matrix. In future, input beam will not hold transf mat in anymore.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/envelope_1d/simulation_output_factory.py:docstring of lightwin.beam_calculation.envelope_1d.simulation_output_factory.SimulationOutputFactoryEnvelope1D.run, line 3.)
Todo
I think that this module could be greatly enhanced. I am not a Cython specialist and suggestions are welcome.
(The original entry is located in docstring of lightwin.beam_calculation.envelope_1d.transfer_matrices_c, line 6.)
Todo
Field maps better to create the transfer matrix in one passage at the end?
(The original entry is located in docstring of lightwin.beam_calculation.envelope_1d.transfer_matrices_c, line 10.)
Todo
the passing of the field maps is not clean at all
(The original entry is located in docstring of lightwin.beam_calculation.envelope_1d.transfer_matrices_c, line 13.)
Todo
Possible to use only lists here. May speed up the code, especially in _c. But numpy is fast, no?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/envelope_1d/transfer_matrices_p.py:docstring of lightwin.beam_calculation.envelope_1d.transfer_matrices_p, line 6.)
Todo
send beta as argument to avoid recomputing it each time
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/envelope_1d/transfer_matrices_p.py:docstring of lightwin.beam_calculation.envelope_1d.transfer_matrices_p, line 10.)
Todo
clean, fix, separate leapfrog integration in dedicated module
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/envelope_1d/transfer_matrices_p.py:docstring of lightwin.beam_calculation.envelope_1d.transfer_matrices_p.z_field_map_leapfrog, line 3.)
Todo
Maybe Envelope3D could inherit from Envelope1D
and this method would be written only once.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/envelope_3d/envelope_3d.py:docstring of lightwin.beam_calculation.envelope_3d.envelope_3d.Envelope3D._adapt_cavity_settings, line 6.)
Todo
Patch in transfer matrix to get proper input transfer matrix. In future, input beam will not hold transf mat in anymore.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/envelope_3d/simulation_output_factory.py:docstring of lightwin.beam_calculation.envelope_3d.simulation_output_factory.SimulationOutputFactoryEnvelope3D.run, line 3.)
Todo
3D field maps?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/envelope_3d/transfer_matrices_p.py:docstring of lightwin.beam_calculation.envelope_3d.transfer_matrices_p, line 6.)
Todo
Maybe it would be clearer to compose r_xx, r_yy, r_zz. As an example, the zz_drift is used in several places.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/envelope_3d/transfer_matrices_p.py:docstring of lightwin.beam_calculation.envelope_3d.transfer_matrices_p, line 9.)
Todo
Will be necessary to separate this module into several sub-packages
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/envelope_3d/transfer_matrices_p.py:docstring of lightwin.beam_calculation.envelope_3d.transfer_matrices_p, line 13.)
Todo
more math, less numpy. look at envelope 1d version
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/envelope_3d/transfer_matrices_p.py:docstring of lightwin.beam_calculation.envelope_3d.transfer_matrices_p, line 16.)
Todo
As I am working on floats and not on np arrays, maybe the functions from the cmath package would be more adapted?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/envelope_3d/transfer_matrices_p.py:docstring of lightwin.beam_calculation.envelope_3d.transfer_matrices_p._quadrupole_trigo_hyperbolic, line 3.)
Todo
fixme
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/factory.py:docstring of lightwin.beam_calculation.factory.BeamCalculatorsFactory._patch_to_remove_misunderstood_key, line 3.)
Todo
different functions, for different outputs. At least, an _element_to_index and a _element_to_indexes. And also a different function for when the index element is desired.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/simulation_output/factory.py:docstring of lightwin.beam_calculation.simulation_output.factory._element_to_index, line 7.)
Todo
Do I really need the r_zz_elt key??
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/simulation_output/simulation_output.py:docstring of lightwin.beam_calculation.simulation_output.simulation_output, line 3.)
Todo
Do I really need z_abs? Envelope1D does not uses it while TraceWin does.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/simulation_output/simulation_output.py:docstring of lightwin.beam_calculation.simulation_output.simulation_output, line 6.)
Todo
Transfer matrices are stored in TransferMatrix, but also in
BeamParameters.zdelta.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/simulation_output/simulation_output.py:docstring of lightwin.beam_calculation.simulation_output.simulation_output, line 9.)
Todo
Maybe the synchronous phase model should appear somewhere in here?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/simulation_output/simulation_output.py:docstring of lightwin.beam_calculation.simulation_output.simulation_output, line 13.)
Todo
normalized or not???
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/tracewin/beam_parameters_factory.py:docstring of lightwin.beam_calculation.tracewin.beam_parameters_factory.BeamParametersFactoryTraceWin._extract_emittance_for_99percent, line 3.)
Todo
fix possible unbound error for n_columns.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/tracewin/simulation_output_factory.py:docstring of lightwin.beam_calculation.tracewin.simulation_output_factory._remove_incomplete_line, line 3.)
Todo
another possibly unbound error to handle
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/tracewin/simulation_output_factory.py:docstring of lightwin.beam_calculation.tracewin.simulation_output_factory._add_dummy_data, line 6.)
Todo
This absolute phase thing should be fixed now. Check this.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/tracewin/tracewin.py:docstring of lightwin.beam_calculation.tracewin.tracewin, line 16.)
Todo
Maybe I should also store the synchronous phase?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/beam_calculation/tracewin/tracewin.py:docstring of lightwin.beam_calculation.tracewin.tracewin.TraceWin._save_cavities_entry_phases, line 8.)
Todo
Handling of arguments for TW could be cleaner
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/config/beam_calculator.py:docstring of lightwin.config.beam_calculator, line 3.)
Todo
I do not like the fact that some design_space_kw values are defined
twice… I could move the default values to the initialisation of the
DesignSpace object maybe. Eventually, everything from this script will be
moved to the object instantiation anyway.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/config/design_space.py:docstring of lightwin.config.design_space, line 3.)
Todo
It would be interesting to be able to pass some fig_kw directly from the
.toml. I guess it is one of the reason of why I started refactoring the
plots…
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/config/plots.py:docstring of lightwin.config.plots, line 7.)
Todo
Specific test for every optimisation method? For now, just trust the user.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/config/wtf.py:docstring of lightwin.config.wtf, line 3.)
Todo
Maybe make test and config to dict more compact?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/config_manager.py:docstring of lightwin.config_manager, line 9.)
Todo
- position:
element name
element number
end_section
- variable:
maybe add this? Unnecessary at this point
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/config_manager.py:docstring of lightwin.config_manager, line 12.)
Todo
Remove global variables.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/config_manager.py:docstring of lightwin.config_manager, line 20.)
Todo
Compute_transfer_matrices: simplify, add a calculation of missing phi_0 at the end
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/accelerator/accelerator.py:docstring of lightwin.core.accelerator.accelerator, line 9.)
Todo
Cleaner Accelerator factory (use class, not just a function).
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/accelerator/accelerator.py:docstring of lightwin.core.accelerator.accelerator, line 13.)
Todo
Should I reset the sync particle entry phase?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/accelerator/accelerator.py:docstring of lightwin.core.accelerator.accelerator.Accelerator.keep_settings, line 3.)
Todo
Remove tracewin command from BeamParameters
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/beam_parameters/__init__.py:docstring of lightwin.core.beam_parameters, line 6.)
Todo
Remove the is_3d, is_multipart as I always create the same
object with True, True.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/beam_parameters/factory.py:docstring of lightwin.core.beam_parameters.factory.InitialBeamParametersFactory, line 5.)
Todo
Would be better if all emittances had the same units? Check consistency with rest of the code…
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/beam_parameters/helper.py:docstring of lightwin.core.beam_parameters.helper.twiss_from_sigma, line 9.)
Todo
Could be cleaner.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/beam_parameters/initial_beam_parameters.py:docstring of lightwin.core.beam_parameters.initial_beam_parameters.InitialBeamParameters.sigma, line 3.)
Todo
Implement SET_SYNC_PHASE
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/commands/__init__.py:docstring of lightwin.core.commands, line 3.)
Todo
How should I save the min/max variables?? For now, use None.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/commands/adjust.py:docstring of lightwin.core.commands.adjust, line 8.)
Todo
handle personalized name of commands (marker)
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/commands/factory.py:docstring of lightwin.core.commands.factory, line 3.)
Todo
Check if it would be relatable to hold some arguments? As for now, I would be better off with a run function instead of a class.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/commands/factory.py:docstring of lightwin.core.commands.factory.CommandFactory.__init__, line 3.)
Todo
Make this robust.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/commands/factory.py:docstring of lightwin.core.commands.factory.CommandFactory._personalized_name, line 3.)
Todo
As for now, the effect of this command will be overriden by the _force_a_lattice_for_every_element. See how I should handle this…
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/commands/lattice.py:docstring of lightwin.core.commands.lattice.LatticeEnd.apply, line 3.)
Todo
Should also modify RFQ_CEL, CAVSIN, NCELLS according to doc.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/commands/set_sync_phase.py:docstring of lightwin.core.commands.set_sync_phase, line 3.)
Todo
Check if this still works, as lattice and idx_in_lattice are now initialized with -1 instead of None.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/commands/superpose_map.py:docstring of lightwin.core.commands.superpose_map.SuperposeMap._decrement_lattice_indexes, line 3.)
Todo
Check behavior w.r.t. LATTICE.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/elements/edge.py:docstring of lightwin.core.elements.edge, line 3.)
Todo
clean the patch for the ‘name’. my has and get methods do not work with @property
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/elements/element.py:docstring of lightwin.core.elements.element, line 3.)
Todo
Make this robust.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/elements/factory.py:docstring of lightwin.core.elements.factory.ElementFactory._personalized_name, line 3.)
Todo
Similar to synchronous phase, allow for V_cav to be “master” instead of k_e.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/elements/field_maps/cavity_settings.py:docstring of lightwin.core.elements.field_maps.cavity_settings, line 7.)
Todo
Which syntax for when I want to compute the value of a property but not
return it? Maybe a _ = self.phi_0_abs? Maybe this case should not
appear here, appart for when I debug.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/elements/field_maps/cavity_settings.py:docstring of lightwin.core.elements.field_maps.cavity_settings.CavitySettings, line 3.)
Todo
Determine if status should be kept here or in the field map.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/elements/field_maps/cavity_settings.py:docstring of lightwin.core.elements.field_maps.cavity_settings.CavitySettings, line 11.)
Todo
For TraceWin solver, I will also need the field map index.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/elements/field_maps/cavity_settings.py:docstring of lightwin.core.elements.field_maps.cavity_settings.CavitySettings, line 14.)
Todo
Maybe not necessary to raise an error when there is a mismatch.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/elements/field_maps/cavity_settings.py:docstring of lightwin.core.elements.field_maps.cavity_settings.CavitySettings._check_consistency_of_status_and_reference, line 3.)
Todo
This will be subclassed, as the different solvers do not have the same
needs. TraceWin does not need to load the electromagnetic fields,
so every FIELD_MAP is implemented.
Envelope1D cannot support 3D.
etc
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/elements/field_maps/factory.py:docstring of lightwin.core.elements.field_maps.factory, line 6.)
Todo
Handle the different kind of field_maps…
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/elements/field_maps/field_map.py:docstring of lightwin.core.elements.field_maps.field_map, line 3.)
Todo
Completely handle the SET_SYNCH_PHASE command
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/elements/field_maps/field_map.py:docstring of lightwin.core.elements.field_maps.field_map, line 6.)
Todo
Hande phi_s fitting with TraceWin.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/elements/field_maps/field_map.py:docstring of lightwin.core.elements.field_maps.field_map, line 9.)
Todo
Maybe move this to the field_map package once it is implemented
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/elements/superposed_field_map.py:docstring of lightwin.core.elements.superposed_field_map, line 7.)
Todo
The line is edited to remove personalized name, weight and always have
the same arguments at the same position. But after I shall re-add them with
reinsert_optional_commands_in_line. This is very patchy and un-Pythonic.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/instruction.py:docstring of lightwin.core.instruction, line 3.)
Todo
Instantiate this in BeamCalculator. It could be initialized with
the load_electromagnetic_files flag (False for TraceWin), the list of
implemented elements/commands (ex Envelope3D, not everything is set).
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/instructions_factory.py:docstring of lightwin.core.instructions_factory, line 3.)
Todo
maybe ElementFactory and CommandFactory should be instantiated from this? Or from another class, but they do have a lot in common
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/instructions_factory.py:docstring of lightwin.core.instructions_factory, line 8.)
Todo
for now, forcing loading of cython field maps
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/instructions_factory.py:docstring of lightwin.core.instructions_factory, line 12.)
Todo
Check if the return value from apply_commands is necessary.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/instructions_factory.py:docstring of lightwin.core.instructions_factory.InstructionsFactory.run, line 3.)
Todo
Also handle .dst file in subset_list_run().
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/list_of_elements/factory.py:docstring of lightwin.core.list_of_elements.factory, line 11.)
Todo
Maybe it will be necessary to handle cases where the synch particle is not perfectly on the axis?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/list_of_elements/factory.py:docstring of lightwin.core.list_of_elements.factory, line 14.)
Todo
Find a smart way to sublass ListOfElementsFactory according to
the BeamCalculator… Loading field maps not necessary with
TraceWin for example.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/list_of_elements/factory.py:docstring of lightwin.core.list_of_elements.factory, line 18.)
Todo
The elements_to_dump key should be in the configuration file
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/list_of_elements/factory.py:docstring of lightwin.core.list_of_elements.factory, line 23.)
Todo
Maybe gather some things with the subset?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/list_of_elements/factory.py:docstring of lightwin.core.list_of_elements.factory.ListOfElementsFactory.from_existing_list, line 7.)
Todo
Filtering consistency.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/list_of_elements/helper.py:docstring of lightwin.core.list_of_elements.helper, line 3.)
Todo
Delete dat_content, which does the same thing as elts_n_cmds but
less good
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/list_of_elements/list_of_elements.py:docstring of lightwin.core.list_of_elements.list_of_elements, line 10.)
Todo
Check if it can be more efficient. Maybe store R_xx, R_yy, R_zz separately?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/transfer_matrix/transfer_matrix.py:docstring of lightwin.core.transfer_matrix.transfer_matrix, line 3.)
Todo
Maybe transfer matrices should always be (6, 6)??
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/transfer_matrix/transfer_matrix.py:docstring of lightwin.core.transfer_matrix.transfer_matrix, line 6.)
Todo
_init_from methods in factory???
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/transfer_matrix/transfer_matrix.py:docstring of lightwin.core.transfer_matrix.transfer_matrix, line 9.)
Todo
The SimulationOutput.get method with transfer matrix components fails with
TraceWin solver.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/core/transfer_matrix/transfer_matrix.py:docstring of lightwin.core.transfer_matrix.transfer_matrix, line 12.)
Todo
maybe create a mother class more generic, also for FaultScenarioEvaluator?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/evaluator/simulation_output/factory.py:docstring of lightwin.evaluator.simulation_output.factory, line 3.)
Todo
Only one reference for the existing evaluators. Here or the configuration module. Here would be better, as configuration handling will evolve.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/evaluator/simulation_output/presets.py:docstring of lightwin.evaluator.simulation_output.presets, line 10.)
Todo
different factories for evaluation during the fit and evaluation after
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/evaluator/simulation_output/simulation_output_evaluator.py:docstring of lightwin.evaluator.simulation_output.simulation_output_evaluator, line 7.)
Todo
not clear what happens here. separate __init__ in several functions
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/failures/fault.py:docstring of lightwin.failures.fault, line 5.)
Todo
store DesignSpace as attribute rather than Variable Constraint compute_constraints
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/failures/fault.py:docstring of lightwin.failures.fault, line 8.)
Todo
Could be cleaner.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/failures/fault_scenario.py:docstring of lightwin.failures.fault_scenario.FaultScenario.__init__, line 3.)
Todo
At this step I do not save the .dat anymore. Was it useful for
something?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/failures/fault_scenario.py:docstring of lightwin.failures.fault_scenario.FaultScenario._break_cavities, line 3.)
Todo
make this more readable
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/failures/fault_scenario.py:docstring of lightwin.failures.fault_scenario.FaultScenario.fix_all, line 3.)
Todo
I should create a SetOfCavitySettings with
CavitySettings for every cavity of the compensation zone.
Mandatory to recompute the synchronous phases.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/failures/set_of_cavity_settings.py:docstring of lightwin.failures.set_of_cavity_settings, line 3.)
Todo
Should create the full SetOfCavitySettings directly from the OptimisationAlgorithm. For now, the OptimisationAlgorithm creates a first SetOfCavitySettings. Then, the BeamCalculator calls this method to generate a new SetOfCavitySettings. Ugly, especially given the fact that OptimisationAlgorithm has its ListOfElements.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/failures/set_of_cavity_settings.py:docstring of lightwin.failures.set_of_cavity_settings.SetOfCavitySettings.from_incomplete_set, line 14.)
Todo
Check if it is necessary to pass out the whole elts to
OptimisationAlgorithm?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/optimisation/algorithms/algorithm.py:docstring of lightwin.optimisation.algorithms.algorithm, line 9.)
Todo
Methods and flags to keep the optimisation history or not, and also to save
it or not. See Explorator.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/optimisation/algorithms/algorithm.py:docstring of lightwin.optimisation.algorithms.algorithm, line 13.)
Todo
Better handling of the attribute folder. In particular, a correct value
should be set at the OptimisationAlgorithm instanciation.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/optimisation/algorithms/algorithm.py:docstring of lightwin.optimisation.algorithms.algorithm, line 17.)
Todo
Make this class more robust. In particular: save all objectives (not just
the norm), handle export when there is more than two variables, also save
complementary data (e.g.: always save phi_s even it is not in the
constraints nor variables).
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/optimisation/algorithms/explorator.py:docstring of lightwin.optimisation.algorithms.explorator, line 7.)
Todo
Allow for different number of points according to variable.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/optimisation/algorithms/explorator.py:docstring of lightwin.optimisation.algorithms.explorator, line 13.)
Todo
Docstrings
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/optimisation/algorithms/factory.py:docstring of lightwin.optimisation.algorithms.factory, line 3.)
Todo
Redocument default_kwargs.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/optimisation/algorithms/factory.py:docstring of lightwin.optimisation.algorithms.factory._check_common_keys, line 3.)
Todo
Add support for when all element do not have the same variables/constraints.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/optimisation/design_space/design_space.py:docstring of lightwin.optimisation.design_space.design_space._from_file, line 3.)
Todo
decorator to auto output the variables and constraints?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/optimisation/objective/factory.py:docstring of lightwin.optimisation.objective.factory, line 6.)
Todo
Allow from_file.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/optimisation/objective/factory.py:docstring of lightwin.optimisation.objective.factory.EnergySyncPhaseMismatch._get_phi_s, line 3.)
Todo
end_section, elt.name
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/optimisation/objective/position.py:docstring of lightwin.optimisation.objective.position, line 11.)
Todo
full_linac seems useless. Could be a strategy instead of an override
setting. Would need to edit the ObjectiveFactory too.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/optimisation/objective/position.py:docstring of lightwin.optimisation.objective.position, line 14.)
Todo
Implement loss functions.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/optimisation/objective/quantity_is_between.py:docstring of lightwin.optimisation.objective.quantity_is_between, line 3.)
Todo
Set up default arguments on example.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/scripts/__init__.py:docstring of lightwin.scripts, line 3.)
Todo
Allow for undetermined number of BeamCalculator in the config, and update here.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/scripts/compare_beam_calculators.py:docstring of lightwin.scripts.compare_beam_calculators, line 3.)
Todo
Sometimes the lost power in first row is 1e-10 or something? Check this out when I see it appear again.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/scripts/compute_lost_power_per_meter.py:docstring of lightwin.scripts.compute_lost_power_per_meter, line 3.)
Todo
May be included to post-processing from within LightWin directly
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/scripts/compute_lost_power_per_meter.py:docstring of lightwin.scripts.compute_lost_power_per_meter, line 7.)
Todo
Should they be in a module somewhere?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/scripts/scripts_shorthands.py:docstring of lightwin.scripts.scripts_shorthands, line 3.)
Todo
Insert line skip at each section change in the output.dat
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/tracewin_utils/dat_files.py:docstring of lightwin.tracewin_utils.dat_files, line 3.)
Todo
some functions are not used anymore I guess…
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/tracewin_utils/electromagnetic_fields.py:docstring of lightwin.tracewin_utils.electromagnetic_fields, line 6.)
Todo
Better handling of the module import
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/tracewin_utils/electromagnetic_fields.py:docstring of lightwin.tracewin_utils.electromagnetic_fields, line 9.)
Todo
I think that this should be a method right? Different FieldMap objects -> different loading func?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/tracewin_utils/electromagnetic_fields.py:docstring of lightwin.tracewin_utils.electromagnetic_fields.load_electromagnetic_fields, line 6.)
Todo
Clean this, a lot of old things that may not be used.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/util/debug.py:docstring of lightwin.util.debug, line 3.)
Todo
Ellipse plot could be better
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/util/debug.py:docstring of lightwin.util.debug, line 6.)
Todo
Clean this, check what is still used.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/util/helper.py:docstring of lightwin.util.helper, line 3.)
Todo
Second example does not work
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/util/helper.py:docstring of lightwin.util.helper.pascal_case, line 3.)
Todo
Modernize this, with type hint etc.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/util/log_manager.py:docstring of lightwin.util.log_manager, line 13.)
Todo
fix colors in plots after pass beauty
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/util/pass_beauty.py:docstring of lightwin.util.pass_beauty, line 17.)
Todo
discriminate feasible from unfeasible solutions
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/visualization/anim.py:docstring of lightwin.visualization.anim, line 3.)
Todo
better detection of what is a multiparticle simulation and what is not. Currently looking for “‘partran’: 0” in the name of the solver, making the assumption that multipart is the default. But it depends on the .ini… update: just use .is_a_multiparticle_simulation
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/visualization/plot.py:docstring of lightwin.visualization.plot, line 6.)
Todo
Fix when there is only one accelerator to plot.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/visualization/plot.py:docstring of lightwin.visualization.plot, line 12.)
Todo
Different plot according to dimension of FieldMap, or according to if it accelerates or not (ex when quadrupole defined by a field map)
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/envs/0.7.x/lib/python3.12/site-packages/lightwin/visualization/plot.py:docstring of lightwin.visualization.plot, line 15.)
Todo
List of allowed tracewin arguments in doc
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/checkouts/0.7.x/docs/manual/configuration.beam_calculator.rst, line 34.)
Todo
There are doublons between doc in config.beam_calculator and here. Maybe keep in module, but make the format better.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/checkouts/0.7.x/docs/manual/configuration.beam_calculator.rst, line 37.)
Todo
A Jupyter Notebook would be better to show with examples.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/checkouts/0.7.x/docs/manual/get_method.rst, line 6.)
Todo
Revise integration so that a missing Cython does not lead to import errors.
Specific Cython tests
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/checkouts/0.7.x/docs/manual/installation.cython.rst, line 82.)
Todo
Consider providing more detailed instructions for setting the PYTHONPATH.
For now, you can search for “PYTHONPATH” or “ModuleNotFoundError” online for additional guidance.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/checkouts/0.7.x/docs/manual/installation.python.rst, line 43.)
Todo
Allow for an easy way to skip Cython compilation.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/checkouts/0.7.x/docs/manual/installation.troubleshooting.rst, line 25.)
Todo
Consistency between font size of normal text and math text. Not aesthetic when I have text and units side to side.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/checkouts/0.7.x/docs/manual/units.rst, line 8.)
Todo
General units: MeV etc
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/checkouts/0.7.x/docs/manual/units.rst, line 11.)
Todo
Ease re-usage of old simulations. Very easy to implement, just use the recompute flag, override the run_with_this method, and user must provide a results directory.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/lightwin/checkouts/0.7.x/docs/manual/usage.rst, line 11.)