Esempio n. 1
0
    def _read_position_list(self):
        """Open a Micromanager acquired position file and return a list of X, Y positions"""
        if self.pl_path is None:
            return [], []

        acquisition_dict = util.read_json(self.pl_path)
        return clean_position_text(acquisition_dict)
Esempio n. 2
0
def read_metadata(image_path: Path):
    """Read a metadata dictionary from a file and return it, or return None if not found"""
    metadata_path = Path(image_path.parent, image_path.stem + '_metadata.txt')
    try:
        metadata = util.read_json(metadata_path)
        return metadata
    except:
        return None
Esempio n. 3
0
def get_xy_origin(pl_path, params=None):
    """Read an micromanager position list and get the XY origin"""
    raw_pos_list = util.read_json(pl_path)
    pos_list = clean_position_text(raw_pos_list)[0]
    xy_origin = np.min(pos_list, 0)
    if params is not None:
        xy_origin[0] = xy_origin[
            0] - 0.5 * params['raylines'] * params['transducer spacing']

    return xy_origin
Esempio n. 4
0
 def _read_delays(self):
     """
             Find a delays file if it exists and read it in instead of calculating
             :return:
             """
     temp_params = util.read_json(self.params_path)
     if self.params == temp_params:
         self.delays = sp.load_npz(self.delays_path)
     else:
         raise (
             "The parameters do not match.\n Point to the right file or to an unused file name"
         )
 def test_read_string_io(self, tmpdir, file_content, expected):
     path = tmpdir.join('test.json')
     with open(str(path), 'w') as file:
         json.dump(file_content, file)
     output = util.read_json(path)
     assert output == expected