예제 #1
0
    def setUp(self):
        f_path = os.path.dirname(os.path.realpath(__file__))
        cell_list = load(
            os.path.join(f_path, 'test_data', 'test_synth_cell_storm.hdf5'))
        icp = IterCellPlot(cell_list)
        # Padding
        self.cell_list = icp.cell_list

        self.icp = IterCellPlot(self.cell_list, pad=False)

        self.num = len(self.cell_list)
        self.num_st = [
            len(cell.data.data_dict['storm']) for cell in self.cell_list
        ]

        self.num_poles = []
        self.num_05 = []
        for c in self.cell_list:
            st_x, st_y = c.data.data_dict['storm']['x'], c.data.data_dict[
                'storm']['y']
            l, r, phi = c.coords.transform(st_x, st_y)
            self.num_poles.append((l == 0).sum() + (l == c.length).sum())
            self.num_05.append(
                ((l > 0.25 * c.length) * (l < 0.75 * c.length)).sum())

        self.num_full = np.array(self.num_st) - np.array(self.num_poles)
예제 #2
0
    def setUp(self):
        f_path = os.path.dirname(os.path.realpath(__file__))
        self.cell_list = load(
            os.path.join(f_path, 'test_data', 'test_synth_cell_storm.hdf5'))
        self.cell = self.cell_list[0]

        data = Data()
        data.add_data(self.cell.data.binary_img, 'binary')
        self.empty_cell = Cell(data)
예제 #3
0
    def setUp(self):
        self.data = load_testdata('ds1')
        f_path = os.path.dirname(os.path.realpath(__file__))
        self.storm_cells_1 = load(
            os.path.join(f_path, 'test_data/test_single_spot_storm.hdf5'))
        self.storm_cells_2 = load(
            os.path.join(f_path, 'test_data/test_double_spot_storm.hdf5'))

        cells_no_flu = []
        for c in self.storm_cells_2:
            d = Data()
            d.add_data(c.data.binary_img, 'binary')
            d.add_data(c.data.data_dict['storm_1'], 'storm', 'storm_1')
            d.add_data(c.data.data_dict['storm_2'], 'storm', 'storm_2')
            cell = Cell(d)
            cells_no_flu.append(cell)

        self.storm_cells_2_no_flu = CellList(cells_no_flu)
예제 #4
0
    def setUp(self):
        f_path = os.path.dirname(os.path.realpath(__file__))
        self.cell_list = load(
            os.path.join(f_path, 'test_data', 'test_synth_cell_storm.hdf5'))
        self.cell = self.cell_list[0]

        x = np.arange(20)
        y = np.exp(-x / 5)

        img_3d = self.cell.data.data_dict['fluorescence'][
            np.newaxis, :, :] * y[:, np.newaxis, np.newaxis]
        self.cell.data.add_data(img_3d, 'fluorescence', 'flu_3d')

        data = Data()
        data.add_data(self.cell.data.binary_img, 'binary')
        self.empty_cell = Cell(data)
예제 #5
0
    def setUp(self):
        f_path = os.path.dirname(os.path.realpath(__file__))
        self.cell_list = load(os.path.join(f_path, 'test_data', 'test_synth_cell_storm.hdf5'))
        self.num = len(self.cell_list)
        self.num_st = np.sum([len(cell.data.data_dict['storm']) for cell in self.cell_list])
        self.clp = CellListPlot(self.cell_list)

        self.num_poles = 0
        self.num_05 = 0
        for c in self.cell_list:
            st_x, st_y = c.data.data_dict['storm']['x'], c.data.data_dict['storm']['y']
            l, r, phi = c.coords.transform(st_x, st_y)
            self.num_poles += ((l == 0).sum() + (l == c.length).sum())
            self.num_05 += np.sum((l > 0.25 * c.length) * (l < 0.75 * c.length))
        self.num_full = self.num_st - self.num_poles

        self.model_cell = SynthCell(50, 8, 1e-10)
예제 #6
0
    def test_save_load_cell_list(self):
        save('temp_save_celllist.hdf5', self.cell_list)
        cell_list_load = load('temp_save_celllist.hdf5')
        os.remove('temp_save_celllist.hdf5')

        self.assertEqual(len(self.cell_list), len(cell_list_load))

        for ci, co in zip(self.cell_list, cell_list_load):
            for item in ['r', 'xl', 'xr']:
                self.assertEqual(getattr(ci.coords, item),
                                 getattr(co.coords, item))

            self.assertEqual(ci.name, co.name)

            for p1, p2 in zip(ci.coords.coeff, co.coords.coeff):
                self.assertEqual(p1, p2)

            self.assertArrayEqual(ci.data.binary_img, co.data.binary_img)
            self.assertArrayEqual(ci.data.flu_fluorescence,
                                  co.data.flu_fluorescence)
예제 #7
0
    def test_save_load_cells(self):
        save('temp_save.hdf5', self.cell_obj)
        cell_obj_load = load('temp_save.hdf5')
        os.remove('temp_save.hdf5')

        for item in ['r', 'xl', 'xr']:
            self.assertEqual(getattr(self.cell_obj.coords, item),
                             getattr(cell_obj_load.coords, item))

        self.assertEqual(self.cell_obj.name, cell_obj_load.name)

        for p1, p2 in zip(self.cell_obj.coords.coeff,
                          cell_obj_load.coords.coeff):
            self.assertEqual(p1, p2)

        self.assertEqual(self.cell_obj.coords.shape,
                         cell_obj_load.coords.shape)
        self.assertArrayEqual(self.cell_obj.data.binary_img,
                              cell_obj_load.data.binary_img)
        self.assertArrayEqual(self.cell_obj.data.flu_fluorescence,
                              cell_obj_load.data.flu_fluorescence)
예제 #8
0
 def setUp(self):
     f_path = os.path.dirname(os.path.realpath(__file__))
     self.cells = load(os.path.join(f_path, 'test_data', 'test_cells.hdf5'))
     self.memory = Memory(verbose=0)
     self.de_kwargs = {'popsize': 10, 'seed': 42}
예제 #9
0
 def setUp(self):
     self.data = load_testdata('ds1')
     f_path = os.path.dirname(os.path.realpath(__file__))
     self.cells = load(
         os.path.join(f_path, 'test_data/test_synth_cell_storm.hdf5'))
     self.cell = self.cells[0]
예제 #10
0
 def setUp(self):
     f_path = os.path.dirname(os.path.realpath(__file__))
     self.cells = load(
         os.path.join(f_path, 'test_data', 'test_synth_cell_storm.hdf5'))
예제 #11
0
 def setUp(self):
     f_path = os.path.dirname(os.path.realpath(__file__))
     self.cells = load(os.path.join(f_path, 'test_data', 'test_cells.hdf5'))
     self.de_kwargs = {'popsize': 10, 'recombination': 0.9, 'seed': 42}