Skip to content

Commit

Permalink
pre release (#178)
Browse files Browse the repository at this point in the history
* fixes bad dtype conversion through loc / append

* pre-release, bump version number, update changelog
  • Loading branch information
glyg authored Feb 24, 2020
1 parent cb6cee9 commit 5f13a7e
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 32 deletions.
13 changes: 13 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@

- Added periodic boundary conditions support

## Generation

- adds spherical sheet and monolayers from CGAL

## Install

- CGAL-less version installable with pip

## Geometry & Dynamics

- New geometry classes
- BorderElasticity, RadialTension, and BarrierElasticity effectors
- Cell division on periodic boundary conditions

# What's new in 0.6.0

Expand Down
18 changes: 11 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
# Version management copied form numpy
# Thanks to them!
MAJOR = 0
MINOR = 6
MICRO = 9
ISRELEASED = True
MINOR = 7
MICRO = 0
ISRELEASED = False
VERSION = "%d.%d.%s" % (MAJOR, MINOR, MICRO)


Expand Down Expand Up @@ -117,12 +117,16 @@ def run(self):
try:
out = subprocess.check_output(["cmake", "--version"])
except OSError:
raise RuntimeError("CMake must be installed to build the following extensions: " +
", ".join(e.name for e in self.extensions))
raise RuntimeError(
"CMake must be installed to build the following extensions: "
+ ", ".join(e.name for e in self.extensions)
)

if platform.system() == "Windows":
cmake_version = LooseVersion(re.search(r'version\s*([\d.]+)', out.decode()).group(1))
if cmake_version < '3.1.0':
cmake_version = LooseVersion(
re.search(r"version\s*([\d.]+)", out.decode()).group(1)
)
if cmake_version < "3.1.0":
raise RuntimeError("CMake >= 3.1.0 is required on Windows")

for ext in self.extensions:
Expand Down
4 changes: 2 additions & 2 deletions setup_noarch.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
## Version management copied form numpy
## Thanks to them!
MAJOR = 0
MINOR = 6
MICRO = 8
MINOR = 7
MICRO = 0
ISRELEASED = True
VERSION = "%d.%d.%s" % (MAJOR, MINOR, MICRO)

Expand Down
13 changes: 8 additions & 5 deletions tyssue/core/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,15 @@ def record(self, to_record=None, time_stamp=None, sheet=None):
)
)
else:
if dtypes_[element].to_dict() != self.dtypes[element].to_dict():
change_type = {k: self.dtypes[element].to_dict()[k] for k in self.dtypes[element].to_dict() if k in dtypes_[
element].to_dict() and self.dtypes[element].to_dict()[k] != dtypes_[element].to_dict()[k]}
old_types = self.dtypes[element].to_dict()
new_types = dtypes_[element].to_dict()
if new_types != old_types:
changed_type = {
k: old_types[k] for k in old_types
if k in new_types and old_types[k] != new_types[k]}
raise ValueError(
"There is a change of datatype in {} table in {} columns".format(
element, change_type)
element, changed_type)
)

