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

Enable PDMR measurements by adding analog channel capabilities to National Instruments hardware #258

Merged
merged 15 commits into from
Feb 1, 2018

Conversation

drogenlied
Copy link
Member

  • Add multichannel support to ODMR
  • Add analog input channels to ODMR, Counter and Scanner on National Instruments X Series hardware
  • Clean up configuration and adapt to ConfigOption-only configuration
  • Rename module due to frequent misunderstandings about hardware compatibility

Description

ODMR:

Handle multiple channels that are recorded at the same time and can be shown in the GUI.
Requires changes to ODMRCounterInterface an the data stored in odmr_logic.

NI Card:

Renamed to national_instruments_x_series.py so pople do not wrongly assume that M-Series cards should work fine and then complain.

Added the possibility to record voltages on analog inputs.

Made all configuration variables into ConfigOption entries.

Old configuration:

mynicard:
     module.Class: 'ni_card.NICard'
     clock_channel: '/Dev1/Ctr0'
     counter_channel: '/Dev1/Ctr1'
     scanner_clock_channel: '/Dev1/Ctr2'
     scanner_counter_channel: '/Dev1/Ctr3'
     photon_source: '/Dev1/PFI8'
     photon_source2: '/Dev1/PFI9'
     gate_in_channel: '/Dev1/PFI9'
     counting_edge_rising: True
     odmr_trigger_channel: '/Dev1/PFI15'
     scanner_x_ao: '/Dev1/AO0'
     scanner_y_ao: '/Dev1/AO1'
     scanner_z_ao: '/Dev1/AO2'
     scanner_a_ao: '/Dev1/AO3'
     clock_frequency: 100
     scanner_clock_frequency: 100
     x_range:
     - 0e-6
     - 200e-6
     y_range:
     - 0e-6
     - 200e-6
     z_range:
     - -100e-6
     - 100e-6
     a_range:
     - -10
     - 10
     voltage_range:
     - -10
     - 10
     samples_number: 10

New configuration:

   mynicard:
        module.Class: 'national_instruments_x_series.NationalInstrumentsXSeries'
        clock_channel: '/Dev1/Ctr0'
        scanner_clock_channel: '/Dev1/Ctr2'
        photon_sources:
            - '/Dev1/PFI8'
            - '/Dev1/PFI9'
        counter_channels:
            - '/Dev1/Ctr1'
        counter_ai_channels:  # optional
            - '/Dev1/AI1'
        scanner_counter_channels:
            - '/Dev1/Ctr3'
        scanner_ai_channels:  # optional
            - '/Dev1/AI0'
        scanner_ao_channels:
            - '/Dev1/AO0'
            - '/Dev1/AO1'
            - '/Dev1/AO2'
            - '/Dev1/AO3'
        scanner_position_ranges:
            - [0e-6, 200e-6]
            - [0e-6, 200e-6]
            - [-100e-6, 100e-6]
            - [-10, 10]
        scanner_voltage_ranges:
            - [-10, 10]
            - [-10, 10]
            - [-10, 10]
            - [-10, 10]
        default_samples_number: 10
        defualt_clock_frequency: 100 
        default_scanner_clock_frequency: 100
        gate_in_channel: '/Dev1/PFI9'
        counting_edge_rising: True
        odmr_trigger_channel: '/Dev1/PFI15'

Motivation and Context

Recording an analog voltage during scans is useful for research like Photoelectric detection of electron spin resonance.

At the same time, we can simplify the parsing of configuration options greatly by using lists and ConfigOption:

How Has This Been Tested?

  • This code has been used to perform PDMR measurements.
  • Saving multichannel ODMR data has been used in experiments.
  • The configuration has been tested with and without analog channels.
  • The ODMR counter dummy module has been updated.
  • Scanning and counting with analog channels has been performed.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have checked that the change does not contain obvious errors (syntax, indentation, mutable default values).
  • I have tested my changes using 'Load all modules' on the default dummy configuration with my changes included.
  • All changed Jupyter notebooks have been stripped of their output cells.

@a-stark
Copy link
Contributor

a-stark commented Sep 11, 2017

That looks like a great improvement for the odmr code. Thank you for your work. I might even have the possibility to test this pull request with a setup using a photodiode for odmr instead of an apd. Let's hope that the control pc contains a x-series ni card...

@a-stark
Copy link
Contributor

a-stark commented Sep 12, 2017

hmm, the PC has the NI 6229 card, so just two counter :/
But I will have a look at least from the overall perspective. If there would be counter available for analog channels (instead of displaying the counts as y value, displaying the analog voltage) then I could test it with the interfuse... ;)

