Skip to content

Commit

Permalink
Resolve "Hotfix pandas update"
Browse files Browse the repository at this point in the history
  • Loading branch information
c-meyer committed Feb 4, 2020
1 parent a46ed87 commit 6a5bf4c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions amfe/component/mesh_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,12 @@ def _update_mapping(self):
volume_connectivites = self._ele_obj_df.join(self._mesh.el_df, on='fk_mesh')['connectivity'].values
dofs_by_elements = [element.dofs() for element in self._ele_obj_df['ele_obj'].values]
volume_callbacks = [self.write_mapping_key]*len(dofs_by_elements)
volume_callbackargs = self._ele_obj_df.index.get_values()
volume_callbackargs = self._ele_obj_df.index.to_numpy()

boundary_connectivities = self._neumann.el_df.join(self._mesh.el_df, on='fk_mesh')['connectivity'].values
dofs_by_elements_boundary = [element.dofs() for element in self._neumann.el_df['neumann_obj'].values]
boundary_callbacks = [self._neumann.write_mapping_key]*len(dofs_by_elements_boundary)
boundary_callbackargs = self._neumann.el_df.index.get_values()
boundary_callbackargs = self._neumann.el_df.index.to_numpy()

connectivities = np.concatenate([volume_connectivites, boundary_connectivities])
dofs_by_elements.extend(dofs_by_elements_boundary)
Expand Down
2 changes: 1 addition & 1 deletion amfe/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ def update_connectivity_with_new_node(self, old_node, new_node, target_eleids):
for n_ele in target_eleids:
nodes = self.get_connectivity_by_elementids([n_ele])[0]
nodes[nodes == old_node] = int(new_node)
self._el_df.set_value(n_ele, 'connectivity', nodes)
self._el_df.at[n_ele, 'connectivity'] = nodes
self._changed_iconnectivity = True

def get_value_by_elementid_and_tag(self, ele_id, tag):
Expand Down
2 changes: 1 addition & 1 deletion docs/release/1.1.0-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ Other changes
- list of examples in doc updated
- list of packages in doc updated
- The __init__ system has been changed such that only one level downwards must be imported by the user.

- Fixed bug with deprecated pandas API. The methods get_values and set_values was replaced by .to_numpy and .at methods.
4 changes: 2 additions & 2 deletions tests/test_neumann.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def test_get_ele_obj_fk_mesh_and_fk_mapping(self):
self.neumann_man.assign_neumann_by_eleids(neumannbc, eleids, ele_shapes, tag='_eleids',
property_names=eleids, name='TestCondition')
fks = [100, 105]
local_ids = self.neumann_man.el_df.index.get_values()
local_ids = self.neumann_man.el_df.index.to_numpy()
for fk, local_id in zip(fks, local_ids):
self.neumann_man.write_mapping_key(fk, local_id)
ele_obj, fk_mesh, fk_mapping, = self.neumann_man.get_ele_obj_fk_mesh_and_fk_mapping()
Expand All @@ -161,7 +161,7 @@ def test_write_mapping(self):
property_names=eleids, name='TestCondition')
neumann_obj_df = self.neumann_man.el_df
fk = 100
local_id = neumann_obj_df.index.get_values()[0]
local_id = neumann_obj_df.index.to_numpy()[0]
self.neumann_man.write_mapping_key(fk, local_id)
actual = self.neumann_man.el_df.loc[local_id, 'fk_mapping']
self.assertEqual(actual, fk)

0 comments on commit 6a5bf4c

Please sign in to comment.