Skip to content

Commit 3a2eaf6

Browse files
authored
Merge pull request #50 from VektrexElectronicSystems/development-sandbox
Development sandbox 1.7.0
2 parents d7ffc4d + d8a27bb commit 3a2eaf6

File tree

45 files changed

+4504
-59
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4504
-59
lines changed

README.md

Lines changed: 72 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,90 @@ Use these code samples to start learning how to communicate with your SpikeSafe
1515

1616
## Usage
1717

18+
### Python
19+
Download and install [Python](https://www.python.org/downloads/), which will install:
20+
- IDLE
21+
- Python Launcher
22+
- Python3 Interpreter
23+
24+
#### Windows Setup
25+
26+
##### Use the Standard Console Command Prompt
27+
To open Command Prompt press the key combination Windows + R to open a Run dialog, and then type cmd and hit Enter or click Ok.
28+
29+
##### Add Python to PATH
30+
It is recommended that the path of Python Interpreter is added for easy usage. There are two ways to add Python to Windows PATH.
31+
32+
1. During Python installation check the box Add Python to PATH when prompted.
33+
- Confirm Python PATH is set in **Command Prompt** by typing `python3 --version` to verify the Python version
34+
35+
2. Manually add Python to Windows Path:
36+
- Press the key combination **Windows + R** to open a Run dialog
37+
- Type `sysdm.cpl` to open the System Properties
38+
- Press **Advanced** tab and then press on **Environment Variables…** to open Environment Variables dialog
39+
- Under the **User variables** box, press on **New…** to add the `Path` variable (if your **Path** variable already exists, then press on **Edit…** instead):
40+
- Set the Path **Variable value** to the 1) `Python application path` and 2) `Python Scripts path`. To find these paths and set the value:
41+
- Type `Python` in the Windows Search Bar
42+
- Right-click on the **Python App**, and then press **Open file location**
43+
- Right-click on the **Python shortcut**, and then press **Open file location** (this is the `Python application path`)
44+
- Navigate to the **scripts** folder (this is the `Python Scripts path`)
45+
- Set the Path **Variable value** to `Python application path;Python Scripts path` (paths are separated by a semicolon)
46+
- Press **OK**
47+
- Confirm Python PATH is set in **Command Prompt** by typing `python3 --version` to verify the Python version
48+
49+
#### Mac OS X Setup
50+
51+
##### Use the Standard Console Terminal
52+
To open Terminal navigate to Applications, then Utilities, then double-click the Terminal program.
53+
54+
##### Add Python to PATH
55+
It is recommended that the path of Python Interpreter is added for easy usage. To do this:
56+
57+
- The path for Python interpreter can be found by opening **Python Launcher application** (this is the `Python install directory`)
58+
- Open **Terminal**
59+
- Type `sudo nano /etc/paths`
60+
- Enter path of the `Python install directory` here
61+
- Press `Control + X` to exit
62+
- Press `Y` to save
63+
- Confirm Python PATH is set in **Terminal** by typing `python3 --version` to verify the Python version
64+
1865
### IDEs
1966

