Development

If you are interested in assisting with the development of the library or want to have the most recent version of the software to be available for you. You can create a local Git repository on your local machine.

Please visit https://docs.github.com/en/github for more details. Below, you can find a brief instruction how to proceed.

Create GitHub Account

the first step is to create a GitHub account if you do not have one. Go here to Join GitHub for free

After create the GitHub account you can familiarize yourself with the system, read many articles online or watch youtube videos.

Fork and Clone GitHub Repository

Second, you need to fork the repository and later clone it to your local drive.

Installing local repository

Now, after cloning the repository, we can install it with PIP. Change directory to the folder with the repository and run.

pip3 install -e .

This install the local repository as a library in Python. Next, start python, import library and check version.

python3
import icarus_nmr #or import icarus_nmr as inmr
icarus_nmr.__version__ #inmr.__version__

>> '0.1.0.post2.dev0+g5214016'

Launch Software

Before getting into detailed operation of the software, we can launch all processes. To do so, we need to open terminal window and open four different tabs. Change directory in each tab to the location of the code and go two directories dipper.

cd /location_of_the_repository/icarus_nmr/scripts

Now in each tab run the following commands in this sequence.

first tab, command:

user13:scripts user-13$ python3 device_controller_mock.py --list-pvs

or if you are connected to a real device you can connect to it instead of a simulator

user13:scripts user-13$ python3 device_controller_real.py --list-pvs

You get something like this which is an indication that the device controller process has been succesfully started and the data is generated by a mock driver, saved into device queue and made available for the event controller and digital controller.

/Users/user-13/All-Projects-on-user/LaserLab/Software/libraries/auxiliary/ubcs_auxiliary/threading.py:4: DeprecationWarning: The 'ubcs_auxiliary.threading' class was renamed to 'ubcs_auxiliary.multithreading' to make room for 'multithreading' and 'multiprocessing'
  warnings.warn("The 'ubcs_auxiliary.threading' class was renamed to 'ubcs_auxiliary.multithreading' to make room for 'multithreading' and 'multiprocessing'", DeprecationWarning )
/Users/user-13/All-Projects-on-user/LaserLab/Software/libraries/icarus-nmr/icarus_nmr/tests/test_data/mock_driver traces.py
set DIO inside device daq library
['device_controller.py', '--list-pvs']
{'prefix': 'device_mock:', 'macros': {}}
{'module_name': 'caproto.asyncio.server', 'log_pv_names': True, 'interfaces': ['0.0.0.0']}
[I 14:32:19.159       server:  133] Asyncio server starting up...
INFO:caproto.ctx:Asyncio server starting up...
[I 14:32:19.164       server:  146] Listening on 0.0.0.0:5064
INFO:caproto.ctx:Listening on 0.0.0.0:5064
[I 14:32:19.165       server:  205] Server startup complete.
INFO:caproto.ctx:Server startup complete.
[I 14:32:19.165       server:  207] PVs available:
  device_mock:freq
  device_mock:dio
  device_mock:queue_length
  device_mock:data
  device_mock:peek_data
  device_mock:packet_shape
  device_mock:LIST
INFO:caproto.ctx:PVs available:
device_mock:freq
device_mock:dio
device_mock:queue_length
device_mock:data
device_mock:peek_data
device_mock:packet_shape
device_mock:LIST

seconf tab, command:

user:scripts user-13$ python3 dio_controller.py --list-pvs

You get something like this. It shows that the digital input-output(dio) controller has been successfully started, it subscribed to device controller digital PV.

[I 14:31:53.698       server:  133] Asyncio server starting up...
[I 14:31:53.698       server:  146] Listening on 0.0.0.0:50878
[I 14:31:53.699       server:  205] Server startup complete.
[I 14:31:53.699       server:  207] PVs available:
    digital_controller_mock:dio
    digital_controller_mock:bit0
    digital_controller_mock:bit0_enable
    digital_controller_mock:bit1
    digital_controller_mock:bit1_enable
    digital_controller_mock:bit2
    digital_controller_mock:bit2_enable
    digital_controller_mock:bit3
    digital_controller_mock:bit3_enable
    digital_controller_mock:bit4
    digital_controller_mock:bit4_enable
    digital_controller_mock:bit5
    digital_controller_mock:bit5_enable
    digital_controller_mock:bit6
    digital_controller_mock:bit6_enable
    digital_controller_mock:shutdown_state
    digital_controller_mock:operating_mode

third tab, command:

user13:scripts user-13$ python3 event_controller.py --list-pvs

