Skip to content

Conversation

@nvaytet
Copy link
Member

@nvaytet nvaytet commented Nov 11, 2025

Examples:

From scippneutron.DiskChopper

disk_chopper = DiskChopper(
    axle_position=sc.vector([0.0, 0.0, 2.0], unit='m'),
    frequency=sc.scalar(12.0, unit='Hz'),
    beam_position=sc.scalar(45.0, unit='deg'),
    phase=sc.scalar(20.0, unit='deg'),
    slit_begin=sc.array(dims=['slit'], values=[0.0, 124.0], unit='deg'),
    slit_end=sc.array(dims=['slit'], values=[60.0, 126.0], unit='deg'),
)

chopper = tof.Chopper.from_diskchopper(disk_chopper)

To DiskChopper

chopper = tof.Chopper(
    frequency=12.0 * Hz,
    open=sc.array(dims=['cutout'], values=[-15.0, 45.0], unit='deg'),
    close=sc.array(dims=['cutout'], values=[15.0, 75.0], unit='deg'),
    phase=20.0 * deg,
    distance=2.0 * meter,
    name='chopper',
    direction=tof.AntiClockwise,
)

disk_chopper = chopper.to_diskchopper()

From NeXus

nexus_chopper = {
    'position': sc.vector([0.0, 0.0, 2.0], unit='m'),
    'rotation_speed': sc.scalar(12.0, unit='Hz'),
    'beam_position': sc.scalar(45.0, unit='deg'),
    'phase': sc.scalar(20.0, unit='deg'),
    'slit_edges': sc.array(
        dims=['slit'],
        values=[0.0, 60.0, 124.0, 126.0],
        unit='deg',
    ),
    'slit_height': sc.scalar(0.4, unit='m'),
    'radius': sc.scalar(0.5, unit='m'),
}

chopper = tof.Chopper.from_nexus(nexus_chopper)

Fixes #6

@nvaytet nvaytet changed the base branch from main to to-json November 11, 2025 14:45
@nvaytet nvaytet requested a review from jokasimr November 11, 2025 14:46
Copy link

@jokasimr jokasimr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Base automatically changed from to-json to main November 12, 2025 08:58
@nvaytet nvaytet merged commit 483e755 into main Nov 12, 2025
4 checks passed
@nvaytet nvaytet deleted the chopper-conversions branch November 12, 2025 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use the Nexus standard specification to define the parameters of the Chopper class

3 participants