Closed Ifefu closed 3 years ago
Ive had a quick look at this, and it seems the NMRCPMGParameter
is exactly a copy of the NMRParameter
except for the change in the pulse sequence. I believe since the analysis and everything else is identical, you should be able to do something like this:
nmr_cpmg_parameter = NMRParameter('NMR_CPMG')
nmr_cpmg_parameter.NMR = self.pulse_sequence.NMR
nmr_cpmg_parameter.ESR = nmr_cpmg_parameter.pulse_sequence.ESR
nmr_cpmg_parameter.pre_pulses = nmr_cpmg_parameter.pulse_sequence.pulse_settings['pre_pulses']
nmr_cpmg_parameter.pre_ESR_pulses = nmr_cpmg_parameter.pulse_sequence.pulse_settings['pre_ESR_pulses']
nmr_cpmg_parameter.post_pulses = nmr_cpmg_parameter.pulse_sequence.pulse_settings['post_pulses']
Or if you really want to define a new class you can inherit most of this from the NMRParameter
.
class NMRCPMGParameter(NMRParameter):
def __init__(self, name: str = 'NMR_CPMG',
names: List[str] = ['flips', 'flip_probability',
'up_proportions', 'state_probability',
'threshold_up_proportion'],
**kwargs):
"""
Parameter used to determine the Rabi frequency
"""
super().__init__(name=name,
names=names,
snapshot_value=False,
properties_attrs=['t_read', 't_skip',
'threshold_up_proportion'],
**kwargs)
self.pulse_sequence = NMRCPMGPulseSequence()
self.NMR = self.pulse_sequence.NMR
self.ESR = self.pulse_sequence.ESR
self.pre_pulses = self.pulse_sequence.pulse_settings['pre_pulses']
self.pre_ESR_pulses = self.pulse_sequence.pulse_settings['pre_ESR_pulses']
self.post_pulses = self.pulse_sequence.pulse_settings['post_pulses']
The change of pulse sequence has to happen after the init though, otherwise it will be overwritten by the default NMRPulseSequence
.
Could you try this variation out and see if it works the same way?
Created a parameter for the existing NMRCPMGPulseSequence, which was not yet implemented. This parameter takes care of the differences in the inter delay times between pi/2 and pi pulses in a CPMG sequence. Please note that this NMPRCPMGParameter can be used as a NMRRamseyParameter by setting the number of pi pulses to 0.