-
Notifications
You must be signed in to change notification settings - Fork 29
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
takuya-ulm
wants to merge
24
commits into
main
Choose a base branch
from
spectrum_card
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 0149c50
bug fix on the rework
takuya-ulm 432ad96
bug fix on the problems when stopping the measurement
takuya-ulm 6cf227f
improved docstrings
takuya-ulm f92ea0d
simplified data class
takuya-ulm 5172874
bug fix on data processing
takuya-ulm 63cee56
enable to input two channels
takuya-ulm 8eee2e6
settings working for two channels
takuya-ulm b82c228
data processing working for two channels
takuya-ulm 8bd620d
data processing working for two channels
takuya-ulm 6120246
bug fix on channel selection
takuya-ulm b328359
zero division handling
takuya-ulm 2a1f4b4
refactors for clear folder structure
takuya-ulm f5b1af7
improved docstrings
takuya-ulm d1cacb7
Merge branch 'refs/heads/main' into spectrum_card
takuya-ulm 6fbc1d0
Merge branch 'refs/heads/main' into spectrum_card
takuya-ulm 56886f7
update changelog.md
takuya-ulm d888eb8
debug on switched channel configuration
takuya-ulm 2f59628
reverted unnecessary changes at time_series_gui.py
takuya-ulm ad27029
change how to import pyspcm
takuya-ulm d788cdd
introduced QThread instead of threading
takuya-ulm 019be79
introduced spcm package for si ADC
takuya-ulm 6668e4f
removed wait_new_trig_reps
takuya-ulm c79186a
added TODO on error status
takuya-ulm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
src/qudi/hardware/fast_adc/spectrum/si_commands/buffer_commands.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
75
src/qudi/hardware/fast_adc/spectrum/si_commands/card_commands.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?