@@ -961,23 +961,19 @@ def __init__(self, correction, repetition, signal):
961
961
self .popt = None
962
962
self .pcov = None
963
963
964
- def fit_func (self , repetition , eps0 , N1 , * args ):
964
+ def fit_func (self , repetition , eps0 , N1 , A , B ):
965
965
"""
966
966
Fitting Function for Pulse Train experiment.
967
967
"""
968
-
969
968
N = len (repetition ) // self .n_correction
970
-
971
- A = args [:self .n_correction ]
972
- B = args [self .n_correction :]
973
969
974
970
decay = [np .exp (- repetition [(i * N ):((i + 1 ) * N )] / N1 )
975
971
for i in range (self .n_correction )]
976
972
oscillation = [np .cos (np .pi * (1 + eps0 ) *
977
973
(1 + self .correction [i ]) *
978
974
(2 * repetition [(i * N ):((i + 1 ) * N )] + 0.5 ))
979
975
for i in range (self .n_correction )]
980
- return np .hstack ([A [ i ] * decay [i ] * oscillation [i ] + B [ i ]
976
+ return np .hstack ([A * decay [i ] * oscillation [i ] + B
981
977
for i in range (self .n_correction )])
982
978
983
979
def _guess_init_params (self ):
@@ -995,8 +991,7 @@ def _guess_init_params(self):
995
991
996
992
zero_idx = np .argmin (np .var (self .signal , axis = - 1 ))
997
993
998
- self .p0 = [- self .correction [zero_idx ],
999
- N1 , * ([A0 ] * self .n_correction ), * ([B0 ] * self .n_correction )]
994
+ self .p0 = [- self .correction [zero_idx ], N1 , A0 , B0 ]
1000
995
1001
996
def analyze (self , p0 = None , plot = True , ** kwargs ):
1002
997
"""
0 commit comments