backendinterface.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. .. This is a autogemerated documentation from python docstrings. It was generated using DStrings2Doc.
  2. .. module:: backendinterface
  3. .. _backendinterface:
  4. Module backendinterface
  5. =======================
  6. This is the interface to the backend.
  7. It is used to make the backend easily interchangable.
  8. All Functions that interface directly with the backend are prefixed with bk\_
  9. Functions only used internal in this module will be prefixed _bif_
  10. .. py:method:: initStatus(st)
  11. Initialize Status variables. These variables are used to transfer status variables over different modules.
  12. :param st: variable to use (most likely a DummyStorage instance)
  13. .. py:method:: _bif_enable_wait_cursor()
  14. Show the "Wait Cursor"
  15. .. py:method:: _bif_disable_wait_cursor()
  16. Show the normal Cursor
  17. .. py:method:: _bif_continuous_read_is_enabled(board_id, popup_title_text=None)
  18. Checks if continuous read is enabled and if yes shows a popup dialog to ask if it shall be disabled
  19. :param board_id: id of the board do manipulate
  20. :param popup_title_text: Text to display in the popup that asks to disable continuous read
  21. :return: bool (True if continuous read is enabled and not disabled in popup else False)
  22. .. py:method:: bk_status_readout()
  23. Read Status for every connected board
  24. .. py:method:: _bif_status_readout(board_id)
  25. Read Status from board and update variables
  26. as well as enable and disable corresponding Buttons
  27. .. py:class:: PopupDialog(QtGui.QDialog)
  28. Simple Class to show a popup dialog.
  29. .. py:method:: __init__(self, text, title=None, parent=None)
  30. .. py:method:: on_okay(self)
  31. Handler for the press of the ok button
  32. .. py:method:: on_cancel(self)
  33. Handler for the press of the cancel button
  34. .. py:method:: get_return_value(self)
  35. Get True if the Window was closed with OK else False
  36. :return: True if OK else False
  37. .. py:method:: bk_start_board(board_id)
  38. Start the Board.
  39. This will set initial Registers to power up the Board.
  40. :param board_id: id of the board do manipulate
  41. .. py:class:: _bif_ProgressBar(QtGui.QProgressBar)
  42. Simple Progressbar class.
  43. .. py:method:: __init__(self, min, max, text)
  44. .. py:method:: remove(self, timeout=None)
  45. Remove this instance of a progressbar
  46. :param timeout: the time from calling this function to wanishing of the progressbar
  47. .. py:method:: bk_calibrate(board_id, do_the_rest=None)
  48. Send commands to the board that will enable it to calibrate itself.
  49. This function checks if a read command is still running. BUT: It does not check if
  50. the board is acquiring or something like this.
  51. So Another instance of KCG can still be acquiring or calibrating at the same time. This can be dangerous.
  52. :param board_id: id of the board do manipulate
  53. :param do_the_rest: function to call after calibration. This is used when "Prepare Board" is pressed.
  54. .. py:method:: bk_sync_board(board_id)
  55. Sends commands to the board to sync with triggers.
  56. :param board_id: id of the board do manipulate
  57. .. py:method:: bk_write_values(board_id, defaults=False)
  58. Write values to board.
  59. :param board_id: id of the board do manipulate
  60. :param defaults: (bool) if True Writes default values
  61. .. py:method:: bk_stop_board(board_id)
  62. Stops the board and shuts it down
  63. :param board_id: id of the board do manipulate
  64. .. py:method:: bk_soft_reset(board_id)
  65. Perform a soft reset.
  66. :param board_id: id of the board do manipulate
  67. .. py:method:: bk_update_config(board_id, key, value, silent=False)
  68. Interface to the update command of the BoardConfiguration class.
  69. :param board_id: id of the board do manipulate
  70. :param key: Key to update
  71. :param value: Value to set for key
  72. :param silent: (bool) if True do not inform observers on update
  73. .. py:method:: bk_get_config(board_id, key)
  74. Interface to the get command of the BoardConfiguration class.
  75. :param board_id: id of the board do manipulate
  76. :param key: Key to get the value for
  77. :return: value stored for key
  78. .. py:method:: bk_get_board_status(board_id, status_variable)
  79. Interface to the status class for each board.
  80. :param board_id: id of the board do manipulate
  81. :param status_variable: Key to get the value for
  82. :return: value stored for key
  83. .. py:method:: bk_get_status(board_id)
  84. Interface to the get_status of the board
  85. NOTE: This is not get_board_status
  86. :return: status dictionary
  87. .. py:method:: bk_get_board_config(board_id)
  88. Get the board config instance
  89. :param board_id: the id of the board
  90. :return: the config instance
  91. .. py:method:: bk_change_num_of_orbits(board_id, value, silent=False)
  92. Send new number of orbits to board and update in config
  93. :param board_id: id of the board do manipulate
  94. :param value: the value to send
  95. :param silent: (bool) if True do not inform observers on update
  96. .. py:method:: bk_change_num_of_skipped_orbits(board_id, value, silent=False)
  97. Send new number of orbits to skip to board and update in config
  98. :param board_id: id of the board do manipulate
  99. :param value: the value to send
  100. :param silent: (bool) if True do not inform observers on update
  101. .. py:method:: bk_change_count(board_id, value, silent=False)
  102. Change the number of acquisitions you want to make.
  103. :param board_id: id of the board do manipulate
  104. :param value: (int) Number of acquisitions
  105. :param silent: (bool) if True do not inform observers on update
  106. .. py:method:: bk_change_wait(board_id, value, silent=False)
  107. Change the time between acquisitions.
  108. :param board_id: id of the board do manipulate
  109. :param value: (bool) Time in seconds
  110. :param silent: (bool) if True do not inform observers on update
  111. .. py:method:: bk_change_build_spectrograms(board_id, value, silent=False)
  112. Change if spectrograms are built or not)
  113. :param board_id: id of the board do manipulate
  114. :param value: (bool) True or False built or not
  115. :param silent: (bool) if True do not inform observers on update
  116. .. py:method:: bk_change_pilot_bunch(board_id, value, silent=False)
  117. Change if pilot bunch is simulated
  118. :param board_id: id of the board do manipulate
  119. :param value: (bool) True or False to simulate or not
  120. :param silent: (bool) if True do not inform observers on update
  121. .. py:method:: _bif_iterate_spectrograms(board_id, path)
  122. BROKEN (DOES NOT GET ANY DATA)
  123. Built Spectrograms line by line
  124. :param board_id: id of the board do manipulate
  125. :param path: where to built the spectrogram
  126. .. py:method:: _bif_read_data_and_save(board_id)
  127. Tell the pci command to start acquisition and save data
  128. Also generates the filename from settings
  129. :param board_id: id of the board do manipulate
  130. .. py:method:: _bif_read_and_update_data_from_file(board_id, filename)
  131. Proxy function for _bif_read_and_update to call with correct read_func
  132. :param board_id: id of the board do manipulate
  133. :param filename: filename to read data from
  134. .. py:method:: _bif_read_and_update_data_from_string(board_id, raw_data)
  135. Proxy function for _bif_read_and_update to call with correct read_func
  136. :param board_id: id of the board do manipulate
  137. :param raw_data: Data as string
  138. .. py:method:: _bif_read_and_update(board_id, read_func, *args)
  139. Function to read data from file or string (depending on read_func) and update plots etc.
  140. :param board_id: id of the board do manipulate
  141. :param read_func: function to use to read data
  142. :param args: filename or raw_data (see _bif_read_and_update_from_{filename, string}
  143. .. py:method:: bk_acquire(board_id)
  144. Toggle Acqisition
  145. :param board_id: id of the board do manipulate
  146. .. py:method:: _bif_stop_acquisition(board_id)
  147. Stop acquisition
  148. This does stop the timer started by _bif_start_acquisition()
  149. :param board_id: id of the board do manipulate
  150. .. py:method:: _bif_start_acquisition(board_id)
  151. Start acquisition.
  152. This will start a timer to automatically acquire data.
  153. :param board_id: id of the board do manipulate
  154. .. py:method:: bk_single_read(board_id)
  155. Perform a single read of data
  156. :param board_id: id of the board do manipulate
  157. .. py:method:: _bif_set_continuous_read_active(board_id)
  158. Enable continuous read
  159. :param board_id: id of the board do manipulate
  160. .. py:method:: _bif_set_continuous_read_inactive(board_id)
  161. Disable continuous read
  162. :param board_id: id of the board do manipulate
  163. .. py:method:: bk_continuous_read(board_id, interval=100)
  164. Toggle continuous read
  165. :param board_id: id of the board do manipulate
  166. :param interval: Time between two consecutive reads.
  167. .. py:method:: _bif_continuous_read(board_id, interval=None)
  168. Perform continuous read based on a timer.
  169. :param interval:
  170. .. py:method:: _bif_read_data(board_id)
  171. Reads data acquired by board.
  172. :param board_id: id of the board do manipulate
  173. .. py:method:: bk_board_connected(board_id)
  174. Interface to the board to check if it is connected.
  175. :param board_id: id of the board do manipulate
  176. .. py:method:: bk_get_temperature(board_id)
  177. Get Temperature from board and format it
  178. :param board_id: id of the board do manipulate
  179. .. py:method:: bk_time_scan(board_id, c_frm, c_to, f_frm, f_to, ts_pbar, plot_func, orbits_observe=None, orbits_skip=None)
  180. Toggle Timescan.
  181. :param board_id: id of the board do manipulate
  182. :param c_frm: (int) From value for Coarse scan
  183. :param c_to: (int) To value for Coarse scan
  184. :param f_frm: (int) From value for Fine scan
  185. :param f_to: (int) To value for fine scan
  186. :param ts_pbar: Handle to the Timescan Progressbar
  187. :param plot_func: Function to plot when timescan ended.
  188. :param orbits_observe: Number of orbits to observe for the timescan (original values will be restored after timescan)
  189. :param orbits_skip: Number of orbits to skipfor the timescan (original values will be restored after timescan)
  190. .. py:method:: _bif_stop_time_scan(board_id, ts_pbar)
  191. Stop the timescan. This stops the timer.
  192. :param board_id: id of the board do manipulate
  193. :param ts_pbar: Timescan Progressbar handle
  194. .. py:method:: _bif_start_time_scan(board_id, c_frm, c_to, f_frm, f_to, timescan_progressbar, plot_func, orbits_observe, orbits_skip)
  195. Start the timscan. This starts the timer
  196. :param board_id: id of the board do manipulate
  197. :param c_frm: From value for coarse scan
  198. :param c_to: To value for coarse scan
  199. :param f_frm: From value for fine scan
  200. :param f_to: To value for fine scan
  201. :param timescan_progressbar: Handle for the timescanprogressbar
  202. :param plot_func: Function to use to plot the data
  203. :param orbits_observe: Number of orbits to observe for the timescan (original values will be restored after timescan)
  204. :param orbits_skip: Number of orbits to skipfor the timescan (original values will be restored after timescan)
  205. .. py:method:: bk_check_for_board(board_id)
  206. Check if board is connected
  207. Also overrides the bk_status_readout function with a function that does nothing (suppresses read attempts that
  208. generate errors - if no board is connected, there is nothing to read from)
  209. Also overrides the bk_get_temperature function as of the same reasons
  210. :param board_id: id of the board do manipulate
  211. .. py:method:: bk_toggle_wait_on_trigger(board_id, num_of_acquisitions=None, skip=None, timeout=None, method=None)
  212. Toggle waiting for trigger signal to acquire
  213. :param board_id: id of the board do manipulate
  214. :param num_of_acquisitions: number of acquisitions to wait for
  215. :param skip: how much trigger signals to skip between acquisitions
  216. :param timeout: the timeout for the pci to wait for date
  217. :param method: wait method to use
  218. 1 for wait in pci command and 2 for waiting until register is set that KAPTURE has read data
  219. NOTE: this also means that method 1 enables simultaneous read and write to dma and method 2 does write and
  220. read sequentially
  221. .. py:method:: _bif_start_wait_on_trigger(board_id, num_of_acquisitions=None, skip=None, timeout=None, method=None)
  222. Start waiting on external acquisition trigger. This starts the timer
  223. :param board_id: id of the board do manipulate
  224. :param num_of_acquisitions: number of acquisitions to do
  225. :param count_label: Handle for the countlabel
  226. :param method: wait method to use
  227. 1 for wait in pci command and 2 for waiting until register is set that KAPTURE has read data
  228. NOTE: this also means that method 1 enables simultaneous read and write to dma and method 2 does write and
  229. read sequentially