Skip to content

Commit

Permalink
Restructure, Reduce Test Time, Migrate MELTS to Draft
Browse files Browse the repository at this point in the history
  • Loading branch information
morganjwilliams committed Nov 12, 2018
1 parent 6ad8fa8 commit e765469
Show file tree
Hide file tree
Showing 23 changed files with 181 additions and 33 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/util/test_util_melts.py → draft/test_util_melts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
from pathlib import Path
from collections import OrderedDict
from pyrolite.util.melts import *
from .melts import *
from pyrolite.data.melts.env import MELTS_environment_variables
from pyrolite.util.general import remove_tempdir, internet_connection, \
check_perl, temp_path
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions pyrolite/data/georoc/GEOROC_CFB_Dataset_List.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
AUSTRALIA.csv
AVANAVERA LARGE IGNEOUS PROVINCE.csv
CENTRAL ATLANTIC MAGMATIC PROVINCE - CAMP.csv
CHILCOTIN PLATEAU BASALTS.csv
COMEI LARGE IGNEOUS PROVINCE.csv
DECCAN.csv
EMEISHAN.csv
ETENDEKA PROVINCE.csv
ETHIOPIAN PLATEAU.csv
FRANKLIN LARGE IGNEOUS PROVINCE.csv
GUNBARREL IGNEOUS EVENT.csv
HIGH ARCTIC LARGE IGNEOUS PROVINCE.csv
KAROO AND FERRAR PROVINCES.csv
KUONAMKA LARGE IGNEOUS PROVINCE.csv
KUZNETSK BASIN OR KUZBASS TRAPS.csv
LAKE VICTORIA LARGE IGNEOUS PROVINCE.csv
MACKENZIE LARGE IGNEOUS PROVINCE.csv
MADAGASCAR FLOOD BASALT.csv
MAIMECHA-KOTUI PROVINCE.csv
MALANI MAGMATIC PROVINCE;INDIA.csv
MARATHON LARGE IGNEOUS PROVINCE.csv
MARNDA MOORN LARGE IGNEOUS PROVINCE.csv
MATACHEWAN LARGE IGNEOUS PROVINCE.csv
MIDCONTINENT RIFT SYSTEM - KEWEENAWAN.csv
NANDALING - YANSHAN BELT.csv
NILUFER UNIT - YENISEHIR ASSOCIATION - PONTIDES.csv
NORTH ATLANTIC IGNEOUS PROVINCE OR NAIP.csv
NORTH GREENLAND PROTEROZOIC.csv
PANJAL-SOUTH QIANGTANG LARGE IGNEOUS PROVINCE.csv
PARANA.csv
QIANGTANG FLOOD BASALT PROVINCE.csv
RAJAHMUNDRY TRAPS.csv
RAJMAHAL-BENGAL-SYLHET.csv
RAMPUR-GARHWAL-MANDI-DARLA PROVINCE.csv
SIBERIAN TRAPS.csv
SOUTH TETHYAN SUTURE ZONE - PAKISTAN.csv
TARIM LARGE IGNEOUS PROVINCE.csv
TIBESTI VOLCANIC PROVINCE.csv
UMKONDO LARGE IGNEOUS PROVINCE.csv
WRANGELLIA.csv
YELLOWSTONE-SNAKE RIVER PLAIN VOLCANIC PROVINCE.csv
YEMEN PLATEAU.csv
42 changes: 42 additions & 0 deletions pyrolite/data/georoc/GEOROC_Convergent_Dataset_List.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
AEGEAN ARC.csv
AEOLIAN ARC.csv
ALEUTIAN ARC.csv
ANDEAN ARC part1.csv
ANDEAN ARC part2.csv
APENNINIC-MAGHREBIDES CHAIN.csv
BANDA ARC.csv
BETIC-RIF OROGENIC BELT OR GIBRALTAR ARC.csv
BISMARCK ARC - NEW BRITAIN ARC.csv
CASCADES.csv
CENTRAL AMERICAN VOLCANIC ARC.csv
CHAGAI-RASKOH ARC.csv
GREATER ANTILLES.csv
HALMAHERA ARC.csv
HONSHU ARC part1.csv
HONSHU ARC part2.csv
IZU-BONIN ARC.csv
KAMCHATKA ARC.csv
KERMADEC ARC.csv
KOHISTAN-LADAKH TERRANE OR GANGDISE BELT.csv
KURILE ARC.csv
KYUSHU-PALAU RIDGE.csv
LESSER ANTILLES.csv
LIGURIA-SARDO-TYRRHENIAN ARC.csv
LUZON ARC.csv
MARIANA ARC.csv
MEXICAN VOLCANIC BELTS.csv
MIDDLE AMERICA TRENCH - GUATEMALA TRENCH.csv
NEW HEBRIDES ARC - VANUATU ARCHIPELAGO.csv
NEW ZEALAND.csv
OKHOTSK-CHUKOTKA ARC.csv
RYUKYU ARC.csv
SCOTIA ARC.csv
SIKHOTE-ALIN-SAKHALIN ARC.csv
SOLOMON ISLAND ARC.csv
SULAWESI ARC.csv
SUNDA ARC.csv
TALKEETNA ARC.csv
TONGA ARC.csv
WESTERN ALPS.csv
YAP ARC.csv
YEMEN PLATEAU.csv
49 changes: 49 additions & 0 deletions pyrolite/data/georoc/GEOROC_OIB_Dataset_List.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
AHU VOLCANIC FIELD.csv
AMSTERDAM-ST PAUL.csv
ASCENSION.csv
AUSTRAL-COOK ISLANDS.csv
AZORES.csv
BALLENY ISLANDS.csv
BOUVET.csv
CAMEROON LINE.csv
CANARY ISLANDS.csv
CAPE VERDE ISLANDS.csv
CAROLINE ISLANDS.csv
CHRISTMAS ISLAND SEAMOUNT PROVINCE.csv
COCOS ISLAND.csv
COMOROS.csv
CROZET ISLANDS.csv
DESVENTURADOS ISLANDS.csv
EASTER SEAMOUNT CHAIN - SALAS Y GOMEZ RIDGE.csv
FERNANDO DE NORONHA ARCHIPELAGO.csv
GALAPAGOS ISLANDS.csv
GOUGH CHAIN.csv
HAWAIIAN-EMPEROR CHAIN.csv
HAWAIIAN ARCH VOLCANIC FIELDS.csv
HAWAIIAN ISLANDS part1.csv
HAWAIIAN ISLANDS part2.csv
HEARD.csv
ICELAND.csv
JAN MAYEN.csv
JUAN FERNANDEZ ISLANDS.csv
KERGUELEN.csv
MADEIRA ARCHIPELAGO.csv
MARION ISLANDS.csv
MARQUESAS.csv
MASCARENE ISLANDS INCL REUNION.csv
MCDONALD ISLANDS.csv
PETER I ISLAND.csv
PITCAIRN-GAMBIER CHAIN.csv
PRINCE EDWARD ISLANDS.csv
REVILLAGIGEDO ARCHIPELAGO.csv
ROSS ISLAND.csv
SAMOAN ISLANDS.csv
SCOTT ISLAND.csv
SELVAGEN ISLANDS.csv
SOCIETY ISLANDS.csv
ST HELENA CHAIN.csv
TRINDADE-VITORIA RISE.csv
TRISTAN DA CUNHA GROUP.csv
TUAMOTU ISLANDS.csv
TUPA VOLCANIC FIELD.csv
UMU VOLCANIC FIELD.csv
18 changes: 18 additions & 0 deletions pyrolite/data/georoc/GEOROC_OceanicPlateau_Dataset_List.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
BERMUDA RISE.csv
BRAZIL BASIN.csv
CAPE VERDE RISE.csv
CARIBBEAN-COLOMBIAN PLATEAU.csv
CUVIER OR WALLABY PLATEAU.csv
HESS RISE.csv
HIKURANGI PLATEAU.csv
KERGUELEN PLATEAU.csv
MAGELLAN RISE.csv
MANIHIKI PLATEAU.csv
MASCARENE PLATEAU.csv
MATSUMAE PLATEAU.csv
MAUD RISE.csv
NATURALISTE PLATEAU.csv
ONTONG JAVA.csv
RIO GRANDE RISE.csv
SAO PAULO PLATEAU.csv
SHATSKY RISE.csv
4 changes: 2 additions & 2 deletions pyrolite/geochem.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import periodictable as pt
import matplotlib.pyplot as plt
import functools
from .compositions import renormalise
from .normalisation import ReferenceCompositions, RefComp
from .comp import renormalise
from .norm import ReferenceCompositions, RefComp
from .util.text import titlecase
from .util.pd import to_frame
from .util.math import *
Expand Down
2 changes: 1 addition & 1 deletion pyrolite/normalisation.py → pyrolite/norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import platform
import pandas as pd
import numpy as np
from .compositions import *
from .comp import *
from .util.pd import to_frame, to_numeric
import logging

