diff --git a/Laser_utils.py b/Laser_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..0af4c88ed419096a910bb2a75ed49de97695584c --- /dev/null +++ b/Laser_utils.py @@ -0,0 +1,15 @@ +def positionToDelay(data, key, origin=0, invert = False, reflections=1): + ''' converts a motor position in mm into optical delay in picosecond + Inputs: + data: dataset containing delay stage motor position + key: key of the delay stage + origin: motor position of time zero in mm + invert: bool, inverts the sign of delay if True + reflections: number of bounces in the delay stage + + Output: + delay in picosecond + ''' + c_ = 299792458 *1e-9 # speed of light in mm/ps + x = -1 if invert else 1 + return 2*reflections*(data[key]-origin)*x/c_ \ No newline at end of file diff --git a/__init__.py b/__init__.py index 654b00fd8ddd17321acbc7a68a6d4afe987560bb..9266141c5314b51d023361e26c8767c64864bf26 100644 --- a/__init__.py +++ b/__init__.py @@ -2,3 +2,4 @@ from ToolBox.Load import * from ToolBox.xgm import * from ToolBox.XAS import * from ToolBox.knife_edge import * +from ToolBox.Laser_utils import *