Wiki source code of MatlabDOOCS

Last modified by sndueste on 2025/02/05 11:23

Show last authors
1 = How to read and write DOOCS properties with Matlab =
2
3 \\
4
5 == Contents ==
6
7 \\
8
9 * [[Quick Start>>doc:||anchor="Quick Start"]]
10 * [[DOOCS ADQ412 ADC Access>>doc:||anchor="DOOCS ADQ412 ADC Access"]]
11 * [[Example Matlab scripts>>doc:||anchor="Example Matlab scripts"]]
12 * [[jdoocs_call (deprecated, unmaintained)>>doc:||anchor="jdoocs_call (deprecated, unmaintained)"]]
13
14 \\
15
16 \\
17
18 == Quick Start ==
19
20 The manual of the [[DOOCS Matlab client interface>>url:https://ttfinfo.desy.de/DOOCSWiki/Wiki.jsp?page=MATLABClientInterface||shape="rect"]] can be found on the DOOCS web pages. Examples showing how to read train ID synchronous values using {{code language="none"}}doocsread{{/code}} are maintained on [[Bitbucket>>url:https://stash.desy.de/projects/FSFL/repos/jupyter-notebook/raw/doc/read_at_train_id_doocsread.html||shape="rect"]].
21
22 If you can not use Python, we recommend to use the Mex function {{code language="none"}}doocsread{{/code}} with Matlab as installed on our workstations. It works with Matlab R2016b and is installed on flashlxuser1, flashlxuser2, and the GNU/Linux workstations in the FLASH halls (hasfcons0 to hasfcons10 and hasfpg0, hasfpg3).
23
24 Please do **not** use {{code language="none"}}doocs_read{{/code}} or {{code language="none"}}ttfr{{/code}} et al..
25
26 [[Contents>>doc:||anchor="Contents"]]
27
28 \\
29
30 == DOOCS ADQ412 ADC Access ==
31
32 To read sample spectra from the SP Devices ADQ412 ADCs there are two servers which could be accessed. The server {{code language="none"}}SPDEVDMA{{/code}} should only be used for debugging purposes. Don't touch it during data acquisition for an experiment with beamtime. The ADQ scope servers ({{code language="none"}}ADC.ADQ.FL2EXP1{{/code}}, {{code language="none"}}ADC.ADQ.BL1{{/code}} to {{code language="none"}}ADC.ADQ.BL3{{/code}}, {{code language="none"}}ADC.ADQ.PG{{/code}}, {{code language="none"}}ADC.ADQ{{/code}}) are recommended to use for live data access.
33
34 **Note:** To access the ADQ scope servers you might have to set properties, which also affect the recording of samples to the DAQ and the data access of other users. So be careful changing any properties' values.
35
36 Currently the number of samples accessible this way is limited to 1,048,575 samples. The code snippet below shows how to read the current spectrum with the maximum number of samples.
37
38 (% class="code" %)
39 (((
40 %% ADQ Scope Server MTCA FL2-EXP1
41 % Note CH00.INCR_LOGIC does not do anything
42 % CH00.RAW_COPY must be '1' in order to receive more than 800 values
43 location= 'FLASH.FEL/ADC.ADQ.FL2EXP1/FL2EXP1.CH01/';
44 errorMsg= doocswrite([location, 'CH00.RAW_COPY'], 1);
45 assert(isempty(errorMsg), 'doocsread error: %s', errorMsg);
46 % read
47 mtcaSpectrumNestedStruct= doocsread([location, 'CH00.DAQ.TD']);
48 assert(isempty(mtcaSpectrumNestedStruct.('error')), ...
49 'Error: doocsread: ''%s''', mtcaSpectrumNestedStruct.('error'));
50 % unwrap
51 mtcaSpectrumStruct= mtcaSpectrumNestedStruct.('data');
52 mtcaSpectrum= mtcaSpectrumStruct.('d_spect_array_val');
53 % create time axis and plot
54 start= mtcaSpectrumStruct.('s_start');
55 increment= mtcaSpectrumStruct.('s_inc');
56 sLength= mtcaSpectrumStruct.('d_spect_array_len');
57 assert(sLength == length(mtcaSpectrum));
58 spectrumTimeAxis= start : increment : start + increment*(sLength - 1);
59 plot(spectrumTimeAxis, mtcaSpectrum);\\
60 )))
61
62 [[Contents>>doc:||anchor="Contents"]]
63
64 \\
65
66 == Example Matlab scripts ==
67
68 \\
69
70 * The {{code language="none"}}doocsread{{/code}} based scripts on the [[FS-FLASH repository>>url:https://stash.desy.de/projects/FSFL/repos/matlab-guis/browse||shape="rect"]] are examples for a Camera and a time-of-flight GUI. The layout and functionality are attached:
71 ** [[manual_cam_gui.pdf
72 >>attach:manual_cam_gui.pdf]]
73 ** [[attach:manual_tof_gui.pdf]]
74 *** for the scans in the TOF GUI you need to make the subfolder "data"
75 * Examples how to [[read pulse train synchronous values>>url:https://stash.desy.de/projects/FSFL/repos/jupyter-notebook/raw/doc/read_at_train_id_doocsread.html||shape="rect"]] using {{code language="none"}}doocsread{{/code}} are available on DESY's Bitbucket [[project to evaluate pulse synchronous access>>url:https://stash.desy.de/projects/FSFL/repos/jupyter-notebook/raw/doc/read_at_train_id_doocsread.html||shape="rect"]]
76
77 [[Contents>>doc:||anchor="Contents"]]
78
79 \\
80
81 == jdoocs_call (deprecated, unmaintained) ==
82
83 We strongly suggest **not** to use the M-function `jdoocs_call`. It has been deprecated since 2014 and has not been maintained since then. The files below are kept for reference only. In many cases they won't work any longer.
84
85 In the attachment a collection of old files can be found:
86
87 * in the[[ jDOOCS zip>>attach:jDOOCS_2015.zip]]:
88 ** the *.jar files for the Java DOOCS implementation and its dependencies
89 ** the jdoocs_call.m function which eases the jDOOCS handling and can be used to read numbers and Vectors (spectra ... 1D data)
90 ** a sample program to read 0D (numbers) and 1D (spectra) data with jdoocs_call (jDOOCS_read_sample_0D_and_1D.m)
91 ** a sample program to read 2D (images) (jDOOCS_read_sample_2D.m)
92
93 [[Contents>>doc:||anchor="Contents"]]