Ticket #7501 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Provide option to distribute the detectors along the tube (easy to test)

Reported by: Gesner Passos Owned by: Gesner Passos
Priority: major Milestone: Release 2.6
Component: Framework Keywords: Calibration
Cc: Blocked By:
Blocking: Tester: Karl Palmen

Description

Now, the distribution of the detectors along the tube follows a quadratic fit function.

Extend this to allow the user to choose linear and 3rd order polynomial.

Attachments

TestWishFitPolyn.py (3.2 KB) - added by Gesner Passos 7 years ago.
compare_fit1_fit2.png (160.6 KB) - added by Gesner Passos 7 years ago.
compare_fit2_fit3.png (77.8 KB) - added by Gesner Passos 7 years ago.

Change History

comment:1 Changed 7 years ago by Gesner Passos

  • Status changed from new to inprogress

comment:2 Changed 7 years ago by Gesner Passos

Change Quadratic to Polynomial n2

Changint the fit curve from quadratic to polynomial with n=2 produces exactly the same result. This was seen by saving the calibtable to a file

tb = mtd['CalibTable']
tofile = open('/tmp/quadraticcalibrated.txt','w')
for row in tb:
	print >> tofile, row['Detector ID'], row['Detector Position']
tofile.close()

and comparing the files for the quadratic and for the polynomial n=2, and both files are identical.

re #7501

Changeset: 86e410d05e8e349d12f3fabd5ac34ec9da2def96

comment:3 Changed 7 years ago by Gesner Passos

Implement different polynomial fit

It nows allow a polynomial of any order.

re #7501

Changeset: d50c85a7965de4124e7b2edc17aa7dad2c314a09

comment:4 Changed 7 years ago by Gesner Passos

Extend to allow fit with polynomial 1,2,3

re #7501

Changeset: 065b9fc2ac3bcb9064af2f810ee0c767ea5aa68f

comment:5 Changed 7 years ago by Gesner Passos

Change parameter name from fitPolin to fitPolyn

Correct mispelling and update the documentation removing the 'not yet implemented'

re #7501

Changeset: ed33dedb5cee3bd85e90902aff8a4f943193596b

Changed 7 years ago by Gesner Passos

Changed 7 years ago by Gesner Passos

Changed 7 years ago by Gesner Passos

comment:6 Changed 7 years ago by Gesner Passos

  • Status changed from inprogress to verify
  • Resolution set to fixed

Tester:

the attached file is a slightly different example taken from the TubeCalibDemoWish_Simple.py, but using the fitPolyn argument.

You should be able to execute this example changing fitPolyn to 1, 2 or 3. The results will be just slightly different (maybe even hard to see by eyes), when viewing in the instrument view. But, if you compare the value of the y from the calibrationTable from them, you will see that they differ, but not so much.

From my point of view, you can stop on the observation that it work for the 3 values. But, if you are willing to do further investigation on the quality of the answer... (I've done)

I've also attached two pictures that compare the difference of the position of the detectors inside the tube. I've plotted the max difference, the minimum difference, the average and the standard deviation of the difference of the positions. For both, they are around 0, but, while there is not great improvement from 2 to 3, there is a considerable improvement from 1 to 2.

But, it is something that you have to judge.

BTW, if you want to get all the values for the y position from the calibration table, you may use:

v1 = numpy.array([r['Detector Position'].getY() for r in mtd['calibTable']])
v1_r = v1.reshape(152,512) # than you access v1_r[0] the positions for every detector in tube 0.

comment:7 Changed 7 years ago by Gesner Passos

  • Summary changed from Provide option to distribute the detectors along the tube to Provide option to distribute the detectors along the tube (easy to test)

comment:8 Changed 7 years ago by Nick Draper

  • Component changed from Other to Framework

comment:9 Changed 7 years ago by Keith Brown

  • Status changed from verify to verifying
  • Tester set to Keith Brown

comment:10 Changed 7 years ago by Keith Brown

  • Status changed from verifying to verify
  • Tester Keith Brown deleted

comment:11 Changed 7 years ago by Karl Palmen

  • Status changed from verify to verifying
  • Tester set to Karl Palmen

comment:12 Changed 7 years ago by Karl Palmen

  • Status changed from verifying to closed

Testing

Testing showed a good result for polynomials of degree 2 and 3.

One concern was the slow performance of showing the instrument. I'll investigate this further possibly in unscripted testing.

Code Review

The code seems to be well structured. Some comments need updating and English needs improving.

comment:13 Changed 7 years ago by Karl Palmen

Merge remote-tracking branch 'origin/feature/7501_implement_polin'

comment:14 Changed 7 years ago by Karl Palmen

The slow performance of show instrument may be just because I had built in 'Debug' instead of 'Release'.

comment:15 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 8346

Note: See TracTickets for help on using tickets.