-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Description, motivation and use case
Today we have a single ElementHolder class that holds everything for a given control mode.
The ElementHolder suffers from a large number of methods. There is a need for reorganization and the introduction of other holders. Last but not least, ElementHolder.get_all*() or ElementHolder.get_*s() function return list while typed array would be suitable. The ElementHolder will however hold all elements as before.
Note that the get function from typed holder will return appropriate typed object or arrays and raise an exception in case of wrong type while the equivalent get on the base ElementHolder may return random types.
class MagnetsHolder(object):
# Return the named array or all magnets when no name specified
def get(name:str = None) : "MagnetArray"
...
class MagnetHolder(object):
# Return the magnet with the specified name
def get(name:str) : "Magnet"
...Proposed solution
Create new holders such as Magnet(s)Holder, BPM(s)Holder, RFHolder, DiagnosticHolder,ToolHolder etc and allow access to them trough python properties to allow following writings:
This is a non exhaustive list.
#Magnet(s)Holder
sr.live.magnets.get() # Return all magnets simple and virtual (no combined function magnet)
sr.live.magnets.get_cfm() # Return all combined function magnets
sr.live.magnets.get("QuadForTune") # Returns family `MagnetArray`
sr.live.mangets.QuadForTune # If we add dynamic python properties
sr.live.magnets.get()['*QD*'] # Returns subset
sr.live.magnets.get("QuadForTune")['QD1*'] # Returns subset of familly
sr.live.magnets.get()[1:10] # Returns subset
sr.live.magnets.get()[model_name:'*-H'] # Returns subset
sr.live.manget.get("QF1E-C03").strength.set( 0.8 ) # Exmaple with single manget
# BPM(s)Holder (similar to MagnetHolder)
sr.live.bpms.get(...)
sr.live.bpm.get(...)
# RFHolder
sr.live.rf.masterclock.frequency.set() # The `RFHolder` will contain a masterclock object coming from the "DEFAULT_RF_PLANT"
sr.live.rf.get(rfname) # Will return an other RFPlant
# ElementHolder
sr.live.get(...) # Get all elements
sr.live.mangets.get() & sr.live.get("CELL08") # Example of set operation all magnet of CELL08
# Diagnostic Holder
sr.live.diagnostic.betatron_tune.set(tune) # The `DiagnosticHolder` will contain a betatron_tune object mapped from "DEFAULT_BETATRON_TUNE_MONITOR"
sr.live.diagnostic.get("SPARE_BETATRON_TUNE_MONITOR) # Return an other tune monitor
sr.live.diagnostic.get() # Return a list of all available diagnostic (this will be an untyped list)
# Tool holder
sr.live.tool.tune.set([qx,qy]) # The `ToolHolder` will contain a tune mapped from "DEFAULT_TUNE_CORRECTION"
sr.live.tool.tune.response.measure()
sr.live.tool.get("OTHER_TUNE_CORRECTION") # return an other tune tuning tool.
sr.live.tool.get() # Return a list of all available tool (this will be an untyped list)Feel free to comment and to propose modifications, I will update this top level post following discussions.