@christoph-mueller
Copy link
Contributor

Hey,
we tested it in our setup. The counter gave the PD voltage. That works nice, also ODMR was working via photodiode.
However, in the counter, I only had the values in the plot, but this digital number on the top right corner kept saying '0'. Maybe I just had wrong config settings? Or is that a general thing.
The other issue is, I would very much like it, if I am able to switch between APD and analog PD signal. Maybe with some checkbos in the counter gui. That would be great, since I have both in my setup, and could then switch between them by using a flip mirror.

@drogenlied
Copy link
Member Author

The 0 was probably the APD count value.

It is right that the counter GUi can only show one channel as a number right now, but shows all channels in the plot.

I will probably add a channel selection box like in the confocal and ODMR GUIs.

There is now an option letting you select, which count trace should be displayed on top. Additionally you can select which traces are to be plotted.

However, the save still saves all the traces.
@kay-jahnke
Copy link
Member

All known issues were fixed.
Please double check the code again.
Then someone needs to merge it with the branch (or show me how to do it), before we start including all the changes made by Andrea.

@bens0n
Copy link
Contributor

bens0n commented Jan 30, 2018

We've been using this at https://github.com/WarwickEPR/qudi/tree/analog_readout - it is working well. There's a small error in the logic for the analog readout of a counter when you have multiple analog channels -- see the fix at https://github.com/WarwickEPR/qudi/blame/1bb7b9512b2d0cb30188ffebfd2a351cc832ab55/hardware/national_instruments_x_series.py#L630

christoph-mueller and others added 2 commits January 31, 2018 00:59
There is now an option letting you select, which count trace should be displayed on top. Additionally you can select which traces are to be plotted.

However, the save still saves all the traces.

----
Also fixed a small error in returning the analogue values for multiple channels.

Thanks to Ben for the Tip!
@kay-jahnke
Copy link
Member

Directly included your fix.
Thanks for making us aware of it.

@bens0n
Copy link
Contributor

bens0n commented Jan 31, 2018

In the current implementation, all the analog additions have been made optional, but the national_instrument_x_series module still explicitly requires APD-style photon counters. This is frustrating in systems with only analog detection, as the default detection channel for all windows (confocal, odmr etc) is the vestigial photon counter channel.

I have removed these dependencies and tested them in https://github.com/bens0n/qudi/tree/upstreamnidaq_analog_etc. Do you want to consider including them in this PR or would you rather a separate PR once this current one has been merged?

@AndreaFilipovski
Copy link
Contributor

AndreaFilipovski commented Jan 31, 2018 via email

@kay-jahnke
Copy link
Member

After a short discussion today, we decided to first merge everything in a non breaking way.
After that we definitely need another pull request in order to generally clean up all the modules relating to NiDaq.

# Conflicts:
#	gui/counter/countergui.py
#	hardware/national_instruments_x_series.py
@Neverhorst
Copy link
Member

Ok, I tried to resolve the conflicts with master. Can someone please quickly check if this branch still works as intended?

I'm not sure - @kay-jahnke - what you mean with non-breaking.
As soon as we merge this branch into master a change in the config becomes necessary in order to use NI X-series cards. This is considered a breaking change I would say.

@Neverhorst
Copy link
Member

@bens0n, I think for a better overview and cleanliness we should not rush to put all recent changes to the NI card module into one single pull request.
To go over the changes you made in your fork is a seperate task in my opinion.
Especially because a lot of discussions are going on lately about rethinking the whole NI card concept of qudi anyway. Reasons are that the NI card resources could be used in a more efficient way and the whole interface for counting and scanning are strongly tailored to NIDAQ.
But you are right, the fact that you can't "go fully analog" is an issue we should tackle.

@bens0n
Copy link
Contributor

bens0n commented Feb 1, 2018

No problem - sounds great! ni_card is definitely the thorny beast lurking under the waters of Qudi.

…race is a constant value.

Software tested with physical photodiode.
Copy link
Member

@Neverhorst Neverhorst left a comment

Choose a reason for hiding this comment

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

Ready to merge

Copy link
Member

@kay-jahnke kay-jahnke left a comment

Choose a reason for hiding this comment

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

Tested on photodiode setup. Works!

@kay-jahnke kay-jahnke merged commit 2dfd4aa into master Feb 1, 2018
@kay-jahnke kay-jahnke deleted the nidaq_analog_etc branch February 1, 2018 10:39
kay-jahnke added a commit that referenced this pull request Feb 7, 2019
Enable PDMR measurements by adding analog channel capabilities to National Instruments hardware
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants