add files needed for nicos

This commit is contained in:
2026-06-23 16:49:03 +02:00
parent 542bbc0c13
commit ba9ddfdd0b
22 changed files with 971 additions and 0 deletions
@@ -0,0 +1,59 @@
# *****************************************************************************
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program 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 General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Module authors:
# Davis V. Garrad <davis.last@psi.ch>
#
# *****************************************************************************
# do "accessory" stuff. Set field, temperature, etc.
SetEnvironment(tt, mf) # Add the PPMS temperature and field to the file at every write.
#maw(tt, 3) # set PPMS temperature
#maw(mf, 3) # set PPMS field
#nicossleep(20*60) # 20 minutes
# ...
# Create the pulse sequence
# generate_pulse(pulse_width, amplitude, delay_time, pulse_cycle)
pw90 = 2.3 # us
amp = 40 # percent
tau = 50 # us
p180 = generate_pulse(2*pw90, amp, 1, '1 3 3 1 2 0 0 2 0 2 2 0 3 1 1 3') # 180deg
p90 = generate_pulse(pw90, amp, tau, '0 2 0 2 1 3 1 3 0 2 0 2 1 3 1 3') # 90deg
p180_2 = generate_pulse(2*pw90, amp, 0, '1 3 3 1 2 0 0 2 0 2 2 0 3 1 1 3') # 180deg
seq = [ p180, p90, p180_2 ]
# Create the list of sequences to scan (specifically, for a T1 scan)
delay_times = log_durations(10, 1_000_000, 20)
# generates a list of sequences; copies of seq are made, only the zeroth pulse is modified. Each copy is given a 'delay_time' value from delay_times
seq_list = generate_sequences(seq, [0], 'delay_time', delay_times)
# Set some parameters independent of pulse sequence
globalparams = {
'acq_phase_cycle': '0 2 0 2 1 3 1 3 2 0 2 0 3 1 3 1',
'acquisition_time': 204.8, # us
'num_acqs': 100, # "1D scans" in TNMR. Our 16-fold phase cycling means this should be a multiple of 16 for proper averaging
'ringdown_time': 15, # us
'post_acquisition_time': 250, # ms
'obs_freq': 45.5, # MHz. Receiver frequency
'nucleus': 'NUCMgReS',
'comments': 'An example of a T1 scan',
}
update_device_parameters(nmr_daq_scout, globalparams)
# Acquire data
scan_sequences(nmr_daq_scout, seq_list) # gather the data
@@ -0,0 +1,62 @@
# *****************************************************************************
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program 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 General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Module authors:
# Davis V. Garrad <davis.last@psi.ch>
#
# *****************************************************************************
# do "accessory" stuff. Set field, temperature, etc.
SetEnvironment(tt, mf) # Add the PPMS temperature and field to the file at every write.
#maw(se_tt, 3) # set PPMS temperature
#nicossleep(20*60) # 20 minutes
# ...
# Create the pulse sequence
# generate_pulse(pulse_width, amplitude, delay_time, pulse_cycle)
pw90 = 2.5 # us
amp = 40 # percent
tau = 50 # us
p180 = generate_pulse(2*pw90, amp, 1, '1 3 3 1 2 0 0 2 0 2 2 0 3 1 1 3') # 180deg
p90 = generate_pulse(pw90, amp, tau, '0 2 0 2 1 3 1 3 0 2 0 2 1 3 1 3') # 90deg
p180_2 = generate_pulse(2*pw90, amp, 0, '1 3 3 1 2 0 0 2 0 2 2 0 3 1 1 3') # 180deg
seq = [ p180, p90, p180_2 ]
# Create the list of sequences to scan (specifically, for a T1 scan)
delay_times = log_durations(10, 1_000_000, 20)
# generates a list of sequences; copies of seq are made, only the zeroth pulse is modified. Each copy is given a 'delay_time' value from delay_times
seq_list = generate_sequences(seq, [0], 'delay_time', delay_times)
# Now, the reader should note how easy manipulating pulse sequences really is
for i in range(len(seq_list)):
seq_list[i][1]['delay_time'] = max(seq_list[i][0]['delay_time'] - 10.0, 0.1)
# Set some parameters independent of pulse sequence
globalparams = {
'acq_phase_cycle': '0 2 0 2 1 3 1 3 2 0 2 0 3 1 3 1',
'acquisition_time': 204.8, # us
'num_scans': 1024, # "1D scans" in TNMR. Our 16-fold phase cycling means this should be a multiple of 16 for proper averaging
'ringdown_time': 1, # us
'post_acquisition_time': 250, # ms
'obs_freq': 45.5, # MHz. Receiver frequency
'nucleus': 'NUCMgReS',
'comments': 'An example of a T2 scan',
}
update_device_parameters(nmr_daq_scout, globalparams)
# Acquire data
scan_sequences(nmr_daq_scout, seq_list) # gather the data
@@ -0,0 +1,50 @@
# *****************************************************************************
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program 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 General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Module authors:
# Davis V. Garrad <davis.last@psi.ch>
#
# *****************************************************************************
p90 = generate_pulse(2.5, 40, 50, '0 2 0 2 1 3 1 3 0 2 0 2 1 3 1 3')
p180_2 = generate_pulse(5, 40, 0.1, '1 3 3 1 2 0 0 2 0 2 2 0 3 1 1 3')
seq = [ p90, p180_2 ]
# Set some parameters independent of pulse sequence
globalparams = {
'acq_phase_cycle': '0 2 0 2 1 3 1 3 2 0 2 0 3 1 3 1',
'acquisition_time': 204.8, # us
'num_scans': 1024, # "1D scans" in TNMR. Our 16-fold phase cycling means this should be a multiple of 16 for proper averaging
'ringdown_time': 15, # us
'post_acquisition_time': 250, # ms
'obs_freq': 41.59, # MHz. Receiver frequency
'nucleus': 'NUCMgReS',
'comments': 'An example of a field sweep',
}
update_device_parameters(nmr_daq_scout, globalparams)
fields = [ 6.8 + i*1e-3 for i in range(2000) ]
print(timestring(estimate_scan_length(globalparams, seq)*len(fields)))
with tnmr_scan(): # Enters a mode of manual file control. Values will now be written into a single file until the context is lost
for field in fields:
maw(se_mf, field) # assuming se_mf controls the reader's external field strength (PPMS, etc.)
print_sequence(seq)
# Acquire data
scan_sequence(nmr_daq_scout, seq) # gather the data
+65
View File
@@ -0,0 +1,65 @@
# *****************************************************************************
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program 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 General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Module authors:
# Davis V. Garrad <davis.last@psi.ch>
# Tina Arh <tina.arh@psi.ch>
#
# *****************************************************************************
# Select the parameters that are written under environment in HDF file at every write
SetEnvironment(tt, mf, nmr_TSSOP16, nmr_RP100Node_CH1, nmr_RP100Node_CH2, r1, tps)#, ZVLNode)
# PPMS: Set field & temperature
#maw(tt, 3) # set PPMS temperature (in Kelvin)
#maw(mf, 3) # set the starting PPMS field (in Tesla)
#nicossleep(20*60) # 20 minutes
# ...
# Create the pulse sequence
pw90 = 2.5 # us
amp = 25 # percent
tau = 20 # us
# generate_pulse(pulse_width, amplitude, delay_time, pulse_cycle)
p180 = generate_pulse(2*pw90, amp, 1, '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0') # 180deg
p90 = generate_pulse(pw90, amp, tau, '0 2 0 2 1 3 1 3 0 2 0 2 1 3 1 3') # 90deg
p180_2 = generate_pulse(2*pw90, amp, 0, '1 3 3 1 2 0 0 2 0 2 2 0 3 1 1 3') # 180deg
seq = [ p180, p90, p180_2 ]
# Create the list of sequences to scan (specifically, for a T1 scan)
delay_times = log_durations(1, 600000, 20)
# generates a list of sequences; copies of seq are made, only the zeroth pulse is modified. Each copy is given a 'delay_time' value from delay_times
seq_list = generate_sequences(seq, [0], 'delay_time', delay_times)
# Set some parameters independent of pulse sequence
globalparams = {
'acq_phase_cycle': '0 2 0 2 1 3 1 3 2 0 2 0 3 1 3 1',
'acquisition_time': 204.8, # us
'num_acqs': 16000, # "1D scans" in TNMR. Our 16-fold phase cycling means this should be a multiple of 16 for proper averaging
'ringdown_time': 11, # us
'post_acquisition_time': 200, # ms
'obs_freq': 42.09, # MHz. Receiver frequency
'nucleus': 'NUCMgReS', # For example, 139La. Will be used in a filename!
'comments': 'An example of a T1 scan',
'title': 'T1', # Goes at the beginning of a filename!
}
update_device_parameters(nmr_daq_scout, globalparams)
# Acquire data
scan_sequences(nmr_daq_scout, seq_list) # gather the data
+75
View File
@@ -0,0 +1,75 @@
# *****************************************************************************
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program 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 General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Module authors:
# Davis V. Garrad <davis.last@psi.ch>
# Tina Arh <tina.arh@psi.ch>
#
# *****************************************************************************
# Select the parameters that are written under environment in HDF file at every write
SetEnvironment(tt, mf, nmr_TSSOP16, nmr_RP100Node_CH1, nmr_RP100Node_CH2, r1, tps)#, ZVLNode)
# PPMS: Set field & temperature
#maw(tt, 3) # set PPMS temperature (in Kelvin)
#maw(mf, 3) # set the starting PPMS field (in Tesla)
#nicossleep(20*60) # 20 minutes
# ...
# Create the pulse sequence
pw90 = 2.5 # us
amp = 40 # percent
tau = 50 # us
# generate_pulse(pulse_width, amplitude, delay_time, pulse_cycle)
p90 = generate_pulse(pw90, amp, tau, '0 0 2 2 1 1 3 3 0 0 2 2 1 1 3 3')
p180_2 = generate_pulse(2*pw90, amp, 0, '1 3 3 1 2 0 0 2 0 2 2 0 3 1 1 3')
seq = [ p90, p180_2 ]
# Create the list of sequences to scan (for a T2 scan, the delay after the first pulse - tau - increases linearly from tau_min to tau_max)
tau_min = 50 # us
tau_max = 20000 # us
n_points = 20
delay_times = [tau_min + i * (tau_max - tau_min) / (n_points - 1) for i in range(n_points)]
# Generates a list of sequences; copies of seq are made, only the zeroth pulse is modified. Each copy is given a 'delay_time' value from delay_times
seq_list = generate_sequences(seq, [0], 'delay_time', delay_times)
# We now modify the delay after the second pulse to be a fixed time shorter than tau, this means the spin echo will always appear at the same time after the start of acquisition
for i in range(len(seq_list)):
seq_list[i][1]['delay_time'] = max(seq_list[i][0]['delay_time'] - 20.0, 0.1)
# Set some parameters independent of pulse sequence
globalparams = {
'acq_phase_cycle': '0 0 2 2 1 1 3 3 2 2 0 0 3 3 1 1',
'acquisition_time': 204.8, # us
'num_acqs': 4096, # "1D scans" in TNMR. Our 16-fold phase cycling means this should be a multiple of 16 for proper averaging
'ringdown_time': 5, # us
'post_acquisition_time': 100, # ms
'obs_freq': 42.09, # MHz
'nucleus': '139La', # For example, 139La. Will be used in a filename!
'comments': 'An example of a T2 scan',
'title': 'T2', # Goes at the beginning of a filename!
}
update_device_parameters(nmr_daq_scout, globalparams)
# Acquire data
scan_sequences(nmr_daq_scout, seq_list) # gather the data
+59
View File
@@ -0,0 +1,59 @@
# *****************************************************************************
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program 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 General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Module authors:
# Tina Arh <tina.arh@psi.ch>
#
# *****************************************************************************
# Select the parameters that are written under environment in HDF file at every write
SetEnvironment(tt, mf, nmr_TSSOP16, nmr_RP100Node_CH1, nmr_RP100Node_CH2, r1, tps)#, ZVLNode)
# PPMS: Set field & temperature
#maw(mf, 7.05) # set PPMS field (in Tesla)
#maw(tt, 60) # set PPMS temperature (in Kelvin)
#nicossleep(5*60) # 5 minutes
# Create the pulse sequence
pw90 = 1 # us
amp = 40 # percent
tau = 25 # us
# generate_pulse(pulse_width, amplitude, delay_time, pulse_cycle)
p90 = generate_pulse(pw90, amp, tau, '0 0 2 2 1 1 3 3 0 0 2 2 1 1 3 3')
p180_2 = generate_pulse(2*pw90, amp, 0, '1 3 3 1 2 0 0 2 0 2 2 0 3 1 1 3')
seq = [ p90, p180_2 ]
# Set some parameters independent of pulse sequence
globalparams = {
'acq_phase_cycle': '0 0 2 2 1 1 3 3 2 2 0 0 3 3 1 1',
'acquisition_time': 204.8, # us
'num_acqs': 128, # "1D scans" in TNMR. Our 16-fold phase cycling means this should be a multiple of 16 for proper averaging
'ringdown_time': 15, # us
'post_acquisition_time': 100, # ms
'obs_freq': 42.09, # MHz
'nucleus': '139La', # For example, 139La. Will be used in a filename!
'comments': 'Cooling from 50 K to 25 K',
'title': 'cooldown', # Goes at the beginning of a filename!
}
update_device_parameters(nmr_daq_scout, globalparams)
with tnmr_scan(): # Enters a mode of manual file control. Values will now be written into a single file until the context is lost
for i in range(10000):
scan_sequence(nmr_daq_scout, seq) # Acquire data
+66
View File
@@ -0,0 +1,66 @@
# *****************************************************************************
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program 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 General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Module authors:
# Davis V. Garrad <davis.last@psi.ch>
# Tina Arh <tina.arh@psi.ch>
#
# *****************************************************************************
# Select the parameters that are written under environment in HDF file at every write
SetEnvironment(tt, mf, nmr_TSSOP16, nmr_RP100Node_CH1, nmr_RP100Node_CH2, r1, tps)#, ZVLNode)
# PPMS: Set field & temperature
#maw(tt, 3) # set PPMS temperature (in Kelvin)
#maw(mf, 3) # set the starting PPMS field (in Tesla)
#nicossleep(20*60) # 20 minutes
# ...
pw90 = 1 # us
amp = 40 # percent
tau = 20 # us
# generate_pulse(pulse_width, amplitude, delay_time, pulse_cycle)
p90 = generate_pulse(pw90, amp, tau, '0 0 2 2 1 1 3 3 0 0 2 2 1 1 3 3')
p180_2 = generate_pulse(2*pw90, amp, 0, '1 3 3 1 2 0 0 2 0 2 2 0 3 1 1 3')
seq = [ p90, p180_2 ]
# Set some parameters independent of pulse sequence
globalparams = {
'acq_phase_cycle': '0 0 2 2 1 1 3 3 2 2 0 0 3 3 1 1',
'acquisition_time': 204.8, # us
'num_acqs': 2048, # "1D scans" in TNMR. Our 16-fold phase cycling means this should be a multiple of 16 for proper averaging
'ringdown_time': 5, # us
'post_acquisition_time': 100, # ms
'obs_freq': 42.09, # MHz. Receiver frequency
'nucleus': 'NUCMgReS', # For example, 139La. Will be used in a filename!
'comments': 'An example of a field scan',
'title': 'Bscan', # Goes at the beginning of a filename!
}
update_device_parameters(nmr_daq_scout, globalparams)
fields = [ 6.95 + i*5e-2 for i in range(6) ]
# Estimate the length of scan and multiply by number of fields
print(f'Beginning scan. ETA: {timestring(estimate_sequence_length_from_device(nmr_daq_scout, seq)*len(fields))}')
with tnmr_scan(): # Enters a mode of manual file control. Values will now be written into a single file until the context is lost
for field in fields:
maw(mf, field) # assuming mf controls the reader's external field strength (PPMS, etc.)
scan_sequence(nmr_daq_scout, seq) # Acquire data
+76
View File
@@ -0,0 +1,76 @@
# *****************************************************************************
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program 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 General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Module authors:
# Tina Arh <tina.arh@psi.ch>
#
# *****************************************************************************
# Select the parameters that are written under environment in HDF file at every write
SetEnvironment(tt, mf, nmr_TSSOP16, nmr_RP100Node_CH1, nmr_RP100Node_CH2, r1, tps)#, ZVLNode)
# PPMS: Set field & temperature
#maw(tt, 3) # set PPMS temperature (in Kelvin)
#maw(mf, 3) # set the starting PPMS field (in Tesla)
#nicossleep(20*60) # 20 minutes
# ...
# Create the pulse sequence
pw90 = 2.5 # us
amp = 40 # percent
tau = 50 # us
# generate_pulse(pulse_width, amplitude, delay_time, pulse_cycle)
p90 = generate_pulse(pw90, amp, tau, '0 0 2 2 1 1 3 3 0 0 2 2 1 1 3 3')
p180_2 = generate_pulse(2*pw90, amp, 0, '1 3 3 1 2 0 0 2 0 2 2 0 3 1 1 3')
seq = [ p90, p180_2 ]
# Set some parameters independent of pulse sequence
globalparams = {
'acq_phase_cycle': '0 0 2 2 1 1 3 3 2 2 0 0 3 3 1 1',
'acquisition_time': 204.8, # us
'num_acqs': 16, # "1D scans" in TNMR. Our 16-fold phase cycling means this should be a multiple of 16 for proper averaging
'ringdown_time': 15, # us
'post_acquisition_time': 100, # ms
# 'obs_freq': 45.5, # MHz
'nucleus': 'NUCMgReS', # For example, 139La. Will be used in a filename!
'comments': 'An example of a frequency scan with manual tuning',
'title': 'FRscan', # Goes at the beginning of a filename!
}
update_device_parameters(nmr_daq_scout, globalparams)
# Choose the frequencies (in MHz)
central_frequency = 45.50 # MHz
frequency_range = 0.6 # MHz
half_N = 3
frequencies = [ central_frequency - frequency_range/2 + frequency_range * (i/(2*half_N)) for i in range(0, 2*half_N+1) ]
# Estimate the length of scan and multiply by number of frequencies
print(f'Beginning scan. ETA: {timestring(estimate_sequence_length_from_device(nmr_daq_scout, seq)*len(frequencies))}')
with tnmr_scan(): # Enters a mode of manual file control. Values will now be written into a single file until the context is lost
for fr in frequencies:
globalparams['obs_freq']=fr
update_device_parameters(nmr_daq_scout, globalparams)
# Pause to manually tune the frequency
print(f'New frequency: {fr:.2f} MHz')
pause(f'Tune the resonance circuit to {fr:.2f} MHz and click \'Continue script\' when you are done!')
scan_sequence(nmr_daq_scout, seq) # Acquire data