this starts the event controller process which connects to the device controller and starts requesting data from the device controller queue. The event process analyzes data and make it available for the GUI to visualize.

/Users/user-13/All-Projects-on-user/LaserLab/Software/libraries/auxiliary/ubcs_auxiliary/threading.py:4: DeprecationWarning: The 'ubcs_auxiliary.threading' class was renamed to 'ubcs_auxiliary.multithreading' to make room for 'multithreading' and 'multiprocessing'
  warnings.warn("The 'ubcs_auxiliary.threading' class was renamed to 'ubcs_auxiliary.multithreading' to make room for 'multithreading' and 'multiprocessing'", DeprecationWarning )
[I 14:33:07.302       server:  133] Asyncio server starting up...
INFO:caproto.ctx:Asyncio server starting up...
[I 14:33:07.303       server:  146] Listening on 0.0.0.0:60959
INFO:caproto.ctx:Listening on 0.0.0.0:60959
[I 14:33:07.304       server:  205] Server startup complete.
INFO:caproto.ctx:Server startup complete.
[I 14:33:07.304       server:  207] PVs available:
    event_controller_mock:image_logging
    event_controller_mock:image_pre
    event_controller_mock:image_depre
    event_controller_mock:image_period
    event_controller_mock:t1
    event_controller_mock:dt
    event_controller_mock:server_name
    event_controller_mock:sample_pressure
    event_controller_mock:target_pressure
    event_controller_mock:pump_counter
    event_controller_mock:valves_per_pump_current
    event_controller_mock:valves_per_pump_total
    event_controller_mock:ctrl_operating_mode
    event_controller_mock:ctrl_shutdown_state
    event_controller_mock:ctrl_pump_state
    event_controller_mock:ctrl_disable_pump_state
    event_controller_mock:ctrl_pre_state
    event_controller_mock:ctrl_depre_state
    event_controller_mock:table_pressure_after_pre
    event_controller_mock:table_pressure_before_depre
    event_controller_mock:table_time_to_switch_pre
    event_controller_mock:table_time_to_switch_depre
    event_controller_mock:table_rise_slope
    event_controller_mock:table_fall_slope
    event_controller_mock:table_pulse_width_pre
    event_controller_mock:table_pulse_width_depre
    event_controller_mock:table_delay
    event_controller_mock:table_period
    event_controller_mock:table_valve_counter_pre
    event_controller_mock:table_valve_counter_depre
    event_controller_mock:warning_text
INFO:caproto.ctx:PVs available:
event_controller_mock:image_logging
event_controller_mock:image_pre
event_controller_mock:image_depre
event_controller_mock:image_period
event_controller_mock:t1
event_controller_mock:dt
event_controller_mock:server_name
event_controller_mock:sample_pressure
event_controller_mock:target_pressure
event_controller_mock:pump_counter
event_controller_mock:valves_per_pump_current
event_controller_mock:valves_per_pump_total
event_controller_mock:ctrl_operating_mode
event_controller_mock:ctrl_shutdown_state
event_controller_mock:ctrl_pump_state
event_controller_mock:ctrl_disable_pump_state
event_controller_mock:ctrl_pre_state
event_controller_mock:ctrl_depre_state
event_controller_mock:table_pressure_after_pre
event_controller_mock:table_pressure_before_depre
event_controller_mock:table_time_to_switch_pre
event_controller_mock:table_time_to_switch_depre
event_controller_mock:table_rise_slope
event_controller_mock:table_fall_slope
event_controller_mock:table_pulse_width_pre
event_controller_mock:table_pulse_width_depre
event_controller_mock:table_delay
event_controller_mock:table_period
event_controller_mock:table_valve_counter_pre
event_controller_mock:table_valve_counter_depre
event_controller_mock:warning_text

fourth tab, command:

user13:scripts user-13$ python3 gui_main.py

This starts the GUI process.

**** The executable "caRepeater" couldn't be located
**** because of errno = "No such file or directory".
**** You may need to modify your PATH environment variable.
**** Unable to start "CA Repeater" process.
CA.Client.Exception...............................................
    Warning: "Identical process variable names on multiple servers"
    Context: "Channel: "digital_controller_mock:bit0_enable", Connecting to: 10.177.115.77:50878, Ignored: user13.niddk.nih.gov:50878"
    Source File: ../cac.cpp line 1320
    Current Time: Wed Aug 25 2021 14:33:45.382095597
..................................................................

Note, the communication protocol used in icarus monitoring and control software requires computer to have any kind of active ethernet connection, WiFi or Ethernet.

Running test and creating documentation

To run all unit test

pytest

To generate documentation

make -C docs html