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

User report #76

Open
3 tasks
mrakitin opened this issue Oct 30, 2024 · 0 comments
Open
3 tasks

User report #76

mrakitin opened this issue Oct 30, 2024 · 0 comments

Comments

@mrakitin
Copy link
Member

@lyang11973 reported an issue with this optimization problem:

pos_x10 = crl.x1.position
pos_x20 = crl.x2.position
pos_y10 = crl.y1.position
pos_y20 = crl.y2.position
search_range = 0.6

dofs = [
    DOF(device=crl.x1, description="transfocator upstream x", 
        search_domain=(pos_x10-search_range/2, pos_x10+search_range/2)),
    DOF(device=crl.x2, description="transfocator downstream x", 
        search_domain=(pos_x20-search_range/2, pos_x20+search_range/2)),
    DOF(device=crl.y1, description="transfocator upstream y", 
        search_domain=(pos_y10-search_range/2, pos_y10+search_range/2)),
    DOF(device=crl.y2, description="transfocator downstream y", 
        search_domain=(pos_y20-search_range/2, pos_y20+search_range/2))
]

objectives = [
    Objective(name="em1_sum_all_mean_value", description="beam intensity", target="max", trust_domain=(100000, np.inf))
]

dets = [em1]

agent = Agent(dofs=dofs, objectives=objectives, detectors=dets, db=db)

RE(fast_shutter_wrapper(agent.learn("qr", n=16))) 

It completes the first set of data collection, but then fails with an error:

TypeError: where(): argument 'other' (position 2) must be Tensor, not float 

Proposed fix

In agent.py: np.nan needs to be converted to torch.tensor(np.nan).

@jennmald, @yxrmz, please have a look. We need to:

  • implement the fix
  • add a test for the use case
  • update the doc string to explain the enforce_all_objectives_valid parameter
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

No branches or pull requests

1 participant