Conversation
401d8cf to
e4a1f2a
Compare
Rather than constructing the RM in the order defined in the mml tuneRM file, we do it in the order defined in tunefb_offsets.py
We now find our config files from either diamond2opsdata or diamondopsdata depending on the ringmode
fa5051a to
4e03ab6
Compare
This ensures the caputs complete before continuing and anecdotally has been seen to improve results against the Virtac which responds much slower than the real machine.
When running in D2 mode, you get different ringmodes to choose which load different lattices and make different PVs
4e03ab6 to
4bdbe8a
Compare
| # that they are ordered in the same order as defined elsewhere. | ||
| for family in families: | ||
| for rmat in raw_rms["Rmat"][0]: | ||
| rmat_family = str(rmat["Actuator"][0][0][0][0][1][0]) |
There was a problem hiding this comment.
The list of indices seems a bit confusing, just reply to this comment explaining it so I can see whether it's worth hiding or not.
There was a problem hiding this comment.
This is the structure we get when loading the matlab file:
[[array([[(array([[107.11158457],
[107.11158457],
[107.11158457],
[107.11158457],
[107.11158457],
[107.11158457],
[107.11158457],
[107.11158457],
[107.11158457],
[107.11158457],
[107.11158457],
[107.11158457]]), array(['Q0L'], dtype='<U3'), array(['Setpoint'], dtype='<U8'), array([[ 1, 1],
[ 4, 17],
[ 5, 1],
[ 8, 17],
[ 9, 1],
[12, 17],
[13, 1],
[16, 17],
[17, 1],
[20, 17],
[21, 1],
[24, 17]], dtype=uint8), array([[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1],
[1]], dtype=uint8), array(['Simulator'], dtype='<U9'), array(['Hardware'], dtype='<U8'), array(['a'], dtype='<U1'), array(['Get by FamilyName'], dtype='<U17'), array(['getpv'], dtype='<U5'), array([[0]], dtype=uint8), array([[0.02197698]]), array([[740219.615283],
[740219.615283],
[740219.615283],
[740219.615283],
[740219.615283],
[740219.615283],
[740219.615283],
[740219.615283],
[740219.615283],
[740219.615283],
[740219.615283],
[740219.615283]]), array([[2.02600e+03, 8.00000e+00, 2.50000e+01, 1.40000e+01, 4.60000e+01,
4.45502e-01]])) ]],
dtype=[('Data', 'O'), ('FamilyName', 'O'), ('Field', 'O'), ('DeviceList', 'O'), ('Status', 'O'), ('Mode', 'O'), ('Units', 'O'), ('UnitsString', 'O'), ('DataDescriptor', 'O'), ('CreatedBy', 'O'), ('t', 'O'), ('tout', 'O'), ('DataTime', 'O'), ('TimeStamp', 'O')]) ]]
There was a problem hiding this comment.
The indices are to get the quadrupole family Q0L. Im not sure why the imported dictionary is so horrible, it looks a lot better in matlab.
This code adds a way to make sure that the response matrixes are ordered how we expect. Essentially we are just checking that the data is ordered as we expect and if its not, then we reorder it. This is so we dont end up using the wrong response matrixes for a Quad family
There was a problem hiding this comment.
I'm still a bit lost.
I was looking for a brief (one line?) comment explaining the whole [0][0][0][0][1][0] thing.
There was a problem hiding this comment.
The indices are to index a nested list which is generated when the matlab file is loaded using scipy, the quadrupole family string is located at [0][0][0][0][1][0].
| rmats = [] | ||
|
|
||
| # We build the response matrix out of the tune quad families, making sure | ||
| # that they are ordered in the same order as defined elsewhere. |
There was a problem hiding this comment.
Where is elsewhere? MML config? Inside dls_slow_feedbacks? All of them?
There was a problem hiding this comment.
Inside dls_slow_feedbacks. Previously we just assumed the data in mml was in the order we required, now we check and reorder if necessary.
There was a problem hiding this comment.
Could you make this explicit in the comment?
There was a problem hiding this comment.
I have updated the comment
| def set_mode(self, mode: int) -> None: | ||
| """Set the ring mode and reload the lattice.""" | ||
| self.name = RING_MODES[mode] | ||
| if self.name in RING_MODES_D2: |
There was a problem hiding this comment.
It does feel like there should be some separate variable to indicate whether we are in D2 or D1 mode, although I understand this should work.
There was a problem hiding this comment.
I can see an argument for this yeh, I was trying not to treat D2 as a special case and rather focus on ringmodes which are already an established thing in slow feedbacks.
There was a problem hiding this comment.
It is effectively a special case already. Please just make sure you've tested it in anger.
a7cf2b4 to
e888c1f
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5 +/- ##
==========================================
+ Coverage 47.55% 48.05% +0.49%
==========================================
Files 16 16
Lines 1659 1698 +39
==========================================
+ Hits 789 816 +27
- Misses 870 882 +12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was actually slowing Virtac. This is because Virtac would see the changes to the first pv in the list and then recalculate before the others had taken effect. As wait=True, tunefb would have to wait for Virtac to recalculate and then read in the remainder of the caputs at which point tunefb could then move on. In some ways this was the correct behaviour, but it was causing issues.
d235679 to
614cbee
Compare
Uh oh!
There was an error while loading. Please reload this page.