ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change
on this file since 213892bc was
96c0234,
checked in by Jae Cho <jhjcho@…>, 14 years ago
|
kiessig calculator
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[96c0234] | 1 | """ |
---|
| 2 | This module is a small tool to allow user to quickly |
---|
| 3 | determine the size value in real space from the |
---|
| 4 | fringe width in q space. |
---|
| 5 | """ |
---|
| 6 | from math import pi, fabs |
---|
| 7 | _DQ_DEFAULT = 0.05 |
---|
| 8 | class KiessigThicknessCalculator(object): |
---|
| 9 | """ |
---|
| 10 | compute thickness from the fringe width of data |
---|
| 11 | """ |
---|
| 12 | def __init__(self): |
---|
| 13 | |
---|
| 14 | # dq value |
---|
| 15 | self.deltaq = _DQ_DEFAULT |
---|
| 16 | # thickenss value |
---|
| 17 | self.thickness = None |
---|
| 18 | # unit of the thickness |
---|
| 19 | self.thickness_unit = 'A' |
---|
| 20 | |
---|
| 21 | def set_deltaq(self, dq=None): |
---|
| 22 | """ |
---|
| 23 | Receive deltaQ value |
---|
| 24 | |
---|
| 25 | :param dq: q fringe width in 1/A unit |
---|
| 26 | """ |
---|
| 27 | # set dq |
---|
| 28 | self.deltaq = dq |
---|
| 29 | |
---|
| 30 | def get_deltaq(self): |
---|
| 31 | """ |
---|
| 32 | return deltaQ value in 1/A unit |
---|
| 33 | """ |
---|
| 34 | # return dq |
---|
| 35 | return self.deltaq |
---|
| 36 | |
---|
| 37 | def compute_thickness(self): |
---|
| 38 | """ |
---|
| 39 | Calculate thickness. |
---|
| 40 | |
---|
| 41 | :return: the thickness. |
---|
| 42 | """ |
---|
| 43 | # check if it is float |
---|
| 44 | try: |
---|
| 45 | dq = float(self.deltaq) |
---|
| 46 | except: |
---|
| 47 | return None |
---|
| 48 | # check if delta_q is zero |
---|
| 49 | if dq == 0.0 or dq == None: |
---|
| 50 | return None |
---|
| 51 | else: |
---|
| 52 | # calculate thickness |
---|
| 53 | thickness = 2*pi/fabs(dq) |
---|
| 54 | # return thickness value |
---|
| 55 | return thickness |
---|
| 56 | |
---|
| 57 | def get_thickness_unit(self): |
---|
| 58 | """ |
---|
| 59 | :return: the thickness unit. |
---|
| 60 | """ |
---|
| 61 | # unit of thickness |
---|
| 62 | return self.thickness_unit |
---|
| 63 | |
---|
| 64 | |
---|
Note: See
TracBrowser
for help on using the repository browser.