Transfocator
transfocator
Attributes
Classes
MFXTransfocator
Bases: TransfocatorBase
Class to represent the MFX Transfocator
Source code in tfs/transfocator.py
Attributes
current_focus
property
The distance from the focus of the Transfocator to nominal_sample
Note
If no lenses are inserted this will retun NaN
req_energy
class-attribute
instance-attribute
tfs_radius
class-attribute
instance-attribute
tfs_radius = Component(EpicsSignalRO, ':BEAM:TFS_RADIUS', kind='normal', doc='TFS effective radius')
translation
class-attribute
instance-attribute
xrt_radius
class-attribute
instance-attribute
xrt_radius = Component(EpicsSignalRO, ':BEAM:XRT_RADIUS', kind='normal', doc='XRT effective radius')
Functions
find_best_combo
find_best_combo(target=None, energy_eV=None, n=4, z_obj=0, show=True, exclusions=[], avoid_forbidden=False, enable_prefocus=True, **kwargs)
Calculate the best lens array to hit the nominal sample point
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
float
|
The target image of the lens array. By default this is
|
None
|
energy_eV
|
int
|
Select the energy in eV. Default uses the beam energy given by acr which is usually wrong |
None
|
n
|
int
|
The maximum number of lenses in a valid combination. This saves time by avoiding calculating the focal plane of combinations with a large number of lenses, default n=4 |
4
|
z_obj
|
float
|
The source point of the beam, default halfway through range at 150.0 |
0
|
show
|
bool
|
Print a table of the of the calculated lens combination |
True
|
exclusions
|
list
|
Select your lenses to excluclde from tfs lenes #2-10 as list recommend [8,10] |
[]
|
avoid_forbidden
|
bool
|
Avoids forbidden TFS configurations. True by default |
False
|
enable_prefocus
|
bool
|
Allows the solver to use the prefocusing lenses in the XRT. Default is True since the prefocusing lenses are usually required to hit the target plane at MFX. Setting this to False will force the solver to find a solution using only the TFS lenses. |
True
|
kwargs
|
Passed to :meth: |
{}
|
Source code in tfs/transfocator.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
focus_at
Calculate a combination and insert the lenses
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Chosen focal plane. Nominal sample by default |
None
|
|
wait
|
bool
|
Wait for the motion of the transfocator to complete |
False
|
timeout
|
Timeout for motion |
None
|
|
kwargs
|
All passed to :meth: |
{}
|
Returns:
| Type | Description |
|---|---|
StateStatus
|
Status that represents whether the move is complete |
Source code in tfs/transfocator.py
get_stage_limits
Source code in tfs/transfocator.py
get_z_stage_target
Source code in tfs/transfocator.py
mv_stage_to_pos
mv_stage_to_target_pos
Source code in tfs/transfocator.py
plan_energy_schedule
Plan a schedule of lens insert/remove actions and stage offsets over an energy interval without moving hardware.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
low_eV
|
float
|
Starting energy in eV. |
required |
high_eV
|
float
|
Ending energy in eV. |
required |
step_eV
|
float
|
Energy increment in eV (default 10 eV). |
10.0
|
target
|
float
|
Desired focal plane (defaults to nominal sample). |
None
|
n
|
int
|
Max number of TFS lenses in combo (passed to solver). |
4
|
z_obj
|
float
|
Source point in solver. |
0.0
|
show
|
bool
|
If True, print combo info for each energy. |
False
|
Returns:
| Type | Description |
|---|---|
list of dict
|
For each energy step, returns an entry with keys: - 'energy_eV': energy value in eV - 'lenses': list of lens prefixes in the planned combo - 'actions': {'insert': [...], 'remove': [...]} compared to previous step - 'image_target_delta': signed difference (image - target) - 'stage_offset_mm': signed offset in mm to place focus at target |
Source code in tfs/transfocator.py
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | |
plot_focus_track
Source code in tfs/transfocator.py
remove_all
Removes all tfs lenses.
Source code in tfs/transfocator.py
set
set_reference_combo
kwargs:
Passed to :meth:.Calculator.find_solution
Source code in tfs/transfocator.py
track_focus
track_focus(energies, *, margin_mm=10.0, show=False, ref_focal_length_um=None, ref_z_stage_mm=None, display=True, shrinking_rate=4, enable_prefocus=True, lens_beam_energy_offset=0.0, **kwargs)
Keep the focal length fixed over a provided list of energies by compensating with the translation stage. Lenses are NOT actuated.
Workflow: - Move stage to high limit minus a small margin. - Compute initial lens combo and reference focal length. - For each next energy, compute focal length for the current combo and move the stage to compensate. - If the move would exceed the stage low limit, return to the top position and recompute the lens combo at that energy, then continue.
kwargs:
Passed to :meth:.Calculator.find_solution
Source code in tfs/transfocator.py
597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | |
try_combo
Calculates the focus based on the lens combo you select
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
float
|
The target image of the lens array. By default this is
|
400.37
|
energy
|
int
|
Select the energy in eV. Default uses the beam energy given by acr which is usually wrong |
None
|
show
|
bool
|
Print a table of the of the calculated lens combination |
True
|
prefocus
|
int
|
Select either 333, 428, or 750 um radius lens |
None
|
tfs
|
list
|
Select your lens combination from tfs lenes #2-10 as list i.e. [2,6,8,10] |
[]
|
kwargs
|
Passed to :meth: |
{}
|
Source code in tfs/transfocator.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |
Transfocator
TransfocatorBase
TransfocatorEnergyInterrupt
Bases: Exception
Custom exception returned when input beam energy (user defined or current measured value) changes significantly during calculation
TransfocatorInterlock
Bases: Device
Device containing signals pertinent to the interlock system.
Attributes
bypass
class-attribute
instance-attribute
bypass_energy
class-attribute
instance-attribute
faulted
class-attribute
instance-attribute
ioc_alive
class-attribute
instance-attribute
lens_required_fault
class-attribute
instance-attribute
lens_required_fault = Component(EpicsSignalRO, ':BEAM:REQ_TFS_FAULT', doc='Transfocator lens required for energy/lens combination [active]')
lens_required_fault_latch
class-attribute
instance-attribute
lens_required_fault_latch = Component(EpicsSignalRO, ':BEAM:REQ_TFS_FAULT_LT', doc='Transfocator lens required for energy/lens combination [latched]')
limits
class-attribute
instance-attribute
limits = Component(LensTripLimits, ':ACTIVE', doc='Active trip limit settings, based on pre-focus lens')
min_fault
class-attribute
instance-attribute
min_fault = Component(EpicsSignalRO, ':BEAM:MIN_FAULT', doc='Minimum required energy not met for lens combination [active]')
min_fault_latch
class-attribute
instance-attribute
min_fault_latch = Component(EpicsSignalRO, ':BEAM:MIN_FAULT_LT', doc='Minimum required energy not met for lens combination [latched]')
state_fault
class-attribute
instance-attribute
table_fault
class-attribute
instance-attribute
table_fault = Component(EpicsSignalRO, ':BEAM:TAB_FAULT', doc='Effective radius in table-based disallowed area [active]')
table_fault_latch
class-attribute
instance-attribute
table_fault_latch = Component(EpicsSignalRO, ':BEAM:TAB_FAULT_LT', doc='Effective radius in table-based disallowed area [latched]')
Functions
constant_energy
Ensures that requested energy does not change during calculation
Parameters: transfocator_obj: transfocate.transfocator.Transfocator object
energy_type: string input string specifying 'req_energy' or 'beam_energy' to be monitored during calculation
tolerance: float energy (in eV) for which current beam energy can change during calculation and still assumed constant