Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spectrum instrumentation ADC as fast_counter hardware #131

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2a4661c
rework on sprctrum card
takuya-ulm Feb 8, 2024
0149c50
bug fix on the rework
takuya-ulm Feb 9, 2024
432ad96
bug fix on the problems when stopping the measurement
takuya-ulm Feb 9, 2024
6cf227f
improved docstrings
takuya-ulm Feb 9, 2024
f92ea0d
simplified data class
takuya-ulm Feb 19, 2024
5172874
bug fix on data processing
takuya-ulm Feb 19, 2024
63cee56
enable to input two channels
takuya-ulm Mar 3, 2024
8eee2e6
settings working for two channels
takuya-ulm Mar 3, 2024
b82c228
data processing working for two channels
takuya-ulm Mar 3, 2024
8bd620d
data processing working for two channels
takuya-ulm Mar 3, 2024
6120246
bug fix on channel selection
takuya-ulm Mar 3, 2024
b328359
zero division handling
takuya-ulm Mar 6, 2024
2a1f4b4
refactors for clear folder structure
takuya-ulm May 14, 2024
f5b1af7
improved docstrings
takuya-ulm May 14, 2024
d1cacb7
Merge branch 'refs/heads/main' into spectrum_card
takuya-ulm May 14, 2024
6fbc1d0
Merge branch 'refs/heads/main' into spectrum_card
takuya-ulm May 14, 2024
56886f7
update changelog.md
takuya-ulm May 14, 2024
d888eb8
debug on switched channel configuration
takuya-ulm Mar 14, 2024
2f59628
reverted unnecessary changes at time_series_gui.py
takuya-ulm May 28, 2024
ad27029
change how to import pyspcm
takuya-ulm May 28, 2024
d788cdd
introduced QThread instead of threading
takuya-ulm Jun 4, 2024
019be79
introduced spcm package for si ADC
takuya-ulm Jun 25, 2024
6668e4f
removed wait_new_trig_reps
takuya-ulm Jun 25, 2024
c79186a
added TODO on error status
takuya-ulm Jun 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Re-introduced tilt correction (from old core) to the scanning probe toolchain.
- Improved support for Stanford Research Systems signal generators
- Expanded documentation of the microwave interface
- Added ADC from spectrum instrumentation as `FastCounterInterface` hardware.

### Other

Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
'PySide2', # get fixed version from core
'PyVisa>=1.12.0',
'scipy>=1.9.1',
'zaber_motion>=2.14.6'
'zaber_motion>=2.14.6',
'spcm>=1.2.1'
]

windows_dep = [
Expand All @@ -33,7 +34,8 @@
'PySide2', # get fixed version from core
'PyVisa>=1.12.0',
'scipy>=1.9.1',
'zaber_motion>=2.14.6'
'zaber_motion>=2.14.6',
'spcm>=1.2.1'
]

with open('VERSION', 'r') as file:
Expand Down
2 changes: 1 addition & 1 deletion src/qudi/gui/time_series/time_series_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def update_channel_settings(self, enabled, averaged):
units=different_units[0])
self._mw.trace_plot_widget.setLabel('right',
self._channels_per_axis[1][0],
units=different_units[1])
rev units=different_units[1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this "rev" supposed to be here?

else:
self._mw.trace_plot_widget.setLabel('left', 'Signal', units=different_units[0])
self._mw.trace_plot_widget.setLabel('right', 'Signal', units=different_units[1])
Expand Down
128 changes: 128 additions & 0 deletions src/qudi/hardware/fast_adc/spectrum/si_commands/buffer_commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# -*- coding: utf-8 -*-

"""
This file contains buffer command classes used for spectrum instrumentation ADC.

Copyright (c) 2021, the qudi developers. See the AUTHORS.md file at the top-level directory of this
distribution and on <https://github.com/Ulm-IQO/qudi-iqo-modules/>

This file is part of qudi.

Qudi is free software: you can redistribute it and/or modify it under the terms of
the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.

Qudi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with qudi.
If not, see <https://www.gnu.org/licenses/>.
"""
import pyspcm as spcm
from ctypes import byref


class DataBufferCommands:
"""
This class contains the methods which wrap the commands to control the data buffer handling.
Refer to the chapter 'Buffer handling' in the manual for more details.
"""

def __init__(self, card):
"""
@param str card: The card handle.
"""
self._card = card

def get_status(self):
status = spcm.int32()
spcm.spcm_dwGetParam_i32(self._card, spcm.SPC_M2STATUS, byref(status))
return status.value

def get_avail_user_len_B(self):
c_avail_user_len = spcm.c_int64(0)
spcm.spcm_dwGetParam_i64(self._card, spcm.SPC_DATA_AVAIL_USER_LEN, byref(c_avail_user_len))
return c_avail_user_len.value

def get_avail_user_pos_B(self):
c_avail_user_pos = spcm.c_int64(0)
spcm.spcm_dwGetParam_i64(self._card, spcm.SPC_DATA_AVAIL_USER_POS, byref(c_avail_user_pos))
return c_avail_user_pos.value

def get_avail_card_len_B(self):
c_avail_card_len_B = spcm.c_int64()
spcm.spcm_dwGetParam_i64(self._card, spcm.SPC_DATA_AVAIL_CARD_LEN, byref(c_avail_card_len_B))
return c_avail_card_len_B.value

def set_avail_card_len_B(self, avail_card_len_B):
c_avail_card_len_B = spcm.c_int32(avail_card_len_B)
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_DATA_AVAIL_CARD_LEN, c_avail_card_len_B)
return