Expand Down
10 changes: 4 additions & 6 deletions pyrolite/util/general.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import os, sys
import subprocess
import shutil
import zipfile
import inspect
import re
from itertools import chain
import subprocess, shutil
import operator
import inspect
import zipfile
from collections import Mapping
from pathlib import Path
import numpy as np
Expand Down Expand Up @@ -36,7 +34,7 @@ def pathify(path):
if not isinstance(path, Path):
path = Path(path)
return path


def urlify(url):
"""Strip a string to return a valid URL."""
Expand Down
8 changes: 4 additions & 4 deletions pyrolite/util/georoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import re
import logging

from pyrolite.util.pd import *
from pyrolite.util.text import titlecase, parse_entry, split_records
from pyrolite.util.general import temp_path, urlify, pyrolite_datafolder, \
from ..util.pd import *
from ..util.text import titlecase, parse_entry, split_records
from ..util.general import temp_path, urlify, pyrolite_datafolder, \
pathify
from pyrolite.geochem import tochem, check_multiple_cation_inclusion, \
from ..geochem import tochem, check_multiple_cation_inclusion, \
aggregate_cation

logging.getLogger(__name__).addHandler(logging.NullHandler())
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
test=pytest

[tool:pytest]
addopts = --cov-report term-missing --cov-report html --cov-config .coveragerc --cov=pyrolite
addopts = --cov-report term-missing --cov-report html --cov-config .coveragerc --cov=pyrolite --ignore=draft

