Open Yueming-Yin opened 2 weeks ago
Hi @Yueming-Yin
Thank you for your interest in SyMBac. Can you tell me which branch you are using?
Hi @georgeoshardo
Thanks for your quick reply. I was using the "main" branch. Which branch should I use? I saw four branches.
Ah good, yes stick with the main branch for now. Unfortunately I have not had time to update SyMBac recently, but I shall look into this error for you. For now, is it absolutely necessary that you extract lineage information? Or are you mainly interested in synthetic images?
Thanks @georgeoshardo. I'm mainly interested in synthetic images, so I can skip the sections about my_lineage in the MM_lineage_example.ipynb, correct?
Apologies for the late reply. Yes you can safely skip that step.
Hi, Georgeoshardo. I encountered the error "KeyError: ['mother_mask_label']" when I ran "my_lineage = Lineage(my_simulation)" in the MM_lineage_example.ipynb. I print the df and did not find any key called 'mother_mask_label' in other library codes. Could you please check it and let me know how to fix it. Thank you so much. Below is the full error text:
KeyError Traceback (most recent call last) /tmp/ipykernel_2320870/4038630209.py in ?() ----> 1 my_lineage = Lineage(my_simulation)
/media/DATA/yueming/anaconda3/lib/python3.11/site-packages/SyMBac/lineage.py in ?(self, simulation) 13 sim_dicts.append(cell.dict) 14 15 df = pd.DataFrame(sim_dicts) 16 print(df) ---> 17 df = df.dropna(subset=["mother_mask_label"]) 18 df = df.drop_duplicates(["mask_label", "mother_mask_label"]) 19 self.family_tree_edgelist = np.array(df[["mother_mask_label", "mask_label"]]) 20 self.all_cell_data_df = df
/media/DATA/yueming/anaconda3/lib/python3.11/site-packages/pandas/core/frame.py in ?(self, axis, how, thresh, subset, inplace, ignore_index) 6403 ax = self._get_axis(agg_axis) 6404 indices = ax.get_indexer_for(subset) 6405 check = indices == -1 6406 if check.any(): -> 6407 raise KeyError(np.array(subset)[check].tolist()) 6408 agg_obj = self.take(indices, axis=agg_axis) 6409 6410 if thresh is not no_default:
KeyError: ['mother_mask_label']
the output of print(df): dt growth_rate_constant length width_mean width_var width \ 0 0.05 1 169.093545 46.153846 0.0 46.153846
1 0.05 1 179.981819 46.153846 0.0 46.153846
2 0.05 1 190.045608 46.153846 0.0 46.153846
3 0.05 1 200.217330 46.153846 0.0 46.153846
4 0.05 1 212.731941 46.153846 0.0 46.153846
.. ... ... ... ... ... ...
956 0.05 1 266.721400 46.153846 0.0 46.153846
957 0.05 1 299.779798 46.153846 0.0 46.153846
958 0.05 1 285.315043 46.153846 0.0 46.153846
959 0.05 1 156.415520 46.153846 0.0 46.153846
960 0.05 1 163.783288 46.153846 0.0 46.153846
0 60 1.547069 (63.460284158479965, 86.87530014475523)
1 60 1.548935 (63.46586075789472, 92.32056919876845)
2 60 1.550476 (63.46599226974969, 97.35338545508812)
3 60 1.551828 (63.46613012341372, 102.44000360399433)
4 60 1.553262 (63.46629950679338, 108.69806056616036)
.. ... ... ...
956 60 1.515171 (65.2082185547324, 712.419399272232)
957 60 1.582289 (60.53272686476196, 152.2245586319335)
958 60 1.570796 (64.92307758552582, 464.40770373916973)
959 60 1.570796 (59.0769220565924, 243.9208599808241)
960 60 1.545893 (63.46568654441335, 84.21929099541254)
0 <pymunk.space.Space object at 0x7f2e4d794bd0> 306.923077
1 <pymunk.space.Space object at 0x7f2e4ffe6550> 306.923077
2 <pymunk.space.Space object at 0x7f2e4d7bc210> 306.923077
3 <pymunk.space.Space object at 0x7f2e4d7b1a10> 306.923077
4 <pymunk.space.Space object at 0x7f2e4d7f5150> 306.923077
.. ... ...
956 <pymunk.space.Space object at 0x7f2e36043910> 306.923077
957 <pymunk.space.Space object at 0x7f2e36043910> 306.923077
958 <pymunk.space.Space object at 0x7f2e3d6f8510> 306.923077
959 <pymunk.space.Space object at 0x7f2e3d6f8510> 306.923077
960 <pymunk.space.Space object at 0x7f2e3d6f8510> 306.923077
0 306.923077 0.0
1 306.923077 0.0
2 306.923077 0.0
3 306.923077 0.0
4 306.923077 0.0
.. ... ...
956 306.923077 0.0
957 306.923077 0.0
958 306.923077 0.0
959 306.923077 0.0
960 306.923077 0.0
0 <pymunk.shapes.Poly object at 0x7f2e4d373410>
1 <pymunk.shapes.Poly object at 0x7f2e4d3b8150>
2 <pymunk.shapes.Poly object at 0x7f2e4d3fc210>
3 <pymunk.shapes.Poly object at 0x7f2e4cf32650>
4 <pymunk.shapes.Poly object at 0x7f2e4cf74550>
.. ...
956 <pymunk.shapes.Poly object at 0x7f2e364b6690>
957 <pymunk.shapes.Poly object at 0x7f2e361befd0>
958 <pymunk.shapes.Poly object at 0x7f2e2e452cd0>
959 <pymunk.shapes.Poly object at 0x7f2e2e467910>
960 <pymunk.shapes.Poly object at 0x7f2e34044d10>
0 Body(1e-06, 0.0023046270217826053, Body.DYNAMIC) 20652470 0.0
1 Body(1e-06, 0.0026040475914596247, Body.DYNAMIC) 20652470 0.0
2 Body(1e-06, 0.0028982925702146904, Body.DYNAMIC) 20652470 0.0
3 Body(1e-06, 0.003212785202935517, Body.DYNAMIC) 20652470 0.0
4 Body(1e-06, 0.003623305211034521, Body.DYNAMIC) 20652470 0.0
.. ... ... ...
956 Body(1e-06, 0.005692923596951178, Body.DYNAMIC) 57965077 0.0
957 Body(1e-06, 0.007199654166303326, Body.DYNAMIC) 75117669 0.0
958 Body(1e-06, 0.006517991605536586, Body.DYNAMIC) 68641298 0.0
959 Body(1e-06, 0.0019807580533017857, Body.DYNAMIC) 75117669 0.0
960 Body(1e-06, 0.00216573112259209, Body.DYNAMIC) 52160546 0.0
0 NaN <SyMBac.cell.Cell object at 0x7f2e4d37b990> 0.000000
1 1.398369e+14 <SyMBac.cell.Cell object at 0x7f2e4d3c0610> 0.000000
2 1.398383e+14 <SyMBac.cell.Cell object at 0x7f2e4d3fe9d0> 0.000000
3 1.398368e+14 <SyMBac.cell.Cell object at 0x7f2e4cf34e50> 0.000000
4 1.398368e+14 <SyMBac.cell.Cell object at 0x7f2e4cf76cd0> 0.000000
.. ... ... ...
956 1.398365e+14 None 5.952169
957 1.398365e+14 None 39.010568
958 1.398365e+14 <SyMBac.cell.Cell object at 0x7f2e344fa0d0> 24.545813
959 1.398364e+14 <SyMBac.cell.Cell object at 0x7f2e344fa250> 0.000000
960 1.398364e+14 None 0.000000
[961 rows x 20 columns]