tjlane / pypad

Intuitive, high-level interface to the CSPAD
Other
2 stars 1 forks source link

lies! #23

Closed dermen closed 11 years ago

dermen commented 11 years ago
Then, you should be able to turn those mysterious parameters into a CSPad
geometry by doing something like this:
>>> geom = CSPad.from_dir('my_params', run=0)
>>> assembled_image = geom(raw_image)
>>> imshow(assembled_image)

where is this from_dir method ?

tjlane commented 11 years ago

Shoot this doc is old. Where did you find it?

Right now pypad doesn't interface w/psana at all any more. I don't really see any reason you'd need to read them in -- just use a metrology from confluence as your starting point. Writing would be nice, but without more help from Mikhael I can't be sure the output is correct. Mikhael did say he could give us a script to turn basis grids into psana params, so if you want that we should bug him again and put it into pypad.

dermen commented 11 years ago

k, ill check one out - found it on the main repos CSPad class doc string.. anyhow, I will check confluence for a metrology... Does the CSPad metrology need to be optimized first ? ? I am guessing so..

tjlane commented 11 years ago

cool I found it -- will update that doc string. If you spot anything else confusing let us know (or even just push doc updates).

So the metrology has no info about the relative quad positions. Pypad tries to put that information back in by lining up the powder rings. Check out Jonas' tutorial on the first page.

Also, I have a pretty good geometry for our Jan expt if you want it. Check out ~tjlane/metrologies on psexport.

dermen commented 11 years ago

cool, I am working on reading the new detector xtc... will just download the latest metrology from the confluence and give ti a try..

tjlane commented 11 years ago

Ya give it a shot. Jonas and I are going to implement a few improvements soon that will hopefully make the optimization faster and more robust. Any comments you have about the interface would be great to hear.

dermen commented 11 years ago

SoI tried loading a shot from the new detector.. Does this look right? Here is what I get by doing the following:

Download the latest metrology on confluence ( CXI1-Metrolgy-Feldkamp.xlsx ) and save to a file called 'first.cspad' with

1   x1_0   y1_0   z1_0
2
.
.
32  x32_0   y32_0   z32_0
1   x1_1   y1_1   z1_1
2
.
.
32  x32_1   y32_1   z32_1
.
.
.
1   x1_3   y1_3   z1_3
2
.
.
32  x32_3   y32_3   z32_3

Then I do

In [179]: geom = pypad.cspad.CSPad('first.cspad')
Loading metrology from: first.cspad

Parsing: quad 0

Parsing: quad 1

Parsing: quad 2
WARNING: Metrology quality control failed for 2x1: 6
--> s/f vectors are not orthogonal :: enforcing orthogonality!
    Angle: 0.167938 // tol: 0.148000
WARNING: Metrology quality control failed for 2x1: 7
--> s/f vectors are not orthogonal :: enforcing orthogonality!
    Angle: -1.487239 // tol: 0.148000

Parsing: quad 3
WARNING: Metrology quality control failed for 2x1: 5
--> s/f vectors are not orthogonal :: enforcing orthogonality!
    Angle: -0.265418 // tol: 0.148000

In [180]:

In [181]: a[0].shape
Out[181]: (1480, 1552)

In [182]: a00 = pypad.read.enforce_raw_img_shape(a[0])

In [183]: P = geom(a00 )

In [184]: imshow( P,vmin=0,vmax=400 ); colorbar()
Out[184]: <matplotlib.colorbar.Colorbar instance at 0x11312a28>

In [185]: 

test_image_run34_newdet

tjlane commented 11 years ago

looks good man.

one more tip: you can change the size of the central hole using, e.g.

geom.dilate(5.0) # units in mm
dermen commented 11 years ago

would be awesome during the experiment if we have a designated optimizer.

Anyway we can get some test rings to optimize on before the beamtime ?? Rick suggested we contact some peeps...

tjlane commented 11 years ago

Jonas and I have some tutorial gold rings from our last expt in the repo. try them out.

I've got a metrology from Rick for their previous expts. Will check in a converter either today or tomorrow.