[versioneer]
VCS = git
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
import numpy as np
from pyrolite.compositions.aggregate import *
from pyrolite.comp.aggregate import *
from pyrolite.util.pd import test_df

import logging
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
import numpy as np
from pyrolite.compositions.codata import *
from pyrolite.comp.codata import *
from pyrolite.util.pd import test_df
import logging
log = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import numpy as np
import pandas as pd
from pyrolite.util.pd import test_df, test_ser
from pyrolite.compositions.aggregate import np_cross_ratios
from pyrolite.compositions.impute import *
from pyrolite.comp.aggregate import np_cross_ratios
from pyrolite.comp.impute import *


class TestPDImputeRatios(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion test/test_classification.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
from pyrolite.classification import *
from pyrolite.compositions import renormalise
from pyrolite.comp import renormalise


class TestTAS(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion test/test_geochem.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
from pyrolite.geochem import *
from pyrolite.util.pd import test_df, test_ser
from pyrolite.normalisation import ReferenceCompositions
from pyrolite.norm import ReferenceCompositions


class TestGetRadii(unittest.TestCase):
Expand Down
6 changes: 2 additions & 4 deletions test/test_normalisation.py → test/test_norm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
import pyrolite
from pyrolite.normalisation import *
from pyrolite.norm import *


class TestScaleFunction(unittest.TestCase):
Expand Down Expand Up @@ -75,12 +75,10 @@ class TestRefcomp(unittest.TestCase):

def setUp(self):
self.build_kwargs = dict(encoding='cp1252')
pyrodir = os.path.realpath(pyrolite.normalisation.__file__)
pyrodir = os.path.realpath(pyrolite.__file__)
self.dir = (Path(pyrodir).parent / "data" / "refcomp").resolve()
assert self.dir.is_dir()
self.files = [x for x in self.dir.iterdir() if x.is_file()]

print(self.dir, self.files)
self.CHfile = [f for f in self.files
if 'CH_PalmeONeill2014' in str(f)][0]

Expand Down
6 changes: 3 additions & 3 deletions test/util/test_util_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ def test_orthagonal_basis(self):
"""Checks orthagonality of the transformation basis."""
pass


class TestOPConstants(unittest.TestCase):
"""Checks the generation of orthagonal polynomial parameters."""

def setUp(self):
self.xs = np.array(get_radii(REE()))
self.default_degree = 5
self.default_degree = 4

def test_xs(self):
"""Tests operation on different x arrays."""
Expand All @@ -91,7 +91,7 @@ def test_xs(self):
def test_degree(self):
"""Tests generation of different degree polynomial parameters."""

max_degree = 5
max_degree = 4
expected = OP_constants(self.xs, degree=max_degree)
for degree in range(1, max_degree):
with self.subTest(degree=degree):
Expand Down
11 changes: 6 additions & 5 deletions test/util/test_util_plot.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import unittest
from pathlib import Path
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.axes as matax
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA

from pyrolite.comp import close
from pyrolite.util.plot import *
from pyrolite.util.general import remove_tempdir
from sklearn.decomposition import PCA
from pyrolite.compositions import close
import matplotlib
from pathlib import Path


class TestAddColorbar(unittest.TestCase):
Expand Down Expand Up @@ -162,7 +163,7 @@ def test_get_full_extent(self):

def tearDown(self):
plt.close('all')


class TestSaveFunctions(unittest.TestCase):
"""
Expand Down

0 comments on commit e765469

Please sign in to comment.