Skip to content

Commit

Permalink
update pandas
Browse files Browse the repository at this point in the history
  • Loading branch information
mhangaard committed Mar 2, 2020
1 parent bef4f7e commit fe46f9c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 70 deletions.
8 changes: 4 additions & 4 deletions catlearn/featurize/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def featurize_atomic_pairs(self, candidates):
for atoms in tqdm(candidates):
# One hot encode elements.
dummies = pd.get_dummies(atoms.numbers)
d = dummies.T.reindex(self.atom_types).fillna(0).T.as_matrix()
d = dummies.T.reindex(self.atom_types).fillna(0).T.values

# Number of pairs by 1 + number of element types data matrix.
n_pairs = len(atoms) ** 2
Expand Down Expand Up @@ -272,9 +272,9 @@ def _concatenate_vec(self, atoms, vec_names):
fingerprint_vector.dtype.type is not np.str_) or
(arr.dtype.type is not np.str_ and
fingerprint_vector.dtype.type is np.str_)):
raise AssertionError("Fingerprints should be float" +
" type, and returned separately" +
" from str types.")
raise AssertionError("Fingerprints should be float" +
" type, and returned separately" +
" from str types.")
fingerprint_vector = np.concatenate((fingerprint_vector,
arr))

Expand Down
80 changes: 15 additions & 65 deletions tutorials/09_bulk_fingerprints/Voronoi_FP.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Import packages.\n",
Expand All @@ -52,17 +50,9 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"pulled 10 molecules from db\n"
]
}
],
"outputs": [],
"source": [
"# Connect the ase-db.\n",
"db = ase.db.connect('../../data/cubic_perovskites.db')\n",
Expand All @@ -81,17 +71,9 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"min: 5, mean: 5, max: 5 atoms size\n"
]
}
],
"outputs": [],
"source": [
"# Check the size of the atomic strucures.\n",
"size = []\n",
Expand All @@ -111,17 +93,9 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Generate Voronoi fingerprint of 10 structures\n"
]
}
],
"outputs": [],
"source": [
"voro = VoronoiFingerprintGenerator(alist)\n",
"data_frame = voro.generate()"
Expand All @@ -139,27 +113,11 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(10, 271)\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/raul_desktop/anaconda2/envs/py36/lib/python3.6/site-packages/ipykernel_launcher.py:1: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.\n",
" \"\"\"Entry point for launching an IPython kernel.\n"
]
}
],
"outputs": [],
"source": [
"matrix = data_frame.as_matrix()\n",
"matrix = data_frame.values\n",
"finite_numeric_data = clean_infinite(matrix)\n",
"print(np.shape(finite_numeric_data['train']))"
]
Expand All @@ -173,17 +131,9 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(10, 215)\n"
]
}
],
"outputs": [],
"source": [
"useful_data = clean_variance(finite_numeric_data['train'])\n",
"print(np.shape(useful_data['train']))"
Expand Down Expand Up @@ -213,9 +163,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
"version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
2 changes: 1 addition & 1 deletion tutorials/09_bulk_fingerprints/Voronoi_FP.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
# In[5]:


matrix = data_frame.as_matrix()
matrix = data_frame.values
finite_numeric_data = clean_infinite(matrix)
print(np.shape(finite_numeric_data['train']))

Expand Down

0 comments on commit fe46f9c

Please sign in to comment.