Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug encountered while running "sheet_from_cell_centers" function on points generated using from "sheet_from_cell_centers" #251

Closed
sniffo opened this issue Nov 17, 2021 · 2 comments

Comments

@sniffo
Copy link
Contributor

sniffo commented Nov 17, 2021

Hi there, went back to a project I started a while back with cylindrical tissues. The code used to work fine but am now encountering an error while trying to generate a cylindrical tissue. I have included the traceback as well, seems to be an issue with the __setitem__(self, key, value) function in pandas.

The code I am trying to run:

points = hexa_cylinder(30, 10, 5, noise = 0, capped = True)
 sheet = tyssue.generation.shapes.sheet_from_cell_centers(points)

Traceback:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/tmp/ipykernel_266938/1420852574.py in <module>
----> 1 sheet = tyssue.generation.shapes.sheet_from_cell_centers(points)

~/anaconda3/envs/hearttyssue/lib/python3.9/site-packages/tyssue/generation/shapes.py in sheet_from_cell_centers(points, noise, interp_s)
    376     eptm_ = Epithelium("v", dsets)
    377 
--> 378     eptm_ = single_cell(eptm_, 0)
    379 
    380     eptm = get_outer_sheet(eptm_)

~/anaconda3/envs/hearttyssue/lib/python3.9/site-packages/tyssue/utils/utils.py in single_cell(eptm, cell, copy)
    204     """
    205     edges = eptm.edge_df[eptm.edge_df["cell"] == cell].index
--> 206     return get_sub_eptm(eptm, edges, copy)
    207 
    208 

~/anaconda3/envs/hearttyssue/lib/python3.9/site-packages/tyssue/utils/utils.py in get_sub_eptm(eptm, edges, copy)
    179         sub_eptm.datasets["edge"]["cell_o"] = edge_df["cell"]
    180 
--> 181     sub_eptm.datasets["vert"]["srce_o"] = set(edge_df["srce"])
    182     sub_eptm.datasets["face"]["face_o"] = set(edge_df["face"])
    183     if "cell" in eptm.datasets:

~/anaconda3/envs/hearttyssue/lib/python3.9/site-packages/pandas/core/frame.py in __setitem__(self, key, value)
   3610         else:
   3611             # set column
-> 3612             self._set_item(key, value)
   3613 
   3614     def _setitem_slice(self, key: slice, value):

~/anaconda3/envs/hearttyssue/lib/python3.9/site-packages/pandas/core/frame.py in _set_item(self, key, value)
   3782         ensure homogeneity.
   3783         """
-> 3784         value = self._sanitize_column(value)
   3785 
   3786         if (

~/anaconda3/envs/hearttyssue/lib/python3.9/site-packages/pandas/core/frame.py in _sanitize_column(self, value)
   4508         if is_list_like(value):
   4509             com.require_length_match(value, self.index)
-> 4510         return sanitize_array(value, self.index, copy=True, allow_2d=True)
   4511 
   4512     @property

~/anaconda3/envs/hearttyssue/lib/python3.9/site-packages/pandas/core/construction.py in sanitize_array(data, index, dtype, copy, raise_cast_failure, allow_2d)
    557         if isinstance(data, (set, frozenset)):
    558             # Raise only for unordered sets, e.g., not for dict_keys
--> 559             raise TypeError(f"'{type(data).__name__}' type is unordered")
    560 
    561         # materialize e.g. generators, convert e.g. tuples, abc.ValueView

TypeError: 'set' type is unordered

Python Version: 3.9.7
Tyssue Version: 0.8.1
Pandas Version: 1.3.4

I am currently trying to work out a fix, but thought it would be useful for all to know.

@glyg
Copy link
Member

glyg commented Nov 18, 2021

Hi @sniffo thanks for the bug report - I actually fixed the issue in the zarr branch (see PR #248), I'll merge the branch today, although the work is not complete, and you can install from source then

You can see the fix here

Things are a bit hectic right now, but hopefully I'll have more time for tyssue in january

Best

Guillaume

@sniffo
Copy link
Contributor Author

sniffo commented Nov 19, 2021

Hi Guillaume,

The fix seems to work! I simply edited the source file within my conda env. Thanks for the prompt response!

@sniffo sniffo closed this as completed Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants