labscript-suite-temp / blacs

BLACS, part of the labscript suite, provides an interface to hardware used to control a buffered experiment. It manages a queue of shots to be run as well as providing manual control over devices between shots.
Other
0 stars 0 forks source link

Front Panel settings set to default on load when connection table is modified under Python 3 #38

Closed philipstarkey closed 6 years ago

philipstarkey commented 6 years ago

Original report (archived issue) by David Meyer (Bitbucket: dihm, GitHub: dihm).


Running BLACS with Python 3 gives the blanking default values issue seen in Issue #37 with edits to the connection table, excluding adding something new. I suspect it is caused by a similar issue as that of Issue #37 but haven't dug into it.

This issue is not present on our Python 2 setup.

philipstarkey commented 6 years ago

Original comment by Jan Werkmann (Bitbucket: PhyNerd, GitHub: PhyNerd).


Does adding name = _ensure_str(name) to the top of find_by_name in labscript_utils/connections.py solve the bug for you? It seems that name is sometimes passed as a numpy string.

philipstarkey commented 6 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


I suspect the aboce _ensure_str() might fix it, and if not, is a problem anyway. In front_panel_settings.py, there is code like this:

    def check_row(self,row,ct_match,blacs_ct,saved_ct):            
        # If it has a name
        if row[0] != "-":
            if ct_match:
                # Restore
                return 1
            else:
                # Find if this device is in the connection table
                connection = blacs_ct.find_by_name(row[0])
                connection2 = saved_ct.find_by_name(row[0])

Where row is a row if a HDF dataset - and strings it contains are numpy bytestrings. So not only would find_by_name be better if it accepted numpy strings, the check row[0] != "-" is always resulting in False since "-" is a unicode strings and row[0] is a numpy bytestring.

Fixing these case by case might help, but at some point I might go over front_panel_settings to wrap the reading of the h5 file in something that results in all unicode strings in objects rather than passing rows of numpy arrays around.

philipstarkey commented 6 years ago

Original comment by David Meyer (Bitbucket: dihm, GitHub: dihm).


name = _ensure_str(name) does fix this particular issue for me.

philipstarkey commented 6 years ago

Original comment by Jan Werkmann (Bitbucket: PhyNerd, GitHub: PhyNerd).


Great! I'll create a pull request with that change then.

philipstarkey commented 6 years ago

Original comment by Philip Starkey (Bitbucket: pstarkey, GitHub: pstarkey).


resolved as of changeset labscript-suite-temp/labscript_utils@ec865eda011a4db73ee2f010c39be4c6d60263eb