Frequently Asked Questions

I’m importing functions from a Python module, but when I change the module, Bluelake doesn’t see the changes

Placing re-usable functions into your own Python modules can be a good way to share code between automation scripts. For instance, say you have the following two files:

# --- script.py
import bluelake
import mymodule

mymodule.full_name_dna()


# --- mymodule.py
def full_name_dna():
    print('Deoxyribonucleic acid')

Running the script from Bluelake should work fine. However, if you now make a change in mymodule.py and run script.py again, you’ll see that Bluelake keeps running the old version.

This is a known limitation of importing Python modules: they are not automatically refreshed if the module’s source file changes. To work around this, you have two options:

  1. Restart Bluelake.

  2. Use the following code to import your module in script.py:

    from importlib import reload
    import mymodule
    reload(mymodule)
    
    mymodule.full_name_dna()
    

For more information, see the Python documentation of importlib.

What are the differences between the API of Bluelake 1.6 and 2.0?

In Bluelake 2.0 some of the API has changed. The following changes may require adaptations in your automation script as you transfer from Bluelake 1.6 to 2.0:

  1. The trap steering is more accurate in Bluelake 2.0. As a consequence, the coordinate system in 2.0 has changed. If you had waypoints and/or used the move_to command in a 1.6 script, you will have to update the coordinates. The move_by command in scripts written for Bluelake 1.6 behaves the same in Bluelake 2.0.

  2. The speed of the microstage in Bluelake 1.6 is given as a percentage of the maximum speed, while in Bluelake 2.0 the speed is given in mm/s.

  3. The names of the modules that move the traps have changed. The old names can still be used, but the motion will be less accurate (see point 1 above). In addition, the old names will give a deprecation warning. This warning indicates that in future versions of Bluelake, this deprecated API may be removed. A deprecation warning is just a warning, not an error, so your script should still run fine when using the old names.

    import bluelake as bl
    
    # Bluelake 1.6:
    bl.trap1
    bl.trap2
    bl.trap12xy
    bl.trap12z
    bl.nanostage
    
    # Bluelake 2.0:
    bl.mirror1
    bl.mirror2
    bl.mirror12
    bl.telescope12
    bl.nanostage