def get_trig_counter(self):
c_trig_counter = spcm.c_int64()
spcm.spcm_dwGetParam_i64(self._card, spcm.SPC_TRIGGERCOUNTER, byref(c_trig_counter))
return c_trig_counter.value

def get_bits_per_sample(self):
c_bits_per_sample = spcm.c_int32(0)
spcm.spcm_dwGetParam_i32(self._card, spcm.SPC_MIINST_BITSPERSAMPLE, byref(c_bits_per_sample))
return c_bits_per_sample.value

class TsBufferCommands:
"""
This class contains the methods which wrap the commands to control the timestamp buffer handling.
Refer to the chapter 'Timestamps' in the manual for more details.
"""

def __init__(self, card):
"""
@param str card: The card handle.
"""
self._card = card

def reset_ts_counter(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_TIMESTAMP_CMD, spcm.SPC_TS_RESET)

def start_extra_dma(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_M2CMD, spcm.M2CMD_EXTRA_STARTDMA)

def wait_extra_dma(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_M2CMD, spcm.M2CMD_EXTRA_WAITDMA)

def stop_extra_dma(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_M2CMD, spcm.M2CMD_EXTRA_STOPDMA)

def poll_extra_dma(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_M2CMD, spcm.M2CMD_EXTRA_POLL)

def get_gate_len_alignment(self):
c_gate_len_alignment = spcm.c_int64(0)
spcm.spcm_dwGetParam_i64(self._card, spcm.SPC_GATE_LEN_ALIGNMENT, byref(c_gate_len_alignment))
return c_gate_len_alignment.value

def get_ts_avail_user_len_B(self):
c_ts_avail_user_len = spcm.c_int64(0)
spcm.spcm_dwGetParam_i64(self._card, spcm.SPC_TS_AVAIL_USER_LEN, byref(c_ts_avail_user_len))
return c_ts_avail_user_len.value

def get_ts_avail_user_pos_B(self):
c_ts_avail_user_pos = spcm.c_int64(0)
spcm.spcm_dwGetParam_i64(self._card, spcm.SPC_TS_AVAIL_USER_POS, byref(c_ts_avail_user_pos))
return c_ts_avail_user_pos.value

def get_ts_avail_card_len_B(self):
c_ts_avail_card_len_B = spcm.c_int64()
spcm.spcm_dwGetParam_i64(self._card, spcm.SPC_TS_AVAIL_CARD_LEN, byref(c_ts_avail_card_len_B))
return c_ts_avail_card_len_B.value

def set_ts_avail_card_len_B(self, ts_avail_card_len_B):
c_ts_avail_card_len_B = spcm.c_int64(ts_avail_card_len_B)
spcm.spcm_dwSetParam_i64(self._card, spcm.SPC_TS_AVAIL_CARD_LEN, c_ts_avail_card_len_B)
return

def get_timestamp_command(self):
c_ts_timestamp_command = spcm.c_int64()
spcm.spcm_dwGetParam_i64(self._card, spcm.SPC_TIMESTAMP_CMD, byref(c_ts_timestamp_command))
return c_ts_timestamp_command.value
75 changes: 75 additions & 0 deletions src/qudi/hardware/fast_adc/spectrum/si_commands/card_commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# -*- coding: utf-8 -*-

"""
This file contains card commands classes used for spectrum instrumentation ADC.

Copyright (c) 2021, the qudi developers. See the AUTHORS.md file at the top-level directory of this
distribution and on <https://github.com/Ulm-IQO/qudi-iqo-modules/>

This file is part of qudi.

Qudi is free software: you can redistribute it and/or modify it under the terms of
the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.

Qudi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with qudi.
If not, see <https://www.gnu.org/licenses/>.
"""
import pyspcm as spcm


class CardCommands:
"""
This class contains the methods which wrap the commands to control the SI card.
Refer to the chapter 'Acquisition modes', the section 'Commands' for more information.
"""

def __init__(self, card):
"""
@param str card: The card handle.
"""
self._card = card

def start_all(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_M2CMD, spcm.M2CMD_CARD_START | spcm.M2CMD_CARD_ENABLETRIGGER
| spcm.M2CMD_DATA_STARTDMA)

def start_all_with_extradma(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_M2CMD, spcm.M2CMD_CARD_START | spcm.M2CMD_CARD_ENABLETRIGGER
| spcm.M2CMD_DATA_STARTDMA | spcm.M2CMD_EXTRA_STARTDMA)

def start_all_with_poll(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_M2CMD, spcm.M2CMD_CARD_START | spcm.M2CMD_CARD_ENABLETRIGGER
| spcm.M2CMD_DATA_STARTDMA | spcm.M2CMD_EXTRA_POLL)

def card_start(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_M2CMD, spcm.M2CMD_CARD_START)

def card_stop(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_M2CMD, spcm.M2CMD_CARD_STOP)

def card_reset(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_M2CMD, spcm.M2CMD_CARD_RESET)

def enable_trigger(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_M2CMD, spcm.M2CMD_CARD_ENABLETRIGGER)

def disable_trigger(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_M2CMD, spcm.M2CMD_CARD_DISABLETRIGGER)

def force_trigger(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_M2CMD, spcm.M2CMD_CARD_FORCETRIGGER)

def start_dma(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_M2CMD, spcm.M2CMD_DATA_STARTDMA)

def stop_dma(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_M2CMD, spcm.M2CMD_DATA_STOPDMA)

def wait_dma(self):
spcm.spcm_dwSetParam_i32(self._card, spcm.SPC_M2CMD, spcm.M2CMD_DATA_WAITDMA)

Loading