if (self.save_every is None) or (
Expand Down Expand Up @@ -381,4 +384,4 @@ def retrieve(self, time):
def _retrieve(dset, time):
times = dset["time"].values
t = times[np.argmin(np.abs(times - time))]
return dset[dset["time"] == t]
return dset[dset["time"] == t]
4 changes: 2 additions & 2 deletions tyssue/core/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ def __init__(self, identifier, datasets, specs=None, coords=None, maxbackup=5):
## Topology
"num_sides": 6,
## Masks
"is_alive": True},
"is_alive": 1},
"vert": {
## Coordinates
"x": 0.,
"y": 0.,
"z": 0.,
## Masks
"is_active": True},
"is_active": 1},
"edge": {
## Connections
"srce": 0,
Expand Down
10 changes: 7 additions & 3 deletions tyssue/topology/base_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def split_vert(sheet, vert, face, to_rewire, epsilon, recenter=False):
"""
# Add a vertex
sheet.vert_df = sheet.vert_df.append(sheet.vert_df.loc[vert], ignore_index=True)
this_vert = sheet.vert_df.loc[vert:vert] # avoid type munching
sheet.vert_df = sheet.vert_df.append(this_vert, ignore_index=True)
# reset datatypes
new_vert = sheet.vert_df.index[-1]
# Move it towards the face center
r_ia = sheet.face_df.loc[face, sheet.coords] - sheet.vert_df.loc[vert, sheet.coords]
Expand Down Expand Up @@ -103,9 +105,11 @@ def add_vert(eptm, edge):
(eptm.edge_df["srce"] == srce) & (eptm.edge_df["trgt"] == trgt)
]

new_vert = eptm.vert_df.loc[[srce, trgt]].mean()
new_vert = eptm.vert_df.loc[srce:srce]
eptm.vert_df = eptm.vert_df.append(new_vert, ignore_index=True)
new_vert = eptm.vert_df.index[-1]
eptm.vert_df.loc[new_vert, eptm.coords] = eptm.vert_df.loc[[srce, trgt], eptm.coords].mean()

new_edges = []

for p, p_data in parallels.iterrows():
Expand Down Expand Up @@ -155,7 +159,7 @@ def close_face(eptm, face):
print("Closing only possible with exactly two dangling vertices")
raise err

eptm.edge_df = eptm.edge_df.append(face_edges.iloc[0], ignore_index=True)
eptm.edge_df = eptm.edge_df.append(face_edges.iloc[0:1], ignore_index=True)
eptm.edge_df.index.name = "edge"
new_edge = eptm.edge_df.index[-1]
eptm.edge_df.loc[new_edge, ["srce", "trgt"]] = single_trgt, single_srce
Expand Down
4 changes: 2 additions & 2 deletions tyssue/topology/bulk_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def remove_cell(eptm, cell):
def close_cell(eptm, cell):
"""Closes the cell by adding a face. Assumes a single face is missing
"""
eptm.face_df = eptm.face_df.append(eptm.face_df.iloc[0], ignore_index=True)
eptm.face_df = eptm.face_df.append(eptm.face_df.loc[0:0], ignore_index=True)

new_face = eptm.face_df.index[-1]

Expand Down Expand Up @@ -301,7 +301,7 @@ def cell_division(eptm, mother, geom, vertices=None):
plane_center=None,
)

cell_cols = eptm.cell_df.loc[mother]
cell_cols = eptm.cell_df.loc[mother:mother]
eptm.cell_df = eptm.cell_df.append(cell_cols, ignore_index=True)
eptm.cell_df.index.name = "cell"
daughter = eptm.cell_df.index[-1]
Expand Down
22 changes: 11 additions & 11 deletions tyssue/topology/sheet_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,22 @@ def cell_division(sheet, mother, geom, angle=None):
Parameters
----------
sheet : a 'Sheet' instance
mother : face index of target dividing cell
mother : face index of target dividing cell
geom : a 2D geometry
angle : division angle for newly formed edge
Returns
-------
daughter: face index of new cell
daughter: face index of new cell
Notes
-----
- Function checks for perodic boundaries if there are, it checks if dividing cell
rests on an edge of the periodic boundaries if so, it displaces the boundaries
by a half a period and moves the target cell in the bulk of the tissue. It then
performs cell division normally and reverts the periodic boundaries to the original
- Function checks for perodic boundaries if there are, it checks if dividing cell
rests on an edge of the periodic boundaries if so, it displaces the boundaries
by a half a period and moves the target cell in the bulk of the tissue. It then
performs cell division normally and reverts the periodic boundaries to the original
configuration
"""

Expand Down Expand Up @@ -207,12 +207,12 @@ def face_division(sheet, mother, vert_a, vert_b):
"""
# mother = sheet.edge_df.loc[edge_a, 'face']

face_cols = sheet.face_df.loc[mother]
face_cols = sheet.face_df.loc[mother:mother]
sheet.face_df = sheet.face_df.append(face_cols, ignore_index=True)
sheet.face_df.index.name = "face"
daughter = int(sheet.face_df.index[-1])

edge_cols = sheet.edge_df[sheet.edge_df["face"] == mother].iloc[0]
edge_cols = sheet.edge_df[sheet.edge_df["face"] == mother].iloc[0:1]
sheet.edge_df = sheet.edge_df.append(edge_cols, ignore_index=True)
new_edge_m = sheet.edge_df.index[-1]
sheet.edge_df.loc[new_edge_m, "srce"] = vert_b
Expand Down

0 comments on commit 5f13a7e

Please sign in to comment.