-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCorrDataSetAtt.m
3673 lines (3183 loc) · 181 KB
/
CorrDataSetAtt.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
classdef CorrDataSetAtt < handle
%
properties
Date
Folders
%useful experimental data
UNominal
LattServoV
ScienceFieldV
LattMonAt10V
%DataFolder classes
Ones
Threes
Singles
Doubles
%analysis settings
ExcludePictures
BinMode = 'spatial' %'spatial', 'density', or 'external'
%densities corrected for efficiencies.
OnesDensCorr
OnesDensCorrUnc
ThreesDensCorr
ThreesDensCorrUnc
SinglesDens
SinglesDensUnc
DoublesDensCorr
DoublesDensCorrUnc
%Correlators corrected for efficiencies
OnesCorr
OnesCorrUnc
ThreesCorr
ThreesCorrUnc
SinglesCorr
SinglesCorrUnc
DoublesCorr
DoublesCorrUnc
%physical constants
mLi = 9.9883e-27; %kg
h = 6.6261e-34; %J.s
hbar = 1.0546e-34; %J.s
kb = 1.3806e-23;
a = 1064e-9/sqrt(2); %m
%positions in terms of distance grid...
BinEdges
BinCenters
MeanBinDist
MeanBinDistUnc
%mean radial position of bin...
RadialPos
RadialPosUnc
%total filling
Filling_SandD
Filling_SandD_Unc
Filling_1and3
Filling_1and3_Unc
%Efficiencies
UseEfficiencies = 1
DetectionEff = 1
BlowDoublesEff13 = 0.93
RFAndBlowDoublesEff23 = 0.955
%chemical potentials
OmegaWeak
OmegaStrong
OmegaMean %(2pi)*490-500 Hz??
CloudAspectRatio
%
R_HalfFilling
ChemPot_0
Mu1MinusMu3
ChemPot
ChemPotUnc
%Other useful quantities
SinglesFrac
SinglesFracUnc
LocalPol
LocalPolUnc
GlobalPol
GlobalPolUnc
%Non-int FG quantities
InitFG = 0;
NonIntFG
%DQMC results
% DQMC2_Path = 'DQMC_T=0.5_Mu=-8to8_U=-6to-4.mat'
% DQMC2_Path = 'DQMC_T=0.5_Mu=-8to8_U=-8to-4.mat'
DQMC2_Path = 'DQMC_T=0.3-0.7_Mu=-8to8_U=-8to-4.mat'
DQMC2
end
methods
function obj = CorrDataSetAtt(DateCell,DataSets,ExcludePictures,BinEdges,AzAvgMode,DistGrid)
%constructor...
if exist('DateCell','var')
%if no arguments, instantiate class but do not run this code...
obj.initialize(DateCell,DataSets,ExcludePictures,BinEdges,AzAvgMode,DistGrid);
end
end
function initialize(obj,DateCell,DataSets,ExcludePictures,BinEdges,AzAvgMode,DistGrid)
try
obj.loadDQMC();
catch
fprintf('failed to load DQMC data \n');
end
if ~exist('AzAvgMode','var')
AzAvgMode = 'spatial';
end
obj.BinMode = AzAvgMode;
if ~exist('DistGrid','var')
DistGrid = 0;
end
obj.loadData(DateCell,DataSets,ExcludePictures,BinEdges,AzAvgMode,DistGrid)
%do analysis...i.e. get local pol and etc.
obj.doAnalysis();
end
function loadData(obj,DateCell,DataSets,ExcludePictures,BinEdges,AzAvgMode,DistGrid)
%obj = CorrDataSetAtt(DateCell,DataSets,ExcludePictures,BinEdges)
%%%Arguments
%DateCell = {Year Day Month}
%DataSets = [Doubles,Threes,Ones,Singles]
%Excluded files = {[],[],[],[]}
%BinEdges = []
%
obj.Date = DateCell;
obj.Folders = DataSets;
DataSetList = {DateCell,DateCell,DateCell,DateCell};
if length(DataSets)==4
for ii = 1:4
DataSetList{ii}{4} = DataSets(ii);
DataSetList{ii}{5} = 1;
DataSetList{ii}{6} = 1;
end
elseif length(DataSets)==2
%probably get rid of this case...too much trouble...
DataSetList{1} = {};
DataSetList{4} = {};
DataSetList{2}{4} = DataSets(1);
DataSetList{2}{5} = 1;
DataSetList{2}{6} = 1;
DataSetList{3}{4} = DataSets(2);
DataSetList{3}{5} = 1;
DataSetList{3}{6} = 1;
else
exception('Wrong number of datasets in CorrDatasetAtt.m')
end
if ~exist('ExcludePictures','var') || isempty(ExcludePictures)
ExcludePictures = {[],[],[],[]};
end
obj.ExcludePictures = ExcludePictures;
obj.BinEdges = BinEdges;
%import data sets
% obj.Ones = DataFolder(DataSetList{3},ExcludePictures{3},BinEdges,'density');
obj.Ones = DataFolder(DataSetList{3},ExcludePictures{3},BinEdges,obj.BinMode,DistGrid);
obj.CloudAspectRatio = obj.Ones.CloudAspectRatio;
DistGrid = obj.Ones.DistGrid;
obj.Doubles = DataFolder(DataSetList{1},ExcludePictures{1},BinEdges,'external',DistGrid);
obj.Singles = DataFolder(DataSetList{4},ExcludePictures{4},BinEdges,'external',DistGrid);
obj.Threes = DataFolder(DataSetList{2},ExcludePictures{2},BinEdges,'external',DistGrid);
obj.BinCenters = 0.5*(BinEdges(1:end-1)+BinEdges(2:end)); %can use the center of the bins
% obj.RadialPos = transpose(obj.Ones.BinDist);
% obj.RadialPosUnc = transpose(obj.Ones.BinDistUnc);
obj.RadialPos = transpose(obj.Ones.BinAvg);
obj.RadialPosUnc = transpose(obj.Ones.BinUnc);
obj.MeanBinDist = transpose(obj.Ones.BinAvg); %better to use the average distance of all points in the bin.
obj.MeanBinDistUnc = transpose(obj.Ones.BinUnc); %and its sdm
%transposes make same size as BinCenters...this because I
%replaced this variable for BinCenters in most functions,
%so they were expecting something that size. In general
%would prefer to use nx1 vector than 1xn.
%efficiencies
if ~obj.UseEfficiencies
obj.DetectionEff = 1;
obj.BlowDoublesEff13 = 1;
obj.RFAndBlowDoublesEff23 = 1;
end
%get densities corrected for efficiencies...should only uses
%these and not directly the Doubles,Ones,Threes,etc.
obj.SinglesDens = obj.Singles.Occs_AzAvg/obj.DetectionEff;
obj.SinglesDensUnc = obj.Singles.Occs_AzAvgUnc/obj.DetectionEff;
obj.DoublesDensCorr = obj.Doubles.Occs_AzAvg/obj.RFAndBlowDoublesEff23/obj.DetectionEff;
obj.DoublesDensCorrUnc = obj.Doubles.Occs_AzAvgUnc/obj.RFAndBlowDoublesEff23/obj.DetectionEff;
%1s(corrected for doubles eff) = 1s - Eff*Doubles+Eff*Doubles/Eff
%i.e. subtract the part we measure for doubles, correct it, and add it back
% = 1s + (1/Eff-1)*Eff*Doubles = 1s + (1/Eff-1)*(1s+3s-singles)/2
%As expected this reduces to the measured value if Eff = 1.
%Reason that I do this, instead of using measured doubles
%density is that that has a different efficiency due to
%RF/different doubles blowing.
obj.OnesDensCorr = obj.Ones.Occs_AzAvg/obj.DetectionEff + (1/obj.BlowDoublesEff13-1)*0.5*(obj.Ones.Occs_AzAvg+obj.Threes.Occs_AzAvg-obj.Singles.Occs_AzAvg)/obj.DetectionEff;
obj.OnesDensCorrUnc = obj.Ones.Occs_AzAvgUnc/obj.DetectionEff; %can also correct this with the above expression...
%same thing for threes.
obj.ThreesDensCorr = obj.Threes.Occs_AzAvg/obj.DetectionEff + (1/obj.BlowDoublesEff13-1)*0.5*(obj.Ones.Occs_AzAvg+obj.Threes.Occs_AzAvg-obj.Singles.Occs_AzAvg)/obj.DetectionEff;
obj.ThreesDensCorrUnc = obj.Threes.Occs_AzAvgUnc/obj.DetectionEff;
%get correlations and correct for efficiencies
obj.OnesCorr = obj.Ones.Density_Corr_AzAvg/obj.DetectionEff^2;
obj.OnesCorrUnc = obj.Ones.Density_Corr_AzAvgUnc/obj.DetectionEff^2;
obj.ThreesCorr = obj.Threes.Density_Corr_AzAvg/obj.DetectionEff^2;
obj.ThreesCorrUnc = obj.Threes.Density_Corr_AzAvgUnc/obj.DetectionEff^2;
obj.SinglesCorr = obj.Singles.Density_Corr_AzAvg/obj.DetectionEff^2;
obj.SinglesCorrUnc = obj.Singles.Density_Corr_AzAvgUnc/obj.DetectionEff^2;
obj.DoublesCorr = obj.Doubles.Density_Corr_AzAvg/obj.DetectionEff^2/obj.RFAndBlowDoublesEff23^2;
obj.DoublesCorrUnc = obj.Doubles.Density_Corr_AzAvgUnc/obj.DetectionEff^2/obj.RFAndBlowDoublesEff23^2;
end
function InitializeFG(obj)
tic;
obj.InitFG = 1;
%instantiate class.
obj.NonIntFG = NonIntFG(1);
InitT = toc;
fprintf('Took %0.2f s to initialize NonIntFG class \n',InitT);
end
function doAnalysis(obj)
obj.ChemPot = obj.RadialPos.^2;
obj.LocalPol = (obj.OnesDensCorr-obj.ThreesDensCorr)./(obj.OnesDensCorr+obj.ThreesDensCorr);
obj.LocalPolUnc = sqrt((2*obj.OnesDensCorr./(obj.ThreesDensCorr+obj.OnesDensCorr).^2.*obj.ThreesDensCorrUnc).^2+(2*obj.ThreesDensCorr./(obj.ThreesDensCorr+obj.OnesDensCorr).^2.*obj.OnesDensCorrUnc).^2);
obj.SinglesFrac = obj.SinglesDens./(obj.SinglesDens+2*obj.DoublesDensCorr);
obj.SinglesFracUnc = sqrt((2*obj.DoublesDensCorr./(obj.SinglesDens+2*obj.DoublesDensCorr).^2.*obj.SinglesDensUnc).^2+(2*obj.SinglesDens./(obj.SinglesDens+2*obj.DoublesDensCorr).^2.*obj.DoublesDensCorrUnc).^2);
obj.Filling_SandD = obj.SinglesDens+2*obj.DoublesDensCorr;
obj.Filling_SandD_Unc = sqrt((obj.SinglesDensUnc).^2+(2*obj.DoublesDensCorrUnc).^2);
obj.Filling_1and3 = obj.OnesDensCorr + obj.ThreesDensCorr;
obj.Filling_1and3_Unc = sqrt((obj.OnesDensCorrUnc).^2+(obj.ThreesDensCorrUnc).^2);
%can also correct these for efficiencies...
N1 = obj.Ones.MeanAtomNum;
N1_Unc = obj.Ones.AtomNumSD;
N3 = obj.Threes.MeanAtomNum;
N3_Unc = obj.Threes.AtomNumSD;
obj.GlobalPol = (obj.Ones.MeanAtomNum-obj.Threes.MeanAtomNum)/(obj.Ones.MeanAtomNum+obj.Threes.MeanAtomNum);
obj.GlobalPolUnc = sqrt((2*N1./(N3+N1).^2.*N3_Unc).^2+(2*N3./(N1+N3).^2.*N1_Unc).^2);
end
function Dstring = getDescriptionString(obj)
Dstring = sprintf('%d_%02d_%d_Folders=%03d-%03d_Pg=%0.2f',obj.Date{1},obj.Date{2},obj.Date{3},min(obj.Folders),max(obj.Folders),obj.GlobalPol);
end
function FitParams = fitNonIntLattice_Simultaneous(obj,tHz,InitParams,FixedParams)
%P = [Beta,Omega,Mu1,Mu2]
%Simultaneously fit two non-interacting lattice fermi gas
%profiles to the two spin components.
A = 1; %density correction factor...
t = obj.h*tHz;
%Generate guesses for parameters from single fits...
if ~exist('InitParams','var')
Fp1 = obj.Ones.fitNonIntLattice(tHz);
Beta1 = Fp1(1); Omega1 = Fp1(2); Mu1 = Fp1(3);
Fp2 = obj.Threes.fitNonIntLattice(tHz);
Beta2 = Fp2(1); Omega2 = Fp2(2); Mu2 = Fp2(3);
Beta = 0.5*(Beta1+Beta2); %units of t
Omega = 0.5*(Omega1+Omega2);
InitParams = [Beta,Omega,Mu1,Mu2];
end
if ~exist('FixedParams','var')
FixedParams = zeros(size(InitParams));
end
%Determine temperature, chemical potentials, and trapping
%frequency from fit.
%one trick to let me fix some parameters...
OnesDensity = @(P,X)latticeFGRadial1D([P(1),P(2),P(3),A],X);
ThreesDensity = @(P,X) latticeFGRadial1D([P(1),P(2),P(4),A],X);
%Maybe there is a better way to estimate the uncertainty of
%these points?
OnesUnc = transpose(obj.OnesDensCorrUnc);
OnesUnc(OnesUnc == 0 ) = 1;
ThreesUnc = transpose(obj.ThreesDensCorrUnc);
ThreesUnc(ThreesUnc == 0) = 1;
%
OnesFit = @(P) (OnesDensity(P,obj.RadialPos)-transpose(obj.OnesDensCorr))./OnesUnc;
ThreesFit = @(P) (ThreesDensity(P,obj.RadialPos)-transpose(obj.ThreesDensCorr))./ThreesUnc;
FitFn = @(P) [OnesFit(P.*(1-FixedParams)+InitParams.*FixedParams),ThreesFit(P.*(1-FixedParams)+InitParams.*FixedParams)];
FitParams = lsqnonlin(FitFn,InitParams);
OmegaMeanHz = FitParams(2)/sqrt(obj.mLi/abs(t))/obj.a;
OmegaWeak = OmegaMeanHz/sqrt(obj.CloudAspectRatio);
OmegaStrong = OmegaMeanHz*sqrt(obj.CloudAspectRatio);
T = 1/FitParams(1);
MuOnes = FitParams(3);
MuThrees = FitParams(4);
MuAvg = 0.5*(FitParams(3)+FitParams(4));
DeltaMu = 0.5*(FitParams(3)-FitParams(4));
%display results
fprintf('t = %0.2f Hz \n',tHz);
fprintf('T = %0.2f t = %0.2f nK \n',T,T*t/obj.kb/1e-9);
fprintf('Chemical potential is zero at half filling \n')
fprintf('Bandwidth in tight-binding model is 8t \n')
fprintf('Mu1 = %0.2f t = (2pi) %0.2f Hz \n',MuOnes,MuOnes*t/obj.h);
fprintf('Mu3 = %0.2f t = (2pi) %0.2f Hz \n',MuThrees,MuThrees*t/obj.h);
fprintf('MuAvg = %0.2f t = (2pi) %0.2f Hz \n',MuAvg,MuAvg*t/obj.h);
fprintf('DeltaMu = %0.2f t = (2pi) %0.2f Hz \n',DeltaMu,DeltaMu*t/obj.h);
fprintf('Omega = (2pi) %0.2f Hz \n',OmegaMeanHz/(2*pi));
fprintf('Omega Strong = (2pi) %0.2f Hz \n',OmegaStrong/(2*pi));
fprintf('Omega Weak = (2pi) %0.2f Hz \n \n',OmegaWeak/(2*pi));
RInterp = linspace(min(obj.RadialPos),max(obj.RadialPos),100);
%plot results
FigName = sprintf('Simultaneous Fit Non-Int Latt FG %03d-%03d, T = %0.2f t, Omega = (2pi) %0.0f Hz',min(obj.Folders),max(obj.Folders),T,OmegaMeanHz/(2*pi));
fh = figure('name',FigName);
subplot(2,2,1)
errorbar(obj.RadialPos,obj.OnesDensCorr,obj.OnesDensCorrUnc,'ro');
hold on;
plot(RInterp,OnesDensity(FitParams,RInterp),'b');
title(sprintf('Ones, Mu1 = %0.2f t',MuOnes));
grid on;
ylim([0,1])
subplot(2,2,2)
errorbar(obj.RadialPos,obj.ThreesDensCorr,obj.ThreesDensCorrUnc,'ro');
hold on;
plot(RInterp,ThreesDensity(FitParams,RInterp),'b');
title(sprintf('Threes, Mu3 = %0.2f t',MuThrees));
grid on;
ylim([0,1])
subplot(2,2,3)
errorbar(obj.RadialPos,obj.DoublesDensCorr,obj.DoublesDensCorrUnc,'ro');
hold on;
plot(RInterp,OnesDensity(FitParams,RInterp).*ThreesDensity(FitParams,RInterp),'b');
grid on;
title('Inferred Doubles Profile')
ylim([0,1])
subplot(2,2,4)
errorbar(obj.RadialPos,obj.SinglesDens,obj.SinglesDensUnc,'ro');
hold on;
plot(RInterp,OnesDensity(FitParams,RInterp)+ThreesDensity(FitParams,RInterp)-2*OnesDensity(FitParams,RInterp).*ThreesDensity(FitParams,RInterp),'b');
grid on;
title('Inferred Singles Profile')
ylim([0,2])
suptitle(FigName);
end
function FitParams = fitNonIntLattice_Simultaneous_TrapVariation(obj,tHz,InitParams,FixedParams)
%P = [Beta,Omega,Mu1,Mu2,Vo,tEr]
%Simultaneously fit two non-interacting lattice fermi gas
%profiles to the two spin components.
A = 1; %density correction factor...
t = obj.h*tHz;
%Generate guesses for parameters from single fits...
if ~exist('InitParams','var')
Fp1 = obj.Ones.fitNonIntLattice(tHz);
Beta1 = Fp1(1); Omega1 = Fp1(2); Mu1 = Fp1(3);
Fp2 = obj.Threes.fitNonIntLattice(tHz);
Beta2 = Fp2(1); Omega2 = Fp2(2); Mu2 = Fp2(3);
Beta = 0.5*(Beta1+Beta2); %units of t
Omega = 0.5*(Omega1+Omega2);
Vo = 120; %in t
tEr = tHz/14.66e3;
InitParams = [Beta,Omega,Mu1,Mu2,Vo,tEr];
end
if ~exist('FixedParams','var')
FixedParams = zeros(size(InitParams));
end
%Determine temperature, chemical potentials, and trapping
%frequency from fit.
%one trick to let me fix some parameters...
OnesDensity = @(P,X)latticeFGRadial_VaryingLatticeDepth1D([P(1),P(2),P(3),P(5),P(6),A],X);
ThreesDensity = @(P,X) latticeFGRadial_VaryingLatticeDepth1D([P(1),P(2),P(4),P(5),P(6),A],X);
%Maybe there is a better way to estimate the uncertainty of
%these points?
OnesUnc = transpose(obj.OnesDensCorrUnc);
OnesUnc(OnesUnc == 0 ) = 1;
ThreesUnc = transpose(obj.ThreesDensCorrUnc);
ThreesUnc(ThreesUnc == 0) = 1;
%
OnesFit = @(P) (OnesDensity(P,obj.RadialPos)-transpose(obj.OnesDensCorr))./OnesUnc;
ThreesFit = @(P) (ThreesDensity(P,obj.RadialPos)-transpose(obj.ThreesDensCorr))./ThreesUnc;
FitFn = @(P) [OnesFit(P.*(1-FixedParams)+InitParams.*FixedParams),ThreesFit(P.*(1-FixedParams)+InitParams.*FixedParams)];
FitParams = lsqnonlin(FitFn,InitParams);
OmegaMeanHz = FitParams(2)/sqrt(obj.mLi/abs(t))/obj.a;
OmegaWeak = OmegaMeanHz/sqrt(obj.CloudAspectRatio);
OmegaStrong = OmegaMeanHz*sqrt(obj.CloudAspectRatio);
T = 1/FitParams(1);
MuOnes = FitParams(3);
MuThrees = FitParams(4);
MuAvg = 0.5*(FitParams(3)+FitParams(4));
DeltaMu = 0.5*(FitParams(3)-FitParams(4));
Vo = FitParams(5);
tEr = FitParams(6);
%display results
fprintf('t = %0.2f Hz \n',tHz);
fprintf('T = %0.2f t = %0.2f nK \n',T,T*t/obj.kb/1e-9);
fprintf('Chemical potential is zero at half filling \n')
fprintf('Bandwidth in tight-binding model is 8t \n')
fprintf('Mu1 = %0.2f t = (2pi) %0.2f Hz \n',MuOnes,MuOnes*t/obj.h);
fprintf('Mu3 = %0.2f t = (2pi) %0.2f Hz \n',MuThrees,MuThrees*t/obj.h);
fprintf('MuAvg = %0.2f t = (2pi) %0.2f Hz \n',MuAvg,MuAvg*t/obj.h);
fprintf('DeltaMu = %0.2f t = (2pi) %0.2f Hz \n',DeltaMu,DeltaMu*t/obj.h);
fprintf('Omega = (2pi) %0.2f Hz \n',OmegaMeanHz/(2*pi));
fprintf('Omega Strong = (2pi) %0.2f Hz \n',OmegaStrong/(2*pi));
fprintf('Omega Weak = (2pi) %0.2f Hz \n',OmegaWeak/(2*pi));
fprintf('Central Lattice Depth = %0.2f t = %0.2f Er \n',Vo,Vo*tEr);
fprintf('Central Hopping t = %0.2f Er = %0.2f Hz \n \n',tEr,tEr*14.66e3);
RInterp = linspace(min(obj.RadialPos),max(obj.RadialPos),100);
%plot results
FigName = sprintf('Simultaneous Fit Non-Int Latt FG %03d-%03d, T = %0.2f t, Omega = (2pi) %0.0f Hz',min(obj.Folders),max(obj.Folders),T,OmegaMeanHz/(2*pi));
fh = figure('name',FigName);
subplot(2,2,1)
errorbar(obj.RadialPos,obj.OnesDensCorr,obj.OnesDensCorrUnc,'ro');
hold on;
plot(RInterp,OnesDensity(FitParams,RInterp),'b');
title(sprintf('Ones, Mu1 = %0.2f t',MuOnes));
grid on;
ylim([0,1])
subplot(2,2,2)
errorbar(obj.RadialPos,obj.ThreesDensCorr,obj.ThreesDensCorrUnc,'ro');
hold on;
plot(RInterp,ThreesDensity(FitParams,RInterp),'b');
title(sprintf('Threes, Mu3 = %0.2f t',MuThrees));
grid on;
ylim([0,1])
subplot(2,2,3)
errorbar(obj.RadialPos,obj.DoublesDensCorr,obj.DoublesDensCorrUnc,'ro');
hold on;
plot(RInterp,OnesDensity(FitParams,RInterp).*ThreesDensity(FitParams,RInterp),'b');
grid on;
title('Inferred Doubles Profile')
ylim([0,1])
subplot(2,2,4)
errorbar(obj.RadialPos,obj.SinglesDens,obj.SinglesDensUnc,'ro');
hold on;
plot(RInterp,OnesDensity(FitParams,RInterp)+ThreesDensity(FitParams,RInterp)-2*OnesDensity(FitParams,RInterp).*ThreesDensity(FitParams,RInterp),'b');
grid on;
title('Inferred Singles Profile')
ylim([0,2])
suptitle(FigName);
end
function FitParams = fitNonIntLattice_AndCorr_Simultaneous(obj,tHz,InitParams,FixedParams)
%P = [Beta,Omega,Mu1,Mu2]
%Simultaneously fit two non-interacting lattice fermi gas
%profiles to the two spin components.
A = 1; %density correction factor...
t = obj.h*tHz;
%Generate guesses for parameters from single fits...
if ~exist('InitParams','var')
Fp1 = obj.Ones.fitNonIntLattice(tHz);
Beta1 = Fp1(1); Omega1 = Fp1(2); Mu1 = Fp1(3);
Fp2 = obj.Threes.fitNonIntLattice(tHz);
Beta2 = Fp2(1); Omega2 = Fp2(2); Mu2 = Fp2(3);
Beta = 0.5*(Beta1+Beta2); %units of t
Omega = 0.5*(Omega1+Omega2);
InitParams = [Beta,Omega,Mu1,Mu2];
end
if ~exist('FixedParams','var')
FixedParams = zeros(size(InitParams));
end
%Determine temperature, chemical potentials, and trapping
%frequency from fit.
%one trick to let me fix some parameters...
OnesDensity = @(P,X)latticeFGRadial1D([P(1),P(2),P(3),A],X);
ThreesDensity = @(P,X) latticeFGRadial1D([P(1),P(2),P(4),A],X);
OnesCorr = @(P,X) latticeFGRadial_NNCorr1D([P(1),P(2),P(3),A^2],X);
ThreesCorr = @(P,X) latticeFGRadial_NNCorr1D([P(1),P(2),P(4),A^2],X);
%Maybe there is a better way to estimate the uncertainty of
%these points?
OnesDensUnc = transpose(obj.OnesDensCorrUnc);
OnesDensUnc(OnesDensUnc == 0 ) = 1;
ThreesDensUnc = transpose(obj.ThreesDensCorrUnc);
ThreesDensUnc(ThreesDensUnc == 0) = 1;
%correlator uncertainties
OnesCorrUnc = squeeze(obj.OnesCorrUnc(obj.Ones.CenterIndex_CorrMatrix+0,obj.Ones.CenterIndex_CorrMatrix+1,:));
OnesCorrUnc(OnesCorrUnc == 0) = 1;
ThreesCorrUnc = squeeze(obj.ThreesCorrUnc(obj.Threes.CenterIndex_CorrMatrix+0,obj.Threes.CenterIndex_CorrMatrix+1,:));
ThreesCorrUnc(ThreesCorrUnc == 0) = 1;
%correlators
OnesCorrExp = squeeze(obj.OnesCorr(obj.Ones.CenterIndex_CorrMatrix+0,obj.Ones.CenterIndex_CorrMatrix+1,:));
ThreesCorrExp = squeeze(obj.ThreesCorr(obj.Threes.CenterIndex_CorrMatrix+0,obj.Threes.CenterIndex_CorrMatrix+1,:));
%
OnesDensFit = @(P) (OnesDensity(P,obj.RadialPos)-transpose(obj.OnesDensCorr))./OnesDensUnc;
ThreesDensFit = @(P) (ThreesDensity(P,obj.RadialPos)-transpose(obj.ThreesDensCorr))./ThreesDensUnc;
OnesCorrFit = @(P) (OnesCorr(P,obj.RadialPos) - transpose(OnesCorrExp))./OnesDensUnc;
ThreesCorrFit = @(P) (ThreesCorr(P,obj.RadialPos) - transpose(ThreesCorrExp))./ThreesDensUnc;
DensWeight = 1;
CorrWeight = 1; %1/0.04;
FitFn = @(P) [DensWeight*OnesDensFit(P.*(1-FixedParams)+InitParams.*FixedParams),DensWeight*ThreesDensFit(P.*(1-FixedParams)+InitParams.*FixedParams),CorrWeight*OnesCorrFit(P.*(1-FixedParams)+InitParams.*FixedParams),CorrWeight*ThreesCorrFit(P.*(1-FixedParams)+InitParams.*FixedParams)];
FitParams = lsqnonlin(FitFn,InitParams);
OmegaMeanHz = FitParams(2)/sqrt(obj.mLi/abs(t))/obj.a;
OmegaWeak = OmegaMeanHz/sqrt(obj.CloudAspectRatio);
OmegaStrong = OmegaMeanHz*sqrt(obj.CloudAspectRatio);
T = 1/FitParams(1);
MuOnes = FitParams(3);
MuThrees = FitParams(4);
MuAvg = 0.5*(FitParams(3)+FitParams(4));
DeltaMu = 0.5*(FitParams(3)-FitParams(4));
%display results
fprintf('t = %0.2f Hz \n',tHz);
fprintf('T = %0.2f t = %0.2f nK \n',T,T*t/obj.kb/1e-9);
fprintf('Chemical potential is zero at half filling \n')
fprintf('Bandwidth in tight-binding model is 8t \n')
fprintf('Mu1 = %0.2f t = (2pi) %0.2f Hz \n',MuOnes,MuOnes*t/obj.h);
fprintf('Mu3 = %0.2f t = (2pi) %0.2f Hz \n',MuThrees,MuThrees*t/obj.h);
fprintf('MuAvg = %0.2f t = (2pi) %0.2f Hz \n',MuAvg,MuAvg*t/obj.h);
fprintf('DeltaMu = %0.2f t = (2pi) %0.2f Hz \n',DeltaMu,DeltaMu*t/obj.h);
fprintf('Omega = (2pi) %0.2f Hz \n',OmegaMeanHz/(2*pi));
fprintf('Omega Strong = (2pi) %0.2f Hz \n',OmegaStrong/(2*pi));
fprintf('Omega Weak = (2pi) %0.2f Hz \n \n',OmegaWeak/(2*pi));
RInterp = linspace(min(obj.RadialPos),max(obj.RadialPos),100);
%plot results
FigName = sprintf('Simultaneous Fit Non-Int Latt FG %03d-%03d, T = %0.2f t, Omega = (2pi) %0.0f Hz',min(obj.Folders),max(obj.Folders),T,OmegaMeanHz/(2*pi));
fh = figure('name',FigName);
NRows = 2;
NCols = 4;
subplot(NRows,NCols,1)
errorbar(obj.RadialPos,obj.OnesDensCorr,obj.OnesDensCorrUnc,'ro');
hold on;
plot(RInterp,OnesDensity(FitParams,RInterp),'b');
title(sprintf('Ones, Mu1 = %0.2f t',MuOnes));
grid on;
ylim([0,1])
subplot(NRows,NCols,2)
errorbar(obj.RadialPos,obj.ThreesDensCorr,obj.ThreesDensCorrUnc,'ro');
hold on;
plot(RInterp,ThreesDensity(FitParams,RInterp),'b');
title(sprintf('Threes, Mu3 = %0.2f t',MuThrees));
grid on;
ylim([0,1])
subplot(NRows,NCols,5)
errorbar(obj.RadialPos,obj.DoublesDensCorr,obj.DoublesDensCorrUnc,'ro');
hold on;
plot(RInterp,OnesDensity(FitParams,RInterp).*ThreesDensity(FitParams,RInterp),'b');
grid on;
title('Inferred Doubles Profile')
ylim([0,1])
subplot(NRows,NCols,6)
errorbar(obj.RadialPos,obj.SinglesDens,obj.SinglesDensUnc,'ro');
hold on;
plot(RInterp,OnesDensity(FitParams,RInterp)+ThreesDensity(FitParams,RInterp)-2*OnesDensity(FitParams,RInterp).*ThreesDensity(FitParams,RInterp),'b');
grid on;
title('Inferred Singles Profile')
ylim([0,2])
%correlators.
subplot(NRows,NCols,3)
errorbar(obj.RadialPos,OnesCorrExp,OnesCorrUnc,'ro');
hold on;
plot(RInterp,OnesCorr(FitParams,RInterp),'b');
ylim([-0.05,0])
title('Ones, NN Corr');
grid on;
subplot(NRows,NCols,4)
errorbar(obj.RadialPos,ThreesCorrExp,ThreesCorrUnc,'ro');
hold on;
plot(RInterp,ThreesCorr(FitParams,RInterp),'b');
title('Threes, NN Corr');
ylim([-0.05,0])
grid on;
subplot(NRows,NCols,7)
DoublesCorr = squeeze(obj.DoublesCorr(obj.Doubles.CenterIndex_CorrMatrix+0,obj.Doubles.CenterIndex_CorrMatrix+1,:));
DoublesCorrUnc = squeeze(obj.DoublesCorrUnc(obj.Doubles.CenterIndex_CorrMatrix+0,obj.Doubles.CenterIndex_CorrMatrix+1,:));
errorbar(obj.RadialPos,DoublesCorr,DoublesCorrUnc,'ro')
hold on;
%some combinatorial Wick's thrm manipulation leads to...
%<d_i d_j>_c = n_up^2*<n_up_i n_up_j>_c + n_down^2*<n_down_i n_down_j>_c + n_down^2*n_up^2
DoublesCorrInferred = OnesCorr(FitParams,RInterp).*ThreesDensity(FitParams,RInterp).^2 + ThreesCorr(FitParams,RInterp).*OnesDensity(FitParams,RInterp).^2 + OnesCorr(FitParams,RInterp).*ThreesCorr(FitParams,RInterp);
plot(RInterp,DoublesCorrInferred);
title('Inferred Doubles Correlator')
grid on;
subplot(NRows,NCols,8)
SinglesCorr = squeeze(obj.SinglesCorr(obj.Singles.CenterIndex_CorrMatrix+0,obj.Singles.CenterIndex_CorrMatrix+1,:));
SinglesCorrUnc = squeeze(obj.SinglesCorrUnc(obj.Singles.CenterIndex_CorrMatrix+0,obj.Singles.CenterIndex_CorrMatrix+1,:));
errorbar(obj.RadialPos,SinglesCorr,SinglesCorrUnc,'ro');
hold on;
%This correlator is even worse combinatorally...
%<(n_i_up + n_i_down - 2*n_i_up*n_i_down)(n_j_up +n_j_down- 2*n_j_up*n_j_down>_c
% = <n_i_up n_j_up>_c + <n_i_down n_j_down>_c + 4<d_i d_j> ...
% + <n_i_up n_j_down>_c + <n_i_down n_j_up>_c ...
% - 2*<(n_i_up + n_i_down) d_j>_c - 2*<d_i (n_j_up + n_j_down)>_c
%We already have the first line...our measured correlators
%and the doubles. The second line vanishes for
%non-interacting particles.
%We can evaluate the <n_i_up d_j> term using Wick's theorem.
%Conveniently, only one term contributes ...
%<n_i_up d_j> = - <c^dag_i_up c_j_up><c^dag_j_upc_i_up><c^dag_j_down c_j_down> ...
% = <n_i_up n_j_up>_c <n_down>
%where this last identity comes from using Wick's theorem
%in reverse...i.e. we already found this term when we were
%calculating the density correlations for a single
%species.
SinglesCorrInferred = OnesCorr(FitParams,RInterp)+ThreesCorr(FitParams,RInterp) + 4*DoublesCorrInferred -4*ThreesCorr(FitParams,RInterp).*OnesDensity(FitParams,RInterp) - 4*OnesCorr(FitParams,RInterp).*ThreesDensity(FitParams,RInterp);
plot(RInterp,SinglesCorrInferred);
grid on;
title('Inferred Singles Correlator');
suptitle(FigName);
end
function FitParams = fitNonIntLattice_AndCorr_Simultaneous_TrapVariation(obj,tHz,InitParams,FixedParams)
%P = [Beta,Omega,Mu1,Mu2]
%Simultaneously fit two non-interacting lattice fermi gas
%profiles to the two spin components.
A = 1; %density correction factor...
t = obj.h*tHz;
%Generate guesses for parameters from single fits...
if ~exist('InitParams','var')
Fp1 = obj.Ones.fitNonIntLattice(tHz);
Beta1 = Fp1(1); Omega1 = Fp1(2); Mu1 = Fp1(3);
Fp2 = obj.Threes.fitNonIntLattice(tHz);
Beta2 = Fp2(1); Omega2 = Fp2(2); Mu2 = Fp2(3);
Beta = 0.5*(Beta1+Beta2); %units of t
Omega = 0.5*(Omega1+Omega2);
Vo = 120; %in t
tEr = tHz/14.66e3;
InitParams = [Beta,Omega,Mu1,Mu2,Vo,tEr];
end
if ~exist('FixedParams','var')
FixedParams = zeros(size(InitParams));
end
%Determine temperature, chemical potentials, and trapping
%frequency from fit.
%one trick to let me fix some parameters...
OnesDensity = @(P,X)latticeFGRadial_VaryingLatticeDepth1D([P(1),P(2),P(3),P(5),P(6),A],X);
ThreesDensity = @(P,X) latticeFGRadial_VaryingLatticeDepth1D([P(1),P(2),P(4),P(5),P(6),A],X);
OnesCorr = @(P,X) latticeFGRadial_NNCorr_VaryingLatticeDepth1D([P(1),P(2),P(3),P(5),P(6),A^2],X);
ThreesCorr = @(P,X) latticeFGRadial_NNCorr_VaryingLatticeDepth1D([P(1),P(2),P(4),P(5),P(6),A^2],X);
%Maybe there is a better way to estimate the uncertainty of
%these points?
OnesDensUnc = transpose(obj.OnesDensCorrUnc);
OnesDensUnc(OnesDensUnc == 0 ) = 1;
ThreesDensUnc = transpose(obj.ThreesDensCorrUnc);
ThreesDensUnc(ThreesDensUnc == 0) = 1;
%correlator uncertainties
OnesCorrUnc = squeeze(obj.OnesCorrUnc(obj.Ones.CenterIndex_CorrMatrix+0,obj.Ones.CenterIndex_CorrMatrix+1,:));
OnesCorrUnc(OnesCorrUnc == 0) = 1;
ThreesCorrUnc = squeeze(obj.ThreesCorrUnc(obj.Threes.CenterIndex_CorrMatrix+0,obj.Threes.CenterIndex_CorrMatrix+1,:));
ThreesCorrUnc(ThreesCorrUnc == 0) = 1;
%correlators
OnesCorrExp = squeeze(obj.OnesCorr(obj.Ones.CenterIndex_CorrMatrix+0,obj.Ones.CenterIndex_CorrMatrix+1,:));
ThreesCorrExp = squeeze(obj.ThreesCorr(obj.Threes.CenterIndex_CorrMatrix+0,obj.Threes.CenterIndex_CorrMatrix+1,:));
%
OnesDensFit = @(P) (OnesDensity(P,obj.RadialPos)-transpose(obj.OnesDensCorr))./OnesDensUnc;
ThreesDensFit = @(P) (ThreesDensity(P,obj.RadialPos)-transpose(obj.ThreesDensCorr))./ThreesDensUnc;
OnesCorrFit = @(P) (OnesCorr(P,obj.RadialPos) - transpose(OnesCorrExp))./OnesDensUnc;
ThreesCorrFit = @(P) (ThreesCorr(P,obj.RadialPos) - transpose(ThreesCorrExp))./ThreesDensUnc;
DensWeight = 1;
CorrWeight = 1; %1/0.04;
FitFn = @(P) [DensWeight*OnesDensFit(P.*(1-FixedParams)+InitParams.*FixedParams),DensWeight*ThreesDensFit(P.*(1-FixedParams)+InitParams.*FixedParams),CorrWeight*OnesCorrFit(P.*(1-FixedParams)+InitParams.*FixedParams),CorrWeight*ThreesCorrFit(P.*(1-FixedParams)+InitParams.*FixedParams)];
FitParams = lsqnonlin(FitFn,InitParams);
OmegaMeanHz = FitParams(2)/sqrt(obj.mLi/abs(t))/obj.a;
OmegaWeak = OmegaMeanHz/sqrt(obj.CloudAspectRatio);
OmegaStrong = OmegaMeanHz*sqrt(obj.CloudAspectRatio);
T = 1/FitParams(1);
MuOnes = FitParams(3);
MuThrees = FitParams(4);
MuAvg = 0.5*(FitParams(3)+FitParams(4));
DeltaMu = 0.5*(FitParams(3)-FitParams(4));
Vo = FitParams(5);
tEr = FitParams(6);
%display results
fprintf('t = %0.2f Hz \n',tHz);
fprintf('T = %0.2f t = %0.2f nK \n',T,T*t/obj.kb/1e-9);
fprintf('Chemical potential is zero at half filling \n')
fprintf('Bandwidth in tight-binding model is 8t \n')
fprintf('Mu1 = %0.2f t = (2pi) %0.2f Hz \n',MuOnes,MuOnes*t/obj.h);
fprintf('Mu3 = %0.2f t = (2pi) %0.2f Hz \n',MuThrees,MuThrees*t/obj.h);
fprintf('MuAvg = %0.2f t = (2pi) %0.2f Hz \n',MuAvg,MuAvg*t/obj.h);
fprintf('DeltaMu = %0.2f t = (2pi) %0.2f Hz \n',DeltaMu,DeltaMu*t/obj.h);
fprintf('Omega = (2pi) %0.2f Hz \n',OmegaMeanHz/(2*pi));
fprintf('Omega Strong = (2pi) %0.2f Hz \n',OmegaStrong/(2*pi));
fprintf('Omega Weak = (2pi) %0.2f Hz \n',OmegaWeak/(2*pi));
fprintf('Central Lattice Depth = %0.2f t = %0.2f Er \n',Vo,Vo*tEr);
fprintf('Central Hopping t = %0.2f Er = %0.2f Hz \n \n',tEr,tEr*14.66e3);
RInterp = linspace(min(obj.RadialPos),max(obj.RadialPos),100);
%plot results
FigName = sprintf('Simultaneous Fit Non-Int Latt FG %03d-%03d, T = %0.2f t, Omega = (2pi) %0.0f Hz',min(obj.Folders),max(obj.Folders),T,OmegaMeanHz/(2*pi));
fh = figure('name',FigName);
NRows = 2;
NCols = 4;
subplot(NRows,NCols,1)
errorbar(obj.RadialPos,obj.OnesDensCorr,obj.OnesDensCorrUnc,'ro');
hold on;
plot(RInterp,OnesDensity(FitParams,RInterp),'b');
title(sprintf('Ones, Mu1 = %0.2f t',MuOnes));
grid on;
ylim([0,1])
subplot(NRows,NCols,2)
errorbar(obj.RadialPos,obj.ThreesDensCorr,obj.ThreesDensCorrUnc,'ro');
hold on;
plot(RInterp,ThreesDensity(FitParams,RInterp),'b');
title(sprintf('Threes, Mu3 = %0.2f t',MuThrees));
grid on;
ylim([0,1])
subplot(NRows,NCols,5)
errorbar(obj.RadialPos,obj.DoublesDensCorr,obj.DoublesDensCorrUnc,'ro');
hold on;
plot(RInterp,OnesDensity(FitParams,RInterp).*ThreesDensity(FitParams,RInterp),'b');
grid on;
title('Inferred Doubles Profile')
ylim([0,1])
subplot(NRows,NCols,6)
errorbar(obj.RadialPos,obj.SinglesDens,obj.SinglesDensUnc,'ro');
hold on;
plot(RInterp,OnesDensity(FitParams,RInterp)+ThreesDensity(FitParams,RInterp)-2*OnesDensity(FitParams,RInterp).*ThreesDensity(FitParams,RInterp),'b');
grid on;
title('Inferred Singles Profile')
ylim([0,2])
%correlators.
subplot(NRows,NCols,3)
errorbar(obj.RadialPos,OnesCorrExp,OnesCorrUnc,'ro');
hold on;
plot(RInterp,OnesCorr(FitParams,RInterp),'b');
ylim([-0.05,0])
title('Ones, NN Corr');
grid on;
subplot(NRows,NCols,4)
errorbar(obj.RadialPos,ThreesCorrExp,ThreesCorrUnc,'ro');
hold on;
plot(RInterp,ThreesCorr(FitParams,RInterp),'b');
title('Threes, NN Corr');
ylim([-0.05,0])
grid on;
subplot(NRows,NCols,7)
DoublesCorr = squeeze(obj.DoublesCorr(obj.Doubles.CenterIndex_CorrMatrix+0,obj.Doubles.CenterIndex_CorrMatrix+1,:));
DoublesCorrUnc = squeeze(obj.DoublesCorrUnc(obj.Doubles.CenterIndex_CorrMatrix+0,obj.Doubles.CenterIndex_CorrMatrix+1,:));
errorbar(obj.RadialPos,DoublesCorr,DoublesCorrUnc,'ro')
hold on;
%some combinatorial Wick's thrm manipulation leads to...
%<d_i d_j>_c = n_up^2*<n_up_i n_up_j>_c + n_down^2*<n_down_i n_down_j>_c + n_down^2*n_up^2
DoublesCorrInferred = OnesCorr(FitParams,RInterp).*ThreesDensity(FitParams,RInterp).^2 + ThreesCorr(FitParams,RInterp).*OnesDensity(FitParams,RInterp).^2 + OnesCorr(FitParams,RInterp).*ThreesCorr(FitParams,RInterp);
plot(RInterp,DoublesCorrInferred);
title('Inferred Doubles Correlator')
grid on;
subplot(NRows,NCols,8)
SinglesCorr = squeeze(obj.SinglesCorr(obj.Singles.CenterIndex_CorrMatrix+0,obj.Singles.CenterIndex_CorrMatrix+1,:));
SinglesCorrUnc = squeeze(obj.SinglesCorrUnc(obj.Singles.CenterIndex_CorrMatrix+0,obj.Singles.CenterIndex_CorrMatrix+1,:));
errorbar(obj.RadialPos,SinglesCorr,SinglesCorrUnc,'ro');
hold on;
%This correlator is even worse combinatorally...
SinglesCorrInferred = OnesCorr(FitParams,RInterp)+ThreesCorr(FitParams,RInterp) + 4*DoublesCorrInferred -4*ThreesCorr(FitParams,RInterp).*OnesDensity(FitParams,RInterp) - 4*OnesCorr(FitParams,RInterp).*ThreesDensity(FitParams,RInterp);
plot(RInterp,SinglesCorrInferred);
grid on;
title('Inferred Singles Correlator');
suptitle(FigName);
end
function showNonIntLattice_Inferred(obj)
%show inferred values for singles and doubles density and
%correlators for a non-interacting gas, using the measured values
%of ones and threes density and correlators.
%correlator uncertainties
OnesCorrUnc = squeeze(obj.OnesCorrUnc(obj.Ones.CenterIndex_CorrMatrix+0,obj.Ones.CenterIndex_CorrMatrix+1,:));
OnesCorrUnc(OnesCorrUnc == 0) = 1;
ThreesCorrUnc = squeeze(obj.ThreesCorrUnc(obj.Threes.CenterIndex_CorrMatrix+0,obj.Threes.CenterIndex_CorrMatrix+1,:));
ThreesCorrUnc(ThreesCorrUnc == 0) = 1;
%correlators
OnesCorrExp = squeeze(obj.OnesCorr(obj.Ones.CenterIndex_CorrMatrix+0,obj.Ones.CenterIndex_CorrMatrix+1,:));
ThreesCorrExp = squeeze(obj.ThreesCorr(obj.Threes.CenterIndex_CorrMatrix+0,obj.Threes.CenterIndex_CorrMatrix+1,:));
OnesDensity = @(X) interp1(obj.RadialPos,obj.OnesDensCorr,X);
ThreesDensity = @(X) interp1(obj.RadialPos,obj.ThreesDensCorr,X);
OnesCorr = @(X) interp1(obj.RadialPos,OnesCorrExp,X);
ThreesCorr = @(X) interp1(obj.RadialPos,ThreesCorrExp,X);
RInterp = linspace(min(obj.RadialPos),max(obj.RadialPos),100);
%plot results
FigName = sprintf('Non-Int Latt Inferred Doubles and Singles, FG %03d-%03d',min(obj.Folders),max(obj.Folders));
FigHandle = figure('name',FigName);
NRows = 2;
NCols = 4;
subplot(NRows,NCols,1)
errorbar(obj.RadialPos,obj.OnesDensCorr,obj.OnesDensCorrUnc,'ro');
title(sprintf('Ones'));
grid on;
ylim([0,1])
subplot(NRows,NCols,2)
errorbar(obj.RadialPos,obj.ThreesDensCorr,obj.ThreesDensCorrUnc,'ro');
title(sprintf('Threes'));
grid on;
ylim([0,1])
subplot(NRows,NCols,5)
errorbar(obj.RadialPos,obj.DoublesDensCorr,obj.DoublesDensCorrUnc,'ro');
hold on;
plot(RInterp,OnesDensity(RInterp).*ThreesDensity(RInterp),'b');
grid on;
title('Inferred Doubles Profile')
ylim([0,1])
subplot(NRows,NCols,6)
errorbar(obj.RadialPos,obj.SinglesDens,obj.SinglesDensUnc,'ro');
hold on;
plot(RInterp,OnesDensity(RInterp)+ThreesDensity(RInterp)-2*OnesDensity(RInterp).*ThreesDensity(RInterp),'b');
grid on;
title('Inferred Singles Profile')
ylim([0,2])
%correlators.
subplot(NRows,NCols,3)
errorbar(obj.RadialPos,OnesCorrExp,OnesCorrUnc,'ro');
ylim([-0.05,0])
title('Ones, NN Corr');
grid on;
subplot(NRows,NCols,4)
errorbar(obj.RadialPos,ThreesCorrExp,ThreesCorrUnc,'ro');
title('Threes, NN Corr');
ylim([-0.05,0])
grid on;
subplot(NRows,NCols,7)
DoublesCorr = squeeze(obj.DoublesCorr(obj.Doubles.CenterIndex_CorrMatrix+0,obj.Doubles.CenterIndex_CorrMatrix+1,:));
DoublesCorrUnc = squeeze(obj.DoublesCorrUnc(obj.Doubles.CenterIndex_CorrMatrix+0,obj.Doubles.CenterIndex_CorrMatrix+1,:));
errorbar(obj.RadialPos,DoublesCorr,DoublesCorrUnc,'ro')
hold on;
%some combinatorial Wick's thrm manipulation leads to...
%<d_i d_j>_c = n_up^2*<n_up_i n_up_j>_c + n_down^2*<n_down_i n_down_j>_c + n_down^2*n_up^2
DoublesCorrInferred = OnesCorr(RInterp).*ThreesDensity(RInterp).^2 + ThreesCorr(RInterp).*OnesDensity(RInterp).^2 + OnesCorr(RInterp).*ThreesCorr(RInterp);
plot(RInterp,DoublesCorrInferred);
title('Inferred Doubles Correlator')
grid on;
subplot(NRows,NCols,8)
SinglesCorr = squeeze(obj.SinglesCorr(obj.Singles.CenterIndex_CorrMatrix+0,obj.Singles.CenterIndex_CorrMatrix+1,:));
SinglesCorrUnc = squeeze(obj.SinglesCorrUnc(obj.Singles.CenterIndex_CorrMatrix+0,obj.Singles.CenterIndex_CorrMatrix+1,:));
errorbar(obj.RadialPos,SinglesCorr,SinglesCorrUnc,'ro');
hold on;
%see fitNonIntLattice_AndCorr_Simultaneous fn for
%explanation of this correlator...
SinglesCorrInferred = OnesCorr(RInterp)+ThreesCorr(RInterp) + 4*DoublesCorrInferred -4*ThreesCorr(RInterp).*OnesDensity(RInterp) - 4*OnesCorr(RInterp).*ThreesDensity(RInterp);
plot(RInterp,SinglesCorrInferred);
grid on;
title('Inferred Singles Correlator');
suptitle(FigName);
end
function FitParams = fitNonIntLattice_AndCorr_NoTrap(obj,InitParams,FixedParams)
%FitParams = fitNonIntLattice_AndCorr_NoTrap(obj,InitParams,FixedParams)
%FitParams = [DeltaMu,T]
%use class instance of NonIntFG to fit this.
if ~exist('InitParams','var')
InitParams = [2,0.3];
end
if ~exist('FixedParams','var')
FixedParams = zeros(size(InitParams));
end
if ~obj.InitFG
obj.NonIntFG = NonIntFG(1);
end
%experimental quantities...
Density = 0.5*(obj.Filling_1and3+obj.Filling_SandD);
LocalPol = obj.LocalPol;
SpinDiffExp = obj.OnesDensCorr-obj.ThreesDensCorr;
SpinDiffUnc = sqrt((obj.OnesDensCorrUnc).^2+(obj.ThreesDensCorrUnc).^2);
SpinDiffUnc(isnan(SpinDiffUnc)) = 1;
SpinDiffUnc(SpinDiffUnc == 0) = 1;
LocalPol(isnan(LocalPol)) = 1;
PolUnc = obj.LocalPolUnc;
PolUnc(isnan(PolUnc)) = 1;
PolUnc(PolUnc == 0 ) = 1;
OnesCorrUnc = squeeze(obj.OnesCorrUnc(obj.Ones.CenterIndex_CorrMatrix+0,obj.Ones.CenterIndex_CorrMatrix+1,:));
OnesCorrUnc(OnesCorrUnc == 0) = 1;
ThreesCorrUnc = squeeze(obj.ThreesCorrUnc(obj.Threes.CenterIndex_CorrMatrix+0,obj.Threes.CenterIndex_CorrMatrix+1,:));
ThreesCorrUnc(ThreesCorrUnc == 0) = 1;
DoublesCorrUnc = squeeze(obj.DoublesCorrUnc(obj.Doubles.CenterIndex_CorrMatrix+0,obj.Doubles.CenterIndex_CorrMatrix+1,:));
SinglesCorrUnc = squeeze(obj.SinglesCorrUnc(obj.Singles.CenterIndex_CorrMatrix+0,obj.Singles.CenterIndex_CorrMatrix+1,:));
%correlators
OnesCorrExp = squeeze(obj.OnesCorr(obj.Ones.CenterIndex_CorrMatrix+0,obj.Ones.CenterIndex_CorrMatrix+1,:));
ThreesCorrExp = squeeze(obj.ThreesCorr(obj.Threes.CenterIndex_CorrMatrix+0,obj.Threes.CenterIndex_CorrMatrix+1,:));
DoublesCorrExp = squeeze(obj.DoublesCorr(obj.Doubles.CenterIndex_CorrMatrix+0,obj.Doubles.CenterIndex_CorrMatrix+1,:));
SinglesCorrExp = squeeze(obj.SinglesCorr(obj.Singles.CenterIndex_CorrMatrix+0,obj.Singles.CenterIndex_CorrMatrix+1,:));
%initial approach turned out to be quite slow.
% %non int fermi gas matrices...
% [ns,delmus,Ts,Pols,Corr1s,Corr2s,SpinDiff] = obj.generateNonIntData();
%
% %make functions from these matrices...will fit to these.
% %note that these functions require all three arguments be the
% %same size...so you can't have one be vectorized and the other
% %two be singles.
% %couldn't figure out a way to get rid of Nans in anonymous
% %functions...so added some ugly fns to class.
% pfn = @(n,dmu,T) obj.nonIntFg_PolFn(ns,delmus,Ts,Pols,n,dmu,T);
% SpinDiffFn = @(n,dmu,T) obj.nonIntFg_SpinDiffFn(ns,delmus,Ts,SpinDiff,n,dmu,T);
% C1fn = @(n,dmu,T) obj.nonIntFg_CorrFn(ns,delmus,Ts,Corr1s,n,dmu,T);
% C2fn = @(n,dmu,T) obj.nonIntFg_CorrFn(ns,delmus,Ts,Corr2s,n,dmu,T);
pfn = @(n,dmu,T) obj.NonIntFG.pfn_n_dmu_T(n,dmu,T);
SpinDiffFn = @(n,dmu,T) obj.NonIntFG.n1fn_n_dmu_T(n,dmu,T)-obj.NonIntFG.n2fn_n_dmu_T(n,dmu,T);
C1fn = @(n,dmu,T) obj.NonIntFG.c1fn_n_dmu_T(n,dmu,T);
C2fn = @(n,dmu,T) obj.NonIntFG.c2fn_n_dmu_T(n,dmu,T);
%correct here...
Pfit = @(P)(LocalPol - pfn(Density,P(1)*ones(size(Density)),P(2)*ones(size(Density))))./PolUnc;
Difffit = @(P) (SpinDiffExp - SpinDiffFn(Density,P(1)*ones(size(Density)),P(2)*ones(size(Density))))./SpinDiffUnc;
C1fit = @(P)(OnesCorrExp-C1fn(Density,P(1)*ones(size(Density)),P(2)*ones(size(Density))))./OnesCorrUnc;
C3fit = @(P)(ThreesCorrExp-C2fn(Density,P(1)*ones(size(Density)),P(2)*ones(size(Density))))./ThreesCorrUnc;
FitFn = @(P) [Difffit(P.*(1-FixedParams)+InitParams.*FixedParams),C1fit(P.*(1-FixedParams)+InitParams.*FixedParams),C3fit(P.*(1-FixedParams)+InitParams.*FixedParams)];
FitParams = lsqnonlin(FitFn,InitParams);
FigHandle = figure('name','Non-Int Gas Fit, No Trap')
NRows = 2;
NCols = 3;
subplot(NRows,NCols,1)
errorbar(Density,SpinDiffExp,SpinDiffUnc,'r-o');
hold on;
DensInterp = linspace(min(Density),max(Density),300);