2067
#### Visual Studio Code and Using a Virtual Environment
21-
To run these sequences a light-weight IDE, or to target cross-platform development, use the free [Visual Studio Code](https://code.visualstudio.com/). See [Getting Started with Python in VS Code](https://code.visualstudio.com/docs/python/python-tutorial) to simply setup your IDE with Python. Optionally, using a [virtual environment](https://docs.python.org/3/tutorial/venv.html) is recommended to successfully meet the installation requirements to run these sequences. Using the commands `py -3 -m venv .venv` followed by `.venv\scripts\activate` is a simple way to setup your virtual environment. After your IDE and virtual environment is setup, continue to install the remaining Python packages below.
68+
To run these sequences a light-weight IDE, or to target cross-platform development, use the free [Visual Studio Code](https://code.visualstudio.com/). See [Getting Started with Python in VS Code](https://code.visualstudio.com/docs/python/python-tutorial) to simply setup your IDE with Python. Optionally, using a [virtual environment](https://docs.python.org/3/tutorial/venv.html) is recommended to successfully meet the installation requirements to run these sequences. Using the commands `python3 -m venv .venv` followed by `.venv\scripts\activate` is a simple way to setup your virtual environment. After your IDE and virtual environment is setup, continue to install the remaining Python packages below.
2269

2370
#### Visual Studio Community
2471
To run these sequences in a more feature rich IDE, use the free [Visual Studio Community](https://visualstudio.microsoft.com/vs/community/). See [Python In Visual Studio](https://docs.microsoft.com/en-us/visualstudio/python/tutorial-working-with-python-in-visual-studio-step-00-installation?view=vs-2022) to simply setup your IDE with Python. Optionall, using a [virtual environment](https://docs.microsoft.com/en-us/visualstudio/python/managing-python-environments-in-visual-studio?view=vs-2022) is recommended to successfully meet the installation requirements to run these sequences.
2572

2673
### Packages
2774

28-
#### Installing spikesafe-python Package
29-
The [spikesafe-python](https://pypi.org/project/spikesafe-python/) library will need to be installed using the command `python -m pip install spikesafe-python`. Vektrex recommends always having the latest version of spikesafe-python when running these sequences; the current version is 1.2.3.
75+
#### Managing Packages
76+
##### How to Install/Upgraded Packages
77+
Installing packages use pip. It is recommended that pip be updated to latest version `python3 -m pip install --upgrade pip`
78+
79+
The version of pip can be displayed with the following command `pip3 -V`
80+
81+
##### How to View All Installed Packages
82+
A list of all installed packages can be found with `pip3 freeze` command
83+
84+
##### How to View Details of an Installed Package
85+
After a package is installed the details of a package can be displayed with the following command `pip3 show <package name>` (e.g. `pip3 show spikesafe-python`)
86+
87+
##### Installing spikesafe-python Package
88+
The [spikesafe-python](https://pypi.org/project/spikesafe-python/) library will need to be installed using the command `python3 -m pip install spikesafe-python`. Vektrex recommends always having the latest version of spikesafe-python when running these sequences; the current version is 1.2.3.
3089

3190
Once the spikesafe-python package is installed, each script in this repository can be run independently as a standalone Python file. Run a file in its current state and verify that the expected outputs are obtained, as specified by the file's markdown description.
3291

3392
Complete class documentation is available for spikesafe-python in [spikesafe-python API Overview](spikesafe_python_lib_docs).
3493

3594
#### Installing matplotlib Package
36-
Some sequences involve graphing measurement results. To properly graph results, the [matplotlib](https://matplotlib.org/) library is required (version 3.2.1 or greater). Use the command `python -m pip install matplotlib` to install the latest version of matplotlib. Once the matplotlib library is installed, each sequence that involves graphing can be run as a standalone Python file.
95+
Some sequences involve graphing measurement results. To properly graph results, the [matplotlib](https://matplotlib.org/) library is required (version 3.2.1 or greater). Use the command `python3 -m pip install matplotlib` to install the latest version of matplotlib. Once the matplotlib library is installed, each sequence that involves graphing can be run as a standalone Python file.
3796

3897
#### Installing PyCLibrary Package
39-
Some sequences require external C resources, and requires the [PyCLibrary](https://pyclibrary.readthedocs.io/en/latest/) library. To install this library, enter the command `python -m pip install pyclibrary`. Once the PyCLibrary library is installed, each sequence that involves external C resources can be run as a standalone Python file.
98+
Some sequences require external C resources, and requires the [PyCLibrary](https://pyclibrary.readthedocs.io/en/latest/) library. To install this library, enter the command `python3 -m pip install pyclibrary`. Once the PyCLibrary library is installed, each sequence that involves external C resources can be run as a standalone Python file.
4099

41100
#### Installing pyserial Package
42-
Some sequences involve connecting to a serial interface instrument and requires the [pyserial](https://pypi.org/project/pyserial/) library (version 3.5 or greater). Use the command `python -m pip install pyserial` to install the latest version of pyserial. Once the pyserial library is installed, each sequence that involves a serial interface can be run as a standalone Python file.
101+
Some sequences involve connecting to a serial interface instrument and requires the [pyserial](https://pypi.org/project/pyserial/) library (version 3.5 or greater). Use the command `python3 -m pip install pyserial` to install the latest version of pyserial. Once the pyserial library is installed, each sequence that involves a serial interface can be run as a standalone Python file.
43102

44103
### General Usage
45104
For most examples, you may need to modify the specified IP address within a sequence to match the IP address that is physically set on your SpikeSafe's DIP switch. In each sequence, the default IP address of 10.0.0.220 is set in the line `ip_address = '10.0.0.220'`.
@@ -67,16 +126,22 @@ First start with [TCP Socket Sample](getting_started/tcp_socket_sample) to learn
67126

68127
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/VektrexElectronicSystems/SpikeSafePythonSamples/tags).
69128

129+
## FAQ
130+
131+
I'm developing an application using NI-VISA, what is the recommended practice for handling termination characters?<br />
132+
See [Termination Characters in NI-VISA](https://www.ni.com/en-us/support/documentation/supplemental/06/termination-characters-in-ni-visa.html)
133+
70134
## Support/Feedback
71135

72136
If any further assistance is needed beyond the information provided within this repository, email [email protected].
73137

74-
Feature requests and bug reports can be submitted to [the Vektrex website's support page](https://www.vektrex.com/request-support/). Select "Other" as the Product/System and enter "GitHub Repository" as the Subject.
138+
Feature requests and bug reports can be submitted to [the Vektrex website's support page](https://www.vektrex.com/request-support/). Select "Other" as the Product/System and enter "SpikeSafePythonSamples GitHub Repository" as the Subject.
75139

76140
## Contributors
77141

78142
* **Andy Fung** - [andyfung](https://github.com/andyfung)
79143
* **Bill Thompson** - [BillThomp](https://github.com/BillThomp)
144+
* **Brad Wise** - [BradWise](https://github.com/bradwise)
80145
* **Eljay Gemoto** - [eljayg](https://github.com/eljayg)
81146

82147
## License

application_specific_examples/controlling_thermal_platform_temperature/ControllingThermalPlatformTemperature.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@
1616

1717
### setting up sequence log
1818
log = logging.getLogger(__name__)
19-
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s.%(msecs)03d, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
19+
logging.basicConfig(
20+
level=logging.INFO,
21+
format='%(asctime)s.%(msecs)03d, %(levelname)s, %(message)s',
22+
datefmt='%m/%d/%Y %I:%M:%S',
23+
handlers=[
24+
logging.FileHandler("SpikeSafePythonSamples.log"),
25+
logging.StreamHandler(sys.stdout)
26+
]
27+
)
2028

2129
### start of main program
2230
try:

application_specific_examples/fixed_pulse_count_using_software_timing/FixedPulseCountUsingSoftwareTimingExample.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@
1818

1919
### setting up sequence log
2020
log = logging.getLogger(__name__)
21-
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s.%(msecs)03d, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
21+
logging.basicConfig(
22+
level=logging.INFO,
23+
format='%(asctime)s.%(msecs)03d, %(levelname)s, %(message)s',
24+
datefmt='%m/%d/%Y %I:%M:%S',
25+
handlers=[
26+
logging.FileHandler("SpikeSafePythonSamples.log"),
27+
logging.StreamHandler(sys.stdout)
28+
]
29+
)
2230

2331
### start of main program
2432
try:

application_specific_examples/making_tj_measurements/TjMeasurement.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,15 @@ def calculate_Vf0(start_point, end_point, digitizer_data_list):
7373

7474
### setting up sequence log
7575
log = logging.getLogger(__name__)
76-
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s.%(msecs)03d, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
76+
logging.basicConfig(
77+
level=logging.INFO,
78+
format='%(asctime)s.%(msecs)03d, %(levelname)s, %(message)s',
79+
datefmt='%m/%d/%Y %I:%M:%S',
80+
handlers=[
81+
logging.FileHandler("SpikeSafePythonSamples.log"),
82+
logging.StreamHandler(sys.stdout)
83+
]
84+
)
7785

7886
### start of main program
7987
try:
@@ -119,7 +127,7 @@ def calculate_Vf0(start_point, end_point, digitizer_data_list):
119127
input()
120128
log_and_print_to_console('Enter T2 (in °C):')
121129
temperature_two = float(receive_user_input_and_log())
122-
log_and_print_to_console('Enter V2 (in °C):')
130+
log_and_print_to_console('Enter V2 (in V):')
123131
voltage_two = float(receive_user_input_and_log())
124132

125133
k_factor = (voltage_two - voltage_one)/(temperature_two - temperature_one)

application_specific_examples/making_transient_dual_interface_measurement/digitizer_log_sampling_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def receive_user_input_and_log():
9393
tcp_socket.send_scpi_command('SYST:ERR?')
9494
syst_err_string = tcp_socket.read_data()
9595

96-
# SMU setting
96+
# PSMU setting
9797
# set DC Dynamic mode
9898
tcp_socket.send_scpi_command('SOUR1:FUNC:SHAP DCDYNAMIC')
9999

application_specific_examples/measuring_dc_staircase_voltages/MeasuringDcStaircaseVoltages.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@
3434

3535
### setting up sequence log
3636
log = logging.getLogger(__name__)
37-
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s.%(msecs)03d, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
37+
logging.basicConfig(
38+
level=logging.INFO,
39+
format='%(asctime)s.%(msecs)03d, %(levelname)s, %(message)s',
40+
datefmt='%m/%d/%Y %I:%M:%S',
41+
handlers=[
42+
logging.FileHandler("SpikeSafePythonSamples.log"),
43+
logging.StreamHandler(sys.stdout)
44+
]
45+
)
3846

3947
### start of main program
4048
try:
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
[Spectrometer]
2+
Description=0048144F1 - OFG-424
3+
Type=CAS140D
4+
Model=151
5+
Slit=100
6+
SerialNumber=004814417;17-4400
7+
Pixel=1044
8+
DeadPixel=10
9+
ActivePixel=975
10+
IntTimeMin=4
11+
IntTimeMax=65000
12+
DeleteIntTime=10
13+
Filter=2
14+
Shutter=2
15+
I2Caddress=$2E
16+
ADC_Bits=16
17+
ADC_Shift=32768
18+
ConfigDeviceCRC=0x00006356
19+
20+
[ADC]
21+
ADC.Ref=2.5
22+
ADC0.Factor=-43.54
23+
ADC0.Offs=24.26
24+
25+
[DensityFilter]
26+
0=none
27+
1=OD1
28+
2=OD2
29+
3=OD3
30+
4=OD4
31+
5=none
32+
6=none
33+
7=none
34+
35+
[Wavelength Calibration]
36+
D0=353.13
37+
D1=0.51187
38+
D2=-2.4478E-005
39+
D3=-1.1034E-009
40+
41+
[Wavelength Calibration Points]
42+
23.72=365.24
43+
101.28=404.75
44+
162.85=435.82
45+
384.15=546.08
46+
561.89=632.82
47+
694.69=696.54
48+
783=738.4
49+
836.47=763.51
50+
971.83=826.45
51+
52+
[Linearity]
53+
c110=1.0134
54+
c165=1.0132
55+
c275=1.0126
56+
c440=1.0132
57+
c660=1.014
58+
c939=1.0142
59+
c1265=1.0145
60+
c1652=1.0146
61+
c2754=1.0141
62+
c3858=1.0144
63+
c5520=1.0129
64+
c7190=1.0107
65+
c8859=1.0101
66+
c11066=1.0085
67+
c13865=1.0064
68+
c16686=1.0045
69+
c19474=1.003
70+
c22309=1.0016
71+
c25120=1.0006
72+
c27944=0.99956
73+
c33609=0.99786
74+
c39178=0.99719
75+
c44856=0.99663
76+
c50452=0.99669
77+
c56032=0.99781
78+
c61445=1
79+
80+
[Information]
81+
0=----------Array Detector-------------
82+
1=Array : 1044 Pixel
83+
2=ADC : 16 Bit
84+
3=Cycle Time : 4 ms
85+
4=PC Interface : CAS 100/120/140CT/140D - USB
86+
5=
87+
6=--Flat Field Grating Spectrograph--
88+
7=Grating : 400 l/mm
89+
8=Blaze : 550 nm
90+
9=Spectral Range : ca. 1..10000 nm
91+
10=Order Sorting Filter : yes
92+
11=Shutter : yes
93+

0 commit comments

Comments
 (0)