contrast.scans package¶
Module contents¶
Provides basic acquisition macros and base classes for custom macros.
Submodules¶
contrast.scans.AScan module¶
-
class
contrast.scans.AScan.AScan(*args, **kwargs)[source]¶ Bases:
contrast.scans.Scan.SoftwareScanThis class generates the macro `ascan`
Software scan one or more motors in parallel.
ascan <motor1> <start> <stop> ... <intervals> <exp_time>
-
class
contrast.scans.AScan.DScan(*args, **kwargs)[source]¶ Bases:
contrast.scans.AScan.AScanThis class generates the macro `dscan`
Software scan one or more motors in parallel, with positions relative to each motor’s current one. Moves back afterwards.
dscan <motor1> <start> <stop> <intervals> ... <exp_time>
contrast.scans.Mesh module¶
-
class
contrast.scans.Mesh.Mesh(*args, **kwargs)[source]¶ Bases:
contrast.scans.Scan.SoftwareScanThis class generates the macro `mesh`
Software scan on a regular grid of N motors.
mesh <motor1> <start> <stop> <intervals> ... <exp_time>
- optional keyword arguments:
- jitter: float … Randomizes perfect grid positions.
-
class
contrast.scans.Mesh.DMesh(*args, **kwargs)[source]¶ Bases:
contrast.scans.Mesh.MeshThis class generates the macro `dmesh`
Software scan on a regular grid of N motors, with positions relative to each motor’s current one. Moves motors back at the end.
dmesh <motor1> <start> <stop> <intervals> ... <exp_time>
-
class
contrast.scans.Mesh.MeshJMesh(m1, l1_l, l1_u, n1, j1, sl1_l, sl1_u, sn1, sj1, m2, l2_l, l2_u, n2, j2, sl2_l, sl2_u, sn2, sj2, exptime, **kwargs)[source]¶ Bases:
contrast.scans.Scan.SoftwareScanThis class generates the macro `meshjmesh`
2D Software scan for NearField ptychography. Each point of a larger 2D mesh scan is another smaller 2D mesh.
- meshjmesh <motor1> <abs_start1> <abs_stop1> <nr_int1> <jit_amp1>
- <rel_start_sub1> <rel_stop_sub1> <nr_int_sub1> <jit_amp_sub1>
- <motor1> <abs_start2> <abs_stop2> <nr_int2> <jit_amp2>
- <rel_start_sub2> <rel_stop_sub2> <nr_int_sub2> <jit_amp_sub2>
<exposure_time>
The start and stop position of the coarse mesh are in aboslute coordinates, while the start and stop positions of the submesh are relative coordiantes.
2nd axis is the fast axis.
contrast.scans.Scan module¶
-
class
contrast.scans.Scan.SoftwareScan(exposuretime)[source]¶ Bases:
objectBase class for the normal sardana-style software-controlled scan. Respects the availability and deadlines managed by env.scheduler, honours env.shapshot, and acts on all active detectors, trigger sources, and recorders.
The constructor should parse the parameters of the derived macro.
Parameters: exposuretime (float) – Exposure time to pass on to detectors etc. -
_calc_time_needed()[source]¶ Estimates the time needed for performing the next acquisition. This can be done based on the input parameters, or on the timing of previous points.
-
_before_scan()[source]¶ Placeholder method for users to hook actions onto scan classes after import. For example opening a shutter:
def pre_scan_stuff(slf): print("Maybe open a shutter here?") SoftwareScan._before_scan = pre_scan_stuff
-
_after_scan()[source]¶ Placeholder method for users to hook actions onto scan classes after import, see
_before_scan.
-
_before_move()[source]¶ Gets called for each step, and can be used for example to check that the instrument is ready for the next acquisition, that there is beam in the machine, etc.
-
_while_acquiring()[source]¶ Gets called repeatedly while the detectors detect. Useful for printing a progress bar, for example.
-
-
class
contrast.scans.Scan.LoopScan(intervals, exposuretime=1.0)[source]¶ Bases:
contrast.scans.Scan.SoftwareScanThis class generates the macro `loopscan`
A software scan with no motor movements. Number of exposures is <intervals> + 1, for consistency with ascan, dscan etc.
loopscan <intervals> <exp_time>
contrast.scans.Spiral module¶
-
class
contrast.scans.Spiral.SpiralScan(m1, m2, stepsize, npos, exptime, **kwargs)[source]¶ Bases:
contrast.scans.AScan.DScanThis class generates the macro `spiralscan`
Software scan across a 2D Archimedes spiral centered on the current position.
spiralscan <motor1> <motor2> <stepsize> <positions> <exp_time>
-
class
contrast.scans.Spiral.FermatScan(m1, l1_l, l1_u, m2, l2_l, l2_u, stepsize, exptime, **kwargs)[source]¶ Bases:
contrast.scans.AScan.AScanThis class generates the macro `fermatscan`
Software scan in the shape of a fermat spiral (good for ptychography scan). The center of the spiral will be the center of the given rectangle. Both motors have to be in the same units.
fermatscan <motor1> <start> <stop> <motor2> <start> <stop> <stepsize> <exp_time>
- optional keyword arguments:
- optimize: boolean … will try to solve the traveling salesman problem
- WARNING: can be slow for large scans!
contrast.scans.Tweak module¶
-
contrast.scans.Tweak.getarrowkey()[source]¶ A function which waits for a keypress and returns one of the above constants.
-
class
contrast.scans.Tweak.Tweak(*args, **kwargs)[source]¶ Bases:
contrast.scans.Mesh.MeshThis class generates the macro `tweak`
An interactive scan where motor positions are chosen manually for each point. Useful for tweaking motors and reading the currently active detectors after each step.
tweak <motor1> <stepsize1> [<motor2> <stepsize2>] <exp_time>