Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve scan #336

Merged
merged 10 commits into from
Oct 13, 2014
Merged

Improve scan #336

merged 10 commits into from
Oct 13, 2014

Conversation

tfarago
Copy link
Contributor

@tfarago tfarago commented Oct 13, 2014

Summary

  • Selection parameter is scannable
  • Multidimensional scan and parameter passing via proper lists
  • Range was quite dangerous because of range = Range(...), thus now we have Region
  • User has full control of what the x-values look like in a scan
  • User can attach callbacks executed after certain parameter is changed in a scan (this was an actual user request) - helpful e.g. in long scans when one wants a flat field after some time and so on
  • Travis is happy again

Example

Running this

exp_region = Region(camera['exposure_time'], np.linspace(1, 100, 2) * q.ms)
pos_region = Region(motor['position'], np.linspace(2, 4, 3) * q.mm)


def feedback():
    pass


def callback_exp():
    print 'Exposure callback: {}'.format(camera.exposure_time)


def callback_pos():
    print 'Position callback: {}'.format(motor.position)


callbacks = {exp_region: callback_exp, pos_region: callback_pos}
for future in scan(feedback, [exp_region, pos_region], callbacks=callbacks):
    pass

gives you

Exposure callback: 0.001 second
Position callback: 2.0 millimeter
Position callback: 3.0 millimeter
Position callback: 4.0 millimeter
Exposure callback: 0.1 second
Position callback: 2.0 millimeter
Position callback: 3.0 millimeter
Position callback: 4.0 millimeter

@tfarago tfarago self-assigned this Oct 13, 2014
@tfarago tfarago added this to the Concert 0.10 milestone Oct 13, 2014
@matze
Copy link
Contributor

matze commented Oct 13, 2014

Looks good to me! 👍

@tfarago tfarago added ready and removed in progress labels Oct 13, 2014
tfarago added a commit that referenced this pull request Oct 13, 2014
@tfarago tfarago merged commit 3bea2ec into master Oct 13, 2014
@tfarago tfarago deleted the improve-scan branch October 13, 2014 15:17
@tfarago tfarago removed the ready label Oct 13, 2014
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.

None yet

2 participants