Add Pynel vertical dispersion analysis#241
Draft
VitorSouzaLNLS wants to merge 34 commits intomasterfrom
Draft
Conversation
Include submodules in __init__.py file
fernandohds564
requested changes
Dec 15, 2023
fernandohds564
approved these changes
Dec 18, 2023
murilobalves
approved these changes
Dec 19, 2023
fernandohds564
requested changes
Dec 22, 2023
fernandohds564
approved these changes
Apr 11, 2024
xresende
requested changes
May 3, 2024
Contributor
There was a problem hiding this comment.
@VitorSouzaLNLS , I think it is useful to have the option for the classes to return signatures in all elements positions, not only at BPMs. Sometimes we are interested in the vertical dispersion function inside the dipoles for calculating beam sizes, for example.
Contributor
|
@VitorSouzaLNLS , why is it again that you replaced ADD_FUNCTIONS by SET_FUNCTIONS? what if we want to extract signatures from a model with errors? |
Contributor
|
@VitorSouzaLNLS did you give up on this PR? What is missing here for us to merge it? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pynel package for vertical dispersion analysis
The pynel package has 2 main objects: Base and Button. These objects have properties that study and analysis of vertical dispersion function of the SIRIUS storage ring and its signatures associated to magnets and misalignment and rotation errors.
Object Button
The Button object basically associates one kind of error (transversal misalignment or rotations) to one magnet of the SIRIUS ring and store the vertical dispersion signature caused by the magnet and the error choosen.
The creation
The creation of a Button follows 2 possible ways.
Example:
qfa_sect5_dx = Button(sect=5, name="QFA", dtype="dx")-> creates a quadrupole QFA Button located in the 5th sector with tranversal horizontal misalignment error.Example:
sfa1_sect1_dr = Button(indices=[74], dtype="dx")-> creates a sextupole SFA1 Button located in the 1st sector with rotation roll error.About the arguments
name: the creation of any Button requires its name (when not passing "indices" arg) that is any magnet family name that exists in the SIRIUS ring: "B1, B2, BC, Q1, Q2 ... QFA ... QDB2 ... SFA1 ... SFP2 ... SDB3".If a inexistent family name is passed (or any other random thing) the Button will still be generated, but invalid, that means the Button will not compute and/or store a Vertical Dispersion Signature.
Obs.: In sectors that have more then one magnet of the same family (like dipoles B1 and B2 or quadupoles Q1, Q2...) the
nameargument can specify the precise magnet wanted:b1_1_sect7_dy = Button(7, "B1_1", "dy").sect: the creation of any Button requires its sector (when not passing "indices" arg). The sectors are restrict to integer numbers from 1 to 20 (the real sectors in SIRIUS).Like the
nameargument, if a non-existent sector is passed the Button will be generated, but invalid.indices: the creation of any Button can be made by passing the indices of the magnet in the model. Is recommended to be careful when creating dipoles Buttons by its indices or when working with a refined model (non single integer as its indices).dtype: the creation of any Button always requires its error associated. The error are restricted to:dx- Horizontal misalignment errordy- Vertical misalignment errordr- Rotation roll errordrp- Rotation pitch errordry- Rotation yaw errorAbout the properties
.bname= the magnet family (button) name.fantasy_name= the magnet specified name.sect= the magnet sector location.sectype= the magnet sector type (like: "HighBetaA to LowBetaB").dtype= the error associated.signature= the vertical dispersion signature of the magnet with the error associated.indices= the indices of the magnet in the modelObject Base
The Base object generate Buttons and construct a VDRM matrix (Vertical Dispersion Response Matrix) of the signatures of the buttons. Base objects can be use to easily creates sets of specified kind of magnets or errors or sectors and study with more detail the behavior of the Vertical Dispersion in these combinations.
The creation
The creation of a Base follows 2 possible ways.
Example:
base = Base(sects=[1,7,13,20], elements=["SDB3", "BC"], dtypes=["dy", "dr"])-> creates a Base with the dipoles BC and sextupoles SDB3 in the sectors 1, 7, 13 and 20 with the vertical misalignment and rotation roll errors.Obs.: if any magnet not exists in the sector, the button will be discarded. (Except when controlling the
default_validsarg)base = Base(buttons=list_of_buttons)-> creates a Base with the buttons of thelist_of_buttons.About the arguments
elements: the magnets family/fantasy names -> The valid "elements" follows the Buttons valid "names"/bnamessects: list of integers. The valid sectors are the integers from 1 to 20.dtypes: the misalignment/rotation errors. The valid "dtypes" follows the Buttons validdtype(s)buttons: should be a list of Button objectsdefault_valids: allows to control wether Button is considered valid or invalid. And if the Button will be or not discarded in the gen process.force_rebuild: force the calculation of the vertical dispersion signature of the buttonsfunc: specify the function to be calculated as the buttons signatures. valid "funcs" are:vertical_disportestfunc. The "testfunc" simply sets the buttons signatures as a zero-arrays (used for sandbox creation of buttons)About the properties
.magnets= the buttons magnet families.named_magnets= the buttons magnet fantasy (specified) names.sectors= the sectors of the Base.sector_types= the sector types (like: "HighBetaA to LowBetaB") of the sectors of the Base.dtypes= the errors of the Base.buttons= the buttons of the Base.resp_mat= the constructed VDRM (Vertical Dispersion Response Matrix)The "fitting" module
The fitting module contain functions to fit vertical dispertion (like real data collected in the machine) in pymodels models.
Obs.: this module is outdated (~ september 19, 2023). The functions shouldnt work as expected.
The "misc_functions"/"functions" module
Contain functions to work with Base and Buttons objects and deal with vertical dispertion fittings and analysis.
The "std_si_Data" module
Contain saved data of the Standard SIRIUS model.