ZhuangLab / storm-control

Microscope control software
Other
65 stars 67 forks source link

kilroy - cannot be opened in test mode #43

Closed BogdanBintu closed 6 years ago

BogdanBintu commented 7 years ago

In kilroy.py line 42: if not hasattr(parameters, "num_simulated_valves"):

hasattr(parameters, "num_simulated_valves") will always return false even if parameters.get("num_simulated_valves") will not error and return the value in the xml loaded by the paramaters.

Suggested change: Replace: if not hasattr(parameters, "num_simulated_valves"): self.num_simulated_valves = 0 else: self.num_simulated_valves = parameters.get("num_simulated_valves") with: self.num_simulated_valves = parameters.get("num_simulated_valves", 0)

To get variables with defaults use: self. = get(,)

HazenBabcock commented 7 years ago

Please use the following procedure for your suggestions: (1) Create a fork of storm-control (which you may have already done) on Github. (2) Create a branch off of an updated master branch, "git checkout -b fix_kilroy_test_mode". (3) Make the changes (and only the changes) you want to see in master. (4) Test your changes. (5) Create a pull request on Github for your branch.

Also you can use markdown in your issues, which makes them more legible.

if not hasattr(parameters, "num_simulated_valves"):
    self.num_simulated_valves = 0
else:
   self.num_simulated_valves = parameters.get("num_simulated_valves")
HazenBabcock commented 7 years ago

FWIW, this actually fails because the parameters object has changed. The correct way to test for the presence of a parameter in a parameter object is:

parameters.has("some_attribute_name")
HazenBabcock commented 6 years ago

Fixed? Closing for now.