Skip to content

Commit 3b2d39a

Browse files
committed
export charts
1 parent 72c01f7 commit 3b2d39a

File tree

3 files changed

+88
-9
lines changed

3 files changed

+88
-9
lines changed
13.5 KB
Loading
39.4 KB
Loading

docs/guis/betabeat/analysis_panel.md

Lines changed: 88 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Clicking the ++"Custom"++ button will open a dialog to manually enter frequency
199199
</figure>
200200

201201
Use ++"Add Line"++{.green-gui-button} to add a new line based on your input to the table and ++"Remove"++{.red-gui-button} to remove the currently selected line.
202-
The lines in the charts will only update after clicking t++"Approve"++.
202+
The lines in the charts will only update after clicking ++"Approve"++.
203203

204204

205205
=== "Natural Tune Line"
@@ -232,16 +232,37 @@ The lines in the charts will only update after clicking t++"Approve"++.
232232

233233
### Natural Tune Window
234234

235+
The natural tune window controls help you, to correctly identify the natural tune in the spectrum and assign it to the `NATTUNE`-column in the lin-file
236+
using the [`update_nattune_in_linfile` script][omc3_update_nattune]{target="_blank"} and
237+
helps to avoid re-running the `harpy` analysis with different tolerance windows and natural tunes settings.
238+
Accurate identification of the natural tune is important e.g. for [amplitude detuning analysis][amplitude_detuning_analysis].
239+
240+
There are two main reasons, why the natural tune line might be misidentified in the spectrum by the `harpy` analysis,
241+
even when the natural tune and tolerance window are set "correctly" in the [`Tune Settings`](settings.md#tunes-tab):
242+
243+
- Due to detuning, the natural tune line can be shifted and might not be any longer within the tolerance window.
244+
This can in particular happen during a wide range of amplitude detuning scans, for which you do not want to change the tolerance window at every kick,
245+
or cannot easily make it larger as it would include the driven tune line.
246+
- Large resonances can appear within the tolerance window, e.g. excited by the approach of the natural tune due to detuning effects,
247+
and might be misidentified as the natural tune line when their amplitude is higher than the amplitude of the natural tune line.
248+
235249
<figure>
236250
<center>
237-
<img src="../../assets/images/betabeat_gui/analysis_panel_frequency_controls_nattune.png" width="70%" alt="Frequency tab natural tune window controls."/>
238-
<figcaption>Naturl tune window controls at the bottom of the Frequency tab.</figcaption>
251+
<img src="../../assets/images/betabeat_gui/analysis_panel_frequency_controls_nattune.png" width="65%" alt="Frequency tab natural tune window controls."/>
252+
<figcaption>Natural tune window controls at the bottom of the Frequency tab.</figcaption>
239253
</center>
240254
</figure>
241255

242-
- You can set a frequency range and it does not redo the analysis but just picks the highest peak in that range and assigns it to `NATTUNE` in the lin-file.
243-
- This should be very helpful for amplitude detuning analysis.
244-
- Do NOT use the Nattune-Updater if you have free kicks (it adds a `NATTUNE`-Column to the lin-file).
256+
To update the natural tune in the lin-file, first activate the vertical cursors at the top of the chart by setting a tick in the **Show** checkbox,
257+
they will appear at their last set position or at 0 if they have not been set yet.
258+
259+
!!! tip "Cursors for each plane"
260+
If you have BPMs from both planes selected, two sets of cursors will appear: Blue for the horizonal spectrum and red for the vertical spectrum.
261+
In case only one plane is selected, only one set of cursors will appear.
262+
To update the amount of cursors shown, you need to select BPMs in the planes you want and then de- and re-activate the **Show** checkbox.
263+
264+
Click ++"Set Window"++ to set the markers around the model natural tune with a spacing given by the _Tolerance_,
265+
both of which are taken from the [`Tune Settings`](settings.md#tunes-tab).
245266

246267
<figure>
247268
<center>
@@ -250,6 +271,35 @@ The lines in the charts will only update after clicking t++"Approve"++.
250271
</center>
251272
</figure>
252273

274+
You can now adapt the cursors to your liking, such that the natural tune line is the highest line between them,
275+
avoiding resonances and the driven tune line.
276+
For measurements with many BPMs not showing a clear natural tune line, tightening the window can also help reducing the errorbar on the tune.
277+
278+
!!! tip "Identifying the Natural Tune"
279+
If you are unsure which of the shown lines is the natural tune, it often helps to look at the spectrum of other kicks,
280+
e.g. the ones with similar kick-amplitude in an amplitude detuning scan.
281+
The natural tune line in this measurement is usually the line closest to the natural tune in the other measurements,
282+
as the detuning effect is usually very small between similar kick amplitudes.
283+
284+
A ticked _"All BPMs"_ checkbox will update the `NATTUNE`-column for all BPMs, while an unticked on will only update the currently selected BPMs.
285+
If you have it unticked and no BPMs in one plane selected, this plane will be skipped,
286+
but if _"All BPMs"_ is active, both planes will be updated, even if no BPM is selected in that plane as long as a window is set for that plane (see tip above).
287+
If there is no window set for a plane, this plane will be skipped.
288+
289+
Click ++"Update Lin-Files"++{.green-gui-button} to update the `NATTUNE`-column in the lin-files of the currently selected measurements, with the window defined by the currently set cursors.
290+
291+
!!! tip "The `Empty` dropdown"
292+
In rare cases, e.g. if you are using a large frequency spacing (low number of [output bits](settings.md#harpy-tab)) or a very small tolerance window,
293+
it can happen that for some BPMs no frequency line lies between the cursors.
294+
In this case, the action taken in the `Empty` dropdown menu is applied:
295+
296+
- **error** _(default)_: The `NATTUNE`-column is not updated and an error is raised.
297+
- **ignore**: The BPM is ignored and the value in the `NATTUNE`-column is not updated.
298+
- **remove**: The BPM is removed from the lin-file.
299+
300+
!!! bug "Free Kicks"
301+
Do **NOT** use the Natural Tune Updater if you have free kicks, as the script will add a `NATTUNE`-Column to the lin-file!
302+
253303
### Chart Options
254304

255305
<figure>
@@ -273,9 +323,35 @@ These are the markers of the _Stems_ plot, but without the actual stems.
273323
This shows the spectrum in a scatter plot, i.e. as markers for each frequency set at the corresponding amplitude connected by lines.
274324
So this is the same as _Points_ but with additional lines between the markers.
275325

276-
++"GUI"++
277-
+"PDF"++
278-
326+
Two methods are available to save the chart to file:
327+
328+
- ++"GUI"++:
329+
This button will open a dialog asking you where to save the **chart component directly from java** as a **PNG file**.
330+
The output will look exactly like the chart in the GUI, as it is rendered directly from `java`.
331+
- ++"PDF"++:
332+
This button allows you pass the currently selected data to the [`plot_spectrum` script][omc3_plot_spectrum] to save the spectrum as a **PDF file**.
333+
As the spectrum is completely rendered in `python` the output will look different from the chart in the GUI, but will show in general the same information, with some important caveats listed below.
334+
335+
- Clicking the button you will be requested to select an output **directory**.
336+
As multiple files might be created, the filenames are determined automatically.
337+
Then a dialog will pop up, in which you can change the path again, but also define which data should be plotted in the same file:
338+
339+
<figure>
340+
<center>
341+
<img src="../../assets/images/betabeat_gui/analysis_panel_frequency_export.png" width="60%" alt="Export Spectrum Dialog."/>
342+
<figcaption>The export spectrum dialog.</figcaption>
343+
</center>
344+
</figure>
345+
346+
- In any case, the spectrum of horizontal and vertical BPMs will be split into separate plots on the top and bottom of the same file.
347+
Which also means, that no matter in which plane you have selected a BPM - if it has a horizontal and a vertical spectrum they will both be plotted.
348+
- _"Combine Plots by BPMs"_: Will plot all selected BPMs into the same plots in the same file, with the BPM name in the legend.
349+
If this is deactivated, there will be separate files per BPM with the BPM name in the filename.
350+
- _"Combine Plots by Measurements"_: Will plot all selected Mesurements into the same plots in the same file, with the Measurement name in the legend.
351+
If this is deactivated, there will be separate files per Measurement with the Measurement name in the filename.
352+
- Having both _"BPMs"_ and _"Measurements"_ activated will therefore lead to a single output file, with two charts (for the horizontal and vertical planes) and a combination of BPM-names and Measurement-names as legend.
353+
- Having both _"BPMs"_ and _"Measurements"_ deactivated will lead to `N = No. of selected BPMs x No. of selected Measurements` files, containing two charts for the planes with each showing only a single spectrum.
354+
Both, BPM name and Measurement name will be in the filename.
279355

280356
## Do Optics Dialog
281357

@@ -300,8 +376,11 @@ So this is the same as _Points_ but with additional lines between the markers.
300376
[additional_defaults]: defaults.md#additional-gui-defaults
301377
[harpy_analysis]: ../../measurements/physics/harpy.md
302378
[bad_bpms]: ../../measurements/physics/bpm_filtering.md
379+
[amplitude_detuning_analysis]: ../../measurements/procedures/ampdet.md
303380

304381
[omc3_linfile_clean]: https://pylhc.github.io/omc3/entrypoints/scripts.html#linfile-cleaning
382+
[omc3_update_nattune]: https://pylhc.github.io/omc3/entrypoints/scripts.html#update-natural-tune-in-lin-files
383+
[omc3_plot_spectrum]: https://pylhc.github.io/omc3/entrypoints/plotting.html#plot-spectrum
305384
[malina2018]: https://repository.cern/records/bxyez-pt407
306385
[dilly2023]: http://cds.cern.ch/record/2883681/
307386

0 commit comments

Comments
 (0)