Commit b0ccb329 authored by myron's avatar myron
Browse files

Merge branch 'alessandro_develop' of /home/aless/src/XRStools into alessandro_develop

parents 6ded318c ae368178
This diff is collapsed.
......@@ -377,7 +377,7 @@ def Fista( data , solution , s2d, d2s, solution_shape , parallel = 0 , ni
if myrank==0:
print( indent+"CALCULATING LIPSCHITZ FACTOR ")
for i in range(100):
for i in range(10):
calculate_grad(grad2,None ,grad , s2d, d2s, solution_shape , parallel = parallel , beta=beta)
Lip = math.sqrt( np.linalg.norm(grad2/100000) )*100000
grad[:] = grad2/ Lip
......@@ -725,8 +725,11 @@ def get_spots_list( filename , groupname , filter_rois =1 ):
xscales = {}
enescan = None
tmp_list = list(filterRoiList(list(h5[groupname].keys())))
tmp_list = sorted(tmp_list, key = int )
for sn in filterRoiList(list(h5[groupname].keys())):
for sn in tmp_list:
print( groupname+"/"+sn+"/matrix")
m = h5[groupname+"/"+sn+"/matrix"][:]
......@@ -740,7 +743,7 @@ def get_spots_list( filename , groupname , filter_rois =1 ):
if groupname+"/motorDict/energy" in h5:
enescan = h5[groupname+"/motorDict/energy"].value
enescan = h5[groupname+"/motorDict/energy"][()]
if m.shape!=(0,):
......@@ -876,7 +879,7 @@ def DOFIT(filename=None, groupname=None, nref=5, niter_optical=500, beta_optical
O_spots_list, nomi_rois, stats, origini_foil, rois, xscales, energy = get_spots_list( filename, groupname, filter_rois= filter_rois )
stats = np.array(stats)
if do_refine_trajectory ==2:
h5f = h5py.File(trajectory_reference_scansequence_filename,"r")
......@@ -1010,7 +1013,6 @@ def DOFIT(filename=None, groupname=None, nref=5, niter_optical=500, beta_optical
print( nomi_rois)
print( O_spots_list)
for iterm, (O_spots, name, ROI ) in enumerate(zip(O_spots_list, nomi_rois, rois)):
if (iterm)%nprocs == myrank:
# print " MYRANK %d fa "%myrank, iterm
......@@ -1196,10 +1198,10 @@ def reload_trajectories(trajectory_file, nomi_rois) : ### , trajectory_file_grou
for iterm, name in enumerate( nomi_rois[:]):
h5group = h5[name]
trajectory = Trajectory()
trajectory.X.intercept = h5group["Xintercept"].value
trajectory.X.slope = h5group["Xslope"].value
trajectory.Y.intercept = h5group["Yintercept"].value
trajectory.Y.slope = h5group["Yslope"].value
trajectory.X.intercept = h5group["Xintercept"][()]
trajectory.X.slope = h5group["Xslope"][()]
trajectory.Y.intercept = h5group["Yintercept"][()]
trajectory.Y.slope = h5group["Yslope"][()]
# trajectory.N = O_spots.shape[0]
trajectory_list.append( trajectory )
return trajectory_list
......@@ -1231,7 +1233,6 @@ def DOROIS(filename = "../nonregressions/demo_imaging.hdf5" , groupname = "ROI_B
for iterm, (O_spots, name) in enumerate(zip(O_spots_list[:], nomi_rois[:])):
if (iterm)%nprocs == myrank:
if myrank ==0 :
......@@ -1241,11 +1242,11 @@ def DOROIS(filename = "../nonregressions/demo_imaging.hdf5" , groupname = "ROI_B
print( name, "data")
solution = h5group["data"][:]
trajectory = Trajectory()
trajectory.X.intercept = h5group["Xintercept"].value
trajectory.X.slope = h5group["Xslope"].value
trajectory.Y.intercept = h5group["Yintercept"].value
trajectory.Y.slope = h5group["Yslope"].value
nref = h5group["nref"].value
trajectory.X.intercept = h5group["Xintercept"][()]
trajectory.X.slope = h5group["Xslope"][()]
trajectory.Y.intercept = h5group["Yintercept"][()]
trajectory.Y.slope = h5group["Yslope"][()]
nref = h5group["nref"][()]
trajectory.N = O_spots.shape[0]
if recenterings is not None:
......@@ -1261,7 +1262,7 @@ def DOROIS(filename = "../nonregressions/demo_imaging.hdf5" , groupname = "ROI_B
trajectory.Y.intercept += -recy
if "line" in h5group:
trajectory.line = h5group["line"].value
trajectory.line = h5group["line"][()]
lh,lslope =trajectory.line
lh = lh-recy + recx*lslope
trajectory.line = np.array([lh,lslope])
......@@ -1307,10 +1308,12 @@ def DOROIS(filename = "../nonregressions/demo_imaging.hdf5" , groupname = "ROI_B
h5f = h5py.File(filename,"r")
# imagealldect = h5f [roisgroupname+ "/rois_definition/image"][:]
print( filename)
print( roisgroupname+ "/image" )
imagealldect = h5f [roisgroupname+ "/image"][:]
# h5 = h5f [roisgroupname+ ("/rois_definition/rois_dict/ROI%02d"%int(name)) ]
h5 = h5f [roisgroupname+ ("/ROI%02d"%int(name)) ]
h5 = h5f [roisgroupname+ ("/rois_dict/ROI%02d"%int(name)) ]
mask = h5["mask" ][:]
origin = h5["origin"][:]
h5f.close()
......@@ -1427,7 +1430,15 @@ def DOROIS(filename = "../nonregressions/demo_imaging.hdf5" , groupname = "ROI_B
h5.require_group( str(name) )
h5 = h5 [str(name) ]
for i in range(len(newspots)):
newspots[i] = newspots[i]/newspots[i].sum()
h5["matrix"] = newspots
h5["Xintercept"] =trajectory.X.intercept
h5["Yintercept"] =trajectory.Y.intercept
h5["Xslope"] =trajectory.X.slope
......
This diff is collapsed.
#E (eV) f2
1000 3.2583814624
1038 3.1025391596
1076 2.9581928816
1114 2.8263869557
1152 2.7040254385
1190 2.589421271
1228 16.7700031606
1266 16.4270766261
1304 16.1056775273
1342 15.7993841026
1380 15.5078036632
1418 15.2301471301
1456 14.9562400855
1494 14.6416441004
1532 14.1542157155
1570 13.6796917811
1608 13.2333669076
1646 12.8099241905
1684 12.4111511496
1722 12.0317365647
1760 11.6543195752
1798 11.2929184185
1836 10.9439900333
1874 10.6151714487
1912 10.301806625
1950 10.0029361078
1988 9.718426484
2026 9.4541065214
2064 9.1877776163
2102 8.9337532141
2140 8.6881704252
2178 8.4543962281
2216 8.2265554045
2254 8.0134746138
2292 7.8020935222
2330 7.6021090893
2368 7.4103129877
2406 7.2245451527
2444 7.0458084424
2482 6.8736104511
2520 6.7071187723
2558 6.5481245455
2596 6.3944045771
2634 6.2459933716
2672 6.1014542137
2710 5.9623706831
2748 5.8294444446
2786 5.6989528267
2824 5.5752347046
2862 5.45334597
2900 5.3366855369
2938 5.2243825577
2976 5.1139843854
3014 5.0075584567
3052 4.9060319014
3090 4.806106945
3128 4.7090962483
3166 4.6165572444
3204 4.5268228404
3242 4.4374080027
3280 4.3493523913
3318 4.2688667741
3356 4.1895609865
3394 4.1118242763
3432 4.0358780387
3470 3.9618287367
3508 3.8897054283
3546 3.8194860783
3584 3.7511158543
3622 3.6845197613
3660 3.6196113051
3698 3.5586050132
3736 3.4966365686
3774 3.438104612
3812 3.3806531032
3850 3.3242296476
3888 3.2687806383
3926 3.2158311908
3964 3.1635796642
4002 3.1119959359
4040 3.0623958012
4078 3.0141683396
4116 2.9670496383
4154 2.9209321015
4192 2.875944764
4230 2.8320829395
4268 2.78913152
4306 2.7473017419
4344 2.7063876426
4382 2.6663943002
4420 2.6273237644
4458 2.5891758792
4496 2.5517817234
4534 2.5152348968
4572 2.4795382119
4610 2.4445404981
4648 2.4104040697
4686 2.3769839935
4724 2.3442205558
4762 2.3121974712
4800 2.2808560207
4838 2.2501430366
4876 2.2200744961
4914 2.1906023614
4952 2.1617444794
4990 2.1334572454
5028 2.1057008288
5066 2.0785550489
5104 2.0519231337
5142 2.0258839566
5180 2.0002908213
5218 1.9752243574
5256 1.9505466812
5294 1.9263921822
5332 1.9027320836
5370 1.8795398339
5408 1.8567403536
5446 1.8344126632
5484 1.8124352148
5522 1.7908876018
5560 1.7697017707
5598 1.7489083996
5636 1.7285372701
5674 1.7084776567
5712 1.6888082591
5750 1.6695137498
5788 1.650489347
5826 1.6318138525
5864 1.6134747265
5902 1.5954602565
5940 1.5777594947
5978 1.5603622011
6016 1.543215716
6054 1.5263975244
6092 1.5098558204
6130 1.4935827227
6168 1.4775708409
6206 1.4618549097
6244 1.4463448439
6282 1.4311176498
6320 1.4161669249
6358 1.401405176
6396 1.3869091148
6434 1.3726330893
6472 1.3585325338
6510 1.3446838288
6548 1.3310427497
6586 1.3176056644
6624 1.3044086704
6662 1.2914087823
6700 1.2786422517
6738 1.2660277373
6776 1.2536020031
6814 1.2414014678
6852 1.2293460826
6890 1.217434088
6928 1.2057408664
6966 1.1941874628
7004 1.1828491247
7042 1.1716475485
7080 1.1605815508
7118 1.149726196
7156 1.1390040238
7194 1.1284141311
7232 1.1179935667
7270 1.1077035834
7308 1.0975812712
7346 1.0875881646
7384 1.0777237379
7422 1.0680251438
7460 1.0584167066
7498 1.0489732789
7536 1.0396569658
7574 1.0304675417
7612 1.0213673876
7650 1.0124312954
7688 1.0035843178
7726 0.9948638636
7764 0.9862699419
7802 0.9777652545
7840 0.9693872702
7878 0.9610987866
7916 0.9529373177
7954 0.9448657426
7992 0.9369216274
8030 0.9290679194
8068 0.9213049152
8106 0.9136329336
8144 0.9060523156
8182 0.8986007744
8220 0.8912040025
8258 0.8839371218
8296 0.8767258172
8334 0.8696078951
8372 0.8625838178
8410 0.8556540667
8448 0.8488191414
8486 0.8420420602
8524 0.8353232798
8562 0.8287008181
8600 0.8221752357
8638 0.8157094961
8676 0.8093417424
8714 0.8030349003
8752 0.7967894859
8790 0.7906437752
8828 0.7845606228
8866 0.7785405709
8904 0.7725841691
8942 0.7666919742
8980 0.7609025065
9018 0.755140469
9056 0.7494443533
9094 0.7438147447
9132 0.7382903769
9170 0.732757426
9208 0.7273309219
9246 0.7219733372
9284 0.7166469481
9322 0.7113906191
9360 0.7061665298
9398 0.701052165
9436 0.6959326467
9474 0.6909241426
9512 0.685911445
9550 0.6810110722
9588 0.6761074761
9626 0.6712786788
9664 0.6665253533
9702 0.6618091977
9740 0.6571307081
9778 0.6524903821
9816 0.6479278922
9854 0.6434046971
9892 0.6389213013
9930 0.6344782114
9968 0.6300759355
10006 0.6257149835
10044 0.6214354446
10082 0.6171587471
10120 0.612964633
10158 0.6087742546
10196 0.6046277787
10234 0.6005656603
10272 0.5965086284
10310 0.5924970694
10348 0.5884913556
10386 0.5845722513
10424 0.5806599019
10462 0.5768353755
10500 0.5729780615
10538 0.5692096401
10576 0.5654902682
10614 0.5617391026
10652 0.5580785238
10690 0.5544276118
10728 0.5508276015
10766 0.5472790386
10804 0.5437002892
10842 0.5402149318
10880 0.5367412531
10918 0.5333208955
10956 0.5298715744
10994 0.5265178532
11032 0.5231773665
11070 0.5198504208
11108 3.9168186775
11146 3.8967199049
11184 3.8766998492
11222 3.8568610496
11260 3.8370949735
11298 3.8176070271
11336 3.7982883783
11374 3.7791353151
11412 3.7600420356
11450 3.7412100238
11488 3.7224319953
11526 3.7037062055
11564 3.6851311553
11602 3.6668034718
11640 3.6486195078
11678 3.6303788082
11716 3.612277987
11754 3.5944122013
11792 3.576680033
11830 3.5590789378
11868 3.5414131865
11906 3.523971505
11944 3.5066545081
11982 3.4894599288
12020 3.472480622
12058 3.4554293005
12096 3.438589055
12134 3.4218628296
12172 3.4052486807
12210 3.3888379739
12248 3.3723491257
12286 3.3560601146
12324 3.3398759658
12362 3.3237950065
12400 3.3078156128
12438 3.2919362079
12476 3.2762462734
12514 3.260562001
12552 3.2449732603
12590 3.2295687939
12628 3.2142565374
12666 3.1990351825
12704 3.1838141265
12742 3.1688601273
12780 3.1539039909
12818 3.1391224455
12856 3.1243369823
12894 3.109635314
12932 3.0951042084
12970 3.0807419297
13008 3.0663720313
13046 3.052081382
13084 3.0379559806
13122 3.0238208059
13160 3.0098486474
13198 2.9959517043
13236 2.9822152603
13274 2.9684660735
13312 2.9547896739
13350 2.9412708342
13388 2.9278228998
13426 2.9145303318
13464 2.9012219081
13502 2.8879823098
13540 2.8748955349
13578 2.8618759573
13616 2.8489229664
13654 2.8361201359
13692 2.8233824095
13730 2.8106253752
13768 2.7980163663
13806 2.7855544145
13844 2.7730717403
13882 2.7607348455
13920 2.7484596959
13958 2.7362458354
13996 2.7240928215
14034 2.7120002244
14072 2.700050256
14110 2.6881596374
14148 2.6763279832
14186 2.6645549194
14224 2.6529222419
14262 2.6412651704
14300 2.6297475748
14338 2.6183688071
14376 2.6069647832
14414 2.5956171393
14452 2.5843255819
14490 2.57317126
14528 2.562072277
14566 2.5510283734
14604 2.5400392984
14642 2.5291858826
14680 2.5183056616
14718 2.5075604748
14756 2.4968690383
14794 2.4862311479
14832 2.4756466076
14870 2.4651152284
14908 2.4547173538
14946 2.4442916889
14984 2.4339990501
15022 2.4237587577
15060 2.413570663
15098 2.4034346242
15136 2.3933505056
15174 2.3833181779
15212 2.3734175364
15250 2.3635683355
15288 2.3536905577
15326 2.343943976
15364 2.3342485317
15402 2.3246041352
15440 2.3150107026
15478 2.3054681553
15516 2.29597642
15554 2.2865354284
15592 2.2771451173
15630 2.2678849356
15668 2.2585957786
15706 2.2494365784
15744 2.2402483871
15782 2.2311900048
15820 2.2221819662
15858 2.2131449366
15896 2.2042375399
15934 2.1953011674
15972 2.1864943382
16010 2.1777377636
16048 2.1690314389
16086 2.1603753635
16124 2.1516904002
16162 2.1431348558
16200 2.1346295811
16238 2.1261745911
16276 2.1177699046
16314 2.109415544
16352 2.1010324877
16390 2.0927788716
16428 2.0844966433
16466 2.0763439
16504 2.068162637
16542 2.0601109224
16580 2.0521097868
16618 2.0440802874
16656 2.0361014772
16694 2.0281734098
16732 2.0202961418
16770 2.0125487183
16808 2.0047732327
16846 1.9970487367
16884 1.9892963081
16922 1.9816739977
16960 1.9741028927
16998 1.9665040649
17036 1.9590356008
17074 1.9515395632
17112 1.9440950422
17150 1.9367021247
17188 1.9293609003
17226 1.9220714612
17264 1.9147548283
17302 1.9075692346
17340 1.9003566168
17378 1.8931961498
17416 1.8860879366
17454 1.8790320829
17492 1.8720286972
17530 1.864998704
17568 1.85810057
17606 1.8511760171
17644 1.844304348
17682 1.8374856809
17720 1.8306408449
17758 1.8238492083
17796 1.8171108942
17834 1.8104260283
17872 1.8037947387
17910 1.7971377396
17948 1.7906139686
17986 1.7840646999
18024 1.7774899848
18062 1.7710489305
18100 1.7645826466
18138 1.7581707721
18176 1.7518134489
18214 1.745510821
18252 1.739183348
18290 1.7329107977
18328 1.7266135646
18366 1.7204512716
18404 1.7142645279
18442 1.7081332398
18480 1.7020575622
18518 1.6959577172
18556 1.6899137221
18594 1.6839257359
18632 1.6779138693
18670 1.6719582555
18708 1.6660590578
18746 1.6601362697
18784 1.6542701462
18822 1.6484608543
18860 1.6426282656
18898 1.6369331024
18936 1.6311345134
18974 1.625473694
19012 1.619790004
19050 1.6140834836
19088 1.6085153022
19126 1.6029245525
19164 1.5973919328
19202 1.5918369163
19240 1.5863402964
19278 1.5808214514
19316 1.5753612712
19354 1.5699599402
19392 1.5645366919
19430 1.5591725655
19468 1.5538677491
19506 1.5485413262
19544 1.5432744904
19582 1.5379862223
19620 1.5327578201
19658 1.5275894776
19696 1.522400018
19734 1.5172709013
19772 1.5121208429
19810 1.5070314123
19848 1.5019212158
19886 1.496871934
19924 1.4918837678
19962 1.4868751565
20000 1.4819279519
This diff is collapsed.