prompt
stringlengths
19
879k
completion
stringlengths
3
53.8k
api
stringlengths
8
59
""" Define the unit tests for the :mod:`colour.characterisation.correction` module. """ from __future__ import annotations import numpy as np import platform import unittest from itertools import product from numpy.linalg import LinAlgError from colour.characterisation.correction import ( matrix_augmented_Cheung2004, polynomial_expansion_Finlayson2015, polynomial_expansion_Vandermonde, matrix_colour_correction_Cheung2004, matrix_colour_correction_Finlayson2015, matrix_colour_correction_Vandermonde, colour_correction_Cheung2004, colour_correction_Finlayson2015, colour_correction_Vandermonde, ) from colour.hints import NDArray from colour.utilities import ignore_numpy_errors __author__ = "Colour Developers" __copyright__ = "Copyright 2013 Colour Developers" __license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "<EMAIL>" __status__ = "Production" __all__ = [ "MATRIX_TEST", "MATRIX_REFERENCE", "TestMatrixAugmentedCheung2004", "TestPolynomialExpansionFinlayson2015", "TestPolynomialExpansionVandermonde", "TestMatrixColourCorrectionCheung2004", "TestMatrixColourCorrectionFinlayson2015", "TestMatrixColourCorrectionVandermonde", "TestColourCorrectionCheung2004", "TestColourCorrectionFinlayson2015", "TestColourCorrectionVandermonde", ] MATRIX_TEST: NDArray = np.array( [ [0.17224810, 0.09170660, 0.06416938], [0.49189645, 0.27802050, 0.21923399], [0.10999751, 0.18658946, 0.29938611], [0.11666120, 0.14327905, 0.05713804], [0.18988879, 0.18227649, 0.36056247], [0.12501329, 0.42223442, 0.37027445], [0.64785606, 0.22396782, 0.03365194], [0.06761093, 0.11076896, 0.39779139], [0.49101797, 0.09448929, 0.11623839], [0.11622386, 0.04425753, 0.14469986], [0.36867946, 0.44545230, 0.06028681], [0.61632937, 0.32323906, 0.02437089], [0.03016472, 0.06153243, 0.29014596], [0.11103655, 0.30553067, 0.08149137], [0.41162190, 0.05816656, 0.04845934], [0.73339206, 0.53075188, 0.02475212], [0.47347718, 0.08834792, 0.30310315], [0.00000000, 0.25187016, 0.35062450], [0.76809639, 0.78486240, 0.77808297], [0.53822392, 0.54307997, 0.54710883], [0.35458526, 0.35318419, 0.35524431], [0.17976704, 0.18000531, 0.17991488], [0.09351417, 0.09510603, 0.09675027], [0.03405071, 0.03295077, 0.03702047], ] ) MATRIX_REFERENCE: NDArray = np.array( [ [0.15579559, 0.09715755, 0.07514556], [0.39113140, 0.25943419, 0.21266708], [0.12824821, 0.18463570, 0.31508023], [0.12028974, 0.13455659, 0.07408400], [0.19368988, 0.21158946, 0.37955964], [0.19957424, 0.36085439, 0.40678123], [0.48896605, 0.20691688, 0.05816533], [0.09775522, 0.16710693, 0.47147724], [0.39358649, 0.12233400, 0.10526425], [0.10780332, 0.07258529, 0.16151473], [0.27502671, 0.34705454, 0.09728099], [0.43980441, 0.26880559, 0.05430533], [0.05887212, 0.11126272, 0.38552469], [0.12705825, 0.25787860, 0.13566464], [0.35612929, 0.07933258, 0.05118732], [0.48131976, 0.42082843, 0.07120612], [0.34665585, 0.15170714, 0.24969804], [0.08261116, 0.24588716, 0.48707733], [0.66054904, 0.65941137, 0.66376412], [0.48051509, 0.47870296, 0.48230082], [0.33045354, 0.32904184, 0.33228886], [0.18001305, 0.17978567, 0.18004416], [0.10283975, 0.10424680, 0.10384975], [0.04742204, 0.04772203, 0.04914226], ] ) class TestMatrixAugmentedCheung2004(unittest.TestCase): """ Define :func:`colour.characterisation.correction.\ matrix_augmented_Cheung2004` definition unit tests methods. """ def test_matrix_augmented_Cheung2004(self): """ Test :func:`colour.characterisation.correction.\ matrix_augmented_Cheung2004` definition. """ RGB = np.array([0.17224810, 0.09170660, 0.06416938]) polynomials = [ np.array([0.17224810, 0.09170660, 0.06416938]), np.array( [0.17224810, 0.09170660, 0.06416938, 0.00101364, 1.00000000] ), np.array( [ 0.17224810, 0.09170660, 0.06416938, 0.01579629, 0.01105305, 0.00588476, 1.00000000, ] ), np.array( [ 0.17224810, 0.09170660, 0.06416938, 0.01579629, 0.01105305, 0.00588476, 0.00101364, 1.00000000, ] ), np.array( [ 0.17224810, 0.09170660, 0.06416938, 0.01579629, 0.01105305, 0.00588476, 0.02966941, 0.00841010, 0.00411771, 1.00000000, ] ), np.array( [ 0.17224810, 0.09170660, 0.06416938, 0.01579629, 0.01105305, 0.00588476, 0.02966941, 0.00841010, 0.00411771, 0.00101364, 1.00000000, ] ), np.array( [ 0.17224810, 0.09170660, 0.06416938, 0.01579629, 0.01105305, 0.00588476, 0.02966941, 0.00841010, 0.00411771, 0.00101364, 0.00511050, 0.00077126, 0.00026423, 1.00000000, ] ), np.array( [ 0.17224810, 0.09170660, 0.06416938, 0.01579629, 0.01105305, 0.00588476, 0.02966941, 0.00841010, 0.00411771, 0.00101364, 0.00272088, 0.00053967, 0.00070927, 0.00511050, 0.00077126, 0.00026423, ] ), np.array( [ 0.17224810, 0.09170660, 0.06416938, 0.01579629, 0.01105305, 0.00588476, 0.02966941, 0.00841010, 0.00411771, 0.00101364, 0.00272088, 0.00053967, 0.00070927, 0.00511050, 0.00077126, 0.00026423, 1.00000000, ] ), np.array( [ 0.17224810, 0.09170660, 0.06416938, 0.01579629, 0.01105305, 0.00588476, 0.02966941, 0.00841010, 0.00411771, 0.00101364, 0.00272088, 0.00053967, 0.00070927, 0.00190387, 0.00144862, 0.00037762, 0.00511050, 0.00077126, 0.00026423, ] ), np.array( [ 0.17224810, 0.09170660, 0.06416938, 0.01579629, 0.01105305, 0.00588476, 0.02966941, 0.00841010, 0.00411771, 0.00101364, 0.00272088, 0.00053967, 0.00070927, 0.00190387, 0.00144862, 0.00037762, 0.00511050, 0.00077126, 0.00026423, 1.00000000, ] ), np.array( [ 0.17224810, 0.09170660, 0.06416938, 0.01579629, 0.01105305, 0.00588476, 0.02966941, 0.00841010, 0.00411771, 0.00101364, 0.00272088, 0.00053967, 0.00070927, 0.00190387, 0.00144862, 0.00037762, 0.00511050, 0.00077126, 0.00026423, 0.00017460, 0.00009296, 0.00006504, ] ), ] for i, terms in enumerate( [3, 5, 7, 8, 10, 11, 14, 16, 17, 19, 20, 22] ): np.testing.assert_almost_equal( matrix_augmented_Cheung2004(RGB, terms), polynomials[i], decimal=7, ) def test_raise_exception_matrix_augmented_Cheung2004(self): """ Test :func:`colour.characterisation.correction.\ matrix_augmented_Cheung2004` definition raised exception. """ self.assertRaises( ValueError, matrix_augmented_Cheung2004, np.array([0.17224810, 0.09170660, 0.06416938]), 4, ) @ignore_numpy_errors def test_nan_matrix_augmented_Cheung2004(self): """ Test :func:`colour.characterisation.correction.\ matrix_augmented_Cheung2004` definition nan support. """ cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = np.array(list(set(product(cases, repeat=3)))) matrix_augmented_Cheung2004(cases) class TestPolynomialExpansionFinlayson2015(unittest.TestCase): """ Define :func:`colour.characterisation.correction.\ polynomial_expansion_Finlayson2015` definition unit tests methods. """ def test_polynomial_expansion_Finlayson2015(self): """ Test :func:`colour.characterisation.correction.\ polynomial_expansion_Finlayson2015` definition. """ RGB = np.array([0.17224810, 0.09170660, 0.06416938]) polynomials = [ [ np.array([0.17224810, 0.09170660, 0.06416938]), np.array([0.17224810, 0.09170660, 0.06416938]), ], [ np.array( [ 0.17224810, 0.09170660, 0.06416938, 0.02966941, 0.00841010, 0.00411771, 0.01579629, 0.00588476, 0.01105305, ] ), np.array( [ 0.17224810, 0.09170660, 0.06416938, 0.12568328, 0.07671216, 0.10513350, ] ), ], [ np.array( [ 0.17224810, 0.09170660, 0.06416938, 0.02966941, 0.00841010, 0.00411771, 0.01579629, 0.00588476, 0.01105305, 0.00511050, 0.00077126, 0.00026423, 0.00144862, 0.00037762, 0.00070927, 0.00272088, 0.00053967, 0.00190387, 0.00101364, ] ), np.array( [ 0.17224810, 0.09170660, 0.06416938, 0.12568328, 0.07671216, 0.10513350, 0.11314930, 0.07228010, 0.08918053, 0.13960570, 0.08141598, 0.12394021, 0.10045255, ] ), ], [ np.array( [ 0.17224810, 0.09170660, 0.06416938, 0.02966941, 0.00841010, 0.00411771, 0.01579629, 0.00588476, 0.01105305, 0.00511050, 0.00077126, 0.00026423, 0.00144862, 0.00037762, 0.00070927, 0.00272088, 0.00053967, 0.00190387, 0.00101364, 0.00088027, 0.00007073, 0.00001696, 0.00046867, 0.00032794, 0.00013285, 0.00004949, 0.00004551, 0.00002423, 0.00024952, 0.00003463, 0.00012217, 0.00017460, 0.00009296, 0.00006504, ] ), np.array( [ 0.17224810, 0.09170660, 0.06416938, 0.12568328, 0.07671216, 0.10513350, 0.11314930, 0.07228010, 0.08918053, 0.13960570, 0.08141598, 0.12394021, 0.10045255, 0.14713499, 0.13456986, 0.10735915, 0.08387498, 0.08213618, 0.07016104, 0.11495009, 0.09819082, 0.08980545, ] ), ], ] for i in range(4): np.testing.assert_almost_equal( polynomial_expansion_Finlayson2015(RGB, i + 1, False), polynomials[i][0], decimal=7, ) np.testing.assert_almost_equal( polynomial_expansion_Finlayson2015(RGB, i + 1, True), polynomials[i][1], decimal=7, ) def test_raise_exception_polynomial_expansion_Finlayson2015(self): """ Test :func:`colour.characterisation.correction.\ polynomial_expansion_Finlayson2015` definition raised exception. """ self.assertRaises( ValueError, polynomial_expansion_Finlayson2015, np.array([0.17224810, 0.09170660, 0.06416938]), 5, ) @ignore_numpy_errors def test_nan_polynomial_expansion_Finlayson2015(self): """ Test :func:`colour.characterisation.correction.\ polynomial_expansion_Finlayson2015` definition nan support. """ cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = np.array(list(set(product(cases, repeat=3)))) polynomial_expansion_Finlayson2015(cases) class TestPolynomialExpansionVandermonde(unittest.TestCase): """ Define :func:`colour.characterisation.correction.\ polynomial_expansion_Vandermonde` definition unit tests methods. """ def test_polynomial_expansion_Vandermonde(self): """ Test :func:`colour.characterisation.correction.\ polynomial_expansion_Vandermonde` definition. """ RGB = np.array([0.17224810, 0.09170660, 0.06416938]) polynomials = [ np.array([0.17224810, 0.09170660, 0.06416938, 1.00000000]), np.array( [ 0.02966941, 0.00841010, 0.00411771, 0.17224810, 0.09170660, 0.06416938, 1.00000000, ] ), np.array( [ 0.00511050, 0.00077126, 0.00026423, 0.02966941, 0.00841010, 0.00411771, 0.17224810, 0.09170660, 0.06416938, 1.00000000, ] ), np.array( [ 0.00088027, 0.00007073, 0.00001696, 0.00511050, 0.00077126, 0.00026423, 0.02966941, 0.00841010, 0.00411771, 0.17224810, 0.09170660, 0.06416938, 1.00000000, ] ), ] for i in range(4): np.testing.assert_almost_equal( polynomial_expansion_Vandermonde(RGB, i + 1), polynomials[i], decimal=7, ) @ignore_numpy_errors def test_nan_polynomial_expansion_Vandermonde(self): """ Test :func:`colour.characterisation.correction.\ polynomial_expansion_Vandermonde` definition nan support. """ cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = np.array(list(set(product(cases, repeat=3)))) polynomial_expansion_Vandermonde(cases) class TestMatrixColourCorrectionCheung2004(unittest.TestCase): """ Define :func:`colour.characterisation.correction.\ matrix_colour_correction_Cheung2004` definition unit tests methods. """ def test_matrix_colour_correction_Cheung2004(self): """ Test :func:`colour.characterisation.correction.\ matrix_colour_correction_Cheung2004` definition. """ np.testing.assert_almost_equal( matrix_colour_correction_Cheung2004(MATRIX_TEST, MATRIX_REFERENCE), np.array( [ [0.69822661, 0.03071629, 0.16210422], [0.06893498, 0.67579611, 0.16430385], [-0.06314956, 0.09212471, 0.97134152], ] ), decimal=7, ) np.testing.assert_almost_equal( matrix_colour_correction_Cheung2004( MATRIX_TEST, MATRIX_REFERENCE, terms=7 ), np.array( [ [ 0.80512769, 0.04001012, -0.01255261, -0.41056170, -0.28052094, 0.68417697, 0.02251728, ], [ 0.03270288, 0.71452384, 0.17581905, -0.00897913, 0.04900199, -0.17162742, 0.01688472, ], [ -0.03973098, -0.07164767, 1.16401636, 0.29017859, -0.88909018, 0.26675507, 0.02345109, ], ] ), decimal=7, ) @ignore_numpy_errors def test_nan_matrix_colour_correction_Cheung2004(self): # pragma: no cover """ Test :func:`colour.characterisation.correction.\ matrix_colour_correction_Cheung2004` definition nan support. """ # NOTE: Hangs on "Linux". if platform.system() == "Linux": return cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = np.array(list(set(product(cases, repeat=3)))) for case in cases: try: matrix_colour_correction_Cheung2004( np.vstack([case, case, case]), np.transpose(np.vstack([case, case, case])), ) except LinAlgError: pass class TestMatrixColourCorrectionFinlayson2015(unittest.TestCase): """ Define :func:`colour.characterisation.correction.\ matrix_colour_correction_Finlayson2015` definition unit tests methods. """ def test_matrix_colour_correction_Finlayson2015(self): """ Test :func:`colour.characterisation.correction.\ matrix_colour_correction_Finlayson2015` definition. """ np.testing.assert_almost_equal( matrix_colour_correction_Finlayson2015( MATRIX_TEST, MATRIX_REFERENCE ), np.array( [ [0.69822661, 0.03071629, 0.16210422], [0.06893498, 0.67579611, 0.16430385], [-0.06314956, 0.09212471, 0.97134152], ] ), decimal=7, ) np.testing.assert_almost_equal( matrix_colour_correction_Finlayson2015( MATRIX_TEST, MATRIX_REFERENCE, degree=3 ), np.array( [ [ 2.87796213, 9.85720054, 2.99863978, 76.97227806, 73.73571500, -49.37563169, -48.70879206, -47.53280959, 29.88241815, -39.82871801, -37.11388282, 23.30393209, 3.81579802, ], [ -0.78448243, 5.63631335, 0.95306110, 14.19762287, 20.60124427, -18.05512861, -14.52994195, -13.10606336, 10.53666341, -3.63132534, -12.49672335, 8.17401039, 3.37995231, ], [ -2.39092600, 10.57193455, 4.16361285, 23.41748866, 58.26902059, -39.39669827, -26.63805785, -35.98397757, 21.25508558, -4.12726077, -34.31995017, 18.72796247, 7.33531009, ], ] ), decimal=7, ) @ignore_numpy_errors def test_nan_matrix_colour_correction_Finlayson2015( self, ): # pragma: no cover """ Test :func:`colour.characterisation.correction.\ matrix_colour_correction_Finlayson2015` definition nan support. """ # NOTE: Hangs on "Linux". if platform.system() == "Linux": return cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = np.array(list(set(product(cases, repeat=3)))) for case in cases: try: matrix_colour_correction_Finlayson2015( np.vstack([case, case, case]), np.transpose(np.vstack([case, case, case])), ) except LinAlgError: pass class TestMatrixColourCorrectionVandermonde(unittest.TestCase): """ Define :func:`colour.characterisation.correction.\ matrix_colour_correction_Vandermonde` definition unit tests methods. """ def test_matrix_colour_correction_Vandermonde(self): """ Test :func:`colour.characterisation.correction.\ matrix_colour_correction_Vandermonde` definition. """ np.testing.assert_almost_equal( matrix_colour_correction_Vandermonde( MATRIX_TEST, MATRIX_REFERENCE ), np.array( [ [0.66770040, 0.02514036, 0.12745797, 0.02485425], [0.03155494, 0.66896825, 0.12187874, 0.03043460], [-0.14502258, 0.07716975, 0.87841836, 0.06666049], ] ), decimal=7, ) np.testing.assert_almost_equal( matrix_colour_correction_Vandermonde( MATRIX_TEST, MATRIX_REFERENCE, degree=3 ), np.array( [ [ -0.04328223, -1.87886146, 1.83369170, -0.10798116, 1.06608177, -0.87495813, 0.75525839, -0.08558123, 0.15919076, 0.02404598, ], [ 0.00998152, 0.44525275, -0.53192490, 0.00904507, -0.41034458, 0.36173334, 0.02904178, 0.78362950, 0.07894900, 0.01986479, ], [ -1.66921744, 3.62954420, -2.96789849, 2.31451409, -3.10767297, 1.85975390, -0.98795093, 0.85962796, 0.63591240, 0.07302317, ], ] ), decimal=7, ) @ignore_numpy_errors def test_nan_matrix_colour_correction_Vandermonde( self, ): # pragma: no cover """ Test :func:`colour.characterisation.correction.\ matrix_colour_correction_Vandermonde` definition nan support. """ # NOTE: Hangs on "Linux". if platform.system() == "Linux": return cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = np.array(list(set(product(cases, repeat=3)))) for case in cases: try: matrix_colour_correction_Vandermonde( np.vstack([case, case, case]), np.transpose(np.vstack([case, case, case])), ) except LinAlgError: pass class TestColourCorrectionCheung2004(unittest.TestCase): """ Define :func:`colour.characterisation.correction.\ colour_correction_Cheung2004` definition unit tests methods. """ def test_colour_correction_Cheung2004(self): """ Test :func:`colour.characterisation.correction.\ colour_correction_Cheung2004` definition. """ RGB = np.array([0.17224810, 0.09170660, 0.06416938]) np.testing.assert_almost_equal( colour_correction_Cheung2004(RGB, MATRIX_TEST, MATRIX_REFERENCE), np.array([0.13348722, 0.08439216, 0.05990144]), decimal=7, ) np.testing.assert_almost_equal( colour_correction_Cheung2004( RGB, MATRIX_TEST, MATRIX_REFERENCE, terms=7 ), np.array([0.15850295, 0.09871628, 0.08105752]), decimal=7, ) def test_n_dimensional_colour_correction_Cheung2004(self): """ Test :func:`colour.characterisation.correction.\ colour_correction_Cheung2004` definition n-dimensional support. """ RGB = np.array([0.17224810, 0.09170660, 0.06416938]) RGB_c = colour_correction_Cheung2004( RGB, MATRIX_TEST, MATRIX_REFERENCE ) RGB = np.tile(RGB, (6, 1)) RGB_c =
np.tile(RGB_c, (6, 1))
numpy.tile
from scipy.special import multigammaln from scipy.special import psi import numpy as np import numpy.matlib from ars import ARS from collections import Counter def fbeta(x, s=[0.5,1.5], w=1.5): ''' logbetapdf ''' k = len(s) return -k * multigammaln(x / 2, 1) - 1 / (2 * x) + \ (k * x - 3) / 2 * np.log(x / 2) + \ (x / 2) * np.sum(np.add(np.log(w), np.log(s))) - x * np.sum(np.multiply(s, w / 2)) def fbetaprima(x, s=[0.5,1.5],w=1.5): ''' logbetapdfprime ''' k = len(s) return -k/2*psi(x/2)+1/(2*(x**2))+k/2*np.log(x/2)+(k*x-3)/(2*x)+\ np.sum(np.subtract(np.add(
np.log(s)
numpy.log
from sklearn.model_selection import KFold from sklearn.metrics import mean_squared_error, mean_absolute_error import numpy as np import torch from torch.nn import functional as F from data_handler import add_unknown_filler_labels from torch.distributions.normal import Normal def predict_downstream(X, y, X_val, y_val, model, downstream_model=None, labels_val=[None], labels_train=[None], cv=10, seed=None): np.random.seed(seed) assert downstream_model != None, "Please specify downstream model" ae = [] se = [] try: X, _ = model.pretrained_model.encoder(X, labels_train) X_val, _ = model.pretrained_model.encoder(X_val, labels_val) except: AttributeError if len(X_val) == 0: kf = KFold(n_splits=cv) for train_index, test_index in kf.split(X): if type(labels_train[0]) != type(None): labels_training = labels_train[train_index] labels_test = labels_train[test_index] else: labels_training = labels_train labels_test = [None] X_train, X_test = X[train_index], X[test_index] y_train, y_test = y[train_index], y[test_index] encoded_X_train, _ = model.encoder(X_train, labels_training)#.cuda() if torch.cuda.is_available() else model.encoder(X_train, labels_training) encoded_X_test, _ = model.encoder(X_test, labels_test)#.cuda() if torch.cuda.is_available() else model.encoder(X_test, labels_test) downstream_model.fit(encoded_X_train.cpu().detach().numpy(), y_train) pred = downstream_model.predict(encoded_X_test.cpu().detach().numpy()) se.append(mean_squared_error(pred, y_test)) ae.append(mean_absolute_error(pred, y_test)) else: encoded_X_train, _ = model.encoder(X, labels_train) encoded_X_test, _ = model.encoder(X_val, labels_val) downstream_model.fit(encoded_X_train.cpu().detach().numpy(), y) pred = downstream_model.predict(encoded_X_test.cpu().detach().numpy()) se.append(mean_squared_error(pred, y_val)) ae.append(mean_absolute_error(pred, y_val)) mse = np.mean(se) mae = np.mean(ae) mse_std =
np.std(se, ddof=1)
numpy.std
import pandas as pd import numpy as np class CorrectBias(object): def __init__(self, taper_width, npv_observations): self.taper_width = taper_width self.sampled_controls_loc, self.sampled_controls_beta = self.get_data(npv_observations) self.est_mean_alpha = np.mean(self.sampled_controls_beta) def get_data(self, obs_data): """ obs_data: col_1 = random control; col_2 = npv obtained from a single model realization (random controls applied to different realizations) col_3 = npv obtained from mean model """ # get a list of sampled controls from .csv files action_name = obs_data["control"] action_list = list() for action_index in range(0, action_name.size): temp_seq = action_name[action_index] temp_seq = temp_seq[1:-1].split(",") temp_seq = [it.replace(" ", "")[1:-1] for it in temp_seq] action_list.append(temp_seq) # compute partial correction factor beta f sampled_controls_beta = obs_data["individual_realization"].to_numpy() / obs_data["mean_model"].to_numpy() # compute well-position based location for all sampled random drilling sequences sampled_controls_loc = self.get_loc_multiple(action_list) return sampled_controls_loc, sampled_controls_beta def get_loc_multiple(self, action_list): ref_order = ['OP_1', 'OP_2', 'OP_3', 'OP_4', 'OP_5', 'WI_1', 'WI_2', 'WI_3'] all_locations = np.zeros((len(action_list), 8)) for action_index in range(0, len(action_list)): temp_action = action_list[action_index] if temp_action[0] == '': temp_order = [1] * len(ref_order) all_locations[action_index, :] = temp_order else: temp_order = [len(temp_action) + 1] * len(ref_order) temp_order = np.array(temp_order) upd_order = list(range(1, len(temp_action) + 1)) upd_order = np.array(upd_order) order_index = [] for j in range(0, len(temp_action)): get_index = ref_order.index(temp_action[j]) order_index.append(get_index) order_index = np.array(order_index) temp_order[order_index] = upd_order temp_order = np.reshape(temp_order, (1, 8)) all_locations[action_index, :] = temp_order return all_locations # compute location for a set of random drilling sequences def get_loc_single(self, seq_action): """ # permutation encodings: ref., ['OP_1', 'OP_2', 'OP_3', 'OP_4', 'OP_5', 'WI_1', 'WI_2', 'WI_3'] -> [1 , 2 , 3 , 4, 5, 6, 7, 8]; if input = ['WI_3', 'OP_5', 'OP_3', 'OP_1', 'OP_4', 'WI_2', 'OP_2', 'WI_1'] output = [4 , 7 , 3 , 5, 2, 8, 6, 1]; """ ref_order = ['OP_1', 'OP_2', 'OP_3', 'OP_4', 'OP_5', 'WI_1', 'WI_2', 'WI_3'] loc_seq = np.zeros((1, 8)) temp_action = seq_action temp_order = [len(temp_action) + 1] * len(ref_order) temp_order = np.array(temp_order) upd_order = list(range(1, len(temp_action) + 1)) upd_order = np.array(upd_order) order_index = [] if temp_action == []: temp_order = [1] * len(ref_order) loc_seq[0, :] = temp_order else: for j in range(0, len(temp_action)): get_index = ref_order.index(temp_action[j]) order_index.append(get_index) order_index = np.array(order_index) temp_order[order_index] = upd_order temp_order = np.reshape(temp_order, (1, 8)) loc_seq[0, :] = temp_order return loc_seq # def gaspari_cohn(self, distance_values): distance_range = self.taper_width weight_values = np.zeros(distance_values.shape[0], ) z = distance_values / distance_range index_1 = np.where(z <= 1)[0] index_2 = np.where(z <= 2)[0] index_12 = np.setdiff1d(index_2, index_1) weight_values[index_1] = - (z[index_1] ** 5) / 4 + (z[index_1] ** 4) / 2 + (z[index_1] ** 3) * (5 / 8) - ( z[index_1] ** 2) * (5 / 3) + 1 weight_values[index_12] = (z[index_12] ** 5) / 12 - (z[index_12] ** 4) / 2 + (z[index_12] ** 3) * (5 / 8) + ( z[index_12] ** 2) * (5 / 3) - z[index_12] * 5 + 4 - (z[index_12] ** -1) * (2 / 3) return weight_values def cal_distance(self, est_control_loc): """ ref_seq_loc: location for estimation point ( return: a list of distance between estimation point """ # sampled_control_loc = self.selected_seq_loc # compute distance between estimation point and all sampled control dist_each =
np.abs(self.sampled_controls_loc - est_control_loc)
numpy.abs
# -*- coding: utf-8 -*- # test_imagecodecs.py # Copyright (c) 2018-2019, <NAME> # Copyright (c) 2018-2019, The Regents of the University of California # Produced at the Laboratory for Fluorescence Dynamics # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the copyright holders nor the names of any # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. """Unittests for the imagecodecs package. :Author: `<NAME> <https://www.lfd.uci.edu/~gohlke/>`_ :Organization: Laboratory for Fluorescence Dynamics. University of California, Irvine :License: 3-clause BSD :Version: 2019.12.3 """ from __future__ import division, print_function import sys import os import io import re import glob import tempfile import os.path as osp import pytest import numpy from numpy.testing import assert_array_equal, assert_allclose try: import tifffile except ImportError: tifffile = None try: import czifile except ImportError: czifile = None if ( 'imagecodecs_lite' in os.getcwd() or osp.exists(osp.join(osp.dirname(__file__), '..', 'imagecodecs_lite')) ): try: import imagecodecs_lite as imagecodecs from imagecodecs_lite import _imagecodecs_lite # noqa from imagecodecs_lite import imagecodecs as imagecodecs_py except ImportError: pytest.exit('the imagecodec-lite package is not installed') lzma = zlib = bz2 = zstd = lz4 = lzf = blosc = bitshuffle = None _jpeg12 = _jpegls = _zfp = None else: try: import imagecodecs import imagecodecs.imagecodecs as imagecodecs_py from imagecodecs.imagecodecs import (lzma, zlib, bz2, zstd, lz4, lzf, blosc, bitshuffle) from imagecodecs import _imagecodecs # noqa except ImportError: pytest.exit('the imagecodec package is not installed') try: from imagecodecs import _jpeg12 except ImportError: _jpeg12 = None try: from imagecodecs import _jpegls except ImportError: _jpegls = None try: from imagecodecs import _zfp except ImportError: _zfp = None IS_PY2 = sys.version_info[0] == 2 IS_32BIT = sys.maxsize < 2**32 TEST_DIR = osp.dirname(__file__) class TempFileName(): """Temporary file name context manager.""" def __init__(self, name=None, suffix='', remove=True): self.remove = bool(remove) if not name: self.name = tempfile.NamedTemporaryFile(prefix='test_', suffix=suffix).name else: self.name = osp.join(tempfile.gettempdir(), 'test_%s%s' % (name, suffix)) def __enter__(self): return self.name def __exit__(self, exc_type, exc_value, traceback): if self.remove: try: os.remove(self.name) except Exception: pass def test_version(): """Assert imagecodecs versions match docstrings.""" ver = ':Version: ' + imagecodecs.__version__ assert ver in __doc__ assert ver in imagecodecs.__doc__ assert imagecodecs.version().startswith('imagecodecs') assert ver in imagecodecs_py.__doc__ if zlib: assert imagecodecs.version(dict)['zlib'].startswith('1.') @pytest.mark.skipif(not hasattr(imagecodecs, 'imread'), reason='imread function missing') @pytest.mark.filterwarnings('ignore:Possible precision loss') def test_imread_imwrite(): """Test imread and imwrite functions.""" imread = imagecodecs.imread imwrite = imagecodecs.imwrite data = image_data('rgba', 'uint8') # codec from file extension with TempFileName(suffix='.npy') as filename: imwrite(filename, data, level=99) im, codec = imread(filename, return_codec=True) assert codec == imagecodecs.numpy_decode assert_array_equal(data, im) with TempFileName() as filename: # codec from name imwrite(filename, data, codec='numpy') im = imread(filename, codec='npy') assert_array_equal(data, im) # codec from function imwrite(filename, data, codec=imagecodecs.numpy_encode) im = imread(filename, codec=imagecodecs.numpy_decode) assert_array_equal(data, im) # codec from name list im = imread(filename, codec=['npz']) assert_array_equal(data, im) # autodetect im = imread(filename) assert_array_equal(data, im) # fail with pytest.raises(ValueError): imwrite(filename, data) with pytest.raises(ValueError): im = imread(filename, codec='unknown') def test_none(): """Test NOP codec.""" encode = imagecodecs.none_encode decode = imagecodecs.none_decode data = b'None' assert encode(data) is data assert decode(data) is data def test_bitorder(): """Test BitOrder codec with bytes.""" decode = imagecodecs.bitorder_decode data = b'\x01\x00\x9a\x02' reverse = b'\x80\x00Y@' # return new string assert decode(data) == reverse assert data == b'\x01\x00\x9a\x02' # provide output out = bytearray(len(data)) decode(data, out=out) assert out == reverse assert data == b'\x01\x00\x9a\x02' # inplace decode(data, out=data) assert data == reverse # bytes range assert BYTES == decode(readfile('bytes.bitorder.bin')) def test_bitorder_ndarray(): """Test BitOrder codec with ndarray.""" decode = imagecodecs.bitorder_decode data = numpy.array([1, 666], dtype='uint16') reverse = numpy.array([128, 16473], dtype='uint16') # return new array assert_array_equal(decode(data), reverse) # inplace decode(data, out=data) assert_array_equal(data, numpy.array([128, 16473], dtype='uint16')) # array view data = numpy.array([[1, 666, 1431655765, 62], [2, 667, 2863311530, 32], [3, 668, 1431655765, 30]], dtype='uint32') reverse = numpy.array([[1, 666, 1431655765, 62], [2, 16601, 1431655765, 32], [3, 16441, 2863311530, 30]], dtype='uint32') assert_array_equal(decode(data[1:, 1:3]), reverse[1:, 1:3]) # array view inplace decode(data[1:, 1:3], out=data[1:, 1:3]) assert_array_equal(data, reverse) def test_packints_decode(): """Test PackInts decoder.""" decode = imagecodecs.packints_decode decoded = decode(b'', 'B', 1) assert len(decoded) == 0 decoded = decode(b'a', 'B', 1) assert tuple(decoded) == (0, 1, 1, 0, 0, 0, 0, 1) decoded = decode(b'ab', 'B', 2) assert tuple(decoded) == (1, 2, 0, 1, 1, 2, 0, 2) decoded = decode(b'abcd', 'B', 3) assert tuple(decoded) == (3, 0, 2, 6, 1, 1, 4, 3, 3, 1) decoded = decode(numpy.frombuffer(b'abcd', dtype='uint8'), 'B', 3) assert tuple(decoded) == (3, 0, 2, 6, 1, 1, 4, 3, 3, 1) PACKBITS_DATA = [ (b'', b''), (b'X', b'\x00X'), (b'123', b'\x02123'), (b'112112', b'\xff1\x002\xff1\x002'), (b'1122', b'\xff1\xff2'), (b'1' * 126, b'\x831'), (b'1' * 127, b'\x821'), (b'1' * 128, b'\x811'), (b'1' * 127 + b'foo', b'\x821\x00f\xffo'), (b'12345678' * 16, # literal 128 b'\x7f1234567812345678123456781234567812345678123456781234567812345678' b'1234567812345678123456781234567812345678123456781234567812345678'), (b'12345678' * 17, b'~1234567812345678123456781234567812345678123456781234567812345678' b'123456781234567812345678123456781234567812345678123456781234567\x08' b'812345678'), (b'1' * 128 + b'12345678' * 17, b'\x821\xff1~2345678123456781234567812345678123456781234567812345678' b'1234567812345678123456781234567812345678123456781234567812345678' b'12345678\x0712345678'), (b'\xaa\xaa\xaa\x80\x00\x2a\xaa\xaa\xaa\xaa\x80\x00' b'\x2a\x22\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa', b'\xfe\xaa\x02\x80\x00\x2a\xfd\xaa\x03\x80\x00\x2a\x22\xf7\xaa')] @pytest.mark.parametrize('data', range(len(PACKBITS_DATA))) @pytest.mark.parametrize('codec', ['encode', 'decode']) def test_packbits(codec, data): """Test PackBits codec.""" encode = imagecodecs.packbits_encode decode = imagecodecs.packbits_decode uncompressed, compressed = PACKBITS_DATA[data] if codec == 'decode': assert decode(compressed) == uncompressed elif codec == 'encode': try: assert encode(uncompressed) == compressed except AssertionError: # roundtrip assert decode(encode(uncompressed)) == uncompressed def test_packbits_nop(): """Test PackBits decoding empty data.""" decode = imagecodecs.packbits_decode assert decode(b'\x80') == b'' assert decode(b'\x80\x80') == b'' @pytest.mark.parametrize('output', [None, 'array']) @pytest.mark.parametrize('codec', ['encode', 'decode']) def test_packbits_array(codec, output): """Test PackBits codec with arrays.""" encode = imagecodecs.packbits_encode decode = imagecodecs.packbits_decode uncompressed, compressed = PACKBITS_DATA[-1] shape = (2, 7, len(uncompressed)) data = numpy.empty(shape, dtype='uint8') data[..., :] = numpy.frombuffer(uncompressed, dtype='uint8') compressed = compressed * (shape[0] * shape[1]) if codec == 'encode': if output == 'array': out = numpy.empty(data.size, data.dtype) assert_array_equal(encode(data, out=out), numpy.frombuffer(compressed, dtype='uint8')) else: assert encode(data) == compressed else: if output == 'array': out = numpy.empty(data.size, data.dtype) assert_array_equal(decode(compressed, out=out), data.flat) else: assert decode(compressed) == data.tobytes() @pytest.mark.parametrize('output', ['new', 'out', 'inplace']) @pytest.mark.parametrize('codec', ['encode', 'decode']) @pytest.mark.parametrize( 'kind', ['u1', 'u2', 'u4', 'u8', 'i1', 'i2', 'i4', 'i8', 'f4', 'f8', 'B', pytest.param('b', marks=pytest.mark.skipif( sys.version_info[0] == 2, reason='Python 2'))]) @pytest.mark.parametrize('func', ['delta', 'xor']) def test_delta(output, kind, codec, func): """Test Delta codec.""" if func == 'delta': encode = imagecodecs.delta_encode decode = imagecodecs.delta_decode encode_py = imagecodecs_py.delta_encode # decode_py = imagecodecs_py.imagecodecs.delta_decode elif func == 'xor': encode = imagecodecs.xor_encode decode = imagecodecs.xor_decode encode_py = imagecodecs_py.xor_encode # decode_py = imagecodecs_py.imagecodecs.xor_decode bytetype = bytearray if kind == 'b': bytetype = bytes kind = 'B' axis = -2 # do not change dtype = numpy.dtype(kind) if kind[0] in 'iuB': low = numpy.iinfo(dtype).min high = numpy.iinfo(dtype).max data = numpy.random.randint(low, high, size=33 * 31 * 3, dtype=dtype).reshape(33, 31, 3) else: low, high = -1e5, 1e5 data = numpy.random.randint(low, high, size=33 * 31 * 3, dtype='i4').reshape(33, 31, 3) data = data.astype(dtype) data[16, 14] = [0, 0, 0] data[16, 15] = [low, high, low] data[16, 16] = [high, low, high] data[16, 17] = [low, high, low] data[16, 18] = [high, low, high] data[16, 19] = [0, 0, 0] if kind == 'B': # data = data.reshape(-1) data = data.tobytes() diff = encode_py(data, axis=0) if output == 'new': if codec == 'encode': encoded = encode(data, out=bytetype) assert encoded == diff elif codec == 'decode': decoded = decode(diff, out=bytetype) assert decoded == data elif output == 'out': if codec == 'encode': encoded = bytetype(len(data)) encode(data, out=encoded) assert encoded == diff elif codec == 'decode': decoded = bytetype(len(data)) decode(diff, out=decoded) assert decoded == data elif output == 'inplace': if codec == 'encode': encoded = bytetype(data) encode(encoded, out=encoded) assert encoded == diff elif codec == 'decode': decoded = bytetype(diff) decode(decoded, out=decoded) assert decoded == data else: # if func == 'xor' and kind in ('f4', 'f8'): # with pytest.raises(ValueError): # encode(data, axis=axis) # pytest.skip("XOR codec not implemented for float data") diff = encode_py(data, axis=-2) if output == 'new': if codec == 'encode': encoded = encode(data, axis=axis) assert_array_equal(encoded, diff) elif codec == 'decode': decoded = decode(diff, axis=axis) assert_array_equal(decoded, data) elif output == 'out': if codec == 'encode': encoded = numpy.zeros_like(data) encode(data, axis=axis, out=encoded) assert_array_equal(encoded, diff) elif codec == 'decode': decoded = numpy.zeros_like(data) decode(diff, axis=axis, out=decoded) assert_array_equal(decoded, data) elif output == 'inplace': if codec == 'encode': encoded = data.copy() encode(encoded, axis=axis, out=encoded) assert_array_equal(encoded, diff) elif codec == 'decode': decoded = diff.copy() decode(decoded, axis=axis, out=decoded) assert_array_equal(decoded, data) @pytest.mark.parametrize('output', ['new', 'out']) @pytest.mark.parametrize('codec', ['encode', 'decode']) @pytest.mark.parametrize('endian', ['le', 'be']) @pytest.mark.parametrize('planar', ['rgb', 'rrggbb']) def test_floatpred(planar, endian, output, codec): """Test FloatPred codec.""" encode = imagecodecs.floatpred_encode decode = imagecodecs.floatpred_decode data = numpy.fromfile( datafiles('rgb.bin'), dtype='<f4').reshape(33, 31, 3) if planar == 'rgb': axis = -2 if endian == 'le': encoded = numpy.fromfile( datafiles('rgb.floatpred_le.bin'), dtype='<f4') encoded = encoded.reshape(33, 31, 3) if output == 'new': if codec == 'decode': assert_array_equal(decode(encoded, axis=axis), data) elif codec == 'encode': assert_array_equal(encode(data, axis=axis), encoded) elif output == 'out': out = numpy.empty_like(data) if codec == 'decode': decode(encoded, axis=axis, out=out) assert_array_equal(out, data) elif codec == 'encode': out = numpy.empty_like(data) encode(data, axis=axis, out=out) assert_array_equal(out, encoded) elif endian == 'be': data = data.astype('>f4') encoded = numpy.fromfile( datafiles('rgb.floatpred_be.bin'), dtype='>f4') encoded = encoded.reshape(33, 31, 3) if output == 'new': if codec == 'decode': assert_array_equal(decode(encoded, axis=axis), data) elif codec == 'encode': assert_array_equal(encode(data, axis=axis), encoded) elif output == 'out': out = numpy.empty_like(data) if codec == 'decode': decode(encoded, axis=axis, out=out) assert_array_equal(out, data) elif codec == 'encode': out = numpy.empty_like(data) encode(data, axis=axis, out=out) assert_array_equal(out, encoded) elif planar == 'rrggbb': axis = -1 data = numpy.ascontiguousarray(numpy.moveaxis(data, 2, 0)) if endian == 'le': encoded = numpy.fromfile( datafiles('rrggbb.floatpred_le.bin'), dtype='<f4') encoded = encoded.reshape(3, 33, 31) if output == 'new': if codec == 'decode': assert_array_equal(decode(encoded, axis=axis), data) elif codec == 'encode': assert_array_equal(encode(data, axis=axis), encoded) elif output == 'out': out = numpy.empty_like(data) if codec == 'decode': decode(encoded, axis=axis, out=out) assert_array_equal(out, data) elif codec == 'encode': out = numpy.empty_like(data) encode(data, axis=axis, out=out) assert_array_equal(out, encoded) elif endian == 'be': data = data.astype('>f4') encoded = numpy.fromfile( datafiles('rrggbb.floatpred_be.bin'), dtype='>f4') encoded = encoded.reshape(3, 33, 31) if output == 'new': if codec == 'decode': assert_array_equal(decode(encoded, axis=axis), data) elif codec == 'encode': assert_array_equal(encode(data, axis=axis), encoded) elif output == 'out': out = numpy.empty_like(data) if codec == 'decode': decode(encoded, axis=axis, out=out) assert_array_equal(out, data) elif codec == 'encode': out = numpy.empty_like(data) encode(data, axis=axis, out=out) assert_array_equal(out, encoded) def test_lzw_msb(): """Test LZW decoder with MSB.""" # TODO: add test_lzw_lsb decode = imagecodecs.lzw_decode for data, decoded in [ (b'\x80\x1c\xcc\'\x91\x01\xa0\xc2m6\x99NB\x03\xc9\xbe\x0b' b'\x07\x84\xc2\xcd\xa68|"\x14 3\xc3\xa0\xd1c\x94\x02\x02\x80', b'say hammer yo hammer mc hammer go hammer'), (b'\x80\x18M\xc6A\x01\xd0\xd0e\x10\x1c\x8c\xa73\xa0\x80\xc7\x02' b'\x10\x19\xcd\xe2\x08\x14\x10\xe0l0\x9e`\x10\x10\x80', b'and the rest can go and play'), (b'\x80\x18\xcc&\xe19\xd0@t7\x9dLf\x889\xa0\xd2s', b"can't touch this"), (b'\x80@@', b'')]: assert decode(data) == decoded @pytest.mark.parametrize('output', ['new', 'size', 'ndarray', 'bytearray']) def test_lzw_decode(output): """Test LZW decoder of input with horizontal differencing.""" decode = imagecodecs.lzw_decode delta_decode = imagecodecs.delta_decode data = readfile('bytes.lzw_horizontal.bin') decoded_size = len(BYTES) if output == 'new': decoded = decode(data) decoded = numpy.frombuffer(decoded, 'uint8').reshape(16, 16) delta_decode(decoded, out=decoded, axis=-1) assert_array_equal(BYTESIMG, decoded) elif output == 'size': decoded = decode(data, out=decoded_size) decoded = numpy.frombuffer(decoded, 'uint8').reshape(16, 16) delta_decode(decoded, out=decoded, axis=-1) assert_array_equal(BYTESIMG, decoded) # with pytest.raises(RuntimeError): decode(data, buffersize=32, out=decoded_size) elif output == 'ndarray': decoded = numpy.empty_like(BYTESIMG) decode(data, out=decoded.reshape(-1)) delta_decode(decoded, out=decoded, axis=-1) assert_array_equal(BYTESIMG, decoded) elif output == 'bytearray': decoded = bytearray(decoded_size) decode(data, out=decoded) decoded = numpy.frombuffer(decoded, 'uint8').reshape(16, 16) delta_decode(decoded, out=decoded, axis=-1) assert_array_equal(BYTESIMG, decoded) def test_lzw_decode_image_noeoi(): """Test LZW decoder of input without EOI 512x512u2.""" decode = imagecodecs.lzw_decode fname = datafiles('image_noeoi.lzw.bin') with open(fname, 'rb') as fh: encoded = fh.read() fname = datafiles('image_noeoi.bin') with open(fname, 'rb') as fh: decoded_known = fh.read() # new output decoded = decode(encoded) assert decoded == decoded_known # provide output decoded = bytearray(len(decoded)) decode(encoded, out=decoded) assert decoded == decoded_known # truncated output decoded = bytearray(100) decode(encoded, out=decoded) assert len(decoded) == 100 @pytest.mark.skipif(not hasattr(imagecodecs, 'blosc_decode'), reason='compression codecs missing') @pytest.mark.parametrize('output', ['new', 'out', 'size', 'excess', 'trunc']) @pytest.mark.parametrize('length', [0, 2, 31 * 33 * 3]) @pytest.mark.parametrize('codec', ['encode', 'decode']) @pytest.mark.parametrize('module', [ 'zlib', 'bz2', pytest.param('blosc', marks=pytest.mark.skipif(blosc is None, reason='import blosc')), pytest.param('lzma', marks=pytest.mark.skipif(lzma is None, reason='import lzma')), pytest.param('zstd', marks=pytest.mark.skipif(zstd is None, reason='import zstd')), pytest.param('lzf', marks=pytest.mark.skipif(lzf is None, reason='import lzf')), pytest.param('lz4', marks=pytest.mark.skipif(lz4 is None, reason='import lz4')), pytest.param('lz4h', marks=pytest.mark.skipif(lz4 is None, reason='import lz4')), pytest.param('bitshuffle', marks=pytest.mark.skipif(bitshuffle is None, reason='import bitshuffle')) ]) def test_compressors(module, codec, output, length): """Test various non-image codecs.""" if length: data = numpy.random.randint(255, size=length, dtype='uint8').tobytes() else: data = b'' if module == 'blosc': encode = imagecodecs.blosc_encode decode = imagecodecs.blosc_decode level = 9 encoded = blosc.compress(data, clevel=level) elif module == 'zlib': encode = imagecodecs.zlib_encode decode = imagecodecs.zlib_decode level = 5 encoded = zlib.compress(data, level) elif module == 'lzma': encode = imagecodecs.lzma_encode decode = imagecodecs.lzma_decode level = 6 encoded = lzma.compress(data) elif module == 'zstd': encode = imagecodecs.zstd_encode decode = imagecodecs.zstd_decode level = 5 if length == 0: # bug in zstd.compress? encoded = encode(data, level) else: encoded = zstd.compress(data, level) elif module == 'lzf': encode = imagecodecs.lzf_encode decode = imagecodecs.lzf_decode level = 1 encoded = lzf.compress(data, ((len(data) * 33) >> 5) + 1) if encoded is None: pytest.skip("lzf can't compress empty input") elif module == 'lz4': encode = imagecodecs.lz4_encode decode = imagecodecs.lz4_decode level = 1 encoded = lz4.block.compress(data, store_size=False) elif module == 'lz4h': def encode(*args, **kwargs): return imagecodecs.lz4_encode(*args, header=True, **kwargs) def decode(*args, **kwargs): return imagecodecs.lz4_decode(*args, header=True, **kwargs) level = 1 encoded = lz4.block.compress(data, store_size=True) elif module == 'bz2': encode = imagecodecs.bz2_encode decode = imagecodecs.bz2_decode level = 9 encoded = bz2.compress(data, compresslevel=level) elif module == 'bitshuffle': encode = imagecodecs.bitshuffle_encode decode = imagecodecs.bitshuffle_decode level = 0 encoded = bitshuffle.bitshuffle( numpy.frombuffer(data, 'uint8')).tobytes() else: raise ValueError(module) if codec == 'encode': size = len(encoded) if output == 'new': assert encoded == encode(data, level) elif output == 'size': ret = encode(data, level, out=size) assert encoded == ret elif output == 'out': if module == 'zstd': out = bytearray(max(size, 64)) # elif module == 'blosc': # out = bytearray(max(size, 17)) # bug in blosc ? elif module == 'lzf': out = bytearray(size + 1) # bug in liblzf ? else: out = bytearray(size) ret = encode(data, level, out=out) assert encoded == out[:size] assert encoded == ret elif output == 'excess': out = bytearray(size + 1021) ret = encode(data, level, out=out) if module == 'blosc': # pytest.skip("blosc output depends on output size") assert data == decode(ret) else: assert ret == out[:size] assert encoded == ret elif output == 'trunc': size = max(0, size - 1) out = bytearray(size) if size == 0 and module == 'bitshuffle': encode(data, level, out=out) == b'' else: with pytest.raises(RuntimeError): encode(data, level, out=out) else: raise ValueError(output) elif codec == 'decode': size = len(data) if output == 'new': assert data == decode(encoded) elif output == 'size': ret = decode(encoded, out=size) assert data == ret elif output == 'out': out = bytearray(size) ret = decode(encoded, out=out) assert data == out assert data == ret elif output == 'excess': out = bytearray(size + 1021) ret = decode(encoded, out=out) assert data == out[:size] assert data == ret elif output == 'trunc': size = max(0, size - 1) out = bytearray(size) if length > 0 and module in ('zlib', 'zstd', 'lzf', 'lz4', 'lz4h', 'blosc', 'bitshuffle'): with pytest.raises(RuntimeError): decode(encoded, out=out) else: decode(encoded, out=out) assert data[:size] == out else: raise ValueError(output) else: raise ValueError(codec) @pytest.mark.skipif(not hasattr(imagecodecs, 'bitshuffle_decode'), reason='bitshuffle codec missing') @pytest.mark.parametrize('dtype', ['bytes', 'ndarray']) @pytest.mark.parametrize('itemsize', [1, 2, 4, 8]) @pytest.mark.parametrize('blocksize', [0, 8, 64]) def test_bitshuffle_roundtrip(dtype, itemsize, blocksize): """Test Bitshuffle codec.""" encode = imagecodecs.bitshuffle_encode decode = imagecodecs.bitshuffle_decode if dtype == 'bytes': data = numpy.random.randint(255, size=1024, dtype='uint8').tobytes() else: data = numpy.random.randint(255, size=1024, dtype='u%i' % itemsize) data.shape = 2, 4, 128 encoded = encode(data, itemsize=itemsize, blocksize=blocksize) decoded = decode(encoded, itemsize=itemsize, blocksize=blocksize) if dtype == 'bytes': assert data == decoded else: assert_array_equal(data, decoded) @pytest.mark.skipif(not hasattr(imagecodecs, 'blosc_decode'), reason='blosc codec missing') @pytest.mark.parametrize('numthreads', [1, 6]) @pytest.mark.parametrize('level', [None, 1]) @pytest.mark.parametrize('shuffle', ['noshuffle', 'shuffle', 'bitshuffle']) @pytest.mark.parametrize('compressor', ['blosclz', 'lz4', 'lz4hc', 'snappy', 'zlib', 'zstd']) def test_blosc_roundtrip(compressor, shuffle, level, numthreads): """Test Blosc codec.""" encode = imagecodecs.blosc_encode decode = imagecodecs.blosc_decode data = numpy.random.randint(255, size=2021, dtype='uint8').tobytes() encoded = encode(data, level=level, compressor=compressor, shuffle=shuffle, numthreads=numthreads) decoded = decode(encoded, numthreads=numthreads) assert data == decoded AEC_TEST_DIR = osp.join(TEST_DIR, 'libaec/121B2TestData') AEC_TEST_OPTIONS = list( osp.split(f)[-1][5:-3] for f in glob.glob(osp.join( AEC_TEST_DIR, 'AllOptions', '*.rz'))) AEC_TEST_EXTENDED = list( osp.split(f)[-1][:-3] for f in glob.glob(osp.join( AEC_TEST_DIR, 'ExtendedParameters', '*.rz'))) @pytest.mark.skipif(not hasattr(imagecodecs, 'aec_decode'), reason='aec codec missing') @pytest.mark.parametrize('dtype', ['bytes', 'numpy']) @pytest.mark.parametrize('name', AEC_TEST_EXTENDED) def test_aec_extended(name, dtype): """Test AEC codec with libaec ExtendedParameters.""" encode = imagecodecs.aec_encode decode = imagecodecs.aec_decode size = 512 * 512 * 4 bitspersample = 32 flags = imagecodecs.AEC_DATA_PREPROCESS | imagecodecs.AEC_PAD_RSI matches = re.search(r'j(\d+)\.r(\d+)', name).groups() blocksize = int(matches[0]) rsi = int(matches[1]) filename = osp.join(AEC_TEST_DIR, 'ExtendedParameters', '%s.rz' % name) with open(filename, 'rb') as fh: rz = fh.read() filename = osp.join(AEC_TEST_DIR, 'ExtendedParameters', '%s.dat' % name.split('.')[0]) if dtype == 'bytes': with open(filename, 'rb') as fh: dat = fh.read() out = size else: dat = numpy.fromfile(filename, 'uint32').reshape(512, 512) out = numpy.empty_like(dat) # decode decoded = decode(rz, bitspersample=bitspersample, flags=flags, blocksize=blocksize, rsi=rsi, out=out) if dtype == 'bytes': assert decoded == dat else: pass # roundtrip if dtype == 'bytes': encoded = encode(dat, bitspersample=bitspersample, flags=flags, blocksize=blocksize, rsi=rsi) # fails with AEC_DATA_ERROR if libaec wasn't built with libaec.diff decoded = decode(encoded, bitspersample=bitspersample, flags=flags, blocksize=blocksize, rsi=rsi, out=size) assert decoded == dat else: encoded = encode(dat, flags=flags, blocksize=blocksize, rsi=rsi) # fails with AEC_DATA_ERROR if libaec wasn't built with libaec.diff decoded = decode(encoded, flags=flags, blocksize=blocksize, rsi=rsi, out=out) assert_array_equal(decoded, out) @pytest.mark.skipif(not hasattr(imagecodecs, 'aec_decode'), reason='aec codec missing') @pytest.mark.parametrize('name', AEC_TEST_OPTIONS) def test_aec_options(name): """Test AEC codec with libaec 121B2TestData.""" encode = imagecodecs.aec_encode decode = imagecodecs.aec_decode rsi = 128 blocksize = 16 flags = imagecodecs.AEC_DATA_PREPROCESS if 'restricted' in name: flags |= imagecodecs.AEC_RESTRICTED matches = re.search(r'p(\d+)n(\d+)', name).groups() size = int(matches[0]) bitspersample = int(matches[1]) if bitspersample > 8: size *= 2 if bitspersample > 16: size *= 2 filename = osp.join(AEC_TEST_DIR, 'AllOptions', 'test_%s.rz' % name) with open(filename, 'rb') as fh: rz = fh.read() filename = filename.replace('.rz', '.dat' ).replace('-basic', '' ).replace('-restricted', '') with open(filename, 'rb') as fh: dat = fh.read() out = size # decode decoded = decode(rz, bitspersample=bitspersample, flags=flags, blocksize=blocksize, rsi=rsi, out=out) assert decoded == dat # roundtrip encoded = encode(dat, bitspersample=bitspersample, flags=flags, blocksize=blocksize, rsi=rsi) decoded = decode(encoded, bitspersample=bitspersample, flags=flags, blocksize=blocksize, rsi=rsi, out=out) assert decoded == dat @pytest.mark.skipif(not hasattr(imagecodecs, 'jpeg_encode'), reason='jpeg codecs missing') @pytest.mark.filterwarnings('ignore:Possible precision loss') @pytest.mark.parametrize('optimize', [False, True]) @pytest.mark.parametrize('smoothing', [0, 25]) @pytest.mark.parametrize('subsampling', ['444', '422', '420', '411', '440']) @pytest.mark.parametrize('itype', ['rgb', 'rgba', 'gray']) @pytest.mark.parametrize('codec', ['jpeg8', 'jpeg12']) def test_jpeg_encode(codec, itype, subsampling, smoothing, optimize): """Test various JPEG encode options.""" # general and default options are tested in test_image_roundtrips if codec == 'jpeg8': dtype = 'uint8' decode = imagecodecs.jpeg8_decode encode = imagecodecs.jpeg8_encode atol = 24 elif codec == 'jpeg12': if _jpeg12 is None: pytest.skip('_jpeg12 module missing') if not optimize: pytest.skip('jpeg12 fails without optimize') dtype = 'uint16' decode = imagecodecs.jpeg12_decode encode = imagecodecs.jpeg12_encode atol = 24 * 16 else: raise ValueError(codec) dtype = numpy.dtype(dtype) data = image_data(itype, dtype) data = data[:32, :16].copy() # make divisable by subsamples encoded = encode(data, level=95, subsampling=subsampling, smoothing=smoothing, optimize=optimize) decoded = decode(encoded) if itype == 'gray': decoded = decoded.reshape(data.shape) assert_allclose(data, decoded, atol=atol) @pytest.mark.skipif(not hasattr(imagecodecs, 'jpeg8_decode'), reason='jpeg8 codec missing') @pytest.mark.parametrize('output', ['new', 'out']) def test_jpeg8_decode(output): """Test JPEG 8-bit decoder with separate tables.""" decode = imagecodecs.jpeg8_decode data = readfile('bytes.jpeg8.bin') tables = readfile('bytes.jpeg8_tables.bin') if output == 'new': decoded = decode(data, tables) elif output == 'out': decoded = numpy.empty_like(BYTESIMG) decode(data, tables, out=decoded) elif output == 'bytearray': decoded = bytearray(BYTESIMG.size * BYTESIMG.itemsize) decoded = decode(data, out=decoded) assert_array_equal(BYTESIMG, decoded) @pytest.mark.skipif(_jpeg12 is None, reason='_jpeg12 module missing') @pytest.mark.parametrize('output', ['new', 'out', 'bytearray']) def test_jpeg12_decode(output): """Test JPEG 12-bit decoder with separate tables.""" decode = imagecodecs.jpeg12_decode data = readfile('words.jpeg12.bin') tables = readfile('words.jpeg12_tables.bin') if output == 'new': decoded = decode(data, tables) elif output == 'out': decoded = numpy.empty_like(WORDSIMG) decode(data, tables, out=decoded) elif output == 'bytearray': decoded = bytearray(WORDSIMG.size * WORDSIMG.itemsize) decoded = decode(data, out=decoded) assert numpy.max(numpy.abs(WORDSIMG.astype('int32') - decoded.astype('int32'))) < 2 @pytest.mark.skipif(not hasattr(imagecodecs, 'jpegsof3_decode'), reason='jpegsof3 codec missing') @pytest.mark.parametrize('output', ['new', 'out', 'bytearray']) @pytest.mark.parametrize('fname', ['gray8.sof3.jpg', 'gray16.sof3.jpg']) def test_jpegsof3(fname, output): """Test JPEG SOF3 decoder with 8 and 16-bit images.""" decode = imagecodecs.jpegsof3_decode shape = 535, 800 if fname == 'gray8.sof3.jpg': dtype = 'uint8' value = 75 elif fname == 'gray16.sof3.jpg': dtype = 'uint16' value = 19275 data = readfile(fname) if output == 'new': decoded = decode(data) elif output == 'out': decoded = numpy.empty(shape, dtype) decode(data, out=decoded) elif output == 'bytearray': decoded = bytearray(535 * 800 * numpy.dtype(dtype).itemsize) decoded = decode(data, out=decoded) assert decoded.shape == shape assert decoded.dtype == dtype assert decoded[500, 600] == value @pytest.mark.skipif(not hasattr(imagecodecs, 'jxr_decode'), reason='jxr codec missing') @pytest.mark.parametrize('output', ['new', 'out', 'bytearray']) def test_jxr_decode(output): """Test JXR decoder with RGBA32 image.""" decode = imagecodecs.jxr_decode image = readfile('rgba32.jxr.bin') image = numpy.frombuffer(image, dtype='uint8').reshape(100, 100, -1) data = readfile('rgba32.jxr') if output == 'new': decoded = decode(data) elif output == 'out': decoded = numpy.empty_like(image) decode(data, out=decoded) elif output == 'bytearray': decoded = bytearray(image.size * image.itemsize) decoded = decode(data, out=decoded) assert_array_equal(image, decoded) @pytest.mark.skipif(not hasattr(imagecodecs, 'j2k_decode'), reason='j2k codec missing') @pytest.mark.parametrize('output', ['new', 'out', 'bytearray']) def test_j2k_int8_4bit(output): """Test J2K decoder with int8, 4-bit image.""" decode = imagecodecs.j2k_decode data = readfile('int8_4bit.j2k') dtype = 'int8' shape = 256, 256 if output == 'new': decoded = decode(data, verbose=2) elif output == 'out': decoded = numpy.empty(shape, dtype) decode(data, out=decoded) elif output == 'bytearray': decoded = bytearray(shape[0] * shape[1]) decoded = decode(data, out=decoded) assert decoded.dtype == dtype assert decoded.shape == shape assert decoded[0, 0] == -6 assert decoded[-1, -1] == 2 @pytest.mark.skipif(not hasattr(imagecodecs, 'j2k_decode'), reason='j2k codec missing') def test_j2k_ycbc(): """Test J2K decoder with subsampling.""" decode = imagecodecs.j2k_decode data = readfile('ycbc.j2k') decoded = decode(data, verbose=2) assert decoded.dtype == 'uint8' assert decoded.shape == (256, 256, 3) assert tuple(decoded[0, 0]) == (243, 243, 240) assert tuple(decoded[-1, -1]) == (0, 0, 0) @pytest.mark.skipif(_jpegls is None, reason='_jpegls module missing') @pytest.mark.parametrize('output', ['new', 'out', 'bytearray']) def test_jpegls_decode(output): """Test JPEGLS decoder with RGBA32 image.""" decode = imagecodecs.jpegls_decode data = readfile('rgba.u1.jls') dtype = 'uint8' shape = 32, 31, 4 if output == 'new': decoded = decode(data) elif output == 'out': decoded = numpy.empty(shape, dtype) decode(data, out=decoded) elif output == 'bytearray': decoded = bytearray(shape[0] * shape[1] * shape[2]) decoded = decode(data, out=decoded) assert decoded.dtype == dtype assert decoded.shape == shape assert decoded[25, 25, 1] == 97 assert decoded[-1, -1, -1] == 63 @pytest.mark.skipif(not hasattr(imagecodecs, 'webp_decode'), reason='webp codec missing') @pytest.mark.parametrize('output', ['new', 'out', 'bytearray']) def test_webp_decode(output): """Test WebpP decoder with RGBA32 image.""" decode = imagecodecs.webp_decode data = readfile('rgba.u1.webp') dtype = 'uint8' shape = 32, 31, 4 if output == 'new': decoded = decode(data) elif output == 'out': decoded = numpy.empty(shape, dtype) decode(data, out=decoded) elif output == 'bytearray': decoded = bytearray(shape[0] * shape[1] * shape[2]) decoded = decode(data, out=decoded) assert decoded.dtype == dtype assert decoded.shape == shape assert decoded[25, 25, 1] == 94 # lossy assert decoded[-1, -1, -1] == 63 @pytest.mark.skipif(_zfp is None, reason='_zfp module missing') @pytest.mark.filterwarnings('ignore:Possible precision loss') @pytest.mark.parametrize('execution', [None, 'omp']) @pytest.mark.parametrize('mode', [(None, None), ('p', None)]) # ('r', 24) @pytest.mark.parametrize('deout', ['new', 'out', 'bytearray']) # 'view', @pytest.mark.parametrize('enout', ['new', 'out', 'bytearray']) @pytest.mark.parametrize('itype', ['rgba', 'view', 'gray', 'line']) @pytest.mark.parametrize('dtype', ['float32', 'float64', 'int32', 'int64']) def test_zfp(dtype, itype, enout, deout, mode, execution): """Test ZFP codecs.""" if execution == 'omp' and os.environ.get('SKIP_OMP', False): pytest.skip('omp test skip because of enviroment variable') decode = imagecodecs.zfp_decode encode = imagecodecs.zfp_encode mode, level = mode dtype = numpy.dtype(dtype) itemsize = dtype.itemsize data = image_data(itype, dtype) shape = data.shape kwargs = dict(mode=mode, level=level, execution=execution) encoded = encode(data, **kwargs) if enout == 'new': pass elif enout == 'out': encoded = numpy.empty(len(encoded), 'uint8') encode(data, out=encoded, **kwargs) elif enout == 'bytearray': encoded = bytearray(len(encoded)) encode(data, out=encoded, **kwargs) if deout == 'new': decoded = decode(encoded) elif deout == 'out': decoded = numpy.empty(shape, dtype) decode(encoded, out=decoded) elif deout == 'view': temp = numpy.empty((shape[0] + 5, shape[1] + 5, shape[2]), dtype) decoded = temp[2:2 + shape[0], 3:3 + shape[1], :] decode(encoded, out=decoded) elif deout == 'bytearray': decoded = bytearray(shape[0] * shape[1] * shape[2] * itemsize) decoded = decode(encoded, out=decoded) decoded = numpy.asarray(decoded, dtype=dtype).reshape(shape) if dtype.char == 'f': atol = 1e-6 else: atol = 20 assert_allclose(data, decoded, atol=atol, rtol=0) @pytest.mark.skipif(not hasattr(imagecodecs, 'jxr_decode'), reason='jxr codec missing') @pytest.mark.filterwarnings('ignore:Possible precision loss') @pytest.mark.parametrize('level', [None, 90, 0.4]) @pytest.mark.parametrize('deout', ['new', 'out', 'bytearray']) # 'view', @pytest.mark.parametrize('enout', ['new', 'out', 'bytearray']) @pytest.mark.parametrize('itype', [ 'gray uint8', 'gray uint16', 'gray float16', 'gray float32', 'rgb uint8', 'rgb uint16', 'rgb float16', 'rgb float32', 'rgba uint8', 'rgba uint16', 'rgba float16', 'rgba float32', 'channels uint8', 'channelsa uint8', 'channels uint16', 'channelsa uint16', 'cmyk uint8', 'cmyka uint8']) def test_jxr(itype, enout, deout, level): """Test JpegXR codecs.""" decode = imagecodecs.jxr_decode encode = imagecodecs.jxr_encode itype, dtype = itype.split() dtype = numpy.dtype(dtype) itemsize = dtype.itemsize data = image_data(itype, dtype) shape = data.shape kwargs = dict(level=level) if itype.startswith('cmyk'): kwargs['photometric'] = 'cmyk' if itype.endswith('a'): kwargs['hasalpha'] = True print(data.shape, data.dtype, data.strides) encoded = encode(data, **kwargs) if enout == 'new': pass elif enout == 'out': encoded = numpy.empty(len(encoded), 'uint8') encode(data, out=encoded, **kwargs) elif enout == 'bytearray': encoded = bytearray(len(encoded)) encode(data, out=encoded, **kwargs) if deout == 'new': decoded = decode(encoded) elif deout == 'out': decoded = numpy.empty(shape, dtype) decode(encoded, out=
numpy.squeeze(decoded)
numpy.squeeze
''' Created on Dec 31, 2013 @author: <NAME> (<EMAIL>) @copyright: (c) 2013 <NAME> @license: MIT ''' # standard library from __future__ import division, print_function import logging import os import types # external libraries import numpy as np import scipy.signal import scipy.io.wavfile import matplotlib.pyplot as plt #=================================================================================================== # Classes #=================================================================================================== class Audio(object): def __init__(self, channels=0, fs=96000, nofsamples=0, duration=None, initialdata=None, dtype=np.float64): """Base class for audio processing. Samples are stored as a numpy array. We can create an instance by specifying a channel count and one of either a duration or a sample count parameter. The other way of creating an instance is by providing an already existing numpy array containing the audio samples. The shape of the audio samples are always (Nsamples_per_channel, Nchannels). """ self._logger = logging.getLogger(__name__) # We sometimes divide by the sample rate to get time values assert fs > 0, "sample rate cannot be zero or negative" self.fs = fs # sample rate should always be specified in the constructor self.nofsamples = None # number of samples per channel self.duration = None # duration (length) in seconds self.ch = None # number of channels self._comment = '' if initialdata is None: # if we are not given any initial samples we create an empty array of # zeros for the audio samples. assert isinstance(channels, int) assert not(nofsamples!=0 and duration is not None), "choose either samples or duration" self.ch = channels if duration is not None: self.nofsamples = int(duration*self.fs) self.duration = duration else: self.nofsamples = nofsamples self._set_duration() # create space for the samples self.samples = np.zeros((self.nofsamples, self.ch), dtype=dtype) else: # An array of initial samples are given, use this to extract # channel count and durations. assert isinstance(initialdata, np.ndarray), \ 'Only numpy arrays are allowed as initial data' assert channels == 0, "parameter 'channels' is redundant if initial data is specified" assert nofsamples == 0, "parameter 'nofsamples' is redundant if initial data is specified" assert duration is None, "parameter 'duration' is redundant if initial data is specified" # copy the data to avoid unexpected data corruption self.samples = initialdata.copy() if self.samples.ndim == 1: # if the array is # array([ 1., 1., 1.]) # we expand it to # array([[ 1.], # [ 1.], # [ 1.]]) # self.samples = np.expand_dims(self.samples, axis=1) assert self.samples.ndim == 2, 'shape must be (Nsamples, Nchannels)' self.nofsamples, self.ch = self.samples.shape # initial data is assumed to have more samples than channels assert self.nofsamples > self.ch, 'shape must be (Nsamples, Nchannels)' self._set_duration() assert self.nofsamples is not None assert self.duration is not None assert self.ch is not None def __str__(self): s = '=======================================\n' s += 'classname : %s\n' %self.__class__.__name__ s += 'sample rate : %.1f [Hz]\n' %self.fs s += 'channels : %i\n' %self.ch s += 'duration : %.3f [s]\n' %self.duration s += 'datatype : %s\n' %self.samples.dtype s += 'samples per ch : %i\n' %self.nofsamples s += 'data size : %.3f [Mb]\n' %(self.samples.nbytes/(1024*1024)) s += 'has comment : %s\n' %('yes' if len(self._comment)!=0 else 'no') if self.ch != 0: # += '-----------------:---------------------\n' s += 'peak : %s\n' %np.array_str(self.peak()[0], precision=4, suppress_small=True) s += 'RMS : %s\n' %np.array_str(self.rms(), precision=4, suppress_small=True) s += 'crestfactor : %s\n' %np.array_str(self.crest_factor(), precision=4, suppress_small=True) s += '-----------------:---------------------\n' return s def __len__(self): return self.nofsamples def _set_duration(self): """internal method If we have modified the samples variable (by padding with zeros for example) we need to re-calculate the duration """ self.duration = self.nofsamples/self.fs def _set_samples(self, idx=0, samples=None): """internal method NOTE: idx != channel idx is always zero indexed since it refers to the numpy array. Channels are always indexed from one since this is the natural way of identifying channel numbers. """ assert isinstance(samples, np.ndarray) assert len(samples) == self.nofsamples self.samples[:,idx] = samples def pretty_string_samples(self, idx_start=0, idx_end=20, precision=4, header=False): s = '' if header: t = ' ' u = 'ch' for i in range(self.ch): t += '-------:' u += ' %2i :' %(i+1) t += '\n' u += '\n' s += t # -------:-------:-------: s += u # ch 1 : 2 : 3 : s += t # -------:-------:-------: s += np.array_str(self.samples[idx_start:idx_end,:], max_line_width=260, # we can print 32 channels before linewrap precision=precision, suppress_small=True) if (idx_end-idx_start) < self.nofsamples: s = s[:-1] # strip the right ']' character s += '\n ...,\n' lastlines = np.array_str(self.samples[-3:,:], max_line_width=260, precision=precision, suppress_small=True) s += ' %s\n' %lastlines[1:] # strip first '[' return s def pad(self, nofsamples=0): """Zero pad *at the end* of the current audio data. increases duration by samples/fs """ assert nofsamples >= 0, "Can't append negative number of samples" zeros = np.zeros((nofsamples, self.ch), dtype=self.samples.dtype) self.samples = np.append(self.samples, zeros, axis=0) self.nofsamples=len(self.samples) self._set_duration() def trim(self, start=None, end=None): """Trim samples **IN PLACE** """ self.samples = self.samples[start:end] self.nofsamples=len(self.samples) self._set_duration() def _fade(self, millisec, direction): """Internal method. Fade in/out is essentially the same exept the slope (and position) of the ramp. Currently only a linear ramp is implemented. """ assert np.issubdtype(self.samples.dtype, float), \ "only floating point processing implemented" assert millisec >= 0, "Got a time machine?" assert direction in ("in", "out") fade_seconds = millisec/1000 assert self.duration > fade_seconds, "fade cannot be longer than the length of the audio" sample_count = np.ceil(fade_seconds*self.fs) self._logger.debug("fade %s sample count: %i" %(direction, sample_count)) # generate the ramp if direction is "out": # ramp down ramp = np.linspace(1, 0, num=sample_count, endpoint=True) else: # ramp up ramp = np.linspace(0, 1, num=sample_count, endpoint=True) ones = np.ones(len(self)-len(ramp)) # glue the ones and the ramp together if direction is "out": gains = np.append(ones, ramp, axis=0) else: gains = np.append(ramp, ones, axis=0) # expand the dimension so we get a one channels array of samples, # as in (samples, channels) gains = np.expand_dims(gains, axis=1) assert len(gains) == len(self) # repeat the gain vector so we get as many gain channels as all the channels gains = np.repeat(gains, self.ch, axis=1) assert gains.shape == self.samples.shape # apply gains self.samples = self.samples * gains def fade_in(self, millisec=10): """Fade in over 'millisec' seconds. Applies on *all* channels""" self._fade(millisec, "in") def fade_out(self, millisec=30): """Fade out over 'millisec' seconds. Applies on *all* channels""" self._fade(millisec, "out") def delay(self, n, channel=1): """Delay channel x by n samples""" self.samples[:,channel-1] = np.pad(self.samples[:,channel-1], (n, 0), mode="constant")[:-n] def get_time(self): """Return a vector of time values, starting with t0=0. Useful when plotting.""" return np.linspace(0, self.duration, num=self.nofsamples, endpoint=False) def comment(self, comment=None): """Modify or return a string comment.""" assert isinstance(comment, (basestring, types.NoneType)), "A comment is a string" if comment is not None: self._comment = comment return self._comment def append(self, *args): """Add (append) channels *to the right* of the current audio data. does zeropadding increases channel count """ for i, other in enumerate(args): assert isinstance(other, Audio), "only Audio() instances can be used" self._logger.debug("** iteration %02i --> appending %s" %((i+1), other.__class__.__name__)) assert self.fs == other.fs, "Sample rates must match (%s != %s)" %(self.fs, other.fs) assert self.samples.dtype == other.samples.dtype, \ "Data types must match (%s != %s)"%(self.samples.dtype, other.samples.dtype) max_nofsamples = max(self.nofsamples, other.nofsamples) missingsamples = abs(self.nofsamples - other.nofsamples) self._logger.debug("max nof samples: %i" %max_nofsamples) self._logger.debug("appending %i new channel(s) and %i samples" %(other.ch, missingsamples)) if self.nofsamples > other.nofsamples: self._logger.debug("self.nofsamples > other.nofsamples") tmp = np.append(other.samples, np.zeros(((missingsamples), other.ch), dtype=other.samples.dtype), axis=0) self.samples = np.append(self.samples, tmp, axis=1) elif self.nofsamples < other.nofsamples: self._logger.debug("self.nofsamples < other.nofsamples") tmp = np.append(self.samples, np.zeros(((missingsamples), self.ch), dtype=self.samples.dtype), axis=0) self.samples = np.append(tmp, other.samples, axis=1) else: self._logger.debug("self.nofsamples == other.nofsamples") self.samples = np.append(self.samples, other.samples, axis=1) self.ch = self.ch+other.ch self.nofsamples=max_nofsamples self._set_duration() def concat(self, *args): """Concatenate (append) samples *after* the current audio data. example: x1 = 1234 x2 = 5678 x1.concat(x2) --> 12345678 """ for i, other in enumerate(args): assert isinstance(other, Audio), "only Audio() instances can be used" self._logger.debug("** iteration %02i --> appending %s" %((i+1), other.__class__.__name__)) assert self.fs == other.fs, "Sample rates must match (%s != %s)" %(self.fs, other.fs) assert self.samples.dtype == other.samples.dtype, \ "Data types must match (%s != %s)"%(self.samples.dtype, other.samples.dtype) assert self.ch == other.ch, "channel count must match" self.samples = np.append(self.samples, other.samples, axis=0) self.nofsamples=len(self.samples) self._set_duration() def gain(self, *args): """Apply gain to the audio samples. Always specify gain values in dB. Converts **IN PLACE** """ self._logger.debug('gains: %s' %str(args)) dt = self.samples.dtype lin = db2lin(args) # apply the (linear) gain self.samples = lin*self.samples # make sure that the data type is retained self.samples = self.samples.astype(dt) def rms(self): """Calculate the RMS (Root Mean Square) value of the audio data. Returns the RMS value for each individual channel """ if not (self.samples == 0).all(): if np.issubdtype(self.samples.dtype, float): rms = np.sqrt(np.mean(np.power(self.samples, 2), axis=0)) else: # use a bigger datatype for ints since we most likely will # overflow when calculating to the power of 2 bigger = np.asarray(self.samples, dtype=np.int64) rms = np.sqrt(np.mean(np.power(bigger, 2), axis=0)) elif len(self.samples) == 0: # no samples are set but channels are configured rms = np.zeros(self.ch) rms[:] = float('nan') else: rms = np.zeros(self.ch) return rms def peak(self): """Calculate peak sample value (with sign)""" if len(self.samples) != 0: if np.issubdtype(self.samples.dtype, float): idx = np.absolute(self.samples).argmax(axis=0) else: # We have to be careful when checking two's complement since the absolute value # of the smallest possible value can't be represented without overflowing. For # example: signed 16bit has range [-32768, 32767] so abs(-32768) cannot be # represented in signed 16 bits --> use a bigger datatype bigger = np.asarray(self.samples, dtype=np.int64) idx = np.absolute(bigger).argmax(axis=0) peak = np.array([self.samples[row,col] for col, row in enumerate(idx)]) else: # no samples are set but channels are configured idx = np.zeros(self.ch, dtype=np.int64) peak = np.zeros(self.ch) peak[:] = float('nan') return peak, idx def crest_factor(self): """Calculate the Crest Factor (peak over RMS) value of the audio. Returns the crest factor value for each channel. Some common crest factor values: sine : 1.414... MLS : 1 (if no emphasis filter is applied) impulse : very high. The value gets higher the longer the length of the audio data. square : 1 (ideal square) zeros : NaN (we cannot calculate 0/0) """ rms = self.rms() assert len(rms) != 0 with np.errstate(invalid='ignore'): # if the rms is zero we will get division errors. Ignore them. if len(self.samples) != 0: crest = np.abs(self.samples).max(axis=0)/rms else: # no samples are set but channels are configured crest = np.zeros(self.ch) crest[:] = float('nan') return crest def convert_to_integer(self, targetbits=16): """Scale floating point values between [-1.0, 1.0] to the equivalent signed integer value. Converts **IN PLACE** Note: 24 bit signed integers and 8 bit unsigned integers currently unsupported. """ assert targetbits in (8, 16, 32, 64) assert self.samples.dtype in (np.int8, np.int16, np.int32, np.int64, np.float32, np.float64) dt = { 8 : 'int8', 16 : 'int16', 32 : 'int32', 64 : 'int64'} sourcebits = self.samples.itemsize * 8 if self.samples.dtype in (np.float32, np.float64): self._logger.debug("source is %02i bits (float), target is %2i bits (integer)" %(sourcebits, targetbits)) self.samples = np.array(self.samples*(2**(targetbits-1)-1), dtype=dt.get(targetbits)) else: self._logger.debug("source is %02i bits (integer), target is %2i bits (integer)" %(sourcebits, targetbits)) raise NotImplementedError("TODO: implement scale int->int") def convert_to_float(self, targetbits=64): """Scale integer values to equivalent floating point values between [-1.0, 1.0]. Converts **IN PLACE** """ assert targetbits in (32, 64) assert self.samples.dtype in (np.int8, np.int16, np.int32, np.int64, np.float32, np.float64) dt = {32 : 'float32', 64 : 'float64'} sourcebits = self.samples.itemsize * 8 if self.samples.dtype in (np.int8, np.int16, np.int32, np.int64): self._logger.debug("source is %02i bits (integer), target is %2i bits (float)" %(sourcebits, targetbits)) self.samples = np.array(self.samples/(2**(sourcebits-1)), dtype=dt.get(targetbits)) else: self._logger.debug("source is %02i bits (float), target is %2i bits (float)" %(sourcebits, targetbits)) self.samples = np.array(self.samples, dtype=dt.get(targetbits)) def write_wav_file(self, filename=None): """Save audio data to .wav file.""" assert filename is not None, "Specify a filename, for example 'filename=audio.wav'" self._logger.debug("writing file %s" %filename) if self.samples.dtype == np.float64: self._logger.warn("datatype is %s" %self.samples.dtype) try: scipy.io.wavfile.write(filename, self.fs, self.samples) except: self._logger.exception("Could not write file: '%s'" %filename) def plot(self, ch=1, plotname=None, **kwargs): """Plot the audio data on a time domain plot. example: x1 = Sinetone(f0=0.2, fs=10, nofsamples=50) x1.plot(linestyle='--', marker='x', color='r', label='sine at 0.2Hz') """ # TODO: add range to plotdata [None:None] is everything if ch != 'all': assert ch-1 < self.ch, "channel does not exist" plt.figure(1) plt.title("%s" %self.__class__.__name__) if ch != 'all': plt.plot(self.get_time(), self.samples[:,ch-1], **kwargs) else: plt.plot(self.get_time(), self.samples, **kwargs) plt.xlabel('Time [s]') plt.ylabel('Amplitude [linear]') if 'label' in kwargs: plt.legend(loc='best') plt.grid(True) if plotname is None: plt.show() else: plt.savefig(plotname) plt.close(1) def plot_fft(self, plotname=None, window='hann', normalise=True, **kwargs): """Make a plot (in the frequency domain) of all channels""" ymin = kwargs.get('ymin', -160) #dB freq, mag = self.fft(window=window, normalise=normalise) fig_id = 1 plt.figure(fig_id) #plt.semilogx(freq, mag, **kwargs) # plots all channel directly plt.hold(True) for ch in range(self.ch): plt.semilogx(freq, mag[:,ch], label='ch%2i' %(ch+1)) plt.hold(False) plt.xlim(xmin=1) # we're not interested in freqs. below 1 Hz plt.ylim(ymin=ymin) plt.xlabel('Frequency [Hz]') plt.ylabel('Magnitude [dB]') plt.legend(loc='best') plt.grid(True) if plotname is None: plt.show() else: plt.savefig(plotname) plt.close(fig_id) def fft(self, window='hann', normalise=True): """Calculate the FFT of all channels. Returns data up to fs/2""" fftsize = self.nofsamples # Avoid Mersenne Primes if fftsize in [(2**13)-1, (2**17)-1, (2**19)-1, (2**31)-1]: self._logger.warn("FFT size is a Mersenne Prime, increasing size by 1") fftsize = fftsize+1 self._logger.debug("fftsize: %i" %fftsize) self._logger.debug("window : %s" %str(window)) win = scipy.signal.windows.get_window(window, Nx=self.nofsamples) # not fftsize! win = np.expand_dims(win, axis=1) y = self.samples*win Y = np.fft.fft(y, n=fftsize, axis=0) if normalise: Y = Y/fftsize mag = lin2db(np.abs(Y)) frq =
np.fft.fftfreq(fftsize, 1/self.fs)
numpy.fft.fftfreq
import numpy as np import pandas as pd import matplotlib.pyplot as plt import numba from functools import partial import multiprocessing import random from scipy import stats class naive_sghmc(): def __init__(self,lnp,lnp_grad,initialguess,data=None,usedata = False, M = None): ''' ''' self.data = data self.ndim = len(initialguess) self.get_mass_matrix(M) self.theta0 = initialguess self.lnp = lnp self.lnp_grad = lnp_grad self.res = [] self.r = [] self.usedata = usedata if usedata: self.n = len(data) def get_mass_matrix(self, mass_matrix=None): """ get the inverse of the mass matrix """ if mass_matrix is None: self.mass_matrix = np.identity(self.ndim) self.inverse_mass_matrix = np.identity(self.ndim) else: if len(mass_matrix) != self.ndim: print("Invalid mass matrix") elif len(mass_matrix) == 1: self.mass_matrix = mass_matrix self.inverse_mass_matrix = 1. / mass_matrix #self.ndim_mass = 1 else: self.mass_matrix = mass_matrix self.inverse_mass_matrix = np.linalg.inv(mass_matrix) #self.ndim_mass = 2 def define_momentum(self): """ sample momentum """ if self.ndim == 1: r = np.random.normal(0, np.sqrt(self.mass_matrix)) else: r = np.random.multivariate_normal(
np.zeros(self.ndim)
numpy.zeros
from __future__ import division import numpy as np from scipy.stats import norm from scipy import stats from sklearn.metrics.pairwise import euclidean_distances from scipy.spatial.distance import cdist from acquisition_maximization import acq_max counter = 0 ############################################################################### ''' The max_bound_size variable below contols the size of the maximum allowed bound. This is set at [0,max_bound_size] in each dimention. ###IMPORTANT### This variable must be consistant in all of the following files: 1) acquisition_functions.py 2) bayesian_optimization_function.py 3) function.py 4) real_experiment_functon.py ''' max_bound_size=10 ############################################################################### class AcquisitionFunction(object): """ An object to compute the acquisition functions. """ def __init__(self, acq, bb_function=False): self.acq=acq acq_name=acq['name'] if bb_function: self.bb_function=bb_function if 'WW' not in acq: self.WW=False else: self.WW=acq['WW'] if 'WW_dim' not in acq: self.WW_dim=False else: self.WW_dim=acq['WW_dim'] ListAcq=['ei'] # check valid acquisition function IsTrue=[val for idx,val in enumerate(ListAcq) if val in acq_name] #if not in acq_name: if IsTrue == []: err = "The utility function " \ "{} has not been implemented, " \ "please choose one of ucb, ei, or poi.".format(acq_name) raise NotImplementedError(err) else: self.acq_name = acq_name self.dim=acq['dim'] if 'scalebounds' not in acq: self.scalebounds=[0,1]*self.dim else: self.scalebounds=acq['scalebounds'] self.initialized_flag=0 self.objects=[] def acq_kind(self, x, gp, y_max): #print self.kind if np.any(np.isnan(x)): return 0 if self.acq_name == 'ei': return self._ei(x, gp, y_max) if self.acq_name == 'ei_regularizerH': bound=np.array(self.scalebounds).reshape(self.dim,-1) length=bound[:,1]-bound[:,0] x_bar=bound[:,0]+length/2 return self._ei_regularizerH(x, gp, y_max,x_bar=x_bar,R=0.5) @staticmethod def _ei(x, gp, y_max): """ Calculates the EI acquisition function values Inputs: gp: The Gaussian process, also contains all data y_max: The maxima of the found y values x:The point at which to evaluate the acquisition function Output: acq_value: The value of the aquisition function at point x """ y_max=np.asscalar(y_max) mean, var = gp.predict(x, eval_MSE=True) var2 = np.maximum(var, 1e-8 + 0 * var) z = (mean - y_max)/np.sqrt(var2) out=(mean - y_max) * norm.cdf(z) + np.sqrt(var2) * norm.pdf(z) out[var2<1e-8]=0 return out def _ei_regularizerH(self,x, gp, y_max,x_bar,R=0.5): """ Calculates the EI acquisition function values with a hinge regulariser Inputs: gp: The Gaussian process, also contains all data y_max: The maxima of the found y values x:The point at which to evaluate the acquisition function x_bar: Centroid for the regulariser R: Radius for the regulariser Output: acq_value: The value of the aquisition function at point x """ mean, var = gp.predict(x, eval_MSE=True) extended_bound=np.array(self.scalebounds).copy() extended_bound=extended_bound.reshape(self.dim,-1) extended_bound[:,0]=extended_bound[:,0]-2 extended_bound[:,1]=extended_bound[:,1]+2 for d in range(0,self.dim): extended_bound[d,0]=max(extended_bound[d,0],0) extended_bound[d,1]=min(extended_bound[d,1],max_bound_size) #compute regularizer xi dist= np.linalg.norm(x - x_bar) if dist>R: xi=dist/R-1 else: xi=0 if gp.nGP==0: var = np.maximum(var, 1e-9 + 0 * var) z = (mean - y_max-y_max*xi)/np.sqrt(var) out=(mean - y_max-y_max*xi) * norm.cdf(z) + np.sqrt(var) * norm.pdf(z) return out else: z=[None]*gp.nGP out=[None]*gp.nGP # Avoid points with zero variance for idx in range(gp.nGP): var[idx] = np.maximum(var[idx], 1e-9 + 0 * var[idx]) z[idx] = (mean[idx] - y_max-y_max*xi)/np.sqrt(var[idx]) out[idx]=(mean[idx] - y_max-y_max*xi) * norm.cdf(z[idx]) + np.sqrt(var[idx]) * norm.pdf(z[idx]) if len(x)==1000: return out else: return np.mean(out)# get mean over acquisition functions return np.prod(out,axis=0) # get product over acquisition functions class ThompsonSampling(object): """ Class used for calulating Thompson samples. Re-usable calculations are done in __init__ to reduce compuational cost. """ #Calculates the thompson sample paramers def __init__(self,gp,seed=False): var_mag=1 ls_mag=1 if seed!=False: np.random.seed(seed) dim=gp.X.shape[1] # used for Thompson Sampling self.WW_dim=200 # dimension of random feature self.WW=np.random.multivariate_normal([0]*self.WW_dim,np.eye(self.WW_dim),dim)/(gp.lengthscale*ls_mag) self.bias=np.random.uniform(0,2*3.14,self.WW_dim) # computing Phi(X)^T=[phi(x_1)....phi(x_n)] Phi_X=np.sqrt(2.0/self.WW_dim)*np.hstack([np.sin(np.dot(gp.X,self.WW)+self.bias), np.cos(np.dot(gp.X,self.WW)+self.bias)]) # [N x M] # computing A^-1 A=np.dot(Phi_X.T,Phi_X)+np.eye(2*self.WW_dim)*gp.noise_delta*var_mag gx=
np.dot(Phi_X.T,gp.Y)
numpy.dot
from __future__ import absolute_import from __future__ import division from __future__ import print_function import multiprocessing import random from itertools import product, repeat import numpy as np import tensorflow as tf from cleverhans.attacks import SPSA from cleverhans.model import Model from foolbox.attacks import BoundaryAttack as FoolboxBoundaryAttack from imagenet_c import corrupt from six.moves import xrange from unrestricted_advex.cleverhans_fast_spatial_attack import SpatialTransformationMethod class Attack(object): name = None # TODO: Refactor this out of this object _stop_after_n_datapoints = None # An attack can optionally run on only a subset of the dataset def __call__(self, *args, **kwargs): raise NotImplementedError() class CleanData(Attack): """Also known as the "null attack". Just returns the unaltered clean image""" name = 'clean' def __call__(self, model_fn, images_batch_nhwc, y_np): del y_np, model_fn # unused return images_batch_nhwc class SpsaAttack(Attack): name = 'spsa' def __init__(self, model, image_shape_hwc, epsilon=(16. / 255), num_steps=200, batch_size=32, is_debug=False): self.graph = tf.Graph() with self.graph.as_default(): self.sess = tf.Session(graph=self.graph) self.x_input = tf.placeholder(tf.float32, shape=(1,) + image_shape_hwc) self.y_label = tf.placeholder(tf.int32, shape=(1,)) self.model = model attack = SPSA(CleverhansPyfuncModelWrapper(self.model), sess=self.sess) self.x_adv = attack.generate( self.x_input, y=self.y_label, epsilon=epsilon, num_steps=num_steps, early_stop_loss_threshold=-1., batch_size=batch_size, is_debug=is_debug) self.graph.finalize() def __call__(self, model, x_np, y_np): # (4. / 255)): if model != self.model: raise ValueError('Cannot call spsa attack on different models') del model # unused except to check that we already wired it up right with self.graph.as_default(): all_x_adv_np = [] for i in xrange(len(x_np)): x_adv_np = self.sess.run(self.x_adv, feed_dict={ self.x_input: np.expand_dims(x_np[i], axis=0), self.y_label: np.expand_dims(y_np[i], axis=0), }) all_x_adv_np.append(x_adv_np) return np.concatenate(all_x_adv_np) def corrupt_float32_image(x, corruption_name, severity): """Convert to uint8 and back to conform to corruption API""" x = np.copy(x) # We make a copy to avoid changing things in-place x = (x * 255).astype(np.uint8) corrupt_x = corrupt( x, corruption_name=corruption_name, severity=severity) return corrupt_x.astype(np.float32) / 255. def _corrupt_float32_image_star(args): return corrupt_float32_image(*args) class CommonCorruptionsAttack(Attack): name = "common_corruptions" def __init__(self, severity=1): self.corruption_names = [ 'gaussian_noise', 'shot_noise', 'impulse_noise', 'defocus_blur', 'glass_blur', 'motion_blur', 'zoom_blur', # 'snow', # Snow does not work in python 2.7 # 'frost', # Frost is not working correctly 'fog', 'brightness', 'contrast', 'elastic_transform', 'pixelate', 'jpeg_compression', 'speckle_noise', 'gaussian_blur', 'spatter', 'saturate'] self.severity = severity self.pool = multiprocessing.Pool(len(self.corruption_names)) def __call__(self, model_fn, images_batch_nhwc, y_np): assert images_batch_nhwc.shape[1:] == (224, 224, 3), \ "Image shape must equal (N, 224, 224, 3)" batch_size = len(images_batch_nhwc) # Keep track of the worst corruption for each image worst_corruption = np.copy(images_batch_nhwc) worst_loss = [np.NINF] * batch_size # Iterate through each image in the batch for batch_idx, x in enumerate(images_batch_nhwc): corrupt_args = [(x, corruption_name, self.severity) for corruption_name in self.corruption_names] corrupt_x_batch = self.pool.map(_corrupt_float32_image_star, corrupt_args) logits_batch = model_fn(np.array(corrupt_x_batch)) label = y_np[batch_idx] # This is left un-vectorized for readability for (logits, corrupt_x) in zip(logits_batch, corrupt_x_batch): correct_logit, wrong_logit = logits[label], logits[1 - label] # We can choose different loss functions to optimize in the # attack. For now, optimize the magnitude of the wrong logit # because we use this as our confidence threshold loss = wrong_logit # loss = wrong_logit - correct_logit if loss > worst_loss[batch_idx]: worst_corruption[batch_idx] = corrupt_x worst_loss[batch_idx] = loss return worst_corruption class BoundaryAttack(Attack): name = "boundary" def __init__(self, model, image_shape_hwc, max_l2_distortion=4, label_to_examples=None): if label_to_examples is None: label_to_examples = {} self.max_l2_distortion = max_l2_distortion class Model: def bounds(self): return [0, 1] def predictions(self, img): return model(img[np.newaxis, :, :, :])[0] def batch_predictions(self, img): return model(img) self.label_to_examples = label_to_examples h, w, c = image_shape_hwc mse_threshold = max_l2_distortion ** 2 / (h * w * c) try: # Foolbox 1.5 allows us to use a threshold the attack will abort after # reaching. Because we only care about a distortion of less than 4, as soon # as we reach it, we can just abort and move on to the next image. self.attack = FoolboxBoundaryAttack(model=Model(), threshold=mse_threshold) except: # Fall back to the original implementation. print("WARNING: Using foolbox version < 1.5 will cuase the " "boundary attack to perform more work than is required. " "Please upgrade to version 1.5") self.attack = FoolboxBoundaryAttack(model=Model()) def __call__(self, model, x_np, y_np): r = [] for i in range(len(x_np)): other = 1 - y_np[i] initial_adv = random.choice(self.label_to_examples[other]) try: adv = self.attack(x_np[i], y_np[i], log_every_n_steps=100, # Reduce verbosity of the attack starting_point=initial_adv ) distortion = np.sum((x_np[i] - adv) ** 2) ** .5 if distortion > self.max_l2_distortion: # project to the surface of the L2 ball adv = x_np[i] + (adv - x_np[i]) / distortion * self.max_l2_distortion except AssertionError as error: if str(error).startswith("Invalid starting point provided."): print("WARNING: The model misclassified the starting point (the target) " "from BoundaryAttack. This means that the attack will fail on this " "specific point (but is likely to succeed on other points.") adv = x_np[i] # Just return the non-adversarial point else: raise error r.append(adv) return np.array(r) class FastSpatialGridAttack(Attack): """Fast attack from "A Rotation and a Translation Suffice: Fooling CNNs with Simple Transformations", Engstrom et al. 2018 https://arxiv.org/pdf/1712.02779.pdf """ name = 'spatial_grid' def __init__(self, model, image_shape_hwc, spatial_limits, grid_granularity, black_border_size, ): self.graph = tf.Graph() with self.graph.as_default(): self.sess = tf.Session(graph=self.graph) self.x_input = tf.placeholder( tf.float32, shape=[None] + list(image_shape_hwc)) self.y_input = tf.placeholder(tf.float32, shape=(None, 2)) self.model = model attack = SpatialTransformationMethod( CleverhansPyfuncModelWrapper(self.model), sess=self.sess) self.x_adv = attack.generate( self.x_input, y=self.y_input, n_samples=None, dx_min=-float(spatial_limits[0]) / image_shape_hwc[0], dx_max=float(spatial_limits[0]) / image_shape_hwc[0], n_dxs=grid_granularity[0], dy_min=-float(spatial_limits[1]) / image_shape_hwc[1], dy_max=float(spatial_limits[1]) / image_shape_hwc[1], n_dys=grid_granularity[1], angle_min=-spatial_limits[2], angle_max=spatial_limits[2], n_angles=grid_granularity[2], black_border_size=black_border_size, ) self.graph.finalize() def __call__(self, model_fn, x_np, y_np): if model_fn != self.model: raise ValueError('Cannot call spatial attack on different models') del model_fn # unused except to check that we already wired it up right y_np_one_hot = np.zeros([len(y_np), 2], np.float32) y_np_one_hot[np.arange(len(y_np)), y_np] = 1.0 # Reduce the batch size to 1 to avoid OOM errors with self.graph.as_default(): all_x_adv_np = [] for i in xrange(len(x_np)): x_adv_np = self.sess.run(self.x_adv, feed_dict={ self.x_input: np.expand_dims(x_np[i], axis=0), self.y_input: np.expand_dims(y_np_one_hot[i], axis=0), }) all_x_adv_np.append(x_adv_np) return np.concatenate(all_x_adv_np) class SpatialGridAttack(Attack): """Attack from "A Rotation and a Translation Suffice: Fooling CNNs with Simple Transformations", Engstrom et al. 2018 https://arxiv.org/pdf/1712.02779.pdf """ name = 'spatial_grid' def __init__(self, image_shape_hwc, spatial_limits, grid_granularity, black_border_size, valid_check=None, ): """ :param model_fn: a callable: batch-input -> batch-probability in [0, 1] :param spatial_limits: :param grid_granularity: """ self.limits = spatial_limits self.granularity = grid_granularity self.valid_check = valid_check # Construct graph for spatial attack self.graph = tf.Graph() with self.graph.as_default(): self._x_for_trans = tf.placeholder(tf.float32, shape=[None] + list(image_shape_hwc)) self._t_for_trans = tf.placeholder(tf.float32, shape=[None, 3]) x = apply_black_border( self._x_for_trans, image_height=image_shape_hwc[0], image_width=image_shape_hwc[1], border_size=black_border_size ) self._tranformed_x_op = apply_transformation( x, transform=self._t_for_trans, image_height=image_shape_hwc[0], image_width=image_shape_hwc[1], ) self.session = tf.Session() self.grid_store = [] def __call__(self, model_fn, x_np, y_np): n = len(x_np) grid = product(*list(np.linspace(-l, l, num=g) for l, g in zip(self.limits, self.granularity))) worst_x = np.copy(x_np) max_xent = np.zeros(n) all_correct = np.ones(n).astype(bool) trans_np = np.stack( repeat([0, 0, 0], n)) with self.graph.as_default(): x_downsize_np = self.session.run(self._tranformed_x_op, feed_dict={ self._x_for_trans: x_np, self._t_for_trans: trans_np, }) for horizontal_trans, vertical_trans, rotation in grid: trans_np = np.stack( repeat([horizontal_trans, vertical_trans, rotation], n)) # Apply the spatial attack with self.graph.as_default(): x_np_trans = self.session.run(self._tranformed_x_op, feed_dict={ self._x_for_trans: x_np, self._t_for_trans: trans_np, }) # See how the model_fn performs on the perturbed input logits = model_fn(x_np_trans) preds = np.argmax(logits, axis=1) cur_xent = _sparse_softmax_cross_entropy_with_logits_from_numpy( logits, y_np, self.graph, self.session) cur_xent = np.asarray(cur_xent) cur_correct = np.equal(y_np, preds) if self.valid_check: is_valid = self.valid_check(x_downsize_np, x_np_trans) cur_correct |= ~is_valid cur_xent -= is_valid * 1e9 # Select indices to update: we choose the misclassified transformation # of maximum xent (or just highest xent if everything else if correct). idx = (cur_xent > max_xent) & (cur_correct == all_correct) idx = idx | (cur_correct < all_correct) max_xent =
np.maximum(cur_xent, max_xent)
numpy.maximum
import random import numpy as np from model.model_manager import ModelManager from model.input_pipeline import ALInputPipeline from model.monte_carlo_evaluation import get_monte_carlo_metric from preprocessing.dataset import load def get_al_manager(al_type): if al_type == 'common': return ActiveLearningModelManager elif al_type == 'continuous': return ContinuousActiveLearning elif al_type == 'ceal': return CealModelManager class ActiveLearningModelManager(ModelManager): def __init__(self, model_params, active_learning_params, verbose): self.active_learning_params = active_learning_params self.round = 0 super().__init__(model_params, verbose) def create_dataset(self): train_data = self.model_params['train_data'] validation_data = self.model_params['validation_data'] test_data = self.model_params['test_data'] batch_size = self.model_params['batch_size'] perform_shuffle = self.model_params['perform_shuffle'] bucket_width = self.model_params['bucket_width'] num_buckets = self.model_params['num_buckets'] input_pipeline = ALInputPipeline( train_data, validation_data, test_data, batch_size, perform_shuffle, bucket_width, num_buckets) input_pipeline.build_pipeline() return input_pipeline def get_index(self, train_labels, label, size): # Initialize variable with a single 0 label_indexes = np.zeros(shape=(1), dtype=np.int64) for index, review_label in enumerate(train_labels): if review_label == label: label_indexes = np.append(label_indexes, np.array([index], dtype=np.int64)) # Remove initialization variable label_indexes = label_indexes[1:] np.random.shuffle(label_indexes) return label_indexes[:size] def create_initial_dataset(self): train_file = self.active_learning_params['train_file'] test_file = self.active_learning_params['test_file'] train_initial_size = self.active_learning_params['train_initial_size'] train_data = load(train_file) test_data = load(test_file) random.shuffle(train_data) data_ids, data_labels, data_sizes = [], [], [] test_ids, test_labels, test_sizes = [], [], [] for word_ids, label, size in train_data: data_ids.append(word_ids) data_labels.append(label) data_sizes.append(size) for word_ids, label, size in test_data: test_ids.append(word_ids) test_labels.append(label) test_sizes.append(size) train_ids = np.array(data_ids[:train_initial_size]) train_labels = np.array(data_labels[:train_initial_size]) train_sizes = np.array(data_sizes[:train_initial_size]) unlabeled_ids = np.array(data_ids[train_initial_size:]) unlabeled_labels = np.array(data_labels[train_initial_size:]) unlabeled_sizes = np.array(data_sizes[train_initial_size:]) size = int(train_initial_size / 2) negative_samples = self.get_index(train_labels, 0, size) positive_samples = self.get_index(train_labels, 1, size) train_indexes = np.concatenate([negative_samples, positive_samples]) np.random.shuffle(train_indexes) labeled_dataset = (train_ids[train_indexes], train_labels[train_indexes], train_sizes[train_indexes]) unlabeled_dataset = (unlabeled_ids, unlabeled_labels, unlabeled_sizes) test_dataset = (test_ids, test_labels, test_sizes) return labeled_dataset, unlabeled_dataset, test_dataset def unlabeled_uncertainty(self, uncertainty_metric, pool_ids, pool_sizes, num_classes, num_samples=10): MonteCarlo = get_monte_carlo_metric(uncertainty_metric) monte_carlo_evaluation = MonteCarlo( sess=self.sess, model=self.recurrent_model, data_batch=pool_ids, sizes_batch=pool_sizes, labels_batch=None, num_classes=num_classes, num_samples=num_samples, max_len=self.active_learning_params['max_len'], verbose=self.verbose) print('Getting prediction samples ...') variation_ratios = monte_carlo_evaluation.evaluate() return variation_ratios def select_samples(self): sample_size = self.active_learning_params['sample_size'] if sample_size >= self.unlabeled_dataset_id.shape[0]: sample_size = self.unlabeled_dataset_id.shape[0] - 1 pool_indexes = np.array( random.sample(range(0, self.unlabeled_dataset_id.shape[0]), sample_size) ) pool_ids = self.unlabeled_dataset_id[pool_indexes] pool_labels = self.unlabeled_dataset_labels[pool_indexes] pool_sizes = self.unlabeled_dataset_sizes[pool_indexes] return (pool_ids, pool_labels, pool_sizes, pool_indexes) def select_new_examples(self, pool_ids, pool_labels, pool_sizes): num_passes = self.active_learning_params['num_passes'] num_queries = self.active_learning_params['num_queries'] uncertainty_metric = self.active_learning_params['uncertainty_metric'] num_classes = self.model_params['num_classes'] unlabeled_uncertainty = self.unlabeled_uncertainty( uncertainty_metric, pool_ids, pool_sizes, num_classes, num_passes) new_samples = unlabeled_uncertainty.argsort()[-num_queries:][::-1] np.random.shuffle(new_samples) pooled_id = pool_ids[new_samples] pooled_labels = pool_labels[new_samples] pooled_sizes = pool_sizes[new_samples] return pooled_id, pooled_labels, pooled_sizes, new_samples def new_labeled_dataset(self, pooled_id, pooled_labels, pooled_sizes): labeled_id = self.labeled_dataset[0] labeled_labels = self.labeled_dataset[1] labeled_sizes = self.labeled_dataset[2] labeled_id = np.concatenate([labeled_id, pooled_id], axis=0) labeled_labels = np.concatenate([labeled_labels, pooled_labels], axis=0) labeled_sizes = np.concatenate([labeled_sizes, pooled_sizes], axis=0) return labeled_id, labeled_labels, labeled_sizes def remove_data_from_dataset(self, ids, labels, sizes, data_index): deleted_ids = np.delete(ids, (data_index), axis=0) deleted_labels = np.delete(labels, (data_index), axis=0) deleted_sizes = np.delete(sizes, (data_index), axis=0) return deleted_ids, deleted_labels, deleted_sizes def update_unlabeled_dataset(self, delete_id, delete_id_sample, delete_labels, delete_labels_sample, delete_sizes, delete_sizes_sample): self.unlabeled_dataset_id = np.concatenate([delete_id, delete_id_sample], axis=0) self.unlabeled_dataset_labels = np.concatenate([delete_labels, delete_labels_sample], axis=0) self.unlabeled_dataset_sizes = np.concatenate([delete_sizes, delete_sizes_sample], axis=0) def clear_train_dataset(self): return None def update_labeled_dataset(self, pool_ids, pool_labels, pool_sizes): sample_id, sample_labels, sample_sizes, sample_index = self.select_new_examples( pool_ids, pool_labels, pool_sizes) labeled_id, labeled_labels, labeled_sizes = self.new_labeled_dataset( sample_id, sample_labels, sample_sizes) self.labeled_dataset = (labeled_id, labeled_labels, labeled_sizes) return sample_index def set_random_seeds(self): metric = self.active_learning_params['uncertainty_metric'] if metric == 'variation_ratio': random.seed(9011) elif metric == 'entropy': random.seed(2001) elif metric == 'bald': random.seed(5001) elif metric == 'random': random.seed(9001) elif metric == 'softmax': return random.seed(7001) elif metric == 'ceal': return random.seed(6001) def manage_graph(self): self.reset_graph() def run_cycle(self): self.set_random_seeds() (self.labeled_dataset, unlabeled_dataset, test_dataset) = self.create_initial_dataset() self.unlabeled_dataset_id = unlabeled_dataset[0] self.unlabeled_dataset_labels = unlabeled_dataset[1] self.unlabeled_dataset_sizes = unlabeled_dataset[2] test_accuracies, train_data_sizes = [], [] self.model_params['num_validation'] = self.active_learning_params['sample_size'] self.model_params['test_data'] = test_dataset for i in range(self.active_learning_params['num_rounds']): print('Starting round {}'.format(i)) pool_ids, pool_labels, pool_sizes, pool_indexes = self.select_samples() pool_dataset = (pool_ids, pool_labels, pool_sizes) print('Train data size: {}'.format(len(self.labeled_dataset[0]))) self.model_params['train_data'] = self.labeled_dataset self.model_params['validation_data'] = pool_dataset _, _, _, test_accuracy = self.run_model() test_accuracies.append(test_accuracy) self.clear_train_dataset() train_data_sizes.append(len(self.labeled_dataset[0])) sample_index = self.update_labeled_dataset(pool_ids, pool_labels, pool_sizes) self.manage_graph() (delete_id_sample, delete_labels_sample, delete_sizes_sample) = self.remove_data_from_dataset( pool_ids, pool_labels, pool_sizes, sample_index) delete_id, delete_labels, delete_sizes = self.remove_data_from_dataset( self.unlabeled_dataset_id, self.unlabeled_dataset_labels, self.unlabeled_dataset_sizes, pool_indexes) self.unlabeled_dataset_id =
np.concatenate([delete_id, delete_id_sample], axis=0)
numpy.concatenate
import os import sys import socket import numpy as np import h5py import scipy from scipy.io import loadmat sys.path.append('./latent_3d_points_py3/') from latent_3d_points_py3.src import in_out from latent_3d_points_py3.src.general_utils import plot_3d_point_cloud from functools import partial import tqdm import tensorflow as tf import tensorflow.math as tm import multiprocessing import torch # from numpy import pi, cos, sin, arccos, arange BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(BASE_DIR) # Download dataset for point cloud classification DATA_DIR = os.path.join(BASE_DIR, 'data') if socket.gethostname == 'tianxing-GS73-7RE': SHAPENET_DIR = '/media/tianxing/Data/datasets/shape_net_core_uniform_samples_2048/' else: SHAPENET_DIR = './data/shape_net_core_uniform_samples_2048/' scratch_shapenet_dir = '/scratch/shape_net_core_uniform_samples_2048' if os.path.exists(scratch_shapenet_dir): SHAPENET_DIR = scratch_shapenet_dir print(f'Loading shapenet from {SHAPENET_DIR}') if not os.path.exists(DATA_DIR): os.mkdir(DATA_DIR) if not os.path.exists(os.path.join(DATA_DIR, 'modelnet40_ply_hdf5_2048')): www = 'https://shapenet.cs.stanford.edu/media/modelnet40_ply_hdf5_2048.zip' zipfile = os.path.basename(www) os.system('wget %s; unzip %s' % (www, zipfile)) os.system('mv %s %s' % (zipfile[:-4], DATA_DIR)) os.system('rm %s' % (zipfile)) def get_shapenet_data(): labels_lst = list(in_out.snc_category_to_synth_id().keys()) data = [] labels = [] for label in tqdm.tqdm(labels_lst, desc='loading data'): syn_id = in_out.snc_category_to_synth_id()[label] class_dir = os.path.join(SHAPENET_DIR , syn_id) pc = in_out.load_all_point_clouds_under_folder(class_dir, n_threads=8, file_ending='*.ply', verbose=False) cur_data, _, _ = pc.full_epoch_data(shuffle=False) data.append(cur_data) labels.append([labels_lst.index(label)] * cur_data.shape[0]) current_data = np.concatenate(data, axis=0) current_label = np.concatenate(labels, axis=0) print(current_data.shape) print(current_label.shape) current_data, current_label, _ = shuffle_data(current_data, np.squeeze(current_label)) current_label = np.squeeze(current_label) return current_data, current_label def shuffle_data(data, labels): """ Shuffle data and labels. Input: data: B,N,... numpy array label: B,... numpy array Return: shuffled data, label and shuffle indices """ idx = np.arange(len(labels)) np.random.shuffle(idx) return data[idx, ...], labels[idx], idx def rotate_point_cloud(batch_data): """ Randomly rotate the point clouds to augument the dataset rotation is per shape based along up direction Input: BxNx3 array, original batch of point clouds Return: BxNx3 array, rotated batch of point clouds Bx1 array, rotated angle for all point clouds """ rotated_data = np.zeros(batch_data.shape, dtype=np.float32) angles = np.zeros(batch_data.shape, dtype=np.float32) for k in range(batch_data.shape[0]): rotation_angle = np.random.uniform() * 2 * np.pi cosval = np.cos(rotation_angle) sinval = np.sin(rotation_angle) rotation_matrix = np.array([[cosval, 0, sinval], [0, 1, 0], [-sinval, 0, cosval]]) shape_pc = batch_data[k, ...] rotated_data[k, ...] = np.dot(shape_pc.reshape((-1, 3)), rotation_matrix) angles[k, ...] = rotation_angle return rotated_data, angles def rotate_tensor_point_cloud(point_cloud): """ Randomly rotate one tensor point cloud Nx3 tensor, original point cloud Return: Nx3 tensor, rotated point clouds """ random_angles = np.random.uniform(size = 3) * 2 * np.pi angle_x, angle_y, angle_z = random_angles[0], random_angles[1], random_angles[2] rotated_tensor = rotate_tensor_by_angle_xyz(point_cloud, angle_x, angle_y, angle_z) return rotated_tensor def rotate_point_cloud_by_angle(batch_data, rotation_angle): """ Rotate the point cloud along up direction with certain angle. Input: BxNx3 array, original batch of point clouds Return: BxNx3 array, rotated batch of point clouds """ rotated_data = np.zeros(batch_data.shape, dtype=np.float32) for k in range(batch_data.shape[0]): #rotation_angle = np.random.uniform() * 2 * np.pi cosval = np.cos(rotation_angle) sinval = np.sin(rotation_angle) rotation_matrix = np.array([[cosval, 0, sinval], [0, 1, 0], [-sinval, 0, cosval]]) shape_pc = batch_data[k, ...] rotated_data[k, ...] = np.dot(shape_pc.reshape((-1, 3)), rotation_matrix) return rotated_data def rotate_point_cloud_by_angle_list(batch_data, rotation_angles): """ Rotate the point cloud along up direction with certain angle list. Input: BxNx3 array, original batch of point clouds Return: BxNx3 array, rotated batch of point clouds """ rotated_data = np.zeros(batch_data.shape, dtype=np.float32) for k in range(batch_data.shape[0]): #rotation_angle = np.random.uniform() * 2 * np.pi cosval = np.cos(rotation_angles[k]) sinval = np.sin(rotation_angles[k]) rotation_matrix = np.array([[cosval, 0, sinval], [0, 1, 0], [-sinval, 0, cosval]]) shape_pc = batch_data[k, ...] rotated_data[k, ...] = np.dot(shape_pc.reshape((-1, 3)), rotation_matrix) return rotated_data def rotate_point_cloud_by_angle_xyz(batch_data, angle_x=0, angle_y=0, angle_z=0): """ Rotate the point cloud along up direction with certain angle. Rotate in the order of x, y and then z. Input: BxNx3 array, original batch of point clouds Return: BxNx3 array, rotated batch of point clouds """ rotated_data = batch_data.reshape((-1, 3)) cosval = np.cos(angle_x) sinval = np.sin(angle_x) rotation_matrix = np.array([[1, 0, 0], [0, cosval, -sinval], [0, sinval, cosval]]) rotated_data = np.dot(rotated_data, rotation_matrix) cosval = np.cos(angle_y) sinval = np.sin(angle_y) rotation_matrix = np.array([[cosval, 0, sinval], [0, 1, 0], [-sinval, 0, cosval]]) rotated_data = np.dot(rotated_data, rotation_matrix) cosval = np.cos(angle_z) sinval = np.sin(angle_z) rotation_matrix = np.array([[cosval, -sinval, 0], [sinval, cosval, 0], [0, 0, 1]]) rotated_data = np.dot(rotated_data, rotation_matrix) return rotated_data.reshape(batch_data.shape) def rotate_point_cloud_by_angle_xyz_cuda(batch_data, angle_x=0, angle_y=0, angle_z=0): """ Same interface as rotate_point_cloud_by_angle_xyz, but use gpu to compute """ rotated_data = torch.Tensor(batch_data).cuda() rotated_data = rotated_data.view((-1, 3)) cosval = np.cos(angle_x) sinval = np.sin(angle_x) rotation_matrix = torch.Tensor([[1, 0, 0], [0, cosval, -sinval], [0, sinval, cosval]]) rotation_matrix = rotation_matrix.cuda() rotated_data = torch.mm(rotated_data, rotation_matrix) cosval = np.cos(angle_y) sinval = np.sin(angle_y) rotation_matrix = torch.Tensor([[cosval, 0, sinval], [0, 1, 0], [-sinval, 0, cosval]]) rotation_matrix = rotation_matrix.cuda() rotated_data = torch.mm(rotated_data, rotation_matrix) cosval = np.cos(angle_z) sinval = np.sin(angle_z) rotation_matrix = torch.Tensor([[cosval, -sinval, 0], [sinval, cosval, 0], [0, 0, 1]]) rotation_matrix = rotation_matrix.cuda() rotated_data = torch.mm(rotated_data, rotation_matrix) rotated_data = rotated_data.view(batch_data.shape) return rotated_data.cpu().numpy() def rotate_point_cloud_by_axis_angle(batch_data, u, theta): """ Rotate the point cloud around the axis u by angle theta u is a list of tuples, B * (x,y,z), consisting of unit vectors of the axis theta is a list of angles, B length array, representing the angle Input: BxNx3 array, original batch of point clouds Return: BxNx3 array, rotated batch of point clouds """ u = np.squeeze(u) theta = np.squeeze(theta) eps = 1e-6 rotated_data = np.zeros(batch_data.shape, dtype=np.float32) for k in range(batch_data.shape[0]): x, y, z = u[k] assert 1-eps < x*x+y*y+z*z < 1+eps cosval = np.cos(theta[k]) sinval = np.sin(theta[k]) rotation_matrix = np.array([[cosval + x*x*(1-cosval), x*y*(1-cosval) - z*sinval, x*z*(1-cosval) + y*sinval], [y*x*(1-cosval) + z*sinval, cosval + y*y*(1-cosval), y*z*(1-cosval) - x*sinval], [z*x*(1-cosval) - y*sinval, z*y*(1-cosval) + x*sinval, cosval + z*z*(1-cosval)]]) shape_pc = batch_data[k, ...] rotated_data[k, ...] = np.dot(shape_pc.reshape((-1, 3)), rotation_matrix) return rotated_data def tflt(value): return tf.constant(value, dtype=tf.float32) def rotate_tensor_by_angle_xyz(input_data, graph, angle_x=0, angle_y=0, angle_z=0): """ Rotate the point cloud along up direction with certain angle. Rotate in the order of x, y and then z. Input: input_data: Nx3 tensor, original batch of point clouds angle_x: tf constant angle_y: tf constant angle_z: tf constant Return: Nx3 tensor, rotated batch of point clouds """ with graph.as_default(): # print('angle_x', angle_x) if angle_x == 0: angle_x = tflt(0) if angle_y == 0: angle_y = tflt(0) if angle_z == 0: angle_z = tflt(0) input_data = tf.cast(input_data, tf.float32) rotation_matrix1 = tf.stack([1, 0, 0, 0, tm.cos(angle_x), -tm.sin(angle_x), 0, tm.sin(angle_x), tm.cos(angle_x)]) rotation_matrix1 = tf.reshape(rotation_matrix1, (3,3)) rotation_matrix1 = tf.cast(rotation_matrix1, tf.float32) shape_pc = tf.matmul(input_data, rotation_matrix1) rotation_matrix2 = tf.stack([tm.cos(angle_y), 0, tm.sin(angle_y), 0, 1, 0, -tm.sin(angle_y), 0, tm.cos(angle_y)]) rotation_matrix2 = tf.reshape(rotation_matrix2, (3,3)) rotation_matrix2 = tf.cast(rotation_matrix2, tf.float32) shape_pc = tf.matmul(shape_pc, rotation_matrix2) rotation_matrix3 = tf.stack([tm.cos(angle_z), -tm.sin(angle_z), 0, tm.sin(angle_z), tm.cos(angle_z), 0, 0, 0, 1]) rotation_matrix3 = tf.reshape(rotation_matrix3, (3,3)) rotation_matrix3 = tf.cast(rotation_matrix3, tf.float32) shape_pc = tf.matmul(shape_pc, rotation_matrix3) return shape_pc def rotate_tensor_by_batch(batch_data, label): batch_size = batch_data.get_shape().as_list()[0] phi, theta = get_sunflower_angle(batch_size, label) rotate_fun = partial(rotate_tensor_by_angle_xyz, angle_x=theta, angle_z=phi) rotated_data = tf.map_fn(rotate_fun, batch_data) return rotated_data def get_sunflower_angle(num_points, label): pts = sunflower_distri(num_points) pt = pts[label] phi = compute_angle([pt[0],pt[1],0],[1,0,0]) theta = compute_angle(pt,[0,0,1]) return phi, theta def nested_tf_cond(conditions, callables): cond, to_call = conditions[0], callables[0] if len(conditions) == 1: return tf.cond(cond, lambda: to_call, lambda: to_call) else: return tf.cond(cond, lambda: to_call, lambda: nested_tf_cond(conditions[1:], callables[1:])) def rotate_tensor_by_label(batch_data, label, graph): """ Rotate a batch of points by [label] to 6 or 18 possible angles [label] is a tensor Input: BxNx3 array Return: BxNx3 array """ with graph.as_default(): batch_size = batch_data.get_shape().as_list()[0] rotated_data = [None] * batch_size splits = tf.split(batch_data, batch_size, 0) label = tf.dtypes.cast(label, dtype=tf.float32) label = tf.split(label, batch_size, 0) label = [tf.squeeze(l) for l in label] for k in range(batch_size): shape_pc = splits[k] l = label[k] cond0 = tm.equal(tflt(0), l) cond1 = tm.logical_and(tm.less_equal(tflt(1), l), tm.less_equal(l, tflt(3))) cond2 = tm.logical_and(tm.less_equal(tflt(4), l), tm.less_equal(l, tflt(5))) cond3 = tm.logical_and(tm.less_equal(tflt(6), l), tm.less_equal(l, tflt(9))) cond4 = tm.logical_and(tm.less_equal(tflt(10), l), tm.less_equal(l, tflt(13))) cond5 = tm.logical_and(tm.less_equal(tflt(14), l), tm.less_equal(l, tflt(17))) call0= rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=0) call1= rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=(l)*np.pi/4) call2 = rotate_tensor_by_angle_xyz(shape_pc, graph, angle_z=(l*2-7)*np.pi/2) call3 = rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=(l*2-11)*np.pi/4) call4 = rotate_tensor_by_angle_xyz(shape_pc, graph, angle_z=(l*2-19)*np.pi/4) call5 = rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=np.pi/2, angle_z=(l*2-27)*np.pi/4) conditions = [cond0, cond1, cond2, cond3, cond4, cond5] callables = [call0, call1, call2, call3, call4, call5] shape_pc = nested_tf_cond(conditions, callables) rotated_data[k] = shape_pc rotated_data = tf.squeeze(tf.stack(rotated_data, axis=0)) return rotated_data def rotate_point_by_label(batch_data, label): """ Rotate a batch of points by the label Input: BxNx3 array Return: BxNx3 array """ rotate_func = rotate_point_cloud_by_angle_xyz batch_size = batch_data.shape[0] rotated_data = np.zeros(batch_data.shape, dtype=np.float32) for k in range(batch_size): shape_pc = batch_data[k, ...] l = label[k] if l==0: pass elif 1<=l<=3: shape_pc = rotate_func(shape_pc, angle_x=l*np.pi/2) elif 4<=l<=5: shape_pc = rotate_func(shape_pc, angle_z=(l*2-7)*np.pi/2) elif 6<=l<=9: shape_pc = rotate_func(shape_pc, angle_x=(l*2-11)*np.pi/4) elif 10<=l<=13: shape_pc = rotate_func(shape_pc, angle_z=(l*2-19)*np.pi/4) else: #l == 14 ~ 17 shape_pc = rotate_func(shape_pc, angle_x=np.pi/2, angle_z=(l*2-27)*np.pi/4) rotated_data[k, ...] = shape_pc return rotated_data def rotate_tensor_by_label_32(batch_data, label, graph): """ Rotate a batch of points by the label 32 possible directions: vertices of a regular icosahedron vertices of a regular dodecahedron Input: BxNx3 array Return: BxNx3 array """ with graph.as_default(): batch_size = batch_data.get_shape().as_list()[0] rotated_data = [None] * batch_size splits = tf.split(batch_data, batch_size, 0) label = tf.dtypes.cast(label, dtype=tf.float32) label = tf.split(label, batch_size, 0) label = [tf.squeeze(l) for l in label] for k in range(batch_size): shape_pc = splits[k] l = label[k] cond0 = tm.equal(tflt(0), l) cond1 = tm.logical_and(tm.less_equal(tflt(1), l), tm.less_equal(l, tflt(5))) cond2 = tm.logical_and(tm.less_equal(tflt(6), l), tm.less_equal(l, tflt(10))) cond3 = tm.logical_and(tm.less_equal(tflt(11), l), tm.less_equal(l, tflt(20))) cond4 = tm.logical_and(tm.less_equal(tflt(21), l), tm.less_equal(l, tflt(25))) cond5 = tm.logical_and(tm.less_equal(tflt(26), l), tm.less_equal(l, tflt(30))) cond6 = tm.equal(tflt(31), l) call0= rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=0) call1= rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=0.646, angle_y=(l-1)*np.pi/2.5) call2 = rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=1.108, angle_y=(l*2-11)*np.pi/5) call3 = rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=np.pi/2, angle_y=(l-11)*np.pi/5) call4 = rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=2.033, angle_y=(l*2-11)*np.pi/5) call5 = rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=2.496, angle_y=(l-26)*np.pi/2.5) call6 = rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=np.pi) conditions = [cond0, cond1, cond2, cond3, cond4, cond5, cond6] callables = [call0, call1, call2, call3, call4, call5, call6] shape_pc = nested_tf_cond(conditions, callables) rotated_data[k] = shape_pc rotated_data = tf.squeeze(tf.stack(rotated_data, axis=0)) return rotated_data def rotate_point_by_label_32(batch_data, label, use_tensor=False): """ Rotate a batch of points by the label 32 possible directions: vertices of a regular icosahedron vertices of a regular dodecahedron Input: BxNx3 array Return: BxNx3 array """ if use_tensor: rotate_func = rotate_tensor_by_angle_xyz batch_size = batch_data.get_shape().as_list()[0] rotated_data = [None] * batch_size splits = tf.split(batch_data, batch_size, 0) else: rotate_func = rotate_point_cloud_by_angle_xyz batch_size = batch_data.shape[0] rotated_data = np.zeros(batch_data.shape, dtype=np.float32) for k in range(batch_size): shape_pc = splits[k] if use_tensor else batch_data[k, ...] l = label[k] if l==0: pass # not rotate, upright elif 0 < l <= 5: # 1 - 5 is the upper layer # rotate down 37 degree, then 72 degree along gravity axis shape_pc = rotate_func(shape_pc, angle_x=0.646, angle_y=(l-1)*np.pi/2.5) elif 6 <= l <= 10: # 6 - 10 is the second layer # rotate down 63.5 degree, then 72 degree along gravity axis shape_pc = rotate_func(shape_pc, angle_x=1.108, angle_y=(l*2-11)*np.pi/5) elif 11 <= l <= 20: # 11 - 20 is the horizontal layer # rotate down 90 degree, then 36 degree along gravity axis shape_pc = rotate_func(shape_pc, angle_x=np.pi/2, angle_y=(l-11)*np.pi/5) elif 21 <= l <= 25: # 21 - 25 is symmetrical to 6 - 10 # rotate down 180 - 63.5 degree, then 72 degree along gravity axis shape_pc = rotate_func(shape_pc, angle_x=2.033, angle_y=(l*2-11)*np.pi/5) elif 26 <= l <= 30: # 26 - 30 is symmetrical to 1 - 5 # rotate down 180 - 37 degree, then 72 degree along gravity axis shape_pc = rotate_func(shape_pc, angle_x=2.496, angle_y=(l-26)*np.pi/2.5) else: # downwards shape_pc = rotate_func(shape_pc, angle_x=np.pi) if use_tensor: rotated_data[k] = shape_pc else: rotated_data[k, ...] = shape_pc if use_tensor: rotated_data = tf.squeeze(tf.stack(rotated_data, axis=0)) return rotated_data def rotate_tensor_by_label_54(batch_data, label, graph): """ Rotate a batch of points by the label 54 possible directions: vertices of a regular icosahedron vertices of a regular dodecahedron Input: BxNx3 array Return: BxNx3 array """ with graph.as_default(): batch_size = batch_data.get_shape().as_list()[0] rotated_data = [None] * batch_size splits = tf.split(batch_data, batch_size, 0) label = tf.dtypes.cast(label, dtype=tf.float32) label = tf.split(label, batch_size, 0) label = [tf.squeeze(l) for l in label] for k in range(batch_size): shape_pc = splits[k] l = label[k] cond0 = tm.logical_or(tm.equal(tflt(0), l), tm.equal(tflt(1), l)) cond1 = tm.logical_and(tm.logical_and(tm.less_equal(tflt(2), l), tm.less_equal(l, tflt(15))), tm.equal(tflt(0), tm.mod(l, tflt(2)))) cond2 = tm.logical_and(tm.logical_and(tm.less_equal(tflt(2), l), tm.less_equal(l, tflt(15))), tm.equal(tflt(1), tm.mod(l, tflt(2)))) cond3 = tm.logical_and(tm.logical_and(tm.less_equal(tflt(16), l), tm.less_equal(l, tflt(39))), tm.equal(tflt(0), tm.mod(l, tflt(2)))) cond4 = tm.logical_and(tm.logical_and(tm.less_equal(tflt(16), l), tm.less_equal(l, tflt(39))), tm.equal(tflt(1), tm.mod(l, tflt(2)))) cond5 = tm.logical_and(tm.less_equal(tflt(40), l), tm.less_equal(l, tflt(53))) call0= rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=np.pi*l) call1= rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=np.pi/6, angle_z=2*(l-2)*np.pi/7) call2 = rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=5*np.pi/6, angle_z=2*(l-2)*np.pi/7) call3 = rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=np.pi/3, angle_z=2*(l-16)*np.pi/12) call4 = rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=2*np.pi/3, angle_z=2*(l-16)*np.pi/12) call5 = rotate_tensor_by_angle_xyz(shape_pc, graph, angle_x=np.pi/2, angle_z=2*(l-40)*np.pi/14) conditions = [cond0, cond1, cond2, cond3, cond4, cond5] callables = [call0, call1, call2, call3, call4, call5] shape_pc = nested_tf_cond(shape_pc, conditions, callables) rotated_data[k] = shape_pc rotated_data = tf.squeeze(tf.stack(rotated_data, axis=0)) return rotated_data def rotate_point_by_label_54(batch_data, label, use_tensor=False): """ Rotate a batch of points by the label 54 possible directions: 2 points at poles 14 points at 30 degrees from the z-axis (7 points on each hemisphere) 24 points at 60 degrees from the z-axis (12 points on each hemisphere) 14 points on the equator Input: BxNx3 array Return: BxNx3 array """ if use_tensor: #only rotate one tensor rotate_func = rotate_tensor_by_angle_xyz batch_size = batch_data.get_shape().as_list()[0] rotated_data = [None] * batch_size splits = tf.split(batch_data, batch_size, 0) else: rotate_func = rotate_point_cloud_by_angle_xyz batch_size = batch_data.shape[0] rotated_data = np.zeros(batch_data.shape, dtype=np.float32) for k in range(batch_size): shape_pc = splits[k] if use_tensor else batch_data[k, ...] l = label[k] # l = 0, ..., 53 if l==0 or l==1: shape_pc = rotate_func(shape_pc, angle_x=np.pi*l) elif 2<=l<=15: shape_pc = rotate_func(shape_pc, angle_z=2*(l-2)*np.pi/7) if l%2==0: shape_pc = rotate_func(shape_pc, angle_x=np.pi/6) else: shape_pc = rotate_func(shape_pc, angle_x=5*np.pi/6) elif 16<=l<=39: shape_pc = rotate_func(shape_pc, angle_z=2*(l-16)*np.pi/12) if l%2==0: shape_pc = rotate_func(shape_pc, angle_x=np.pi/3) else: shape_pc = rotate_func(shape_pc, angle_x=2*np.pi/3) else: shape_pc = rotate_func(shape_pc, angle_x=np.pi/2, angle_z=2*(l-40)*np.pi/14) if use_tensor: rotated_data[k] = shape_pc else: rotated_data[k, ...] = shape_pc if use_tensor: rotated_data = tf.squeeze(tf.stack(rotated_data, axis=0)) return rotated_data def rotate_point_by_label_n(batch_data, label, graph, n, use_tensor=False, distri='sunflower'): """ Rotate a batch of points by the label n possible directions: n points forms a sunflower spiral distribution with golden ratio (1 + sqrt(5))/2 Input: BxNx3 array Return: BxNx3 array """ if use_tensor: #only rotate one tensor rotate_func = rotate_tensor_by_angle_xyz batch_size = batch_data.get_shape().as_list()[0] rotated_data = [None] * batch_size splits = tf.split(batch_data, batch_size, 0) # label = tf.dtypes.cast(label, dtype=tf.float32) # label = tf.split(label, batch_size, 0) # label = [tf.squeeze(l) for l in label] label = np.random.randint(0, n, size=batch_size) else: rotate_func = rotate_point_cloud_by_angle_xyz batch_size = batch_data.shape[0] rotated_data = np.zeros(batch_data.shape, dtype=np.float32) if distri == 'sunflower': pts = sunflower_distri(n) elif distri == 'normal': pts = normal_distri(n) np.random.shuffle(pts) for k in range(batch_data.shape[0]): shape_pc = splits[k] if use_tensor else batch_data[k, ...] l = label[k] # l = 0, ..., n-1 pt = pts[l] phi = compute_angle([pt[0],pt[1],0],[1,0,0]) theta = compute_angle(pt,[0,0,1]) if use_tensor: shape_pc = rotate_func(shape_pc, graph, angle_x=theta, angle_z=phi) rotated_data[k] = shape_pc else: shape_pc = rotate_func(shape_pc, angle_x=theta, angle_z=phi) rotated_data[k, ...] = shape_pc if use_tensor: rotated_data = tf.squeeze(tf.stack(rotated_data, axis=0)) return rotated_data def compute_angle(pt1, pt2): """ Compute the angle between pt1 and pt2 with respect to the origin Input: pt1: 1x3 list pt2: 1x3 list """ a=np.array(pt1) c=np.array(pt2) b = np.array([0, 0, 0]) ba = a - b bc = c - b cosine_angle = np.dot(ba, bc) / (np.linalg.norm(ba) * np.linalg.norm(bc)) angle = np.arccos(cosine_angle) return angle def compute_angle_tensor(pts1, pts2): """ Compute the angle between pt1 and pt2 with respect to the origin Input: pts1: batch_size x 1 x 3 tensor pts2: batch_size x 1 x 3 tensor """ b = tf.constant([0.,0.,0.]) angle_diff = [] for pt1, pt2 in zip(pts1, pts2): ba = tf.subtract(pt1, b) bc = tf.subtract(pt2, b) cosine_angle = tm.divide(tf.tensordot(ba, bc, 1), tm.multiply(tf.norm(ba), tf.norm(bc))) angle = tm.acos(cosine_angle) angle_diff.append(tf.cast(angle, tf.float32)) return tf.stack(angle_diff, axis=0) def sunflower_distri(num_pts): """ Compute [num_pts] of points that conforms a sunflower distribution with golden ratio (1 + sqrt(5))/2 Input: num_pts: number of points, int """ indices = np.arange(0, num_pts, dtype=float) + 0.5 phi = np.arccos(1 - 2*indices/num_pts) theta = np.pi * (1 + 5**0.5) * indices x, y, z = np.cos(theta) * np.sin(phi), np.sin(theta) * np.sin(phi), np.cos(phi) pts=np.concatenate((np.expand_dims(x, axis=1), np.expand_dims(y, axis=1), np.expand_dims(z, axis=1)), axis=1) return pts def normal_distri(num_pts): """ Compute [num_pts] of points following https://stats.stackexchange.com/users/919/whuber with x, y, z conforming to normal distributions Input: num_pts: number of points, int """ pts = np.random.normal(size = (num_pts, 3)) pts_normed = sklearn.preprocessing.normalize(pts, axis=1, norm='l2') return pts_normed def re(x, y, z): return tf.stack([x,y,z], axis=0) def map_label_to_angle_18(label): """ return a list of tensors, each is the rotation angle corresponding to label [l] """ batch_size = label.shape[0] label = tf.dtypes.cast(label, dtype=tf.float32) label = tf.split(label, batch_size, 0) label = [tf.squeeze(l) for l in label] angles = [] for l in label: cond0 = tm.equal(tflt(0), l) cond1 = tm.logical_and(tm.less_equal(tflt(1), l), tm.less_equal(l, tflt(3))) cond2 = tm.logical_and(tm.less_equal(tflt(4), l), tm.less_equal(l, tflt(5))) cond3 = tm.logical_and(tm.less_equal(tflt(6), l), tm.less_equal(l, tflt(9))) cond4 = tm.logical_and(tm.less_equal(tflt(10), l), tm.less_equal(l, tflt(13))) cond5 = tm.logical_and(tm.less_equal(tflt(14), l), tm.less_equal(l, tflt(17))) call0= re(0., 0., 0.) call1= re(l*np.pi/2, 0, 0) call2 = re(0, 0, (l*2-7)*np.pi/2) call3 = re((l*2-11)*np.pi/4, 0, 0) call4 = re(0, 0, (l*2-19)*np.pi/4) call5 = re(np.pi/2, 0, (l*2-27)*np.pi/4) conditions = [cond0, cond1, cond2, cond3, cond4, cond5] callables = [call0, call1, call2, call3, call4, call5] angle = nested_tf_cond(conditions, callables) angles.append(angle) return angles def map_label_to_angle_32(label): """ return a list of tensors, each is the rotation angle corresponding to label [l] """ batch_size = label.shape[0] label = tf.dtypes.cast(label, dtype=tf.float32) label = tf.split(label, batch_size, 0) label = [tf.squeeze(l) for l in label] angles = [] for l in label: cond0 = tm.equal(tflt(0), l) cond1 = tm.logical_and(tm.less_equal(tflt(1), l), tm.less_equal(l, tflt(5))) cond2 = tm.logical_and(tm.less_equal(tflt(6), l), tm.less_equal(l, tflt(10))) cond3 = tm.logical_and(tm.less_equal(tflt(11), l), tm.less_equal(l, tflt(20))) cond4 = tm.logical_and(tm.less_equal(tflt(21), l), tm.less_equal(l, tflt(25))) cond5 = tm.logical_and(tm.less_equal(tflt(26), l), tm.less_equal(l, tflt(30))) cond6 = tm.equal(tflt(31), l) call0= re(0., 0., 0.) call1= re(0.646, (l-1)*np.pi/2.5, 0) call2 = re(1.108, (l*2-11)*np.pi/5, 0) call3 = re(np.pi/2, (l-11)*np.pi/5, 0) call4 = re(2.033, (l*2-11)*np.pi/5, 0) call5 = re(2.496, (l-26)*np.pi/2.5, 0) call6 = re(np.pi, 0, 0) conditions = [cond0, cond1, cond2, cond3, cond4, cond5, cond6] callables = [call0, call1, call2, call3, call4, call5, call6] angle = nested_tf_cond(conditions, callables) angles.append(angle) return angles def get_rotated_angle_diff(num_angles, label1, label2): """ get the angle between two rotation directions, represented as label1 and label2 Input: label1:[batch_size] tensor label2:[batch_size] tensor Return: [batch_size] list of tensors """ label1 = tf.to_int64(label1) label2 = tf.to_int64(label2) if num_angles <= 18: angles1 = map_label_to_angle_18(label1) angles2 = map_label_to_angle_18(label2) elif num_angles == 32: angle1 = map_label_to_angle_32(label1) angle2 = map_label_to_angle_32(label2) else: raise NotImplementedError return compute_angle_tensor(angles1, angles2) def _rotation_multiprocessing_worker(func, batch_data, label, return_dict, idx, *args): result = func(batch_data, label, *args) return_dict[idx] = result def rotation_multiprocessing_wrapper(func, batch_data, label, *args, num_workers=8): """ A wrapper for doing rotation using multiprocessing Input: func: a function for rotating on batch data, e.g. rotate_point_by_label batch_data: B*N*3 numpy array label: B length numpy array Returns: B*N*3 numpy array """ batch_size = batch_data.shape[0] // num_workers manager = multiprocessing.Manager() return_dict = manager.dict() jobs = [] for i in range(num_workers): start_idx = i * batch_size end_idx = (i+1) * batch_size if i < num_workers - 1 else batch_data.shape[0] # print(f"[INFO] batch {i}, start index {start_idx}, end index {end_idx}") cur_data = batch_data[start_idx: end_idx] cur_label = label[start_idx: end_idx] p = multiprocessing.Process(target=_rotation_multiprocessing_worker, args=(func, cur_data, cur_label, return_dict, i, *args)) p.start() jobs.append(p) for proc in jobs: proc.join() result = np.concatenate([return_dict[i] for i in range(num_workers)]) # print("[INFO] rotated dimension:", result.shape) return result def jitter_point_cloud(batch_data, sigma=0.01, clip=0.05): """ Randomly jitter points. jittering is per point. Input: BxNx3 array, original batch of point clouds Return: BxNx3 array, jittered batch of point clouds """ B, N, C = batch_data.shape assert(clip > 0) jittered_data = np.clip(sigma * np.random.randn(B, N, C), -1*clip, clip) jittered_data += batch_data return jittered_data def getDataFiles(list_filename): return [line.rstrip() for line in open(list_filename)] def load_h5(h5_filename): f = h5py.File(h5_filename) data = f['data'][:] label = f['label'][:] return (data, label) def loadDataFile(filename): return load_h5(filename) def load_h5_data_label_seg(h5_filename): f = h5py.File(h5_filename) data = f['data'][:] label = f['label'][:] seg = f['pid'][:] return (data, label, seg) def loadDataFile_with_seg(filename): return load_h5_data_label_seg(filename) def load_mat_keypts(files, keypts_path, NUM_POINT): keypts_dict = loadmat(keypts_path) keypts = keypts_dict['keypts'] # print('\n') # print(keypts[1]) # print('\n') # print(keypts[2]) # print('\n') # print(keypts[3]) names = [n[0][0] for n in keypts_dict['modelname']] data = None label = None data = [] labels = [] for f in files: x = loadmat(f) pts = x['pts'] # pts = [pt[0][0:NUM_POINT, :] for pt in pts] # pts = [pt[0] for pt in pts] # pts = np.stack(pts, axis = 0) model_names = [n[0][0] for n in x['modelList']] indices = [names.index(n) for n in model_names] keypts_labels = np.asarray([keypts[i] for i in indices]) for i in range(len(pts)): pt = pts[i][0] if pt.shape[0] < NUM_POINT: continue # skip invalid object keypt = keypts_labels[i] t = sum([1 for ke in keypt if ke != []]) if t < 10: continue # skip objects with fewer than 10 keypts label = np.zeros(NUM_POINT-t) label = np.concatenate((label,
np.ones(t)
numpy.ones
import os import numpy as np import pandas as pd import pytest from skmultiflow.data.data_stream import DataStream def test_data_stream(test_path, package_path): test_file = os.path.join(package_path, 'src/skmultiflow/data/datasets/sea_stream.csv') raw_data = pd.read_csv(test_file) stream = DataStream(raw_data, name='Test') assert not stream._Y_is_defined stream.prepare_for_use() assert stream.n_remaining_samples() == 40000 expected_names = ['attrib1', 'attrib2', 'attrib3'] assert stream.feature_names == expected_names expected_targets = [0, 1] assert stream.target_values == expected_targets assert stream.target_names == ['class'] assert stream.n_features == 3 assert stream.n_cat_features == 0 assert stream.n_num_features == 3 assert stream.n_targets == 1 assert stream.get_data_info() == 'Test: 1 target(s), 2 classes' assert stream.has_more_samples() is True assert stream.is_restartable() is True # Load test data corresponding to first 10 instances test_file = os.path.join(test_path, 'sea_stream_file.npz') data = np.load(test_file) X_expected = data['X'] y_expected = data['y'] X, y = stream.next_sample() assert np.alltrue(X[0] == X_expected[0]) assert np.alltrue(y[0] == y_expected[0]) X, y = stream.last_sample() assert
np.alltrue(X[0] == X_expected[0])
numpy.alltrue
# Implementation of trustworthiness and continuity (T&C), a quality measure for NLDR embeddings. # For more details on the measure, see <NAME>., & <NAME>. (2006). # Local multidimensional scaling. Neural Networks, 19(6-7), 889-899. # This implementation has been written by <NAME> (University of Namur). import numpy as np from scipy.spatial.distance import pdist, squareform # This function computes the continuity for a particular K, as in Venna et al.'s paper def compute_continuity(dataset, visu, projection_K, dataset_K, I_projection): N = len(visu) K = len(projection_K[0]) acc = 0 for i in range(0, N-1): _, common_neighborhood, _ = np.intersect1d(dataset_K[i, :], projection_K[i, :], return_indices=True) VK_i = np.delete(dataset_K[i, :], common_neighborhood) for j in VK_i: acc += np.where(I_projection[i, :] == j)[0][0] - K return 1 - ((2/(N*K*((2*N)-(3*K)-1)))*acc) # Compute T&C for all K in logarithmic scale, as performed by AUClogRNX, # see <NAME>., <NAME>., & <NAME>. (2015). # Multi-scale similarities in stochastic neighbour embedding: Reducing dimensionality while preserving both local and global structure. Neurocomputing, 169, 246-261. def compute(dataset, visu): N = len(visu) D_dataset = squareform(pdist(dataset)) D_projection = squareform(pdist(visu)) numerator = 0.0 denominator = 0.0 I_dataset =
np.argsort(D_dataset, 1)
numpy.argsort
""" Created on 22. apr. 2015 @author: pab References ---------- A METHODOLOGY FOR ROBUST OPTIMIZATION OF LOW-THRUST TRAJECTORIES IN MULTI-BODY ENVIRONMENTS <NAME> (2010) Phd thesis, Georgia Institute of Technology USING MULTICOMPLEX VARIABLES FOR AUTOMATIC COMPUTATION OF HIGH-ORDER DERIVATIVES <NAME>, <NAME> , and <NAME> ACM Transactions on Mathematical Software, Vol. 38, No. 3, Article 16, April 2012, 21 pages, <NAME>, <NAME>, <NAME>, <NAME> (2012) CUBO A Mathematical Journal Vol. 14, No 2, (61-80). June 2012. Computation of higher-order derivatives using the multi-complex step method <NAME>, (2014) Project report, NTNU """ from __future__ import division import numpy as np _TINY = np.finfo(float).machar.tiny def c_atan2(x, y): a, b = np.real(x), np.imag(x) c, d = np.real(y), np.imag(y) return np.arctan2(a, c) + 1j * (c * b - a * d) / (a**2 + c**2) def c_max(x, y): return np.where(x.real < y.real, y, x) def c_min(x, y): return np.where(x.real > y.real, y, x) def c_abs(z): return np.where(np.real(z) >= 0, z, -z) class bicomplex(object): """ BICOMPLEX(z1, z2) Creates an instance of a bicomplex object. zeta = z1 + j*z2, where z1 and z2 are complex numbers. """ def __init__(self, z1, z2): z1, z2 = np.broadcast_arrays(z1, z2) self.z1 =
np.asanyarray(z1, dtype=np.complex128)
numpy.asanyarray
import torch import re import numpy as np import argparse from scipy import io as sio from tqdm import tqdm # code adapted from https://github.com/bilylee/SiamFC-TensorFlow/blob/master/utils/train_utils.py def convert(mat_path): """Get parameter from .mat file into parms(dict)""" def squeeze(vars_): # Matlab save some params with shape (*, 1) # However, we don't need the trailing dimension in TensorFlow. if isinstance(vars_, (list, tuple)): return [np.squeeze(v, 1) for v in vars_] else: return np.squeeze(vars_, 1) netparams = sio.loadmat(mat_path)["net"]["params"][0][0] params = dict() name_map = {(1, 'conv'): 0, (1, 'bn'): 1, (2, 'conv'): 4, (2, 'bn'): 5, (3, 'conv'): 8, (3, 'bn'): 9, (4, 'conv'): 11, (4, 'bn'): 12, (5, 'conv'): 14} for i in tqdm(range(netparams.size)): param = netparams[0][i] name = param["name"][0] value = param["value"] value_size = param["value"].shape[0] match = re.match(r"([a-z]+)([0-9]+)([a-z]+)", name, re.I) if match: items = match.groups() elif name == 'adjust_f': continue elif name == 'adjust_b': params['corr_bias'] = torch.from_numpy(squeeze(value)) continue op, layer, types = items layer = int(layer) if layer in [1, 2, 3, 4, 5]: idx = name_map[(layer, op)] if op == 'conv': # convolution if types == 'f': params['features.{}.weight'.format(idx)] = torch.from_numpy(value.transpose(3, 2, 0, 1)) elif types == 'b':# and layer == 5: value = squeeze(value) params['features.{}.bias'.format(idx)] = torch.from_numpy(value) elif op == 'bn': # batch normalization if types == 'x': m, v = squeeze(
np.split(value, 2, 1)
numpy.split
from hcipy import * import numpy as np def check_energy_conservation(shift_input, scale, shift_output, q, fov, dims): grid = make_uniform_grid(dims, 1).shifted(shift_input).scaled(scale) f_in = Field(np.random.randn(grid.size), grid) #f_in = Field(np.exp(-30 * grid.as_('polar').r**2), grid) fft = FastFourierTransform(grid, q=q, fov=fov, shift=shift_output) mft = MatrixFourierTransform(grid, fft.output_grid) nft = NaiveFourierTransform(grid, fft.output_grid, True) nft2 = NaiveFourierTransform(grid, fft.output_grid, False) fourier_transforms = [fft, mft, nft, nft2] energy_ratios = [] patterns_match = [] for ft1 in fourier_transforms: for ft2 in fourier_transforms: f_inter = ft1.forward(f_in) f_out = ft2.backward(f_inter) energy_in = np.sum(np.abs(f_in)**2 * f_in.grid.weights) energy_out = np.sum(np.abs(f_out)**2 * f_out.grid.weights) energy_ratio = energy_out / energy_in pattern_match = np.abs(f_out - f_in).max() / f_in.max() if fov == 1: # If the full fov is retained, energy and pattern should be conserved # for all fourier transform combinations. assert np.allclose(f_in, f_out) assert np.allclose(energy_in, energy_out) energy_ratios.append(energy_ratio) patterns_match.append(pattern_match) energy_ratios =
np.array(energy_ratios)
numpy.array
""" Benchmark for prior learning Compressed sensing """ import time import numpy as np import pandas as pd import itertools import signal from pathlib import Path from joblib import Memory from scipy.optimize import linear_sum_assignment from scipy.fftpack import dct from plipy.ddl import DeepDictionaryLearning from plipy.dpdpl import (DeepPrimalDualPriorLearningUN, DeepPrimalDualPriorLearningUNTF) mem = Memory(location='./tmp_inv_prob/', verbose=0) ############## # Parameters # ############## NUM_EXP = 1 ########### # Solvers # ########### SOLVERS = { "DDL": [DeepDictionaryLearning, "synthesis"], "DPDPL_UN": [DeepPrimalDualPriorLearningUN, "analysis"], "DPDPL_UNTF": [DeepPrimalDualPriorLearningUNTF, "analysis"] } ################### # Data generation # ################### def find_signal_analysis(prior, sparsity, sigma_data): """ Generates a signal using an analytic prior. Works only with square and overcomplete full-rank priors. """ N, L = prior.shape k = np.sum(np.random.random(L) > (1 - sparsity)) V = np.zeros(shape=(L, L - k)) while np.linalg.matrix_rank(V) != L - k: s =
np.random.permutation(N)
numpy.random.permutation
import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns import os, sys import subprocess from scipy import stats from scipy.cluster.hierarchy import distance, linkage, fcluster from sklearn.decomposition import PCA from sklearn.manifold import TSNE from utils import parallel_analysis, calculate_deg # short functions ---------------------------------------- def in_ipython(): return 'TerminalIPythonApp' in get_ipython().config def corr_inter(X, Y): # X (n x p1), Y (n x p2) X_normed = (X - X.mean(axis=0)) / X.std(axis=0, ddof=0) Y_normed = (Y - Y.mean(axis=0)) / Y.std(axis=0, ddof=0) return np.dot(X_normed.T, Y_normed) / X.shape[0] def plot_gene(gene_name): long_form_df = data_df.loc[gene_name].reset_index() fig, ax = plt.subplots() sns.swarmplot(data=long_form_df, x='week', y=gene_name, hue='condition', dodge=True) def correlation_adjust(): p1 = 10**4 p2 = 10**3 for n in [3,4,5]: res = np.abs(corr_inter(
np.random.randn(n, p1)
numpy.random.randn
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 17 10:31:31 2020 @author: grat05 """ import numpy as np from numpy import exp import pandas as pd from functools import wraps class ObjDict(): def __repr__(self): return str(self.__dict__) def isList(thing): return isinstance(thing, (list, tuple, np.ndarray)) class SodiumChannelModel(): def __init__(self, TEMP = 310.0, naO = 140.0, naI = 7, recArrayNames = [], state_vals = [], retOptions = {'G': True, 'INa': True, 'INaL': True,\ 'Open': True, 'RevPot': True}): self.TEMP = TEMP self.naO = naO self.naI = naI self.recArrayNames = pd.Index(recArrayNames) self.num_states = len(self.recArrayNames) self._state_vals = np.array(state_vals, dtype='float64') self._recArray = [] self.retOptions = retOptions self.lastVal = None self.memoize = True self.RGAS = 8314.0; self.FDAY = 96487.0; @property def recArray(self): return pd.DataFrame(np.array(self._recArray), columns=self.recArrayNames) @property def state_vals(self): return pd.Series(self._state_vals, index=self.recArrayNames, dtype='float64') def calc_constants(self, vOld): pass def jac(self, vOld): pass def ddtcalc(self, vals, vOld): pass def getRevPot(self): return (self.RGAS * self.TEMP / self.FDAY) * np.log(self.naO / self.naI) def calcCurrent(self, vals, vOld, setRecArray=True): pass def update(self, vOld, dt, record=True): vals = self._state_vals ddt = self.ddtcalc(vals, vOld) vals += ddt*dt return self.calcCurrent(vals, vOld, setRecArray=record) def memoize_calc_constants(calc_constants): @wraps(calc_constants) def memoized(self, vOld): if self.memoize: if self.lastVal is not None and np.array_equal(self.lastVal[0], vOld): return self.lastVal[1] ret = calc_constants(self, vOld) if self.memoize: self.lastVal = (vOld, ret) return ret return memoized class OHaraRudy_INa(SodiumChannelModel): num_params = 33 param_bounds = [(-3,3)]*2 + \ [(-0.1,3)] + [(-3,3)] + [(-0.1,3)] +\ [(-3,3)] + [(-0.1,3)] +\ [(-1,3), (-3,3), (-0.1,3)] + \ [(-3,3)] + [(-0.1,3)] +\ [(-3,3)] + [(-1,3)] +\ [(-3,3)] + [(-1,3)] +\ [(-20,20)] + \ [(-3,3)] + [(-3,3)] + [(-1,3)] +\ [(-3,3)] + [(-1,3)] +\ [(-1,1)]*3 + \ [(-1,1)]*2 + \ [(-1,1)]*2 + \ [(-15,15)]*2 + \ [(-15,15), (-1,3)] KmCaMK = 0.15 CaMKa = 1e-5 def __init__(self, GNaFactor=0, GNaLFactor=0, \ mss_tauFactor=0, tm_maxFactor=0, tm_tau1Factor=0,\ tm_shiftFactor=0, tm_tau2Factor=0,\ hss_tauFactor=0, thf_maxFactor=0, thf_tau1Factor=0,\ thf_shiftFactor=0, thf_tau2Factor=0,\ ths_maxFactor=0, ths_tau1Factor=0,\ ths_shiftFactor=0, ths_tau2Factor=0,\ Ahf_multFactor=0,\ tj_baselineFactor=0, tj_maxFactor=0, tj_tau1Factor=0,\ tj_shiftFactor=0, tj_tau2Factor=0,\ hssp_tauFactor=0, tssp_multFactor=0, tjp_multFactor=0,\ mLss_tauFactor=0, hLss_tauFactor=0,\ thL_baselineFactor=0, thLp_multFactor=0,\ mss_shiftFactor=0, hss_shiftFactor=0,\ jss_shiftFactor=0, jss_tauFactor=0, TEMP = 310.0, naO = 140.0, naI = 7): super().__init__(TEMP=TEMP, naO=naO, naI=naI, recArrayNames = ["m","hf","hs","j","hsp","jp","mL","hL","hLp"], state_vals = [0,1,1,1,1,1,0,1,1]) # scaling currents 0 self.GNa = 75*np.exp(GNaFactor); self.GNaL = 0.0075*np.exp(GNaLFactor); #m gate 2 self.mss_tau = 9.871*np.exp(mss_tauFactor) self.tm_max = 0.473824721*np.exp(tm_maxFactor) self.tm_tau1 = 34.77*np.exp(tm_tau1Factor) self.tm_shift = -57.6379999+tm_shiftFactor self.tm_tau2 = 5.955*np.exp(tm_tau2Factor) tm_cshift = np.log(self.tm_tau1/self.tm_tau2)/(1/self.tm_tau1+1/self.tm_tau2) tm_cmax = np.exp(tm_cshift/self.tm_tau1) + np.exp(-tm_cshift/self.tm_tau2) self.tm_shift -= tm_cshift #shift correction self.tm_max *= tm_cmax #height correction #h gate 7 self.hss_tau = 6.086*np.exp(hss_tauFactor) self.thf_max = 3.594172982376325*np.exp(thf_maxFactor) self.thf_tau1 = 6.285*np.exp(thf_tau1Factor) self.thf_shift = -57.639999999606744+thf_shiftFactor self.thf_tau2 = 20.27*np.exp(thf_tau2Factor) thf_cshift = np.log(self.thf_tau2/self.thf_tau1)/(1/self.thf_tau2+1/self.thf_tau1) thf_cmax = np.exp(thf_cshift/self.thf_tau2) + np.exp(-thf_cshift/self.thf_tau1) self.thf_shift -= thf_cshift self.thf_max *= thf_cmax #12 self.ths_max = 5.894233734241695*np.exp(ths_maxFactor) self.ths_tau1 = 28.05*np.exp(ths_tau1Factor) self.ths_shift = -66.94699999965118+ths_shiftFactor self.ths_tau2 = 56.66*np.exp(ths_tau2Factor) ths_cshift = np.log(self.ths_tau2/self.ths_tau1)/(1/self.ths_tau2+1/self.ths_tau1) ths_cmax = np.exp(ths_cshift/self.ths_tau2) + np.exp(-ths_cshift/self.ths_tau1) self.ths_shift -= ths_cshift self.ths_max *= ths_cmax mixingodds = np.exp(Ahf_multFactor+np.log(99)) self.Ahf_mult = mixingodds/(mixingodds+1)# np.exp(Ahf_multFactor) #j gate 17 self.tj_baseline = 2.038*np.exp(tj_baselineFactor) self.tj_max = 27.726847365476033*np.exp(tj_maxFactor) self.tj_tau1 = 8.281*np.exp(tj_tau1Factor) self.tj_shift = -90.60799999976416+tj_shiftFactor self.tj_tau2 = 38.45*np.exp(tj_tau2Factor) tj_cshift = np.log(self.tj_tau2/self.tj_tau1)/(1/self.tj_tau2+1/self.tj_tau1) tj_cmax = np.exp(tj_cshift/self.tj_tau2) + np.exp(-tj_cshift/self.tj_tau1) self.tj_shift -= tj_cshift self.tj_max *= tj_cmax # phosphorylated gates self.hssp_tau = 6.086*np.exp(hssp_tauFactor) self.tssp_mult = 3.0*np.exp(tssp_multFactor) self.tjp_mult = 1.46*np.exp(tjp_multFactor) #late gates & late gate phosphorylation self.mLss_tau = 5.264*np.exp(mLss_tauFactor) self.hLss_tau = 7.488*np.exp(hLss_tauFactor) self.hLssp_tau = self.hLss_tau self.thL_baseline = 200.0*np.exp(thL_baselineFactor) self.thLp_mult = 3*np.exp(thLp_multFactor) #added later 29 self.mss_shift = 39.57+mss_shiftFactor self.hss_shift = 82.90+hss_shiftFactor self.jss_shift = 82.90+jss_shiftFactor self.jss_tau = 6.086*np.exp(jss_tauFactor) @memoize_calc_constants def calc_constants(self, vOld): tau = ObjDict() ss = ObjDict() ss.mss = 1.0 / (1.0 + np.exp((-(vOld + self.mss_shift)) / self.mss_tau)); tau.tm = self.tm_max/(np.exp((vOld-self.tm_shift)/self.tm_tau1) + np.exp(-(vOld-self.tm_shift)/self.tm_tau2)) ss.hss = 1.0 / (1 + np.exp((vOld + self.hss_shift) / self.hss_tau)); tau.thf = self.thf_max/(np.exp((vOld-self.thf_shift)/self.thf_tau2) + np.exp(-(vOld-self.thf_shift)/self.thf_tau1)) tau.ths = self.ths_max/(np.exp((vOld-self.ths_shift)/self.ths_tau2) + np.exp(-(vOld-self.ths_shift)/self.ths_tau1)) ss.jss = ss.hss#1.0 / (1 + np.exp((vOld + self.jss_shift) / self.jss_tau));#hss; tau.tj = self.tj_baseline + self.tj_max/(np.exp((vOld-self.tj_shift)/self.tj_tau2) + np.exp(-(vOld-self.tj_shift)/self.tj_tau1)) ss.hssp = 1.0 / (1 + np.exp((vOld + 89.1) / self.hssp_tau)); tau.thsp = self.tssp_mult * tau.ths; tau.tjp = self.tjp_mult * tau.tj; ss.mLss = 1.0 / (1.0 + np.exp((-(vOld + 42.85)) / self.mLss_tau)); tau.tmL = tau.tm; ss.hLss = 1.0 / (1.0 + np.exp((vOld + 87.61) / self.hLss_tau)); tau.thL = self.thL_baseline; ss.hLssp = 1.0 / (1.0 + np.exp((vOld + 93.81) / self.hLssp_tau)); tau.thLp = self.thLp_mult * tau.thL; tau.__dict__ = {key: min(max(value, 1e-8), 1e20) for key,value in tau.__dict__.items()} return tau, ss def jac(self, vOld): vOld = np.array(vOld,ndmin=1) d_vals = np.squeeze(np.zeros((9,len(vOld)))) tau, _ = self.calc_constants(vOld) d_vals[0] = -1 / tau.tm d_vals[1] = -1 / tau.thf d_vals[2] = -1 / tau.ths d_vals[3] = -1 / tau.tj d_vals[4] = -1 / tau.thsp d_vals[5] = -1 / tau.tjp d_vals[6] = -1 / tau.tmL d_vals[7] = -1 / tau.thL d_vals[8] = -1 / tau.thLp # np.clip(d_vals, a_min=-1e15, a_max=None, out=d_vals) return np.diag(d_vals) def ddtcalc(self, vals, vOld): d_vals = np.zeros_like(vals) tau, ss = self.calc_constants(vOld) d_vals[0] = (ss.mss-vals[0]) / tau.tm d_vals[1] = (ss.hss-vals[1]) / tau.thf d_vals[2] = (ss.hss-vals[2]) / tau.ths d_vals[3] = (ss.jss-vals[3]) / tau.tj d_vals[4] = (ss.hssp-vals[4]) / tau.thsp d_vals[5] = (ss.jss-vals[5]) / tau.tjp d_vals[6] = (ss.mLss-vals[6]) / tau.tmL d_vals[7] = (ss.hLss-vals[7]) / tau.thL d_vals[8] = (ss.hLssp-vals[8]) / tau.thLp # np.clip(d_vals, a_min=-1e15, a_max=1e15, out=d_vals) return d_vals def calcCurrent(self, vals, vOld, setRecArray=True): vals = np.array(vals) if len(vals.shape) == 1: vals.shape = (9,-1) elif vals.shape[0] != 9 and vals.shape[-1] == 9: vals = vals.T m,hf,hs,j,hsp,jp,mL,hL,hLp = vals if setRecArray: self._recArray += list(np.copy(vals.T)) ena = self.getRevPot() Ahf = 0.99*self.Ahf_mult; Ahs = 1.0 - Ahf; h = Ahf * hf + Ahs * hs; hp = Ahf * hf + Ahs *hsp; fINap = (1.0 / (1.0 + self.KmCaMK / self.CaMKa)); # oprob = self.m * self.m * self.m * ((1.0 - fINap) * h * self.j + fINap * hp * self.jp) # oprob = m**3 * ((1.0 - fINap) * h + fINap * hp * jp) oprob = m**3 * ((1.0 - fINap) * h * j + fINap * hp * jp) INa = (self.GNa if self.retOptions['G'] else 1) *\ (oprob if self.retOptions['Open'] else 1) *\ ((vOld - ena) if self.retOptions['RevPot'] else 1); fINaLp = (1.0 / (1.0 + self.KmCaMK / self.CaMKa)); loprob = mL * ((1.0 - fINaLp) * hL + fINaLp * hLp) INaL = (self.GNaL if self.retOptions['G'] else 1)*\ (loprob if self.retOptions['Open'] else 1)*\ ((vOld - ena) if self.retOptions['RevPot'] else 1); return (INa if self.retOptions['INa'] else 0)+\ (INaL if self.retOptions['INaL'] else 0) def update(self, vOld, dt, record=True): m,hf,hs,j,hsp,jp,mL,hL,hLp = self.state_vals tau, ss = self.calc_taus_ss(vOld) m = ss.mss - (ss.mss - m) * np.exp(-dt / tau.tm); hf = ss.hss - (ss.hss - hf) * np.exp(-dt / tau.thf); hs = ss.hss - (ss.hss - hs) * np.exp(-dt / tau.ths); j = ss.jss - (ss.jss - j) * np.exp(-dt / tau.tj); hsp = ss.hssp - (ss.hssp - hsp) * np.exp(-dt / tau.thsp); jp = ss.jss - (ss.jss - jp) * np.exp(-dt / tau.tjp); mL = ss.mLss - (ss.mLss - mL) * np.exp(-dt / tau.tmL); hL = ss.hLss - (ss.hLss - hL) * np.exp(-dt / tau.thL); hLp = ss.hLssp - (ss.hLssp - hLp) * np.exp(-dt / tau.thLp); self.state_vals = m,hf,hs,j,hsp,jp,mL,hL,hLp return self.calcCurrent(self.state_vals, vOld, setRecArray=record) class OHaraRudy_wMark_INa(SodiumChannelModel): num_params = 25 param_bounds = [(-3,3), (-3,3), (-1,3), (-15,15), (-3,3), (-1,3), (-15,15), (-1,3), (-1,3), (-15,15),# (-15,15), (-3,3), (-15,15), (-1,3), (-3,3), (-3,3), (-15,15), (-1,3), (-1,3), (-5,5), (-1,3), (-15,15), (-3,3), (-15,15), (-1,3), (-1,3), ] def __init__(self, GNaFactor=0, baselineFactor=0, mss_tauFactor=0, mss_shiftFactor=0, tm_maxFactor=0, tm_tau1Factor=0, tm_shiftFactor=0, tm_tau2Factor=0, hss_tauFactor=0, hss_shiftFactor=0, thf_maxFactor=0, thf_shiftFactor=0, thf_tau1Factor=0, thf_tau2Factor=0, ths_maxFactor=0, ths_shiftFactor=0, ths_tau1Factor=0, ths_tau2Factor=0, Ahf_multFactor=0, jss_tauFactor=0, jss_shiftFactor=0, tj_maxFactor=0, tj_shiftFactor=0, tj_tau2Factor=0, tj_tau1Factor=0, TEMP = 310.0, naO = 140.0, naI = 7): # scaling currents 0 self.GNa = np.exp(GNaFactor); #fastest tau 1 self.baseline = 2.038*np.exp(baselineFactor) #m gate 2 self.mss_tau = 9.871*np.exp(mss_tauFactor) self.mss_shift = 51.57+mss_shiftFactor self.tm_max = 0.474*np.exp(tm_maxFactor) self.tm_tau1 = 34.77*np.exp(tm_tau1Factor) self.tm_shift = -57.6+tm_shiftFactor self.tm_tau2 = 5.955*np.exp(tm_tau2Factor) tm_cshift = np.log(self.tm_tau1/self.tm_tau2)/(1/self.tm_tau1+1/self.tm_tau2) tm_cmax = np.exp(tm_cshift/self.tm_tau1) + np.exp(-tm_cshift/self.tm_tau2) self.tm_shift -= tm_cshift #shift correction self.tm_max *= tm_cmax #height correction #h gate 8 self.hss_tau = 14.086*np.exp(hss_tauFactor) self.hfss_shift = -76+hss_shiftFactor #self.hsss_shift = -87.90+hss_shiftFactor#np.exp(hsss_shiftFactor) self.thf_max = 5*np.exp(thf_maxFactor) self.thf_tau1 = 6.285*np.exp(thf_tau1Factor) self.thf_shift = -57.639999999606744+thf_shiftFactor self.thf_tau2 = 15*np.exp(thf_tau2Factor) thf_cshift = np.log(self.thf_tau2/self.thf_tau1)/(1/self.thf_tau2+1/self.thf_tau1) thf_cmax = np.exp(thf_cshift/self.thf_tau2) + np.exp(-thf_cshift/self.thf_tau1) self.thf_shift -= thf_cshift self.thf_max *= thf_cmax self.ths_max = 5.894233734241695*np.exp(ths_maxFactor) self.ths_tau1 = 28.05*np.exp(ths_tau1Factor) self.ths_shift = -66.94699999965118+ths_shiftFactor self.ths_tau2 = 40*np.exp(ths_tau2Factor) ths_cshift = np.log(self.ths_tau2/self.ths_tau1)/(1/self.ths_tau2+1/self.ths_tau1) ths_cmax = np.exp(ths_cshift/self.ths_tau2) + np.exp(-ths_cshift/self.ths_tau1) self.ths_shift -= ths_cshift self.ths_max *= ths_cmax mixingodds = np.exp(Ahf_multFactor) self.Ahf_mult = mixingodds/(mixingodds+1)# np.exp(Ahf_multFactor) #j gate 18 self.jss_tau = 20*np.exp(jss_tauFactor) self.jss_shift = -110+jss_shiftFactor self.tj_max = 100*np.exp(tj_maxFactor) self.tj_tau2 = 10*np.exp(tj_tau2Factor) self.tj_tau1 = 20*np.exp(tj_tau1Factor) self.tj_shift = -80+tj_shiftFactor tj_cshift = np.log(self.tj_tau1/self.tj_tau2)/(1/self.tj_tau1+1/self.tj_tau2) tj_cmax = np.exp(tj_cshift/self.tj_tau1) + np.exp(-tj_cshift/self.tj_tau2) self.tj_shift -= tj_cshift #shift correction self.tj_max *= tj_cmax #height correction retOptions = {'G': True, 'INa': True, 'INaL': True,\ 'Open': True, 'RevPot': True, 'fh': True, 'sh': True} super().__init__(TEMP=TEMP, naO=naO, naI=naI, recArrayNames = ["m", "hf","jf","if","i2f", "hs","js","is","i2s"], state_vals = [0, 1,0,0,0, 1,0,0,0], retOptions=retOptions) self.lastddt = None @memoize_calc_constants def calc_constants(self, vOld): vOld = np.array(vOld,ndmin=1) tau = ObjDict() ss = ObjDict() num_a_b = 5 a = np.empty((num_a_b, len(vOld)))#np.empty(num_a_b)# b = np.empty((num_a_b, len(vOld)))#np.empty(num_a_b)#np.empty((num_a_b, len(vOld))) ss.mss = 1.0 / (1.0 + exp((-(vOld + self.mss_shift)) / self.mss_tau)); tau.tm = self.baseline/15+ self.tm_max/(exp((vOld-self.tm_shift)/self.tm_tau1) + exp(-(vOld-self.tm_shift)/self.tm_tau2)) #1.0 / (self.tm_mult1 * np.exp((vOld + 11.64) / self.tm_tau1) + # self.tm_mult2 * np.exp(-(vOld + 77.42) / self.tm_tau2)); a[0] = ss.mss/tau.tm b[0] = (1-ss.mss)/tau.tm ss.hfss = 1.0 / (1 + exp((vOld - self.hfss_shift) / (self.hss_tau))) tau.thf = self.baseline/10 + self.thf_max/(exp((vOld-self.thf_shift)/self.thf_tau2) + exp(-(vOld-self.thf_shift)/self.thf_tau1)) a[1] = ss.hfss/tau.thf b[1] = (1-ss.hfss)/tau.thf # tau.thf = self.baseline/5 + 1/(6.149) * np.exp(-(vOld + 0.5096) / 15); # if vOld < -100: # tau.thf = self.baseline # tau.thf = np.clip(tau.thf, a_max=15, a_min=None) #1.0 / (1 + np.exp((vOld - self.hsss_shift) / (self.hss_tau))) ss.hsss = ss.hfss tau.ths = self.baseline + self.ths_max/(exp((vOld-self.ths_shift)/self.ths_tau2) + exp(-(vOld-self.ths_shift)/self.ths_tau1)) a[2] = ss.hsss/tau.ths b[2] = (1-ss.hsss)/tau.ths # tau.ths = self.baseline + 1.0 / (0.3343) * np.exp(-(vOld + 5.730) / 30); # if vOld < -100: # tau.ths = self.baseline # tau.ths = np.clip(tau.ths, a_max=20, a_min=None) ss.jss = 1.0 / (1 + exp((vOld - self.jss_shift) / (self.jss_tau)));#hss; tau.tj = self.baseline + (self.tj_max-self.baseline)/(exp((vOld-self.tj_shift)/self.tj_tau1) + exp(-(vOld-self.tj_shift)/self.tj_tau2)) a[3] = ss.jss/tau.tj b[3] = (1-ss.jss)/tau.tj # mask = vOld > -60 # tau.tj[mask] = 100 + (self.tj_max-100)/(1+np.exp(2/self.tj_tau*(vOld[mask]-(self.tj_shift+40)))) # tau.tj *= 0.001 # tau.tj = 0.1 #ss.jss2 = 1.0 / (1 + np.exp((vOld - self.jss2_shift) / (self.jss_tau)));#hss; #tau.tj2 = self.baseline + (self.tj2_max-self.baseline) / (1+np.exp(-(vOld-self.tj_shift)/self.tj_tau2)) a[4] = 0#ss.jss2/(tau.tj2) b[4] = 0#(1-ss.jss2)/(tau.tj2) ### tau.__dict__ = {key: min(max(value, 1e-8), 1e20) for key,value in tau.__dict__.items()} # a = np.squeeze(a) # b = np.squeeze(b) # tau.__dict__ = {key: np.squeeze(value) for key,value in tau.__dict__.items()} # ss.__dict__ = {key: np.squeeze(value) for key,value in ss.__dict__.items()} return tau, ss, a, b def jac(self, vOld): d_vals = np.zeros(self.num_states) _, _, a, b = self.calc_constants(vOld) #m d_vals[0] = -a[0]-b[0]#-1 / tau.tm #hf jf if i2f d_vals[1] = -b[1] d_vals[2] = -(b[3]+a[1]) d_vals[3] = -(a[3]+b[4]) d_vals[4] = -a[4] #hs js is i2s d_vals[5] = -b[2] d_vals[6] = -(b[3]+a[2]) d_vals[7] = -(a[3]+b[4]) d_vals[8] = -a[4] # np.clip(d_vals, a_min=-1e15, a_max=None, out=d_vals) d_vals = np.diag(d_vals) #m (none) #hf jf if i2f d_vals[1,2] = a[1] d_vals[2,1] = b[1] d_vals[2,3] = a[3] d_vals[3,2] = b[3] d_vals[3,4] = a[4] d_vals[4,3] = b[4] #hs js is i2s d_vals[5,6] = a[2] d_vals[6,5] = b[2] d_vals[6,7] = a[3] d_vals[7,6] = b[3] d_vals[7,8] = a[4] d_vals[8,7] = b[4] return d_vals def ddtcalc(self, vals, vOld): d_vals = np.zeros_like(vals) vals = np.clip(vals, a_min=0, a_max=1) if self.memoize and\ self.lastddt is not None and\ np.array_equal(self.lastddt[0], vOld) and\ np.array_equal(self.lastddt[1], vals): # print(np.sum(np.abs(self.lastddt[1]- vals))) return self.lastddt[2] tau, ss, a, b = self.calc_constants(vOld) #m d_vals[0] = (1-vals[0])*a[0] - vals[0]*b[0] #hf jf if i2f d_vals[1] = vals[2]*a[1] - vals[1]*b[1] d_vals[2] = a[3]*vals[3]+b[1]*vals[1] - vals[2]*(b[3]+a[1]) d_vals[3] = b[3]*vals[2]+a[4]*vals[4] - vals[3]*(a[3]+b[4]) d_vals[4] = b[4]*vals[3] - vals[4]*a[4] #hs js is i2s d_vals[5] = vals[6]*a[2] - vals[5]*b[2] d_vals[6] = a[3]*vals[7]+b[2]*vals[5] - vals[6]*(b[3]+a[2]) d_vals[7] = b[3]*vals[6]+a[4]*vals[8] - vals[7]*(a[3]+b[4]) d_vals[8] = b[4]*vals[7] - vals[8]*a[4] # if not np.isclose(np.sum(vals[1:]),2): # print(np.sum(vals[1:])) # np.clip(d_vals, a_min=-1e15, a_max=1e15, out=d_vals) self.lastddt = (vOld, vals, d_vals) return d_vals def calcCurrent(self, vals, vOld, setRecArray=True): vals = np.array(vals) if len(vals.shape) == 1: vals.shape = (self.num_states,-1) elif vals.shape[0] != self.num_states and vals.shape[-1] == self.num_states: vals = vals.T m, hf,jf,i1f,i2f, hs,js,i1s,i2s = np.clip(vals, a_min=0, a_max=1) if setRecArray: self._recArray += list(np.copy(vals.T)) ena = self.getRevPot() if self.retOptions['fh'] and self.retOptions['sh']: Ahf = self.Ahf_mult; Ahs = 1.0 - Ahf; elif self.retOptions['fh']: Ahf = 1 Ahs = 1.0 - Ahf; elif self.retOptions['sh']: Ahf = 0 Ahs = 1.0 - Ahf; h = Ahf*hf + Ahs*hs; # hp = Ahf * hf + Ahs *hsp; # fINap = (1.0 / (1.0 + self.KmCaMK / self.CaMKa)); # oprob = self.m * self.m * self.m * ((1.0 - fINap) * h * self.j + fINap * hp * self.jp) # oprob = m**3 * ((1.0 - fINap) * h + fINap * hp * jp) oprob = m**3 * h INa = (self.GNa if self.retOptions['G'] else 1) *\ (oprob if self.retOptions['Open'] else 1) *\ ((vOld - ena) if self.retOptions['RevPot'] else 1); # fINaLp = (1.0 / (1.0 + self.KmCaMK / self.CaMKa)); # loprob = mL * ((1.0 - fINaLp) * hL + fINaLp * hLp) INaL = 0#(self.GNaL if self.retOptions['G'] else 1)*\ #(loprob if self.retOptions['Open'] else 1)*\ # ((vOld - ena) if self.retOptions['RevPot'] else 1); return (INa if self.retOptions['INa'] else 0)+\ (INaL if self.retOptions['INaL'] else 0) #10.1161/CIRCULATIONAHA.112.105320 P glynn class Koval_ina(SodiumChannelModel): num_params = 22 param_bounds = \ [(-3,4)] +\ [(-3,4)]*3 +\ [(-3,4)] + [(-0.5,4)] + [(-3,4)] +\ [(-0.5,4),(-3,4)] + [(-10,10)] +\ [(-3,4)] + [(-10,10)] + [(-3,4)] +\ [(-3,4)]*9 def __init__(self, gNaFactor = 0, P1a1Factor=0, P2a1Factor=0, P1a4Factor=0, P1a5Factor=0, P2a5Factor=0, P1b1Factor=0, P2b1Factor=0, P1b2Factor=0, P2b2Factor=0, P1b3Factor=0, P2b3Factor=0, P1b5Factor=0, P2b5Factor=0, P1a6Factor=0, P1b6Factor=0, P1a7Factor=0, P1b7Factor=0, P1a8Factor=0, P1b8Factor=0, P1a9Factor=0, P1b9Factor=0, TEMP = 310.0, naO = 140.0, naI = 8.35504003): self.P1a1 = np.exp(P1a1Factor)*7.5207 self.P2a1 = np.exp(P2a1Factor)*0.1027 self.P1a4 = np.exp(P1a4Factor)*0.188495 self.P1a5 = np.exp(P1a5Factor)*7.0e-7 self.P2a5 = np.exp(P2a5Factor)*7.7 self.P1b1 = np.exp(P1b1Factor)*0.1917 self.P2b1 = np.exp(P2b1Factor)*20.3 self.P1b2 = np.exp(P1b2Factor)*0.2 self.P2b2 = P2b2Factor+2.5 self.P1b3 = np.exp(P1b3Factor)*0.22 self.P2b3 = P2b3Factor+7.5 self.P1b5 = np.exp(P1b5Factor)*0.0108469 self.P2b5 = np.exp(P2b5Factor)*2e-5 self.P1a6 = np.exp(P1a6Factor)*1000.0 self.P1b6 = np.exp(P1b6Factor)*6.0448e-3 self.P1a7 = np.exp(P1a7Factor)*1.05263e-5 self.P1b7 = np.exp(P1b7Factor)*0.02 self.P1a8 = np.exp(P1a8Factor)*4.0933e-13 self.P1b8 = np.exp(P1b8Factor)*9.5e-4 self.P1a9 = np.exp(P1a9Factor)*8.2 self.P1b9 = np.exp(P1b9Factor)*0.022 self.gNa = np.exp(gNaFactor)*7.35 super().__init__(TEMP=TEMP, naO=naO, naI=naI, recArrayNames = ["C1","C2","C3", "IC2","IC3","IF", "IM1","IM2", "LC1","LC2","LC3", "O", "LO", "OB", "LOB"], state_vals = [0.0003850597267,0.02639207662,0.7015088787, 0.009845083654,0.2616851145,0.0001436395221, 3.913769904e-05,3.381242427e-08, 1.659002962e-13,1.137084204e-11,3.02240205e-10, 9.754706096e-07,4.202747013e-16, 0,0]) self.RanolazineConc = 0 @memoize_calc_constants def calc_constants(self, vOld): exp = np.exp a = np.zeros(10) b = np.zeros(10) # P123a_max = 45 # P123a_tau = 6#15 # P123a_shift = -25 # P123a_shift_diff = 4-10 # P4a_max = 2.53835453 # P4a_shift = -20 # P4a_tau = 16.6 # P5a_max = 600 # P5a_shift = -160 # P5a_tau = 6 # a[1] = P123a_max/((exp(-(vOld-(P123a_shift-P123a_shift_diff))/P123a_tau)) + 1) # a[2] = P123a_max/((exp(-(vOld-(P123a_shift))/P123a_tau)) + 1) # a[3] = P123a_max/((exp(-(vOld-(P123a_shift+P123a_shift_diff))/P123a_tau)) + 1) # a[4] = P4a_max/(exp(-(vOld-P4a_shift)/P4a_tau) + 1) # a[5] = P5a_max/(exp((vOld-P5a_shift)/P5a_tau) + 1) # a[6] = a[4]/self.P1a6 # a[7] = self.P1a7*a[4] # a[8] = self.P1a8 # a[9] = self.RanolazineConc*self.P1a9 # b[1] = 400/(exp((vOld+137-P123a_shift_diff)/self.P2b1)+1) # b[2] = 400/(exp((vOld+137)/self.P2b1)+1) # b[3] = 400/(exp((vOld+137+P123a_shift_diff)/self.P2b1)+1) # b[5] = self.P1b5 + self.P2b5*(vOld+7.0) # b[4] = (a[3]*a[4]*a[5])/(b[3]*b[5]) # b[6] = self.P1b6*a[5] # b[7] = self.P1b7*a[5] # b[8] = self.P1b8 # b[9] = self.P1b9 a[1] = self.P1a1/((self.P2a1*exp(-(vOld+2.5)/17)) + 0.20*exp(-(vOld+2.5)/150)) a[2] = self.P1a1/((self.P2a1*exp(-(vOld+2.5)/15)) + 0.23*exp(-(vOld+2.5)/150)) a[3] = self.P1a1/((self.P2a1*exp(-(vOld+2.5)/12)) + 0.25*exp(-(vOld+2.5)/150)) a[4] = 1.0/(self.P1a4*exp(-(vOld+7.0)/16.6) + 0.393956) a[5] = self.P1a5*exp(-(vOld+7)/self.P2a5) #self.P1a5*exp(-Vm/self.P2a5) a[6] = a[4]/self.P1a6 a[7] = self.P1a7*a[4] a[8] = self.P1a8 a[9] = self.RanolazineConc*self.P1a9 b[1] = self.P1b1*exp(-(vOld+2.5)/self.P2b1) b[2] = self.P1b2*exp(-(vOld-self.P2b2)/self.P2b1) b[3] = self.P1b3*exp(-(vOld-self.P2b3)/self.P2b1) b[5] = self.P1b5 + self.P2b5*(vOld+7.0) b[4] = (a[3]*a[4]*a[5])/(b[3]*b[5]) b[6] = self.P1b6*a[5] b[7] = self.P1b7*a[5] b[8] = self.P1b8 b[9] = self.P1b9 # if np.max(a) > 1e6 or np.max(b) > 1e6: # print('test') return a, b def ddtcalc(self, vals, vOld): C1,C2,C3,\ IC2,IC3,IF,\ IM1,IM2,\ LC1,LC2,LC3,\ O,LO,\ OB,LOB = vals d_vals = np.zeros_like(vals) a, b = self.calc_constants(vOld) dC1 = (a[5]*IF+b[3]*O+b[8]*LC1+a[2]*C2 -(b[5]+a[3]+a[8]+b[2])*C1) dC2 = (a[5]*IC2+b[2]*C1+b[8]*LC2+a[1]*C3 -(b[5]+a[2]+a[8]+b[1])*C2) dC3 = (a[5]*IC3+b[1]*C2+b[8]*LC3 -(b[5]+a[1]+a[8])*C3) dIC2 = (b[2]*IF+b[5]*C2+a[1]*IC3 -(a[2]+a[5]+b[1])*IC2) dIC3 = (b[1]*IC2+b[5]*C3 -(a[1]+a[5])*IC3) dIF = (b[6]*IM1+a[4]*O+b[5]*C1+a[2]*IC2 -(a[6]+b[4]+a[5]+b[2])*IF) dIM1 = (b[7]*IM2+a[6]*IF -(a[7]+b[6])*IM1) dIM2 = (a[7]*IM1 -(b[7])*IM2) dLC1 = (a[8]*C1+b[3]*LO+a[2]*LC2 -(b[8]+a[3]+b[2])*LC1) dLC2 = (a[8]*C2+b[2]*LC1+a[1]*LC3 -(b[8]+a[2]+b[1])*LC2) dLC3 = (b[1]*LC2+a[8]*C3 -(a[1]+b[8])*LC3) dO = (b[9]*OB+b[8]*LO+a[3]*C1+b[4]*IF -(a[9]+a[8]+b[3]+a[4])*O) dLO = (a[8]*O+b[9]*LOB+a[3]*LC1 -(b[8]+a[9]+b[3])*LO) dOB = (a[9]*O -(b[9])*OB) dLOB = (a[9]*LO -(b[9])*LOB) d_vals = dC1,dC2,dC3,dIC2, dIC3, dIF, dIM1, dIM2, dLC1, dLC2, dLC3, dO, dLO, dOB, dLOB return d_vals def jac(self, vOld): a, b = self.calc_constants(vOld) J = np.array([ [-(b[5]+a[3]+a[8]+b[2]), a[2], 0, 0, 0, a[5], 0, 0, b[8], 0, 0, b[3], 0, 0, 0], [b[2], -(b[5]+a[2]+a[8]+b[1]), a[1], a[5], 0, 0, 0, 0, 0, b[8], 0, 0, 0, 0, 0], [0, b[1], -(b[5]+a[1]+a[8]), 0, a[5], 0, 0, 0, 0, 0, b[8], 0, 0, 0, 0], [0, b[5], 0, -(a[2]+a[5]+b[1]), a[1], b[2], 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, b[5], b[1], -(a[1]+a[5]), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [b[5], 0, 0, a[2], 0, -(a[6]+b[4]+a[5]+b[2]), b[6], 0, 0, 0, 0, a[4], 0, 0, 0], [0, 0, 0, 0, 0, a[6], -(a[7]+b[6]), b[7], 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, a[7], -(b[7]), 0, 0, 0, 0, 0, 0, 0], [a[8], 0, 0, 0, 0, 0, 0, 0, -(b[8]+a[3]+b[2]), a[2], 0, 0, b[3], 0, 0], [0, a[8], 0, 0, 0, 0, 0, 0, b[2], -(b[8]+a[2]+b[1]), a[1], 0, 0, 0, 0], [0, 0, a[8], 0, 0, 0, 0, 0, 0, b[1], -(a[1]+b[8]), 0, 0, 0, 0], [a[3], 0, 0, 0, 0, b[4], 0, 0, 0, 0, 0, -(a[9]+a[8]+b[3]+a[4]), b[8], b[9], 0], [0, 0, 0, 0, 0, 0, 0, 0, a[3], 0, 0, a[8], -(b[8]+a[9]+b[3]), 0, b[9]], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a[9], 0, -b[9], 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a[9], 0, -b[9]] ]) return J def calcCurrent(self, vals, vOld, setRecArray=True): vals = np.array(vals) if len(vals.shape) == 1: vals.shape = (9,-1) elif vals.shape[0] != 9 and vals.shape[-1] == 9: vals = vals.T C1,C2,C3,\ IC2,IC3,IF,\ IM1,IM2,\ LC1,LC2,LC3,\ O,LO,\ OB,LOB = vals if setRecArray: self._recArray += list(np.copy(vals.T)) ena = self.getRevPot() oprob = (O if self.retOptions['INa'] else 0)+\ (LO if self.retOptions['INaL'] else 0) INa = (self.gNa if self.retOptions['G'] else 1) *\ (oprob if self.retOptions['Open'] else 1) *\ ((vOld - ena) if self.retOptions['RevPot'] else 1); return INa class OHaraRudy_Gratz_INa(): num_params = 31 param_bounds = [(-3,3), (-3,3), (-3,3), (-1,3), (-15,15), (-3,3), (-0.1,3), (-3,3), (-0.1,3), (-1,3), (-15,15), (-15,15), (-3,3), (-15,15), (-1,3), (-3,3), (-15,15), (-1,3), (-5,5), (-1,3), (-15,15), (-3,3), (-15,15), (-1,3), (-1,3), (-3,3), (-15,15), (-1,3), (-1,3), (-3,3), (-3,3)] RGAS = 8314.0; FDAY = 96487.0; KmCaMK = 0.15 CaMKa = 1e-5 def __init__(self, GNaFactor=0, GNaLFactor=0, baselineFactor=0, mss_tauFactor=0, mss_shiftFactor=0, tm_mult1Factor=0, tm_tau1Factor=0, tm_mult2Factor=0, tm_tau2Factor=0, hss_tauFactor=0, hss_shiftFactor=0, hsss_shiftFactor=0, thf_maxFactor=0, thf_shiftFactor=0, thf_tauFactor=0, ths_maxFactor=0, ths_shiftFactor=0, ths_tauFactor=0, Ahf_multFactor=0, jss_tauFactor=0, jss_shiftFactor=0, tj_maxFactor=0, tj_shiftFactor=0, tj_tauFactor=0, hssp_tauFactor=0, tssp_multFactor=0, tjp_multFactor=0,\ mLss_tauFactor=0, hLss_tauFactor=0, thL_baselineFactor=0, thLp_multFactor=0, TEMP = 310.0, naO = 140.0, naI = 7): # scaling currents 0 self.GNa = 75*np.exp(GNaFactor); self.GNaL = 0.0075*np.exp(GNaLFactor); #fastest tau 2 self.baseline = 2.038*np.exp(baselineFactor) #m gate 3 self.mss_tau = 9.871*np.exp(mss_tauFactor) self.mss_shift = 39.57+mss_shiftFactor self.tm_mult1 = 6.765*np.exp(tm_mult1Factor) self.tm_tau1 = 34.77*np.exp(tm_tau1Factor) self.tm_mult2 = 8.552*np.exp(tm_mult2Factor) self.tm_tau2 = 5.955*np.exp(tm_tau2Factor) #h gate 9 self.hss_tau = 6.086*np.exp(hss_tauFactor) self.hfss_shift = 82.90+hss_shiftFactor self.hsss_shift = 60*np.exp(hsss_shiftFactor) self.thf_max = 50*np.exp(thf_maxFactor) self.thf_shift = -78+thf_shiftFactor self.thf_tau = 15*np.exp(thf_tauFactor) self.ths_max = 50*np.exp(ths_maxFactor) self.ths_shift = -75+ths_shiftFactor self.ths_tau = 40*np.exp(ths_tauFactor) mixingodds = np.exp(Ahf_multFactor) self.Ahf_mult = mixingodds/(mixingodds+1)# np.exp(Ahf_multFactor) #j gate 19 self.jss_tau = 6.086*np.exp(jss_tauFactor) self.jss_shift = 80+jss_shiftFactor self.tj_max = 200*np.exp(tj_maxFactor) self.tj_shift = -95+tj_shiftFactor self.tj_tau = 3*np.exp(tj_tauFactor) # phosphorylated gates 24 self.hssp_tau = 6.086*np.exp(hssp_tauFactor) self.tssp_mult = 3.0*np.exp(tssp_multFactor) self.tjp_mult = 1.46*np.exp(tjp_multFactor) #late gates & late gate phosphorylation 27 self.mLss_tau = 5.264*np.exp(mLss_tauFactor) self.hLss_tau = 7.488*np.exp(hLss_tauFactor) self.hLssp_tau = self.hLss_tau self.thL_baseline = 200.0*np.exp(thL_baselineFactor) self.thLp_mult = 3*np.exp(thLp_multFactor) self.TEMP = TEMP self.naO = naO self.naI = naI self.recArrayNames = pd.Index(["m","hf","hs","j","hsp","jp","mL","hL","hLp"]) self.state_vals = pd.Series([0,1,1,1,1,1,0,1,1], index=self.recArrayNames, dtype='float64') self._recArray = pd.DataFrame(columns=self.recArrayNames) self.retOptions = {'G': True, 'INa': True, 'INaL': True,\ 'Open': True, 'RevPot': True} self.lastVal = None def calc_taus_ss(self, vOld): if self.lastVal is not None and np.array_equal(self.lastVal[0], vOld): return self.lastVal[1] tau = ObjDict() ss = ObjDict() ss.mss = 1.0 / (1.0 + np.exp((-(vOld + self.mss_shift+12)) / self.mss_tau)); tau.tm = self.baseline/15+ 1.0 / (self.tm_mult1 * np.exp((vOld + 11.64) / self.tm_tau1) + self.tm_mult2 * np.exp(-(vOld + 77.42) / self.tm_tau2)); ss.hfss = 1.0 / (1 + np.exp((vOld + self.hfss_shift+5) / self.hss_tau)); tau.thf = self.baseline/5 + (self.thf_max-self.baseline/5) / (1+np.exp((vOld-self.thf_shift)/self.thf_tau)) # tau.thf = self.baseline/5 + 1/(6.149) * np.exp(-(vOld + 0.5096) / 15); # if vOld < -100: # tau.thf = self.baseline # tau.thf = np.clip(tau.thf, a_max=15, a_min=None) ss.hsss = 1.0 / (1 + np.exp((vOld + self.hsss_shift-5) / (self.hss_tau+8))); tau.ths = self.baseline + (self.ths_max-self.baseline) / (1+np.exp((vOld-self.ths_shift)/self.ths_tau)) # tau.ths = self.baseline + 1.0 / (0.3343) * np.exp(-(vOld + 5.730) / 30); # if vOld < -100: # tau.ths = self.baseline # tau.ths = np.clip(tau.ths, a_max=20, a_min=None) ss.jss = 1.0 / (1 + np.exp((vOld + self.jss_shift+5) / (self.jss_tau)));#hss; tau.tj = self.baseline + (self.tj_max-self.baseline)/(1+np.exp(-1/self.tj_tau*(vOld-self.tj_shift))) if vOld > -60: tau.tj = 100 + (self.tj_max-100)/(1+np.exp(2/self.tj_tau*(vOld-(self.tj_shift+40)))) ss.hssp = 1.0 / (1 + np.exp((vOld + 89.1) / self.hssp_tau)); tau.thsp = self.tssp_mult * tau.ths; tau.tjp = self.tjp_mult * tau.tj; ss.mLss = 1.0 / (1.0 + np.exp((-(vOld + 42.85)) / self.mLss_tau)); tau.tmL = tau.tm; ss.hLss = 1.0 / (1.0 + np.exp((vOld + 87.61) / self.hLss_tau)); tau.thL = self.thL_baseline; ss.hLssp = 1.0 / (1.0 + np.exp((vOld + 93.81) / self.hLssp_tau)); tau.thLp = self.thLp_mult * tau.thL; # tau.__dict__ = {key: min(max(value, 1e-8), 1e20) for key,value in tau.__dict__.items()} self.lastVal = (vOld, (tau, ss)) return tau, ss def jac(self, vOld): vOld = np.array(vOld,ndmin=1) d_vals = np.squeeze(np.zeros((9,len(vOld)))) tau, _ = self.calc_taus_ss(vOld) d_vals[0] = -1 / tau.tm d_vals[1] = -1 / tau.thf d_vals[2] = -1 / tau.ths d_vals[3] = -1 / tau.tj d_vals[4] = -1 / tau.thsp d_vals[5] = -1 / tau.tjp d_vals[6] = -1 / tau.tmL d_vals[7] = -1 / tau.thL d_vals[8] = -1 / tau.thLp # np.clip(d_vals, a_min=-1e15, a_max=None, out=d_vals) return np.diag(d_vals) def ddtcalc(self, vals, vOld): d_vals = np.zeros_like(vals) tau, ss = self.calc_taus_ss(vOld) d_vals[0] = (ss.mss-vals[0]) / tau.tm d_vals[1] = (ss.hfss-vals[1]) / tau.thf d_vals[2] = (ss.hsss-vals[2]) / tau.ths d_vals[3] = (ss.jss-vals[3]) / tau.tj d_vals[4] = (ss.hssp-vals[4]) / tau.thsp d_vals[5] = (ss.jss-vals[5]) / tau.tjp d_vals[6] = (ss.mLss-vals[6]) / tau.tmL d_vals[7] = (ss.hLss-vals[7]) / tau.thL d_vals[8] = (ss.hLssp-vals[8]) / tau.thLp # np.clip(d_vals, a_min=-1e15, a_max=1e15, out=d_vals) return d_vals def getRevPot(self): return (self.RGAS * self.TEMP / self.FDAY) * np.log(self.naO / self.naI) def calcCurrent(self, vals, vOld, ret=[True]*3, setRecArray=True): vals = np.array(vals) if len(vals.shape) == 1: vals.shape = (9,-1) elif vals.shape[0] != 9 and vals.shape[-1] == 9: vals = vals.T m,hf,hs,j,hsp,jp,mL,hL,hLp = vals self.recArray = self.recArray.append(pd.DataFrame(vals.T, columns=self.recArrayNames)) ena = self.getRevPot() Ahf = self.Ahf_mult; Ahs = 1.0 - Ahf; h = Ahf * hf + Ahs * hs; hp = Ahf * hf + Ahs *hsp; fINap = (1.0 / (1.0 + self.KmCaMK / self.CaMKa)); # oprob = self.m * self.m * self.m * ((1.0 - fINap) * h * self.j + fINap * hp * self.jp) # oprob = m**3 * ((1.0 - fINap) * h + fINap * hp * jp) oprob = m**3 * ((1.0 - fINap) * h * j + fINap * hp * jp) INa = (self.GNa if self.retOptions['G'] else 1) *\ (oprob if self.retOptions['Open'] else 1) *\ ((vOld - ena) if self.retOptions['RevPot'] else 1); fINaLp = (1.0 / (1.0 + self.KmCaMK / self.CaMKa)); loprob = mL * ((1.0 - fINaLp) * hL + fINaLp * hLp) INaL = (self.GNaL if self.retOptions['G'] else 1)*\ (loprob if self.retOptions['Open'] else 1)*\ ((vOld - ena) if self.retOptions['RevPot'] else 1); return (INa if self.retOptions['INa'] else 0)+\ (INaL if self.retOptions['INaL'] else 0) def update(self, vOld, dt): m,hf,hs,j,hsp,jp,mL,hL,hLp = self.state_vals tau, ss = self.calc_taus_ss(vOld) m = ss.mss - (ss.mss - m) * np.exp(-dt / tau.tm); hf = ss.hss - (ss.hss - hf) * np.exp(-dt / tau.thf); hs = ss.hss - (ss.hss - hs) *
np.exp(-dt / tau.ths)
numpy.exp
import numpy as np from pycbc import waveform, psd, detector from scipy.stats import betaprime, uniform, randint from scipy.special import erf, erfinv import time from scipy.interpolate import interp1d import scipy.interpolate as si from gwcosmo import priors as p from scipy.stats import truncnorm from astropy.cosmology import FlatLambdaCDM, z_at_value import argparse import dill import os import sys cdir = os.path.dirname(os.path.dirname(sys.path[0])) print(cdir) cosmo = FlatLambdaCDM(H0 = 70, Om0 = 0.31) np.random.seed(7) parser = argparse.ArgumentParser(description='Generate population and posterior samples.') parser.add_argument('--N',type=int,help='number of population events',default=10000) args = parser.parse_args() N = int(args.N) # nunber of events # Here come all the definitions used in this script def TruncNormSampler(clip_a, clip_b, mean, std, Nsamples): a, b = (clip_a - mean) / std, (clip_b - mean) / std return truncnorm.rvs(a,b,size=Nsamples ) * std + mean def AntennaPattern(inclination, rightAscension, declination, polarisation, GPStime, interferometer = 'L1'): """ This is a measure for the detector response, depending on the sky localisation and orbital configuration of the binary and the arrival time of the GW (for the transformation between the source frame and the detector frame). """ scienceMachien = detector.Detector(interferometer) Fplus, Fcross = scienceMachien.antenna_pattern(rightAscension, declination, polarisation, GPStime) Aplus = 0.5*Fplus*(1 + np.cos(inclination)**2) Across = Fcross*np.cos(inclination) A = (Aplus**2 + Across**2)**0.5 return A def LuminosityDistance(redshift): dL = cosmo.luminosity_distance(redshift).value return dL def InclinationPPF(u): """For sampling the inclination""" ppf = np.arccos(1 - 2*u) return ppf def LogNormIshPPF(u, a = 1.1375, b = 0.8665, zmax = 15): """For sampling the analytical approximation of the redshift distribution""" ppf = np.exp(a**2 + b - a*2**0.5*erfinv(1 - u*(1 - erf((a**2 + b - np.log(zmax))/2**0.5/a)))) return ppf def BetaprimePPF(u, a = 2.906, b = 0.0158, c = 0.58, zmax = 15): """For sampling the analytical approximation of the redshift distribution""" ppf = betaprime.ppf(u*betaprime.cdf(zmax, a, b, loc = c), a, b, loc = c) return ppf def RedshiftSampler(lambda_z = 0.563, a1 = 2.906, b1 = 0.0158, c = 0.58, a2 = 1.1375, b2 = 0.8665, zmax = 15, Nsample=1): """ Function for sampling the redshift distribution using a rejection sampling procedure. """ # Random number between 0 and 1 that will define which # distribution will be drawn from u = uniform.rvs(size=Nsample) sample =
np.zeros(u.shape)
numpy.zeros
""" Explanation of the Algorithm ============================ First of all it is crucial to understand how a STL file is constructed. For this purpose I would recommend reading the following articles, since this explanation aims on outlining the implementation of the below algorithm only: * http://www.fabbers.com/tech/STL_Format * https://danbscott.ghost.io/writing-an-stl-file-from-scratch/ With that in mind, we basically only need to accomplish the transformation of pixels into facets (triangles). This is achieved by the following steps: 0. Reading the GeoTiff and turning it into a 2d array where each pixel value equals the altitude ------------------------------------------------------------------------------------------------ Reading the GeoTiff and turning it into a numpy array is not considered part of the below algorithm. It is taken care of by `mapa/__init__.py` and not described in greater detail here. 1. Creating a 2d array (raster) given the input GeoTIFF data ------------------------------------------------------------ A 2d numpy array is created within `_create_raster`. It has one more row and one more column compared to the input array of the GeoTIFF. That is because we are going to describe each input pixel by four triangles. A pixel with center C and corners 1,2,3 and 4 represented by four triangles: 1-----------------2 | x x | | x x | | x x | | x x | | C | | x x | | x x | | x x | | x x | 3-----------------4 All four triangles are connected to each other in the center C of the pixel. Imaging we are moving the raster slightly across/above the input array. r r r r r r a a a a a r r r r r r a a a a a r r r r r r a a a a a r r r r r r a a a a a r r r r r r a a a a a r r r r r r The values of the raster r can then be used to describe the altitude at the corners (1,2,3 and 4) of a pixel, while the values of the array a describe the altitude at the center C of the pixel. With this approach the information for computing the position of the required triangles representing the 3d surface of the desired output model can easily be determined by looking into the input array and the constructed raster. 2. Computing the triangles representing the elevation data ---------------------------------------------------------- With the above step in mind, determining the altitude values basically consists of a lookup into the given raster and input array. The function `_compute_triangles_of_3d_surface` takes care of this while at the same time adding offset values and scaling the x, y and z-axis to achieve the desired model size. The return value of the function is a numpy array containing the computed triangles. Each triangle T consists of 3 vertices V where each vertex V corresponds to one coordinates C, where each coordinate C in turn consists of a X, Y and Z value: T = V1, V2, V3 V = C C = X, Y, Z This means each triangle consists of nine values. The `_compute_triangles_of_3d_surface` therefore needs to iterate over all pixels and compute the positions of the four triangles for each pixel. The triangles per pixel are described as top, left, bottom and right triangles. 3. Computing the triangles representing the side and bottom of the output 3d model ---------------------------------------------------------------------------------- With the above steps we manage to compute the triangles for describing the 3d surface which we derived from the input GeoTIFF file. However, in order to make a 3d-printable STL file, we need to ensure that the resulting mesh is actually closed i.e. watertight. This is done by `_compute_triangles_of_body_side` and `_compute_triangles_of_bottom`. The vertices of the triangles for the side of the resulting STL model are computed in the following fashion. Imaging moving along one side (x or y) of the computed 3d surface. Each coordinate along this side will be the considered the vertex of two triangles, while the next coordinate along the side of the surface is the second vertex and one coordinate at the bottom of the model will be the third vertex of the triangle. Or one vertex at the surface and two at the bottom. s s s s s s s s s s s s s b b b b b b b b b b b b b s illustrates a coordinate at the side of the 3d surface and b a coordinate at the bottom of the model. Imaging drawing triangles between the s's and the b's. This approach is used to compute the side triangles within `_compute_triangles_of_body_side`. Computing the triangles of the bottom in the scope of `_compute_triangles_of_bottom` is super straight forward, as it only needs to compute two triangles, where the altitude value z is zero and all other x and y values correspond the desired model dimensions. 4. Write triangles to STL file ------------------------------ This is not considered part of the algorithm and is taken care of by `mapa/__init__._save_to_stl_file`. It boils down to the usage of numpy-stl, which has a super convenient and efficient interface for writing triangles to a (binary of ascii) STL file. """ import logging from dataclasses import dataclass from typing import Union import numba as nb import numpy as np import numpy.typing as npt from numpy.lib.stride_tricks import as_strided log = logging.getLogger(__name__) @dataclass class ModelSize: x: float y: float @nb.njit(fastmath=True, cache=True) def _create_raster(array: npt.ArrayLike, max_x: int, max_y: int) -> np.ndarray: max_x, max_y = array.shape raster = np.zeros((max_x + 1, max_y + 1)) # loop over raster elements to determine z value of raster elements for ix in range(0, raster.shape[0]): for iy in range(0, raster.shape[1]): # special treatment of first and last rows/cols if ix >= max_x or iy >= max_y: if ix >= max_x and iy < max_y: raster[ix][iy] = array[ix - 1][iy] elif iy >= max_y and ix < max_x: raster[ix][iy] = array[ix][iy - 1] else: raster[ix][iy] = array[ix - 1][iy - 1] elif ix == 0 or iy == 0: raster[ix][iy] = array[ix][iy] else: # z value in raster is average of four neighbors raster[ix][iy] = (array[ix][iy] + array[ix - 1][iy] + array[ix][iy - 1] + array[ix - 1][iy - 1]) / 4 return raster @nb.njit(fastmath=True, cache=True) def _compute_triangles_of_3d_surface( raster: npt.ArrayLike, array: npt.ArrayLike, max_x: int, max_y: int, x_scale: float, y_scale: float, z_scale: float, z_offset: float, ) -> np.ndarray: triangles = np.full((max_x, max_y, 4, 3, 3), -1.0, dtype=np.float64) for ix in range(0, max_x): for iy in range(0, max_y): if ix > max_x or iy > max_y: continue else: # top triangle # first vertex triangles[ix, iy, 0, 0, 0] = (ix + 1 / 2) * x_scale triangles[ix, iy, 0, 0, 1] = (iy + 1 / 2) * y_scale triangles[ix, iy, 0, 0, 2] = (array[ix, iy]) * z_scale + z_offset # second vertex triangles[ix, iy, 0, 1, 0] = ix * x_scale triangles[ix, iy, 0, 1, 1] = iy * y_scale triangles[ix, iy, 0, 1, 2] = (raster[ix, iy]) * z_scale + z_offset # third vertex triangles[ix, iy, 0, 2, 0] = (ix + 1) * x_scale triangles[ix, iy, 0, 2, 1] = iy * y_scale triangles[ix, iy, 0, 2, 2] = (raster[ix + 1, iy]) * z_scale + z_offset # left triangle # first vertex triangles[ix, iy, 1, 0, 0] = ix * x_scale triangles[ix, iy, 1, 0, 1] = (iy + 1) * y_scale triangles[ix, iy, 1, 0, 2] = (raster[ix, iy + 1]) * z_scale + z_offset # second vertex triangles[ix, iy, 1, 1, 0] = ix * x_scale triangles[ix, iy, 1, 1, 1] = iy * y_scale triangles[ix, iy, 1, 1, 2] = (raster[ix, iy]) * z_scale + z_offset # third vertex triangles[ix, iy, 1, 2, 0] = (ix + 1 / 2) * x_scale triangles[ix, iy, 1, 2, 1] = (iy + 1 / 2) * y_scale triangles[ix, iy, 1, 2, 2] = (array[ix, iy]) * z_scale + z_offset # bottom triangle # first vertex triangles[ix, iy, 2, 0, 0] = (ix + 1) * x_scale triangles[ix, iy, 2, 0, 1] = (iy + 1) * y_scale triangles[ix, iy, 2, 0, 2] = (raster[ix + 1, iy + 1]) * z_scale + z_offset # second vertex triangles[ix, iy, 2, 1, 0] = ix * x_scale triangles[ix, iy, 2, 1, 1] = (iy + 1) * y_scale triangles[ix, iy, 2, 1, 2] = (raster[ix, iy + 1]) * z_scale + z_offset # third vertex triangles[ix, iy, 2, 2, 0] = (ix + 1 / 2) * x_scale triangles[ix, iy, 2, 2, 1] = (iy + 1 / 2) * y_scale triangles[ix, iy, 2, 2, 2] = (array[ix, iy]) * z_scale + z_offset # right triangle # first vertex triangles[ix, iy, 3, 0, 0] = (ix + 1 / 2) * x_scale triangles[ix, iy, 3, 0, 1] = (iy + 1 / 2) * y_scale triangles[ix, iy, 3, 0, 2] = (array[ix, iy]) * z_scale + z_offset # second vertex triangles[ix, iy, 3, 1, 0] = (ix + 1) * x_scale triangles[ix, iy, 3, 1, 1] = iy * y_scale triangles[ix, iy, 3, 1, 2] = (raster[ix + 1, iy]) * z_scale + z_offset # third vertex triangles[ix, iy, 3, 2, 0] = (ix + 1) * x_scale triangles[ix, iy, 3, 2, 1] = (iy + 1) * y_scale triangles[ix, iy, 3, 2, 2] = (raster[ix + 1, iy + 1]) * z_scale + z_offset return triangles.reshape((max_x * max_y * 4, 3, 3)) def _compute_triangles_of_body_side( raster: npt.ArrayLike, max_x: int, max_y: int, x_scale: float, y_scale: float, z_scale: float, z_offset: float ) -> np.ndarray: # loop over raster and build triangles when in first and last col and row triangles = np.full((max_x * 4 + max_y * 4, 3, 3), -1.0, dtype=np.float64) cnt = 0 for ix in range(0, max_x): for iy in range(0, max_y): if ix == 0: # first row # triangle with two points at top of mesh # first vertex triangles[cnt + 0, 0, 0] = 0 triangles[cnt + 0, 0, 1] = iy * y_scale triangles[cnt + 0, 0, 2] = raster[ix][iy] * z_scale + z_offset # second vertex triangles[cnt + 0, 1, 0] = 0 triangles[cnt + 0, 1, 1] = (iy + 1) * y_scale triangles[cnt + 0, 1, 2] = raster[ix][iy + 1] * z_scale + z_offset # third vertex triangles[cnt + 0, 2, 0] = 0 triangles[cnt + 0, 2, 1] = iy * y_scale triangles[cnt + 0, 2, 2] = 0 # triangle with two points at ground # first vertex triangles[cnt + 1, 0, 0] = 0 triangles[cnt + 1, 0, 1] = iy * y_scale triangles[cnt + 1, 0, 2] = 0 # second vertex triangles[cnt + 1, 1, 0] = 0 triangles[cnt + 1, 1, 1] = (iy + 1) * y_scale triangles[cnt + 1, 1, 2] = raster[ix][iy + 1] * z_scale + z_offset # third vertex triangles[cnt + 1, 2, 0] = 0 triangles[cnt + 1, 2, 1] = (iy + 1) * y_scale triangles[cnt + 1, 2, 2] = 0 cnt += 2 if ix == max_x - 1: # last row # two points at top 3d mesh # first vertex triangles[cnt + 0, 0, 0] = max_x * x_scale triangles[cnt + 0, 0, 1] = (iy + 1) * y_scale triangles[cnt + 0, 0, 2] = raster[ix + 1][iy + 1] * z_scale + z_offset # second vertex triangles[cnt + 0, 1, 0] = max_x * x_scale triangles[cnt + 0, 1, 1] = iy * y_scale triangles[cnt + 0, 1, 2] = raster[ix + 1][iy] * z_scale + z_offset # third vertex triangles[cnt + 0, 2, 0] = max_x * x_scale triangles[cnt + 0, 2, 1] = iy * y_scale triangles[cnt + 0, 2, 2] = 0 # two points at ground # first vertex triangles[cnt + 1, 0, 0] = max_x * x_scale triangles[cnt + 1, 0, 1] = (iy + 1) * y_scale triangles[cnt + 1, 0, 2] = raster[ix + 1][iy + 1] * z_scale + z_offset # second vertex triangles[cnt + 1, 1, 0] = max_x * x_scale triangles[cnt + 1, 1, 1] = iy * y_scale triangles[cnt + 1, 1, 2] = 0 # third vertex triangles[cnt + 1, 2, 0] = max_x * x_scale triangles[cnt + 1, 2, 1] = (iy + 1) * y_scale triangles[cnt + 1, 2, 2] = 0 cnt += 2 if iy == 0: # first col # two points at top 3d mesh # first vertex triangles[cnt + 0, 0, 0] = (ix + 1) * x_scale triangles[cnt + 0, 0, 1] = 0 triangles[cnt + 0, 0, 2] = raster[ix + 1][iy] * z_scale + z_offset # second vertex triangles[cnt + 0, 1, 0] = ix * x_scale triangles[cnt + 0, 1, 1] = 0 triangles[cnt + 0, 1, 2] = raster[ix][iy] * z_scale + z_offset # third vertex triangles[cnt + 0, 2, 0] = ix * x_scale triangles[cnt + 0, 2, 1] = 0 triangles[cnt + 0, 2, 2] = 0 # two points at ground # first vertex triangles[cnt + 1, 0, 0] = (ix + 1) * x_scale triangles[cnt + 1, 0, 1] = 0 triangles[cnt + 1, 0, 2] = raster[ix + 1][iy] * z_scale + z_offset # second vertex triangles[cnt + 1, 1, 0] = ix * x_scale triangles[cnt + 1, 1, 1] = 0 triangles[cnt + 1, 1, 2] = 0 # third vertex triangles[cnt + 1, 2, 0] = (ix + 1) * x_scale triangles[cnt + 1, 2, 1] = 0 triangles[cnt + 1, 2, 2] = 0 cnt += 2 if iy == max_y - 1: # last col # two points at top 3d mesh # first vertex triangles[cnt + 0, 0, 0] = ix * x_scale triangles[cnt + 0, 0, 1] = max_y * y_scale triangles[cnt + 0, 0, 2] = raster[ix][iy + 1] * z_scale + z_offset # second vertex triangles[cnt + 0, 1, 0] = (ix + 1) * x_scale triangles[cnt + 0, 1, 1] = max_y * y_scale triangles[cnt + 0, 1, 2] = raster[ix + 1][iy + 1] * z_scale + z_offset # third vertex triangles[cnt + 0, 2, 0] = ix * x_scale triangles[cnt + 0, 2, 1] = max_y * y_scale triangles[cnt + 0, 2, 2] = 0 # two points at ground # first vertex triangles[cnt + 1, 0, 0] = ix * x_scale triangles[cnt + 1, 0, 1] = max_y * y_scale triangles[cnt + 1, 0, 2] = 0 # second vertex triangles[cnt + 1, 1, 0] = (ix + 1) * x_scale triangles[cnt + 1, 1, 1] = max_y * y_scale triangles[cnt + 1, 1, 2] = raster[ix + 1][iy + 1] * z_scale + z_offset # third vertex triangles[cnt + 1, 2, 0] = (ix + 1) * x_scale triangles[cnt + 1, 2, 1] = max_y * y_scale triangles[cnt + 1, 2, 2] = 0 cnt += 2 return triangles def _compute_triangles_of_bottom(max_x: int, max_y: int, x_scale: float, y_scale: float) -> np.ndarray: # first row fr_triangles = np.full((max_x - 1, 3, 3), -1.0, dtype=np.float64) for i, cnt in enumerate(range(0, max_x - 1)): fr_triangles[i, 0, 0] = cnt * x_scale fr_triangles[i, 0, 1] = 0 fr_triangles[i, 0, 2] = 0 fr_triangles[i, 1, 0] = 0 fr_triangles[i, 1, 1] = 1 * y_scale fr_triangles[i, 1, 2] = 0 fr_triangles[i, 2, 0] = (cnt + 1) * x_scale fr_triangles[i, 2, 1] = 0 fr_triangles[i, 2, 2] = 0 # first col fc_triangles = np.full((max_y - 1, 3, 3), -1.0, dtype=np.float64) for i, cnt in enumerate(range(1, max_y)): fc_triangles[i, 0, 0] = 0 fc_triangles[i, 0, 1] = cnt * y_scale fc_triangles[i, 0, 2] = 0 fc_triangles[i, 1, 0] = 0 fc_triangles[i, 1, 1] = (cnt + 1) * y_scale fc_triangles[i, 1, 2] = 0 fc_triangles[i, 2, 0] = 1 * x_scale fc_triangles[i, 2, 1] = max_y * y_scale fc_triangles[i, 2, 2] = 0 # last row lr_triangles = np.full((max_x - 1, 3, 3), -1.0, dtype=np.float64) for i, cnt in enumerate(range(1, max_x)): lr_triangles[i, 0, 0] = cnt * x_scale lr_triangles[i, 0, 1] = max_y * y_scale lr_triangles[i, 0, 2] = 0 lr_triangles[i, 1, 0] = (cnt + 1) * x_scale lr_triangles[i, 1, 1] = max_y * y_scale lr_triangles[i, 1, 2] = 0 lr_triangles[i, 2, 0] = max_x * x_scale lr_triangles[i, 2, 1] = (max_y - 1) * y_scale lr_triangles[i, 2, 2] = 0 # last col lc_triangles = np.full((max_y - 1, 3, 3), -1.0, dtype=np.float64) for i, cnt in enumerate(range(0, max_y - 1)): lc_triangles[i, 0, 0] = max_x * x_scale lc_triangles[i, 0, 1] = cnt * y_scale lc_triangles[i, 0, 2] = 0 lc_triangles[i, 1, 0] = (max_x - 1) * x_scale lc_triangles[i, 1, 1] = 0 lc_triangles[i, 1, 2] = 0 lc_triangles[i, 2, 0] = max_x * x_scale lc_triangles[i, 2, 1] = (cnt + 1) * y_scale lc_triangles[i, 2, 2] = 0 center_triangles = np.full((2, 3, 3), -1.0, dtype=np.float64) center_triangles[0, 0, 0] = (max_x - 1) * x_scale center_triangles[0, 0, 1] = 0 * y_scale center_triangles[0, 0, 2] = 0 center_triangles[0, 1, 0] = 1 * x_scale center_triangles[0, 1, 1] = max_y * y_scale center_triangles[0, 1, 2] = 0 center_triangles[0, 2, 0] = max_x * x_scale center_triangles[0, 2, 1] = (max_y - 1) * y_scale center_triangles[0, 2, 2] = 0 center_triangles[1, 0, 0] = 1 * x_scale center_triangles[1, 0, 1] = max_y * y_scale center_triangles[1, 0, 2] = 0 center_triangles[1, 1, 0] = (max_x - 1) * x_scale center_triangles[1, 1, 1] = 0 * y_scale center_triangles[1, 1, 2] = 0 center_triangles[1, 2, 0] = 0 * x_scale center_triangles[1, 2, 1] = 1 * y_scale center_triangles[1, 2, 2] = 0 return np.vstack((fr_triangles, lr_triangles, fc_triangles, lc_triangles, center_triangles)) def _determine_z_offset(z_offset: Union[None, float], minimum: float, elevation_scale: float) -> float: if z_offset is None: # using the natural height, i.e. islands will have an z_offset of ~0 and mountains will have a larger z_offset return minimum * elevation_scale else: if z_offset < 0: log.warning("☝️ Warning: Be careful using negative z_offsets, as it might break your 3D model.") # subtract scaled minimum from z_offset to ensure the input z_offset will remain return z_offset - minimum * elevation_scale def compute_all_triangles( array: npt.ArrayLike, desired_size: ModelSize, z_offset: Union[None, float], z_scale: float, elevation_scale: float, ) -> np.ndarray: max_x, max_y = array.shape log.debug("🗺 creating base raster for tiff...") raster = _create_raster(array, max_x, max_y) x_scale, y_scale = desired_size.x / max_x, desired_size.y / max_y z_offset = _determine_z_offset(z_offset, raster.min(), elevation_scale) combined_z_scale = elevation_scale * z_scale # compute triangles for 3d surface, sides and bottom log.debug("⛰ computing triangles of 3d surface...") dem_triangles = _compute_triangles_of_3d_surface( raster=raster, array=array, max_x=max_x, max_y=max_y, x_scale=x_scale, y_scale=y_scale, z_scale=combined_z_scale, z_offset=z_offset, ) log.debug("📐 computing triangles of body sides...") side_triangles = _compute_triangles_of_body_side( raster=raster, max_x=max_x, max_y=max_y, x_scale=x_scale, y_scale=y_scale, z_scale=combined_z_scale, z_offset=z_offset, ) bottom_triangles = _compute_triangles_of_bottom(max_x=max_x, max_y=max_y, x_scale=x_scale, y_scale=y_scale) return
np.vstack((dem_triangles, side_triangles, bottom_triangles))
numpy.vstack
import logging import numba import numpy as np import numpy.random as npr import second.core.box_np_ops as box_np_ops logger = logging.getLogger(__name__) def unmap(data, count, inds, fill=0): """Unmap a subset of item (data) back to the original set of items (of size count)""" if count == len(inds): return data if len(data.shape) == 1: ret = np.empty((count, ), dtype=data.dtype) ret.fill(fill) ret[inds] = data else: ret = np.empty((count, ) + data.shape[1:], dtype=data.dtype) ret.fill(fill) ret[inds, :] = data return ret def create_target_np(all_anchors, gt_boxes, similarity_fn, box_encoding_fn, prune_anchor_fn=None, gt_classes=None, matched_threshold=0.6, unmatched_threshold=0.45, bbox_inside_weight=None, positive_fraction=None, rpn_batch_size=300, norm_by_num_examples=False, gt_importance=None, box_code_size=7): """Modified from FAIR detectron. Args: all_anchors: [num_of_anchors, box_ndim] float tensor. gt_boxes: [num_gt_boxes, box_ndim] float tensor. similarity_fn: a function, accept anchors and gt_boxes, return similarity matrix(such as IoU). box_encoding_fn: a function, accept gt_boxes and anchors, return box encodings(offsets). prune_anchor_fn: a function, accept anchors, return indices that indicate valid anchors. gt_classes: [num_gt_boxes] int tensor. indicate gt classes, must start with 1. matched_threshold: float, iou greater than matched_threshold will be treated as positives. unmatched_threshold: float, iou smaller than unmatched_threshold will be treated as negatives. bbox_inside_weight: unused positive_fraction: [0-1] float or None. if not None, we will try to keep ratio of pos/neg equal to positive_fraction when sample. if there is not enough positives, it fills the rest with negatives rpn_batch_size: int. sample size norm_by_num_examples: bool. norm box_weight by number of examples, but I recommend to do this outside. gt_importance: 1d array. loss weight per gt. Returns: labels, bbox_targets, bbox_outside_weights """ total_anchors = all_anchors.shape[0] if prune_anchor_fn is not None: inds_inside = prune_anchor_fn(all_anchors) anchors = all_anchors[inds_inside, :] if not isinstance(matched_threshold, float): matched_threshold = matched_threshold[inds_inside] if not isinstance(unmatched_threshold, float): unmatched_threshold = unmatched_threshold[inds_inside] else: anchors = all_anchors inds_inside = None num_inside = len(inds_inside) if inds_inside is not None else total_anchors box_ndim = all_anchors.shape[1] logger.debug('total_anchors: {}'.format(total_anchors)) logger.debug('inds_inside: {}'.format(num_inside)) logger.debug('anchors.shape: {}'.format(anchors.shape)) if gt_classes is None: gt_classes = np.ones([gt_boxes.shape[0]], dtype=np.int32) if gt_importance is None: gt_importance = np.ones([gt_boxes.shape[0]], dtype=np.float32) # Compute anchor labels: # label=1 is positive, 0 is negative, -1 is don't care (ignore) labels = np.empty((num_inside, ), dtype=np.int32) gt_ids = np.empty((num_inside, ), dtype=np.int32) labels.fill(-1) gt_ids.fill(-1) importance = np.empty((num_inside, ), dtype=np.float32) importance.fill(1) if len(gt_boxes) > 0: # Compute overlaps between the anchors and the gt boxes overlaps anchor_by_gt_overlap = similarity_fn(anchors, gt_boxes) # Map from anchor to gt box that has highest overlap anchor_to_gt_argmax = anchor_by_gt_overlap.argmax(axis=1) # For each anchor, amount of overlap with most overlapping gt box anchor_to_gt_max = anchor_by_gt_overlap[np.arange(num_inside), anchor_to_gt_argmax] # # Map from gt box to an anchor that has highest overlap gt_to_anchor_argmax = anchor_by_gt_overlap.argmax(axis=0) # For each gt box, amount of overlap with most overlapping anchor gt_to_anchor_max = anchor_by_gt_overlap[gt_to_anchor_argmax, np.arange(anchor_by_gt_overlap. shape[1])] # must remove gt which doesn't match any anchor. empty_gt_mask = gt_to_anchor_max == 0 gt_to_anchor_max[empty_gt_mask] = -1 """ if not np.all(empty_gt_mask): gt_to_anchor_max = gt_to_anchor_max[empty_gt_mask] anchor_by_gt_overlap = anchor_by_gt_overlap[:, empty_gt_mask] gt_classes = gt_classes[empty_gt_mask] gt_boxes = gt_boxes[empty_gt_mask] """ # Find all anchors that share the max overlap amount # (this includes many ties) anchors_with_max_overlap = np.where( anchor_by_gt_overlap == gt_to_anchor_max)[0] # Fg label: for each gt use anchors with highest overlap # (including ties) gt_inds_force = anchor_to_gt_argmax[anchors_with_max_overlap] labels[anchors_with_max_overlap] = gt_classes[gt_inds_force] gt_ids[anchors_with_max_overlap] = gt_inds_force # Fg label: above threshold IOU pos_inds = anchor_to_gt_max >= matched_threshold gt_inds = anchor_to_gt_argmax[pos_inds] labels[pos_inds] = gt_classes[gt_inds] gt_ids[pos_inds] = gt_inds bg_inds = np.where(anchor_to_gt_max < unmatched_threshold)[0] importance[pos_inds] = gt_importance[gt_inds] else: # labels[:] = 0 bg_inds = np.arange(num_inside) fg_inds = np.where(labels > 0)[0] fg_max_overlap = None if len(gt_boxes) > 0: fg_max_overlap = anchor_to_gt_max[fg_inds] gt_pos_ids = gt_ids[fg_inds] # bg_inds = np.where(anchor_to_gt_max < unmatched_threshold)[0] # bg_inds = np.where(labels == 0)[0] # subsample positive labels if we have too many if positive_fraction is not None: num_fg = int(positive_fraction * rpn_batch_size) if len(fg_inds) > num_fg: disable_inds = npr.choice( fg_inds, size=(len(fg_inds) - num_fg), replace=False) labels[disable_inds] = -1 fg_inds = np.where(labels > 0)[0] # subsample negative labels if we have too many # (samples with replacement, but since the set of bg inds is large most # samples will not have repeats) num_bg = rpn_batch_size - np.sum(labels > 0) # print(num_fg, num_bg, len(bg_inds) ) if len(bg_inds) > num_bg: enable_inds = bg_inds[npr.randint(len(bg_inds), size=num_bg)] labels[enable_inds] = 0 bg_inds = np.where(labels == 0)[0] else: if len(gt_boxes) == 0: labels[:] = 0 else: labels[bg_inds] = 0 # re-enable anchors_with_max_overlap labels[anchors_with_max_overlap] = gt_classes[gt_inds_force] bbox_targets = np.zeros((num_inside, box_code_size), dtype=all_anchors.dtype) if len(gt_boxes) > 0: # print(anchors[fg_inds, :].shape, gt_boxes[anchor_to_gt_argmax[fg_inds], :].shape) # bbox_targets[fg_inds, :] = box_encoding_fn( # anchors[fg_inds, :], gt_boxes[anchor_to_gt_argmax[fg_inds], :]) bbox_targets[fg_inds, :] = box_encoding_fn( gt_boxes[anchor_to_gt_argmax[fg_inds], :], anchors[fg_inds, :]) # Bbox regression loss has the form: # loss(x) = weight_outside * L(weight_inside * x) # Inside weights allow us to set zero loss on an element-wise basis # Bbox regression is only trained on positive examples so we set their # weights to 1.0 (or otherwise if config is different) and 0 otherwise # NOTE: we don't need bbox_inside_weights, remove it. # bbox_inside_weights = np.zeros((num_inside, box_ndim), dtype=np.float32) # bbox_inside_weights[labels == 1, :] = [1.0] * box_ndim # The bbox regression loss only averages by the number of images in the # mini-batch, whereas we need to average by the total number of example # anchors selected # Outside weights are used to scale each element-wise loss so the final # average over the mini-batch is correct # bbox_outside_weights = np.zeros((num_inside, box_ndim), dtype=np.float32) bbox_outside_weights = np.zeros((num_inside, ), dtype=all_anchors.dtype) # uniform weighting of examples (given non-uniform sampling) if norm_by_num_examples: num_examples = np.sum(labels >= 0) # neg + pos num_examples =
np.maximum(1.0, num_examples)
numpy.maximum
""" Tests for zipline.utils.validate. """ from operator import attrgetter from types import FunctionType from unittest import TestCase from parameterized import parameterized from numpy import arange, array, dtype import pytz from six import PY3 from zipline.utils.preprocess import call, preprocess from zipline.utils.input_validation import ( expect_dimensions, ensure_timezone, expect_element, expect_dtypes, expect_types, optional, optionally, ) def noop(func, argname, argvalue): assert isinstance(func, FunctionType) assert isinstance(argname, str) return argvalue if PY3: qualname = attrgetter('__qualname__') else: def qualname(ob): return '.'.join((__name__, ob.__name__)) class PreprocessTestCase(TestCase): @parameterized.expand([ ('too_many', (1, 2, 3), {}), ('too_few', (1,), {}), ('collision', (1,), {'a': 1}), ('unexpected', (1,), {'q': 1}), ]) def test_preprocess_doesnt_change_TypeErrors(self, name, args, kwargs): """ Verify that the validate decorator doesn't swallow typeerrors that would be raised when calling a function with invalid arguments """ def undecorated(x, y): return x, y decorated = preprocess(x=noop, y=noop)(undecorated) with self.assertRaises(TypeError) as e: undecorated(*args, **kwargs) undecorated_errargs = e.exception.args with self.assertRaises(TypeError) as e: decorated(*args, **kwargs) decorated_errargs = e.exception.args self.assertEqual(len(decorated_errargs), 1) self.assertEqual(len(undecorated_errargs), 1) self.assertEqual(decorated_errargs[0], undecorated_errargs[0]) def test_preprocess_co_filename(self): def undecorated(): pass decorated = preprocess()(undecorated) self.assertEqual( undecorated.__code__.co_filename, decorated.__code__.co_filename, ) def test_preprocess_preserves_docstring(self): @preprocess() def func(): "My awesome docstring" self.assertEqual(func.__doc__, "My awesome docstring") def test_preprocess_preserves_function_name(self): @preprocess() def arglebargle(): pass self.assertEqual(arglebargle.__name__, 'arglebargle') @parameterized.expand([ ((1, 2), {}), ((1, 2), {'c': 3}), ((1,), {'b': 2}), ((), {'a': 1, 'b': 2}), ((), {'a': 1, 'b': 2, 'c': 3}), ]) def test_preprocess_no_processors(self, args, kwargs): @preprocess() def func(a, b, c=3): return a, b, c self.assertEqual(func(*args, **kwargs), (1, 2, 3)) def test_preprocess_bad_processor_name(self): a_processor = preprocess(a=int) # Should work fine. @a_processor def func_with_arg_named_a(a): pass @a_processor def func_with_default_arg_named_a(a=1): pass message = "Got processors for unknown arguments: %s." % {'a'} with self.assertRaises(TypeError) as e: @a_processor def func_with_no_args(): pass self.assertEqual(e.exception.args[0], message) with self.assertRaises(TypeError) as e: @a_processor def func_with_arg_named_b(b): pass self.assertEqual(e.exception.args[0], message) @parameterized.expand([ ((1, 2), {}), ((1, 2), {'c': 3}), ((1,), {'b': 2}), ((), {'a': 1, 'b': 2}), ((), {'a': 1, 'b': 2, 'c': 3}), ]) def test_preprocess_on_function(self, args, kwargs): decorators = [ preprocess(a=call(str), b=call(float), c=call(lambda x: x + 1)), ] for decorator in decorators: @decorator def func(a, b, c=3): return a, b, c self.assertEqual(func(*args, **kwargs), ('1', 2.0, 4)) @parameterized.expand([ ((1, 2), {}), ((1, 2), {'c': 3}), ((1,), {'b': 2}), ((), {'a': 1, 'b': 2}), ((), {'a': 1, 'b': 2, 'c': 3}), ]) def test_preprocess_on_method(self, args, kwargs): decorators = [ preprocess(a=call(str), b=call(float), c=call(lambda x: x + 1)), ] for decorator in decorators: class Foo(object): @decorator def method(self, a, b, c=3): return a, b, c @classmethod @decorator def clsmeth(cls, a, b, c=3): return a, b, c self.assertEqual(Foo.clsmeth(*args, **kwargs), ('1', 2.0, 4)) self.assertEqual(Foo().method(*args, **kwargs), ('1', 2.0, 4)) def test_expect_types(self): @expect_types(a=int, b=int) def foo(a, b, c): return a, b, c self.assertEqual(foo(1, 2, 3), (1, 2, 3)) self.assertEqual(foo(1, 2, c=3), (1, 2, 3)) self.assertEqual(foo(1, b=2, c=3), (1, 2, 3)) self.assertEqual(foo(1, 2, c='3'), (1, 2, '3')) for not_int in (str, float): with self.assertRaises(TypeError) as e: foo(not_int(1), 2, 3) self.assertEqual( e.exception.args[0], "{qualname}() expected a value of type " "int for argument 'a', but got {t} instead.".format( qualname=qualname(foo), t=not_int.__name__, ) ) with self.assertRaises(TypeError): foo(1, not_int(2), 3) with self.assertRaises(TypeError): foo(not_int(1), not_int(2), 3) def test_expect_types_custom_funcname(self): class Foo(object): @expect_types(__funcname='ArgleBargle', a=int) def __init__(self, a): self.a = a foo = Foo(1) self.assertEqual(foo.a, 1) for not_int in (str, float): with self.assertRaises(TypeError) as e: Foo(not_int(1)) self.assertEqual( e.exception.args[0], "ArgleBargle() expected a value of type " "int for argument 'a', but got {t} instead.".format( t=not_int.__name__, ) ) def test_expect_types_with_tuple(self): @expect_types(a=(int, float)) def foo(a): return a self.assertEqual(foo(1), 1) self.assertEqual(foo(1.0), 1.0) with self.assertRaises(TypeError) as e: foo('1') expected_message = ( "{qualname}() expected a value of " "type int or float for argument 'a', but got str instead." ).format(qualname=qualname(foo)) self.assertEqual(e.exception.args[0], expected_message) def test_expect_optional_types(self): @expect_types(a=optional(int)) def foo(a=None): return a self.assertIs(foo(), None) self.assertIs(foo(None), None) self.assertIs(foo(a=None), None) self.assertEqual(foo(1), 1) self.assertEqual(foo(a=1), 1) with self.assertRaises(TypeError) as e: foo('1') expected_message = ( "{qualname}() expected a value of " "type int or NoneType for argument 'a', but got str instead." ).format(qualname=qualname(foo)) self.assertEqual(e.exception.args[0], expected_message) def test_expect_element(self): set_ = {'a', 'b'} @expect_element(a=set_) def f(a): return a self.assertEqual(f('a'), 'a') self.assertEqual(f('b'), 'b') with self.assertRaises(ValueError) as e: f('c') expected_message = ( "{qualname}() expected a value in {set_!r}" " for argument 'a', but got 'c' instead." ).format( # We special-case set to show a tuple instead of the set repr. set_=tuple(sorted(set_)), qualname=qualname(f), ) self.assertEqual(e.exception.args[0], expected_message) def test_expect_element_custom_funcname(self): set_ = {'a', 'b'} class Foo(object): @expect_element(__funcname='ArgleBargle', a=set_) def __init__(self, a): self.a = a with self.assertRaises(ValueError) as e: Foo('c') expected_message = ( "ArgleBargle() expected a value in {set_!r}" " for argument 'a', but got 'c' instead." ).format( # We special-case set to show a tuple instead of the set repr. set_=tuple(sorted(set_)), ) self.assertEqual(e.exception.args[0], expected_message) def test_expect_dtypes(self): @expect_dtypes(a=dtype(float), b=dtype('datetime64[ns]')) def foo(a, b, c): return a, b, c good_a = arange(3, dtype=float) good_b = arange(3).astype('datetime64[ns]') good_c = object() a_ret, b_ret, c_ret = foo(good_a, good_b, good_c) self.assertIs(a_ret, good_a) self.assertIs(b_ret, good_b) self.assertIs(c_ret, good_c) with self.assertRaises(TypeError) as e: foo(good_a, arange(3, dtype='int64'), good_c) expected_message = ( "{qualname}() expected a value with dtype 'datetime64[ns]'" " for argument 'b', but got 'int64' instead." ).format(qualname=qualname(foo)) self.assertEqual(e.exception.args[0], expected_message) with self.assertRaises(TypeError) as e: foo(arange(3, dtype='uint32'), good_c, good_c) expected_message = ( "{qualname}() expected a value with dtype 'float64'" " for argument 'a', but got 'uint32' instead." ).format(qualname=qualname(foo)) self.assertEqual(e.exception.args[0], expected_message) def test_expect_dtypes_with_tuple(self): allowed_dtypes = (dtype('datetime64[ns]'), dtype('float')) @expect_dtypes(a=allowed_dtypes) def foo(a, b): return a, b for d in allowed_dtypes: good_a = arange(3).astype(d) good_b = object() ret_a, ret_b = foo(good_a, good_b) self.assertIs(good_a, ret_a) self.assertIs(good_b, ret_b) with self.assertRaises(TypeError) as e: foo(arange(3, dtype='uint32'), object()) expected_message = ( "{qualname}() expected a value with dtype 'datetime64[ns]' " "or 'float64' for argument 'a', but got 'uint32' instead." ).format(qualname=qualname(foo)) self.assertEqual(e.exception.args[0], expected_message) def test_expect_dtypes_custom_funcname(self): allowed_dtypes = (dtype('datetime64[ns]'),
dtype('float')
numpy.dtype
#%% STARmap_AllenVISp import os os.chdir('STARmap_AllenVISp/') import pickle import numpy as np import pandas as pd import matplotlib matplotlib.use('qt5agg') matplotlib.rcParams['pdf.fonttype'] = 42 matplotlib.rcParams['ps.fonttype'] = 42 import matplotlib.pyplot as plt import seaborn as sns import sys sys.path.insert(1,'SpaGE/') from principal_vectors import PVComputation with open ('data/SpaGE_pkl/Starmap.pkl', 'rb') as f: datadict = pickle.load(f) Starmap_data_scaled = datadict['Starmap_data_scaled'] del datadict with open ('data/SpaGE_pkl/Allen_VISp.pkl', 'rb') as f: datadict = pickle.load(f) RNA_data_scaled = datadict['RNA_data_scaled'] del datadict Common_data = RNA_data_scaled[
np.intersect1d(Starmap_data_scaled.columns,RNA_data_scaled.columns)
numpy.intersect1d
import sys import operator import numpy as np from sklearn.base import BaseEstimator, RegressorMixin, clone from sklearn.externals import six from sklearn.metrics import r2_score, mean_absolute_error, mean_squared_error class MetaRegressor(BaseEstimator, RegressorMixin): """ A combined multi-class regressor Parameters ---------- regressors : array-like, shape = [n_regressors] weights : array-like, shape = [n_regressors] Optional, default: None If a list of `int` or `float` values are provided, the regressors are weighted by importance; Uses uniform weights if `weights=None`. """ def __init__(self, regressors, weights=None): self.regressors = regressors self.weights = weights def fit(self, Xs, ys, nested=True): """ Fit regressors Parameters ---------- Xs : List of {array-like, sparse matrix}, length = number of regressors List of matrices of training samples ys : List of array-like, length = number of regressors List of vectors of target class labels nested: Bool (default = True) Returns ------- self : object """ assert(len(Xs) == len(ys) == len(self.regressors)) if (not isinstance(Xs,list)) or (not isinstance(ys,list)): raise TypeError sys.exit() if nested: Xs = map(np.vstack, Xs) ys = map(np.hstack, ys) self.regressors_ = [] for i,reg in enumerate(self.regressors): fitted_reg = clone(reg).fit(Xs[i], ys[i]) self.regressors_.append(fitted_reg) return self def predict(self, Xs): """ Predict class labels. Parameters ---------- Xs : List of {array-like, sparse matrix}, length = number of regressors List of matrices of training samples Returns ------- weighted_pred : array-like, shape = [n_samples] Predicted (weighted) target values """ num_regs = len(self.regressors_) preds = [] for index, X in enumerate(Xs): pred = [np.mean(self.regressors_[index].predict(P), axis=0) for P in X] preds.append(pred) preds = np.asarray(preds) weighted_pred = np.average(preds, axis=0, weights=self.weights) return weighted_pred def score(self, Xs, y_true, scoring='rmse'): """ Returns the R2 (Coefficient of Determination) score by default Parameters ---------- Xs : List of {array-like, sparse matrix}, length = number of regressors List of matrices of training samples y_true: Single vectors of true y values """ y_true = np.asarray(y_true) if scoring == 'r2': return r2_score(y_true,self.predict(Xs)) elif scoring == 'mean_abs_error': return mean_absolute_error(y_true, self.predict(Xs)) elif scoring == 'rmse': return np.sqrt(mean_squared_error(y_true, self.predict(Xs))) class LateFusionRegressor(BaseEstimator, RegressorMixin): """ Weighted Combined Regressor """ def __init__(self,regressors,weights=None): self.regressors = regressors # list of regressors self.weights = weights # weights for each of the regressors def fit(self,Xs,ys): """ Trains on the data. Xs = [[], [], []] (one matrix for each mode) ys = [[], [], []] Returns: self """ if isinstance(Xs,list) and isinstance(ys,list): assert(len(Xs) == len(ys) == len(self.regressors)) self.regressors_ = [] # store trained regressors for idx, reg in enumerate(self.regressors): fitted_reg = clone(reg).fit(Xs[idx],ys[idx]) self.regressors_.append(fitted_reg) return self def predict(self,Xs): """ Predicts new data instances Args: Xs = [[], [], []] Returns: weighted_pred: Weighted prediction of the target """ preds = [] for mode_idx, reg in enumerate(self.regressors_): preds.append(reg.predict(Xs[mode_idx])) preds =
np.asarray(preds)
numpy.asarray
import numpy as np import pandas as pd import scipy.cluster.hierarchy as hr from scipy.spatial.distance import squareform import riskfolio.RiskFunctions as rk import riskfolio.AuxFunctions as af import riskfolio.ParamsEstimation as pe class HCPortfolio(object): r""" Class that creates a portfolio object with all properties needed to calculate optimal portfolios. Parameters ---------- returns : DataFrame, optional A dataframe that containts the returns of the assets. The default is None. alpha : float, optional Significance level of CVaR, EVaR, CDaR and EDaR. The default is 0.05. """ def __init__(self, returns=None, alpha=0.05): self._returns = returns self.alpha = alpha self.asset_order = None self.clusters = None self.cov = None self.corr = None self.corr_sorted = None @property def returns(self): if self._returns is not None and isinstance(self._returns, pd.DataFrame): return self._returns else: raise NameError("returns must be a DataFrame") @returns.setter def returns(self, value): if value is not None and isinstance(value, pd.DataFrame): self._returns = value else: raise NameError("returns must be a DataFrame") @property def assetslist(self): if self._returns is not None and isinstance(self._returns, pd.DataFrame): return self._returns.columns.tolist() # get naive-risk weights def _naive_risk(self, returns, cov, rm="MV", rf=0): assets = returns.columns.tolist() n = len(assets) if rm == "equal": weight = np.ones((n, 1)) * 1 / n else: inv_risk =
np.zeros((n, 1))
numpy.zeros
import math import numpy as np from scipy import io import scipy import cv2 import matplotlib.pyplot as plt #################################### MAP ##################################### def initializeMap(res, xmin, ymin, xmax, ymax, memory = None, trust = None, optimism = None, occupied_thresh = None, free_thresh = None, confidence_limit = None): if memory == None: memory = 1 # set to value between 0 and 1 if memory is imperfect if trust == None: trust = 0.8 if optimism == None: optimism = 0.5 if occupied_thresh == None: occupied_thresh = 0.85 if free_thresh == None: free_thresh = 0.2 # 0.5 # 0.25 if confidence_limit == None: confidence_limit = 100 * memory MAP = {} MAP['res'] = res #meters; used to detrmine the number of square cells MAP['xmin'] = xmin #meters MAP['ymin'] = ymin MAP['xmax'] = xmax MAP['ymax'] = ymax MAP['sizex'] = int(np.ceil((MAP['xmax'] - MAP['xmin']) / MAP['res'] + 1)) # number of horizontal cells MAP['sizey'] = int(np.ceil((MAP['ymax'] - MAP['ymin']) / MAP['res'] + 1)) # number of vertical cells MAP['map'] = np.zeros((MAP['sizex'], MAP['sizey']), dtype=np.float64) # contains log odds. DATA TYPE: char or int8 # Related to log-odds MAP['memory'] = memory MAP['occupied'] = np.log(trust / (1 - trust)) MAP['free'] = optimism * np.log((1 - trust) / trust) # Try to be optimistic about exploration, so weight free space MAP['confidence_limit'] = confidence_limit # Related to occupancy grid MAP['occupied_thresh'] = np.log(occupied_thresh / (1 - occupied_thresh)) MAP['free_thresh'] = np.log(free_thresh / (1 - free_thresh)) (h, w) = MAP['map'].shape MAP['plot'] = np.zeros((h, w, 3), np.uint8) return MAP def updateMap(MAP, x_w, y_w, x_curr, y_curr): # convert lidar hits to map coordinates x_m, y_m = world2map(MAP, x_w, y_w) # convert robot's position to map coordinates x_curr_m, y_curr_m = world2map(MAP, x_curr, y_curr) indGood = np.logical_and(np.logical_and(np.logical_and((x_m > 1), (y_m > 1)), (x_m < MAP['sizex'])), (y_m < MAP['sizey'])) MAP['map'] = MAP['map'] * MAP['memory'] MAP['map'][x_m[0][indGood[0]], y_m[0][indGood[0]]] += MAP['occupied'] - MAP['free'] # we're going to add the MAP['free'] back in a second # initialize a mask where we will label the free cells free_grid = np.zeros(MAP['map'].shape).astype(np.int8) x_m = np.append(x_m, x_curr_m) # Must consider robot's current cell y_m = np.append(y_m, y_curr_m) contours = np.vstack((x_m, y_m)) # SWITCH # find the cells that are free, and update the map cv2.drawContours(free_grid, [contours.T], -1, MAP['free'], -1) MAP['map'] += free_grid # prevent overconfidence MAP['map'][MAP['map'] > MAP['confidence_limit']] = MAP['confidence_limit'] MAP['map'][MAP['map'] < -MAP['confidence_limit']] = -MAP['confidence_limit'] # update plot occupied_grid = MAP['map'] > MAP['occupied_thresh'] free_grid = MAP['map'] < MAP['free_thresh'] MAP['plot'][occupied_grid] = [0, 0, 0] MAP['plot'][free_grid] = [255, 255, 255] MAP['plot'][np.logical_and(np.logical_not(free_grid), np.logical_not(occupied_grid))] = [127, 127, 127] x_m, y_m = world2map(MAP, x_w, y_w) MAP['plot'][y_m, x_m] = [0, 255, 0] # plot latest lidar scan hits def lidar2map(MAP, x_l, y_l): #x_w, y_w = lidar2world() x_m, y_m = world2map(MAP, x_l, y_l) # build a single map in the lidar's frame of reference indGood = np.logical_and(np.logical_and(np.logical_and((x_m > 1), (y_m > 1)), (x_m < MAP['sizex'])), (y_m < MAP['sizey'])) map = np.zeros(MAP['map'].shape) map[x_m[0][indGood[0]], y_m[0][indGood[0]]] = 1 np.int8(map) return map def world2map(MAP, x_w, y_w): # convert from meters to cells x_m = np.ceil((x_w - MAP['xmin']) / MAP['res']).astype(np.int16) - 1 y_m = np.ceil((y_w - MAP['ymin']) / MAP['res']).astype(np.int16) - 1 indGood = np.logical_and(np.logical_and(np.logical_and((x_m > 1), (y_m > 1)), (x_m < MAP['sizex'])), (y_m < MAP['sizey'])) x_m = x_m[indGood] y_m = y_m[indGood] return x_m.astype(np.int), y_m.astype(np.int) ################################## PARTICLES ################################# # A particle is just a tuple of weights (scalar) and pose (3x1) def initializeParticles(num = None, n_thresh = None, noise_cov = None): if num == None: num = 100 if n_thresh == None: n_thresh = 0.1 * num # set threshold to 20% of original number of particles to resample if noise_cov == None: noise_cov = np.zeros((3,3)) # for debugging purposes noise_cov = 0.5 * np.eye(3) # set noise covariances for multivariate Gaussian. This is 10% of the delta_pose movement (check predictParticles) noise_cov = np.array([[.1, 0, 0], [0, .1, 0], [0, 0, 0.005]]) PARTICLES = {} PARTICLES['num'] = num PARTICLES['n_thresh'] = n_thresh # below this value, resample PARTICLES['noise_cov'] = noise_cov # covariances for Gaussian noise in each dimension PARTICLES['weights'] = np.ones(PARTICLES['num']) / PARTICLES['num'] PARTICLES['poses'] = np.zeros((PARTICLES['num'], 3)) return PARTICLES def predictParticles(PARTICLES, d_x, d_y, d_yaw, x_prev, y_prev, yaw_prev): noise_cov = np.matmul(PARTICLES['noise_cov'], np.abs(np.array([[d_x, 0, 0], [0, d_y, 0], [0, 0, d_yaw]]))) # create hypothesis (particles) poses noise = np.random.multivariate_normal([0, 0, 0], noise_cov, PARTICLES['num']) PARTICLES['poses'] = noise + np.array([[x_prev, y_prev, yaw_prev]]) # update poses according to deltas PARTICLES['poses'] += np.array([[d_x, d_y, d_yaw]]) return def updateParticles(PARTICLES, MAP, x_l, y_l, psi, theta): n_eff = 1 / np.sum(np.square(PARTICLES['weights'])) if (n_eff < PARTICLES['n_thresh']): print("resampling!") resampleParticles(PARTICLES) correlations = np.zeros(PARTICLES['num']) _, plot = cv2.threshold(MAP['plot'], 127, 255, cv2.THRESH_BINARY) for i in range(PARTICLES['num']): x_w, y_w, _ = lidar2world(psi, theta, x_l, y_l, PARTICLES['poses'][i][0], PARTICLES['poses'][i][1], PARTICLES['poses'][i][2]) x_m, y_m = world2map(MAP, x_w, y_w) particle_plot = np.zeros(MAP['plot'].shape) particle_plot[y_m, x_m] = [0, 1, 0] correlations[i] = np.sum(np.logical_and(plot, particle_plot)) # switched x and y weights = scipy.special.softmax(correlations - np.max(correlations)) # np.multiply(PARTICLES['weights'], scipy.special.softmax(correlations)) # multiply or add or replace? if (np.count_nonzero(correlations) == 0): print("ALL ZERO CORRELATIONS") PARTICLES['weights'] = weights return def resampleParticles(PARTICLES): # implemented low-variance resampling according to: https://robotics.stackexchange.com/questions/7705/low-variance-resampling-algorithm-for-particle-filter M = PARTICLES['num'] new_poses = np.zeros(PARTICLES['poses'].shape) r = np.random.uniform(0, 1 / M) w = PARTICLES['weights'][0] i = 0 j = 0 for m in range(M): U = r + m / M while (U > w): i += 1 w += PARTICLES['weights'][i] new_poses[j, :] = PARTICLES['poses'][i, :] j += 1 PARTICLES['poses'] = new_poses PARTICLES['weights'] = np.ones(PARTICLES['num']) / PARTICLES['num'] return ################################# TRANSFORMS ################################# b = 0.93 # distance from world to body in meters h = 0.33 # distance from body to head l = 0.15 # distance from head to lidar k = 0.07 # distance from head to kinect def pol2cart(rho, phi): x = rho * np.cos(phi) y = rho *
np.sin(phi)
numpy.sin
#!/usr/bin/python2 # -*- coding: utf-8 -*- import sys import os.path import numpy as np from utils.util import * ZENITH_LEVEL = 64 AZIMUTH_LEVEL = 512 INPUT_MEAN = np.array([[[10.88, 0.23, -1.04, 12.12]]]) # Need to be changed to accomodate airsmith environment INPUT_STD = np.array([[[11.47, 6.91, 0.86, 12.32]]]) # Need to be changed to accomodate airsmith environment def spherical_project(point_cloud): np_p = np.load(point_cloud) # perform fov filter by using hv_in_range cond = self.hv_in_range(x=np_p[:, 0], y=np_p[:, 1], z=np_p[:, 2], fov=[-45, 45]) np_p_ranged = np_p[cond] # get depth map lidar = self.pto_depth_map(velo_points=np_p_ranged, C=7) lidar_f = lidar.astype(np.float32) # to perform prediction lidar_mask = np.reshape( (lidar[:, :, 6] > 0), [ZENITH_LEVEL, AZIMUTH_LEVEL, 1] ) lidar_f = (lidar_f - INPUT_MEAN) / INPUT_STD return lidar_f def hv_in_range( x, y, z, fov, fov_type='h'): """ Extract filtered in-range velodyne coordinates based on azimuth & elevation angle limit Args: `x`:velodyne points x array `y`:velodyne points y array `z`:velodyne points z array `fov`:a two element list, e.g.[-45,45] `fov_type`:the fov type, could be `h` or 'v',defualt in `h` Return: `cond`:condition of points within fov or not Raise: `NameError`:"fov type must be set between 'h' and 'v' " """ d = np.sqrt(x ** 2 + y ** 2 + z ** 2) if fov_type == 'h': return np.logical_and(np.arctan2(y, x) > (-fov[1] * np.pi / 180), \ np.arctan2(y, x) < (-fov[0] * np.pi / 180)) elif fov_type == 'v': return np.logical_and(np.arctan2(z, d) < (fov[1] * np.pi / 180), \ np.arctan2(z, d) > (fov[0] * np.pi / 180)) else: raise NameError("fov type must be set between 'h' and 'v' ") def pto_depth_map(velo_points, H=64, W=512, C=7, dtheta=np.radians(0.4), dphi=np.radians(90./512.0)): x, y, z = velo_points[:, 0], velo_points[:, 1], velo_points[:, 2] r, g, b = velo_points[:, 3], velo_points[:, 4], velo_points[:, 5] d = np.sqrt(x ** 2 + y ** 2 + z**2) r = np.sqrt(x ** 2 + y ** 2) d[d==0] = 0.000001 r[r==0] = 0.000001 phi = np.radians(45.) -
np.arcsin(y/r)
numpy.arcsin
import numpy as np import os import re import requests import sys import time from netCDF4 import Dataset import pandas as pd from bs4 import BeautifulSoup from tqdm import tqdm # setup constants used to access the data from the different M2M interfaces BASE_URL = 'https://ooinet.oceanobservatories.org/api/m2m/' # base M2M URL SENSOR_URL = '12576/sensor/inv/' # Sensor Information # setup access credentials AUTH = ['OOIAPI-853A3LA6QI3L62', '<KEY>'] def M2M_Call(uframe_dataset_name, start_date, end_date): options = '?beginDT=' + start_date + '&endDT=' + end_date + '&format=application/netcdf' r = requests.get(BASE_URL + SENSOR_URL + uframe_dataset_name + options, auth=(AUTH[0], AUTH[1])) if r.status_code == requests.codes.ok: data = r.json() else: return None # wait until the request is completed print('Waiting for OOINet to process and prepare data request, this may take up to 20 minutes') url = [url for url in data['allURLs'] if re.match(r'.*async_results.*', url)][0] check_complete = url + '/status.txt' with tqdm(total=400, desc='Waiting') as bar: for i in range(400): r = requests.get(check_complete) bar.update(1) if r.status_code == requests.codes.ok: bar.n = 400 bar.last_print_n = 400 bar.refresh() print('\nrequest completed in %f minutes.' % elapsed) break else: time.sleep(3) elapsed = (i * 3) / 60 return data def M2M_Files(data, tag=''): """ Use a regex tag combined with the results of the M2M data request to collect the data from the THREDDS catalog. Collected data is gathered into an xarray dataset for further processing. :param data: JSON object returned from M2M data request with details on where the data is to be found for download :param tag: regex tag to use in discriminating the data files, so we only collect the correct ones :return: the collected data as an xarray dataset """ # Create a list of the files from the request above using a simple regex as a tag to discriminate the files url = [url for url in data['allURLs'] if re.match(r'.*thredds.*', url)][0] files = list_files(url, tag) return files def list_files(url, tag=''): """ Function to create a list of the NetCDF data files in the THREDDS catalog created by a request to the M2M system. :param url: URL to user's THREDDS catalog specific to a data request :param tag: regex pattern used to distinguish files of interest :return: list of files in the catalog with the URL path set relative to the catalog """ page = requests.get(url).text soup = BeautifulSoup(page, 'html.parser') pattern = re.compile(tag) return [node.get('href') for node in soup.find_all('a', text=pattern)] def M2M_Data(nclist,variables): thredds = 'https://opendap.oceanobservatories.org/thredds/dodsC/ooi/' #nclist is going to contain more than one url eventually for jj in range(len(nclist)): url=nclist[jj] url=url[25:] dap_url = thredds + url + '#fillmismatch' openFile = Dataset(dap_url,'r') for ii in range(len(variables)): dum = openFile.variables[variables[ii].name] variables[ii].data = np.append(variables[ii].data, dum[:].data) tmp = variables[0].data/60/60/24 time_converted = pd.to_datetime(tmp, unit='D', origin=pd.Timestamp('1900-01-01')) return variables, time_converted class var(object): def __init__(self): """A Class that generically holds data with a variable name and the units as attributes""" self.name = '' self.data = np.array([]) self.units = '' def __repr__(self): return_str = "name: " + self.name + '\n' return_str += "units: " + self.units + '\n' return_str += "data: size: " + str(self.data.shape) return return_str class structtype(object): def __init__(self): """ A class that imitates a Matlab structure type """ self._data = [] def __getitem__(self, index): """implement index behavior in the struct""" if index == len(self._data): self._data.append(var()) return self._data[index] def __len__(self): return len(self._data) def M2M_URLs(platform_name,node,instrument_class,method): var_list = structtype() #MOPAK if platform_name == 'CE01ISSM' and node == 'BUOY' and instrument_class == 'MOPAK' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/SBD17/01-MOPAK0000/telemetered/mopak_o_dcl_accel' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'MOPAK' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/SBD11/01-MOPAK0000/telemetered/mopak_o_dcl_accel' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'MOPAK' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/SBD11/01-MOPAK0000/telemetered/mopak_o_dcl_accel' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE06ISSM' and node == 'BUOY' and instrument_class == 'MOPAK' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/SBD17/01-MOPAK0000/telemetered/mopak_o_dcl_accel' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'MOPAK' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/SBD11/01-MOPAK0000/telemetered/mopak_o_dcl_accel' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'MOPAK' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/SBD11/01-MOPAK0000/telemetered/mopak_o_dcl_accel' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE09OSPM' and node == 'BUOY' and instrument_class == 'MOPAK' and method == 'Telemetered': uframe_dataset_name = 'CE09OSPM/SBS01/01-MOPAK0000/telemetered/mopak_o_dcl_accel' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' #METBK elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'METBK1' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/SBD11/06-METBKA000/telemetered/metbk_a_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'sea_surface_temperature' var_list[2].name = 'sea_surface_conductivity' var_list[3].name = 'met_salsurf' var_list[4].name = 'met_windavg_mag_corr_east' var_list[5].name = 'met_windavg_mag_corr_north' var_list[6].name = 'barometric_pressure' var_list[7].name = 'air_temperature' var_list[8].name = 'relative_humidity' var_list[9].name = 'longwave_irradiance' var_list[10].name = 'shortwave_irradiance' var_list[11].name = 'precipitation' var_list[12].name = 'met_heatflx_minute' var_list[13].name = 'met_latnflx_minute' var_list[14].name = 'met_netlirr_minute' var_list[15].name = 'met_sensflx_minute' var_list[16].name = 'eastward_velocity' var_list[17].name = 'northward_velocity' var_list[18].name = 'met_spechum' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[15].data = np.array([]) var_list[16].data = np.array([]) var_list[17].data = np.array([]) var_list[18].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'S/m' var_list[3].units = 'unitless' var_list[4].units = 'm/s' var_list[5].units = 'm/s' var_list[6].units = 'mbar' var_list[7].units = 'degC' var_list[8].units = '#' var_list[9].units = 'W/m' var_list[10].units = 'W/m' var_list[11].units = 'mm' var_list[12].units = 'W/m' var_list[13].units = 'W/m' var_list[14].units = 'W/m' var_list[15].units = 'W/m' var_list[16].units = 'm/s' var_list[17].units = 'm/s' var_list[18].units = 'g/kg' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'METBK1' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/SBD11/06-METBKA000/telemetered/metbk_a_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'sea_surface_temperature' var_list[2].name = 'sea_surface_conductivity' var_list[3].name = 'met_salsurf' var_list[4].name = 'met_windavg_mag_corr_east' var_list[5].name = 'met_windavg_mag_corr_north' var_list[6].name = 'barometric_pressure' var_list[7].name = 'air_temperature' var_list[8].name = 'relative_humidity' var_list[9].name = 'longwave_irradiance' var_list[10].name = 'shortwave_irradiance' var_list[11].name = 'precipitation' var_list[12].name = 'met_heatflx_minute' var_list[13].name = 'met_latnflx_minute' var_list[14].name = 'met_netlirr_minute' var_list[15].name = 'met_sensflx_minute' var_list[16].name = 'eastward_velocity' var_list[17].name = 'northward_velocity' var_list[18].name = 'met_spechum' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[15].data = np.array([]) var_list[16].data = np.array([]) var_list[17].data = np.array([]) var_list[18].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'S/m' var_list[3].units = 'unitless' var_list[4].units = 'm/s' var_list[5].units = 'm/s' var_list[6].units = 'mbar' var_list[7].units = 'degC' var_list[8].units = '#' var_list[9].units = 'W/m' var_list[10].units = 'W/m' var_list[11].units = 'mm' var_list[12].units = 'W/m' var_list[13].units = 'W/m' var_list[14].units = 'W/m' var_list[15].units = 'W/m' var_list[16].units = 'm/s' var_list[17].units = 'm/s' var_list[18].units = 'g/kg' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'METBK1' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/SBD11/06-METBKA000/telemetered/metbk_a_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'sea_surface_temperature' var_list[2].name = 'sea_surface_conductivity' var_list[3].name = 'met_salsurf' var_list[4].name = 'met_windavg_mag_corr_east' var_list[5].name = 'met_windavg_mag_corr_north' var_list[6].name = 'barometric_pressure' var_list[7].name = 'air_temperature' var_list[8].name = 'relative_humidity' var_list[9].name = 'longwave_irradiance' var_list[10].name = 'shortwave_irradiance' var_list[11].name = 'precipitation' var_list[12].name = 'met_heatflx_minute' var_list[13].name = 'met_latnflx_minute' var_list[14].name = 'met_netlirr_minute' var_list[15].name = 'met_sensflx_minute' var_list[16].name = 'eastward_velocity' var_list[17].name = 'northward_velocity' var_list[18].name = 'met_spechum' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[15].data = np.array([]) var_list[16].data = np.array([]) var_list[17].data = np.array([]) var_list[18].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'S/m' var_list[3].units = 'unitless' var_list[4].units = 'm/s' var_list[5].units = 'm/s' var_list[6].units = 'mbar' var_list[7].units = 'degC' var_list[8].units = '#' var_list[9].units = 'W/m' var_list[10].units = 'W/m' var_list[11].units = 'mm' var_list[12].units = 'W/m' var_list[13].units = 'W/m' var_list[14].units = 'W/m' var_list[15].units = 'W/m' var_list[16].units = 'm/s' var_list[17].units = 'm/s' var_list[18].units = 'g/kg' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'METBK1' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/SBD11/06-METBKA000/telemetered/metbk_a_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'sea_surface_temperature' var_list[2].name = 'sea_surface_conductivity' var_list[3].name = 'met_salsurf' var_list[4].name = 'met_windavg_mag_corr_east' var_list[5].name = 'met_windavg_mag_corr_north' var_list[6].name = 'barometric_pressure' var_list[7].name = 'air_temperature' var_list[8].name = 'relative_humidity' var_list[9].name = 'longwave_irradiance' var_list[10].name = 'shortwave_irradiance' var_list[11].name = 'precipitation' var_list[12].name = 'met_heatflx_minute' var_list[13].name = 'met_latnflx_minute' var_list[14].name = 'met_netlirr_minute' var_list[15].name = 'met_sensflx_minute' var_list[16].name = 'eastward_velocity' var_list[17].name = 'northward_velocity' var_list[18].name = 'met_spechum' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[15].data = np.array([]) var_list[16].data = np.array([]) var_list[17].data = np.array([]) var_list[18].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'S/m' var_list[3].units = 'unitless' var_list[4].units = 'm/s' var_list[5].units = 'm/s' var_list[6].units = 'mbar' var_list[7].units = 'degC' var_list[8].units = '#' var_list[9].units = 'W/m' var_list[10].units = 'W/m' var_list[11].units = 'mm' var_list[12].units = 'W/m' var_list[13].units = 'W/m' var_list[14].units = 'W/m' var_list[15].units = 'W/m' var_list[16].units = 'm/s' var_list[17].units = 'm/s' var_list[18].units = 'g/kg' #FLORT elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/RID16/02-FLORTD000/telemetered/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE01ISSM' and node == 'BUOY' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/SBD17/06-FLORTD000/telemetered/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/RID16/02-FLORTD000/telemetered/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE06ISSM' and node == 'BUOY' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/SBD17/06-FLORTD000/telemetered/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/RID27/02-FLORTD000/telemetered/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/RID27/02-FLORTD000/telemetered/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/RID27/02-FLORTD000/telemetered/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/RID27/02-FLORTD000/telemetered/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE09OSPM' and node == 'PROFILER' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE09OSPM/WFP01/04-FLORTK000/telemetered/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' #FDCHP elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'FDCHP' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/SBD12/08-FDCHPA000/telemetered/fdchp_a_dcl_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' #DOSTA elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/RID16/03-DOSTAD000/telemetered/dosta_abcdjm_ctdbp_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'dosta_ln_optode_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/RID27/04-DOSTAD000/telemetered/dosta_abcdjm_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'estimated_oxygen_concentration' var_list[3].name = 'optode_temperature' var_list[4].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'degC' var_list[4].units = 'umol/L' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/RID27/04-DOSTAD000/telemetered/dosta_abcdjm_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'estimated_oxygen_concentration' var_list[3].name = 'optode_temperature' var_list[4].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'degC' var_list[4].units = 'umol/L' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/RID16/03-DOSTAD000/telemetered/dosta_abcdjm_ctdbp_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'dosta_ln_optode_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/RID27/04-DOSTAD000/telemetered/dosta_abcdjm_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'estimated_oxygen_concentration' var_list[3].name = 'optode_temperature' var_list[4].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'degC' var_list[4].units = 'umol/L' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/RID27/04-DOSTAD000/telemetered/dosta_abcdjm_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'estimated_oxygen_concentration' var_list[3].name = 'optode_temperature' var_list[4].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'degC' var_list[4].units = 'umol/L' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/MFD37/03-DOSTAD000/telemetered/dosta_abcdjm_ctdbp_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'dosta_ln_optode_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/MFD37/03-DOSTAD000/telemetered/dosta_abcdjm_ctdbp_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'dosta_ln_optode_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/MFD37/03-DOSTAD000/telemetered/dosta_abcdjm_ctdbp_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'dosta_ln_optode_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/MFD37/03-DOSTAD000/telemetered/dosta_abcdjm_ctdbp_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'dosta_ln_optode_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' elif platform_name == 'CE09OSPM' and node == 'PROFILER' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE09OSPM/WFP01/02-DOFSTK000/telemetered/dofst_k_wfp_instrument' var_list[0].name = 'time' var_list[1].name = 'dofst_k_oxygen_l2' var_list[2].name = 'dofst_k_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'Hz' var_list[3].units = 'dbar' #ADCP elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'ADCP' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/RID26/01-ADCPTA000/telemetered/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'ADCP' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/RID26/01-ADCPTC000/telemetered/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'ADCP' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/RID26/01-ADCPTA000/telemetered/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'ADCP' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/RID26/01-ADCPTC000/telemetered/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'ADCP' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/MFD35/04-ADCPTM000/telemetered/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'ADCP' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/MFD35/04-ADCPTM000/telemetered/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'ADCP' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/MFD35/04-ADCPTC000/telemetered/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'ADCP' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/MFD35/04-ADCPSJ000/telemetered/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' #ZPLSC elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'ZPLSC' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/MFD37/07-ZPLSCC000/telemetered/zplsc_c_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'ZPLSC' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/MFD37/07-ZPLSCC000/telemetered/zplsc_c_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'ZPLSC' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/MFD37/07-ZPLSCC000/telemetered/zplsc_c_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'ZPLSC' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/MFD37/07-ZPLSCC000/telemetered/zplsc_c_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'ZPLSC' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/MFD37/07-ZPLSCC000/recovered_host/zplsc_c_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'ZPLSC' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/MFD37/07-ZPLSCC000/recovered_host/zplsc_c_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'ZPLSC' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/MFD37/07-ZPLSCC000/recovered_host/zplsc_c_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'ZPLSC' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/MFD37/07-ZPLSCC000/recovered_host/zplsc_c_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' #WAVSS elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_Stats' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_statistics' var_list[0].name = 'time' var_list[1].name = 'number_zero_crossings' var_list[2].name = 'average_wave_height' var_list[3].name = 'mean_spectral_period' var_list[4].name = 'max_wave_height' var_list[5].name = 'significant_wave_height' var_list[6].name = 'significant_period' var_list[7].name = 'wave_height_10' var_list[8].name = 'wave_period_10' var_list[9].name = 'mean_wave_period' var_list[10].name = 'peak_wave_period' var_list[11].name = 'wave_period_tp5' var_list[12].name = 'wave_height_hmo' var_list[13].name = 'mean_direction' var_list[14].name = 'mean_spread' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'counts' var_list[2].units = 'm' var_list[3].units = 'sec' var_list[4].units = 'm' var_list[5].units = 'm' var_list[6].units = 'sec' var_list[7].units = 'm' var_list[8].units = 'sec' var_list[9].units = 'sec' var_list[10].units = 'sec' var_list[11].units = 'sec' var_list[12].units = 'm' var_list[13].units = 'degrees' var_list[14].units = 'degrees' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_Stats' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_statistics' var_list[0].name = 'time' var_list[1].name = 'number_zero_crossings' var_list[2].name = 'average_wave_height' var_list[3].name = 'mean_spectral_period' var_list[4].name = 'max_wave_height' var_list[5].name = 'significant_wave_height' var_list[6].name = 'significant_period' var_list[7].name = 'wave_height_10' var_list[8].name = 'wave_period_10' var_list[9].name = 'mean_wave_period' var_list[10].name = 'peak_wave_period' var_list[11].name = 'wave_period_tp5' var_list[12].name = 'wave_height_hmo' var_list[13].name = 'mean_direction' var_list[14].name = 'mean_spread' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'counts' var_list[2].units = 'm' var_list[3].units = 'sec' var_list[4].units = 'm' var_list[5].units = 'm' var_list[6].units = 'sec' var_list[7].units = 'm' var_list[8].units = 'sec' var_list[9].units = 'sec' var_list[10].units = 'sec' var_list[11].units = 'sec' var_list[12].units = 'm' var_list[13].units = 'degrees' var_list[14].units = 'degrees' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_Stats' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_statistics' var_list[0].name = 'time' var_list[1].name = 'number_zero_crossings' var_list[2].name = 'average_wave_height' var_list[3].name = 'mean_spectral_period' var_list[4].name = 'max_wave_height' var_list[5].name = 'significant_wave_height' var_list[6].name = 'significant_period' var_list[7].name = 'wave_height_10' var_list[8].name = 'wave_period_10' var_list[9].name = 'mean_wave_period' var_list[10].name = 'peak_wave_period' var_list[11].name = 'wave_period_tp5' var_list[12].name = 'wave_height_hmo' var_list[13].name = 'mean_direction' var_list[14].name = 'mean_spread' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'counts' var_list[2].units = 'm' var_list[3].units = 'sec' var_list[4].units = 'm' var_list[5].units = 'm' var_list[6].units = 'sec' var_list[7].units = 'm' var_list[8].units = 'sec' var_list[9].units = 'sec' var_list[10].units = 'sec' var_list[11].units = 'sec' var_list[12].units = 'm' var_list[13].units = 'degrees' var_list[14].units = 'degrees' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_Stats' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_statistics' var_list[0].name = 'time' var_list[1].name = 'number_zero_crossings' var_list[2].name = 'average_wave_height' var_list[3].name = 'mean_spectral_period' var_list[4].name = 'max_wave_height' var_list[5].name = 'significant_wave_height' var_list[6].name = 'significant_period' var_list[7].name = 'wave_height_10' var_list[8].name = 'wave_period_10' var_list[9].name = 'mean_wave_period' var_list[10].name = 'peak_wave_period' var_list[11].name = 'wave_period_tp5' var_list[12].name = 'wave_height_hmo' var_list[13].name = 'mean_direction' var_list[14].name = 'mean_spread' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'counts' var_list[2].units = 'm' var_list[3].units = 'sec' var_list[4].units = 'm' var_list[5].units = 'm' var_list[6].units = 'sec' var_list[7].units = 'm' var_list[8].units = 'sec' var_list[9].units = 'sec' var_list[10].units = 'sec' var_list[11].units = 'sec' var_list[12].units = 'm' var_list[13].units = 'degrees' var_list[14].units = 'degrees' #VELPT elif platform_name == 'CE01ISSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/SBD17/04-VELPTA000/telemetered/velpt_ab_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/SBD11/04-VELPTA000/telemetered/velpt_ab_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/SBD11/04-VELPTA000/telemetered/velpt_ab_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE06ISSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/SBD17/04-VELPTA000/telemetered/velpt_ab_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/SBD11/04-VELPTA000/telemetered/velpt_ab_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/SBD11/04-VELPTA000/telemetered/velpt_ab_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/RID16/04-VELPTA000/telemetered/velpt_ab_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/RID26/04-VELPTA000/telemetered/velpt_ab_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/RID26/04-VELPTA000/telemetered/velpt_ab_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/RID16/04-VELPTA000/telemetered/velpt_ab_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/RID26/04-VELPTA000/telemetered/velpt_ab_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/RID26/04-VELPTA000/telemetered/velpt_ab_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' #PCO2W elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'PCO2W' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/RID16/05-PCO2WB000/telemetered/pco2w_abc_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'PCO2W' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/MFD35/05-PCO2WB000/telemetered/pco2w_abc_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'PCO2W' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/RID16/05-PCO2WB000/telemetered/pco2w_abc_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'PCO2W' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/MFD35/05-PCO2WB000/telemetered/pco2w_abc_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'PCO2W' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/MFD35/05-PCO2WB000/telemetered/pco2w_abc_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'PCO2W' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/MFD35/05-PCO2WB000/telemetered/pco2w_abc_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' #PHSEN elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/RID16/06-PHSEND000/telemetered/phsen_abcdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/RID26/06-PHSEND000/telemetered/phsen_abcdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/RID26/06-PHSEND000/telemetered/phsen_abcdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/RID16/06-PHSEND000/telemetered/phsen_abcdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/RID26/06-PHSEND000/telemetered/phsen_abcdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/RID26/06-PHSEND000/telemetered/phsen_abcdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'PHSEN' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/MFD35/06-PHSEND000/telemetered/phsen_abcdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'PHSEN' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/MFD35/06-PHSEND000/telemetered/phsen_abcdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'PHSEN' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/MFD35/06-PHSEND000/telemetered/phsen_abcdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'PHSEN' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/MFD35/06-PHSEND000/telemetered/phsen_abcdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' #SPKIR elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'SPKIR' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/RID16/08-SPKIRB000/telemetered/spkir_abj_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'SPKIR' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/RID26/08-SPKIRB000/telemetered/spkir_abj_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'SPKIR' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/RID26/08-SPKIRB000/telemetered/spkir_abj_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'SPKIR' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/RID16/08-SPKIRB000/telemetered/spkir_abj_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'SPKIR' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/RID26/08-SPKIRB000/telemetered/spkir_abj_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'SPKIR' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/RID26/08-SPKIRB000/telemetered/spkir_abj_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' #PRESF elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'PRESF' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/MFD35/02-PRESFA000/telemetered/presf_abc_dcl_tide_measurement' var_list[0].name = 'time' var_list[1].name = 'abs_seafloor_pressure' var_list[2].name = 'seawater_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'dbar' var_list[2].units = 'degC' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'PRESF' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/MFD35/02-PRESFA000/telemetered/presf_abc_dcl_tide_measurement' var_list[0].name = 'time' var_list[1].name = 'abs_seafloor_pressure' var_list[2].name = 'seawater_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'dbar' var_list[2].units = 'degC' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'PRESF' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/MFD35/02-PRESFB000/telemetered/presf_abc_dcl_tide_measurement' var_list[0].name = 'time' var_list[1].name = 'abs_seafloor_pressure' var_list[2].name = 'seawater_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'dbar' var_list[2].units = 'degC' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'PRESF' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/MFD35/02-PRESFC000/telemetered/presf_abc_dcl_tide_measurement' var_list[0].name = 'time' var_list[1].name = 'abs_seafloor_pressure' var_list[2].name = 'seawater_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'dbar' var_list[2].units = 'degC' #CTDBP elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/RID16/03-CTDBPC000/telemetered/ctdbp_cdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/MFD37/03-CTDBPC000/telemetered/ctdbp_cdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE01ISSM' and node == 'BUOY' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/SBD17/06-CTDBPC000/telemetered/ctdbp_cdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/RID16/03-CTDBPC000/telemetered/ctdbp_cdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/MFD37/03-CTDBPC000/telemetered/ctdbp_cdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE06ISSM' and node == 'BUOY' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/SBD17/06-CTDBPC000/telemetered/ctdbp_cdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/RID27/03-CTDBPC000/telemetered/ctdbp_cdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/RID27/03-CTDBPC000/telemetered/ctdbp_cdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/RID27/03-CTDBPC000/telemetered/ctdbp_cdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/RID27/03-CTDBPC000/telemetered/ctdbp_cdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/MFD37/03-CTDBPC000/telemetered/ctdbp_cdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/MFD37/03-CTDBPE000/telemetered/ctdbp_cdef_dcl_instrument' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' #VEL3D elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'VEL3D' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/MFD35/01-VEL3DD000/telemetered/vel3d_cd_dcl_velocity_data' var_list[0].name = 'time' var_list[1].name = 'vel3d_c_eastward_turbulent_velocity' var_list[2].name = 'vel3d_c_northward_turbulent_velocity' var_list[3].name = 'vel3d_c_upward_turbulent_velocity' var_list[4].name = 'seawater_pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = '0.001dbar' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'VEL3D' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/MFD35/01-VEL3DD000/telemetered/vel3d_cd_dcl_velocity_data' var_list[0].name = 'time' var_list[1].name = 'vel3d_c_eastward_turbulent_velocity' var_list[2].name = 'vel3d_c_northward_turbulent_velocity' var_list[3].name = 'vel3d_c_upward_turbulent_velocity' var_list[4].name = 'seawater_pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = '0.001dbar' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'VEL3D' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/MFD35/01-VEL3DD000/telemetered/vel3d_cd_dcl_velocity_data' var_list[0].name = 'time' var_list[1].name = 'vel3d_c_eastward_turbulent_velocity' var_list[2].name = 'vel3d_c_northward_turbulent_velocity' var_list[3].name = 'vel3d_c_upward_turbulent_velocity' var_list[4].name = 'seawater_pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = '0.001dbar' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'VEL3D' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/MFD35/01-VEL3DD000/telemetered/vel3d_cd_dcl_velocity_data' var_list[0].name = 'time' var_list[1].name = 'vel3d_c_eastward_turbulent_velocity' var_list[2].name = 'vel3d_c_northward_turbulent_velocity' var_list[3].name = 'vel3d_c_upward_turbulent_velocity' var_list[4].name = 'seawater_pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = '0.001dbar' #VEL3DK elif platform_name == 'CE09OSPM' and node == 'PROFILER' and instrument_class == 'VEL3D' and method == 'Telemetered': uframe_dataset_name = 'CE09OSPM/WFP01/01-VEL3DK000/telemetered/vel3d_k_wfp_stc_instrument' var_list[0].name = 'time' var_list[1].name = 'vel3d_k_eastward_velocity' var_list[2].name = 'vel3d_k_northward_velocity' var_list[3].name = 'vel3d_k_upward_velocity' var_list[4].name = 'vel3d_k_heading' var_list[5].name = 'vel3d_k_pitch' var_list[6].name = 'vel3d_k_roll' var_list[7].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'ddegrees' var_list[5].units = 'ddegrees' var_list[6].units = 'ddegrees' var_list[7].units = 'dbar' elif platform_name == 'CE09OSPM' and node == 'PROFILER' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE09OSPM/WFP01/03-CTDPFK000/telemetered/ctdpf_ckl_wfp_instrument' var_list[0].name = 'time' var_list[1].name = 'ctdpf_ckl_seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'ctdpf_ckl_seawater_pressure' var_list[5].name = 'ctdpf_ckl_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' #PCO2A elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'PCO2A' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/SBD12/04-PCO2AA000/telemetered/pco2a_a_dcl_instrument_water' var_list[0].name = 'time' var_list[1].name = 'partial_pressure_co2_ssw' var_list[2].name = 'partial_pressure_co2_atm' var_list[3].name = 'pco2_co2flux' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uatm' var_list[2].units = 'uatm' var_list[3].units = 'mol m-2 s-1' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'PCO2A' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/SBD12/04-PCO2AA000/telemetered/pco2a_a_dcl_instrument_water' var_list[0].name = 'time' var_list[1].name = 'partial_pressure_co2_ssw' var_list[2].name = 'partial_pressure_co2_atm' var_list[3].name = 'pco2_co2flux' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uatm' var_list[2].units = 'uatm' var_list[3].units = 'mol m-2 s-1' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'PCO2A' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/SBD12/04-PCO2AA000/telemetered/pco2a_a_dcl_instrument_water' var_list[0].name = 'time' var_list[1].name = 'partial_pressure_co2_ssw' var_list[2].name = 'partial_pressure_co2_atm' var_list[3].name = 'pco2_co2flux' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uatm' var_list[2].units = 'uatm' var_list[3].units = 'mol m-2 s-1' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'PCO2A' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/SBD12/04-PCO2AA000/telemetered/pco2a_a_dcl_instrument_water' var_list[0].name = 'time' var_list[1].name = 'partial_pressure_co2_ssw' var_list[2].name = 'partial_pressure_co2_atm' var_list[3].name = 'pco2_co2flux' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uatm' var_list[2].units = 'uatm' var_list[3].units = 'mol m-2 s-1' #PARAD elif platform_name == 'CE09OSPM' and node == 'PROFILER' and instrument_class == 'PARAD' and method == 'Telemetered': uframe_dataset_name = 'CE09OSPM/WFP01/05-PARADK000/telemetered/parad_k__stc_imodem_instrument' var_list[0].name = 'time' var_list[1].name = 'parad_k_par' var_list[2].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' #OPTAA elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'OPTAA' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/RID16/01-OPTAAD000/telemetered/optaa_dj_dcl_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'OPTAA' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/RID27/01-OPTAAD000/telemetered/optaa_dj_dcl_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'OPTAA' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/RID27/01-OPTAAD000/telemetered/optaa_dj_dcl_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'OPTAA' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/RID16/01-OPTAAD000/telemetered/optaa_dj_dcl_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'OPTAA' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/RID27/01-OPTAAD000/telemetered/optaa_dj_dcl_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'OPTAA' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/RID27/01-OPTAAD000/telemetered/optaa_dj_dcl_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'OPTAA' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/MFD37/01-OPTAAD000/telemetered/optaa_dj_dcl_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'OPTAA' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/MFD37/01-OPTAAD000/telemetered/optaa_dj_dcl_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'OPTAA' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/MFD37/01-OPTAAD000/telemetered/optaa_dj_dcl_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'OPTAA' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/MFD37/01-OPTAAC000/telemetered/optaa_dj_dcl_instrument' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' #NUTNR elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSM/RID16/07-NUTNRB000/telemetered/suna_dcl_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/RID26/07-NUTNRB000/telemetered/suna_dcl_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/RID26/07-NUTNRB000/telemetered/suna_dcl_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSM/RID16/07-NUTNRB000/telemetered/suna_dcl_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/RID26/07-NUTNRB000/telemetered/suna_dcl_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/RID26/07-NUTNRB000/telemetered/suna_dcl_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' ## #MOPAK elif platform_name == 'CE01ISSM' and node == 'BUOY' and instrument_class == 'MOPAK' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/SBD17/01-MOPAK0000/recovered_host/mopak_o_dcl_accel_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'MOPAK' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/SBD11/01-MOPAK0000/recovered_host/mopak_o_dcl_accel_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'MOPAK' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/SBD11/01-MOPAK0000/recovered_host/mopak_o_dcl_accel_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE06ISSM' and node == 'BUOY' and instrument_class == 'MOPAK' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/SBD17/01-MOPAK0000/recovered_host/mopak_o_dcl_accel_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'MOPAK' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/SBD11/01-MOPAK0000/recovered_host/mopak_o_dcl_accel_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'MOPAK' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/SBD11/01-MOPAK0000/recovered_host/mopak_o_dcl_accel_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE09OSPM' and node == 'BUOY' and instrument_class == 'MOPAK' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSPM/SBS01/01-MOPAK0000/recovered_host/mopak_o_dcl_accel_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' #METBK elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'METBK1' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/SBD11/06-METBKA000/recovered_host/metbk_a_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'sea_surface_temperature' var_list[2].name = 'sea_surface_conductivity' var_list[3].name = 'met_salsurf' var_list[4].name = 'met_windavg_mag_corr_east' var_list[5].name = 'met_windavg_mag_corr_north' var_list[6].name = 'barometric_pressure' var_list[7].name = 'air_temperature' var_list[8].name = 'relative_humidity' var_list[9].name = 'longwave_irradiance' var_list[10].name = 'shortwave_irradiance' var_list[11].name = 'precipitation' var_list[12].name = 'met_heatflx_minute' var_list[13].name = 'met_latnflx_minute' var_list[14].name = 'met_netlirr_minute' var_list[15].name = 'met_sensflx_minute' var_list[16].name = 'eastward_velocity' var_list[17].name = 'northward_velocity' var_list[18].name = 'met_spechum' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[15].data = np.array([]) var_list[16].data = np.array([]) var_list[17].data = np.array([]) var_list[18].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'S/m' var_list[3].units = 'unitless' var_list[4].units = 'm/s' var_list[5].units = 'm/s' var_list[6].units = 'mbar' var_list[7].units = 'degC' var_list[8].units = '#' var_list[9].units = 'W/m' var_list[10].units = 'W/m' var_list[11].units = 'mm' var_list[12].units = 'W/m' var_list[13].units = 'W/m' var_list[14].units = 'W/m' var_list[15].units = 'W/m' var_list[16].units = 'm/s' var_list[17].units = 'm/s' var_list[18].units = 'g/kg' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'METBK1' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/SBD11/06-METBKA000/recovered_host/metbk_a_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'sea_surface_temperature' var_list[2].name = 'sea_surface_conductivity' var_list[3].name = 'met_salsurf' var_list[4].name = 'met_windavg_mag_corr_east' var_list[5].name = 'met_windavg_mag_corr_north' var_list[6].name = 'barometric_pressure' var_list[7].name = 'air_temperature' var_list[8].name = 'relative_humidity' var_list[9].name = 'longwave_irradiance' var_list[10].name = 'shortwave_irradiance' var_list[11].name = 'precipitation' var_list[12].name = 'met_heatflx_minute' var_list[13].name = 'met_latnflx_minute' var_list[14].name = 'met_netlirr_minute' var_list[15].name = 'met_sensflx_minute' var_list[16].name = 'eastward_velocity' var_list[17].name = 'northward_velocity' var_list[18].name = 'met_spechum' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[15].data = np.array([]) var_list[16].data = np.array([]) var_list[17].data = np.array([]) var_list[18].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'S/m' var_list[3].units = 'unitless' var_list[4].units = 'm/s' var_list[5].units = 'm/s' var_list[6].units = 'mbar' var_list[7].units = 'degC' var_list[8].units = '#' var_list[9].units = 'W/m' var_list[10].units = 'W/m' var_list[11].units = 'mm' var_list[12].units = 'W/m' var_list[13].units = 'W/m' var_list[14].units = 'W/m' var_list[15].units = 'W/m' var_list[16].units = 'm/s' var_list[17].units = 'm/s' var_list[18].units = 'g/kg' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'METBK1' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/SBD11/06-METBKA000/recovered_host/metbk_a_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'sea_surface_temperature' var_list[2].name = 'sea_surface_conductivity' var_list[3].name = 'met_salsurf' var_list[4].name = 'met_windavg_mag_corr_east' var_list[5].name = 'met_windavg_mag_corr_north' var_list[6].name = 'barometric_pressure' var_list[7].name = 'air_temperature' var_list[8].name = 'relative_humidity' var_list[9].name = 'longwave_irradiance' var_list[10].name = 'shortwave_irradiance' var_list[11].name = 'precipitation' var_list[12].name = 'met_heatflx_minute' var_list[13].name = 'met_latnflx_minute' var_list[14].name = 'met_netlirr_minute' var_list[15].name = 'met_sensflx_minute' var_list[16].name = 'eastward_velocity' var_list[17].name = 'northward_velocity' var_list[18].name = 'met_spechum' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[15].data = np.array([]) var_list[16].data = np.array([]) var_list[17].data = np.array([]) var_list[18].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'S/m' var_list[3].units = 'unitless' var_list[4].units = 'm/s' var_list[5].units = 'm/s' var_list[6].units = 'mbar' var_list[7].units = 'degC' var_list[8].units = '#' var_list[9].units = 'W/m' var_list[10].units = 'W/m' var_list[11].units = 'mm' var_list[12].units = 'W/m' var_list[13].units = 'W/m' var_list[14].units = 'W/m' var_list[15].units = 'W/m' var_list[16].units = 'm/s' var_list[17].units = 'm/s' var_list[18].units = 'g/kg' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'METBK1' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/SBD11/06-METBKA000/recovered_host/metbk_a_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'sea_surface_temperature' var_list[2].name = 'sea_surface_conductivity' var_list[3].name = 'met_salsurf' var_list[4].name = 'met_windavg_mag_corr_east' var_list[5].name = 'met_windavg_mag_corr_north' var_list[6].name = 'barometric_pressure' var_list[7].name = 'air_temperature' var_list[8].name = 'relative_humidity' var_list[9].name = 'longwave_irradiance' var_list[10].name = 'shortwave_irradiance' var_list[11].name = 'precipitation' var_list[12].name = 'met_heatflx_minute' var_list[13].name = 'met_latnflx_minute' var_list[14].name = 'met_netlirr_minute' var_list[15].name = 'met_sensflx_minute' var_list[16].name = 'eastward_velocity' var_list[17].name = 'northward_velocity' var_list[18].name = 'met_spechum' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[15].data = np.array([]) var_list[16].data = np.array([]) var_list[17].data = np.array([]) var_list[18].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'S/m' var_list[3].units = 'unitless' var_list[4].units = 'm/s' var_list[5].units = 'm/s' var_list[6].units = 'mbar' var_list[7].units = 'degC' var_list[8].units = '#' var_list[9].units = 'W/m' var_list[10].units = 'W/m' var_list[11].units = 'mm' var_list[12].units = 'W/m' var_list[13].units = 'W/m' var_list[14].units = 'W/m' var_list[15].units = 'W/m' var_list[16].units = 'm/s' var_list[17].units = 'm/s' var_list[18].units = 'g/kg' #FLORT elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/RID16/02-FLORTD000/recovered_host/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE01ISSM' and node == 'BUOY' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/SBD17/06-FLORTD000/recovered_host/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/RID16/02-FLORTD000/recovered_host/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE06ISSM' and node == 'BUOY' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/SBD17/06-FLORTD000/recovered_host/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/RID27/02-FLORTD000/recovered_host/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/RID27/02-FLORTD000/recovered_host/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/RID27/02-FLORTD000/recovered_host/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/RID27/02-FLORTD000/recovered_host/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' #FDCHP elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'FDCHP' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/SBD12/08-FDCHPA000/recovered_host/fdchp_a_dcl_instrument_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' #DOSTA elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/RID16/03-DOSTAD000/recovered_host/dosta_abcdjm_ctdbp_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'estimated_oxygen_concentration' var_list[3].name = 'optode_temperature' var_list[4].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'degC' var_list[4].units = 'umol/L' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/RID27/04-DOSTAD000/recovered_host/dosta_abcdjm_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'estimated_oxygen_concentration' var_list[3].name = 'optode_temperature' var_list[4].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'degC' var_list[4].units = 'umol/L' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/RID27/04-DOSTAD000/recovered_host/dosta_abcdjm_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'estimated_oxygen_concentration' var_list[3].name = 'optode_temperature' var_list[4].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'degC' var_list[4].units = 'umol/L' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/RID16/03-DOSTAD000/recovered_host/dosta_abcdjm_ctdbp_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'estimated_oxygen_concentration' var_list[3].name = 'optode_temperature' var_list[4].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'degC' var_list[4].units = 'umol/L' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/RID27/04-DOSTAD000/recovered_host/dosta_abcdjm_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'estimated_oxygen_concentration' var_list[3].name = 'optode_temperature' var_list[4].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'degC' var_list[4].units = 'umol/L' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/RID27/04-DOSTAD000/recovered_host/dosta_abcdjm_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'estimated_oxygen_concentration' var_list[3].name = 'optode_temperature' var_list[4].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'degC' var_list[4].units = 'umol/L' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/MFD37/03-DOSTAD000/recovered_host/dosta_abcdjm_ctdbp_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'dosta_ln_optode_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/MFD37/03-DOSTAD000/recovered_host/dosta_abcdjm_ctdbp_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'dosta_ln_optode_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/MFD37/03-DOSTAD000/recovered_host/dosta_abcdjm_ctdbp_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'dosta_ln_optode_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/MFD37/03-DOSTAD000/recovered_host/dosta_abcdjm_ctdbp_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'dosta_ln_optode_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' #ADCP elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/RID26/01-ADCPTA000/recovered_host/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/RID26/01-ADCPTC000/recovered_host/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/RID26/01-ADCPTA000/recovered_host/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/RID26/01-ADCPTC000/recovered_host/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/MFD35/04-ADCPTM000/recovered_host/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/MFD35/04-ADCPTM000/recovered_host/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/MFD35/04-ADCPTC000/recovered_host/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/MFD35/04-ADCPSJ000/recovered_host/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' #WAVSS elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_Stats' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_statistics_recovered' var_list[0].name = 'time' var_list[1].name = 'number_zero_crossings' var_list[2].name = 'average_wave_height' var_list[3].name = 'mean_spectral_period' var_list[4].name = 'max_wave_height' var_list[5].name = 'significant_wave_height' var_list[6].name = 'significant_period' var_list[7].name = 'wave_height_10' var_list[8].name = 'wave_period_10' var_list[9].name = 'mean_wave_period' var_list[10].name = 'peak_wave_period' var_list[11].name = 'wave_period_tp5' var_list[12].name = 'wave_height_hmo' var_list[13].name = 'mean_direction' var_list[14].name = 'mean_spread' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'counts' var_list[2].units = 'm' var_list[3].units = 'sec' var_list[4].units = 'm' var_list[5].units = 'm' var_list[6].units = 'sec' var_list[7].units = 'm' var_list[8].units = 'sec' var_list[9].units = 'sec' var_list[10].units = 'sec' var_list[11].units = 'sec' var_list[12].units = 'm' var_list[13].units = 'degrees' var_list[14].units = 'degrees' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_Stats' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_statistics_recovered' var_list[0].name = 'time' var_list[1].name = 'number_zero_crossings' var_list[2].name = 'average_wave_height' var_list[3].name = 'mean_spectral_period' var_list[4].name = 'max_wave_height' var_list[5].name = 'significant_wave_height' var_list[6].name = 'significant_period' var_list[7].name = 'wave_height_10' var_list[8].name = 'wave_period_10' var_list[9].name = 'mean_wave_period' var_list[10].name = 'peak_wave_period' var_list[11].name = 'wave_period_tp5' var_list[12].name = 'wave_height_hmo' var_list[13].name = 'mean_direction' var_list[14].name = 'mean_spread' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'counts' var_list[2].units = 'm' var_list[3].units = 'sec' var_list[4].units = 'm' var_list[5].units = 'm' var_list[6].units = 'sec' var_list[7].units = 'm' var_list[8].units = 'sec' var_list[9].units = 'sec' var_list[10].units = 'sec' var_list[11].units = 'sec' var_list[12].units = 'm' var_list[13].units = 'degrees' var_list[14].units = 'degrees' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_Stats' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_statistics_recovered' var_list[0].name = 'time' var_list[1].name = 'number_zero_crossings' var_list[2].name = 'average_wave_height' var_list[3].name = 'mean_spectral_period' var_list[4].name = 'max_wave_height' var_list[5].name = 'significant_wave_height' var_list[6].name = 'significant_period' var_list[7].name = 'wave_height_10' var_list[8].name = 'wave_period_10' var_list[9].name = 'mean_wave_period' var_list[10].name = 'peak_wave_period' var_list[11].name = 'wave_period_tp5' var_list[12].name = 'wave_height_hmo' var_list[13].name = 'mean_direction' var_list[14].name = 'mean_spread' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'counts' var_list[2].units = 'm' var_list[3].units = 'sec' var_list[4].units = 'm' var_list[5].units = 'm' var_list[6].units = 'sec' var_list[7].units = 'm' var_list[8].units = 'sec' var_list[9].units = 'sec' var_list[10].units = 'sec' var_list[11].units = 'sec' var_list[12].units = 'm' var_list[13].units = 'degrees' var_list[14].units = 'degrees' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_Stats' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_statistics_recovered' var_list[0].name = 'time' var_list[1].name = 'number_zero_crossings' var_list[2].name = 'average_wave_height' var_list[3].name = 'mean_spectral_period' var_list[4].name = 'max_wave_height' var_list[5].name = 'significant_wave_height' var_list[6].name = 'significant_period' var_list[7].name = 'wave_height_10' var_list[8].name = 'wave_period_10' var_list[9].name = 'mean_wave_period' var_list[10].name = 'peak_wave_period' var_list[11].name = 'wave_period_tp5' var_list[12].name = 'wave_height_hmo' var_list[13].name = 'mean_direction' var_list[14].name = 'mean_spread' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'counts' var_list[2].units = 'm' var_list[3].units = 'sec' var_list[4].units = 'm' var_list[5].units = 'm' var_list[6].units = 'sec' var_list[7].units = 'm' var_list[8].units = 'sec' var_list[9].units = 'sec' var_list[10].units = 'sec' var_list[11].units = 'sec' var_list[12].units = 'm' var_list[13].units = 'degrees' var_list[14].units = 'degrees' #VELPT elif platform_name == 'CE01ISSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/SBD17/04-VELPTA000/recovered_host/velpt_ab_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/SBD11/04-VELPTA000/recovered_host/velpt_ab_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/SBD11/04-VELPTA000/recovered_host/velpt_ab_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE06ISSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'RecoveredHost': #uframe_dataset_name = 'CE06ISSM/RID16/04-VELPTA000/recovered_host/velpt_ab_dcl_instrument_recovered' uframe_dataset_name = 'CE06ISSM/RID16/04-VELPTA000/recovered_host/velpt_ab_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/SBD11/04-VELPTA000/recovered_host/velpt_ab_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/SBD11/04-VELPTA000/recovered_host/velpt_ab_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/RID16/04-VELPTA000/recovered_host/velpt_ab_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/RID26/04-VELPTA000/recovered_host/velpt_ab_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/RID26/04-VELPTA000/recovered_host/velpt_ab_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/RID16/04-VELPTA000/recovered_host/velpt_ab_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/RID26/04-VELPTA000/recovered_host/velpt_ab_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/RID26/04-VELPTA000/recovered_host/velpt_ab_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' #PCO2W elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'PCO2W' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/RID16/05-PCO2WB000/recovered_host/pco2w_abc_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'PCO2W' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/MFD35/05-PCO2WB000/recovered_host/pco2w_abc_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'PCO2W' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/RID16/05-PCO2WB000/recovered_host/pco2w_abc_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'PCO2W' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/MFD35/05-PCO2WB000/recovered_host/pco2w_abc_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'PCO2W' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/MFD35/05-PCO2WB000/recovered_host/pco2w_abc_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'PCO2W' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/MFD35/05-PCO2WB000/recovered_host/pco2w_abc_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' #PHSEN elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/RID16/06-PHSEND000/recovered_host/phsen_abcdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/RID26/06-PHSEND000/recovered_host/phsen_abcdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/RID26/06-PHSEND000/recovered_host/phsen_abcdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/RID16/06-PHSEND000/recovered_host/phsen_abcdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/RID26/06-PHSEND000/recovered_host/phsen_abcdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/RID26/06-PHSEND000/recovered_host/phsen_abcdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'PHSEN' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/MFD35/06-PHSEND000/recovered_host/phsen_abcdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'PHSEN' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/MFD35/06-PHSEND000/recovered_host/phsen_abcdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'PHSEN' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/MFD35/06-PHSEND000/recovered_host/phsen_abcdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'PHSEN' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/MFD35/06-PHSEND000/recovered_host/phsen_abcdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' #SPKIR elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'SPKIR' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/RID16/08-SPKIRB000/recovered_host/spkir_abj_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'SPKIR' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/RID26/08-SPKIRB000/recovered_host/spkir_abj_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'SPKIR' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/RID26/08-SPKIRB000/recovered_host/spkir_abj_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'SPKIR' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/RID16/08-SPKIRB000/recovered_host/spkir_abj_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'SPKIR' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/RID26/08-SPKIRB000/recovered_host/spkir_abj_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'SPKIR' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/RID26/08-SPKIRB000/recovered_host/spkir_abj_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' #PRESF elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'PRESF' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/MFD35/02-PRESFA000/recovered_host/presf_abc_dcl_tide_measurement_recovered' var_list[0].name = 'time' var_list[1].name = 'abs_seafloor_pressure' var_list[2].name = 'seawater_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'dbar' var_list[2].units = 'degC' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'PRESF' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/MFD35/02-PRESFA000/recovered_host/presf_abc_dcl_tide_measurement_recovered' var_list[0].name = 'time' var_list[1].name = 'abs_seafloor_pressure' var_list[2].name = 'seawater_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'dbar' var_list[2].units = 'degC' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'PRESF' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/MFD35/02-PRESFB000/recovered_host/presf_abc_dcl_tide_measurement_recovered' var_list[0].name = 'time' var_list[1].name = 'abs_seafloor_pressure' var_list[2].name = 'seawater_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'dbar' var_list[2].units = 'degC' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'PRESF' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/MFD35/02-PRESFC000/recovered_host/presf_abc_dcl_tide_measurement_recovered' var_list[0].name = 'time' var_list[1].name = 'abs_seafloor_pressure' var_list[2].name = 'seawater_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'dbar' var_list[2].units = 'degC' #CTDBP elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/RID16/03-CTDBPC000/recovered_host/ctdbp_cdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/MFD37/03-CTDBPC000/recovered_host/ctdbp_cdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE01ISSM' and node == 'BUOY' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/SBD17/06-CTDBPC000/recovered_host/ctdbp_cdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/RID16/03-CTDBPC000/recovered_host/ctdbp_cdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/MFD37/03-CTDBPC000/recovered_host/ctdbp_cdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE06ISSM' and node == 'BUOY' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/SBD17/06-CTDBPC000/recovered_host/ctdbp_cdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/RID27/03-CTDBPC000/recovered_host/ctdbp_cdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/RID27/03-CTDBPC000/recovered_host/ctdbp_cdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/RID27/03-CTDBPC000/recovered_host/ctdbp_cdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/RID27/03-CTDBPC000/recovered_host/ctdbp_cdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/MFD37/03-CTDBPC000/recovered_host/ctdbp_cdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/MFD37/03-CTDBPE000/recovered_host/ctdbp_cdef_dcl_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' #VEL3D elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'VEL3D' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/MFD35/01-VEL3DD000/recovered_host/vel3d_cd_dcl_velocity_data_recovered' var_list[0].name = 'time' var_list[1].name = 'vel3d_c_eastward_turbulent_velocity' var_list[2].name = 'vel3d_c_northward_turbulent_velocity' var_list[3].name = 'vel3d_c_upward_turbulent_velocity' var_list[4].name = 'seawater_pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = '0.001dbar' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'VEL3D' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/MFD35/01-VEL3DD000/recovered_host/vel3d_cd_dcl_velocity_data_recovered' var_list[0].name = 'time' var_list[1].name = 'vel3d_c_eastward_turbulent_velocity' var_list[2].name = 'vel3d_c_northward_turbulent_velocity' var_list[3].name = 'vel3d_c_upward_turbulent_velocity' var_list[4].name = 'seawater_pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = '0.001dbar' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'VEL3D' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/MFD35/01-VEL3DD000/recovered_host/vel3d_cd_dcl_velocity_data_recovered' var_list[0].name = 'time' var_list[1].name = 'vel3d_c_eastward_turbulent_velocity' var_list[2].name = 'vel3d_c_northward_turbulent_velocity' var_list[3].name = 'vel3d_c_upward_turbulent_velocity' var_list[4].name = 'seawater_pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = '0.001dbar' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'VEL3D' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/MFD35/01-VEL3DD000/recovered_host/vel3d_cd_dcl_velocity_data_recovered' var_list[0].name = 'time' var_list[1].name = 'vel3d_c_eastward_turbulent_velocity' var_list[2].name = 'vel3d_c_northward_turbulent_velocity' var_list[3].name = 'vel3d_c_upward_turbulent_velocity' var_list[4].name = 'seawater_pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = '0.001dbar' #PCO2A elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'PCO2A' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/SBD12/04-PCO2AA000/recovered_host/pco2a_a_dcl_instrument_water_recovered' var_list[0].name = 'time' var_list[1].name = 'partial_pressure_co2_ssw' var_list[2].name = 'partial_pressure_co2_atm' var_list[3].name = 'pco2_co2flux' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uatm' var_list[2].units = 'uatm' var_list[3].units = 'mol m-2 s-1' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'PCO2A' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/SBD12/04-PCO2AA000/recovered_host/pco2a_a_dcl_instrument_water_recovered' var_list[0].name = 'time' var_list[1].name = 'partial_pressure_co2_ssw' var_list[2].name = 'partial_pressure_co2_atm' var_list[3].name = 'pco2_co2flux' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uatm' var_list[2].units = 'uatm' var_list[3].units = 'mol m-2 s-1' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'PCO2A' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/SBD12/04-PCO2AA000/recovered_host/pco2a_a_dcl_instrument_water_recovered' var_list[0].name = 'time' var_list[1].name = 'partial_pressure_co2_ssw' var_list[2].name = 'partial_pressure_co2_atm' var_list[3].name = 'pco2_co2flux' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uatm' var_list[2].units = 'uatm' var_list[3].units = 'mol m-2 s-1' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'PCO2A' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/SBD12/04-PCO2AA000/recovered_host/pco2a_a_dcl_instrument_water_recovered' var_list[0].name = 'time' var_list[1].name = 'partial_pressure_co2_ssw' var_list[2].name = 'partial_pressure_co2_atm' var_list[3].name = 'pco2_co2flux' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uatm' var_list[2].units = 'uatm' var_list[3].units = 'mol m-2 s-1' #OPTAA elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'OPTAA' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/RID16/01-OPTAAD000/recovered_host/optaa_dj_dcl_instrument_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'OPTAA' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/RID27/01-OPTAAD000/recovered_host/optaa_dj_dcl_instrument_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'OPTAA' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/RID27/01-OPTAAD000/recovered_host/optaa_dj_dcl_instrument_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'OPTAA' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/RID16/01-OPTAAD000/recovered_host/optaa_dj_dcl_instrument_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'OPTAA' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/RID27/01-OPTAAD000/recovered_host/optaa_dj_dcl_instrument_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'OPTAA' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/RID27/01-OPTAAD000/recovered_host/optaa_dj_dcl_instrument_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'OPTAA' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/MFD37/01-OPTAAD000/recovered_host/optaa_dj_dcl_instrument_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'OPTAA' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/MFD37/01-OPTAAD000/recovered_host/optaa_dj_dcl_instrument_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'OPTAA' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/MFD37/01-OPTAAD000/recovered_host/optaa_dj_dcl_instrument_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'OPTAA' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/MFD37/01-OPTAAC000/recovered_host/optaa_dj_dcl_instrument_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' #NUTNR elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'RecoveredHost': uframe_dataset_name = 'CE01ISSM/RID16/07-NUTNRB000/recovered_host/suna_dcl_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/RID26/07-NUTNRB000/recovered_host/suna_dcl_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/RID26/07-NUTNRB000/recovered_host/suna_dcl_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'RecoveredHost': uframe_dataset_name = 'CE06ISSM/RID16/07-NUTNRB000/recovered_host/suna_dcl_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/RID26/07-NUTNRB000/recovered_host/suna_dcl_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/RID26/07-NUTNRB000/recovered_host/suna_dcl_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/RID16/03-CTDBPC000/recovered_inst/ctdbp_cdef_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'ctdbp_seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'ctdbp_seawater_pressure' var_list[5].name = 'ctdbp_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'CTD' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/MFD37/03-CTDBPC000/recovered_inst/ctdbp_cdef_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'ctdbp_seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'ctdbp_seawater_pressure' var_list[5].name = 'ctdbp_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE01ISSM' and node == 'BUOY' and instrument_class == 'CTD' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/SBD17/06-CTDBPC000/recovered_inst/ctdbp_cdef_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'ctdbp_seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'ctdbp_seawater_pressure' var_list[5].name = 'ctdbp_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/RID16/03-CTDBPC000/recovered_inst/ctdbp_cdef_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'ctdbp_seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'ctdbp_seawater_pressure' var_list[5].name = 'ctdbp_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'CTD' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/MFD37/03-CTDBPC000/recovered_inst/ctdbp_cdef_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'ctdbp_seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'ctdbp_seawater_pressure' var_list[5].name = 'ctdbp_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE06ISSM' and node == 'BUOY' and instrument_class == 'CTD' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/SBD17/06-CTDBPC000/recovered_inst/ctdbp_cdef_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'ctdbp_seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'ctdbp_seawater_pressure' var_list[5].name = 'ctdbp_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'RecoveredInst': uframe_dataset_name = 'CE02SHSM/RID27/03-CTDBPC000/recovered_inst/ctdbp_cdef_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'ctdbp_seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'ctdbp_seawater_pressure' var_list[5].name = 'ctdbp_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'RecoveredInst': uframe_dataset_name = 'CE07SHSM/RID27/03-CTDBPC000/recovered_inst/ctdbp_cdef_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'ctdbp_seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'ctdbp_seawater_pressure' var_list[5].name = 'ctdbp_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'RecoveredInst': uframe_dataset_name = 'CE04OSSM/RID27/03-CTDBPC000/recovered_inst/ctdbp_cdef_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'ctdbp_seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'ctdbp_seawater_pressure' var_list[5].name = 'ctdbp_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'CTD' and method == 'RecoveredInst': uframe_dataset_name = 'CE09OSSM/RID27/03-CTDBPC000/recovered_inst/ctdbp_cdef_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'ctdbp_seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'ctdbp_seawater_pressure' var_list[5].name = 'ctdbp_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'CTD' and method == 'RecoveredInst': uframe_dataset_name = 'CE07SHSM/MFD37/03-CTDBPC000/recovered_inst/ctdbp_cdef_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'ctdbp_seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'ctdbp_seawater_pressure' var_list[5].name = 'ctdbp_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'CTD' and method == 'RecoveredInst': uframe_dataset_name = 'CE09OSSM/MFD37/03-CTDBPE000/recovered_inst/ctdbp_cdef_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'ctdbp_seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'ctdbp_seawater_pressure' var_list[5].name = 'ctdbp_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE09OSPM' and node == 'PROFILER' and instrument_class == 'CTD' and method == 'RecoveredWFP': uframe_dataset_name = 'CE09OSPM/WFP01/03-CTDPFK000/recovered_wfp/ctdpf_ckl_wfp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'ctdpf_ckl_seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'ctdpf_ckl_seawater_pressure' var_list[5].name = 'ctdpf_ckl_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'ADCP' and method == 'RecoveredInst': uframe_dataset_name = 'CE02SHSM/RID26/01-ADCPTA000/recovered_inst/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'ADCP' and method == 'RecoveredInst': uframe_dataset_name = 'CE04OSSM/RID26/01-ADCPTC000/recovered_inst/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'ADCP' and method == 'RecoveredInst': uframe_dataset_name = 'CE07SHSM/RID26/01-ADCPTA000/recovered_inst/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'ADCP' and method == 'RecoveredInst': uframe_dataset_name = 'CE09OSSM/RID26/01-ADCPTC000/recovered_inst/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'ADCP' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/MFD35/04-ADCPTM000/recovered_inst/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'ADCP' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/MFD35/04-ADCPTM000/recovered_inst/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'ADCP' and method == 'RecoveredInst': uframe_dataset_name = 'CE07SHSM/MFD35/04-ADCPTC000/recovered_inst/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'ADCP' and method == 'RecoveredInst': uframe_dataset_name = 'CE09OSSM/MFD35/04-ADCPSJ000/recovered_inst/adcp_velocity_earth' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'ZPLSC' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/MFD37/07-ZPLSCC000/recovered_inst/zplsc_echogram_data' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'ZPLSC' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/MFD37/07-ZPLSCC000/recovered_inst/zplsc_echogram_data' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'ZPLSC' and method == 'RecoveredInst': uframe_dataset_name = 'CE07SHSM/MFD37/07-ZPLSCC000/recovered_inst/zplsc_echogram_data' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'ZPLSC' and method == 'RecoveredInst': uframe_dataset_name = 'CE09OSSM/MFD37/07-ZPLSCC000/recovered_inst/zplsc_echogram_data' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE01ISSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/SBD17/04-VELPTA000/recovered_inst/velpt_ab_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'RecoveredInst': uframe_dataset_name = 'CE02SHSM/SBD11/04-VELPTA000/recovered_inst/velpt_ab_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'RecoveredInst': uframe_dataset_name = 'CE04OSSM/SBD11/04-VELPTA000/recovered_inst/velpt_ab_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE06ISSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/SBD17/04-VELPTA000/recovered_inst/velpt_ab_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'RecoveredInst': uframe_dataset_name = 'CE07SHSM/SBD11/04-VELPTA000/recovered_inst/velpt_ab_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'VELPT' and method == 'RecoveredInst': uframe_dataset_name = 'CE09OSSM/SBD11/04-VELPTA000/recovered_inst/velpt_ab_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/RID16/04-VELPTA000/recovered_inst/velpt_ab_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'RecoveredInst': uframe_dataset_name = 'CE02SHSM/RID26/04-VELPTA000/recovered_inst/velpt_ab_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'RecoveredInst': uframe_dataset_name = 'CE04OSSM/RID26/04-VELPTA000/recovered_inst/velpt_ab_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/RID16/04-VELPTA000/recovered_inst/velpt_ab_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'RecoveredInst': uframe_dataset_name = 'CE07SHSM/RID26/04-VELPTA000/recovered_inst/velpt_ab_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'VELPT' and method == 'RecoveredInst': uframe_dataset_name = 'CE09OSSM/RID26/04-VELPTA000/recovered_inst/velpt_ab_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'eastward_velocity' var_list[2].name = 'northward_velocity' var_list[3].name = 'upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'deci-degrees' var_list[5].units = 'deci-degrees' var_list[6].units = 'deci-degrees' var_list[7].units = '0.01degC' var_list[8].units = '0.001dbar' elif platform_name == 'CE09OSPM' and node == 'PROFILER' and instrument_class == 'VEL3D' and method == 'RecoveredWFP': uframe_dataset_name = 'CE09OSPM/WFP01/01-VEL3DK000/recovered_wfp/vel3d_k_wfp_instrument' var_list[0].name = 'time' var_list[1].name = 'vel3d_k_eastward_velocity' var_list[2].name = 'vel3d_k_northward_velocity' var_list[3].name = 'vel3d_k_upward_velocity' var_list[4].name = 'vel3d_k_heading' var_list[5].name = 'vel3d_k_pitch' var_list[6].name = 'vel3d_k_roll' var_list[7].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'ddegrees' var_list[5].units = 'ddegrees' var_list[6].units = 'ddegrees' var_list[7].units = 'dbar' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'VEL3D' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/MFD35/01-VEL3DD000/recovered_inst/vel3d_cd_dcl_velocity_data_recovered' var_list[0].name = 'time' var_list[1].name = 'vel3d_c_eastward_turbulent_velocity' var_list[2].name = 'vel3d_c_northward_turbulent_velocity' var_list[3].name = 'vel3d_c_upward_turbulent_velocity' var_list[4].name = 'seawater_pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = '0.001dbar' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'VEL3D' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/MFD35/01-VEL3DD000/recovered_inst/vel3d_cd_dcl_velocity_data_recovered' var_list[0].name = 'time' var_list[1].name = 'vel3d_c_eastward_turbulent_velocity' var_list[2].name = 'vel3d_c_northward_turbulent_velocity' var_list[3].name = 'vel3d_c_upward_turbulent_velocity' var_list[4].name = 'seawater_pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = '0.001dbar' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'VEL3D' and method == 'RecoveredInst': uframe_dataset_name = 'CE07SHSM/MFD35/01-VEL3DD000/recovered_inst/vel3d_cd_dcl_velocity_data_recovered' var_list[0].name = 'time' var_list[1].name = 'vel3d_c_eastward_turbulent_velocity' var_list[2].name = 'vel3d_c_northward_turbulent_velocity' var_list[3].name = 'vel3d_c_upward_turbulent_velocity' var_list[4].name = 'seawater_pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = '0.001dbar' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'VEL3D' and method == 'RecoveredInst': uframe_dataset_name = 'CE09OSSM/MFD35/01-VEL3DD000/recovered_inst/vel3d_cd_dcl_velocity_data_recovered' var_list[0].name = 'time' var_list[1].name = 'vel3d_c_eastward_turbulent_velocity' var_list[2].name = 'vel3d_c_northward_turbulent_velocity' var_list[3].name = 'vel3d_c_upward_turbulent_velocity' var_list[4].name = 'seawater_pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = '0.001dbar' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'PRESF' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/MFD35/02-PRESFA000/recovered_inst/presf_abc_tide_measurement_recovered' var_list[0].name = 'time' var_list[1].name = 'presf_tide_pressure' var_list[2].name = 'presf_tide_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'dbar' var_list[2].units = 'degC' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'PRESF' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/MFD35/02-PRESFA000/recovered_inst/presf_abc_tide_measurement_recovered' var_list[0].name = 'time' var_list[1].name = 'presf_tide_pressure' var_list[2].name = 'presf_tide_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'dbar' var_list[2].units = 'degC' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'PRESF' and method == 'RecoveredInst': uframe_dataset_name = 'CE07SHSM/MFD35/02-PRESFB000/recovered_inst/presf_abc_tide_measurement_recovered' var_list[0].name = 'time' var_list[1].name = 'presf_tide_pressure' var_list[2].name = 'presf_tide_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'dbar' var_list[2].units = 'degC' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'PRESF' and method == 'RecoveredInst': uframe_dataset_name = 'CE09OSSM/MFD35/02-PRESFC000/recovered_inst/presf_abc_tide_measurement_recovered' var_list[0].name = 'time' var_list[1].name = 'presf_tide_pressure' var_list[2].name = 'presf_tide_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'dbar' var_list[2].units = 'degC' elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/RID16/06-PHSEND000/recovered_inst/phsen_abcdef_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'RecoveredInst': uframe_dataset_name = 'CE02SHSM/RID26/06-PHSEND000/recovered_inst/phsen_abcdef_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'RecoveredInst': uframe_dataset_name = 'CE04OSSM/RID26/06-PHSEND000/recovered_inst/phsen_abcdef_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/RID16/06-PHSEND000/recovered_inst/phsen_abcdef_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'RecoveredInst': uframe_dataset_name = 'CE07SHSM/RID26/06-PHSEND000/recovered_inst/phsen_abcdef_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'PHSEN' and method == 'RecoveredInst': uframe_dataset_name = 'CE09OSSM/RID26/06-PHSEND000/recovered_inst/phsen_abcdef_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'PHSEN' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/MFD35/06-PHSEND000/recovered_inst/phsen_abcdef_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'PHSEN' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/MFD35/06-PHSEND000/recovered_inst/phsen_abcdef_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'PHSEN' and method == 'RecoveredInst': uframe_dataset_name = 'CE07SHSM/MFD35/06-PHSEND000/recovered_inst/phsen_abcdef_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'PHSEN' and method == 'RecoveredInst': uframe_dataset_name = 'CE09OSSM/MFD35/06-PHSEND000/recovered_inst/phsen_abcdef_instrument' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'phsen_abcdef_ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'PCO2W' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/RID16/05-PCO2WB000/recovered_inst/pco2w_abc_instrument' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'PCO2W' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/MFD35/05-PCO2WB000/recovered_inst/pco2w_abc_instrument' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'PCO2W' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/RID16/05-PCO2WB000/recovered_inst/pco2w_abc_instrument' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'PCO2W' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/MFD35/05-PCO2WB000/recovered_inst/pco2w_abc_instrument' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'PCO2W' and method == 'RecoveredInst': uframe_dataset_name = 'CE07SHSM/MFD35/05-PCO2WB000/recovered_inst/pco2w_abc_instrument' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'PCO2W' and method == 'RecoveredInst': uframe_dataset_name = 'CE09OSSM/MFD35/05-PCO2WB000/recovered_inst/pco2w_abc_instrument' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE09OSPM' and node == 'PROFILER' and instrument_class == 'PARAD' and method == 'RecoveredWFP': uframe_dataset_name = 'CE09OSPM/WFP01/05-PARADK000/recovered_wfp/parad_k__stc_imodem_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_k_par' var_list[2].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/RID16/07-NUTNRB000/recovered_inst/suna_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE02SHSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'RecoveredInst': uframe_dataset_name = 'CE02SHSM/RID26/07-NUTNRB000/recovered_inst/suna_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE04OSSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'RecoveredInst': uframe_dataset_name = 'CE04OSSM/RID26/07-NUTNRB000/recovered_inst/suna_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/RID16/07-NUTNRB000/recovered_inst/suna_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE07SHSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'RecoveredInst': uframe_dataset_name = 'CE07SHSM/RID26/07-NUTNRB000/recovered_inst/suna_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE09OSSM' and node == 'NSIF' and instrument_class == 'NUTNR' and method == 'RecoveredInst': uframe_dataset_name = 'CE09OSSM/RID26/07-NUTNRB000/recovered_inst/suna_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'FDCHP' and method == 'RecoveredInst': uframe_dataset_name = 'CE02SHSM/SBD12/08-FDCHPA000/recovered_inst/fdchp_a_instrument_recovered' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE01ISSM' and node == 'BUOY' and instrument_class == 'FLORT' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/SBD17/06-FLORTD000/recovered_inst/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE06ISSM' and node == 'BUOY' and instrument_class == 'FLORT' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/SBD17/06-FLORTD000/recovered_inst/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' elif platform_name == 'CE09OSPM' and node == 'PROFILER' and instrument_class == 'FLORT' and method == 'RecoveredWFP': uframe_dataset_name = 'CE09OSPM/WFP01/04-FLORTK000/recovered_wfp/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' elif platform_name == 'CE09OSPM' and node == 'PROFILER' and instrument_class == 'DOSTA' and method == 'RecoveredWFP': uframe_dataset_name = 'CE09OSPM/WFP01/02-DOFSTK000/recovered_wfp/dofst_k_wfp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dofst_k_oxygen_l2' var_list[2].name = 'dofst_k_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'Hz' var_list[3].units = 'dbar' elif platform_name == 'CE01ISSM' and node == 'NSIF' and instrument_class == 'DOSTA' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/RID16/03-DOSTAD000/recovered_inst/dosta_abcdjm_ctdbp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'ctd_tc_oxygen' var_list[3].name = 'ctdbp_seawater_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'degC' elif platform_name == 'CE06ISSM' and node == 'NSIF' and instrument_class == 'DOSTA' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/RID16/03-DOSTAD000/recovered_inst/dosta_abcdjm_ctdbp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'ctd_tc_oxygen' var_list[3].name = 'ctdbp_seawater_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'degC' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'DOSTA' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/MFD37/03-DOSTAD000/recovered_inst/dosta_abcdjm_ctdbp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'ctd_tc_oxygen' var_list[3].name = 'ctdbp_seawater_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'degC' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'DOSTA' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/MFD37/03-DOSTAD000/recovered_inst/dosta_abcdjm_ctdbp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'ctd_tc_oxygen' var_list[3].name = 'ctdbp_seawater_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'degC' elif platform_name == 'CE07SHSM' and node == 'MFN' and instrument_class == 'DOSTA' and method == 'RecoveredInst': uframe_dataset_name = 'CE07SHSM/MFD37/03-DOSTAD000/recovered_inst/dosta_abcdjm_ctdbp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'ctd_tc_oxygen' var_list[3].name = 'ctdbp_seawater_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'degC' elif platform_name == 'CE09OSSM' and node == 'MFN' and instrument_class == 'DOSTA' and method == 'RecoveredInst': uframe_dataset_name = 'CE09OSSM/MFD37/03-DOSTAD000/recovered_inst/dosta_abcdjm_ctdbp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'ctd_tc_oxygen' var_list[3].name = 'ctdbp_seawater_temperature' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'degC' elif platform_name == 'CE01ISSM' and node == 'MFN' and instrument_class == 'WAVSS_Stats' and method == 'RecoveredInst': uframe_dataset_name = 'CE01ISSM/MFD35/04-ADCPTM000/recovered_inst/adcpt_m_instrument_log9_recovered' var_list[0].name = 'time' var_list[1].name = 'significant_wave_height' var_list[2].name = 'peak_wave_period' var_list[3].name = 'peak_wave_direction' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'seconds' var_list[3].units = 'degrees' elif platform_name == 'CE06ISSM' and node == 'MFN' and instrument_class == 'WAVSS_Stats' and method == 'RecoveredInst': uframe_dataset_name = 'CE06ISSM/MFD35/04-ADCPTM000/recovered_inst/adcpt_m_instrument_log9_recovered' var_list[0].name = 'time' var_list[1].name = 'significant_wave_height' var_list[2].name = 'peak_wave_period' var_list[3].name = 'peak_wave_direction' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'seconds' var_list[3].units = 'degrees' elif platform_name == 'CE02SHBP' and node == 'BEP' and instrument_class == 'CTD' and method == 'Streamed': uframe_dataset_name = 'CE02SHBP/LJ01D/06-CTDBPN106/streamed/ctdbp_no_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'ctdbp_no_seawater_pressure' var_list[5].name = 'ctdbp_no_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE04OSBP' and node == 'BEP' and instrument_class == 'CTD' and method == 'Streamed': uframe_dataset_name = 'CE04OSBP/LJ01C/06-CTDBPO108/streamed/ctdbp_no_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'ctdbp_no_seawater_pressure' var_list[5].name = 'ctdbp_no_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE02SHBP' and node == 'BEP' and instrument_class == 'DOSTA' and method == 'Streamed': uframe_dataset_name = 'CE02SHBP/LJ01D/06-CTDBPN106/streamed/ctdbp_no_sample' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'ctd_tc_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' elif platform_name == 'CE04OSBP' and node == 'BEP' and instrument_class == 'DOSTA' and method == 'Streamed': uframe_dataset_name = 'CE04OSBP/LJ01C/06-CTDBPO108/streamed/ctdbp_no_sample' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'ctd_tc_oxygen' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' elif platform_name == 'CE02SHBP' and node == 'BEP' and instrument_class == 'PHSEN' and method == 'Streamed': uframe_dataset_name = 'CE02SHBP/LJ01D/10-PHSEND103/streamed/phsen_data_record' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE04OSBP' and node == 'BEP' and instrument_class == 'PHSEN' and method == 'Streamed': uframe_dataset_name = 'CE04OSBP/LJ01C/10-PHSEND107/streamed/phsen_data_record' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'ph_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' elif platform_name == 'CE02SHBP' and node == 'BEP' and instrument_class == 'PCO2W' and method == 'Streamed': uframe_dataset_name = 'CE02SHBP/LJ01D/09-PCO2WB103/streamed/pco2w_b_sami_data_record' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE04OSBP' and node == 'BEP' and instrument_class == 'PCO2W' and method == 'Streamed': uframe_dataset_name = 'CE04OSBP/LJ01C/09-PCO2WB104/streamed/pco2w_b_sami_data_record' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' elif platform_name == 'CE02SHBP' and node == 'BEP' and instrument_class == 'ADCP' and method == 'Streamed': uframe_dataset_name = 'CE02SHBP/LJ01D/05-ADCPTB104/streamed/adcp_velocity_beam' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE04OSBP' and node == 'BEP' and instrument_class == 'ADCP' and method == 'Streamed': uframe_dataset_name = 'CE04OSBP/LJ01C/05-ADCPSI103/streamed/adcp_velocity_beam' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' elif platform_name == 'CE02SHBP' and node == 'BEP' and instrument_class == 'VEL3D' and method == 'Streamed': uframe_dataset_name = 'CE02SHBP/LJ01D/07-VEL3DC108/streamed/vel3d_cd_velocity_data' var_list[0].name = 'time' var_list[1].name = 'vel3d_c_eastward_turbulent_velocity' var_list[2].name = 'vel3d_c_northward_turbulent_velocity' var_list[3].name = 'vel3d_c_upward_turbulent_velocity' var_list[4].name = 'seawater_pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = '0.001dbar' elif platform_name == 'CE04OSBP' and node == 'BEP' and instrument_class == 'VEL3D' and method == 'Streamed': uframe_dataset_name = 'CE04OSBP/LJ01C/07-VEL3DC107/streamed/vel3d_cd_velocity_data' var_list[0].name = 'time' var_list[1].name = 'vel3d_c_eastward_turbulent_velocity' var_list[2].name = 'vel3d_c_northward_turbulent_velocity' var_list[3].name = 'vel3d_c_upward_turbulent_velocity' var_list[4].name = 'seawater_pressure_mbar' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = '0.001dbar' elif platform_name == 'CE02SHBP' and node == 'BEP' and instrument_class == 'OPTAA' and method == 'Streamed': uframe_dataset_name = 'CE02SHBP/LJ01D/08-OPTAAD106/streamed/optaa_sample' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' elif platform_name == 'CE04OSBP' and node == 'BEP' and instrument_class == 'OPTAA' and method == 'Streamed': uframe_dataset_name = 'CE04OSBP/LJ01C/08-OPTAAC104/streamed/optaa_sample' var_list[0].name = 'time' var_list[0].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' #CSPP Data below elif platform_name == 'CE01ISSP' and node == 'PROFILER' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSP/SP001/08-FLORTJ000/telemetered/flort_dj_cspp_instrument' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' elif platform_name == 'CE01ISSP' and node == 'PROFILER' and instrument_class == 'FLORT' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE01ISSP/SP001/08-FLORTJ000/recovered_cspp/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' elif platform_name == 'CE06ISSP' and node == 'PROFILER' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSP/SP001/08-FLORTJ000/telemetered/flort_dj_cspp_instrument' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' elif platform_name == 'CE06ISSP' and node == 'PROFILER' and instrument_class == 'FLORT' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE06ISSP/SP001/08-FLORTJ000/recovered_cspp/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' elif platform_name == 'CE01ISSP' and node == 'PROFILER' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSP/SP001/02-DOSTAJ000/telemetered/dosta_abcdjm_cspp_instrument' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'estimated_oxygen_concentration' var_list[3].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[4].name = 'optode_temperature' var_list[5].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'umol/L' var_list[4].units = 'degC' var_list[5].units = 'dbar' elif platform_name == 'CE01ISSP' and node == 'PROFILER' and instrument_class == 'DOSTA' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE01ISSP/SP001/02-DOSTAJ000/recovered_cspp/dosta_abcdjm_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'estimated_oxygen_concentration' var_list[3].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[4].name = 'optode_temperature' var_list[5].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'umol/L' var_list[4].units = 'degC' var_list[5].units = 'dbar' elif platform_name == 'CE06ISSP' and node == 'PROFILER' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSP/SP001/02-DOSTAJ000/telemetered/dosta_abcdjm_cspp_instrument' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'estimated_oxygen_concentration' var_list[3].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[4].name = 'optode_temperature' var_list[5].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'umol/L' var_list[4].units = 'degC' var_list[5].units = 'dbar' elif platform_name == 'CE06ISSP' and node == 'PROFILER' and instrument_class == 'DOSTA' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE06ISSP/SP001/02-DOSTAJ000/recovered_cspp/dosta_abcdjm_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'estimated_oxygen_concentration' var_list[3].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[4].name = 'optode_temperature' var_list[5].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'umol/L' var_list[4].units = 'degC' var_list[5].units = 'dbar' elif platform_name == 'CE01ISSP' and node == 'PROFILER' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSP/SP001/09-CTDPFJ000/telemetered/ctdpf_j_cspp_instrument' var_list[0].name = 'time' var_list[1].name = 'temperature' var_list[2].name = 'salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE01ISSP' and node == 'PROFILER' and instrument_class == 'CTD' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE01ISSP/SP001/09-CTDPFJ000/recovered_cspp/ctdpf_j_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temperature' var_list[2].name = 'salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE06ISSP' and node == 'PROFILER' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSP/SP001/09-CTDPFJ000/telemetered/ctdpf_j_cspp_instrument' var_list[0].name = 'time' var_list[1].name = 'temperature' var_list[2].name = 'salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE06ISSP' and node == 'PROFILER' and instrument_class == 'CTD' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE06ISSP/SP001/09-CTDPFJ000/recovered_cspp/ctdpf_j_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temperature' var_list[2].name = 'salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE01ISSP' and node == 'PROFILER' and instrument_class == 'PARAD' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSP/SP001/10-PARADJ000/telemetered/parad_j_cspp_instrument' var_list[0].name = 'time' var_list[1].name = 'parad_j_par_counts_output' var_list[2].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' elif platform_name == 'CE01ISSP' and node == 'PROFILER' and instrument_class == 'PARAD' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE01ISSP/SP001/10-PARADJ000/recovered_cspp/parad_j_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_j_par_counts_output' var_list[2].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' elif platform_name == 'CE06ISSP' and node == 'PROFILER' and instrument_class == 'PARAD' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSP/SP001/10-PARADJ000/telemetered/parad_j_cspp_instrument' var_list[0].name = 'time' var_list[1].name = 'parad_j_par_counts_output' var_list[2].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' elif platform_name == 'CE06ISSP' and node == 'PROFILER' and instrument_class == 'PARAD' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE06ISSP/SP001/10-PARADJ000/recovered_cspp/parad_j_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_j_par_counts_output' var_list[2].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' elif platform_name == 'CE01ISSP' and node == 'PROFILER' and instrument_class == 'NUTNR' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE01ISSP/SP001/06-NUTNRJ000/recovered_cspp/nutnr_j_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'salinity_corrected_nitrate' var_list[2].name = 'nitrate_concentration' var_list[3].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' var_list[3].units = 'dbar' elif platform_name == 'CE06ISSP' and node == 'PROFILER' and instrument_class == 'NUTNR' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE06ISSP/SP001/06-NUTNRJ000/recovered_cspp/nutnr_j_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'salinity_corrected_nitrate' var_list[2].name = 'nitrate_concentration' var_list[3].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' var_list[3].units = 'dbar' elif platform_name == 'CE01ISSP' and node == 'PROFILER' and instrument_class == 'SPKIR' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSP/SP001/07-SPKIRJ000/telemetered/spkir_abj_cspp_instrument' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[2].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' var_list[2].units = 'dbar' elif platform_name == 'CE01ISSP' and node == 'PROFILER' and instrument_class == 'SPKIR' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE01ISSP/SP001/07-SPKIRJ000/recovered_cspp/spkir_abj_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[2].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' var_list[2].units = 'dbar' elif platform_name == 'CE06ISSP' and node == 'PROFILER' and instrument_class == 'SPKIR' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSP/SP001/07-SPKIRJ000/telemetered/spkir_abj_cspp_instrument' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[2].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' var_list[2].units = 'dbar' elif platform_name == 'CE06ISSP' and node == 'PROFILER' and instrument_class == 'SPKIR' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE06ISSP/SP001/07-SPKIRJ000/recovered_cspp/spkir_abj_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[2].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' var_list[2].units = 'dbar' elif platform_name == 'CE01ISSP' and node == 'PROFILER' and instrument_class == 'VELPT' and method == 'Telemetered': uframe_dataset_name = 'CE01ISSP/SP001/05-VELPTJ000/telemetered/velpt_j_cspp_instrument' var_list[0].name = 'time' var_list[1].name = 'velpt_j_eastward_velocity' var_list[2].name = 'velpt_j_northward_velocity' var_list[3].name = 'velpt_j_upward_velocity' var_list[4].name = 'heading' var_list[5].name = 'roll' var_list[6].name = 'pitch' var_list[7].name = 'temperature' var_list[8].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'degrees' var_list[5].units = 'degrees' var_list[6].units = 'degrees' var_list[7].units = 'degC' var_list[8].units = 'dbar' elif platform_name == 'CE01ISSP' and node == 'PROFILER' and instrument_class == 'VELPT' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE01ISSP/SP001/05-VELPTJ000/recovered_cspp/velpt_j_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'velpt_j_eastward_velocity' var_list[2].name = 'velpt_j_northward_velocity' var_list[3].name = 'velpt_j_upward_velocity' var_list[4].name = 'heading' var_list[5].name = 'roll' var_list[6].name = 'pitch' var_list[7].name = 'temperature' var_list[8].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'degrees' var_list[5].units = 'degrees' var_list[6].units = 'degrees' var_list[7].units = 'degC' var_list[8].units = 'dbar' elif platform_name == 'CE06ISSP' and node == 'PROFILER' and instrument_class == 'VELPT' and method == 'Telemetered': uframe_dataset_name = 'CE06ISSP/SP001/05-VELPTJ000/telemetered/velpt_j_cspp_instrument' var_list[0].name = 'time' var_list[1].name = 'velpt_j_eastward_velocity' var_list[2].name = 'velpt_j_northward_velocity' var_list[3].name = 'velpt_j_upward_velocity' var_list[4].name = 'heading' var_list[5].name = 'roll' var_list[6].name = 'pitch' var_list[7].name = 'temperature' var_list[8].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'degrees' var_list[5].units = 'degrees' var_list[6].units = 'degrees' var_list[7].units = 'degC' var_list[8].units = 'dbar' elif platform_name == 'CE06ISSP' and node == 'PROFILER' and instrument_class == 'VELPT' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE06ISSP/SP001/05-VELPTJ000/recovered_cspp/velpt_j_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'velpt_j_eastward_velocity' var_list[2].name = 'velpt_j_northward_velocity' var_list[3].name = 'velpt_j_upward_velocity' var_list[4].name = 'heading' var_list[5].name = 'roll' var_list[6].name = 'pitch' var_list[7].name = 'temperature' var_list[8].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'degrees' var_list[5].units = 'degrees' var_list[6].units = 'degrees' var_list[7].units = 'degC' var_list[8].units = 'dbar' elif platform_name == 'CE01ISSP' and node == 'PROFILER' and instrument_class == 'OPTAA' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE01ISSP/SP001/04-OPTAAJ000/recovered_cspp/optaa_dj_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'dbar' elif platform_name == 'CE06ISSP' and node == 'PROFILER' and instrument_class == 'OPTAA' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE06ISSP/SP001/04-OPTAAJ000/recovered_cspp/optaa_dj_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'dbar' elif platform_name == 'CE02SHSP' and node == 'PROFILER' and instrument_class == 'FLORT' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE02SHSP/SP001/07-FLORTJ000/recovered_cspp/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' elif platform_name == 'CE07SHSP' and node == 'PROFILER' and instrument_class == 'FLORT' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE07SHSP/SP001/07-FLORTJ000/recovered_cspp/flort_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' elif platform_name == 'CE02SHSP' and node == 'PROFILER' and instrument_class == 'DOSTA' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE02SHSP/SP001/01-DOSTAJ000/recovered_cspp/dosta_abcdjm_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'estimated_oxygen_concentration' var_list[3].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[4].name = 'optode_temperature' var_list[5].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'umol/L' var_list[4].units = 'degC' var_list[5].units = 'dbar' elif platform_name == 'CE07SHSP' and node == 'PROFILER' and instrument_class == 'DOSTA' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE07SHSP/SP001/01-DOSTAJ000/recovered_cspp/dosta_abcdjm_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'estimated_oxygen_concentration' var_list[3].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[4].name = 'optode_temperature' var_list[5].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'umol/L' var_list[4].units = 'degC' var_list[5].units = 'dbar' elif platform_name == 'CE02SHSP' and node == 'PROFILER' and instrument_class == 'CTD' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE02SHSP/SP001/08-CTDPFJ000/recovered_cspp/ctdpf_j_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temperature' var_list[2].name = 'salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE07SHSP' and node == 'PROFILER' and instrument_class == 'CTD' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE07SHSP/SP001/08-CTDPFJ000/recovered_cspp/ctdpf_j_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temperature' var_list[2].name = 'salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE02SHSP' and node == 'PROFILER' and instrument_class == 'PARAD' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE02SHSP/SP001/09-PARADJ000/recovered_cspp/parad_j_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_j_par_counts_output' var_list[2].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' elif platform_name == 'CE07SHSP' and node == 'PROFILER' and instrument_class == 'PARAD' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE07SHSP/SP001/09-PARADJ000/recovered_cspp/parad_j_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_j_par_counts_output' var_list[2].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' elif platform_name == 'CE02SHSP' and node == 'PROFILER' and instrument_class == 'NUTNR' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE02SHSP/SP001/05-NUTNRJ000/recovered_cspp/nutnr_j_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'salinity_corrected_nitrate' var_list[2].name = 'nitrate_concentration' var_list[3].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' var_list[3].units = 'dbar' elif platform_name == 'CE07SHSP' and node == 'PROFILER' and instrument_class == 'NUTNR' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE07SHSP/SP001/05-NUTNRJ000/recovered_cspp/nutnr_j_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'salinity_corrected_nitrate' var_list[2].name = 'nitrate_concentration' var_list[3].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' var_list[3].units = 'dbar' elif platform_name == 'CE02SHSP' and node == 'PROFILER' and instrument_class == 'SPKIR' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE02SHSP/SP001/06-SPKIRJ000/recovered_cspp/spkir_abj_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[2].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' var_list[2].units = 'dbar' elif platform_name == 'CE07SHSP' and node == 'PROFILER' and instrument_class == 'SPKIR' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE07SHSP/SP001/06-SPKIRJ000/recovered_cspp/spkir_abj_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'spkir_abj_cspp_downwelling_vector' var_list[2].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' var_list[2].units = 'dbar' elif platform_name == 'CE02SHSP' and node == 'PROFILER' and instrument_class == 'VELPT' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE02SHSP/SP001/02-VELPTJ000/recovered_cspp/velpt_j_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'velpt_j_eastward_velocity' var_list[2].name = 'velpt_j_northward_velocity' var_list[3].name = 'velpt_j_upward_velocity' var_list[4].name = 'heading' var_list[5].name = 'roll' var_list[6].name = 'pitch' var_list[7].name = 'temperature' var_list[8].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'degrees' var_list[5].units = 'degrees' var_list[6].units = 'degrees' var_list[7].units = 'degC' var_list[8].units = 'dbar' elif platform_name == 'CE07SHSP' and node == 'PROFILER' and instrument_class == 'VELPT' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE07SHSP/SP001/02-VELPTJ000/recovered_cspp/velpt_j_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'velpt_j_eastward_velocity' var_list[2].name = 'velpt_j_northward_velocity' var_list[3].name = 'velpt_j_upward_velocity' var_list[4].name = 'heading' var_list[5].name = 'roll' var_list[6].name = 'pitch' var_list[7].name = 'temperature' var_list[8].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm/s' var_list[2].units = 'm/s' var_list[3].units = 'm/s' var_list[4].units = 'degrees' var_list[5].units = 'degrees' var_list[6].units = 'degrees' var_list[7].units = 'degC' var_list[8].units = 'dbar' elif platform_name == 'CE02SHSP' and node == 'PROFILER' and instrument_class == 'OPTAA' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE02SHSP/SP001/04-OPTAAJ000/recovered_cspp/optaa_dj_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'dbar' elif platform_name == 'CE07SHSP' and node == 'PROFILER' and instrument_class == 'OPTAA' and method == 'RecoveredCSPP': uframe_dataset_name = 'CE07SHSP/SP001/04-OPTAAJ000/recovered_cspp/optaa_dj_cspp_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'dbar' elif platform_name == 'CEGL386' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL386/05-CTDGVM000/telemetered/ctdgv_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL386' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL386/05-CTDGVM000/recovered_host/ctdgv_m_glider_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL384' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL384/05-CTDGVM000/telemetered/ctdgv_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL384' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL384/05-CTDGVM000/recovered_host/ctdgv_m_glider_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL383' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL383/05-CTDGVM000/telemetered/ctdgv_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL383' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL383/05-CTDGVM000/recovered_host/ctdgv_m_glider_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL382' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL382/05-CTDGVM000/telemetered/ctdgv_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL382' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL382/05-CTDGVM000/recovered_host/ctdgv_m_glider_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL381' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL381/05-CTDGVM000/telemetered/ctdgv_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL381' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL381/05-CTDGVM000/recovered_host/ctdgv_m_glider_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL327' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL327/05-CTDGVM000/telemetered/ctdgv_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL327' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL327/05-CTDGVM000/recovered_host/ctdgv_m_glider_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL326' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL326/05-CTDGVM000/telemetered/ctdgv_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL326' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL326/05-CTDGVM000/recovered_host/ctdgv_m_glider_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL320' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL320/05-CTDGVM000/telemetered/ctdgv_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL320' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL320/05-CTDGVM000/recovered_host/ctdgv_m_glider_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL319' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL319/05-CTDGVM000/telemetered/ctdgv_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL319' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL319/05-CTDGVM000/recovered_host/ctdgv_m_glider_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL312' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL312/05-CTDGVM000/telemetered/ctdgv_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL312' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL312/05-CTDGVM000/recovered_host/ctdgv_m_glider_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL311' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL311/05-CTDGVM000/telemetered/ctdgv_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL311' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL311/05-CTDGVM000/recovered_host/ctdgv_m_glider_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL247' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL247/05-CTDGVM000/telemetered/ctdgv_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL247' and node == 'GLIDER' and instrument_class == 'CTD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL247/05-CTDGVM000/recovered_host/ctdgv_m_glider_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' var_list[4].name = 'sci_water_pressure_dbar' var_list[5].name = 'sci_water_cond' var_list[6].name = 'lat' var_list[7].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' var_list[6].units = 'degree_north' var_list[7].units = 'degree_east' elif platform_name == 'CEGL386' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL386/04-DOSTAM000/telemetered/dosta_abcdjm_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL386' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL386/04-DOSTAM000/recovered_host/dosta_abcdjm_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL384' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL384/04-DOSTAM000/telemetered/dosta_abcdjm_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL384' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL384/04-DOSTAM000/recovered_host/dosta_abcdjm_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL383' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL383/04-DOSTAM000/telemetered/dosta_abcdjm_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL383' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL383/04-DOSTAM000/recovered_host/dosta_abcdjm_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL382' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL382/04-DOSTAM000/telemetered/dosta_abcdjm_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL382' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL382/04-DOSTAM000/recovered_host/dosta_abcdjm_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL381' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL381/04-DOSTAM000/telemetered/dosta_abcdjm_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL381' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL381/04-DOSTAM000/recovered_host/dosta_abcdjm_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL327' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL327/04-DOSTAM000/telemetered/dosta_abcdjm_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL327' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL327/04-DOSTAM000/recovered_host/dosta_abcdjm_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL326' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL326/04-DOSTAM000/telemetered/dosta_abcdjm_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL326' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL326/04-DOSTAM000/recovered_host/dosta_abcdjm_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL320' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL320/04-DOSTAM000/telemetered/dosta_abcdjm_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL320' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL320/04-DOSTAM000/recovered_host/dosta_abcdjm_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL319' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL319/04-DOSTAM000/telemetered/dosta_abcdjm_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL319' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL319/04-DOSTAM000/recovered_host/dosta_abcdjm_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL312' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL312/04-DOSTAM000/telemetered/dosta_abcdjm_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL312' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL312/04-DOSTAM000/recovered_host/dosta_abcdjm_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL311' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL311/04-DOSTAM000/telemetered/dosta_abcdjm_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL311' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL311/04-DOSTAM000/recovered_host/dosta_abcdjm_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL247' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL247/04-DOSTAM000/telemetered/dosta_abcdjm_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL247' and node == 'GLIDER' and instrument_class == 'DOSTA' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL247/04-DOSTAM000/recovered_host/dosta_abcdjm_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'sci_oxy4_oxygen' var_list[2].name = 'sci_abs_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[4].name = 'lat' var_list[5].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/kg' var_list[3].units = 'dbar' var_list[4].units = 'degree_north' var_list[5].units = 'degree_east' elif platform_name == 'CEGL386' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL386/02-FLORTM000/telemetered/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL386' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL386/02-FLORTM000/recovered_host/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL384' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL384/02-FLORTM000/telemetered/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL384' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL384/02-FLORTM000/recovered_host/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL383' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL383/02-FLORTM000/telemetered/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL383' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL383/02-FLORTM000/recovered_host/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL382' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL382/02-FLORTM000/telemetered/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL382' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL382/02-FLORTM000/recovered_host/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL381' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL381/02-FLORTM000/telemetered/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL381' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL381/02-FLORTM000/recovered_host/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL327' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL327/02-FLORTM000/telemetered/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL327' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL327/02-FLORTM000/recovered_host/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL326' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL326/02-FLORTM000/telemetered/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL326' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL326/02-FLORTM000/recovered_host/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL320' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL320/02-FLORTM000/telemetered/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL320' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL320/02-FLORTM000/recovered_host/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL319' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL319/02-FLORTM000/telemetered/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL319' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL319/02-FLORTM000/recovered_host/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL312' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL312/02-FLORTM000/telemetered/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL312' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL312/02-FLORTM000/recovered_host/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL311' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL311/02-FLORTM000/telemetered/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL311' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL311/02-FLORTM000/recovered_host/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL247' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL247/02-FLORTM000/telemetered/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL247' and node == 'GLIDER' and instrument_class == 'FLORT' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL247/02-FLORTM000/recovered_host/flort_m_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'sci_flbbcd_chlor_units' var_list[3].name = 'sci_flbbcd_cdom_units' var_list[4].name = 'sci_flbbcd_bb_units' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[7].name = 'lat' var_list[8].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' var_list[7].units = 'degree_north' var_list[8].units = 'degree_east' elif platform_name == 'CEGL386' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL386/01-PARADM000/telemetered/parad_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL386' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL386/01-PARADM000/recovered_host/parad_m_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL384' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL384/01-PARADM000/telemetered/parad_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL384' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL384/01-PARADM000/recovered_host/parad_m_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL383' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL383/01-PARADM000/telemetered/parad_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL383' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL383/01-PARADM000/recovered_host/parad_m_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL382' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL382/01-PARADM000/telemetered/parad_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL382' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL382/01-PARADM000/recovered_host/parad_m_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL381' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL381/01-PARADM000/telemetered/parad_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL381' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL381/01-PARADM000/recovered_host/parad_m_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL327' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL327/01-PARADM000/telemetered/parad_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL327' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL327/01-PARADM000/recovered_host/parad_m_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL326' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL326/01-PARADM000/telemetered/parad_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL326' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL326/01-PARADM000/recovered_host/parad_m_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL320' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL320/01-PARADM000/telemetered/parad_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL320' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL320/01-PARADM000/recovered_host/parad_m_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL319' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL319/01-PARADM000/telemetered/parad_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL319' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL319/01-PARADM000/recovered_host/parad_m_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL312' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL312/01-PARADM000/telemetered/parad_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL312' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL312/01-PARADM000/recovered_host/parad_m_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL311' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL311/01-PARADM000/telemetered/parad_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL311' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL311/01-PARADM000/recovered_host/parad_m_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL247' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'Telemetered': uframe_dataset_name = 'CE05MOAS/GL247/01-PARADM000/telemetered/parad_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL247' and node == 'GLIDER' and instrument_class == 'PARAD' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL247/01-PARADM000/recovered_host/parad_m_glider_recovered' var_list[0].name = 'time' var_list[1].name = 'parad_m_par' var_list[2].name = 'int_ctd_pressure' var_list[3].name = 'lat' var_list[4].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' var_list[3].units = 'degree_north' var_list[4].units = 'degree_east' elif platform_name == 'CEGL386' and node == 'GLIDER' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL386/03-ADCPAM000/recovered_host/adcp_velocity_glider' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[8].name = 'int_ctd_pressure' var_list[9].name = 'lat' var_list[10].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' var_list[8].units = 'dbar' var_list[9].units = 'degree_north' var_list[10].units = 'degree_east' elif platform_name == 'CEGL384' and node == 'GLIDER' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL384/03-ADCPAM000/recovered_host/adcp_velocity_glider' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[8].name = 'int_ctd_pressure' var_list[9].name = 'lat' var_list[10].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' var_list[8].units = 'dbar' var_list[9].units = 'degree_north' var_list[10].units = 'degree_east' elif platform_name == 'CEGL383' and node == 'GLIDER' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL383/03-ADCPAM000/recovered_host/adcp_velocity_glider' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[8].name = 'int_ctd_pressure' var_list[9].name = 'lat' var_list[10].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' var_list[8].units = 'dbar' var_list[9].units = 'degree_north' var_list[10].units = 'degree_east' elif platform_name == 'CEGL382' and node == 'GLIDER' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL382/03-ADCPAM000/recovered_host/adcp_velocity_glider' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[8].name = 'int_ctd_pressure' var_list[9].name = 'lat' var_list[10].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' var_list[8].units = 'dbar' var_list[9].units = 'degree_north' var_list[10].units = 'degree_east' elif platform_name == 'CEGL381' and node == 'GLIDER' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL381/03-ADCPAM000/recovered_host/adcp_velocity_glider' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[8].name = 'int_ctd_pressure' var_list[9].name = 'lat' var_list[10].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' var_list[8].units = 'dbar' var_list[9].units = 'degree_north' var_list[10].units = 'degree_east' elif platform_name == 'CEGL327' and node == 'GLIDER' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL327/03-ADCPAM000/recovered_host/adcp_velocity_glider' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[8].name = 'int_ctd_pressure' var_list[9].name = 'lat' var_list[10].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' var_list[8].units = 'dbar' var_list[9].units = 'degree_north' var_list[10].units = 'degree_east' elif platform_name == 'CEGL326' and node == 'GLIDER' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL326/03-ADCPAM000/recovered_host/adcp_velocity_glider' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[8].name = 'int_ctd_pressure' var_list[9].name = 'lat' var_list[10].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' var_list[8].units = 'dbar' var_list[9].units = 'degree_north' var_list[10].units = 'degree_east' elif platform_name == 'CEGL320' and node == 'GLIDER' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL320/03-ADCPAM000/recovered_host/adcp_velocity_glider' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[8].name = 'int_ctd_pressure' var_list[9].name = 'lat' var_list[10].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' var_list[8].units = 'dbar' var_list[9].units = 'degree_north' var_list[10].units = 'degree_east' elif platform_name == 'CEGL319' and node == 'GLIDER' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL319/03-ADCPAM000/recovered_host/adcp_velocity_glider' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[8].name = 'int_ctd_pressure' var_list[9].name = 'lat' var_list[10].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' var_list[8].units = 'dbar' var_list[9].units = 'degree_north' var_list[10].units = 'degree_east' elif platform_name == 'CEGL312' and node == 'GLIDER' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL312/03-ADCPAM000/recovered_host/adcp_velocity_glider' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[8].name = 'int_ctd_pressure' var_list[9].name = 'lat' var_list[10].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' var_list[8].units = 'dbar' var_list[9].units = 'degree_north' var_list[10].units = 'degree_east' elif platform_name == 'CEGL311' and node == 'GLIDER' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL311/03-ADCPAM000/recovered_host/adcp_velocity_glider' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[8].name = 'int_ctd_pressure' var_list[9].name = 'lat' var_list[10].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' var_list[8].units = 'dbar' var_list[9].units = 'degree_north' var_list[10].units = 'degree_east' elif platform_name == 'CEGL247' and node == 'GLIDER' and instrument_class == 'ADCP' and method == 'RecoveredHost': uframe_dataset_name = 'CE05MOAS/GL247/03-ADCPAM000/recovered_host/adcp_velocity_glider' var_list[0].name = 'time' var_list[1].name = 'bin_depths' var_list[2].name = 'heading' var_list[3].name = 'pitch' var_list[4].name = 'roll' var_list[5].name = 'eastward_seawater_velocity' var_list[6].name = 'northward_seawater_velocity' var_list[7].name = 'upward_seawater_velocity' var_list[8].name = 'int_ctd_pressure' var_list[9].name = 'lat' var_list[10].name = 'lon' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'meters' var_list[2].units = 'deci-degrees' var_list[3].units = 'deci-degrees' var_list[4].units = 'deci-degrees' var_list[5].units = 'm/s' var_list[6].units = 'm/s' var_list[7].units = 'm/s' var_list[8].units = 'dbar' var_list[9].units = 'degree_north' var_list[10].units = 'degree_east' elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'METBK1-hr' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/SBD11/06-METBKA000/telemetered/metbk_hourly' var_list[0].name = 'met_timeflx' var_list[1].name = 'met_rainrte' var_list[2].name = 'met_buoyfls' var_list[3].name = 'met_buoyflx' var_list[4].name = 'met_frshflx' var_list[5].name = 'met_heatflx' var_list[6].name = 'met_latnflx' var_list[7].name = 'met_mommflx' var_list[8].name = 'met_netlirr' var_list[9].name = 'met_rainflx' var_list[10].name = 'met_sensflx' var_list[11].name = 'met_sphum2m' var_list[12].name = 'met_stablty' var_list[13].name = 'met_tempa2m' var_list[14].name = 'met_tempskn' var_list[15].name = 'met_wind10m' var_list[16].name = 'met_netsirr_hourly' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[15].data = np.array([]) var_list[16].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'mm/hr' var_list[2].units = 'W/m2' var_list[3].units = 'W/m2' var_list[4].units = 'mm/hr' var_list[5].units = 'W/m2' var_list[6].units = 'W/m2' var_list[7].units = 'N/m2' var_list[8].units = 'W/m2' var_list[9].units = 'W/m2' var_list[10].units = 'W/m2' var_list[11].units = 'g/kg' var_list[12].units = 'unitless' var_list[13].units = 'degC' var_list[14].units = 'degC' var_list[15].units = 'm/s' var_list[16].units = 'W/m2' elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'METBK1-hr' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/SBD11/06-METBKA000/recovered_host/metbk_hourly' var_list[0].name = 'met_timeflx' var_list[1].name = 'met_rainrte' var_list[2].name = 'met_buoyfls' var_list[3].name = 'met_buoyflx' var_list[4].name = 'met_frshflx' var_list[5].name = 'met_heatflx' var_list[6].name = 'met_latnflx' var_list[7].name = 'met_mommflx' var_list[8].name = 'met_netlirr' var_list[9].name = 'met_rainflx' var_list[10].name = 'met_sensflx' var_list[11].name = 'met_sphum2m' var_list[12].name = 'met_stablty' var_list[13].name = 'met_tempa2m' var_list[14].name = 'met_tempskn' var_list[15].name = 'met_wind10m' var_list[16].name = 'met_netsirr_hourly' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[15].data = np.array([]) var_list[16].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'mm/hr' var_list[2].units = 'W/m2' var_list[3].units = 'W/m2' var_list[4].units = 'mm/hr' var_list[5].units = 'W/m2' var_list[6].units = 'W/m2' var_list[7].units = 'N/m2' var_list[8].units = 'W/m2' var_list[9].units = 'W/m2' var_list[10].units = 'W/m2' var_list[11].units = 'g/kg' var_list[12].units = 'unitless' var_list[13].units = 'degC' var_list[14].units = 'degC' var_list[15].units = 'm/s' var_list[16].units = 'W/m2' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'METBK1-hr' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/SBD11/06-METBKA000/telemetered/metbk_hourly' var_list[0].name = 'met_timeflx' var_list[1].name = 'met_rainrte' var_list[2].name = 'met_buoyfls' var_list[3].name = 'met_buoyflx' var_list[4].name = 'met_frshflx' var_list[5].name = 'met_heatflx' var_list[6].name = 'met_latnflx' var_list[7].name = 'met_mommflx' var_list[8].name = 'met_netlirr' var_list[9].name = 'met_rainflx' var_list[10].name = 'met_sensflx' var_list[11].name = 'met_sphum2m' var_list[12].name = 'met_stablty' var_list[13].name = 'met_tempa2m' var_list[14].name = 'met_tempskn' var_list[15].name = 'met_wind10m' var_list[16].name = 'met_netsirr_hourly' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[15].data = np.array([]) var_list[16].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'mm/hr' var_list[2].units = 'W/m2' var_list[3].units = 'W/m2' var_list[4].units = 'mm/hr' var_list[5].units = 'W/m2' var_list[6].units = 'W/m2' var_list[7].units = 'N/m2' var_list[8].units = 'W/m2' var_list[9].units = 'W/m2' var_list[10].units = 'W/m2' var_list[11].units = 'g/kg' var_list[12].units = 'unitless' var_list[13].units = 'degC' var_list[14].units = 'degC' var_list[15].units = 'm/s' var_list[16].units = 'W/m2' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'METBK1-hr' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/SBD11/06-METBKA000/recovered_host/metbk_hourly' var_list[0].name = 'met_timeflx' var_list[1].name = 'met_rainrte' var_list[2].name = 'met_buoyfls' var_list[3].name = 'met_buoyflx' var_list[4].name = 'met_frshflx' var_list[5].name = 'met_heatflx' var_list[6].name = 'met_latnflx' var_list[7].name = 'met_mommflx' var_list[8].name = 'met_netlirr' var_list[9].name = 'met_rainflx' var_list[10].name = 'met_sensflx' var_list[11].name = 'met_sphum2m' var_list[12].name = 'met_stablty' var_list[13].name = 'met_tempa2m' var_list[14].name = 'met_tempskn' var_list[15].name = 'met_wind10m' var_list[16].name = 'met_netsirr_hourly' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[15].data = np.array([]) var_list[16].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'mm/hr' var_list[2].units = 'W/m2' var_list[3].units = 'W/m2' var_list[4].units = 'mm/hr' var_list[5].units = 'W/m2' var_list[6].units = 'W/m2' var_list[7].units = 'N/m2' var_list[8].units = 'W/m2' var_list[9].units = 'W/m2' var_list[10].units = 'W/m2' var_list[11].units = 'g/kg' var_list[12].units = 'unitless' var_list[13].units = 'degC' var_list[14].units = 'degC' var_list[15].units = 'm/s' var_list[16].units = 'W/m2' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'METBK1-hr' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/SBD11/06-METBKA000/telemetered/metbk_hourly' var_list[0].name = 'met_timeflx' var_list[1].name = 'met_rainrte' var_list[2].name = 'met_buoyfls' var_list[3].name = 'met_buoyflx' var_list[4].name = 'met_frshflx' var_list[5].name = 'met_heatflx' var_list[6].name = 'met_latnflx' var_list[7].name = 'met_mommflx' var_list[8].name = 'met_netlirr' var_list[9].name = 'met_rainflx' var_list[10].name = 'met_sensflx' var_list[11].name = 'met_sphum2m' var_list[12].name = 'met_stablty' var_list[13].name = 'met_tempa2m' var_list[14].name = 'met_tempskn' var_list[15].name = 'met_wind10m' var_list[16].name = 'met_netsirr_hourly' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[15].data = np.array([]) var_list[16].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'mm/hr' var_list[2].units = 'W/m2' var_list[3].units = 'W/m2' var_list[4].units = 'mm/hr' var_list[5].units = 'W/m2' var_list[6].units = 'W/m2' var_list[7].units = 'N/m2' var_list[8].units = 'W/m2' var_list[9].units = 'W/m2' var_list[10].units = 'W/m2' var_list[11].units = 'g/kg' var_list[12].units = 'unitless' var_list[13].units = 'degC' var_list[14].units = 'degC' var_list[15].units = 'm/s' var_list[16].units = 'W/m2' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'METBK1-hr' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/SBD11/06-METBKA000/recovered_host/metbk_hourly' var_list[0].name = 'met_timeflx' var_list[1].name = 'met_rainrte' var_list[2].name = 'met_buoyfls' var_list[3].name = 'met_buoyflx' var_list[4].name = 'met_frshflx' var_list[5].name = 'met_heatflx' var_list[6].name = 'met_latnflx' var_list[7].name = 'met_mommflx' var_list[8].name = 'met_netlirr' var_list[9].name = 'met_rainflx' var_list[10].name = 'met_sensflx' var_list[11].name = 'met_sphum2m' var_list[12].name = 'met_stablty' var_list[13].name = 'met_tempa2m' var_list[14].name = 'met_tempskn' var_list[15].name = 'met_wind10m' var_list[16].name = 'met_netsirr_hourly' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[15].data = np.array([]) var_list[16].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'mm/hr' var_list[2].units = 'W/m2' var_list[3].units = 'W/m2' var_list[4].units = 'mm/hr' var_list[5].units = 'W/m2' var_list[6].units = 'W/m2' var_list[7].units = 'N/m2' var_list[8].units = 'W/m2' var_list[9].units = 'W/m2' var_list[10].units = 'W/m2' var_list[11].units = 'g/kg' var_list[12].units = 'unitless' var_list[13].units = 'degC' var_list[14].units = 'degC' var_list[15].units = 'm/s' var_list[16].units = 'W/m2' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'METBK1-hr' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/SBD11/06-METBKA000/telemetered/metbk_hourly' var_list[0].name = 'met_timeflx' var_list[1].name = 'met_rainrte' var_list[2].name = 'met_buoyfls' var_list[3].name = 'met_buoyflx' var_list[4].name = 'met_frshflx' var_list[5].name = 'met_heatflx' var_list[6].name = 'met_latnflx' var_list[7].name = 'met_mommflx' var_list[8].name = 'met_netlirr' var_list[9].name = 'met_rainflx' var_list[10].name = 'met_sensflx' var_list[11].name = 'met_sphum2m' var_list[12].name = 'met_stablty' var_list[13].name = 'met_tempa2m' var_list[14].name = 'met_tempskn' var_list[15].name = 'met_wind10m' var_list[16].name = 'met_netsirr_hourly' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[15].data = np.array([]) var_list[16].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'mm/hr' var_list[2].units = 'W/m2' var_list[3].units = 'W/m2' var_list[4].units = 'mm/hr' var_list[5].units = 'W/m2' var_list[6].units = 'W/m2' var_list[7].units = 'N/m2' var_list[8].units = 'W/m2' var_list[9].units = 'W/m2' var_list[10].units = 'W/m2' var_list[11].units = 'g/kg' var_list[12].units = 'unitless' var_list[13].units = 'degC' var_list[14].units = 'degC' var_list[15].units = 'm/s' var_list[16].units = 'W/m2' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'METBK1-hr' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/SBD11/06-METBKA000/recovered_host/metbk_hourly' var_list[0].name = 'met_timeflx' var_list[1].name = 'met_rainrte' var_list[2].name = 'met_buoyfls' var_list[3].name = 'met_buoyflx' var_list[4].name = 'met_frshflx' var_list[5].name = 'met_heatflx' var_list[6].name = 'met_latnflx' var_list[7].name = 'met_mommflx' var_list[8].name = 'met_netlirr' var_list[9].name = 'met_rainflx' var_list[10].name = 'met_sensflx' var_list[11].name = 'met_sphum2m' var_list[12].name = 'met_stablty' var_list[13].name = 'met_tempa2m' var_list[14].name = 'met_tempskn' var_list[15].name = 'met_wind10m' var_list[16].name = 'met_netsirr_hourly' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[12].data = np.array([]) var_list[13].data = np.array([]) var_list[14].data = np.array([]) var_list[15].data = np.array([]) var_list[16].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'mm/hr' var_list[2].units = 'W/m2' var_list[3].units = 'W/m2' var_list[4].units = 'mm/hr' var_list[5].units = 'W/m2' var_list[6].units = 'W/m2' var_list[7].units = 'N/m2' var_list[8].units = 'W/m2' var_list[9].units = 'W/m2' var_list[10].units = 'W/m2' var_list[11].units = 'g/kg' var_list[12].units = 'unitless' var_list[13].units = 'degC' var_list[14].units = 'degC' var_list[15].units = 'm/s' var_list[16].units = 'W/m2' elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_MeanDir' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_mean_directional' var_list[0].name = 'time' var_list[1].name = 'mean_direction' var_list[2].name = 'number_bands' var_list[3].name = 'initial_frequency' var_list[4].name = 'frequency_spacing' var_list[5].name = 'psd_mean_directional' var_list[6].name = 'mean_direction_array' var_list[7].name = 'directional_spread_array' var_list[8].name = 'spread_direction' var_list[9].name = 'wavss_a_directional_frequency' var_list[10].name = 'wavss_a_corrected_mean_wave_direction' var_list[11].name = 'wavss_a_corrected_directional_wave_direction' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degrees' var_list[2].units = '1' var_list[3].units = 'Hz' var_list[4].units = 'Hz' var_list[5].units = 'm2 Hz-1' var_list[6].units = 'degrees' var_list[7].units = 'degrees' var_list[8].units = 'degrees' var_list[9].units = 'Hz' var_list[10].units = 'deg' var_list[11].units = 'deg' elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_MeanDir' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_mean_directional_recovered' var_list[0].name = 'time' var_list[1].name = 'mean_direction' var_list[2].name = 'number_bands' var_list[3].name = 'initial_frequency' var_list[4].name = 'frequency_spacing' var_list[5].name = 'psd_mean_directional' var_list[6].name = 'mean_direction_array' var_list[7].name = 'directional_spread_array' var_list[8].name = 'spread_direction' var_list[9].name = 'wavss_a_directional_frequency' var_list[10].name = 'wavss_a_corrected_mean_wave_direction' var_list[11].name = 'wavss_a_corrected_directional_wave_direction' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degrees' var_list[2].units = '1' var_list[3].units = 'Hz' var_list[4].units = 'Hz' var_list[5].units = 'm2 Hz-1' var_list[6].units = 'degrees' var_list[7].units = 'degrees' var_list[8].units = 'degrees' var_list[9].units = 'Hz' var_list[10].units = 'deg' var_list[11].units = 'deg' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_MeanDir' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_mean_directional' var_list[0].name = 'time' var_list[1].name = 'mean_direction' var_list[2].name = 'number_bands' var_list[3].name = 'initial_frequency' var_list[4].name = 'frequency_spacing' var_list[5].name = 'psd_mean_directional' var_list[6].name = 'mean_direction_array' var_list[7].name = 'directional_spread_array' var_list[8].name = 'spread_direction' var_list[9].name = 'wavss_a_directional_frequency' var_list[10].name = 'wavss_a_corrected_mean_wave_direction' var_list[11].name = 'wavss_a_corrected_directional_wave_direction' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degrees' var_list[2].units = '1' var_list[3].units = 'Hz' var_list[4].units = 'Hz' var_list[5].units = 'm2 Hz-1' var_list[6].units = 'degrees' var_list[7].units = 'degrees' var_list[8].units = 'degrees' var_list[9].units = 'Hz' var_list[10].units = 'deg' var_list[11].units = 'deg' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_MeanDir' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_mean_directional_recovered' var_list[0].name = 'time' var_list[1].name = 'mean_direction' var_list[2].name = 'number_bands' var_list[3].name = 'initial_frequency' var_list[4].name = 'frequency_spacing' var_list[5].name = 'psd_mean_directional' var_list[6].name = 'mean_direction_array' var_list[7].name = 'directional_spread_array' var_list[8].name = 'spread_direction' var_list[9].name = 'wavss_a_directional_frequency' var_list[10].name = 'wavss_a_corrected_mean_wave_direction' var_list[11].name = 'wavss_a_corrected_directional_wave_direction' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degrees' var_list[2].units = '1' var_list[3].units = 'Hz' var_list[4].units = 'Hz' var_list[5].units = 'm2 Hz-1' var_list[6].units = 'degrees' var_list[7].units = 'degrees' var_list[8].units = 'degrees' var_list[9].units = 'Hz' var_list[10].units = 'deg' var_list[11].units = 'deg' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_MeanDir' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_mean_directional' var_list[0].name = 'time' var_list[1].name = 'mean_direction' var_list[2].name = 'number_bands' var_list[3].name = 'initial_frequency' var_list[4].name = 'frequency_spacing' var_list[5].name = 'psd_mean_directional' var_list[6].name = 'mean_direction_array' var_list[7].name = 'directional_spread_array' var_list[8].name = 'spread_direction' var_list[9].name = 'wavss_a_directional_frequency' var_list[10].name = 'wavss_a_corrected_mean_wave_direction' var_list[11].name = 'wavss_a_corrected_directional_wave_direction' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degrees' var_list[2].units = '1' var_list[3].units = 'Hz' var_list[4].units = 'Hz' var_list[5].units = 'm2 Hz-1' var_list[6].units = 'degrees' var_list[7].units = 'degrees' var_list[8].units = 'degrees' var_list[9].units = 'Hz' var_list[10].units = 'deg' var_list[11].units = 'deg' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_MeanDir' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_mean_directional_recovered' var_list[0].name = 'time' var_list[1].name = 'mean_direction' var_list[2].name = 'number_bands' var_list[3].name = 'initial_frequency' var_list[4].name = 'frequency_spacing' var_list[5].name = 'psd_mean_directional' var_list[6].name = 'mean_direction_array' var_list[7].name = 'directional_spread_array' var_list[8].name = 'spread_direction' var_list[9].name = 'wavss_a_directional_frequency' var_list[10].name = 'wavss_a_corrected_mean_wave_direction' var_list[11].name = 'wavss_a_corrected_directional_wave_direction' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degrees' var_list[2].units = '1' var_list[3].units = 'Hz' var_list[4].units = 'Hz' var_list[5].units = 'm2 Hz-1' var_list[6].units = 'degrees' var_list[7].units = 'degrees' var_list[8].units = 'degrees' var_list[9].units = 'Hz' var_list[10].units = 'deg' var_list[11].units = 'deg' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_MeanDir' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_mean_directional' var_list[0].name = 'time' var_list[1].name = 'mean_direction' var_list[2].name = 'number_bands' var_list[3].name = 'initial_frequency' var_list[4].name = 'frequency_spacing' var_list[5].name = 'psd_mean_directional' var_list[6].name = 'mean_direction_array' var_list[7].name = 'directional_spread_array' var_list[8].name = 'spread_direction' var_list[9].name = 'wavss_a_directional_frequency' var_list[10].name = 'wavss_a_corrected_mean_wave_direction' var_list[11].name = 'wavss_a_corrected_directional_wave_direction' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degrees' var_list[2].units = '1' var_list[3].units = 'Hz' var_list[4].units = 'Hz' var_list[5].units = 'm2 Hz-1' var_list[6].units = 'degrees' var_list[7].units = 'degrees' var_list[8].units = 'degrees' var_list[9].units = 'Hz' var_list[10].units = 'deg' var_list[11].units = 'deg' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_MeanDir' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_mean_directional_recovered' var_list[0].name = 'time' var_list[1].name = 'mean_direction' var_list[2].name = 'number_bands' var_list[3].name = 'initial_frequency' var_list[4].name = 'frequency_spacing' var_list[5].name = 'psd_mean_directional' var_list[6].name = 'mean_direction_array' var_list[7].name = 'directional_spread_array' var_list[8].name = 'spread_direction' var_list[9].name = 'wavss_a_directional_frequency' var_list[10].name = 'wavss_a_corrected_mean_wave_direction' var_list[11].name = 'wavss_a_corrected_directional_wave_direction' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[11].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degrees' var_list[2].units = '1' var_list[3].units = 'Hz' var_list[4].units = 'Hz' var_list[5].units = 'm2 Hz-1' var_list[6].units = 'degrees' var_list[7].units = 'degrees' var_list[8].units = 'degrees' var_list[9].units = 'Hz' var_list[10].units = 'deg' var_list[11].units = 'deg' elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_NonDir' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_non_directional' var_list[0].name = 'time' var_list[1].name = 'number_bands' var_list[2].name = 'initial_frequency' var_list[3].name = 'frequency_spacing' var_list[4].name = 'psd_non_directional' var_list[5].name = 'wavss_a_non_directional_frequency' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'Hz' var_list[3].units = 'Hz' var_list[4].units = 'm2 Hz-1' var_list[5].units = 'Hz' elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_NonDir' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_non_directional_recovered' var_list[0].name = 'time' var_list[1].name = 'number_bands' var_list[2].name = 'initial_frequency' var_list[3].name = 'frequency_spacing' var_list[4].name = 'psd_non_directional' var_list[5].name = 'wavss_a_non_directional_frequency' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'Hz' var_list[3].units = 'Hz' var_list[4].units = 'm2 Hz-1' var_list[5].units = 'Hz' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_NonDir' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_non_directional' var_list[0].name = 'time' var_list[1].name = 'number_bands' var_list[2].name = 'initial_frequency' var_list[3].name = 'frequency_spacing' var_list[4].name = 'psd_non_directional' var_list[5].name = 'wavss_a_non_directional_frequency' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'Hz' var_list[3].units = 'Hz' var_list[4].units = 'm2 Hz-1' var_list[5].units = 'Hz' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_NonDir' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_non_directional_recovered' var_list[0].name = 'time' var_list[1].name = 'number_bands' var_list[2].name = 'initial_frequency' var_list[3].name = 'frequency_spacing' var_list[4].name = 'psd_non_directional' var_list[5].name = 'wavss_a_non_directional_frequency' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'Hz' var_list[3].units = 'Hz' var_list[4].units = 'm2 Hz-1' var_list[5].units = 'Hz' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_NonDir' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_non_directional' var_list[0].name = 'time' var_list[1].name = 'number_bands' var_list[2].name = 'initial_frequency' var_list[3].name = 'frequency_spacing' var_list[4].name = 'psd_non_directional' var_list[5].name = 'wavss_a_non_directional_frequency' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'Hz' var_list[3].units = 'Hz' var_list[4].units = 'm2 Hz-1' var_list[5].units = 'Hz' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_NonDir' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_non_directional_recovered' var_list[0].name = 'time' var_list[1].name = 'number_bands' var_list[2].name = 'initial_frequency' var_list[3].name = 'frequency_spacing' var_list[4].name = 'psd_non_directional' var_list[5].name = 'wavss_a_non_directional_frequency' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'Hz' var_list[3].units = 'Hz' var_list[4].units = 'm2 Hz-1' var_list[5].units = 'Hz' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_NonDir' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_non_directional' var_list[0].name = 'time' var_list[1].name = 'number_bands' var_list[2].name = 'initial_frequency' var_list[3].name = 'frequency_spacing' var_list[4].name = 'psd_non_directional' var_list[5].name = 'wavss_a_non_directional_frequency' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'Hz' var_list[3].units = 'Hz' var_list[4].units = 'm2 Hz-1' var_list[5].units = 'Hz' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_NonDir' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_non_directional_recovered' var_list[0].name = 'time' var_list[1].name = 'number_bands' var_list[2].name = 'initial_frequency' var_list[3].name = 'frequency_spacing' var_list[4].name = 'psd_non_directional' var_list[5].name = 'wavss_a_non_directional_frequency' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'Hz' var_list[3].units = 'Hz' var_list[4].units = 'm2 Hz-1' var_list[5].units = 'Hz' elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_Motion' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_motion' var_list[0].name = 'time' var_list[1].name = 'number_time_samples' var_list[2].name = 'initial_time' var_list[3].name = 'time_spacing' var_list[4].name = 'solution_found' var_list[5].name = 'heave_offset_array' var_list[6].name = 'north_offset_array' var_list[7].name = 'east_offset_array' var_list[8].name = 'wavss_a_buoymotion_time' var_list[9].name = 'wavss_a_magcor_buoymotion_x' var_list[10].name = 'wavss_a_magcor_buoymotion_y' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'sec' var_list[3].units = 'sec' var_list[4].units = '1' var_list[5].units = 'm' var_list[6].units = 'm' var_list[7].units = 'm' var_list[8].units = 'seconds since 1900-01-01' var_list[9].units = 'm' var_list[10].units = 'm' elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_Motion' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_motion_recovered' var_list[0].name = 'time' var_list[1].name = 'number_time_samples' var_list[2].name = 'initial_time' var_list[3].name = 'time_spacing' var_list[4].name = 'solution_found' var_list[5].name = 'heave_offset_array' var_list[6].name = 'north_offset_array' var_list[7].name = 'east_offset_array' var_list[8].name = 'wavss_a_buoymotion_time' var_list[9].name = 'wavss_a_magcor_buoymotion_x' var_list[10].name = 'wavss_a_magcor_buoymotion_y' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'sec' var_list[3].units = 'sec' var_list[4].units = '1' var_list[5].units = 'm' var_list[6].units = 'm' var_list[7].units = 'm' var_list[8].units = 'seconds since 1900-01-01' var_list[9].units = 'm' var_list[10].units = 'm' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_Motion' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_motion' var_list[0].name = 'time' var_list[1].name = 'number_time_samples' var_list[2].name = 'initial_time' var_list[3].name = 'time_spacing' var_list[4].name = 'solution_found' var_list[5].name = 'heave_offset_array' var_list[6].name = 'north_offset_array' var_list[7].name = 'east_offset_array' var_list[8].name = 'wavss_a_buoymotion_time' var_list[9].name = 'wavss_a_magcor_buoymotion_x' var_list[10].name = 'wavss_a_magcor_buoymotion_y' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'sec' var_list[3].units = 'sec' var_list[4].units = '1' var_list[5].units = 'm' var_list[6].units = 'm' var_list[7].units = 'm' var_list[8].units = 'seconds since 1900-01-01' var_list[9].units = 'm' var_list[10].units = 'm' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_Motion' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_motion_recovered' var_list[0].name = 'time' var_list[1].name = 'number_time_samples' var_list[2].name = 'initial_time' var_list[3].name = 'time_spacing' var_list[4].name = 'solution_found' var_list[5].name = 'heave_offset_array' var_list[6].name = 'north_offset_array' var_list[7].name = 'east_offset_array' var_list[8].name = 'wavss_a_buoymotion_time' var_list[9].name = 'wavss_a_magcor_buoymotion_x' var_list[10].name = 'wavss_a_magcor_buoymotion_y' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'sec' var_list[3].units = 'sec' var_list[4].units = '1' var_list[5].units = 'm' var_list[6].units = 'm' var_list[7].units = 'm' var_list[8].units = 'seconds since 1900-01-01' var_list[9].units = 'm' var_list[10].units = 'm' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_Motion' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_motion' var_list[0].name = 'time' var_list[1].name = 'number_time_samples' var_list[2].name = 'initial_time' var_list[3].name = 'time_spacing' var_list[4].name = 'solution_found' var_list[5].name = 'heave_offset_array' var_list[6].name = 'north_offset_array' var_list[7].name = 'east_offset_array' var_list[8].name = 'wavss_a_buoymotion_time' var_list[9].name = 'wavss_a_magcor_buoymotion_x' var_list[10].name = 'wavss_a_magcor_buoymotion_y' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'sec' var_list[3].units = 'sec' var_list[4].units = '1' var_list[5].units = 'm' var_list[6].units = 'm' var_list[7].units = 'm' var_list[8].units = 'seconds since 1900-01-01' var_list[9].units = 'm' var_list[10].units = 'm' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_Motion' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_motion_recovered' var_list[0].name = 'time' var_list[1].name = 'number_time_samples' var_list[2].name = 'initial_time' var_list[3].name = 'time_spacing' var_list[4].name = 'solution_found' var_list[5].name = 'heave_offset_array' var_list[6].name = 'north_offset_array' var_list[7].name = 'east_offset_array' var_list[8].name = 'wavss_a_buoymotion_time' var_list[9].name = 'wavss_a_magcor_buoymotion_x' var_list[10].name = 'wavss_a_magcor_buoymotion_y' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'sec' var_list[3].units = 'sec' var_list[4].units = '1' var_list[5].units = 'm' var_list[6].units = 'm' var_list[7].units = 'm' var_list[8].units = 'seconds since 1900-01-01' var_list[9].units = 'm' var_list[10].units = 'm' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_Motion' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_motion' var_list[0].name = 'time' var_list[1].name = 'number_time_samples' var_list[2].name = 'initial_time' var_list[3].name = 'time_spacing' var_list[4].name = 'solution_found' var_list[5].name = 'heave_offset_array' var_list[6].name = 'north_offset_array' var_list[7].name = 'east_offset_array' var_list[8].name = 'wavss_a_buoymotion_time' var_list[9].name = 'wavss_a_magcor_buoymotion_x' var_list[10].name = 'wavss_a_magcor_buoymotion_y' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'sec' var_list[3].units = 'sec' var_list[4].units = '1' var_list[5].units = 'm' var_list[6].units = 'm' var_list[7].units = 'm' var_list[8].units = 'seconds since 1900-01-01' var_list[9].units = 'm' var_list[10].units = 'm' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_Motion' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_motion_recovered' var_list[0].name = 'time' var_list[1].name = 'number_time_samples' var_list[2].name = 'initial_time' var_list[3].name = 'time_spacing' var_list[4].name = 'solution_found' var_list[5].name = 'heave_offset_array' var_list[6].name = 'north_offset_array' var_list[7].name = 'east_offset_array' var_list[8].name = 'wavss_a_buoymotion_time' var_list[9].name = 'wavss_a_magcor_buoymotion_x' var_list[10].name = 'wavss_a_magcor_buoymotion_y' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[8].data = np.array([]) var_list[9].data = np.array([]) var_list[10].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'sec' var_list[3].units = 'sec' var_list[4].units = '1' var_list[5].units = 'm' var_list[6].units = 'm' var_list[7].units = 'm' var_list[8].units = 'seconds since 1900-01-01' var_list[9].units = 'm' var_list[10].units = 'm' elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_Fourier' and method == 'Telemetered': uframe_dataset_name = 'CE02SHSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_fourier' var_list[0].name = 'time' var_list[1].name = 'number_bands' var_list[2].name = 'initial_frequency' var_list[3].name = 'frequency_spacing' var_list[4].name = 'number_directional_bands' var_list[5].name = 'initial_directional_frequency' var_list[6].name = 'directional_frequency_spacing' var_list[7].name = 'fourier_coefficient_2d_array' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'Hz' var_list[3].units = 'Hz' var_list[4].units = '1' var_list[5].units = 'Hz' var_list[6].units = 'Hz' var_list[7].units = '1' elif platform_name == 'CE02SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_Fourier' and method == 'RecoveredHost': uframe_dataset_name = 'CE02SHSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_fourier_recovered' var_list[0].name = 'time' var_list[1].name = 'number_bands' var_list[2].name = 'initial_frequency' var_list[3].name = 'frequency_spacing' var_list[4].name = 'number_directional_bands' var_list[5].name = 'initial_directional_frequency' var_list[6].name = 'directional_frequency_spacing' var_list[7].name = 'fourier_coefficient_2d_array' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'Hz' var_list[3].units = 'Hz' var_list[4].units = '1' var_list[5].units = 'Hz' var_list[6].units = 'Hz' var_list[7].units = '1' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_Fourier' and method == 'Telemetered': uframe_dataset_name = 'CE04OSSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_fourier' var_list[0].name = 'time' var_list[1].name = 'number_bands' var_list[2].name = 'initial_frequency' var_list[3].name = 'frequency_spacing' var_list[4].name = 'number_directional_bands' var_list[5].name = 'initial_directional_frequency' var_list[6].name = 'directional_frequency_spacing' var_list[7].name = 'fourier_coefficient_2d_array' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'Hz' var_list[3].units = 'Hz' var_list[4].units = '1' var_list[5].units = 'Hz' var_list[6].units = 'Hz' var_list[7].units = '1' elif platform_name == 'CE04OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_Fourier' and method == 'RecoveredHost': uframe_dataset_name = 'CE04OSSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_fourier_recovered' var_list[0].name = 'time' var_list[1].name = 'number_bands' var_list[2].name = 'initial_frequency' var_list[3].name = 'frequency_spacing' var_list[4].name = 'number_directional_bands' var_list[5].name = 'initial_directional_frequency' var_list[6].name = 'directional_frequency_spacing' var_list[7].name = 'fourier_coefficient_2d_array' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'Hz' var_list[3].units = 'Hz' var_list[4].units = '1' var_list[5].units = 'Hz' var_list[6].units = 'Hz' var_list[7].units = '1' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_Fourier' and method == 'Telemetered': uframe_dataset_name = 'CE09OSSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_fourier' var_list[0].name = 'time' var_list[1].name = 'number_bands' var_list[2].name = 'initial_frequency' var_list[3].name = 'frequency_spacing' var_list[4].name = 'number_directional_bands' var_list[5].name = 'initial_directional_frequency' var_list[6].name = 'directional_frequency_spacing' var_list[7].name = 'fourier_coefficient_2d_array' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'Hz' var_list[3].units = 'Hz' var_list[4].units = '1' var_list[5].units = 'Hz' var_list[6].units = 'Hz' var_list[7].units = '1' elif platform_name == 'CE09OSSM' and node == 'BUOY' and instrument_class == 'WAVSS_Fourier' and method == 'RecoveredHost': uframe_dataset_name = 'CE09OSSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_fourier_recovered' var_list[0].name = 'time' var_list[1].name = 'number_bands' var_list[2].name = 'initial_frequency' var_list[3].name = 'frequency_spacing' var_list[4].name = 'number_directional_bands' var_list[5].name = 'initial_directional_frequency' var_list[6].name = 'directional_frequency_spacing' var_list[7].name = 'fourier_coefficient_2d_array' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'Hz' var_list[3].units = 'Hz' var_list[4].units = '1' var_list[5].units = 'Hz' var_list[6].units = 'Hz' var_list[7].units = '1' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_Fourier' and method == 'Telemetered': uframe_dataset_name = 'CE07SHSM/SBD12/05-WAVSSA000/telemetered/wavss_a_dcl_fourier' var_list[0].name = 'time' var_list[1].name = 'number_bands' var_list[2].name = 'initial_frequency' var_list[3].name = 'frequency_spacing' var_list[4].name = 'number_directional_bands' var_list[5].name = 'initial_directional_frequency' var_list[6].name = 'directional_frequency_spacing' var_list[7].name = 'fourier_coefficient_2d_array' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'Hz' var_list[3].units = 'Hz' var_list[4].units = '1' var_list[5].units = 'Hz' var_list[6].units = 'Hz' var_list[7].units = '1' elif platform_name == 'CE07SHSM' and node == 'BUOY' and instrument_class == 'WAVSS_Fourier' and method == 'RecoveredHost': uframe_dataset_name = 'CE07SHSM/SBD12/05-WAVSSA000/recovered_host/wavss_a_dcl_fourier_recovered' var_list[0].name = 'time' var_list[1].name = 'number_bands' var_list[2].name = 'initial_frequency' var_list[3].name = 'frequency_spacing' var_list[4].name = 'number_directional_bands' var_list[5].name = 'initial_directional_frequency' var_list[6].name = 'directional_frequency_spacing' var_list[7].name = 'fourier_coefficient_2d_array' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[7].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = '1' var_list[2].units = 'Hz' var_list[3].units = 'Hz' var_list[4].units = '1' var_list[5].units = 'Hz' var_list[6].units = 'Hz' var_list[7].units = '1' elif platform_name == 'CE04OSPS' and node == 'PROFILER' and instrument_class == 'CTD' and method == 'Streamed': uframe_dataset_name = 'CE04OSPS/SF01B/2A-CTDPFA107/streamed/ctdpf_sbe43_sample' var_list[0].name = 'time' var_list[1].name = 'seawater_temperature' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'seawater_pressure' var_list[5].name = 'seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE04OSPD' and node == 'PROFILER' and instrument_class == 'CTD' and method == 'RecoveredInst': uframe_dataset_name = 'CE04OSPD/DP01B/01-CTDPFL105/recovered_inst/dpc_ctd_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'dpc_ctd_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE04OSPD' and node == 'PROFILER' and instrument_class == 'CTD' and method == 'RecoveredWFP': uframe_dataset_name = 'CE04OSPD/DP01B/01-CTDPFL105/recovered_wfp/dpc_ctd_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'density' var_list[4].name = 'pressure' var_list[5].name = 'dpc_ctd_seawater_conductivity' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'kg/m3' var_list[4].units = 'dbar' var_list[5].units = 'S/m' elif platform_name == 'CE04OSPS' and node == 'PROFILER' and instrument_class == 'DOSTA' and method == 'Streamed': uframe_dataset_name = 'CE04OSPS/SF01B/2A-CTDPFA107/streamed/ctdpf_sbe43_sample' var_list[0].name = 'time' var_list[1].name = 'corrected_dissolved_oxygen' var_list[2].name = 'seawater_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'dbar' elif platform_name == 'CE04OSPD' and node == 'PROFILER' and instrument_class == 'DOSTA' and method == 'RecoveredInst': uframe_dataset_name = 'CE04OSPD/DP01B/06-DOSTAD105/recovered_inst/dpc_optode_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'dbar' elif platform_name == 'CE04OSPD' and node == 'PROFILER' and instrument_class == 'DOSTA' and method == 'RecoveredWFP': uframe_dataset_name = 'CE04OSPD/DP01B/06-DOSTAD105/recovered_wfp/dpc_optode_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'dissolved_oxygen' var_list[2].name = 'dosta_abcdjm_cspp_tc_oxygen' var_list[3].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/kg' var_list[2].units = 'umol/L' var_list[3].units = 'dbar' elif platform_name == 'CE04OSPS' and node == 'PROFILER' and instrument_class == 'FLORT' and method == 'Streamed': uframe_dataset_name = 'CE04OSPS/SF01B/3A-FLORTD104/streamed/flort_d_data_record' var_list[0].name = 'time' var_list[1].name = 'seawater_scattering_coefficient' var_list[2].name = 'fluorometric_chlorophyll_a' var_list[3].name = 'fluorometric_cdom' var_list[4].name = 'total_volume_scattering_coefficient' var_list[5].name = 'optical_backscatter' var_list[6].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[6].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'm-1' var_list[2].units = 'ug/L' var_list[3].units = 'ppb' var_list[4].units = 'm-1 sr-1' var_list[5].units = 'm-1' var_list[6].units = 'dbar' elif platform_name == 'CE04OSPD' and node == 'PROFILER' and instrument_class == 'FLORT' and method == 'RecoveredInst': uframe_dataset_name = 'CE04OSPD/DP01B/04-FLNTUA103/recovered_inst/dpc_flnturtd_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'flntu_x_mmp_cds_fluorometric_chlorophyll_a' var_list[2].name = 'flntu_x_mmp_cds_total_volume_scattering_coefficient ' var_list[3].name = 'flntu_x_mmp_cds_bback_total' var_list[4].name = 'flcdr_x_mmp_cds_fluorometric_cdom' var_list[5].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'ug/L' var_list[2].units = 'm-1 sr-1' var_list[3].units = 'm-1' var_list[4].units = 'ppb' var_list[5].units = 'dbar' elif platform_name == 'CE04OSPD' and node == 'PROFILER' and instrument_class == 'FLORT' and method == 'RecoveredWFP': uframe_dataset_name = 'CE04OSPD/DP01B/03-FLCDRA103/recovered_wfp/dpc_flcdrtd_instrument_recovered' var_list[0].name = 'time' var_list[1].name = 'flntu_x_mmp_cds_fluorometric_chlorophyll_a' var_list[2].name = 'flntu_x_mmp_cds_total_volume_scattering_coefficient ' var_list[3].name = 'flntu_x_mmp_cds_bback_total' var_list[4].name = 'flcdr_x_mmp_cds_fluorometric_cdom' var_list[5].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data = np.array([]) var_list[5].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'ug/L' var_list[2].units = 'm-1 sr-1' var_list[3].units = 'm-1' var_list[4].units = 'ppb' var_list[5].units = 'dbar' elif platform_name == 'CE04OSPS' and node == 'PROFILER' and instrument_class == 'PHSEN' and method == 'Streamed': uframe_dataset_name = 'CE04OSPS/SF01B/2B-PHSENA108/streamed/phsen_data_record' var_list[0].name = 'time' var_list[1].name = 'phsen_thermistor_temperature' var_list[2].name = 'ph_seawater' var_list[3].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'unitless' var_list[3].units = 'dbar' elif platform_name == 'CE04OSPS' and node == 'PROFILER' and instrument_class == 'PARAD' and method == 'Streamed': uframe_dataset_name = 'CE04OSPS/SF01B/3C-PARADA102/streamed/parad_sa_sample' var_list[0].name = 'time' var_list[1].name = 'par_counts_output' var_list[2].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol photons m-2 s-1' var_list[2].units = 'dbar' elif platform_name == 'CE04OSPS' and node == 'PROFILER' and instrument_class == 'SPKIR' and method == 'Streamed': uframe_dataset_name = 'CE04OSPS/SF01B/3D-SPKIRA102/streamed/spkir_data_record' var_list[0].name = 'time' var_list[1].name = 'spkir_downwelling_vector' var_list[2].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'uW cm-2 nm-1' var_list[2].units = 'dbar' elif platform_name == 'CE04OSPS' and node == 'PROFILER' and instrument_class == 'NUTNR' and method == 'Streamed': uframe_dataset_name = 'CE04OSPS/SF01B/4A-NUTNRA102/streamed/nutnr_a_sample' var_list[0].name = 'time' var_list[1].name = 'nitrate_concentration' var_list[2].name = 'salinity_corrected_nitrate' var_list[3].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'umol/L' var_list[2].units = 'umol/L' var_list[3].units = 'dbar' elif platform_name == 'CE04OSPS' and node == 'PROFILER' and instrument_class == 'PCO2W' and method == 'Streamed': uframe_dataset_name = 'CE04OSPS/SF01B/4F-PCO2WA102/streamed/pco2w_a_sami_data_record' var_list[0].name = 'time' var_list[1].name = 'pco2w_thermistor_temperature' var_list[2].name = 'pco2_seawater' var_list[3].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[0].units = 'seconds since 1900-01-01' var_list[1].units = 'degC' var_list[2].units = 'uatm' var_list[3].units = 'dbar' elif platform_name == 'CE04OSPS' and node == 'PROFILER' and instrument_class == 'VELPT' and method == 'Streamed': uframe_dataset_name = 'CE04OSPS/SF01B/4B-VELPTD106/streamed/velpt_velocity_data' var_list[0].name = 'time' var_list[1].name = 'velpt_d_eastward_velocity' var_list[2].name = 'velpt_d_northward_velocity' var_list[3].name = 'velpt_d_upward_velocity' var_list[4].name = 'heading_decidegree' var_list[5].name = 'roll_decidegree' var_list[6].name = 'pitch_decidegree' var_list[7].name = 'temperature_centidegree' var_list[8].name = 'pressure_mbar' var_list[9].name = 'int_ctd_pressure' var_list[0].data = np.array([]) var_list[1].data = np.array([]) var_list[2].data = np.array([]) var_list[3].data = np.array([]) var_list[4].data =
np.array([])
numpy.array
# Author: <NAME> # Date: 2014-01-17 # pylint: disable=invalid-name, line-too-long """ Class for kernel density estimation. Currently, only Gaussian kernels are implemented. """ from __future__ import absolute_import, division, print_function __license__ = """MIT License Copyright (c) 2014-2019 <NAME> and <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ from copy import copy import numexpr import numpy as np from scipy import linalg from .stat_tools import weighted_cov __all__ = ['gaussian_kde', 'bootstrap_kde'] class gaussian_kde(object): """Representation of a kernel-density estimate using Gaussian kernels. Kernel density estimation is a way to estimate the probability density function (PDF) of a random variable in a non-parametric way. It includes automatic bandwidth determination. Parameters ---------- dataset : array_like Datapoints to estimate from. In case of univariate data this is a 1-D array, otherwise a 2-D array with shape (# of dims, # of data). weights : array_like A 1-D array containing the weights of the data points. This option should be used if data points are weighted in order to calculate the a weighted KDE. adaptive : boolean Should adaptive kernel density estimation be applied? For the implementation see: Algorithm 3.1 in DOI: 10.1214/154957804100000000 weight_adaptive_bw : boolean If using the adaptive kernel density estimation it can be chosen if the adaptive bandwidth should be calculated by the weighted (True) or unweighted (False) dataset. alpha : float The sensitivity parameter alpha in the range [0,1] is needed for the adaptive KDE. Also for this see: Algorithm 3.1 in DOI: 10.1214/154957804100000000 bw_method : str, scalar or callable, optional The method used to calculate the estimator bandwidth. This can be 'scott', 'silverman', a scalar constant or a callable. If a scalar, this will be used directly as `kde.factor`. If a callable, it should take a `gaussian_kde` instance as only parameter and return a scalar. If None (default), 'scott' is used. See Notes for more details. Attributes ---------- dataset : ndarray The dataset with which `gaussian_kde` was initialized. d : int Number of dimensions. n : int Number of datapoints. factor : float The bandwidth factor, obtained from `kde.covariance_factor`, with which the covariance matrix is multiplied. covariance : ndarray The covariance matrix of `dataset`, scaled by the calculated bandwidth (`kde.factor`). inv_cov : ndarray The inverse of `covariance`. local_covariance : ndarray An array of covariance matrices of `dataset` scaled by the calculated adaptive bandwidth. local_inv_cov : ndarray The inverse of `local_covariance`. Methods ------- kde.evaluate(points) : ndarray Evaluate the estimated pdf on a provided set of points. kde(points) : ndarray Same as kde.evaluate(points) kde.set_bandwidth(bw_method='scott') : None Computes the bandwidth, i.e. the coefficient that multiplies the data covariance matrix to obtain the kernel covariance matrix. .. versionadded:: 0.11.0 kde.covariance_factor : float Computes the coefficient (`kde.factor`) that multiplies the data covariance matrix to obtain the kernel covariance matrix. The default is `scotts_factor`. A subclass can overwrite this method to provide a different method, or set it through a call to `kde.set_bandwidth`. kde._compute_adaptive_covariance : None Computes the adaptive bandwidth for `dataset`. Notes ----- Bandwidth selection strongly influences the estimate obtained from the KDE (much more so than the actual shape of the kernel). Bandwidth selection can be done by a "rule of thumb", by cross-validation, by "plug-in methods" or by other means; see [3]_, [4]_ for reviews. `gaussian_kde` uses a rule of thumb, the default is Scott's Rule. Scott's Rule [1]_, implemented as `scotts_factor`, is:: n**(-1./(d+4)), with ``n`` the number of data points and ``d`` the number of dimensions. Silverman's Rule [2]_, implemented as `silverman_factor`, is:: n * (d + 2) / 4.)**(-1. / (d + 4)). Good general descriptions of kernel density estimation can be found in [1]_ and [2]_, the mathematics for this multi-dimensional implementation can be found in [1]_. References ---------- .. [1] <NAME>, "Multivariate Density Estimation: Theory, Practice, and Visualization", John Wiley & Sons, New York, Chicester, 1992. .. [2] <NAME>, "Density Estimation for Statistics and Data Analysis", Vol. 26, Monographs on Statistics and Applied Probability, Chapman and Hall, London, 1986. .. [3] <NAME>, "Bandwidth Selection in Kernel Density Estimation: A Review", CORE and Institut de Statistique, Vol. 19, pp. 1-33, 1993. .. [4] <NAME> and <NAME>, "Bandwidth selection for kernel conditional density estimation", Computational Statistics & Data Analysis, Vol. 36, pp. 279-298, 2001. Examples -------- Generate some random two-dimensional data: >>> from scipy import stats >>> def measure(n): >>> "Measurement model, return two coupled measurements." >>> m1 = np.random.normal(size=n) >>> m2 = np.random.normal(scale=0.5, size=n) >>> return m1+m2, m1-m2 >>> m1, m2 = measure(2000) >>> xmin = m1.min() >>> xmax = m1.max() >>> ymin = m2.min() >>> ymax = m2.max() Perform a kernel density estimate on the data: >>> X, Y = np.mgrid[xmin:xmax:100j, ymin:ymax:100j] >>> positions = np.vstack([X.ravel(), Y.ravel()]) >>> values = np.vstack([m1, m2]) >>> kernel = gaussian_kde(values) >>> Z = np.reshape(kernel(positions).T, X.shape) Plot the results: >>> import matplotlib.pyplot as plt >>> fig = plt.figure() >>> ax = fig.add_subplot(111) >>> ax.imshow(np.rot90(Z), cmap=plt.cm.gist_earth_r, ... extent=[xmin, xmax, ymin, ymax]) >>> ax.plot(m1, m2, 'k.', markersize=2) >>> ax.set_xlim([xmin, xmax]) >>> ax.set_ylim([ymin, ymax]) >>> plt.show() """ def __init__(self, dataset, weights=None, kde_values=None, adaptive=False, weight_adaptive_bw=False, alpha=0.3, bw_method='silverman'): self.inv_cov12 = None self.ds = None self._normalized_weights = None self.dataset = np.atleast_2d(dataset) self.d, self.n = self.dataset.shape max_array_length = 1e8 """Maximum amount of data in memory (~2GB, scales linearly)""" self.m_max = np.int(np.floor(max_array_length/self.n)) if self.n > max_array_length: raise ValueError("`dataset` is too large (too many array entries)!") if weights is not None and len(weights) == self.n: self.weights = weights elif weights is None: self.weights = np.ones(self.n) else: raise ValueError("unequal dimension of `dataset` and `weights`.") self.kde_values = kde_values if self.kde_values is not None: print("Warning: By giving `kde_values`, `weight_adaptive_bw` is" " useless. You have to be sure what was used to calculate" " those values!") if len(self.kde_values) != self.n: raise ValueError("unequal dimension of `dataset` and `kde_values`.") if not self.dataset.size > 1: raise ValueError("`dataset` input should have multiple elements.") # compute covariance matrix self.set_bandwidth(bw_method=bw_method) self.adaptive = adaptive if self.adaptive: self.weight_adaptive_bw = weight_adaptive_bw try: self.alpha = float(alpha) except: raise ValueError("`alpha` has to be a number.") if self.alpha < 0. or self.alpha > 1.: raise ValueError("`alpha` has to be in the range [0,1].") self._compute_adaptive_covariance() elif not self.adaptive and self.kde_values is not None: raise ValueError("Giving `kde_values`, `adaptive` cannot be False!") def evaluate(self, points, adaptive=False): """Evaluate the estimated pdf on a set of points. Parameters ---------- points : (# of dimensions, # of points)-array Alternatively, a (# of dimensions,) vector can be passed in and treated as a single point. Returns ------- values : (# of points,)-array The values at each point. Raises ------ ValueError : if the dimensionality of the input points is different than the dimensionality of the KDE. """ points = np.dot(self.inv_cov12, np.atleast_2d(points)) ds = self.ds # pylint: disable=unused-variable normalized_weights = self._normalized_weights # pylint: disable=unused-variable d, m = points.shape if d != self.d: if d == 1 and m == self.d: # points was passed in as a row vector points = np.reshape(points, (m, d)) d, m = points.shape else: msg = "points have dimension %s, dataset has dimension %s" % (d, self.d) raise ValueError(msg) nloops = np.int(np.ceil(m/self.m_max)) dm = self.m_max modulo_dm = m%dm results = np.empty((m,), dtype=float) if adaptive: inv_loc_bw = self.inv_loc_bw # pylint: disable=unused-variable for i in range(nloops): index = i*dm if modulo_dm and i == (nloops-1): dm = modulo_dm pt = points[:, index:index+dm].T.reshape(dm, self.d, 1) # has to be done due to BUG in `numexpr` (`sum` in `numexpr` != `numpy.sum`) if self.d == 1: energy = numexpr.evaluate( # pylint: disable=unused-variable "(ds - pt)**2", optimization='aggressive' ).reshape(dm, self.n) else: energy = numexpr.evaluate( # pylint: disable=unused-variable "sum((ds - pt)**2, axis=1)", optimization='aggressive' ) results[index:index+dm] = numexpr.evaluate( "sum(normalized_weights * exp(-0.5 * energy * inv_loc_bw), axis=1)", optimization='aggressive' ) del pt else: for i in range(nloops): index = i*dm if modulo_dm and i == (nloops-1): dm = modulo_dm pt = points[:, index:index+dm].T.reshape(dm, self.d, 1) # has to be done due to BUG in `numexpr` (`sum` in `numexpr` != `numpy.sum`) if self.d == 1: energy = numexpr.evaluate( "(ds - pt)**2", optimization='aggressive' ).reshape(dm, self.n) else: energy = numexpr.evaluate( "sum((ds - pt)**2, axis=1)", optimization='aggressive' ) results[index:index+dm] = numexpr.evaluate( "sum(normalized_weights * exp(-0.5 * energy), axis=1)", optimization='aggressive' ) del pt return results def __call__(self, points): return self.evaluate(points, adaptive=self.adaptive) def scotts_factor(self): return self.n ** (-1 / (self.d + 4)) def silverman_factor(self): return (self.n * (self.d + 2) / 4) ** (-1 / (self.d + 4)) # Default method to calculate bandwidth, can be overwritten by subclass covariance_factor = scotts_factor def set_bandwidth(self, bw_method=None): """Compute the estimator bandwidth with given method. The new bandwidth calculated after a call to `set_bandwidth` is used for subsequent evaluations of the estimated density. Parameters ---------- bw_method : str, scalar or callable, optional The method used to calculate the estimator bandwidth. This can be 'scott', 'silverman', a scalar constant or a callable. If a scalar, this will be used directly as `kde.factor`. If a callable, it should take a `gaussian_kde` instance as only parameter and return a scalar. If None (default), nothing happens; the current `kde.covariance_factor` method is kept. Examples -------- >>> x1 = np.array([-7, -5, 1, 4, 5.]) >>> kde = stats.gaussian_kde(x1) >>> xs = np.linspace(-10, 10, num=50) >>> y1 = kde(xs) >>> kde.set_bandwidth(bw_method='silverman') >>> y2 = kde(xs) >>> kde.set_bandwidth(bw_method=kde.factor / 3.) >>> y3 = kde(xs) >>> fig = plt.figure() >>> ax = fig.add_subplot(111) >>> ax.plot(x1, np.ones(x1.shape) / (4. * x1.size), 'bo', ... label='Data points (rescaled)') >>> ax.plot(xs, y1, label='Scott (default)') >>> ax.plot(xs, y2, label='Silverman') >>> ax.plot(xs, y3, label='Const (1/3 * Silverman)') >>> ax.legend() >>> plt.show() """ if bw_method is None: pass elif bw_method == 'scott': self.covariance_factor = self.scotts_factor elif bw_method == 'silverman': self.covariance_factor = self.silverman_factor elif np.isscalar(bw_method) and not isinstance(bw_method, basestring): self._bw_method = 'use constant' self.covariance_factor = lambda: bw_method elif callable(bw_method): self._bw_method = bw_method self.covariance_factor = lambda: self._bw_method(self) else: msg = "`bw_method` should be 'scott', 'silverman', a scalar " \ "or a callable." raise ValueError(msg) self._compute_covariance() def _compute_covariance(self): """Computes the covariance matrix for each Gaussian kernel using covariance_factor(). """ factor = self.covariance_factor() # Cache covariance and inverse covariance of the data data_covariance = np.atleast_2d(weighted_cov(self.dataset, weights=self.weights, bias=False)) data_inv_cov = linalg.inv(data_covariance) covariance = data_covariance * factor**2 inv_cov = data_inv_cov / factor**2 self.inv_cov12 = linalg.cholesky(inv_cov).T self.ds = np.dot(self.inv_cov12, self.dataset) norm_factor = np.sqrt(linalg.det(2*np.pi*covariance)) #inv_norm_factor = 1. / (norm_factor * sum(self.weights)) self._normalized_weights = self.weights / (norm_factor * sum(self.weights)) def _compute_adaptive_covariance(self): """Computes an adaptive covariance matrix for each Gaussian kernel using _compute_covariance(). """ # evaluate dataset for kde without adaptive kernel: if self.kde_values is None: if self.weight_adaptive_bw: self.kde_values = self.evaluate(self.dataset, adaptive=False) else: weights_temp = copy(self.weights) self.weights = np.ones(self.n) self._compute_covariance() self.kde_values = self.evaluate(self.dataset, adaptive=False) self.weights = weights_temp self._compute_covariance() # Define global bandwidth `glob_bw` by using the kde without adaptive kernel: # NOTE: is this really self.n or should it be sum(weights)? glob_bw = np.exp(1./self.n * np.sum(np.log(self.kde_values))) # Define local bandwidth `loc_bw`: self.inv_loc_bw = np.power(self.kde_values/glob_bw, 2.*self.alpha) #inv_local_norm_factors = self._inv_norm_factor * power(self.inv_loc_bw, 0.5*self.d) self._normalized_weights = self._normalized_weights * np.power(self.inv_loc_bw, 0.5*self.d) class bootstrap_kde(object): """Bootstrapping to estimate uncertainty in KDE. Parameters ---------- dataset niter : int > 0 **kwargs Passed on to `gaussian_kde`, except 'weights' which,if present, is extracted and re-sampled in the same manner as `dataset`. """ def __init__(self, dataset, niter=10, **kwargs): self.kernels = [] self.bootstrap_indices = [] self.dataset = np.atleast_2d(dataset) self.d, self.n = self.dataset.shape if "weights" in kwargs: weights = kwargs.pop("weights") else: weights = None for _ in range(niter): indices = self.get_bootstrap_indices() self.bootstrap_indices.append(indices) if weights is not None: kernel = gaussian_kde(self.dataset[:, indices], weights=weights[indices], **kwargs) self.kernels.append(kernel) else: kernel = gaussian_kde(self.dataset[:, indices], **kwargs) self.kernels.append(kernel) def __call__(self, points): return self.evaluate(points) def evaluate(self, points): points = np.atleast_2d(points) _, m = points.shape means, sqmeans = np.zeros(m),
np.zeros(m)
numpy.zeros
import pickle import random import socket import logging import socketserver import numpy as np from utils import * # compatible with Windows socket.SO_REUSEPORT = socket.SO_REUSEADDR class SignatureRequestHandler(socketserver.BaseRequestHandler): user_num = 0 ka_pub_keys_map = {} # {id: {c_pk: bytes, s_pk, bytes, signature: bytes}} U_1 = [] def handle(self) -> None: # receive data from the client data = SocketUtil.recv_msg(self.request) msg = pickle.loads(data) id = msg["id"] del msg["id"] self.ka_pub_keys_map[id] = msg self.U_1.append(id) received_num = len(self.U_1) logging.info("[%d/%d] | received user %s's signature", received_num, self.user_num, id) class SecretShareRequestHandler(socketserver.BaseRequestHandler): U_1_num = 0 ciphertexts_map = {} # {u:{v1: ciphertexts, v2: ciphertexts}} U_2 = [] def handle(self) -> None: # receive data from the client data = SocketUtil.recv_msg(self.request) msg = pickle.loads(data) id = msg[0] # retrieve each user's ciphertexts for key, value in msg[1].items(): if key not in self.ciphertexts_map: self.ciphertexts_map[key] = {} self.ciphertexts_map[key][id] = value self.U_2.append(id) received_num = len(self.U_2) logging.info("[%d/%d] | received user %s's ciphertexts", received_num, self.U_1_num, id) class MaskingRequestHandler(socketserver.BaseRequestHandler): U_2_num = 0 masked_gradients_list = [] U_3 = [] def handle(self) -> None: # receive data from the client data = SocketUtil.recv_msg(self.request) msg = pickle.loads(data) id = msg[0] self.U_3.append(msg[0]) self.masked_gradients_list.append(msg[1]) received_num = len(self.U_3) logging.info("[%d/%d] | received user %s's masked gradients", received_num, self.U_2_num, id) class ConsistencyRequestHandler(socketserver.BaseRequestHandler): U_3_num = 0 consistency_check_map = {} U_4 = [] def handle(self) -> None: data = SocketUtil.recv_msg(self.request) msg = pickle.loads(data) id = msg[0] self.U_4.append(id) self.consistency_check_map[id] = msg[1] received_num = len(self.U_4) logging.info("[%d/%d] | received user %s's consistency check", received_num, self.U_3_num, id) class UnmaskingRequestHandler(socketserver.BaseRequestHandler): U_4_num = 0 priv_key_shares_map = {} # {id: []} random_seed_shares_map = {} # {id: []} U_5 = [] def handle(self) -> None: data = SocketUtil.recv_msg(self.request) msg = pickle.loads(data) id = msg[0] # retrieve the private key shares for key, value in msg[1].items(): if key not in self.priv_key_shares_map: self.priv_key_shares_map[key] = [] self.priv_key_shares_map[key].append(value) # retrieve the ramdom seed shares for key, value in msg[2].items(): if key not in self.random_seed_shares_map: self.random_seed_shares_map[key] = [] self.random_seed_shares_map[key].append(value) self.U_5.append(id) received_num = len(self.U_5) logging.info("[%d/%d] | received user %s's shares", received_num, self.U_4_num, id) class Server: def __init__(self): self.id = "0" self.host = socket.gethostname() self.broadcast_port = 10000 self.signature_port = 20000 self.ss_port = 20001 self.masking_port = 20002 self.consistency_port = 20003 self.unmasking_port = 20004 socketserver.ThreadingTCPServer.allow_reuse_address = True self.signature_server = socketserver.ThreadingTCPServer( (self.host, self.signature_port), SignatureRequestHandler) self.ss_server = socketserver.ThreadingTCPServer( (self.host, self.ss_port), SecretShareRequestHandler) self.masking_server = socketserver.ThreadingTCPServer( (self.host, self.masking_port), MaskingRequestHandler) self.consistency_server = socketserver.ThreadingTCPServer( (self.host, self.consistency_port), ConsistencyRequestHandler) self.unmasking_server = socketserver.ThreadingTCPServer( (self.host, self.unmasking_port), UnmaskingRequestHandler) def broadcast_signatures(self, port: int): """Broadcasts all users' key pairs and corresponding signatures. Args: port (int): the port used to broadcast the message. """ server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # reuse port so we will be able to run multiple clients on single (host, port). server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) # enable broadcasting mode server.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) data = pickle.dumps(SignatureRequestHandler.ka_pub_keys_map) SocketUtil.broadcast_msg(server, data, port) logging.info("broadcasted all signatures.") server.close() def send(self, msg: bytes, host: str, port: int): """Sends message to host:port. Args: msg (bytes): the message to be sent. host (str): the target host. port (int): the target port. """ sock = socket.socket() sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) sock.connect((host, port)) SocketUtil.send_msg(sock, msg) sock.close() def unmask(self, shape: tuple) -> np.ndarray: """Unmasks gradients by reconstructing random vectors and private mask vectors. Args: shape (tuple): the shape of the raw gradients. Returns: np.ndarray: the sum of the raw gradients. """ # reconstruct random vectors p_v_u recon_random_vec_list = [] for u in SecretShareRequestHandler.U_2: if u not in MaskingRequestHandler.U_3: # the user drops out, reconstruct its private keys and then generate the corresponding random vectors priv_key = SS.recon(UnmaskingRequestHandler.priv_key_shares_map[u]) for v in MaskingRequestHandler.U_3: shared_key = KA.agree(priv_key, SignatureRequestHandler.ka_pub_keys_map[v]["s_pk"]) random.seed(shared_key) rs = np.random.RandomState(random.randint(0, 2**32 - 1)) if int(u) > int(v): recon_random_vec_list.append(rs.random(shape)) else: recon_random_vec_list.append(-rs.random(shape)) # reconstruct private mask vectors p_u recon_priv_vec_list = [] for u in MaskingRequestHandler.U_3: random_seed = SS.recon(UnmaskingRequestHandler.random_seed_shares_map[u]) rs = np.random.RandomState(random_seed) priv_mask_vec = rs.random(shape) recon_priv_vec_list.append(priv_mask_vec) masked_gradients = np.sum(np.array(MaskingRequestHandler.masked_gradients_list), axis=0) recon_priv_vec = np.sum(np.array(recon_priv_vec_list), axis=0) recon_random_vec = np.sum(
np.array(recon_random_vec_list)
numpy.array
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Tests for Keras activation functions.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from absl.testing import parameterized import numpy as np from tensorflow.python.keras import activations from tensorflow.python.keras import backend from tensorflow.python.keras import combinations from tensorflow.python.keras.layers import advanced_activations from tensorflow.python.keras.layers import core from tensorflow.python.keras.layers import serialization from tensorflow.python.ops import nn_ops as nn from tensorflow.python.platform import test def _ref_softmax(values): m =
np.max(values)
numpy.max
import numpy as np import bethy_fapar as fapar class photosynthesis(): def __init__(self): ''' Class initialisation and setup of parameters ''' # zero C in K self.zeroC = 273.15 # gas constant J mol-1 K-1 self.R_gas = 8.314 # Minimum of maximum carboxylation rate [10^(-6) mol/(m^2 s)] self.minOfMaxCarboxrate = 1e-12 # Minimum stomatal conductance [mol H2O /(m^2 s)] self.minStomaConductance = 0.0 # oxygen concentration self.Ox = 0.21 # mol(O2)mol(air)-1 # energy content of PAR quanta self.EPAR = 220. # kJmol-1 # photon capture efficiency self.alpha = 0.28 # maximum Michaelis-Menton values for CO2 self.KC0 = 460.e-6 # mol(CO2)mol(air)-1 # maximum Michaelis-Menton values for O2 self.KO0 = 330.e-3 # mol(O2)mol(air)-1 # activation energy for KC self.EC = 59396. # J mol-1 # activation energy for KO self.EO = 35948. # J mol-1 # activation energy for VCMAX self.EV = 58520. # J mol-1 # activation energy for dark respiration self.ER = 45000. # J mol-1 # Q10=2 (Collatz et al. 1992) self.EK = 50967. # ratio of dark respiration to PVM at 25 C self.FRDC3 = 0.011 self.FRDC4 = 0.042 # scaling for GammaStar self.GammaStarScale = 1.7e-6 # Effective quantum efficiency C4 self.ALC4 = 0.04 # Curvature parameter (C4) self.Theta = 0.83 self.molarMassAir_kg = 28.97e-3 self.molarMassCO2_kg = 44.011e-3 # LAI limit used in N scaling self.LaiLimit = 3. def calc_nitrogen_scaling_factors(self,zlai,layer_bounds,declination,latitude): ''' ''' factors = np.ones((layer_bounds.size,zlai.size)) cos_zenith_noon = np.cos(declination)*np.cos(latitude) \ + np.sin(declination)*np.sin(latitude) ww = np.where(cos_zenith_noon < 1e-3) cos_zenith_noon[ww] = 1e-3 # Extinction factor k12 = 0.5 / cos_zenith_noon # Condition: LAI>LaiLimit ww = np.where(zlai >= self.LaiLimit) for i in range(ayer_bounds.size): factors[i,:] = np.exp(-k12 * layer_bounds[i] * zlai.flatten()) return factors def assimilate(self,delta_time,mask,cos_zenith,declination,latitude,\ swdown, par, frac_par_direct, pressure,\ canopy_temp, soil_albedo, CO2_concentration_air,\ canopy_conductance, lai, waterLimitationFlag): ''' ''' # Expresse radiation in mol(photons) / (m^2 s) swdown_mol = swdown/self.EPAR # soil reflectivity is set to soil albedo of the visible range soil_reflectivity_par = soil_albedo # canopy_boundaries_lai canopy_boundaries_lai = np.arange(ncanopy)/float(ncanopy) # calculate nitrogen scaling factors nitrogen_scaling_factors = self.calc_nitrogen_scaling_factors(lai,\ canopy_boundaries_lai,\ declination,\ latitude) (laiPerLayer,fAPAR) = fapar.faparl(mask,ncanopy,lai,soil_reflectivity_par,cos_zenith,frac_par_direct,\ canopy_boundaries_lai) # Compute absorbed PAR per leaf area in canopy layer [units: (absorbed photons) / (m^2(leaf area) s)] from # par and fraction of absorbed PAR (Epar is needed to convert radiation intensity from W/m^2 to mol/(m^2 s)) apar_acc = np.zeros_like(faPAR) lai_ = laiPerLayer*1. ww = np.where(lai_ < 1.e-10) lai_[ww] = 1.e-10 for icanopy in range(ncanopy): apar_layer = (par/Epar)*faPAR[icanopy]/lai_[icanopy] apar_acc += (par/Epar)*faPAR[icanopy]*delta_time # Convert CO2 mass mixing ratio [kg/kg] to volume mixing ratio [mol/mol] CO2_concentration_mol = CO2_concentration_air * self.molarMassAir_kg / self.molarMassCO2_kg # estimate CO2 leaf conc CO2_conc_leaf = self.FCI1C3*CO2_concentration_mol self.photosynthesis(C3Flag,waterLimitationFlag,PAR,PIRRIN,P,T,CO2_concentration_mol,\ NSCL,ETransport,CarboxRate,Ci,Gs) def photosynthesis(self,C3Flag,waterLimitedFlag,PAR,PIRRIN,P,T,Atm_co2_conc,\ NSCL,ETransport,CarboxRate,\ Ci,Gs): ''' Farquar et al. 1980 C3 photosynthesis args: C3Flag : True if C3, False for C4 waterLimited : flags to indicate water limited or not PAR : Absorbed PAR mol(photons) m-2 s-1 PIRRIN : Total irridiance at the surface mol m-2 s-1 P : air pressure (Pa) T : vegetation (leaf) temperature (K) Atm_co2_conc : Atmospheric CO2 conc. NSCL : Nitrogen scaling factor at maximum carboxylation rate and maximum electron transport rate ETransport : The maximum rate of electron transport at 25 C for each PFT (mol(CO2) m-2 s-1) CarboxRate : The maximum carboxilation rate at 25 C (micro mol(CO2) m-2 s-1) Ci : CO2 concentration inside leaf mol(CO2) mol(air)-1 Gs : Stomatal conductance (use for water-limited) Returns: (A,Diagnostics) : A = gross assimilation ''' # return None if no data if C3Flag.size == 0: return None # work out which are C3 and C4 wC3 = np.where(C3Flag) wC4 = np.where(not C3Flag) # process C3 if wC3.sum(): (A3,C3diagnostics) = self.photosynthesisC3(PAR[wC3],PIRRIN[wC3],P[wC3],T[wC3],Atm_co2_conc[wC3],\ NSCL[wC3],ETransport[wC3],CarboxRate[wC3],\ Ci[wC3],Gs[wC3],waterLimited[wC3]) else: A3 = np.array([]) C3diagnostics = {} # process C4 if wC4.sum(): (A4,C4diagnostics) = self.photosynthesisC4(PAR[wC4],PIRRIN[wC4],P[wC4],T[wC4],Atm_co2_conc[wC4],\ NSCL[wC4],ETransport[wC4],CarboxRate[wC4],\ Ci[wC4],Gs[wC4],waterLimited[wC4]) else: A4 = np.array([]) C4diagnostics = {} # combine A = np.zeros_like(C3Flag).astype(float) A[C3Flag] = A3 A[not C3Flag] = A4 self.Diagnostics = {} keys = np.unique(np.array(C3diagnostics.keys() + C4diagnostics.keys())) for k in keys: self.Diagnostics[k] = np.zeros_like(A) try: self.Diagnostics[k][wC3] = C3diagnostics[k] except: pass try: self.Diagnostics[k][wC4] = C4diagnostics[k] except: pass self.Diagnostics['C3Flag'] = C3Flag self.Diagnostics['waterLimited'] = waterLimited return (A,self.Diagnostics) def photosynthesisC4(self,PAR,PIRRIN,P,T,Atm_co2_conc,\ NSCL,ETransport,CarboxRate,\ Ci,Gs,waterLimited): ''' Similar to C3 case, but For C4 plants the Farquhar equations are replaced by the set of equations of Collatz et al. 1992: args: PAR : Absorbed PAR mol(photons) m-2 s-1 PIRRIN : Total irridiance at the surface mol m-2 s-1 P : air pressure (Pa) T : vegetation (leaf) temperature (K) Atm_co2_conc : Atmospheric CO2 conc. NSCL : Nitrogen scaling factor at maximum carboxylation rate and maximum electron transport rate ETransport : The maximum rate of electron transport at 25 C for each PFT (mol(CO2) m-2 s-1) CarboxRate : The maximum carboxilation rate at 25 C (micro mol(CO2) m-2 s-1) Ci : CO2 concentration inside leaf mol(CO2) mol(air)-1 Gs : Stomatal conductance waterLimited : flags for water limited or not Returns: (A,Diagnostics) : A = gross assimilation ''' # T1 = 25 C in K T1 = 25. + self.zeroC # T0 is veg temperature relative tp 25 C T0 = T - T1 # TC is the temperatrure in C TC = T - self.zeroC # K is the PECase CO2 specifity instead of the electron transport capacity # within C3 plants K = ETransport * 1.e3 * NSCL \ * np.exp(self.EK * T0 / T1 / self.R_gas / T) # VCMAX : : assume N content, therefore Rubisco is placed # where most incoming light is # NB .. this is a structural consideration VCMAX = CarboxRate * NSCL * np.exp(self.EV * T0 / T1 / self.R_gas / T) # dark respiration (mol(CO2)m-2s-1) Rd = self.FRDC4 * CarboxRate * NSCL \ * np.exp(self.ER * T0 / T1 / self.R_gas / T) \ * highTInhibit(TC) \ * darkInhibit(PIRRIN) # C4 gross photosynthesis at given Ci J0 = (self.ALC4 * PAR + VCMAX) / 2. / self.Theta Je = J0 - np.sqrt(J0*J0 - VCMAX * self.ALC4 * PAR / self.Theta) Jc = np.zeros_like(Rd) A = np.zeros_like(Rd) waterLimit = np.where(waterLimited) notWaterLimit = np.where(not waterLimited) if notWaterLimit.sum() > 0: Ci_ = Ci[notWaterLimit] TC_ = TC[notWaterLimit] Rd_ = Rd[notWaterLimit] Atm_co2_conc_ = Atm_co2_conc[notWaterLimit] P_ = P[notWaterLimit] T_ = T[notwaterLimit] K_ = K[notWaterLimit] Je_ = Je[notWaterLimit] Jc_ = K_ * Ci_ # assimilation is the minimum of Je and Jc # with a high temperature inhibition # mol(CO2)m-2s-1 A_ = Je_ ww = np.where(Jc_ < Je_) A_[ww] = Jc_[ww] A_ = A_ * highTInhhibit(TC_) # stomatal conductance Gs_ = 1.6 * (A_-Rd_) * self.R_gas * T_/ (Atm_co2_conc_ - Ci_) / P_ ww = np.where(Gs_ < self.minStomaConductance) Gs_[ww] = self.minStomaConductance Gs[notWaterLimit] = Gs_ Jc[notWaterLimit] = Jc_ A[notWaterLimit] = A_ else: # water limted, so Gs is defined and Ci must be calculated Gs_ = Gs[waterLimit] TC_ = TC[waterLimit] Rd_ = Rd[waterLimit] Atm_co2_conc_ = Atm_co2_conc[waterLimit] P_ = P[waterLimit] T_ = T[waterLimit] K_ = K[waterLimit] Je_ = Je[waterLimit] G0 = Gs_ / 1.6 / self.R_gas / T_ * P_ Jc_ = (G0 * Atm_co2_conc_ + Rd_)/(1. + G0/K_) ww = np.where(Jc_ < 0) Jc_[ww] = 0. # assimilation is the minimum of Je and Jc # with a high temperature inhibition # mol(CO2)m-2s-1 A_ = Je_ ww = np.where(Jc_ < Je_) A_[ww] = Jc_[ww] A_ = A_ * highTInhhibit(TC) maxer1 = A_ - Rd_ maxer2 = G0 ww = np.where(G0<1e-6) maxer2[ww] = 1e-6 maxer = maxer1/maxer2 ww = np.where(maxer < 0) maxer[ww] = 0. Ci_ = Atm_co2_conc_ - maxer Ci[notWaterLimit] = Ci_ Jc[notWaterLimit] = Jc_ A[notWaterLimit] = A_ Diagnostics = {'max carboxylation rate':VMAX,\ 'internal leaf CO2':Ci,\ 'gross assimilation':A,\ 'dark respiration':Rd,\ 'stomatal conductance':Gs,\ 'max e-transport rate':Jmax,\ 'carboxylation rate':Jc,\ 'e-transport rate':Je} return (A,Diagnostics) def photosynthesisC3(self,PAR,PIRRIN,P,T,Atm_co2_conc,\ NSCL,ETransport,CarboxRate,\ Ci,Gs,waterLimited): ''' Farquar et al. 1980 C3 photosynthesis args: PAR : Absorbed PAR mol(photons) m-2 s-1 PIRRIN : Total irridiance at the surface mol m-2 s-1 P : air pressure (Pa) T : vegetation (leaf) temperature (K) Atm_co2_conc : Atmospheric CO2 conc. NSCL : Nitrogen scaling factor at maximum carboxylation rate and maximum electron transport rate ETransport : The maximum rate of electron transport at 25 C for each PFT (mol(CO2) m-2 s-1) CarboxRate : The maximum carboxilation rate at 25 C (micro mol(CO2) m-2 s-1) Ci : CO2 concentration inside leaf mol(CO2) mol(air)-1 Gs : Stomatal conductance waterLimited : flags to indicate water limited or not Returns: (A,Diagnostics) : A = gross assimilation ''' # T1 = 25 C in K T1 = 25. + self.zeroC # T0 is veg temperature relative tp 25 C T0 = T - T1 # TC is the temperatrure in C TC = T - self.zeroC # Temperature dependent rates and compensation point KC = self.KC0 * np.exp(self.EC * T0 / T1 / self.R_gas / T) KO = self.KO0 * np.exp(self.EO * T0 / T1 / self.R_gas / T) # CO2 compensation point without leaf respiration # assumed in JSBACH to be a linear fn of temperature (C) GammaStar = self.GammaStarScale * TC ww = np.where(GammaStar < 0) GammaStar[ww] = 0. # VCMAX : assume N content, therefore Rubisco is placed # where most incoming light is # NB .. this is a structural consideration VCMAX = CarboxRate * NSCL * np.exp(self.EV * T0 / T1 / self.R_gas / T) # Jmax maximum electron transport rate mol(CO2)m-2s-1 Jmax = ETransport * NSCL * TC/25. ww = np.where(Jmax <= self.minOfMaxCarboxrate) Jmax[ww] = self.minOfMaxCarboxrate # electron transport rate: ww = np.where(Jmax <= self.minOfMaxCarboxrate) J = self.alpha * PAR * Jmax \ / np.sqrt(Jmax * Jmax + self.alpha * self.alpha * PAR * PAR) J[ww] = 0. # dark respiration (mol(CO2)m-2s-1) Rd = self.FRDC3 * CarboxRate * NSCL \ * np.exp(self.ER * T0 / T1 / self.R_gas / T) \ * highTInhibit(TC) \ * darkInhibit(PIRRIN) Jc = np.zeros_like(Rd) Je = np.zeros_like(Rd) A = np.zeros_like(Rd) waterLimit = np.where(waterLimited) notWaterLimit = np.where(not waterLimited) if notWaterLimit.sum() > 0: VCMAX_ = VCMAX[notWaterLimit] Ci_ = Ci[notWaterLimit] GammaStar_ = GammaStar[notWaterLimit] Kc_ = Kc[notWaterLimit] KO_ = KO[notWaterLimit] J_ = J[notWaterLimit] TC_ = TC[notWaterLimit] Rd_ = Rd[notWaterLimit] Atm_co2_conc_ = Atm_co2_conc[notWaterLimit] P_ = P[notWaterLimit] T_ = T[notWaterLimit] # no water limiting # so Ci is defined and Gs is calculated # electron transport limited rate Je and # carboxylating rate Jc (mol(CO2)m-2s-1 Jc_ = VCMAX_ * (Ci_ - GammaStar_)/\ (Ci_ + Kc_ * (1 + (self.Ox/KO_))) Je_ = J_ * (Ci_ - GammaStar_)/\ (4. * (Ci_ + 2. * GammaStar_)) # assimilation is the minimum of Je and Jc # with a high temperature inhibition # mol(CO2)m-2s-1 A_ = Je_ ww = np.where(Jc_ < Je_) A_[ww] = Jc_[ww] A_ = A_ * highTInhhibit(TC_) # stomatal conductance Gs_ = 1.6 * (A_-Rd_) * self.R_gas * T_/ (Atm_co2_conc_ - Ci_) / P_ ww = np.where(Gs < self.minStomaConductance) Gs_[ww] = self.minStomaConductance Gs[notWaterLimit] = Gs_ A[notWaterLimit] = A_ Jc[notWaterLimit] = Jc_ Je[notWaterLimit] = Je_ if waterLimit.sum() > 0: VCMAX_ = VCMAX[waterLimit] Gs_ = Gs[waterLimit] GammaStar_ = GammaStar[waterLimit] Kc_ = Kc[waterLimit] KO_ = KO[waterLimit] J_ = J[waterLimit] TC_ = TC[waterLimit] Rd_ = Rd[waterLimit] Atm_co2_conc_ = Atm_co2_conc[waterLimit] P_ = P[waterLimit] T_ = T[waterLimit] # water limted, so Gs is defined and Ci must be calculated K1 = 2. * GammaStar_ W1 = i_ / 4. W2 = VCMAX_ K2 = Kc_ * (1 + Ox/KO_) G0 = Gs_ / 1.6 / self.R_gas / T_ * P_ B = Rd_ + W1 + G0 * (Atm_co2_conc_ + K1) C = W1 * G0 * (Atm_co2_conc_ - GammaStar_) + W1 * Rd_ sqrter = (B*B / 4.) - C ww = np.where(sqrter < 0) sqrter[ww] = 0. Je_ = B / 2. - np.sqrt(sqrter) ww = np.where(Je < 0) Je_[ww] = 0. B = Rd_ + W2 + G0 * (Atm_co2_conc_ + K2) C = W2 * G0 * (Atm_co2_conc_ - GammaStar_) + W2 * Rd_ sqrter = (B*B / 4.) - C ww = np.where(sqrter < 0) sqrter[ww] = 0. Jc_ = B / 2. - np.sqrt(sqrter) ww = np.where(Jc_ < 0) Jc_[ww] = 0. # assimilation is the minimum of Je and Jc # with a high temperature inhibition # mol(CO2)m-2s-1 A_ = Je_ ww = np.where(Jc_ < Je_) A_[ww] = Jc_[ww] A_ = A_ * highTInhhibit(TC_) maxer1 = A_ - Rd_ maxer2 = G0 ww = np.where(G0<1e-6) maxer2[ww] = 1e-6 maxer = maxer1/maxer2 ww = np.where(maxer < 0) maxer[ww] = 0. Ci_ = Atm_co2_conc_ - maxer Ci[waterLimit] = Ci_ A[waterLimit] = A_ Jc[waterLimit] = Jc_ Je[waterLimit] = Je_ Diagnostics = {'max carboxylation rate':VMAX,\ 'internal leaf CO2':Ci,\ 'gross assimilation':A,\ 'dark respiration':Rd,\ 'stomatal conductance':Gs,\ 'max e-transport rate':Jmax,\ 'carboxylation rate':Jc,\ 'e-transport rate':Je} return (A,Diagnostics) def highTInhibit(self,Tc): ''' Inhibit assimilation and respiration at temperatures above 55 C From: Collatz et al., Physiological and environmental regulation of stomatal conductance, photosynthesis and transpiration: a model that includes a laminar boundary layer, Agricultural and Forest Meteorology, 54, pp. 107-136, 1991 Args: Tc (np.array or similar) : Leaf temperature in C Kwargs: None Returns: A scaling term to reduce assimilation/respiration (same type as input) ''' out = 1./(1. + np.exp(1.3 * (T- 55.))) ww = np.where(out > 1.) out[ww] = 1. return out def darkInhibit(self,IRR): ''' Inhibit dark respiration Brooks and Farquhar, Effect of temperature on the CO2/O2 specifity on RBisCO and the rate of respiration in the light, Planta 165, 397-406, 1985 inhibit the dark-respiration to 50% of it's uninhibited value up from 50 umol/m^2s From Bethy model (JSBACH) Args: IRR (np.array or similar) : Total irridiance at the surface [mol/(m^2 s)] Kwargs: None Returns: A scaling term to reduce dark respiration (same type as input) ''' out = 0.5 + 0.5*np.exp(-IRR * 1e6 / 10.) ww = np.where(IRR == 0.) out[ww] = 0. ww =
np.where(out > 1.)
numpy.where
__author__ = 'Ardalan' CODE_FOLDER = "/home/ardalan/Documents/kaggle/bnp/" # CODE_FOLDER = "/home/arda/Documents/kaggle/bnp/" import os, sys, time, re, zipfile, pickle, operator, glob import pandas as pd import numpy as np from xgboost import XGBClassifier, XGBRegressor from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.preprocessing import StandardScaler from sklearn import metrics from sklearn import cross_validation from sklearn import linear_model from sklearn import ensemble from sklearn import naive_bayes from sklearn import svm from sklearn import calibration from keras.preprocessing import text, sequence from keras.optimizers import * from keras.models import Sequential from keras.utils import np_utils from keras.layers import core, embeddings, recurrent, advanced_activations, normalization from keras.utils import np_utils from keras.callbacks import EarlyStopping def clipProba(ypredproba): """ Taking list of proba and returning a list of clipped proba :param ypredproba: :return: ypredproba clipped """"" ypredproba = np.where(ypredproba <= 0., 1e-5 , ypredproba) ypredproba = np.where(ypredproba >= 1., 1.-1e-5, ypredproba) return ypredproba def reshapePrediction(ypredproba): result = None if len(ypredproba.shape) > 1: if ypredproba.shape[1] == 1: result = ypredproba[:, 0] if ypredproba.shape[1] == 2: result = ypredproba[:, 1] else: result = ypredproba.ravel() result = clipProba(result) return result def eval_func(ytrue, ypredproba): return metrics.log_loss(ytrue, ypredproba) def loadFileinZipFile(zip_filename, filename, dtypes=None, parsedate = None, password=None, **kvargs): """ Load file to dataframe. """ with zipfile.ZipFile(zip_filename, 'r') as myzip: if password: myzip.setpassword(password) if parsedate: return pd.read_csv(myzip.open(filename), sep=',', parse_dates=parsedate, dtype=dtypes, **kvargs) else: return pd.read_csv(myzip.open(filename), sep=',', dtype=dtypes, **kvargs) def CreateDataFrameFeatureImportance(model, pd_data): dic_fi = model.get_fscore() df = pd.DataFrame(dic_fi.items(), columns=['feature', 'fscore']) df['col_indice'] = df['feature'].apply(lambda r: r.replace('f','')).astype(int) df['feat_name'] = df['col_indice'].apply(lambda r: pd_data.columns[r]) return df.sort('fscore', ascending=False) def LoadParseData(l_filenames): l_X = [] l_X_test=[] l_Y = [] for filename in l_filenames: filename = filename[:-2] print(filename) dic_log = pickle.load(open(filename + '.p','rb')) pd_temp = pd.read_csv(filename + '.csv') test_idx = pd_temp['ID'].values.astype(int) l_X.append(np.hstack(dic_log['ypredproba'])) l_X_test.append(pd_temp['PredictedProb'].values) l_Y.append(np.hstack(dic_log['yval'])) X = np.array(l_X).T X_test = np.array(l_X_test).T Y = np.array(l_Y).T.mean(1).astype(int) # Y = np.array(l_Y).T return X, Y, X_test, test_idx def xgb_accuracy(ypred, dtrain): ytrue = dtrain.get_label().astype(int) ypred = np.where(ypred <= 0., 1e-5 , ypred) ypred = np.where(ypred >= 1., 1.-1e-5, ypred) return 'logloss', metrics.log_loss(ytrue, ypred) class NN(): def __init__(self, input_dim, output_dim, hidden_units=(512, 256), activation=('tanh', 'tanh'), dropout=(0.3, 0.3), l2_regularizer=(1e-4, 1e-4), loss="categorical_crossentropy", optimizer=RMSprop(lr=0.001, tho=0.9), batch_size=512, nb_epoch=3, early_stopping_epoch=None, verbose=1, class_mode='binary'): self.name = 'NN' self.input_dim = input_dim self.output_dim = output_dim self.hidden_units = hidden_units self.activation = activation self.dropout = dropout self.loss = loss self.optimizer = optimizer self.l2_regularizer = l2_regularizer self.batch_size = batch_size self.nb_epoch = nb_epoch self.verbose = verbose self.class_mode = class_mode self.model = None self.esr = early_stopping_epoch self.params = {'input_dim': self.input_dim, 'output_dim': self.output_dim, 'hidden_units': self.hidden_units, 'activation': self.activation, 'dropout': self.dropout, 'l2_regularizer': self.l2_regularizer, 'loss': self.loss, 'optimizer': self.optimizer, 'batch_size': self.batch_size, 'nb_epoch': self.nb_epoch, 'esr': self.esr, 'verbose': self.verbose} def _build_model(self, input_dim, output_dim, hidden_units, activation, dropout, loss="binary_crossentropy", optimizer=RMSprop(), class_mode='binary'): model = Sequential() model.add(core.Dense(hidden_units[0], input_dim=input_dim, W_regularizer=None, )) model.add(activation[0]) model.add(normalization.BatchNormalization()) # model.add(core.Dropout(dropout[0])) for i in range(1, len(activation) - 1): model.add(core.Dense(hidden_units[i], input_dim=hidden_units[i-1], W_regularizer=None)) model.add(activation[i]) model.add(normalization.BatchNormalization()) # model.add(core.Dropout(dropout[i])) model.add(core.Dense(output_dim, input_dim=hidden_units[-1], W_regularizer=None)) model.add(core.Activation(activation[-1])) model.compile(loss=loss, optimizer=optimizer, class_mode=class_mode) return model def fit(self, X, y, eval_set=None, class_weight=None, show_accuracy=True): if self.loss == 'categorical_crossentropy': y = np_utils.to_categorical(y) if eval_set != None and self.loss == 'categorical_crossentropy': eval_set = (eval_set[0], np_utils.to_categorical(eval_set[1])) self.model = self._build_model(self.input_dim,self.output_dim,self.hidden_units,self.activation, self.dropout, self.loss, self.optimizer, self.class_mode) if eval_set !=None: early_stopping = EarlyStopping(monitor='val_loss', patience=self.esr, verbose=1, mode='min') logs = self.model.fit(X, y, self.batch_size, self.nb_epoch, self.verbose, validation_data=eval_set, callbacks=[early_stopping], show_accuracy=True, shuffle=True) else: logs = self.model.fit(X, y, self.batch_size, self.nb_epoch, self.verbose, show_accuracy=True, shuffle=True) return logs def predict_proba(self, X): prediction = self.model.predict_proba(X, verbose=0) return prediction def models(): params = {'n_jobs':nthread,'random_state':seed,'class_weight':None} # extra = ensemble.ExtraTreesClassifier(n_estimators=1000,max_features='auto',criterion= 'entropy',min_samples_split= 2, max_depth= None, min_samples_leaf= 1, **params) # extra1 = ensemble.ExtraTreesClassifier(n_estimators=1000,max_features=60,criterion= 'gini',min_samples_split= 4, max_depth= 40, min_samples_leaf= 2, **params) # rf = ensemble.RandomForestClassifier(n_estimators=1000,max_features= 'auto',criterion= 'gini',min_samples_split= 2, max_depth= None, min_samples_leaf= 1, **params) # rf1 = ensemble.RandomForestClassifier(n_estimators=1000,max_features=60,criterion= 'entropy',min_samples_split= 4, max_depth= 40, min_samples_leaf= 2, **params) # xgb_binlog = XGBClassifier(objective="binary:logistic" ,max_depth=10, learning_rate=0.01, n_estimators=5,nthread=nthread, seed=seed) # xgb_reglog = XGBClassifier(objective="reg:logistic", max_depth=10, learning_rate=0.01, n_estimators=5,nthread=nthread, seed=seed) # xgb_poi = XGBClassifier(objective="count:poisson", max_depth=10, learning_rate=0.01, n_estimators=5,nthread=nthread, seed=seed) # xgb_reglin = XGBClassifier(objective="reg:linear", max_depth=10, learning_rate=0.01, n_estimators=5,nthread=nthread, seed=seed) rf_params = {'n_estimators':850,'max_features':60,'criterion':'entropy','min_samples_split': 4,'max_depth': 40, 'min_samples_leaf': 2, 'n_jobs': -1} clfs = [ # (D1, XGBRegressor(objective="reg:linear", max_depth=6, learning_rate=0.01, subsample=.8, n_estimators=2000,nthread=nthread, seed=seed)), (D1, XGBClassifier(objective="binary:logistic" ,max_depth=6, learning_rate=0.01, subsample=.8, n_estimators=2000,nthread=nthread, seed=seed)), # (D1, XGBRegressor(objective="reg:linear", max_depth=5, learning_rate=0.01, subsample=.8, n_estimators=2000,nthread=nthread, seed=seed)), # (D1,XGBClassifier(objective="binary:logistic", max_depth=5, learning_rate=0.01, subsample=.8, n_estimators=2000,nthread=nthread, seed=seed)), # (D1, XGBRegressor(objective="reg:linear", max_depth=4, learning_rate=0.01, subsample=.8, n_estimators=2000,nthread=nthread, seed=seed)), # (D1,XGBClassifier(objective="binary:logistic", max_depth=4, learning_rate=0.01, subsample=.8, n_estimators=2000,nthread=nthread, seed=seed)), ] for clf in clfs: yield clf def printResults(dic_logs): l_train_logloss = dic_logs['train_error'] l_val_logloss = dic_logs['val_error'] string = ("logTRVAL_{0:.4f}|{1:.4f}".format(np.mean(l_train_logloss), np.mean(l_val_logloss))) return string def KerasClassWeight(Y_vec): # Find the weight of each class as present in y. # inversely proportional to the number of samples in the class recip_freq = 1. / np.bincount(Y_vec) weight = recip_freq / np.mean(recip_freq) dic_w = {index:weight_value for index, weight_value in enumerate(weight)} return dic_w def saveDicLogs(dic_logs, filename): try: with open(filename, 'wb') as f: pickle.dump(dic_logs, f, protocol=pickle.HIGHEST_PROTOCOL) except FileNotFoundError: pass CV = 'strat' STORE = True DOTEST = True SELECT = False n_folds = 5 test_size = 0.20 nthread = 4 seed = 123 import fnmatch folder = CODE_FOLDER + 'diclogs/stage1/**/*' pattern = "*XGB*.p" pattern = "*.p" l_filenames = [path for path in glob.iglob(folder) if fnmatch.fnmatch(path, pattern)] print(len(l_filenames), l_filenames) X, Y, X_test, test_idx = LoadParseData(l_filenames) # X = StandardScaler().fit_transform(X) ; X_test = StandardScaler().fit_transform(X_test) pd_corr = pd.DataFrame(X).corr() mat_corr = np.array(pd_corr) if SELECT: # selectionTOP = 1000 cols2keep = [] thresh = .95 for line in range(mat_corr.shape[0]-1): if max(mat_corr[line, line+1:]) < thresh: cols2keep.append(line) X = X[:, cols2keep] X_test = X_test[:, cols2keep] print(np.array(l_filenames)[cols2keep]) D1 = (X, Y, X_test,test_idx, "all") if CV == 'strat': skf = cross_validation.StratifiedShuffleSplit(Y, n_iter=n_folds, test_size=test_size, random_state=seed) if CV == 'random': skf = cross_validation.ShuffleSplit(len(Y), n_iter=n_folds, test_size=test_size, random_state=seed) clfs = models() ################################################################################## # CV ################################################################################## for clf_indice, data_clf in enumerate(clfs): print('-' * 50) print("Classifier [%i]" % clf_indice) X = data_clf[0][0] ; print(X.shape) Y = data_clf[0][1] X_test = data_clf[0][2] test_idx = data_clf[0][3] clf = data_clf[1] print(clf) clf_class_name = clf.__class__.__name__ clf_name = clf_class_name[:3] data_name = data_clf[0][4] dic_logs = {'name':clf_name, 'fold':[],'ypredproba':[],'yval':[], 'params':None,'prepro':None,'best_epoch':[],'best_val_metric':[], 'train_error': [], 'val_error':[]} filename = 'blend_{}_{}_{}f_CV{}'.format(clf_name, data_name,X.shape[1],n_folds) for fold_indice, (tr_idx, te_idx) in enumerate(skf): print("Fold [%i]" % fold_indice) xtrain = X[tr_idx] ytrain = Y[tr_idx] xval = X[te_idx] yval = Y[te_idx] if clf_class_name == 'XGBClassifier' or clf_class_name == 'XGBRegressor': dic_logs['params'] = clf.get_params() added_params = ["_{}".format('-'.join(list(map(lambda x: x[:3] ,clf.objective.split(':'))))), "_d{}".format(clf.max_depth), "_lr{}".format(clf.learning_rate) ] clf.fit(xtrain, ytrain, eval_set=[(xval, yval)], eval_metric=xgb_accuracy, early_stopping_rounds=50, verbose=True) dic_logs['best_epoch'].append(clf.best_iteration) dic_logs['best_val_metric'].append(clf.best_score) elif clf_class_name == 'NN': logs = clf.fit(xtrain, ytrain, eval_set=(xval, yval), show_accuracy=True) dic_logs['params'] = clf.model.get_config() dic_logs['best_epoch'].append(
np.argmin(logs.history['val_loss'])
numpy.argmin
import numpy as np from mushroom_rl.algorithms.value.batch_td import BatchTD from mushroom_rl.approximators.parametric import LinearApproximator from mushroom_rl.features import get_action_features from mushroom_rl.utils.dataset import parse_dataset from mushroom_rl.utils.parameters import to_parameter class LSPI(BatchTD): """ Least-Squares Policy Iteration algorithm. "Least-Squares Policy Iteration". <NAME>. and <NAME>.. 2003. """ def __init__(self, mdp_info, policy, approximator_params=None, epsilon=1e-2, fit_params=None, features=None): """ Constructor. Args: epsilon ([float, Parameter], 1e-2): termination coefficient. """ self._epsilon = to_parameter(epsilon) self._add_save_attr(_epsilon='mushroom') super().__init__(mdp_info, policy, LinearApproximator, approximator_params, fit_params, features) def fit(self, dataset): phi_state, action, reward, phi_next_state, absorbing, _ = parse_dataset( dataset, self.phi) phi_state_action = get_action_features(phi_state, action, self.mdp_info.action_space.n) norm = np.inf while norm > self._epsilon(): q = self.approximator.predict(phi_next_state) if np.any(absorbing): q *= 1 - absorbing.reshape(-1, 1) next_action =
np.argmax(q, axis=1)
numpy.argmax
# This file is part of NEORL. # Copyright (c) 2021 Exelon Corporation and MIT Nuclear Science and Engineering # NEORL is free software: you can redistribute it and/or modify # it under the terms of the MIT LICENSE # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # -*- coding: utf-8 -*- #""" #Created on Sun Aug 15 2021 # #@author: Paul #""" import random import numpy as np import math import time import joblib from neorl.evolu.discrete import mutate_discrete, encode_grid_to_discrete, decode_discrete_to_grid from neorl.utils.seeding import set_neorl_seed class CS(object): """ Cuckoo Search Algorithm :param mode: (str) problem type, either ``min`` for minimization problem or ``max`` for maximization :param bounds: (dict) input parameter type and lower/upper bounds in dictionary form. Example: ``bounds={'x1': ['int', 1, 4], 'x2': ['float', 0.1, 0.8], 'x3': ['float', 2.2, 6.2]}`` :param fit: (function) the fitness function :param ncuckoos: (int) number of cuckoos or nests in the population: one cuckoos per nest. Default value is 15. :param pa: (float) a scalar value for the coefficient that controls exploration/exploitation, i.e. fraction of the cuckoos/nests that will be replaced by the new cuckoos/nests. :param int_transform: (str) method of handling int/discrete variables, choose from: ``nearest_int``, ``sigmoid``, ``minmax``. :param ncores: (int) number of parallel processors (must be ``<= ncuckoos``) :param seed: (int) random seed for sampling """ def __init__(self, mode, bounds, fit, ncuckoos=15, pa=0.25, int_transform='nearest_int', ncores=1, seed=None): set_neorl_seed(seed) assert ncores <= ncuckoos, '--error: ncores ({}) must be less than or equal than ncuckoos ({})'.format(ncores, ncuckoos) self.mode=mode # mode for optimization: CS only solves a minimization problem. if mode == 'min': self.fit=fit elif mode == 'max': def fitness_wrapper(*args, **kwargs): return -fit(*args, **kwargs) self.fit=fitness_wrapper else: raise ValueError('--error: The mode entered by user is invalid, use either `min` or `max`') self.int_transform=int_transform if int_transform not in ["nearest_int", "sigmoid", "minmax"]: raise ValueError('--error: int_transform entered by user is invalid, must be `nearest_int`, `sigmoid`, or `minmax`') self.bounds=bounds self.ncores = ncores self.ncuckoos = ncuckoos self.pa = pa # Discovery rate of parasitic eggs/solutions self.var_type = np.array([bounds[item][0] for item in bounds])# infer variable types #mir-grid if "grid" in self.var_type: self.grid_flag=True self.orig_bounds=bounds #keep original bounds for decoding print('--debug: grid parameter type is found in the space') self.bounds, self.bounds_map=encode_grid_to_discrete(self.bounds) #encoding grid to int #define var_types again by converting grid to int self.var_type = np.array([self.bounds[item][0] for item in self.bounds]) else: self.grid_flag=False self.bounds = bounds self.dim = len(bounds) self.lb=np.array([self.bounds[item][1] for item in self.bounds]) self.ub=np.array([self.bounds[item][2] for item in self.bounds]) def init_sample(self, bounds): #""" #Initialize the initial population of cuckoos/nests #""" indv=[] for key in bounds: if bounds[key][0] == 'int': indv.append(random.randint(bounds[key][1], bounds[key][2])) elif bounds[key][0] == 'float': indv.append(random.uniform(bounds[key][1], bounds[key][2])) else: raise Exception ('unknown data type is given, either int, float, or grid are allowed for parameter bounds') return np.array(indv) def eval_cuckoos(self,newnest = None): #--------------------- # Fitness calcs #--------------------- core_lst=[] if newnest is None: for case in range (0, self.Positions.shape[0]): core_lst.append(self.Positions[case, :]) if self.ncores > 1: with joblib.Parallel(n_jobs=self.ncores) as parallel: fitness_lst=parallel(joblib.delayed(self.fit_worker)(item) for item in core_lst) else: fitness_lst=[] for item in core_lst: fitness_lst.append(self.fit_worker(item)) else:# fitness of new cuckoo versus old cuckoo must also be compared. newnest are the new cuckoos for case in range (0, newnest.shape[0]): core_lst.append(newnest[case, :]) if self.ncores > 1: with joblib.Parallel(n_jobs=self.ncores) as parallel: fitness_lst=parallel(joblib.delayed(self.fit_worker)(item) for item in core_lst) else: fitness_lst=[] for item in core_lst: fitness_lst.append(self.fit_worker(item)) return fitness_lst def select(self, pos, fit): best_fit=np.min(fit) min_idx=
np.argmin(fit)
numpy.argmin
from __future__ import division, print_function, absolute_import import numpy as np from oeshoot.neuralnetwork import (FeedforwardNetwork, Logistic, HyperbolicTangent, Identity) from numpy.testing import (TestCase, assert_array_almost_equal, assert_array_equal, assert_array_less, assert_raises, assert_equal, assert_, run_module_suite, assert_allclose, assert_warns, dec) import numdifftools as nd class TestFeedforwardNetworkInit(TestCase): def test_single_activation_function(self): activ_func = Logistic() net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3], activ_func=activ_func) assert_equal(net.ninput, 3) assert_equal(net.noutput, 2) assert_equal(net.nhidden, [2, 3]) assert_equal(net.weights_shape, [(2, 3), (3, 2), (2, 3)]) assert_equal(net.bias_shape, [(2, 1), (3, 1), (2, 1)]) assert_equal(net.nparams, 25) assert_equal(net.nlayers, 3) assert_equal(isinstance(net.activ_func[0], Logistic), True) assert_equal(isinstance(net.activ_func[1], Logistic), True) assert_equal(isinstance(net.activ_func[2], Identity), True) def test_listof_activation_function(self): net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3, 4], activ_func=[Logistic(), HyperbolicTangent(), Identity(), Logistic()]) assert_equal(net.ninput, 3) assert_equal(net.noutput, 2) assert_equal(net.nhidden, [2, 3, 4]) assert_equal(net.weights_shape, [(2, 3), (3, 2), (4, 3), (2, 4)]) assert_equal(net.bias_shape, [(2, 1), (3, 1), (4, 1), (2, 1)]) assert_equal(net.nlayers, 4) assert_equal(net.nparams, 43) assert_equal(isinstance(net.activ_func[0], Logistic), True) assert_equal(isinstance(net.activ_func[1], HyperbolicTangent), True) assert_equal(isinstance(net.activ_func[2], Identity), True) assert_equal(isinstance(net.activ_func[3], Logistic), True) def test_raise_exception(self): assert_raises(ValueError, FeedforwardNetwork, ninput=3, noutput=2, nhidden=[2, 3], activ_func=[Logistic(), "bsdfad"]) assert_raises(ValueError, FeedforwardNetwork, ninput=3, noutput=2, nhidden=[2, 3], activ_func=[Logistic()]) class TestDisassembleParams(TestCase): def test_disassemble_params(self): net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3], activ_func=Logistic()) params = [1111, 1112, 1113, 1121, 1122, 1123, 121, 122, 2111, 2112, 2121, 2122, 2131, 2132, 221, 222, 223, 3111, 3112, 3113, 3121, 3122, 3123, 321, 322] w, b = net.disassemble_params(params) W0 = [[1111, 1112, 1113], [1121, 1122, 1123]] W1 = [[2111, 2112], [2121, 2122], [2131, 2132]] W2 = [[3111, 3112, 3113], [3121, 3122, 3123]] B0 = [[121], [122]] B1 = [[221], [222], [223]] B2 = [[321], [322]] assert_array_almost_equal(w[0], W0) assert_array_almost_equal(w[1], W1) assert_array_almost_equal(w[2], W2) assert_array_almost_equal(b[0], B0) assert_array_almost_equal(b[1], B1) assert_array_almost_equal(b[2], B2) def test_disassemble_params_raise_exception(self): net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3], activ_func=Logistic()) params = [1111] assert_raises(ValueError, net.disassemble_params, params) class TestAssembleParams(TestCase): def test_assemble_params(self): net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3], activ_func=Logistic()) expected_params = [1111, 1112, 1113, 1121, 1122, 1123, 121, 122, 2111, 2112, 2121, 2122, 2131, 2132, 221, 222, 223, 3111, 3112, 3113, 3121, 3122, 3123, 321, 322] W0 = [[1111, 1112, 1113], [1121, 1122, 1123]] W1 = [[2111, 2112], [2121, 2122], [2131, 2132]] W2 = [[3111, 3112, 3113], [3121, 3122, 3123]] B0 = [[121], [122]] B1 = [[221], [222], [223]] B2 = [[321], [322]] params = net.assemble_params([W0, W1, W2], [B0, B1, B2]) assert_array_almost_equal(params, expected_params) def test_assemble_params_raise_exception(self): net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3], activ_func=Logistic()) expected_params = [1111, 1112, 1113, 1121, 1122, 1123, 121, 122, 2111, 2112, 2121, 2122, 2131, 2132, 221, 222, 223, 3111, 3112, 3113, 3121, 3122, 3123, 321, 322] W0 = [[1111, 1112, 1113], [1121, 1122, 1123]] W1 = [[2111, 2112], [2121, 2122], [2131, 2132]] W2 = [[3111, 3112, 3113], [3121, 3122, 3123]] B0 = [[121], [122]] B1 = [[221], [222], [223]] B2 = [[321], [322]] assert_raises(ValueError, net.assemble_params, [W0, W1], [B0, B1, B2]) assert_raises(ValueError, net.assemble_params, [W0, W1, W2], [B1, B2]) assert_raises(ValueError, net.assemble_params, [W0, W1, W2], [[1, 2, 3], B1, B2]) assert_raises(ValueError, net.assemble_params, [[1, 2, 3], W1, W2], [B0, B1, B2]) class TestFeedforwardNetworkCall(TestCase): def test_two_hiddenlayer_three_input_two_output(self): l = Logistic() i = Identity() net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3], activ_func=Logistic()) params = np.array([1.111, 1.112, 11.13, 112.1, 0.1122, 1123, 12.1, 1.22, 0.2111, 0.2112, 2.121, 2.122, 0.2131, 0.2132, 2.21, 2.22, 0.223, 3.111, 0.3112, 3.113, 0.3121, 0.3122, 0.3123, 0.321, 3.22]) w, b = net.disassemble_params(params) innet = np.asarray([1, 2, 3]).reshape(3, 1) expected = i(np.dot(w[2], l(np.dot(w[1], l(np.dot(w[0], innet)+b[0]))+b[1]))+b[2]).flatten() assert_array_almost_equal(net(innet, params), expected, decimal=3) innet = np.asarray([1.78, -2, 3]).reshape(3, 1) expected = i(np.dot(w[2], l(np.dot(w[1], l(np.dot(w[0], innet)+b[0]))+b[1]))+b[2]).flatten() assert_array_almost_equal(net(innet, params), expected, decimal=3) innet = np.asarray([1, 25, 3]).reshape(3, 1) expected = i(np.dot(w[2], l(np.dot(w[1], l(np.dot(w[0], innet)+b[0]))+b[1]))+b[2]).flatten() assert_array_almost_equal(net(innet, params), expected, decimal=3) def test_raise_exception(self): net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3], activ_func=Logistic()) params = np.array([1.111, 1.112, 11.13, 112.1, 0.1122, 1123, 12.1, 1.22, 0.2111, 0.2112, 2.121, 2.122, 0.2131, 0.2132, 2.21, 2.22, 0.223, 3.111, 0.3112, 3.113, 0.3121, 0.3122, 0.3123, 0.321, 3.22]) assert_raises(ValueError, net, [1, 2, 3, 4], params)
assert_raises(ValueError, net, [1, 2, 3], params[:-1])
numpy.testing.assert_raises
""" PTDB-TUG: Pitch Tracking Database from Graz University of Technology. The original database is available at https://www.spsc.tugraz.at/databases-and-tools/ ptdb-tug-pitch-tracking-database-from-graz-university-of-technology.html """ from typing import no_type_check from typing import Union, Optional, Tuple from os.path import exists, join from os import makedirs, walk import re import numpy as np import pandas as pd import joblib from sklearn.datasets import get_data_home from sklearn.datasets._base import _pkl_filepath from sklearn.utils.validation import _deprecate_positional_args from sklearn.base import BaseEstimator @no_type_check @_deprecate_positional_args def fetch_ptdb_tug_dataset(*, data_origin: Union[str, bytes], data_home: Optional[Union[str, bytes]] = None, preprocessor: Optional[BaseEstimator] = None, augment: Union[int, np.integer] = 0, force_preprocessing: bool = False) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: """ Load the PTDB-TUG: Pitch Tracking Database from Graz University of Technology. (classification and regression) ================= ===================== Outputs 2 Samples total TODO Dimensionality TODO Features TODO ================= ===================== Parameters ---------- data_origin : Optional[str] Specify where the original dataset can be found. By default, all pyrcn data is stored in '~/pyrcn_data' and all scikit-learn data in '~/scikit_learn_data' subfolders. data_home : Optional[str] Specify another download and cache folder fo the datasets. By default, all pyrcn data is stored in '~/pyrcn_data' and all scikit-learn data in '~/scikit_learn_data' subfolders. preprocessor : Optional[BaseEstimator], default=None, Estimator for preprocessing the dataset (create features and targets from audio and label files). augment : Union[int, np.integer], default = 0 Semitone range used for data augmentation force_preprocessing: bool, default=False Force preprocessing (label computation and feature extraction) Returns ------- (X, y) : tuple """ data_home = get_data_home(data_home=data_home) if not exists(data_home): makedirs(data_home) filepath = _pkl_filepath(data_home, 'ptdb_tug.pkz') if not exists(filepath) or force_preprocessing: print('preprocessing PTDB-TUG database from {0} to {1}' .format(data_origin, data_home)) all_training_files = [] all_test_files = [] for root, dirs, files in walk(data_origin): for f in files: if (f.endswith(".wav") and f.startswith("mic") and not re.search(r'\_[0-9]\.wav$', f) and not re.search(r'\_\-[0-9]\.wav$', f)): if "F09" in f or "F10" in f or "M09" in f or "M10" in f: all_test_files.append(join(root, f)) else: all_training_files.append(join(root, f)) if augment > 0: augment = list(range(-augment, augment + 1)) augment.remove(0) else: augment = [0] if len(augment) == 1: X_train = np.empty(shape=(len(all_training_files),), dtype=object) y_train = np.empty(shape=(len(all_training_files),), dtype=object) else: X_train = np.empty(shape=((1 + len(augment)) * len(all_training_files),), dtype=object) y_train = np.empty(shape=((1 + len(augment)) * len(all_training_files),), dtype=object) X_test = np.empty(shape=(len(all_test_files),), dtype=object) y_test = np.empty(shape=(len(all_test_files),), dtype=object) if len(augment) > 1: for k, f in enumerate(all_training_files): X_train[k] = preprocessor.transform(f) y_train[k] = pd.read_csv(f.replace("MIC", "REF"). replace("mic", "ref").replace(".wav", ".f0"), sep=" ", header=None) for m, st in enumerate(augment): for k, f in enumerate(all_training_files): X_train[k + int((m+1) * len(all_training_files))] = \ preprocessor.transform( f.replace(".wav", "_" + str(st) + ".wav")) df = pd.read_csv(f.replace("MIC", "REF"). replace("mic", "ref"). replace(".wav", ".f0"), sep=" ", header=None) df[[0]] = df[[0]] * 2**(st/12) y_train[k + int((m+1) * len(all_training_files))] = df else: for k, f in enumerate(all_training_files): X_train[k] = preprocessor.transform(f) y_train[k] = pd.read_csv(f.replace("MIC", "REF"). replace("mic", "ref"). replace(".wav", ".f0"), sep=" ", header=None) for k, f in enumerate(all_test_files): X_test[k] = preprocessor.transform(f) y_test[k] = pd.read_csv(f.replace("MIC", "REF"). replace("mic", "ref"). replace(".wav", ".f0"), sep=" ", header=None) joblib.dump([X_train, X_test, y_train, y_test], filepath, compress=6) else: X_train, X_test, y_train, y_test = joblib.load(filepath) x_shape_zero = np.unique( [x.shape[0] for x in X_train] + [x.shape[0] for x in X_test]) x_shape_one = np.unique( [x.shape[1] for x in X_train] + [x.shape[1] for x in X_test]) if len(x_shape_zero) == 1 and len(x_shape_one) > 1: for k in range(len(X_train)): X_train[k] = X_train[k].T y_train[k] = _get_labels(X_train[k], y_train[k]) for k in range(len(X_test)): X_test[k] = X_test[k].T y_test[k] = _get_labels(X_test[k], y_test[k]) elif len(x_shape_zero) > 1 and len(x_shape_one) == 1: for k in range(len(X_train)): y_train[k] = _get_labels(X_train[k], y_train[k]) for k in range(len(X_test)): y_test[k] = _get_labels(X_test[k], y_test[k]) else: raise TypeError("Invalid dataformat." "Expected at least one equal dimension of all sequences.") return X_train, X_test, y_train, y_test def _get_labels(X: np.ndarray, df_label: pd.DataFrame) -> np.ndarray: """ Get the pitch labels of a recording. Parameters ---------- X: np.ndarray Feature matrix to know the shape of the input data. df_label, pandas.DataFrame Pandas dataframe that contains the annotations. Returns ------- y : np.ndarray """ labels = df_label[[0, 1]].to_numpy() y = np.zeros(shape=(X.shape[0], 2)) if X.shape[0] == labels.shape[0]: y[:, :] = labels return y elif X.shape[0] == labels.shape[0] + 2 or X.shape[0] == labels.shape[0] + 1: y[1:1+len(labels), :] = labels return y elif X.shape[0] == 2*labels.shape[0]: y[:, 0] = np.interp( np.arange(len(labels), step=0.5), # type: ignore xp=np.arange(len(labels), step=1), fp=labels[:, 0]) # type: ignore y[:, 1] = np.interp( np.arange(len(labels), step=0.5), # type: ignore xp=np.arange(len(labels), step=1), fp=labels[:, 1]) # type: ignore return y elif X.shape[0] == 2*labels.shape[0] - 1: y[1:1+2*len(labels)-1, 0] = np.interp( np.arange(len(labels) - 1, step=0.5), # type: ignore xp=np.arange(len(labels), step=1), fp=labels[:, 0]) # type: ignore y[1:1+2*len(labels)-1, 1] = np.interp( np.arange(len(labels) - 1, step=0.5), # type: ignore xp=np.arange(len(labels), step=1), fp=labels[:, 1]) # type: ignore return y elif X.shape[0] == 2*labels.shape[0] + 1: y[1:1+2*len(labels)+1, 0] = np.interp( np.arange(len(labels), step=0.5), # type: ignore xp=np.arange(len(labels), step=1), fp=labels[:, 0]) # type: ignore y[1:1+2*len(labels)+1, 1] = np.interp( np.arange(len(labels), step=0.5), # type: ignore xp=np.arange(len(labels), step=1), fp=labels[:, 1]) # type: ignore return y else: return
np.ndarray([])
numpy.ndarray
# coding=utf-8 import talib import numpy as np ''' TALIB综合调用函数 name:函数名称 price_h:最高价 price_l:最低价 price_c:收盘价 price_v:成交量 price_o:开盘价 ''' def ta(name, price_h, price_l, price_c, price_v, price_o): # function 'MAX'/'MAXINDEX'/'MIN'/'MININDEX'/'MINMAX'/'MINMAXINDEX'/'SUM' is missing if name == 'AD': return talib.AD(np.array(price_h), np.array(price_l), np.array(price_c), np.asarray(price_v, dtype='float')) if name == 'ADOSC': return talib.ADOSC(np.array(price_h), np.array(price_l), np.array(price_c), np.asarray(price_v, dtype='float'), fastperiod=2, slowperiod=10) if name == 'ADX': return talib.ADX(np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float'), timeperiod=14) if name == 'ADXR': return talib.ADXR(np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float'), timeperiod=14) if name == 'APO': return talib.APO(np.asarray(price_c, dtype='float'), fastperiod=12, slowperiod=26, matype=0) if name == 'AROON': AROON_DWON, AROON2_UP = talib.AROON(np.array(price_h), np.asarray(price_l, dtype='float'), timeperiod=90) return (AROON_DWON, AROON2_UP) if name == 'AROONOSC': return talib.AROONOSC(np.array(price_h), np.asarray(price_l, dtype='float'), timeperiod=14) if name == 'ATR': return talib.ATR(np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float'), timeperiod=14) if name == 'AVGPRICE': return talib.AVGPRICE(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'BBANDS': BBANDS1, BBANDS2, BBANDS3 = talib.BBANDS(np.asarray(price_c, dtype='float'), matype=MA_Type.T3) return BBANDS1 if name == 'BETA': return talib.BETA(np.array(price_h), np.asarray(price_l, dtype='float'), timeperiod=5) if name == 'BOP': return talib.BOP(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CCI': return talib.CCI(np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float'), timeperiod=14) if name == 'CDL2CROWS': return talib.CDL2CROWS(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDL3BLACKCROWS': return talib.CDL3BLACKCROWS(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDL3INSIDE': return talib.CDL3INSIDE(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDL3LINESTRIKE': return talib.CDL3LINESTRIKE(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDL3OUTSIDE': return talib.CDL3OUTSIDE(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDL3STARSINSOUTH': return talib.CDL3STARSINSOUTH(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDL3WHITESOLDIERS': return talib.CDL3WHITESOLDIERS(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLABANDONEDBABY': return talib.CDLABANDONEDBABY(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float'), penetration=0) if name == 'CDLADVANCEBLOCK': return talib.CDLADVANCEBLOCK(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLBELTHOLD': return talib.CDLBELTHOLD(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLBREAKAWAY': return talib.CDLBREAKAWAY(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLCLOSINGMARUBOZU': return talib.CDLCLOSINGMARUBOZU(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLCONCEALBABYSWALL': return talib.CDLCONCEALBABYSWALL(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLCOUNTERATTACK': return talib.CDLCOUNTERATTACK(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLDARKCLOUDCOVER': return talib.CDLDARKCLOUDCOVER(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float'), penetration=0) if name == 'CDLDOJI': return talib.CDLDOJI(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLDOJISTAR': return talib.CDLDOJISTAR(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLDRAGONFLYDOJI': return talib.CDLDRAGONFLYDOJI(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLENGULFING': return talib.CDLENGULFING(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLEVENINGDOJISTAR': return talib.CDLEVENINGDOJISTAR(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float'), penetration=0) if name == 'CDLEVENINGSTAR': return talib.CDLEVENINGSTAR(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float'), penetration=0) if name == 'CDLGAPSIDESIDEWHITE': return talib.CDLGAPSIDESIDEWHITE(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLGRAVESTONEDOJI': return talib.CDLGRAVESTONEDOJI(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLHAMMER': return talib.CDLHAMMER(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLHANGINGMAN': return talib.CDLHANGINGMAN(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLHARAMI': return talib.CDLHARAMI(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLHARAMICROSS': return talib.CDLHARAMICROSS(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLHIGHWAVE': return talib.CDLHIGHWAVE(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLHIKKAKE': return talib.CDLHIKKAKE(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLHIKKAKEMOD': return talib.CDLHIKKAKEMOD(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLHOMINGPIGEON': return talib.CDLHOMINGPIGEON(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLIDENTICAL3CROWS': return talib.CDLIDENTICAL3CROWS(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLINNECK': return talib.CDLINNECK(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLINVERTEDHAMMER': return talib.CDLINVERTEDHAMMER(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLKICKING': return talib.CDLKICKING(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLKICKINGBYLENGTH': return talib.CDLKICKINGBYLENGTH(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLLADDERBOTTOM': return talib.CDLLADDERBOTTOM(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLLONGLEGGEDDOJI': return talib.CDLLONGLEGGEDDOJI(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLLONGLINE': return talib.CDLLONGLINE(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLMARUBOZU': return talib.CDLMARUBOZU(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLMATCHINGLOW': return talib.CDLMATCHINGLOW(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLMATHOLD': return talib.CDLMATHOLD(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLMORNINGDOJISTAR': return talib.CDLMORNINGDOJISTAR(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float'), penetration=0) if name == 'CDLMORNINGSTAR': return talib.CDLMORNINGSTAR(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float'), penetration=0) if name == 'CDLONNECK': return talib.CDLONNECK(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLPIERCING': return talib.CDLPIERCING(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLRICKSHAWMAN': return talib.CDLRICKSHAWMAN(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLRISEFALL3METHODS': return talib.CDLRISEFALL3METHODS(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLSEPARATINGLINES': return talib.CDLSEPARATINGLINES(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLSHOOTINGSTAR': return talib.CDLSHOOTINGSTAR(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLSHORTLINE': return talib.CDLSHORTLINE(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLSPINNINGTOP': return talib.CDLSPINNINGTOP(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLSTALLEDPATTERN': return talib.CDLSTALLEDPATTERN(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLSTICKSANDWICH': return talib.CDLSTICKSANDWICH(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLTAKURI': return talib.CDLTAKURI(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLTASUKIGAP': return talib.CDLTASUKIGAP(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLTHRUSTING': return talib.CDLTHRUSTING(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLTRISTAR': return talib.CDLTRISTAR(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLUNIQUE3RIVER': return talib.CDLUNIQUE3RIVER(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLUPSIDEGAP2CROWS': return talib.CDLUPSIDEGAP2CROWS(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CDLXSIDEGAP3METHODS': return talib.CDLXSIDEGAP3METHODS(np.array(price_o), np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float')) if name == 'CMO': return talib.CMO(np.asarray(price_c, dtype='float'), timeperiod=14) if name == 'CORREL': return talib.CORREL(np.array(price_h), np.asarray(price_l, dtype='float'), timeperiod=30) if name == 'DEMA': return talib.DEMA(np.asarray(price_c, dtype='float'), timeperiod=30) if name == 'DX': return talib.DX(np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float'), timeperiod=14) if name == 'EMA': return talib.EMA(np.asarray(price_c, dtype='float'), timeperiod=30) if name == 'HT_DCPERIOD': return talib.HT_DCPERIOD(np.asarray(price_c, dtype='float')) if name == 'HT_DCPHASE': return talib.HT_DCPHASE(np.asarray(price_c, dtype='float')) if name == 'HT_PHASOR': HT_PHASOR1, HT_PHASOR2 = talib.HT_PHASOR( np.asarray(price_c, dtype='float')) # use HT_PHASOR1 for the indication of up and down return HT_PHASOR1 if name == 'HT_SINE': HT_SINE1, HT_SINE2 = talib.HT_SINE(np.asarray(price_c, dtype='float')) return HT_SINE1 if name == 'HT_TRENDLINE': return talib.HT_TRENDLINE(np.asarray(price_c, dtype='float')) if name == 'HT_TRENDMODE': return talib.HT_TRENDMODE(np.asarray(price_c, dtype='float')) if name == 'KAMA': return talib.KAMA(np.asarray(price_c, dtype='float'), timeperiod=30) if name == 'LINEARREG': return talib.LINEARREG(np.asarray(price_c, dtype='float'), timeperiod=14) if name == 'LINEARREG_ANGLE': return talib.LINEARREG_ANGLE(np.asarray(price_c, dtype='float'), timeperiod=14) if name == 'LINEARREG_INTERCEPT': return talib.LINEARREG_INTERCEPT(np.asarray(price_c, dtype='float'), timeperiod=14) if name == 'LINEARREG_SLOPE': return talib.LINEARREG_SLOPE(np.asarray(price_c, dtype='float'), timeperiod=14) if name == 'MA': return talib.MA(np.asarray(price_c, dtype='float'), timeperiod=30, matype=0) if name == 'MACD': MACD1, MACD2, MACD3 = talib.MACD(np.asarray(price_c, dtype='float'), fastperiod=12, slowperiod=26, signalperiod=9) return MACD1 if nam == 'MACDEXT': return talib.MACDEXT(np.asarray(price_c, dtype='float'), fastperiod=12, fastmatype=0, slowperiod=26, slowmatype=0, signalperiod=9, signalmatype=0) if name == 'MACDFIX': MACDFIX1, MACDFIX2, MACDFIX3 = talib.MACDFIX(np.asarray(price_c, dtype='float'), signalperiod=9) return MACDFIX1 if name == 'MAMA': MAMA1, MAMA2 = talib.MAMA(np.asarray(price_c, dtype='float'), fastlimit=0, slowlimit=0) return MAMA1 if name == 'MEDPRICE': return talib.MEDPRICE(np.array(price_h), np.asarray(price_l, dtype='float')) if name == 'MINUS_DI': return talib.MINUS_DI(np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float'), timeperiod=14) if name == 'MINUS_DM': return talib.MINUS_DM(np.array(price_h), np.asarray(price_l, dtype='float'), timeperiod=14) if name == 'MOM': return talib.MOM(np.asarray(price_c, dtype='float'), timeperiod=10) if name == 'NATR': return talib.NATR(np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float'), timeperiod=14) if name == 'OBV': return talib.OBV(np.array(price_c), np.asarray(price_v, dtype='float')) if name == 'PLUS_DI': return talib.PLUS_DI(np.array(price_h), np.array(price_l), np.asarray(price_c, dtype='float'), timeperiod=14) if name == 'PLUS_DM': return talib.PLUS_DM(np.array(price_h), np.asarray(price_l, dtype='float'), timeperiod=14) if name == 'PPO': return talib.PPO(
np.asarray(price_c, dtype='float')
numpy.asarray
import pandas as pd import numpy as np import os import cv2 as cv import matplotlib.pyplot as plt from PIL import Image import pickle from torch.utils.data import DataLoader,Dataset from torchvision import transforms as T import torch root = './dataset/image/' directory = './dataset/label.csv' class raw_dataset(Dataset): """import and package raw data into dataset data preprocessing with transforms: 1.resize 2.to tensor 3. normalize""" def __init__(self, root,directory): self.img, self.label = self.read_dataset(directory) self.root = root self.transforms = T.Compose([ T.ToTensor(), T.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)) ]) def __getitem__(self, index): img_path = os.path.join(self.root,self.img[index]) #data = Image.open(img_path) data = cv.imread(img_path) data = Image.fromarray(
np.array(data)
numpy.array
""" Functions related to computation of the log-likelihood. """ #*************************************************************************************************** # Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS). # Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain rights # in this software. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 or in the LICENSE file in the root pyGSTi directory. #*************************************************************************************************** import numpy as _np from pygsti import tools as _tools #pos = lambda x: x**2 pos = abs class WildcardBudget(object): """ A fixed wildcard budget. Encapsulates a fixed amount of "wildcard budget" that allows each circuit an amount "slack" in its outcomes probabilities. The way in which this slack is computed - or "distributed", though it need not necessarily sum to a fixed total - per circuit depends on each derived class's implementation of the :method:`circuit_budget` method. Goodness-of-fit quantities such as the log-likelihood or chi2 can utilize a `WildcardBudget` object to compute a value that shifts the circuit outcome probabilities within their allowed slack (so `|p_used - p_actual| <= slack`) to achieve the best goodness of fit. For example, see the `wildcard` argument of :function:`two_delta_logl_terms`. This is a base class, which must be inherited from in order to obtain a full functional wildcard budge (the `circuit_budget` method must be implemented and usually `__init__` should accept more customized args). Parameters ---------- w_vec : numpy.array vector of wildcard budget components. """ def __init__(self, w_vec): """ Create a new WildcardBudget. Parameters ---------- w_vec : numpy array The "wildcard vector" which stores the parameters of this budget which can be varied when trying to find an optimal budget (similar to the parameters of a :class:`Model`). """ self.wildcard_vector = w_vec def to_vector(self): """ Get the parameters of this wildcard budget. Returns ------- numpy array """ return self.wildcard_vector def from_vector(self, w_vec): """ Set the parameters of this wildcard budge. Parameters ---------- w_vec : numpy array A vector of parameter values. Returns ------- None """ self.wildcard_vector = w_vec @property def num_params(self): """ The number of parameters of this wildcard budget. Returns ------- int """ return len(self.wildcard_vector) def circuit_budget(self, circuit): """ Get the amount of wildcard budget, or "outcome-probability-slack" for `circuit`. Parameters ---------- circuit : Circuit the circuit to get the budget for. Returns ------- float """ raise NotImplementedError("Derived classes must implement `circuit_budget`") def circuit_budgets(self, circuits, precomp=None): """ Get the wildcard budgets for a list of circuits. Parameters ---------- circuits : list The list of circuits to act on. precomp : numpy.ndarray, optional A precomputed quantity that speeds up the computation of circuit budgets. Given by :method:`precompute_for_same_circuits`. Returns ------- numpy.ndarray """ # XXX is this supposed to do something? # circuit_budgets = [self.circuit_budget(circ) for circ in circuits] pass @property def description(self): """ A dictionary of quantities describing this budget. Return the contents of this budget in a dictionary containing (description, value) pairs for each element name. Returns ------- dict """ raise NotImplementedError("Derived classes must implement `description`") #def compute_circuit_wildcard_budget(c, w_vec): # #raise NotImplementedError("TODO!!!") # #for now, assume w_vec is a length-1 vector # return abs(w_vec[0]) * len(c) def precompute_for_same_circuits(self, circuits): """ Compute a pre-computed quantity for speeding up circuit calculations. This value can be passed to `update_probs` or `circuit_budgets` whenever this same `circuits` list is passed to `update_probs` to speed things up. Parameters ---------- circuits : list A list of :class:`Circuit` objects. Returns ------- object """ raise NotImplementedError("Derived classes must implement `precompute_for_same_circuits`") def slow_update_probs(self, probs_in, probs_out, freqs, layout, precomp=None): """ Updates `probs_in` to `probs_out` by applying this wildcard budget. Update a set of circuit outcome probabilities, `probs_in`, into a corresponding set, `probs_out`, which uses the slack alloted to each outcome probability to match (as best as possible) the data frequencies in `freqs`. In particular, it computes this best-match in a way that maximizes the likelihood between `probs_out` and `freqs`. This method is the core function of a :class:`WildcardBudget`. Parameters ---------- probs_in : numpy array The input probabilities, usually computed by a :class:`Model`. probs_out : numpy array The output probabilities: `probs_in`, adjusted according to the slack allowed by this wildcard budget, in order to maximize `logl(probs_out, freqs)`. Note that `probs_out` may be the same array as `probs_in` for in-place updating. freqs : numpy array An array of frequencies corresponding to each of the outcome probabilites in `probs_in` or `probs_out`. layout : CircuitOutcomeProbabilityArrayLayout The layout for `probs_in`, `probs_out`, and `freqs`, specifying how array indices correspond to circuit outcomes, as well as the list of circuits. precomp : numpy.ndarray, optional A precomputed quantity for speeding up this calculation. Returns ------- None """ #Special case where f_k=0, since ratio is ill-defined. One might think # we shouldn't don't bother wasting any TVD on these since the corresponding # p_k doesn't enter the likelihood. ( => treat these components as if f_k == q_k (ratio = 1)) # BUT they *do* enter in poisson-picture logl... # so set freqs very small so ratio is large (and probably not chosen) for i, circ in enumerate(layout.circuits): elInds = layout.indices_for_index(i) qvec = probs_in[elInds] fvec = freqs[elInds] W = self.circuit_budget(circ) #print("Circuit %d: %s" % (i, circ)) #print(" inds = ", elInds, "q = ", qvec, " f = ", fvec) updated_qvec = update_circuit_probs(qvec, fvec, W) _tools.matrixtools._fas(probs_out, (elInds,), updated_qvec) return def precompute_for_same_probs_freqs(self, probs_in, freqs, layout): tol = 1e-8 # for checking equality - same as in update_probs tvd_precomp = 0.5 * _np.abs(probs_in - freqs) A_precomp = _np.logical_and(probs_in > freqs + tol, freqs > 0) B_precomp = _np.logical_and(probs_in < freqs - tol, freqs > 0) C_precomp = _np.logical_and(freqs - tol <= probs_in, probs_in <= freqs + tol) # freqs == probs D_precomp = _np.logical_and(~C_precomp, freqs == 0) # probs_in != freqs and freqs == 0 circuits = layout.circuits precomp_info = [] for i, circ in enumerate(circuits): elInds = layout.indices_for_index(i) fvec = freqs[elInds] qvec = probs_in[elInds] initialTVD = sum(tvd_precomp[elInds]) # 0.5 * sum(_np.abs(qvec - fvec)) A = A_precomp[elInds] B = B_precomp[elInds] C = C_precomp[elInds] D = D_precomp[elInds] sum_fA = float(_np.sum(fvec[A])) sum_fB = float(_np.sum(fvec[B])) sum_qA = float(_np.sum(qvec[A])) sum_qB = float(_np.sum(qvec[B])) sum_qC = float(_np.sum(qvec[C])) sum_qD = float(_np.sum(qvec[D])) min_qvec = _np.min(qvec) # sort(abs(qvec[A] / fvec[A] - 1.0)) but abs and 1.0 irrelevant since ratio is always > 1 iA = sorted(zip(_np.nonzero(A)[0], qvec[A] / fvec[A]), key=lambda x: x[1]) # sort(abs(1.0 - qvec[B] / fvec[B])) but abs and 1.0 irrelevant since ratio is always < 1 iB = sorted(zip(_np.nonzero(B)[0], qvec[B] / fvec[B]), key=lambda x: -x[1]) precomp_info.append((A, B, C, D, sum_fA, sum_fB, sum_qA, sum_qB, sum_qC, sum_qD, initialTVD, fvec, qvec, min_qvec, iA, iB)) return precomp_info def update_probs(self, probs_in, probs_out, freqs, layout, precomp=None, probs_freqs_precomp=None, return_deriv=False): """ Updates `probs_in` to `probs_out` by applying this wildcard budget. Update a set of circuit outcome probabilities, `probs_in`, into a corresponding set, `probs_out`, which uses the slack alloted to each outcome probability to match (as best as possible) the data frequencies in `freqs`. In particular, it computes this best-match in a way that maximizes the likelihood between `probs_out` and `freqs`. This method is the core function of a :class:`WildcardBudget`. Parameters ---------- probs_in : numpy array The input probabilities, usually computed by a :class:`Model`. probs_out : numpy array The output probabilities: `probs_in`, adjusted according to the slack allowed by this wildcard budget, in order to maximize `logl(probs_out, freqs)`. Note that `probs_out` may be the same array as `probs_in` for in-place updating. freqs : numpy array An array of frequencies corresponding to each of the outcome probabilites in `probs_in` or `probs_out`. layout : CircuitOutcomeProbabilityArrayLayout The layout for `probs_in`, `probs_out`, and `freqs`, specifying how array indices correspond to circuit outcomes, as well as the list of circuits. precomp : numpy.ndarray, optional A precomputed quantity for speeding up this calculation. probs_freqs_precomp : list, optional A precomputed list of quantities re-used when calling `update_probs` using the same `probs_in`, `freqs`, and `layout`. Generate by calling :method:`precompute_for_same_probs_freqs`. return_deriv : bool, optional When True, returns the derivative of each updated probability with respect to its circuit budget as a numpy array. Useful for internal methods. Returns ------- None """ #Note: special case where f_k=0, since ratio is ill-defined. One might think # we shouldn't don't bother wasting any TVD on these since the corresponding # p_k doesn't enter the likelihood. ( => treat these components as if f_k == q_k (ratio = 1)) # BUT they *do* enter in poisson-picture logl... # so set freqs very small so ratio is large (and probably not chosen) tol = 1e-8 # for checking equality circuits = layout.circuits circuit_budgets = self.circuit_budgets(circuits, precomp) p_deriv = _np.empty(layout.num_elements, 'd') if probs_freqs_precomp is None: probs_freqs_precomp = self.precompute_for_same_probs_freqs(probs_in, freqs, layout) for i, (circ, W, info) in enumerate(zip(circuits, circuit_budgets, probs_freqs_precomp)): A, B, C, D, sum_fA, sum_fB, sum_qA, sum_qB, sum_qC, sum_qD, initialTVD, fvec, qvec, min_qvec, iA, iB = info elInds = layout.indices_for_index(i) if initialTVD <= W + tol: # TVD is already "in-budget" for this circuit - can adjust to fvec exactly probs_out[elInds] = fvec # _tools.matrixtools._fas(probs_out, (elInds,), fvec) if return_deriv: p_deriv[elInds] = 0.0 continue if min_qvec < 0 or abs(1.0 - sum(qvec)) > 1e-6: qvec, W = _adjust_qvec_to_be_nonnegative_and_unit_sum(qvec, W, min_qvec, circ) #recompute A-D b/c we've updated qvec A = _np.logical_and(qvec > fvec, fvec > 0); sum_fA = sum(fvec[A]); sum_qA = sum(qvec[A]) B = _np.logical_and(qvec < fvec, fvec > 0); sum_fB = sum(fvec[B]); sum_qB = sum(qvec[B]) C = (qvec == fvec); sum_qC = sum(qvec[C]) D = _np.logical_and(qvec != fvec, fvec == 0); sum_qD = sum(qvec[D]) #update other values tht depend on qvec (same as in precompute_for_same_probs_freqs) sum_qA = float(_np.sum(qvec[A])) sum_qB = float(_np.sum(qvec[B])) sum_qC = float(_np.sum(qvec[C])) sum_qD = float(_np.sum(qvec[D])) iA = sorted(zip(_np.nonzero(A)[0], qvec[A] / fvec[A]), key=lambda x: x[1]) iB = sorted(zip(_np.nonzero(B)[0], qvec[B] / fvec[B]), key=lambda x: -x[1]) indices_moved_to_C = []; alist_ptr = blist_ptr = 0 while alist_ptr < len(iA): # and sum_fA > 0 # if alist_ptr < len(iA): # always true when sum_fA > 0 jA, alphaA = iA[alist_ptr] betaA = (1.0 - alphaA * sum_fA - sum_qC) / sum_fB testA = min(alphaA - 1.0, 1.0 - betaA) #if blist_ptr < len(iB): # also always true assert(sum_fB > 0) # sum_fB should always be > 0 - otherwise there's nowhere to take probability from jB, betaB = iB[blist_ptr] alphaB = (1.0 - betaB * sum_fB - sum_qC) / sum_fA testB = min(alphaB - 1.0, 1.0 - betaB) #Note: pushedSD = 0.0 if testA < testB: j, alpha_break, beta_break = jA, alphaA, betaA TVD_at_breakpt = 0.5 * (sum_qA - alpha_break * sum_fA + beta_break * sum_fB - sum_qB + sum_qD) # - pushedSD) # compute_tvd if TVD_at_breakpt <= W + tol: break # exit loop # move j from A -> C sum_qA -= qvec[j]; sum_qC += qvec[j]; sum_fA -= fvec[j] alist_ptr += 1 else: j, alpha_break, beta_break = jB, alphaB, betaB TVD_at_breakpt = 0.5 * (sum_qA - alpha_break * sum_fA + beta_break * sum_fB - sum_qB + sum_qD) # - pushedSD) # compute_tvd if TVD_at_breakpt <= W + tol: break # exit loop # move j from B -> C sum_qB -= qvec[j]; sum_qC += qvec[j]; sum_fB -= fvec[j] blist_ptr += 1 indices_moved_to_C.append(j) else: # if we didn't break due to TVD being small enough, continue to process with empty A-list: while blist_ptr < len(iB): # now sum_fA == 0 => alist_ptr is maxed out assert(sum_fB > 0) # otherwise there's nowhere to take probability from j, beta_break = iB[blist_ptr] pushedSD = 1.0 - beta_break * sum_fB - sum_qC # just used for TVD calc below TVD_at_breakpt = 0.5 * (sum_qA + beta_break * sum_fB - sum_qB + sum_qD - pushedSD) # compute_tvd if TVD_at_breakpt <= W + tol: break # exit loop # move j from B -> C sum_qB -= qvec[j]; sum_qC += qvec[j]; sum_fB -= fvec[j] blist_ptr += 1 indices_moved_to_C.append(j) else: assert(False), "TVD should reach zero: qvec=%s, fvec=%s, W=%g" % (str(qvec), str(fvec), W) #Now A,B,C are fixed to what they need to be for our given W # test if len(A) > 0, make tol here *smaller* than that assigned to zero freqs above if sum_fA > tol: alpha = (sum_qA - sum_qB + sum_qD - 2 * W) / sum_fA if sum_fB == 0 else \ (sum_qA - sum_qB + sum_qD + 1.0 - sum_qC - 2 * W) / (2 * sum_fA) # compute_alpha beta = _np.nan if sum_fB == 0 else (1.0 - alpha * sum_fA - sum_qC) / sum_fB # beta_fn pushedSD = 0.0 # assume initially that we don't need to push any TVD into the "D" set dalpha_dW = -2 / sum_fA if sum_fB == 0 else -1 / sum_fA dbeta_dW = 0.0 if sum_fB == 0 else (- dalpha_dW * sum_fA) / sum_fB dpushedSD_dW = 0.0 else: # fall back to this when len(A) == 0 beta = -(sum_qA - sum_qB + sum_qD + sum_qC - 1 - 2 * W) / (2 * sum_fB) if sum_fA == 0 else \ -(sum_qA - sum_qB + sum_qD - 1.0 + sum_qC - 2 * W) / (2 * sum_fB) # compute_beta (assumes pushedSD can be >0) #beta = -(sum_qA - sum_qB + sum_qD - 2 * W) / sum_fB # assumes pushedSD == 0 alpha = 0.0 # doesn't matter OLD: _alpha_fn(beta, A, B, C, qvec, fvec) pushedSD = 1 - beta * sum_fB - sum_qC dalpha_dW = 0.0 dbeta_dW = 2 / sum_fB if sum_fA == 0 else 1 / sum_fB dpushedSD_dW = -dbeta_dW * sum_fB #compute_pvec pvec = fvec.copy() pvec[A] = alpha * fvec[A] pvec[B] = beta * fvec[B] pvec[C] = qvec[C] #indices_moved_to_C = [x[0] for x in sorted_indices_and_ratios[0:nMovedToC]] pvec[indices_moved_to_C] = qvec[indices_moved_to_C] pvec[D] = pushedSD * qvec[D] / sum_qD probs_out[elInds] = pvec # _tools.matrixtools._fas(probs_out, (elInds,), pvec) assert(W > 0 or min_qvec < 0 or _np.linalg.norm(qvec - pvec) < 1e-6), \ "Probability shouldn't be updated when W=0!" # don't check this when there are negative probs #Check with other version (for debugging) #check_pvec = update_circuit_probs(qvec.copy(), fvec.copy(), W) #assert(_np.linalg.norm(check_pvec - pvec) < 1e-6) if return_deriv: p_deriv_wrt_W = _np.zeros(len(pvec), 'd') p_deriv_wrt_W[A] = dalpha_dW * fvec[A] p_deriv_wrt_W[B] = dbeta_dW * fvec[B] p_deriv_wrt_W[indices_moved_to_C] = 0.0 p_deriv_wrt_W[D] = dpushedSD_dW * qvec[D] / sum_qD p_deriv[elInds] = p_deriv_wrt_W return p_deriv if return_deriv else None class PrimitiveOpsWildcardBudget(WildcardBudget): """ A wildcard budget containing one parameter per "primitive operation". A parameter's absolute value gives the amount of "slack", or "wildcard budget" that is allocated per that particular primitive operation. Primitive operations are the components of circuit layers, and so the wilcard budget for a circuit is just the sum of the (abs vals of) the parameters corresponding to each primitive operation in the circuit. Parameters ---------- primitive_op_labels : iterable or dict A list of primitive-operation labels, e.g. `Label('Gx',(0,))`, which give all the possible primitive ops (components of circuit layers) that will appear in circuits. Each one of these operations will be assigned it's own independent element in the wilcard-vector. A dictionary can be given whose keys are Labels and whose values are 0-based parameter indices. In the non-dictionary case, each label gets it's own parameter. Dictionaries allow multiple labels to be associated with the *same* wildcard budget parameter, e.g. `{Label('Gx',(0,)): 0, Label('Gy',(0,)): 0}`. If `'SPAM'` is included as a primitive op, this value correspond to a uniform "SPAM budget" added to each circuit. start_budget : float or dict, optional An initial value to set all the parameters to (if a float), or a dictionary mapping primitive operation labels to initial values. """ def __init__(self, primitive_op_labels, start_budget=0.0, idle_name=None): """ Create a new PrimitiveOpsWildcardBudget. Parameters ---------- primitive_op_labels : iterable or dict A list of primitive-operation labels, e.g. `Label('Gx',(0,))`, which give all the possible primitive ops (components of circuit layers) that will appear in circuits. Each one of these operations will be assigned it's own independent element in the wilcard-vector. A dictionary can be given whose keys are Labels and whose values are 0-based parameter indices. In the non-dictionary case, each label gets it's own parameter. Dictionaries allow multiple labels to be associated with the *same* wildcard budget parameter, e.g. `{Label('Gx',(0,)): 0, Label('Gy',(0,)): 0}`. If `'SPAM'` is included as a primitive op, this value correspond to a uniform "SPAM budget" added to each circuit. start_budget : float or dict, optional An initial value to set all the parameters to (if a float), or a dictionary mapping primitive operation labels to initial values. idle_name : str, optional The gate name to be used for the 1-qubit idle gate. If not `None`, then circuit budgets are computed by considering layers of the circuit as being "padded" with `1-qubit` idles gates on any empty lines. """ if isinstance(primitive_op_labels, dict): assert(set(primitive_op_labels.values()) == set(range(len(set(primitive_op_labels.values()))))) self.primOpLookup = primitive_op_labels else: self.primOpLookup = {lbl: i for i, lbl in enumerate(primitive_op_labels)} if 'SPAM' in self.primOpLookup: self.spam_index = self.primOpLookup['SPAM'] else: self.spam_index = None self._idlename = idle_name nParams = len(set(self.primOpLookup.values())) if isinstance(start_budget, dict): Wvec =
_np.zeros(nParams, 'd')
numpy.zeros
from trimesh import TriMesh, Vertex import pytest import numpy as np def test_manifold_creation(): trimesh = TriMesh() assert np.array_equal(trimesh.get_faces_by_index(), np.array([])) assert np.array_equal(trimesh.get_vertices(), np.array([])) def test_trimesh_add_vertices(): trimesh = TriMesh() vertices = [Vertex(1, 0, 0), Vertex(0, 1, 0), Vertex(0, 0, 1)] trimesh.add_vertices(vertices) assert np.array_equal(trimesh.get_vertices(), np.array(vertices)) def test_trimesh_add_faces(): trimesh = TriMesh() vertices = [Vertex(1, 0, 0), Vertex(0, 1, 0)] faces = [(1, 0, 0), (0, 1, 0), (0, 0, 1)] trimesh.add_vertices(vertices) trimesh.add_faces_by_index(faces) assert np.array_equal(trimesh.get_faces_by_index(), np.array(faces)) def test_trimesh_remove_duplicate_faces(): trimesh = TriMesh() vertices = [Vertex(1, 0, 0)] faces = [(0, 0, 0), (0, 0, 0), (0, 0, 0)] trimesh.add_vertices(vertices) trimesh.add_faces_by_index(faces) trimesh.remove_duplicate_faces() assert np.array_equal(trimesh.get_faces_by_index(), np.array([(0, 0, 0)])) def test_trimesh_remove_empty_faces(): trimesh = TriMesh() vertices = [Vertex(1, 0, 0), Vertex(0, 1, 0)] faces = [(1, 0, 0), (0, 1, 0), (0, 0, 1)] trimesh.add_vertices(vertices) trimesh.add_faces_by_index(faces) trimesh.remove_empty_faces() assert np.array_equal(trimesh.get_faces_by_index(), np.array([])) #Generated mesh saved to "stl/pyramidtest.stl" import stl def test_trimesh_pyramid_test(): trimesh = TriMesh() vertices = [Vertex(1, 0, 0), Vertex(-1, 0, 0), Vertex(0, 1, 0), Vertex(0, -1, 0), Vertex(0, 0, 1)] faces = [(0, 2, 3), (1, 2, 3), (0, 2, 4), (1, 2, 4), (0, 3, 4), (1, 3, 4)] trimesh.add_vertices(vertices) trimesh.add_faces_by_index(faces) trimesh.trimesh_to_npmesh().save('stl/pyramidtest.stl', mode=stl.Mode.BINARY) assert np.array_equal(trimesh.get_faces_by_index(),
np.array(faces)
numpy.array
import numpy as np from .derivatives import (d_camera_d_shape_parameters, d_camera_d_camera_parameters) from .projectout import project_out, sample_uv_terms def J_data(camera, warped_uv, shape_pc_uv, U_tex_pc, grad_x_uv, grad_y_uv, focal_length_update=False): # Compute derivative of camera wrt shape and camera parameters dp_da_dr = d_camera_d_shape_parameters(camera, warped_uv, shape_pc_uv) dp_dr = d_camera_d_camera_parameters( camera, warped_uv, with_focal_length=focal_length_update) # stack the shape_parameters/camera_parameters updates dp_da_dr = np.hstack((dp_da_dr, dp_dr)) # Multiply image gradient with camera derivative permuted_grad_x =
np.transpose(grad_x_uv[..., None], (0, 2, 1))
numpy.transpose
# -*- coding: utf-8 -*- """ Created on Tue Nov 14 14:40:04 2017 @author: r.dewinter """ from testFunctions.TBTD import TBTD from testFunctions.SRD import SRD from testFunctions.WB import WB from testFunctions.DBD import DBD from testFunctions.SPD import SPD from testFunctions.CSI import CSI from testFunctions.WP import WP from testFunctions.OSY import OSY from testFunctions.CTP1 import CTP1 from testFunctions.CEXP import CEXP from testFunctions.C3DTLZ4 import C3DTLZ4 from testFunctions.TNK import TNK from testFunctions.SRN import SRN from testFunctions.BNH import BNH from CONSTRAINED_SMSEGO import CONSTRAINED_SMSEGO import time import numpy as np ## Real world like problems problemCall = CSI rngMin = np.array([0.5, 0.45, 0.5, 0.5, 0.875, 0.4, 0.4]) rngMax = np.array([1.5, 1.35, 1.5, 1.5, 2.625, 1.2, 1.2]) initEval = 30 maxEval = 200 smooth = 2 nVar = 7 runNo = 11 ref = np.array([42,4.5,13]) nconstraints = 10 epsilonInit=0.01 epsilonMax=0.02 s = time.time() CONSTRAINED_SMSEGO(problemCall, rngMin, rngMax, ref, nconstraints, initEval, maxEval, smooth, runNo, epsilonInit, epsilonMax) print(time.time()-s) problemCall = WB rngMin = np.array([0.125, 0.1, 0.1, 0.125]) rngMax = np.array([5, 10, 10, 5]) initEval = 30 maxEval = 200 smooth = 2 nVar = 4 runNo = 3 ref = np.array([350,0.1]) nconstraints = 5 epsilonInit=0.01 epsilonMax=0.02 s = time.time() CONSTRAINED_SMSEGO(problemCall, rngMin, rngMax, ref, nconstraints, initEval, maxEval, smooth, runNo, epsilonInit, epsilonMax) print(time.time()-s) problemCall = TBTD rngMin = np.array([1,0.0005,0.0005]) rngMax = np.array([3,0.05,0.05]) initEval = 30 maxEval = 200 smooth = 2 runNo = 5 ref = np.array([0.1,100000]) nconstraints = 3 epsilonInit=0.01 epsilonMax=0.02 s = time.time() CONSTRAINED_SMSEGO(problemCall, rngMin, rngMax, ref, nconstraints, initEval, maxEval, smooth, runNo, epsilonInit, epsilonMax) print(time.time()-s) problemCall = DBD rngMin = np.array([55, 75, 1000, 2]) rngMax = np.array([80, 110, 3000, 20]) initEval = 30 maxEval = 200 smooth = 2 nVar = 4 runNo = 3 ref = np.array([5,50]) nconstraints = 5 epsilonInit=0.01 epsilonMax=0.02 s = time.time() CONSTRAINED_SMSEGO(problemCall, rngMin, rngMax, ref, nconstraints, initEval, maxEval, smooth, runNo, epsilonInit, epsilonMax) print(time.time()-s) problemCall = SPD rngMin = np.array([150, 25, 12, 8, 14, 0.63]) rngMax = np.array([274.32, 32.31, 22, 11.71, 18, 0.75]) initEval = 30 maxEval = 200 smooth = 2 nVar = 6 runNo = 5 ref = np.array([16,19000,-260000]) nconstraints=9 epsilonInit=0.01 epsilonMax=0.02 s = time.time() CONSTRAINED_SMSEGO(problemCall, rngMin, rngMax, ref, nconstraints, initEval, maxEval, smooth, runNo, epsilonInit, epsilonMax) print(time.time()-s) problemCall = WP rngMin = np.array([0.01, 0.01, 0.01]) rngMax = np.array([0.45, 0.1, 0.1]) initEval = 30 maxEval = 200 smooth = 2 nVar = 3 runNo = 3 ref = np.array([83000, 1350, 2.85, 15989825, 25000]) nconstraints = 7 epsilonInit=0.01 epsilonMax=0.02 s = time.time() CONSTRAINED_SMSEGO(problemCall, rngMin, rngMax, ref, nconstraints, initEval, maxEval, smooth, runNo, epsilonInit, epsilonMax) print(time.time()-s) ##########################theoreticala problems problemCall = BNH rngMin = np.array([0,0]) rngMax = np.array([5,3]) initEval = 30 maxEval = 200 smooth = 2 runNo = 2 ref = np.array([140,50]) nconstraints = 2 epsilonInit=0.01 epsilonMax=0.02 s = time.time() CONSTRAINED_SMSEGO(problemCall, rngMin, rngMax, ref, nconstraints, initEval, maxEval, smooth, runNo, epsilonInit, epsilonMax) print(time.time()-s) problemCall = SRN rngMin = np.array([-20,-20]) rngMax = np.array([20, 20]) initEval = 30 maxEval = 200 smooth = 2 runNo = 8 ref = np.array([301,72]) nconstraints = 2 epsilonInit=0.01 epsilonMax=0.02 s = time.time() CONSTRAINED_SMSEGO(problemCall, rngMin, rngMax, ref, nconstraints, initEval, maxEval, smooth, runNo, epsilonInit, epsilonMax) print(time.time()-s) problemCall = TNK rngMin =
np.array([1e-5,1e-5])
numpy.array
# -*- coding: utf-8 -*- """ Created on Sat May 19 17:13:47 2018 # 数据预处理工具函数,整体功能是读取指定路径下的npy格式数据文件,预处理后生成自己的训练/验证/测试数据 @author: liuhuaqing """ import time import os import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from itertools import product from scipy.ndimage.interpolation import map_coordinates from scipy.ndimage.filters import gaussian_filter def convert_to_onehot(y,C): #将label转化为one-hot形式 y = y.astype(int) y_shape = list(y.shape) y_shape[-1] = C y_onehot = np.reshape(np.eye(C)[y.reshape(-1)], y_shape) return y_onehot.astype(float) #弹性变形 def elastic_transform_V0(image3D,mask3D,alpha=1,sigma=1): # 弹性变形函数版本0 shape = image3D.shape random_state = np.random.RandomState(None) dx = gaussian_filter((random_state.rand(*shape)*2-1),sigma)*alpha dy = gaussian_filter((random_state.rand(*shape)*2-1),sigma)*alpha dz = gaussian_filter((random_state.rand(*shape)*2-1),sigma)*alpha x,y,z,c = np.meshgrid(np.arange(shape[1]),np.arange(shape[0]),np.arange(shape[2]),np.arange(1)) x,y,z = x[:,:,:,0],y[:,:,:,0],z[:,:,:,0] indices = np.reshape(y+dy,(-1,1)),np.reshape(x+dx,(-1,1)),np.reshape(z+dz,(-1,1)) image3D_elastic = map_coordinates(image3D,indices,order=1,mode='reflect').reshape(shape) mask3D_elastic = map_coordinates(mask3D,indices,order=1,mode='reflect').reshape(shape) return image3D_elastic, mask3D_elastic def elastic_transform_V1(image3D,alpha=1,sigma=1): # 弹性变形函数版本1,实现的功能和版本0一样 shape = image3D.shape random_state = np.random.RandomState(None) dx = gaussian_filter((random_state.rand(*shape)*2-1),sigma)*alpha dy = gaussian_filter((random_state.rand(*shape)*2-1),sigma)*alpha dz = gaussian_filter((random_state.rand(*shape)*2-1),sigma)*alpha x,y,z,c = np.meshgrid(np.arange(shape[1]),np.arange(shape[0]),np.arange(shape[2]),np.arange(1)) x,y,z = x[:,:,:,0],y[:,:,:,0],z[:,:,:,0] indices = np.reshape(y+dy,(-1,1)),np.reshape(x+dx,(-1,1)),np.reshape(z+dz,(-1,1)) image3D_elastic = map_coordinates(image3D,indices,order=1,mode='reflect').reshape(shape) return image3D_elastic # 旋转,axis为旋转轴,0,1,2分别代表x,y,z轴 # theta为旋转角度,单位已改为度,非弧度 # center为旋转中心,其为一维np数组[x,y,z],默认值为图像中心点 def rotation(data, axis, theta, c = np.array([]), patch_shape=(64,64,32)):# c代表旋转点 #3D矩阵的旋转(实际仅仅又绕z轴旋转的功能,在该项目中,z轴特指CT图像人体身高方向) theta = -np.pi * theta / 180 if c.size == 0: c = np.array([np.floor((data.shape[0]-1)/2), np.floor((data.shape[1]-1)/2), np.floor((data.shape[1]-1)/2)]) s = patch_shape new_data = np.zeros(s) # 补零 # 绕x轴旋转 if axis == 0: print('axis==0 not supported') # 绕y轴旋转 elif axis == 1: print('axis==1 not supported') # 绕z轴旋转 else: c_theta = np.cos(theta) s_theta = np.sin(theta) i0,j0 = np.int(-s[0]/2),np.int(-s[1]/2) i1,j1 = i0+s[0], j0+s[1] z0 = c[2]-np.floor(patch_shape[2]/2).astype(int) z1 = z0+patch_shape[2] for i,j in product( range(i0,i1),range(j0,j1) ): x = np.floor(i*c_theta-j*s_theta+c[0]).astype(int) y = np.floor(i*s_theta+j*c_theta+c[1]).astype(int) new_data[i-i0,j-j0,:] = data[x,y,z0:z1] return new_data def calc_c_range(data,patch_shape=(64,64,32)): # 该函数的作用是:服务于数据扩增中的随机旋转与裁剪,计算允许截取数据块的原始CT范围 c_range = np.zeros([2,3]) c_range[0:2,0:2] = np.vstack( (np.ceil( np.array([0,0])+np.linalg.norm(np.array(patch_shape)[0:2])/2), np.floor(np.array(data.shape)[0:2]-1-np.linalg.norm(np.array(patch_shape)[0:2])/2)) ) c_range[0:2,2] = np.array([ np.ceil(np.array(patch_shape[2])/2).astype(int), np.floor(np.array(data.shape[2])-1-np.array(patch_shape[2])/2).astype(int)]) return c_range def read_npy_file(item1,item2,get_label=True,do_augment=True,do_patch=True,D=16,H=128,W=128): # 读取文件并根据do_patch决定是否做数据扩增 # 训练的时候做数据扩增,验证和测试的时候不做 image = np.load(item1)+70.75# 原始数据三个维度对应人体的:左右、前后、上下 if get_label: mask = np.load(item2) else: mask = np.array([]) #随机裁剪 if do_patch and not do_augment: imageShape = image.shape x1 = np.random.randint(low=0, high=imageShape[0]-H, dtype='l')#这个方法产生离散均匀分布的整数,这些整数大于等于low,小于high。 y1 = np.random.randint(low=0, high=imageShape[1]-W, dtype='l') z1 = np.random.randint(low=0, high=imageShape[2]-D, dtype='l') image = image[x1:x1+H,y1:y1+W,z1:z1+D] if get_label: mask = mask[x1:x1+H,y1:y1+W,z1:z1+D] #随机旋转与裁剪 if do_patch and do_augment: c_range = calc_c_range(image,patch_shape=(H,W,D)) c = np.array([np.random.randint(low=c_range[0,0],high=c_range[1,0]), np.random.randint(low=c_range[0,1],high=c_range[1,1]), np.random.randint(low=c_range[0,2],high=c_range[1,2])]) theta = np.random.normal(loc=0.0,scale=10)#旋转角 image = rotation(image,axis=3,c=c,theta=theta,patch_shape=(H,W,D)) if get_label: mask = rotation(mask,axis=3,c=c,theta=theta,patch_shape=(H,W,D)) if do_augment: # ============================================================================= # #弹性变形,实验发现性价比不高:耗时且效果提升不明显 # alpha=2 # sigma=1 # if get_label: # image,mask = elastic_transform_V0(image,mask,alpha,sigma) # else: # image = elastic_transform_V1(image,alpha,sigma) # ============================================================================= #正太分布随机噪声 noise = np.random.normal(0, 1, image.shape) image = image+noise image = image.astype(np.float32) if get_label: mask = mask.astype(np.float32) #左右翻转 if np.random.rand()>0.5: image = np.flip(image,0) if get_label: mask = np.flip(mask,0) image = np.transpose(image,(2,0,1))#调换维度顺序后,各维度分别是:D,H,W image = image[:,:,:,np.newaxis]#在最后增加一个channel维度,得到的维度分别是:D,H,W,channel if get_label: mask = np.transpose(mask,(2,0,1))#调换维度顺序后,各维度分别是:D,H,W,channel mask = mask[:,:,:,np.newaxis]#在最后增加一个channel维度 if get_label: return (image,mask) else: return image def get_files(file_dir,get_label=True,do_shuffle=True): # 获取CT和mask成对的数据集文件名,并打乱顺序但不影响CT和mask的对应关系 # get_label:表示是否获取标签mask # step1;获取file_dir下所有的图路径名 image_list = [] mask_list = [] for file in os.listdir(file_dir+'/CT'): image_list.append(file_dir+'/CT'+'/'+file) if get_label: mask_list.append(file_dir+'/SegmentationLabel'+'/'+file) #for file in os.listdir(file_dir+'/SegmentationLabel'): # step2: 对生成的图片路径和标签做打乱处理 # 利用shuffle打乱顺序 if do_shuffle: if get_label: temp = np.array([image_list,mask_list]) temp = temp.transpose()#n行2列 np.random.shuffle(temp) #从打乱顺序的temp中取list image_list = list(temp[:,0])#打乱顺序的文件路径名字符串 mask_list = list(temp[:,1])#打乱顺序的文件路径名字符串 else: temp =
np.array(image_list)
numpy.array
import os, sys import json import numpy as np import quaternion import torch from torch.utils.data import Dataset BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = os.path.dirname(BASE_DIR) sys.path.append(BASE_DIR) # import scan2cad_utils from s2c_config import Scan2CADDatasetConfig import s2c_utils DC = Scan2CADDatasetConfig() MAX_NUM_POINT = 40000 MAX_NUM_OBJ = 64 NOT_CARED_ID = np.array([0]) SYM2CLASS = {"__SYM_NONE": 0, "__SYM_ROTATE_UP_2": 1, "__SYM_ROTATE_UP_4": 2, "__SYM_ROTATE_UP_INF": 3} def roty(t): """Rotation about the y-axis.""" c = np.cos(t) s = np.sin(t) return np.array([[c, 0, s], [0, 1, 0], [-s, 0, c]]) def from_q_to_6d(q): q = np.quaternion(q[0], q[1], q[2], q[3]) mat = quaternion.as_rotation_matrix(q) # 3x3 rep6d = mat[:, 0:2].transpose().reshape(-1, 6) # 6 return rep6d def nn_search(p, ps): target = torch.from_numpy(ps.copy()) p = torch.from_numpy(p.copy()) p_diff = target - p p_dist = torch.sum(p_diff**2, dim=-1) dist, idx = torch.min(p_dist, dim=-1) return dist.item(), idx.item() def make_M_from_tqs(t, q, s): q = np.quaternion(q[0], q[1], q[2], q[3]) T = np.eye(4) T[0:3, 3] = t R = np.eye(4) R[0:3, 0:3] = quaternion.as_rotation_matrix(q) S = np.eye(4) S[0:3, 0:3] = np.diag(s) M = T.dot(R).dot(S) return M class Scan2CADDataset(Dataset): def __init__(self, split_set='train', num_points=40000, augment=False): self.data_path = os.path.join(BASE_DIR, 'scan2cad_data') filename_json = BASE_DIR + "/full_annotations.json" assert filename_json all_scan_names = list(set([os.path.basename(x)[0:12] \ for x in os.listdir(self.data_path) if x.startswith('scene')])) self.scan_names = [] # Split scan list if split_set=='all': self.scan_list = all_scan_names elif split_set in ['train', 'val', 'test']: split_filenames = os.path.join(BASE_DIR, 'scannet_meta', 'scan2cad_{}.txt'.format(split_set)) with open(split_filenames, 'r') as f: self.scan_list = f.read().splitlines() # remove unavailiable scans num_scans = len(self.scan_list) self.scan_list = [sname for sname in self.scan_list \ if sname in all_scan_names] print('Dataset for {}: kept {} scans out of {}'.format(split_set, len(self.scan_list), num_scans)) num_scans = len(self.scan_list) else: print('illegal split name') return self.dataset = {} self.test: int = None with open(filename_json, 'r') as f: data = json.load(f) d = {} i = -1 for idx, r in enumerate(data): i_scan = r["id_scan"] if i_scan not in self.scan_list: continue self.scan_names.append(i_scan) i += 1 d[i] = {} d[i]['id_scan'] = i_scan d[i]['trs'] = r["trs"] n_model = r["n_aligned_models"] d[i]['n_total'] = n_model d[i]['models'] = {} for j in range(n_model): d[i]['models'][j] = {} d[i]['models'][j]['trs'] = r["aligned_models"][j]['trs'] d[i]['models'][j]['sym'] = SYM2CLASS[r["aligned_models"][j]['sym']] cat_id = r["aligned_models"][j]['catid_cad'] if cat_id in DC.ShapenetIDToName: d[i]['models'][j]['sem_cls'] = DC.ShapenetIDToName[cat_id] else: d[i]['models'][j]['sem_cls'] = 'other' d[i]['models'][j]['id'] = r["aligned_models"][j]['id_cad'] self.dataset = d self.num_points = num_points self.augment = augment def __len__(self): return len(self.dataset) def get_alignment_matrix(self, index): data = self.dataset[index] id_scan = data['id_scan'] m_scan = make_M_from_tqs(data['trs']['translation'], data['trs']['rotation'], data['trs']['scale']) return id_scan, m_scan def __getitem__(self, index): data = self.dataset[index] id_scan = data['id_scan'] K = data['n_total'] assert(K <= MAX_NUM_OBJ) # Point Cloud mesh_vertices = np.load(os.path.join(self.data_path, id_scan) + '_vert.npy') # (N, 3) instance_labels = np.load(os.path.join(self.data_path, id_scan) + '_ins_label.npy') # (N, obj_id) semantic_labels = np.load(os.path.join(self.data_path, id_scan) + '_sem_label.npy') # (N, sem_cls) instance_bboxes = np.load(os.path.join(self.data_path, id_scan) + '_bbox.npy') # (obj_id, 7) point_cloud = mesh_vertices[:,0:3] # do not use color for now point_cloud, choices = s2c_utils.random_sampling(point_cloud, self.num_points, return_choices=True) instance_labels = instance_labels[choices] semantic_labels = semantic_labels[choices] # Target CAD Objects (K, cls, 9 DoF) target_obj_classes = np.zeros((MAX_NUM_OBJ), dtype=np.int64) target_obj_symmetry = np.zeros((MAX_NUM_OBJ), dtype=np.int64) target_obj_alignments = np.zeros((MAX_NUM_OBJ, 10), dtype=np.float32) # trs, rot, scl target_obj_6d_rotation = np.zeros((MAX_NUM_OBJ, 6), dtype=np.float32) for model in range(K): # Class (1) cls_str = data['models'][model]['sem_cls'] target_obj_classes[model] = int(DC.ShapenetNameToClass[cls_str]) # Center (3) target_obj_alignments[model, 0:3] =
np.array(data['models'][model]['trs']['translation'])
numpy.array
import numpy as np import pandas as pd import math from sklearn.metrics import log_loss from sklearn.preprocessing import StandardScaler import csv from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import ExtraTreesClassifier from sklearn import ensemble # https://github.com/sublee/elo/blob/master/elo.py """ elo ~~~ The Elo rating system. :copyright: (c) 2012 by <NAME> :license: BSD, see LICENSE for more details. """ from datetime import datetime import inspect __version__ = '0.1.dev' __all__ = ['Elo', 'Rating', 'CountedRating', 'TimedRating', 'rate', 'adjust', 'expect', 'rate_1vs1', 'adjust_1vs1', 'quality_1vs1', 'setup', 'global_env', 'WIN', 'DRAW', 'LOSS', 'K_FACTOR', 'RATING_CLASS', 'INITIAL', 'BETA'] #: The actual score for win. WIN = 1.01 #: The actual score for draw. DRAW = 0.5 #: The actual score for loss. LOSS = 0. #: Default K-factor. K_FACTOR = 10 #: Default rating class. RATING_CLASS = float #: Default initial rating. INITIAL = 1300 #: Default Beta value. BETA = 170 class Rating(object): try: __metaclass__ = __import__('abc').ABCMeta except ImportError: # for Python 2.5 pass value = None def __init__(self, value=None): if value is None: value = global_env().initial self.value = value def rated(self, value): """Creates a :class:`Rating` object for the recalculated rating. :param value: the recalculated rating value. """ return type(self)(value) def __int__(self): """Type-casting to ``int``.""" return int(self.value) def __long__(self): """Type-casting to ``long``.""" return long(self.value) def __float__(self): """Type-casting to ``float``.""" return float(self.value) def __nonzero__(self): """Type-casting to ``bool``.""" return bool(int(self)) def __eq__(self, other): return float(self) == float(other) def __lt__(self, other): """Is Rating < number. :param other: the operand :type other: number """ return self.value < other def __le__(self, other): """Is Rating <= number. :param other: the operand :type other: number """ return self.value <= other def __gt__(self, other): """Is Rating > number. :param other: the operand :type other: number """ return self.value > other def __ge__(self, other): """Is Rating >= number. :param other: the operand :type other: number """ return self.value >= other def __iadd__(self, other): """Rating += number. :param other: the operand :type other: number """ self.value += other return self def __isub__(self, other): """Rating -= number. :param other: the operand :type other: number """ self.value -= other return self def __repr__(self): c = type(self) ext_params = inspect.getargspec(c.__init__)[0][2:] kwargs = ', '.join('%s=%r' % (param, getattr(self, param)) for param in ext_params) if kwargs: kwargs = ', ' + kwargs args = ('.'.join([c.__module__, c.__name__]), self.value, kwargs) return '%s(%.3f%s)' % args try: Rating.register(float) except AttributeError: pass class CountedRating(Rating): """Increases count each rating recalculation.""" times = None def __init__(self, value=None, times=0): self.times = times super(CountedRating, self).__init__(value) def rated(self, value): rated = super(CountedRating, self).rated(value) rated.times = self.times + 1 return rated class TimedRating(Rating): """Writes the final rated time.""" rated_at = None def __init__(self, value=None, rated_at=None): self.rated_at = rated_at super(TimedRating, self).__init__(value) def rated(self, value): rated = super(TimedRating, self).rated(value) rated.rated_at = datetime.utcnow() return rated class Elo(object): def __init__(self, k_factor=K_FACTOR, rating_class=RATING_CLASS, initial=INITIAL, beta=BETA): self.k_factor = k_factor self.rating_class = rating_class self.initial = initial self.beta = beta def expect(self, rating, other_rating): """The "E" function in Elo. It calculates the expected score of the first rating by the second rating. """ # http://www.chess-mind.com/en/elo-system diff = float(other_rating) - float(rating) f_factor = 2 * self.beta # rating disparity return 1. / (1 + 11 ** (diff / f_factor)) def adjust(self, rating, series): """Calculates the adjustment value.""" return sum(score - self.expect(rating, other_rating) for score, other_rating in series) def rate(self, rating, series): """Calculates new ratings by the game result series.""" rating = self.ensure_rating(rating) k = self.k_factor(rating) if callable(self.k_factor) else self.k_factor new_rating = float(rating) + k * self.adjust(rating, series) if hasattr(rating, 'rated'): new_rating = rating.rated(new_rating) return new_rating def adjust_1vs1(self, rating1, rating2, drawn=False): return self.adjust(rating1, [(DRAW if drawn else WIN, rating2)]) def rate_1vs1(self, rating1, rating2, drawn=False): scores = (DRAW, DRAW) if drawn else (WIN, LOSS) return (self.rate(rating1, [(scores[0], rating2)]), self.rate(rating2, [(scores[1], rating1)])) def quality_1vs1(self, rating1, rating2): return 2 * (0.5 - abs(0.5 - self.expect(rating1, rating2))) def create_rating(self, value=None, *args, **kwargs): if value is None: value = self.initial return self.rating_class(value, *args, **kwargs) def ensure_rating(self, rating): if isinstance(rating, self.rating_class): return rating return self.rating_class(rating) def make_as_global(self): """Registers the environment as the global environment. >>> env = Elo(initial=2000) >>> Rating() elo.Rating(1200.000) >>> env.make_as_global() #doctest: +ELLIPSIS elo.Elo(..., initial=2000.000, ...) >>> Rating() elo.Rating(2000.000) But if you need just one environment, use :func:`setup` instead. """ return setup(env=self) def __repr__(self): c = type(self) rc = self.rating_class if callable(self.k_factor): f = self.k_factor k_factor = '.'.join([f.__module__, f.__name__]) else: k_factor = '%.3f' % self.k_factor args = ('.'.join([c.__module__, c.__name__]), k_factor, '.'.join([rc.__module__, rc.__name__]), self.initial, self.beta) return ('%s(k_factor=%s, rating_class=%s, ' 'initial=%.3f, beta=%.3f)' % args) def rate(rating, series): return global_env().rate(rating, series) def adjust(rating, series): return global_env().adjust(rating, series) def expect(rating, other_rating): return global_env().expect(rating, other_rating) def rate_1vs1(rating1, rating2, drawn=False): return global_env().rate_1vs1(rating1, rating2, drawn) def adjust_1vs1(rating1, rating2, drawn=False): return global_env().adjust_1vs1(rating1, rating2, drawn) def quality_1vs1(rating1, rating2): return global_env().quality_1vs1(rating1, rating2) def setup(k_factor=K_FACTOR, rating_class=RATING_CLASS, initial=INITIAL, beta=BETA, env=None): if env is None: env = Elo(k_factor, rating_class, initial, beta) global_env.__elo__ = env return env def global_env(): """Gets the global Elo environment.""" try: global_env.__elo__ except AttributeError: # setup the default environment setup() return global_env.__elo__ # ------------------------------------------------------- def Outputs(data): return 1.-(1./(1.+np.exp(-data))) def GPIndividual1(data): predictions = (np.sinh(((((np.sinh(data["team1Seed"]) - data["team2Seed"]) + ((np.tanh(data["team2Wmax"]) + ((data["team1Lstd"] + np.minimum( (data["team1losses"]), (data["year"])))/2.0))/2.0)) + ((data["team2Seed"] == (1.0/(1.0 + np.exp(- data["team2wins"])))).astype(float)))/2.0)) + ((np.cos(((np.round(data["team2Wmedian"]) <= data["team1LAverage"]).astype(float))) - np.maximum( ((data["team1Seed"] * data["team2Lstd"])), (np.round(np.tanh(np.maximum( (np.maximum( (data["team2Lstd"]), (data["team2Wstd"]))), (data["team1wins"]))))))) / 2.0) + ((np.floor(np.minimum( (((1.732051 == data["team1Lmax"]).astype(float))), (np.cos(data["team1WAverage"])))) == ((np.round(((((-(data["team2LAverage"])) <= data["team2losses"]).astype(float)) - 2.212120)) <= (data["team2Wmin"] * data["team2losses"])).astype(float))).astype(float)) + np.minimum( ((np.abs(data["team1Wmedian"]) - ((data["team1Seed"] >= np.abs(data["team1Lmedian"])).astype(float)))), (np.round(np.sinh(np.minimum( ((((data["team2WAverage"] != data["team1Seed"]).astype(float)) + data["team2WAverage"])), ((-(((data["team1Wmin"] >= 2.718282).astype(float)))))))))) + ((np.minimum( (-1.0), (data["team2Lmax"])) > (data["team2Wmax"] - np.minimum( (data["team1Lmax"]), ((data["team2Wmin"] * (data["team2Wmax"] - np.minimum( (data["team2Wmin"]), (np.tanh(np.sin((data["team1Lmax"] * 2.0))))))))))).astype(float)) + np.minimum( (((data["team2WAverage"] >= np.floor(data["team2Wmin"])).astype(float))), (np.abs(((data["team1Seed"] >= np.sinh(((0.693147 > np.minimum( (data["team2Wmedian"]), (((data["team1Seed"] <= ((data["team1Wmedian"] <= np.cos(0.693147)).astype(float))).astype(float))))).astype(float)))).astype(float))))) + np.sin(np.sinh(((((-((((-(0.367879)) <= data["team1Lmax"]).astype(float)))) + ((data["team1Wmin"] >= np.floor(data["team1Seed"])).astype(float)))/2.0) - ((np.sin(data["team2Wstd"]) > (data["team2Wmax"] + np.abs(data["team2"]))).astype(float))))) + (((((np.sin(data["team1Lmax"]) > data["team1Wstd"]).astype(float)) != ((data["team1Lmax"] == data["team2wins"]).astype(float))).astype(float)) * (((-(data["team2Wmin"])) + ((data["team1Lstd"] + np.minimum( (data["team2wins"]), (np.minimum( (data["team1Lmax"]), (data["team2Wmin"])))))/2.0))/2.0)) + np.maximum( (np.minimum( (data["team1Wmin"]), (np.ceil(np.minimum( (np.minimum( (0.138462), (((data["team1Seed"] >= data["team2Lmedian"]).astype(float))))), (data["team2losses"])))))), ((((-(np.maximum( (data["team2"]), (data["team2Seed"])))) > ((data["team1losses"] < 1.414214).astype(float))).astype(float)))) + np.minimum( (np.maximum( (data["team1Lmin"]), ((-(((data["team1wins"] >= np.cos(0.720430)).astype(float))))))), (np.minimum( (np.ceil((data["team1Wmedian"] / 2.0))), ((-(((data["team1Wmin"] >= (1.197370 + ((data["team1Wstd"] < 0.094340).astype(float)))).astype(float)))))))) + ((((-(np.abs(np.abs(((data["team1"] + (-(0.138462)))/2.0))))) * ((0.367879 >= data["team2wins"]).astype(float))) > ((data["team1Wmedian"] + np.maximum( (data["team1"]), (((0.367879 != data["team1"]).astype(float)))))/2.0)).astype(float)) + ((3.0 == np.maximum( (np.round(np.maximum( (np.sinh(data["team2Lmin"])), (data["team2LAverage"])))), (np.floor(np.maximum( (np.sinh(np.maximum( ((data["team1"] * 2.0)), (data["team1Wmedian"])))), (np.sinh((data["team2Wmedian"] * np.sin(data["team2WAverage"]))))))))).astype(float)) + np.minimum( (np.ceil(((data["team2Wmin"] + ((0.094340 >= data["team2"]).astype(float)))/2.0))), ((np.minimum( ((data["team1Lmax"] * data["team1Wmedian"])), (((data["team1Wmedian"] < (data["team1Wmax"] - data["team2Lmedian"])).astype(float)))) * np.maximum( (data["team2Seed"]), (data["team1Wmax"]))))) + ((-(((data["team2Wmin"] >= ((-((data["team2Wstd"] + 0.318310))) * (1.0/(1.0 + np.exp(- (-((1.0/(1.0 + np.exp(- 0.318310)))))))))).astype(float)))) * (((1.0/(1.0 + np.exp(- data["year"]))) * data["team1Lmin"]) * data["team2Lstd"])) + np.floor(np.cos(((data["team1WAverage"] * np.minimum( ((data["team1WAverage"] * data["team2Lmax"])), (data["team1Lstd"]))) * ((np.sin(np.round(data["team2Lmax"])) + ((data["team1LAverage"] != data["team2WAverage"]).astype(float)))/2.0)))) + np.ceil(((2.675680 <= np.abs(np.maximum( ((data["team2"] + np.maximum( (np.abs(data["team1Seed"])), (data["team2LAverage"])))), ((0.318310 + (np.minimum( (data["team1Wmedian"]), (((data["team2"] != data["team2LAverage"]).astype(float)))) - data["team2Lmin"])))))).astype(float))) + ((np.sinh(np.sin(data["team2Lstd"])) * np.round(np.minimum( (np.sin(np.sinh(np.round(data["team1Wmin"])))), ((np.minimum( (data["team1Lstd"]), (np.sin(data["team2Lstd"]))) * np.sin(data["team2Lstd"])))))) / 2.0) + ((((data["team2"] <= ((((data["team1Lmin"] + 5.428570)/2.0) + (np.cos(np.maximum( (data["team1Lmin"]), (np.maximum( ((1.0/(1.0 + np.exp(- data["team1Wmin"])))), (data["team2LAverage"]))))) / 2.0))/2.0)).astype(float)) <= ((((data["team2"] + 5.428570)/2.0) <= data["team1Wmedian"]).astype(float))).astype(float)) + np.floor(np.cos((data["team2Lmin"] * np.minimum( ((data["team1wins"] + ((data["year"] + data["team2Wmedian"])/2.0))), ((np.minimum( (data["year"]), (data["team1wins"])) + ((((data["year"] > data["team2Wmin"]).astype(float)) + data["team2Wmedian"])/2.0))))))) + np.minimum( ((((np.minimum( (((data["team1Wmedian"] >= data["team1WAverage"]).astype(float))), (data["team2losses"])) / 2.0) > data["team1Lmax"]).astype(float))), (((data["team1Wmedian"] >= (1.0/(1.0 + np.exp(- ((data["team1Wmax"] > ((data["team1WAverage"] < (data["team1Wmedian"] - data["team2Lmin"])).astype(float))).astype(float)))))).astype(float)))) + (((0.602941 <= (data["team2Wmin"] - ((((np.cos(data["team1Wmedian"]) * 2.0) * 2.0) >= 1.570796).astype(float)))).astype(float)) * np.sin(np.sinh(np.sinh(data["team2Wstd"])))) + (data["team1losses"] * ((data["team1Wmedian"] >= (np.tanh((((((-(data["team1Lmin"])) > 0.434294).astype(float)) != ((np.minimum( (data["team1wins"]), (((0.434294 <= data["team2losses"]).astype(float)))) < data["team1Wmedian"]).astype(float))).astype(float))) * 2.0)).astype(float))) + np.maximum( (((np.minimum( (data["team1Lmedian"]), (((data["team2"] > np.maximum( (data["team2losses"]), (0.585714))).astype(float)))) >= (data["team1WAverage"] + ((1.414214 > data["team2Lmin"]).astype(float)))).astype(float))), (((data["team2Wmin"] < (data["team1wins"] - 3.141593)).astype(float)))) + np.round((np.round(((data["team2Lmedian"] * ((data["year"] > ((2.675680 + ((data["team1LAverage"] <= np.maximum( (data["team1WAverage"]), (0.094340))).astype(float)))/2.0)).astype(float))) * 2.0)) * 2.0)) + ((np.abs(np.sinh(np.abs(data["team2Lstd"]))) <= (data["team1Lmax"] * ((data["team2losses"] <= (-(((((data["team2Lstd"] <= np.minimum( (data["team2wins"]), (data["team2losses"]))).astype(float)) < np.maximum( (data["team2Wmedian"]), (data["team1losses"]))).astype(float))))).astype(float)))).astype(float)) + np.minimum( (np.cos(data["team1"])), (((((((((((data["team1"] / 2.0) / 2.0) * 9.869604) <= 0.058823).astype(float)) <= data["team1Wstd"]).astype(float)) == np.ceil(((data["team1"] / 2.0) * 9.869604))).astype(float)) - 0.094340))) + np.maximum( (np.round(((2.212120 <= (data["team1Wmax"] - ((data["team2Lmin"] + data["team2Lmedian"])/2.0))).astype(float)))), (((3.0 < (data["team2losses"] + np.maximum( ((-(((data["team2Lmin"] + data["team2LAverage"])/2.0)))), (data["team1"])))).astype(float)))) + ((data["team2wins"] - np.sin(data["team2Wmin"])) * ((np.maximum( (data["team2wins"]), (0.840000)) <= np.minimum( (data["team1Lmax"]), ((np.maximum( (data["team2Wmax"]), ((data["team2wins"] * np.floor(data["team2Wmax"])))) - 0.058823)))).astype(float))) + ((math.tanh((-(1.630430))) > np.sin(np.maximum( (data["team2Wmin"]), (np.minimum( (np.minimum( (data["team2Seed"]), (((data["team1LAverage"] + data["team1Wstd"])/2.0)))), ((((data["team2Seed"] <= data["team2Wmin"]).astype(float)) - data["team2Lstd"]))))))).astype(float)) + np.floor(np.cos(((1.570796 + (np.minimum( (data["team1LAverage"]), (((data["team1WAverage"] <= ((((((data["team1Wmin"] + data["team1WAverage"])/2.0) < ((data["team2Seed"] >= data["team1Seed"]).astype(float))).astype(float)) + (data["team2Lmedian"] * 0.636620))/2.0)).astype(float)))) * 2.0))/2.0))) + ((data["team2Wmin"] > ((0.318310 + (((1.0/(1.0 + np.exp(- (((data["team2Seed"] * np.maximum( (data["team2"]), (data["team1Lmax"]))) <= ((data["team2losses"] < data["team1Lmax"]).astype(float))).astype(float))))) < data["team2Wmin"]).astype(float))) * 2.0)).astype(float)) + np.sinh(np.floor((0.367879 - (((((np.minimum( (data["team1LAverage"]), (np.floor(data["team2WAverage"]))) == ((2.409090 < -3.0))).astype(float)) + (data["team2wins"] * np.sin(np.minimum( (data["team1Lmax"]), (data["team2WAverage"])))))/2.0) / 2.0)))) + (((data["team1Wmax"] < (-2.0 + ((data["team1wins"] < ((data["team1Wstd"] - (((data["team1Wstd"] * data["team1Wstd"]) < data["team2Wstd"]).astype(float))) - np.sinh((((data["team2Wmax"] > data["team2Lstd"]).astype(float)) * 2.0)))).astype(float)))).astype(float)) * 2.0) + np.tanh(np.sin(np.round(np.tanh((data["team2Wmax"] * ((np.round(data["team2LAverage"]) == ((((data["team1Wmin"] < data["team1LAverage"]).astype(float)) > ((data["team2Wmin"] >= np.cos(np.minimum( (data["team2Wmax"]), (data["team2LAverage"])))).astype(float))).astype(float))).astype(float))))))) + np.minimum( (np.cos(data["team1losses"])), (((1.197370 < (data["team2"] * ((data["team1Lmax"] + np.round(((data["team1Wstd"] - ((((data["team1Lmax"] / 2.0) > data["team2Wmax"]).astype(float)) / 2.0)) / 2.0)))/2.0))).astype(float)))) + np.abs(((((data["team1WAverage"] > data["team2Wstd"]).astype(float)) * 2.0) * (np.tanh(1.732051) * ((((data["team1wins"] <= 1.732051).astype(float)) < ((np.cos(data["team2Lmedian"]) > np.abs(np.sin((data["team2losses"] * 2.0)))).astype(float))).astype(float))))) + np.minimum( (np.cos((data["team1Wmin"] * data["team2WAverage"]))), (np.minimum( (((-(((np.abs(data["team1WAverage"]) > 1.414214).astype(float)))) / 2.0)), (np.cos(np.maximum( (data["team1Wmax"]), ((data["team1wins"] - data["team2Wmedian"])))))))) + np.abs(np.minimum( (np.minimum( (((np.abs(data["team1Lmax"]) > ((1.732051 > (data["team1Wmedian"] + data["team1"])).astype(float))).astype(float))), (np.cos(np.minimum( (data["team2wins"]), ((-(np.abs(data["team1Lmax"]))))))))), (
np.cos(data["team1LAverage"])
numpy.cos
import numpy as np import cv2 import os import torch.utils.data as data import math from utils.image import flip, color_aug from utils.image import get_affine_transform, affine_transform from utils.image import gaussian_radius, draw_umich_gaussian, draw_msra_gaussian from utils.image import draw_dense_reg from opts import opts import matplotlib.pyplot as plt class CenterLandmarkDataset(data.Dataset): def get_border(self, border, size): i = 1 while size - border // i <= border // i: i *= 2 return border // i def __getitem__(self, index): img_id = self.images[index] #loadImgs(ids=[img_id]) return a list, whose length = 1 file_name = self.coco.loadImgs(ids=[img_id])[0]['file_name'] img_path = os.path.join(self.img_dir, file_name) ann_ids = self.coco.getAnnIds(imgIds=[img_id]) anns = self.coco.loadAnns(ids=ann_ids) num_objs = min(len(anns), self.max_objs) cropped = False if self.split == 'train': if np.random.random() < 1: cropped = True file_name = file_name.split('.')[0]+'crop.jpg' img_path = os.path.join(self.img_dir, file_name) if self.split == 'val': cropped = True img = cv2.imread(img_path) height, width = img.shape[0], img.shape[1] c = np.array([img.shape[1] / 2., img.shape[0] / 2.], dtype=np.float32) s = max(img.shape[0], img.shape[1]) * 1.0 rot = 0 flipped = False rotted = False # input_res is max(input_h, input_w), input is the size of original img if np.random.random() < self.opts.keep_inp_res_prob and max((height | 127) + 1, (width | 127) + 1) < 1024: self.opts.input_h = (height | 127) + 1 self.opts.input_w = (width | 127) + 1 self.opts.output_h = self.opts.input_h // self.opts.down_ratio self.opts.output_w = self.opts.input_w // self.opts.down_ratio self.opts.input_res = max(self.opts.input_h, self.opts.input_w) self.opts.output_res = max(self.opts.output_h, self.opts.output_w) trans_input = get_affine_transform( c, s, rot, [self.opts.input_res, self.opts.input_res]) inp = cv2.warpAffine(img, trans_input, (self.opts.input_res, self.opts.input_res), flags=cv2.INTER_LINEAR) inp = (inp.astype(np.float32) / 255.) inp = (inp - self.mean) / self.std #change data shape to [3, input_size, input_size] inp = inp.transpose(2, 0, 1) #output_res is max(output_h, output_w), output is the size after down sampling output_res = self.opts.output_res num_joints = self.num_joints trans_output_rot = get_affine_transform(c, s, rot, [output_res, output_res]) trans_output = get_affine_transform(c, s, 0, [output_res, output_res]) hm = np.zeros((self.num_classes, output_res, output_res), dtype=np.float32) hm_hp = np.zeros((num_joints, output_res, output_res), dtype=np.float32) dense_kps = np.zeros((num_joints, 2, output_res, output_res), dtype=np.float32) dense_kps_mask = np.zeros((num_joints, output_res, output_res), dtype=np.float32) wh = np.zeros((self.max_objs, 2), dtype=np.float32) kps = np.zeros((self.max_objs, 2*num_joints), dtype=np.float32) reg = np.zeros((self.max_objs, 2), dtype=np.float32) ind = np.zeros((self.max_objs), dtype=np.int64) reg_mask = np.zeros((self.max_objs), dtype=np.uint8) kps_mask = np.zeros((self.max_objs, self.num_joints * 2), dtype=np.uint8) hp_offset = np.zeros((self.max_objs * num_joints, 2), dtype=np.float32) hp_ind = np.zeros((self.max_objs * num_joints), dtype=np.int64) hp_mask = np.zeros((self.max_objs * num_joints), dtype=np.int64) draw_gaussian = draw_msra_gaussian if self.opts.mse_loss else \ draw_umich_gaussian gt_det = [] for k in range(num_objs): ann = anns[k] if cropped: bbox = np.array(ann['bbox']) else: bbox = np.array(ann['org_bbox']) cls_id = int(ann['category_id']) - 1 if cropped: pts =
np.array(ann['keypoints'], np.float32)
numpy.array
"""Simulate a population of Kepler planets.""" import numpy as np import matplotlib.pyplot as pl import tidal from scipy.stats import beta from tqdm import tqdm from collections import OrderedDict np.random.seed(1234) def sample_e(size=1): """From Kipping (2013). See also Hogg, Myers and Bovy (2010).""" a = 0.867 b = 3.03 return beta.rvs(a, b, size=size) def sample_a(size=1): """Sample from a flat prior for a, based on zero physics.""" inner = 0.01 outer = 0.3 return inner + (outer - inner) * np.random.random(size) def sample_r(size=1): """ Sample from the planet radius distribution. Very loosely based on Fulton et al. (2017). """ mu = 2.4 sig = 0.7 res = mu + sig * np.random.randn(size) res[res < 0.1] = 0.1 return res def sample_M(size=1): """Every star is a Sun, ish.""" res = 1 + 0.1 * np.random.randn(size) res[res < 0.1] = 0.1 return res def sample_R(M, size=1): """Very simple mass-radius relation for stars.""" res = M ** (3. / 7.) + 0.1 * np.random.randn(size) res[res < 0.1] = 0.1 return res def sample_m(r, size=1): """Made-up radius-mass relation for planets.""" res = r ** (1 / 0.55) + 0.1 *
np.random.randn(size)
numpy.random.randn
import numpy as np from scipy.sparse import diags,bmat from scipy.sparse.linalg import spsolve class CurvedTrapezoidalDuctFlowClass(object): """This class provides a finite difference implementation for solving steady flow through a curved duct having a trapezoidal cross-section. Solutions may be computed both with and without using the Dean approximation (solutions in this are often referred to as Dean flow). The specific equations and non-dimensionalisation used within this class are described in my publication here doi.org/10.1017/S1446181118000287 (noting, however, that this paper describes an alternative numerical method to solve these equations for a larger variety of cross-section shapes). Specifically, refer to the non-linear PDE given in equations (2.3). This class, in fact, solves an appropriate transformation of these equations, i.e. one which maps rectangular coordinates to certain trapezoidal cross-sections. The solver uses Newton's method to solve the fully coupled non-linear problem. The linear system for each iteration is contructed in sparse matrix format and solved using sparse LU by default (although using bicgstab is an option). The discretisation is such that the solutions achieve second order convergence with respect to grid resolution. """ def __init__(self,m=65,n=65,W=2.0,H=2.0,epsilon=0.01,K=1.0,G=4.0,\ alpha=0.0,beta=0.0,delta=None,symmetric=True): """ Initialise the class with the desired parameters. Some parameters can be changed later, excepting W,H (I would recommend using a separate class instance for different shapes). Similarly, changing m,n is loosely supported, but using different instances would probably better. Parameters ---------- m,n : int,int The number of points in the finite difference discretisation, m being the number of points across the width, and n being the number of points across the height. Note that array shape/dimensions will be ordered as (n,m). Defaults to 65,65 W,H : float The width and height of the rectangular cross-section (in dimensionless coordinates). To be consistent with the non-dimensionalisation in the referenced paper these should generally be scaled such that min(W,H)=2. Defaults to 2.0,2.0 epsilon: float The curvature of the duct, that is 1/R given a bend radius R in dimensionless coordinates. Providing a value of 0 means the solution corresponds to 'Dean flow'. Defaults to 0.0 K : float The Dean number used in the equations (specifically K=epsilon*Re^2). Observe this can be specified as non-zero even if epsilon=0. Defaults to 1.0 G : float The pressure gradient driving the axial flow. Ideally it should be chosen such that max(u)=1.0 given K=0.0 (e.g. 4.0/L^2 would be the appropriate choice for a circular pipe and is generally close enough for our purposes). You should only change this if you understand the consequences on the scaling of both the axial velocity and stream-function. Defaults to 4.0 alpha,beta: float Coefficients which describe the cross-section shape. Specifically, the rectangular coordinates (r,z) in [-W/2,W/2]x[-H/2,H/2] are mapped to (r,z+alpha*r+beta*r*z) which can describe a wide range of trapezoidal/rhombus cross-sections having vertical side walls. If delta!=None any values passed here are ignored. delta: float Provides a convenient way to specify trapezoidal cross-sections. The delta parameter describes a cross-section whose height is H*(1+delta*r/(W/2)) for each r across its width. If delta!=None is specified, then the alpha,beta parameters are ignored and the symmetric parameter is checked. symmetric: bool Only checked when delta!=None is specified. If True then alpha=0 is set so that the cross-section is vertically symmetric, if False then alpha is set such that the bottom wall is flat (i.e. perpendicular to the sides). """ self._shape = (n,m) self._size = (H,W) self._epsilon = epsilon self._K = K self._G = G # self._alpha = alpha self._beta = beta if delta is not None: self._beta = delta*2/W if symmetric: # z -> z*(1+delta*r/(W/2)) self._alpha = 0.0 else: # z -> (z+H/2)*(1+delta*r/(W/2))-H/2=z+r*z*delta/(W/2)+r*delta*H/W self._alpha = delta*H/W # Define other useful numbers self._L = min(0.5*W,0.5*H) # probably not really needed... self._N = n*m # probably not really needed... self._dr = W/(m-1) self._dz = H/(n-1) # Construct the arrays describing the rectangular coordinate system self._r = np.linspace(-0.5*W,0.5*W,m) self._z = np.linspace(-0.5*H,0.5*H,n) self._R,self._Z = np.meshgrid(self._r,self._z) # Note: use default index order # Construct array describing the vertical trapezoidal coordinate (R is same) self._Zt = self._Z+self._alpha*self._R+self._beta*self._R*self._Z # Define some useful meshgrids depending on physical dimensions if self._epsilon==0.0: self._Tau = 1.0 else: self._Tau = 1.0+self._epsilon*self._R if self._beta==0.0: self._Sigma = 1.0 self._Omega = self._alpha else: self._Sigma = 1.0+self._beta*self._R self._Omega = self._alpha+self._beta*self._Z # Pre-allocate array for holding an initial guess (2*8*m*n bytes) self._u_old = np.zeros((n,m)) self._Phi_old = np.zeros((n,m)) self._u_old_is_zero = True # tracks whether an initial u iteration should be performed # Pre-allocate arrays of intermediate results self._dudr = np.zeros((n,m)) self._dudz = np.zeros((n,m)) self._d2udr2 = np.zeros((n,m)) self._d2udrdz = np.zeros((n,m)) self._d2udz2 =
np.zeros((n,m))
numpy.zeros
# test module for resqpy.olio.transmission.py import math as maths import os import numpy as np import pytest from numpy.testing import assert_array_almost_equal import resqpy.grid as grr import resqpy.model as rq import resqpy.olio.transmission as rqtr import resqpy.olio.uuid as bu import resqpy.olio.vector_utilities as vec def test_regular_grid_half_cell_transmission(tmp_path): def try_one_half_t_regular(model, extent_kji = (2, 2, 2), dxyz = (1.0, 1.0, 1.0), perm_kji = (1.0, 1.0, 1.0), ntg = 1.0, darcy_constant = 1.0, rotate = None, dip = None): ones = np.ones(extent_kji) grid = grr.RegularGrid(model, extent_kji = extent_kji, dxyz = dxyz) if dip is not None: # dip positive x axis downwards r_matrix = vec.rotation_matrix_3d_axial(1, dip) p = grid.points_ref(masked = False) p[:] = vec.rotate_array(r_matrix, p) if rotate is not None: # rotate anticlockwise in xy plane (viewed from above) r_matrix = vec.rotation_matrix_3d_axial(2, rotate) p = grid.points_ref(masked = False) p[:] = vec.rotate_array(r_matrix, p) half_t = rqtr.half_cell_t(grid, perm_k = perm_kji[0] * ones, perm_j = perm_kji[1] * ones, perm_i = perm_kji[2] * ones, ntg = ntg * ones, darcy_constant = darcy_constant) expected = 2.0 * darcy_constant * np.array( (perm_kji[0] * dxyz[0] * dxyz[1] / dxyz[2], ntg * perm_kji[1] * dxyz[0] * dxyz[2] / dxyz[1], ntg * perm_kji[2] * dxyz[1] * dxyz[2] / dxyz[0])) assert np.all(np.isclose(half_t, expected.reshape(1, 1, 1, 3))) temp_epc = str(os.path.join(tmp_path, f"{bu.new_uuid()}.epc")) model = rq.Model(temp_epc, new_epc = True, create_basics = True) try_one_half_t_regular(model) try_one_half_t_regular(model, extent_kji = (3, 4, 5)) try_one_half_t_regular(model, dxyz = (127.53, 21.05, 12.6452)) try_one_half_t_regular(model, perm_kji = (123.23, 512.4, 314.7)) try_one_half_t_regular(model, ntg = 0.7) try_one_half_t_regular(model, darcy_constant = 0.001127) try_one_half_t_regular(model, extent_kji = (5, 4, 3), dxyz = (84.23, 77.31, 15.823), perm_kji = (0.6732, 298.14, 384.2), ntg = 0.32, darcy_constant = 0.008527) try_one_half_t_regular(model, rotate = 67.8) # should not have written anything, but try clean-up just in case try: os.remove(temp_epc) except Exception: pass try: os.remove(temp_epc[-4] + '.h5') except Exception: pass def test_half_cell_t_2d_triangular_precursor_equilateral(): side = 123.45 height = side * maths.sin(vec.radians_from_degrees(60.0)) # create a pair of equilateral triangles p = np.array([(0.0, 0.0), (side, 0.0), (side / 2.0, height), (side * 3.0 / 2.0, height)]) t = np.array([(0, 1, 2), (1, 2, 3)], dtype = int) a, b = rqtr.half_cell_t_2d_triangular_precursor(p, t) a_over_l = a / b expected = side / (height / 3) assert a_over_l.shape == (2, 3)
assert_array_almost_equal(a_over_l, expected)
numpy.testing.assert_array_almost_equal
# -*- coding: utf-8 -*- """ Detect CV (consonant-vowel) pair events in speaker and microphone channels. """ # Third party libraries import numpy as np import scipy.signal as sgn from ecogvis.signal_processing.resample import resample def detect_events(speaker_data, mic_data=None, interval=None, dfact=30, smooth_width=0.4, speaker_threshold=0.05, mic_threshold=0.05, direction='both'): """ Automatically detects events in audio signals. Parameters ---------- speaker_data : 'pynwb.base.TimeSeries' object Object containing speaker data. mic_data : 'pynwb.base.TimeSeries' object Object containing microphone data. interval : list of floats Interval to be used [Start_bin, End_bin]. If 'None', the whole signal is used. dfact : float Downsampling factor. Default 30. smooth_width: float Width scale for median smoothing filter (default = .4, decent for CVs). speaker_threshold : float Sets threshold level for speaker. mic_threshold : float Sets threshold level for mic. direction : str 'Up' detects events start times. 'Down' detects events stop times. 'Both' detects both start and stop times. Returns ------- speakerDS : 1D array of floats Downsampled speaker signal. speakerEventDS : 1D array of floats Event times for speaker signal. speakerFilt : 1D array of floats Filtered speaker signal. micDS : 1D array of floats Downsampled microphone signal. micEventDS : 1D array of floats Event times for microphone signal. micFilt : 1D array of floats Filtered microphone signal. """ # Downsampling Speaker --------------------------------------------------- speakerDS, speakerEventDS, speakerFilt = None, None, None if speaker_data is not None: if interval is None: X = speaker_data.data[:] else: X = speaker_data.data[interval[0]:interval[1]] fs = speaker_data.rate # sampling rate ds = fs / dfact # Pad zeros to make signal length a power of 2, improves performance nBins = X.shape[0] extraBins = 2 ** (np.ceil(np.log2(nBins)).astype('int')) - nBins extraZeros = np.zeros(extraBins) X = np.append(X, extraZeros) speakerDS = resample(X, ds, fs) # Remove excess bins (because of zero padding on previous step) excessBins = int(np.ceil(extraBins * ds / fs)) speakerDS = speakerDS[0:-excessBins] # Kernel size must be an odd number speakerFilt = sgn.medfilt( volume=np.diff(np.append(speakerDS, speakerDS[-1])) ** 2, kernel_size=int((smooth_width * ds // 2) * 2 + 1)) # Normalize the filtered signal. speakerFilt /= np.max(np.abs(speakerFilt)) # Find threshold crossing times stimBinsDS = threshcross(speakerFilt, speaker_threshold, direction) # Remove events that have a duration less than 0.1 s. speaker_events = stimBinsDS.reshape((-1, 2)) rem_ind = np.where((speaker_events[:, 1] - speaker_events[:, 0]) < ds * 0.1)[0] speaker_events = np.delete(speaker_events, rem_ind, axis=0) stimBinsDS = speaker_events.reshape((-1)) # Transform bins to time speakerEventDS = (stimBinsDS / ds) + (interval[0] / fs) # Downsampling Mic ------------------------------------------------------- micDS, micEventDS, micFilt = None, None, None if mic_data is not None: if interval is None: X = mic_data.data[:] else: X = mic_data.data[interval[0]:interval[1]] fs = mic_data.rate # sampling rate ds = fs / dfact # Pad zeros to make signal length a power of 2, improves performance nBins = X.shape[0] extraBins = 2 ** (np.ceil(
np.log2(nBins)
numpy.log2
import sys import numpy as np import pytest import polynomials_on_simplices.algebra.multiindex as multiindex from polynomials_on_simplices.calculus.finite_difference import central_difference, central_difference_jacobian from polynomials_on_simplices.calculus.polynomial.polynomials_calculus import derivative from polynomials_on_simplices.calculus.polynomial.polynomials_simplex_bernstein_basis_calculus import ( integrate_bernstein_polynomial_unit_simplex) from polynomials_on_simplices.geometry.mesh.simplicial_complex import opposite_sub_simplex, simplex_vertices from polynomials_on_simplices.geometry.primitives.simplex import unit from polynomials_on_simplices.polynomial.polynomials_base import get_dimension, polynomials_equal from polynomials_on_simplices.polynomial.polynomials_monomial_basis import unique_identifier_monomial_basis from polynomials_on_simplices.polynomial.polynomials_unit_simplex_bernstein_basis import ( PolynomialBernstein, bernstein_basis_fn, degree_elevated_bernstein_basis_fn, dual_bernstein_basis_fn, dual_bernstein_basis_polynomial, dual_vector_valued_bernstein_basis, get_associated_sub_simplex, unique_identifier_bernstein_basis, unit_polynomial, vector_valued_bernstein_basis, zero_polynomial) from polynomials_on_simplices.probability_theory.uniform_sampling import nsimplex_sampling def test_call(): # Test calling a scalar valued univariate polynomial p = PolynomialBernstein([1, 1, 1], 2, 1) value = p(0.5) expected_value = 1 assert value == expected_value # Test calling a vector valued univariate polynomial p = PolynomialBernstein([[1, 1], [1, 1], [1, 1]], 2, 1) value = p(0.5) expected_value = np.array([1, 1]) assert np.linalg.norm(value - expected_value) < 1e-10 # Test calling a scalar valued bivariate polynomial p = PolynomialBernstein([1, 1, 1, 1, 1, 1], 2, 2) value = p([1 / 3, 1 / 3]) expected_value = 1 assert value == expected_value # Test calling a vector valued bivariate polynomial p = PolynomialBernstein([[1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]], 2, 2) value = p([1 / 3, 1 / 3]) expected_value = np.array([1, 1]) assert np.linalg.norm(value - expected_value) < 1e-10 def test_getitem(): # Test getting the components of a polynomial in P(R^m, R^n) for m in [1, 2, 3]: for n in [1, 2, 3]: r = 3 dim = get_dimension(r, m) if n == 1: a = np.random.random_sample(dim) else: a = np.random.random_sample((dim, n)) p = PolynomialBernstein(a, r, m) for i in range(n): if n == 1: def pi_expected(x): return p(x) else: def pi_expected(x): return p(x)[i] assert polynomials_equal(p[i], pi_expected, r, m) def test_add(): # Test adding two polynomials in P(R^m, R^n) for m in [1, 2, 3]: for n in [1, 2, 3]: r = 3 dim = get_dimension(r, m) if n == 1: a = np.random.random_sample(dim) b = np.random.random_sample(dim) else: a = np.random.random_sample((dim, n)) b = np.random.random_sample((dim, n)) p1 = PolynomialBernstein(a, r, m) p2 = PolynomialBernstein(b, r, m) def p_expected(x): return p1(x) + p2(x) assert polynomials_equal(p1 + p2, p_expected, r, m) # Test adding two polynomials in P(R^m, R^n) of different degree for m in [1, 2, 3]: for n in [1, 2, 3]: r1 = 2 r2 = 3 dim1 = get_dimension(r1, m) dim2 = get_dimension(r2, m) if n == 1: a = np.random.random_sample(dim1) b = np.random.random_sample(dim2) else: a = np.random.random_sample((dim1, n)) b = np.random.random_sample((dim2, n)) p1 = PolynomialBernstein(a, r1, m) p2 = PolynomialBernstein(b, r2, m) def p_expected(x): return p1(x) + p2(x) assert polynomials_equal(p1 + p2, p_expected, r, m) def test_sub(): # Test subtracting two polynomials in P(R^m, R^n) for m in [1, 2, 3]: for n in [1, 2, 3]: r = 3 dim = get_dimension(r, m) if n == 1: a = np.random.random_sample(dim) b = np.random.random_sample(dim) else: a = np.random.random_sample((dim, n)) b = np.random.random_sample((dim, n)) p1 = PolynomialBernstein(a, r, m) p2 = PolynomialBernstein(b, r, m) def p_expected(x): return p1(x) - p2(x) assert polynomials_equal(p1 - p2, p_expected, r, m) # Test subtracting two polynomials in P(R^m, R^n) of different degree for m in [1, 2, 3]: for n in [1, 2, 3]: r1 = 2 r2 = 3 dim1 = get_dimension(r1, m) dim2 = get_dimension(r2, m) if n == 1: a = np.random.random_sample(dim1) b = np.random.random_sample(dim2) else: a = np.random.random_sample((dim1, n)) b = np.random.random_sample((dim2, n)) p1 = PolynomialBernstein(a, r1, m) p2 = PolynomialBernstein(b, r2, m) def p_expected(x): return p1(x) - p2(x) assert polynomials_equal(p1 - p2, p_expected, r, m) def test_mul(): # Test multiplying a polynomial in P(R^m, R^n) with a scalar for m in [1, 2, 3]: for n in [1, 2, 3]: r = 3 dim = get_dimension(r, m) if n == 1: a = np.random.random_sample(dim) else: a = np.random.random_sample((dim, n)) s = np.random.rand() p = PolynomialBernstein(a, r, m) def p_expected(x): return s * p(x) assert polynomials_equal(s * p, p_expected, r, m) assert polynomials_equal(p * s, p_expected, r, m) # Test multiplying a polynomial in P(R^m) = P(R^m, R^1) with a vector for m in [1, 2, 3]: r = 3 dim = get_dimension(r, m) a = np.random.random_sample(dim) v = np.random.rand(2) p = PolynomialBernstein(a, r, m) def p_expected(x): return v * p(x) # Can't do this, because this will be handled by the Numpy ndarray __mul__ method and result in Numpy array # of polynomials # assert polynomials_equal(v * p, p_expected, r, m) assert polynomials_equal(p * v, p_expected, r, m) # Test multiplying two polynomials in P(R^m) = P(R^m, R^1) for m in [1, 2, 3]: r1 = 3 r2 = 2 dim1 = get_dimension(r1, m) a = np.random.random_sample(dim1) dim2 = get_dimension(r2, m) b = np.random.random_sample(dim2) p1 = PolynomialBernstein(a, r1, m) p2 = PolynomialBernstein(b, r2, m) def p_expected(x): return p1(x) * p2(x) assert polynomials_equal(p1 * p2, p_expected, r1 + r2, m) def test_div(): # Test dividing a polynomial in P(R^m, R^n) with a scalar for m in [1, 2, 3]: for n in [1, 2, 3]: r = 3 dim = get_dimension(r, m) if n == 1: a = np.random.random_sample(dim) else: a = np.random.random_sample((dim, n)) s = np.random.rand() p = PolynomialBernstein(a, r, m) def p_expected(x): return p(x) / s assert polynomials_equal(p / s, p_expected, r, m) def test_pow(): # Test taking the power of a polynomial in P(R^m, R^n) r = 3 for m in [1, 2, 3]: for n in [1, 2, 3]: if n == 1: exponents = range(r + 1) else: exponents = multiindex.generate_all(n, r) for exponent in exponents: r_base = 1 dim = get_dimension(r_base, m) if n == 1: a = np.random.random_sample(dim) else: a = np.random.random_sample((dim, n)) p = PolynomialBernstein(a, r_base, m) if n == 1: def p_expected(x): return p(x)**exponent else: def p_expected(x): return multiindex.power(p(x), exponent) assert polynomials_equal(p**exponent, p_expected, r, m) def test_partial_derivative(): for m in [1, 2, 3]: for n in [1, 2, 3]: for r in [0, 1, 2, 3]: dim = get_dimension(r, m) if n == 1: a = np.random.random_sample(dim) else: a = np.random.random_sample((dim, n)) p = PolynomialBernstein(a, r, m) for i in range(m): if n == 1: if m == 1: def dp_dxi_fd(x): return central_difference(p, x) else: def dp_dxi_fd(x): return central_difference(p, x)[i] else: def dp_dxi_fd(x): return central_difference_jacobian(p, n, x)[:, i] assert polynomials_equal(p.partial_derivative(i), dp_dxi_fd, r, m, rel_tol=1e-4, abs_tol=1e-6) def test_degree_elevate(): for m in [1, 2, 3]: for n in [1, 2, 3]: for r in [0, 1, 2, 3]: dim = get_dimension(r, m) if n == 1: a = np.random.random_sample(dim) else: a = np.random.random_sample((dim, n)) p = PolynomialBernstein(a, r, m) for s in range(r, r + 3): q = p.degree_elevate(s) assert polynomials_equal(p, q, s, m) @pytest.mark.slow def test_to_monomial_basis(): for m in [1, 2, 3]: for n in [1, 2, 3]: for r in [0, 1, 2, 3]: dim = get_dimension(r, m) if n == 1: a =
np.random.random_sample(dim)
numpy.random.random_sample
"""Contains a bunch of utilities useful during network training in PyTorch.""" import math from collections import deque from typing import Dict, Union, List, Tuple, Any, Callable import numpy as np import torch import torch.nn as nn from PIL import Image from torchvision import transforms def init_orthogonal(tensor, gain=1): r""" Taken from a future torch version """ if tensor.ndimension() < 2: raise ValueError("Only tensors with 2 or more dimensions are supported") rows = tensor.size(0) cols = tensor.numel() // rows flattened = tensor.new(rows, cols).normal_(0, 1) if rows < cols: flattened.t_() # Compute the qr factorization q, r = torch.qr(flattened) # Make Q uniform according to https://arxiv.org/pdf/math-ph/0609050.pdf d = torch.diag(r, 0) ph = d.sign() q *= ph if rows < cols: q.t_() tensor.view_as(q).copy_(q) tensor.mul_(gain) return tensor def get_gpu_memory_map(): # From https://discuss.pytorch.org/t/access-gpu-memory-usage-in-pytorch/3192/3 import subprocess """Get the current gpu usage. Returns ------- usage: dict Keys are device ids as integers. Values are memory usage as integers in MB. """ result = subprocess.check_output( ["nvidia-smi", "--query-gpu=memory.used", "--format=csv,nounits,noheader"], encoding="utf-8", ) # Convert lines into a dictionary gpu_memory = [int(x) for x in result.strip().split("\n")] gpu_memory_map = dict(zip(range(len(gpu_memory)), gpu_memory)) return gpu_memory_map def load_model_from_state_dict(model, state_dict): model_state_dict = model.state_dict() model_keys = set(model_state_dict.keys()) dict_keys = set(state_dict.keys()) in_model_not_in_dict = [] in_dict_not_in_model = [] wrong_parameter_sizes = [] for key in model_keys | dict_keys: if key in model_keys and key not in dict_keys: in_model_not_in_dict.append(key) elif key not in model_keys and key in dict_keys: in_dict_not_in_model.append(key) elif model_state_dict[key].shape != state_dict[key].shape: wrong_parameter_sizes.append(key) if ( len(in_model_not_in_dict) == 0 and len(in_dict_not_in_model) == 0 and len(wrong_parameter_sizes) == 0 ): return model.load_state_dict(state_dict) else: print( ( "WARNING: Loading model from state dictionary but:\n" "* The following parameters are present in the state" " dictionary and not in the model and will be ignored: {}\n" "* The following parameters are present in the model but " "not in the state and will remain in their initial state: {}\n" "* The following parameters are present in both the model and " "saved state but are of incompatible sizes, they will remain as in the model: {}\n" ).format( "\n\t- None" if len(in_dict_not_in_model) == 0 else "\n\t- " + "\n\t- ".join(in_dict_not_in_model), "\n\t- None" if len(in_model_not_in_dict) == 0 else "\n\t- " + "\n\t- ".join(in_model_not_in_dict), "\n\t- None" if len(wrong_parameter_sizes) == 0 else "\n\t- " + "\n\t- ".join(wrong_parameter_sizes), ) ) yn = input("Continue? (y/n)").lower().strip() if yn not in ["y", "yes"]: print("Aborting...") quit() return model.load_state_dict( { **model.state_dict(), **{ k: state_dict[k] for k in ((dict_keys - set(wrong_parameter_sizes)) & model_keys) }, } ) def count_parameters(model): return sum(p.numel() for p in model.parameters() if p.requires_grad) def binary_search_for_model_with_least_upper_bound_parameters( target_parameter_count, create_model_func: Callable[[int], nn.Module], lower: int, upper: int, ): assert lower <= upper lower_count = count_parameters(create_model_func(lower)) upper_count = count_parameters(create_model_func(upper)) assert lower_count <= target_parameter_count <= upper_count, "Invalid range" def run_search( target_parameter_count, create_model_func: Callable[[int], nn.Module], lower: int, upper: int, ): if lower == upper: return lower mid = int(math.floor((lower + upper) / 2)) mid_count = count_parameters(create_model_func(mid)) if mid_count == target_parameter_count: return mid elif mid_count > target_parameter_count: return run_search( target_parameter_count=target_parameter_count, create_model_func=create_model_func, lower=lower, upper=mid, ) else: return run_search( target_parameter_count=target_parameter_count, create_model_func=create_model_func, lower=mid + 1, upper=upper, ) return run_search( target_parameter_count=target_parameter_count, create_model_func=create_model_func, lower=lower, upper=upper, ) def logit_offsets_for_conditional_probabilities( action_group_dims: Tuple[int, ...] ) -> List[float]: consts = [0.0] for i in range(1, len(action_group_dims)): consts.append(math.log(action_group_dims[0] / action_group_dims[i])) return consts class ScalarMeanTracker(object): def __init__(self) -> None: self._sums: Dict[str, float] = {} self._counts: Dict[str, int] = {} def add_scalars(self, scalars: Dict[str, Union[float, int]]) -> None: for k in scalars: if np.isscalar(scalars[k]): if k not in self._sums: self._sums[k] = float(scalars[k]) self._counts[k] = 1 else: self._sums[k] += float(scalars[k]) self._counts[k] += 1 def means(self): means = {k: self._sums[k] / self._counts[k] for k in self._sums} return means def counts(self): return {**self._counts} def pop_and_reset_for_key(self, k): s = self._sums[k] c = self._counts[k] del self._sums[k] del self._counts[k] return s / c def pop_and_reset(self): means = {k: self._sums[k] / self._counts[k] for k in self._sums} self._sums = {} self._counts = {} return means class TensorConcatTracker(object): def __init__(self) -> None: self._tensors: Dict[str, torch.FloatTensor] = {} def add_tensors(self, tensors: Dict[str, Union[torch.FloatTensor, Any]]) -> None: for k in tensors: if type(tensors[k]) == torch.FloatTensor: if k not in self._tensors: self._tensors[k] = tensors[k] else: self._tensors[k] = torch.cat((self._tensors[k], tensors[k]), dim=0) def pop_and_reset(self): t = self._tensors self._tensors = {} return t class RollingAverage(object): """Computes and stores the running average as well as the average within a recent window""" def __init__(self, window_size): assert window_size > 0 self.window_size = window_size self.rolling_sum = 0 self.sum = 0 self.count = 0 self.rolling_deque = deque() def add(self, val): """Add one value.""" self.sum += val self.rolling_sum += val self.count += 1 self.rolling_deque.append(val) if len(self.rolling_deque) > self.window_size: self.rolling_sum -= self.rolling_deque.popleft() def rolling_average(self): assert self.count > 0 return self.rolling_sum / (1.0 * len(self.rolling_deque)) def full_average(self): assert self.count > 0 return self.sum / self.count class TrainTestInfoStore(object): def __init__(self, train_window_size, test_window_size): self.train_window_size = train_window_size self.test_window_size = test_window_size self.train_recent_save = [] self.train_averages = [] self.train_num_frames = [] self.test_recent_save = [] self.test_averages = [] self.test_num_frames = [] def add_train_result(self, episode_reward, num_frames): self.train_recent_save.append(episode_reward) if len(self.train_recent_save) == self.train_window_size: self.train_averages.append(np.mean(self.train_recent_save)) self.train_num_frames.append(num_frames) self.train_recent_save = [] def add_test_result(self, episode_reward, num_frames): self.test_recent_save.append(episode_reward) if len(self.test_recent_save) == self.test_window_size: self.test_averages.append(np.mean(self.test_recent_save)) self.test_num_frames.append(num_frames) self.test_recent_save = [] def train_results(self): return self.train_averages, self.train_num_frames def test_results(self): return self.test_averages, self.test_num_frames def train_full_average(self): sum = ( np.sum(self.train_recent_save) + np.sum(self.train_averages) * self.train_window_size ) return sum / ( len(self.train_averages) * self.train_window_size + len(self.train_recent_save) ) def test_full_average(self): sum = ( np.sum(self.test_recent_save) + np.sum(self.test_averages) * self.test_window_size ) return sum / ( len(self.test_averages) * self.test_window_size + len(self.test_recent_save) ) class AverageMeter(object): """Computes and stores the average and current value""" def __init__(self): self.reset() self.val = 0 self.avg = 0 self.sum = 0 self.count = 0 def reset(self): """Resets counters.""" self.val = 0 self.avg = 0 self.sum = 0 self.count = 0 def update(self, val, n=1): """Updates counters.""" self.val = val self.sum += val * n self.count += n self.avg = self.sum / self.count def save_gpu_model(model, optim, epoch, ckpt_fname): state_dict = model.state_dict() for key in state_dict.keys(): state_dict[key] = state_dict[key].cpu() optimizer = optim.state_dict() for key in optimizer.keys(): optimizer[key] = optimizer[key].cpu() torch.save( {"epoch": epoch, "state_dict": state_dict, "optimizer": optimizer}, ckpt_fname ) def save_model(model, optim, epoch, ckpt_fname): state_dict = model.state_dict() optimizer = optim.state_dict() torch.save( {"epoch": epoch, "state_dict": state_dict, "optimizer": optimizer}, ckpt_fname ) def show_image_stack(image_stack): """Displays the stack of images If the image_stack is of type torch.Tensor, then expected size is (1, N, H, W) If the image_stack is of type np.ndarray, then expected size is (H, W, N) """ import matplotlib matplotlib.use("TkAgg", force=False) import matplotlib.pyplot as plt # Keeping this outside causes issues in multiprocessing. if isinstance(image_stack, torch.Tensor): image_stack = image_stack.squeeze().cpu().numpy() image_stack = np.transpose(image_stack, (1, 2, 0)) num_images = image_stack.shape[2] length = np.ceil(np.sqrt(num_images)).item() plt.figure() for idx in range(num_images): plt.subplot(length, length, idx + 1) img = image_stack[:, :, idx] plt.imshow(img, cmap="gray") plt.show() def recursively_detach(to_detach: Any): """Recursively detach tensors in nested structure.""" if to_detach is None: return to_detach elif isinstance(to_detach, tuple): return tuple(recursively_detach(x) for x in to_detach) elif isinstance(to_detach, list): return [recursively_detach(x) for x in to_detach] elif isinstance(to_detach, dict): return {k: recursively_detach(to_detach[k]) for k in to_detach} elif isinstance(to_detach, set): return set(recursively_detach(x) for x in to_detach) elif ( isinstance(to_detach, np.ndarray) or
np.isscalar(to_detach)
numpy.isscalar
# mathematical imports import numpy as np from sklearn import metrics import pandas as pd # graphical imports from matplotlib import pyplot as plt import seaborn as sns # system imports import pickle import sys import os # pytorch imports import torch import torch.utils.data as data # my file imports sys.path.insert(0, '/Users/chanaross/dev/Thesis/MachineLearning/forGPU/') from LSTM_inputFullGrid_multiClassSmooth import Model, moving_average from dataLoader_uber import DataSet_oneLSTM_allGrid sys.path.insert(0, '/Users/chanaross/dev/Thesis/UtilsCode/') from createGif import create_gif sns.set() np.random.seed(1) def loadFile(fileName): with open(fileName+'.pkl', 'rb') as handle: data = pickle.load(handle) return data def checkResults(data_net, data_labels, data_real, timeIndexs, xIndexs, yIndexs, filePath, fileName, dataType): clr = np.random.rand(3, 3) t_size = data_net.shape[0] x_size = data_net.shape[1] y_size = data_net.shape[2] if dataType == 'Real': fileName = 'RealInput_'+fileName elif dataType == 'Smooth': fileName = 'SmoothInput_'+fileName for i, x in enumerate(xIndexs): for j, y in enumerate(yIndexs): fig, ax = plt.subplots(1, 1) # ax.plot(timeIndex, data_labels[:, i, j], color='g', marker='.', linestyle='-.', label=dataType + ' label output') ax.plot(timeIndexs, data_real[:, i, j], color='m', marker='o', linestyle='-', label=dataType + ' output') ax.plot(timeIndexs, data_net[:, i, j], color='k', marker='*', linestyle='--', label='net output') ax.set_xlabel('Time') ax.set_ylabel('Num Events') ax.set_title(fileName + ', (x,y):(' + str(x) + ',' + str(y) + ')') plt.legend() plt.show() # plt.savefig(filePath + 'timeResults_' + fileName + str(x) + 'x_' + str(y) + 'y_' + '.png') # plt.close() return def plotSpesificTime(data_net, data_labels, data_real, t, pathName, fileName, dataType, maxTick): dataReal = data_real.reshape(data_real.shape[1], data_real.shape[2]) dataPred = data_net.reshape(data_net.shape[1], data_net.shape[2]) day = np.floor_divide(t, 2 * 24) + 1 # sunday is 1 week = np.floor_divide(t, 2 * 24 * 7) + 14 # first week is week 14 of the year temp_hour, temp = np.divmod(t, 2) temp_hour += 8 # data starts from 98 but was normalized to 0 _, hour = np.divmod(temp_hour, 24) minute = temp * 30 dataFixed = np.zeros_like(dataReal) dataFixed = np.swapaxes(dataReal, 1, 0) dataFixed = np.flipud(dataFixed) dataFixedPred = np.zeros_like(dataPred) dataFixedPred = np.swapaxes(dataPred, 1, 0) dataFixedPred = np.flipud(dataFixedPred) f, axes = plt.subplots(1, 4) ticksDict = list(range(maxTick+1)) sns.heatmap(dataFixed, cbar=False, center=1, square=True, vmin=0, vmax=np.max(ticksDict), ax=axes[1], cmap='BuPu', cbar_kws=dict(ticks=ticksDict)) sns.heatmap(dataFixedPred, cbar=True, center=1, square=True, vmin=0, vmax=np.max(ticksDict), ax=axes[2], cmap='BuPu', cbar_kws=dict(ticks=ticksDict)) f.set_suptitle('week- {0}, day- {1},time- {2}:{3}'.format(week, day, hour, minute)) axes[0].set_title(dataType + 'real data') axes[1].set_title('predicted data') # plt.title('time is - {0}:{1}'.format(hour, minute)) axes[0].set_xlabel('X axis') axes[0].set_ylabel('Y axis') axes[1].set_xlabel('X axis') axes[1].set_ylabel('Y axis') plt.savefig(pathName + dataType + '_' + fileName + '_' + str(t) +'.png') plt.close() return def plotSpesificTime_allData(data_net, data_real, t, pathName, fileName, dataType, maxTick): dataReal = data_real.reshape(data_real.shape[1], data_real.shape[2]) dataPred = data_net.reshape(data_net.shape[1], data_net.shape[2]) day = np.floor_divide(t, 2 * 24) + 1 # sunday is 1 week = np.floor_divide(t, 2 * 24 * 7) + 14 # first week is week 14 of the year temp_hour, temp = np.divmod(t, 2) temp_hour += 8 # data starts from 98 but was normalized to 0 _, hour = np.divmod(temp_hour, 24) minute = temp * 30 dataFixed = np.zeros_like(dataReal) dataFixed = np.swapaxes(dataReal, 1, 0) dataFixed = np.flipud(dataFixed) dataFixedPred = np.zeros_like(dataPred) dataFixedPred = np.swapaxes(dataPred, 1, 0) dataFixedPred = np.flipud(dataFixedPred) f, axes = plt.subplots(1, 4) ticksDict = list(range(maxTick+1)) cbar_ax = f.add_axes([.91, .3, .03, .4]) sns.heatmap(dataFixedPred, cbar=False, center=1, square=True, vmin=0, vmax=np.max(ticksDict), ax=axes[1], cmap='CMRmap_r', cbar_kws=dict(ticks=ticksDict)) sns.heatmap(dataFixed, cbar=True, cbar_ax=cbar_ax, center=1, square=True, vmin=0, vmax=np.max(ticksDict), ax=axes[2], cmap='CMRmap_r', cbar_kws=dict(ticks=ticksDict)) f.suptitle('week- {0}, day- {1},time- {2}:{3}'.format(week, day, hour, minute), fontsize=16) axes[0].set_title('net-real data') axes[1].set_title('real data') axes[0].set_xlabel('X axis') axes[0].set_ylabel('Y axis') axes[1].set_xlabel('X axis') plt.savefig(pathName + dataType + '_' + fileName + '_' + str(t) +'.png') plt.close() return def createTimeGif(net_data, labels_data, real_data, timeIndexs, fileName, pathName, dataType): lengthX = net_data.shape[1] lengthY = net_data.shape[2] maxTick = np.max(real_data).astype(int) maxTick = 10 for i, t in enumerate(timeIndexs): temp_net = net_data[i, :, :].reshape([1, lengthX, lengthY]) temp_real = real_data[i, :, :].reshape([1, lengthX, lengthY]) temp_label = labels_data[i, :, :].reshape([1, lengthX, lengthY]) plotSpesificTime(temp_net, temp_label, temp_real, t, pathName, fileName, dataType, maxTick) listNames = [dataType + '_' + fileName + '_' + str(t) + '.png' for t in timeIndexs] create_gif(pathName, listNames, 1, dataType + '_' + fileName) for fileName in listNames: os.remove(pathName + fileName) return def createTimeGif_allData(net_data, real_data, timeIndexs, fileName, pathName, dataType): lengthX = net_data.shape[1] lengthY = net_data.shape[2] maxTick = np.max(real_data).astype(int) for i, t in enumerate(timeIndexs): temp_net = net_data[i, :, :].reshape([1, lengthX, lengthY]) temp_real = real_data[i, :, :].reshape([1, lengthX, lengthY]) plotSpesificTime_allData(temp_net, temp_real, t, pathName, fileName, dataType, maxTick) listNames = [dataType + '_' + fileName + '_' + str(t) + '.png' for t in timeIndexs] create_gif(pathName, listNames, 1, dataType + '_' + fileName) for fileName in listNames: os.remove(pathName + fileName) return def create_bm_seq_input(data, t_index, seq_len, createLabel = True): # in this case we assume that the batches are the different grid points t_size = data.shape[0] x_size = data.shape[1] y_size = data.shape[2] temp = np.zeros(shape=(seq_len, x_size, y_size)) if (t_index - seq_len > 0): temp = data[t_index - seq_len:t_index, :, :] else: temp[seq_len - t_index:, :, :] = data[0:t_index, :, :] xArr = np.zeros(shape=(x_size * y_size, seq_len)) if createLabel: tempOut = np.zeros(shape=(seq_len, x_size, y_size)) try: if (t_index + 1 <= t_size) and (t_index + 1 - seq_len > 0): tempOut = data[t_index + 1 - seq_len: t_index + 1, :, :].reshape(seq_len, x_size, y_size) elif (t_index + 1 <= t_size) and (t_index + 1 - seq_len <= 0): tempOut[seq_len - t_index - 1:, :, :] = data[0:t_index + 1, :, :] elif (t_index + 1 > t_size) and (t_index + 1 - seq_len > 0): tempOut[0:seq_len - 1, :, :] = data[t_index + 1 - seq_len: t_index, :, :] # taking the last part of the sequence except: print('couldnt find correct output sequence!!!') try: yArrTemp = tempOut[-1, :, :] except: print("couldnt take last value of time sequence for output!!!") yArr = np.zeros(shape=(x_size*y_size)) k = 0 for i in range(x_size): for j in range(y_size): xArr[k, :] = temp[:, i, j] if createLabel: yArr[k] = yArrTemp[i, j] k += 1 # xArr is of shape: [grid id, seq] # yArr is of shape: [grid id] if not createLabel: yArr = [] return xArr, yArr def calc_bm_seq_Output_fromData_probability(data_in, class_size, timeIndexs, sequence_size): time_size = timeIndexs.size x_size = data_in.shape[1] y_size = data_in.shape[2] grid_size = x_size*y_size net_accuracy = [] net_rmse = [] correct_non_zeros = [] correct_zeros = [] numEventsCreated = [] numEventsPredicted = [] bm_seq_output = np.zeros((time_size, x_size, y_size)) label_output = np.zeros((time_size, x_size, y_size)) # testOutTemp = [] # netlabelTemp = [] # inputTemp = [] cdf = np.zeros(class_size) events_mat = np.zeros(shape=[x_size, y_size, class_size]) for i, t in enumerate(timeIndexs): # print("t:" + str(i) + " out of:" + str(timeIndexs.size)) for x in range(x_size): for y in range(y_size): # print("t:" + str(i) + ",x:"+str(x)+", y:"+str(y)) input, label = create_bm_seq_input(data_in[:, x, y].reshape([-1, 1, 1]), t, sequence_size) # input size is: [grid_id, seq_len] # label size is: [grid_id] for t_seq in range(sequence_size): num_events = int(input[0, t_seq]) events_mat[x, y, num_events] += 1 events_mat[x, y, :] = events_mat[x, y, :]/np.sum(events_mat[x, y, :]) probOut = events_mat[x, y, :] for j in range(probOut.size): cdf[j] = np.sum(probOut[0:j + 1]) randNum = np.random.uniform(0, 1) # find how many events are happening at the same time numEvents = np.searchsorted(cdf, randNum, side='left') numEvents = np.floor(numEvents).astype(int) bm_labelsNp = np.array([numEvents]).reshape([1, 1]) # testOutTemp.append(testOut.detach().numpy()) # netlabelTemp.append(net_labelsNp) # inputTemp.append(input) labelsNp = label sizeMat = bm_labelsNp.size net_rmse.append(np.sqrt(metrics.mean_squared_error(labelsNp.reshape(-1), bm_labelsNp.reshape(-1)))) net_accuracy.append(np.sum(labelsNp == bm_labelsNp) / sizeMat) sizeMat_zeros = bm_labelsNp[labelsNp == 0].size sizeMat_non_zeros = bm_labelsNp[labelsNp != 0].size if (sizeMat_non_zeros > 0): correct_non_zeros.append(np.sum(bm_labelsNp[labelsNp != 0] == labelsNp[labelsNp != 0]) / sizeMat_non_zeros) if sizeMat_zeros > 0: correct_zeros.append(np.sum(bm_labelsNp[labelsNp == 0] == labelsNp[labelsNp == 0]) / sizeMat_zeros) numEventsCreated.append(np.sum(labelsNp)) numEventsPredicted.append(np.sum(bm_labelsNp)) bm_seq_output[i, x, y] = bm_labelsNp label_output[i, x, y] = labelsNp results = {'accuracy' : net_accuracy, 'rmse' : net_rmse, 'numCreated' : numEventsCreated, 'numPredicted' : numEventsPredicted, 'correctedZeros' : correct_zeros, 'correctedNonZeros' : correct_non_zeros} return bm_seq_output, label_output, results def plotEpochGraphs(my_net, filePath, fileName): f, ax = plt.subplots(2,1) ax[0].plot(range(len(my_net.accVecTrain)), np.array(my_net.accVecTrain), label = "Train accuracy") ax[0].plot(range(len(my_net.accVecTest)), np.array(my_net.accVecTest), label="Test accuracy") ax[0].set_xlabel('Epoch') ax[0].set_ylabel('Accuracy [%]') ax[1].plot(range(len(my_net.lossVecTrain)), np.array(my_net.lossVecTrain), label="Train Loss") ax[1].plot(range(len(my_net.lossVecTest)), np.array(my_net.lossVecTest), label="Test Loss") ax[1].set_xlabel('Epoch') ax[1].set_ylabel('Loss') plt.legend() plt.savefig(filePath + 'lossResults_' + fileName + '.png') plt.close() # plt.show() return def main(): data_path = '/Users/chanaross/dev/Thesis/UberData/' data_name = '3D_allDataLatLonCorrected_20MultiClass_500gridpickle_30min.p' # network_path = '/Users/chanaross/dev/Thesis/MachineLearning/forGPU/GPU_results/uberSingleGridTrain_longSeq/' network_path = '/Users/chanaross/dev/Thesis/MachineLearning/forGPU/GPU_results/singleGridId_multiClassSmooth/' # GPU_results/singleGridId_multiClassSmooth/' # network_name = 'smooth_30_seq_50_bs_40_hs_128_lr_0.9_ot_1_wd_0.002_torch.pkl' network_name = 'smooth_10_seq_50_bs_40_hs_128_lr_0.9_ot_1_wd_0.002_torch.pkl' my_net = torch.load(network_path + network_name, map_location=lambda storage, loc: storage) sequence_size = my_net.sequence_size plot_graph_vs_time = True plot_time_gif = False # create dictionary for storing result for each network tested results = {'mean RMSE' : [], 'mean accuracy' : [], 'mean zeros accuracy' : [], 'mean nonZeros accuracy' : [], 'mean smooth RMSE' : [], 'mean smooth accuracy' : [], 'mean smooth zeros accuracy' : [], 'mean smooth nonZeros accuracy' : []} dataInputReal = np.load(data_path + data_name, allow_pickle=True) lengthT = dataInputReal.shape[2] lengthX = dataInputReal.shape[0] lengthY = dataInputReal.shape[1] xmin = 0 xmax = dataInputReal.shape[0] # 6 ymin = 0 ymax = dataInputReal.shape[1] # 11 zmin = 0 # np.floor(dataInputReal.shape[2]*0.7).astype(int) zmax = dataInputReal.shape[2] dataInputReal = dataInputReal[xmin:xmax, ymin:ymax, zmin:zmax] # shrink matrix size for fast training in order to test model class_size = int(np.max(dataInputReal) + 1) dataInputReal = dataInputReal[5:6, 10:11, :] # reshape input data for network format - dataInputReal = np.swapaxes(dataInputReal, 0, 1) dataInputReal = np.swapaxes(dataInputReal, 0, 2) # create results index's - tmin = 2000 tmax = 2100 timeIndexs = np.arange(tmin, tmax, 1).astype(int) xIndexs = np.arange(xmin, xmax, 1).astype(int) yIndexs = np.arange(ymin, ymax, 1).astype(int) numRuns = timeIndexs.size figPath = data_path + 'figures/' fileName = str(numRuns) + '_bm_easy_seqBased' try: smoothParam = my_net.smoothingParam except: print("no smoothing param, using default 15") smoothParam = 15 # create smooth data - dataInputSmooth = moving_average(dataInputReal, smoothParam, axis=0) # smoothing data so that results are more clear to network # calc network output # real data - bm_output_fromData, label_output_fromData, net_results = calc_bm_seq_Output_fromData_probability(dataInputReal, class_size, timeIndexs, sequence_size) bm_output_fromData_smooth, label_output_fromData_smooth, net_results_smooth = calc_bm_seq_Output_fromData_probability(dataInputSmooth, class_size, timeIndexs, sequence_size) # plot each grid point vs. time if plot_graph_vs_time: # real data- checkResults(bm_output_fromData, label_output_fromData, dataInputReal[timeIndexs, :, :], timeIndexs, xIndexs, yIndexs, figPath, fileName, 'Real') # real data- checkResults(bm_output_fromData_smooth, label_output_fromData_smooth, dataInputSmooth[timeIndexs, :, :], timeIndexs, xIndexs, yIndexs, figPath, fileName, 'Smooth') # save total results to dictionary for each network tested - # real data - results['mean RMSE'].append(np.mean(net_results['rmse'])) results['mean accuracy'].append(100 * np.mean(net_results['accuracy'])) results['mean nonZeros accuracy'].append(100 * np.mean(net_results['correctedNonZeros'])) results['mean zeros accuracy'].append(100 * np.mean(net_results['correctedZeros'])) # smooth data - results['mean smooth RMSE'].append(np.mean(net_results_smooth['rmse'])) results['mean smooth accuracy'].append(100 *
np.mean(net_results_smooth['accuracy'])
numpy.mean
""" Large-scale version of population.py """ import pandas as pd import numpy as np import humanleague import neworder import ethpop from helpers import * class Microsynth: def __init__(self, countries): country_lookup = pd.read_csv("./examples/world/data/CountryLookup.csv", sep="\t").set_index("Code")["Country"].to_dict() self.value_column = "2019 [YR2019]" self.countries = countries self.pop = pd.DataFrame() alldata = pd.read_csv("./examples/world/data/CountryData.csv").replace("..","") alldata[self.value_column] = pd.to_numeric(alldata[self.value_column]) for country in self.countries: neworder.log("Microsynthesising population for %s" % country_lookup[country]) data = alldata[(alldata["Country Code"] == country) & (alldata["Series Code"]).str.match("SP.POP.*(FE|MA)$")] # fallback to gender totals if age-specific values not available if data[self.value_column].isnull().values.any(): neworder.log("%s: age-gender specific population data not available" % country_lookup[country]) data = alldata[(alldata["Country Code"] == country) & (alldata["Series Code"]).str.match("^SP.POP.TOTL.(FE|MA).IN$")] # fallback to overall total if gender-specific values not available if data[self.value_column].isnull().values.any(): neworder.log("%s: gender specific population data not available" % country_lookup[country]) data = alldata[(alldata["Country Code"] == country) & (alldata["Series Code"]).str.match("^SP.POP.TOTL$")] assert len(data) == 1 if np.isnan(data[self.value_column].values): neworder.log("%s: total population data not available - skipping" % country) else: self._generate_from_total(data[self.value_column].values, country) else: raise NotImplementedError("microsynth from M/F totals") else: data = pd.concat([data, data["Series Code"].str.split(".", expand=True)], axis=1) \ .drop(["Country Code", "Series Code", 0, 1], axis=1) \ .set_index([2,3]).unstack() # get synth pop for the country self._generate(data.values, country) # memory used in MB scaled up to world pop #neworder.log(self.pop.memory_usage() / len(self.pop) * 7.5e9 / 1024 / 1024) def _generate(self, agg_data, country): agg_data = humanleague.integerise(agg_data)["result"] # split 5y groups split = humanleague.prob2IntFreq(np.ones(5) / 5, int(agg_data.sum()))["freq"] msynth = humanleague.qis([np.array([0,1], dtype=int), np.array([2], dtype=int)], [agg_data, split]) if not isinstance(msynth, dict): raise RuntimeError("microsynthesis general failure: %s" % msynth) if not msynth["conv"]: raise RuntimeError("microsynthesis convergence failure") #neworder.log(pop["result"]) raw = humanleague.flatten(msynth["result"]) pop = pd.DataFrame(columns=["AGE5", "AGE1", "SEX"]) pop.AGE5 = raw[0] pop.AGE1 = raw[2] pop.SEX = raw[1] # could fail here if zero people in any category assert len(pop.AGE5.unique()) == 17 assert len(pop.AGE1.unique()) == 5 assert len(pop.SEX.unique()) == 2 # construct single year of age pop["Country"] = country pop["AGE"] = pop.AGE5 * 5 + pop.AGE1 self.pop = self.pop.append(pop.drop(["AGE5", "AGE1"], axis=1)) def _generate_from_total(self, agg_value, country): # TODO improve distribution sex_split = humanleague.prob2IntFreq(
np.ones(2)
numpy.ones
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Class of variatonal Gaussian Mixture Image models. It serves as a baseline for a hidden Potts-MRF for Bayesian unsupervised image segmentation. Author: <NAME> Date: 29-11-2018 """ import numpy as np import numpy.random as rnd from numpy.linalg import inv, cholesky from scipy.misc import logsumexp from scipy.special import betaln, digamma, gammaln from scipy.spatial.distance import cdist from sklearn.cluster import KMeans from sklearn.mixture import GaussianMixture from sklearn.neighbors import KNeighborsClassifier import matplotlib.pyplot as plt from vis import plot_posteriors class VariationalMixture(object): """ Superclass of variational mixture models. Methods are functions common to all submixture models. """ def log_multivariate_gamma(self, n, p): """ Logarithmic multivariate gamma function. This function is necessary for expectations and partition functions of Wishart distributions. See also: https://en.wikipedia.org/wiki/Multivariate_gamma_function Parameters ---------- nu : float Degrees of freedom. p : int Dimensionality. Returns ------- Gp : float p-th order multivariate gamma function. """ # Check for appropriate degree of freedom if not n > (p-1): raise ValueError('Degrees of freedom too low for dimensionality.') # Preallocate Gp = 0 # Product from d=1 to p for d in range(1, p+1): # Gamma function of degrees of freedom and dimension Gp += gammaln((n + 1 - d)/2) return (p * (p-1) / 4)*np.log(np.pi) + Gp def multivariate_digamma(self, n, p): """ Multivariate digamma function. This function is necessary for expectations and partition functions of Wishart distributions. See also: https://en.wikipedia.org/wiki/Multivariate_gamma_function Parameters ---------- nu : float Degrees of freedom. p : int Dimensionality. Returns ------- Pp : float p-th order multivariate digamma function. """ # Check for appropriate degree of freedom if not n > (p-1): raise ValueError('Degrees of freedom too low for dimensionality.') # Preallocate Pp = 0 # Sum from d=1 to D for d in range(1, p+1): # Digamma function of degrees of freedom and dimension Pp += digamma((n + 1 - d)/2) return Pp def log_partition_Wishart(self, W, n): """ Logarithmic partition function of the Wishart distribution. To compute variational expectations, the partition of the Wishart distribution is sometimes needed. The current computation follows Appendix B, equations B.78 to B.82 from Bishop's "Pattern Recognition & Machine Learning." Parameters ---------- W : array Positive definite, symmetric precision matrix. nu : int Degrees of freedom. Returns ------- B : float Partition of Wishart distribution. """ # Extract dimensionality D, D_ = W.shape # Check for symmetric matrix if not D == D_: raise ValueError('Matrix is not symmetric.') # Check for appropriate degree of freedom if not n > D-1: raise ValueError('Degrees of freedom too low for dimensionality.') # Compute log-multivariate gamma lmG = self.log_multivariate_gamma(n, D) # Compute partition function B = (-n/2)*self.log_det(W) - (n*D/2)*np.log(2) - lmG return B def entropy_Wishart(self, W, n): """ Entropy of the Wishart distribution. To compute variational expectations, the entropy of the Wishart distribution is sometimes needed. The current computation follows Appendix B, equations B.78 to B.82 from Bishop's "Pattern Recognition & Machine Learning." Parameters ---------- W : array Positive definite, symmetric precision matrix. nu : int Degrees of freedom. Returns ------- H : float Entropy of Wishart distribution. """ # Extract dimensionality D, D_ = W.shape # Check for symmetric matrix if not D == D_: raise ValueError('Matrix is not symmetric.') # Check for appropriate degree of freedom if not n > D-1: raise ValueError('Degrees of freedom too low for dimensionality.') # Expected log-determinant of precision matrix E = self.multivariate_digamma(n, D) + D*np.log(2) + self.log_det(W) # Entropy H = -self.log_partition_Wishart(W, n) - (n - D - 1)/2 * E + n*D/2 return H def log_det(self, A): """ Numerically stable computation of log determinant of a matrix. Parameters ---------- A : array Expecting a positive definite, symmetric matrix. Returns ------- float Log-determinant of given matrix. """ # Perform cholesky decomposition L = cholesky(A) # Stable log-determinant return np.sum(2*np.log(np.diag(L))) def distW(self, X, S): """ Compute weighted distance. Parameters ---------- X : array Vectors (N by D) or (H by W by D). W : array Weights (D by D). Returns ------- array Weighted distance for each vector. """ if not S.shape[0] == S.shape[1]: raise ValueError('Weight matrix not symmetric.') if not X.shape[-1] == S.shape[0]: raise ValueError('Dimensionality of data and weights mismatch.') if len(X.shape) == 2: # Shapes N, D = X.shape # Preallocate A = np.zeros((N,)) # Loop over samples for n in range(N): # Compute weighted inner product between vectors A[n] = X[n, :] @ S @ X[n, :].T elif len(X.shape) == 3: # Shape H, W, D = X.shape # Preallocate A = np.zeros((H, W)) # Loop over samples for h in range(H): for w in range(W): # Compute weighted inner product between vectors A[h, w] = X[h, w, :] @ S @ X[h, w, :].T return A def one_hot(self, A): """ Map array to pages with binary encodings. Parameters ---------- A : array 2-dimensional array of integers Returns ------- B : array (height by width by number of unique integers in A) 3-dimensional array with each page as an indicator of value in A. """ # Unique values labels = np.unique(A) # Preallocate new array B = np.zeros((*A.shape, len(labels))) # Loop over unique values for i, label in enumerate(labels): B[:, :, i] = (A == label) return B class UnsupervisedGaussianMixture(VariationalMixture): """ Variational Gaussian Mixture Image model. This implementation multivariate images (height by width by channel). It is based on the RPubs note by <NAME>: https://rpubs.com/cakapourani/variational-bayes-gmm """ def __init__(self, num_channels=1, num_components=2, init_params='nn', max_iter=10, tol=1e-5): """ Model-specific constructors. Parameters ---------- num_channels : int Number of channels of image (def: 1). num_components : int Number of components (def: 2). theta0 : tuple Prior hyperparameters. max_iter : int Maximum number of iterations to run for (def: 10). tol : float Tolerance on change in x-value (def: 1e-5). Returns ------- None """ # Store data dimensionality if num_channels >= 1: self.D = num_channels else: raise ValueError('Number of channels must be larger than 0.') # Store model parameters if num_components >= 2: self.K = num_components else: raise ValueError('Too few components specified') # Optimization parameters self.init_params = init_params self.max_iter = max_iter self.tol = tol # Set prior hyperparameters self.set_prior_hyperparameters(D=num_channels, K=num_components) def set_prior_hyperparameters(self, D, K, a0=np.array([0.1]), b0=np.array([0.1]), n0=np.array([2.0]), m0=np.array([0.0]), W0=np.array([1.0])): """ Set hyperparameters of prior distributions. Default prior hyperparameters are minimally informative symmetric parameters. Parameters ---------- D : int Dimensionality of data. K : int Number of components. a0 : float / array (components by None) Hyperparameters of Dirichlet distribution on component weights. b0 : float / array (components by None) Scale parameters for hypermean normal distribution. n0 : array (components by None) Degrees of freedom for Wishart precision prior. m0 : array (components by dimensions) Hypermeans. W0 : array (dimensions by dimensions by components) Wishart precision parameters. Returns ------- theta : tuple """ # Expand alpha's if necessary if not a0.shape[0] == K: a0 = np.tile(a0[0], (K,)) # Expand beta's if necessary if not b0.shape[0] == K: b0 = np.tile(b0[0], (K,)) # Expand nu's if necessary if not n0.shape[0] == K: # Check for sufficient degrees of freedom if n0[0] < D: print('Cannot set Wishart degrees of freedom lower than data \ dimensionality.\n Setting it to data dim.') n0 = np.tile(D, (K,)) else: n0 = np.tile(n0[0], (K,)) # Expand hypermeans if necessary if not np.all(m0.shape == (K, D)): # If mean vector given, replicate to each component if len(m0.shape) == 2: if m0.shape[1] == D: m0 = np.tile(m0, (K, 1)) else: m0 = np.tile(m0[0], (K, D)) # Expand hypermeans if necessary if not np.all(W0.shape == (D, D, K)): # If single covariance matrix given, replicate to each component if len(W0.shape) == 2: if np.all(m0.shape[:2] == (D, D)): W0 = np.tile(W0, (1, 1, K)) else: W0_ = np.zeros((D, D, K)) for k in range(K): W0_[:, :, k] = W0[0]*np.eye(D) # Store tupled parameters as model attribute self.theta0 = (a0, b0, n0, m0, W0_) def initialize_posteriors(self, X): """ Initialize posterior hyperparameters Parameters ---------- X : array Observed image (height by width by channels) Returns ------- theta : tuple Set of parameters. """ # Current shape H, W, D = X.shape # Reshape arrays X = X.reshape((H*W, D)) if self.init_params == 'random': # Dirichlet concentration hyperparameters at = np.ones((self.K,))*(H*W)/2 # Normal precision-scale hyperparameters bt = np.ones((self.K,))*(H*W)/2 # Wishart degrees of freedom nt = np.ones((self.K,))*(H*W)/2 mt = np.zeros((self.K, D)) Wt = np.zeros((D, D, self.K)) for k in range(self.K): # Hypermeans mt[k, :] = np.mean(X, axis=0) + rnd.randn(1, D)*.1 # Hyperprecisions Wt[:, :, k] = np.eye(D) # Initialize variational posterior responsibilities rho = np.ones((H, W, self.K)) / self.K elif self.init_params in ('kmeans', 'k-means'): # Fit k-means to data and obtain cluster assignment label = KMeans(n_clusters=self.K, n_init=1).fit(X).labels_ # Set rho based on cluster labels rho = np.zeros((H*W, self.K)) rho[np.arange(H*W), label] = 1 # Dirichlet concentration hyperparameters at = np.sum(rho, axis=0) # Normal precision-scale hyperparameters bt = np.sum(rho, axis=0) # Wishart degrees of freedom nt = np.sum(rho, axis=0) mt = np.zeros((self.K, D)) Wt = np.zeros((D, D, self.K)) for k in range(self.K): # Hypermeans mt[k, :] = np.sum(rho[:, [k]] * X, axis=0) / np.sum(rho[:, k]) # Hyperprecisions Wt[:, :, k] = np.eye(D) else: raise ValueError('Provided method not recognized.') return (at, bt, nt, mt, Wt), rho def free_energy(self, X, rho, thetat, report=True): """ Compute free energy term to monitor progress. Parameters ---------- X : array Observed image (height by width by channels). rho : array Array of variational parameters (height by width by channels). thetat : array Parameters of variational posteriors. theta0 : array Parameters of variational priors. report : bool Print value of free energy function. Returns ------- rho : array Updated array of variational parameters. """ # Shapes H, W, D = X.shape # Reshape arrays X = X.reshape((H*W, D)) rho = rho.reshape((H*W, self.K)) # Unpack parameter sets a0, b0, n0, m0, W0 = self.theta0 at, bt, nt, mt, Wt = thetat # Preallocate terms for energy function E1 = 0 E2 = 0 E3 = 0 E4 = 0 E5 = 0 E6 = 0 E7 = 0 # Loop over classes for k in range(self.K): ''' Convenience variables ''' # Proportion assigned to each component Nk = np.sum(rho[:, k], axis=0) # Responsibility-weighted mean xk = np.sum(rho[:, [k]] * X, axis=0) / Nk # Reponsibility-weighted variance Sk = ((X - xk) * rho[:, [k]]).T @ (X - xk) / Nk # Mahalanobis distance from hypermean mWm = (mt[k, :] - m0[k, :]).T @ Wt[:, :, k] @ (mt[k, :] - m0[k, :]) # Mahalanobis distance from responsibility-weighted mean xWx = (xk - mt[k, :]) @ Wt[:, :, k] @ (xk - mt[k, :]).T # Entropy-based terms Elog_pik = digamma(at[k]) - digamma(np.sum(at)) Elog_Lak = (D*np.log(2) + self.log_det(Wt[:, :, k]) + self.multivariate_digamma(nt[k], D)) ''' Energy function ''' # First term E1 += Nk/2*(Elog_Lak - D / bt[k] - nt[k]*(np.trace(Sk @ Wt[:, :, k]) + xWx) - D*np.log(2*np.pi)) # Second term E2 += np.sum(rho[:, k] * Elog_pik, axis=0) # Third term E3 += (a0[k] - 1)*Elog_pik + (gammaln(np.sum(a0)) - np.sum(gammaln(a0))) / self.K # Fourth term E4 += 1/2*(D*
np.log(b0[k] / (2*np.pi))
numpy.log
import pytest from bfieldtools import coil_optimize from .test_mesh_conductor import _fake_mesh_conductor import cvxpy import numpy as np from numpy.testing import assert_allclose def test_coil_optimize(): """ test that optimization works for different mesh_conductor objects and solvers """ for test_mesh in ["unit_sphere", "unit_disc", "plane_w_holes"]: for basis_name in ["suh"]: # , 'inner', 'vertex']: c = _fake_mesh_conductor( mesh_name=test_mesh, basis_name=basis_name, N_suh=10 ) spec = dict( coupling=c.B_coupling(np.array([[0, -0.1, 1], [0, 0, 1], [0, 0.1, 1]])), target=np.array([[0, 0, 1], [0, 0, 1], [0, 0, 1]]), abs_error=0.01, ) for objective in [ "minimum_inductive_energy", "minimum_ohmic_power", (0.5, 0.5), ]: results = [] results.append(coil_optimize.optimize_lsq(c, [dict(spec)], reg=1e3)) # For now, test with all solvers that can handle SOC problems for solver in [ i for i in cvxpy.solvers.defines.INSTALLED_CONIC_SOLVERS if i not in ("GLPK", "GLPK_MI", "SCS") ]: results.append( coil_optimize.optimize_streamfunctions( c, [spec], objective, solver )[0] ) if len(results) > 1: # tolerance is quite high, since some solvers give a bit differing results # in real life, let's not use those solvers. assert_allclose( results[-2], results[-1], rtol=5e-1, atol=0.001 * np.mean(np.abs(results[-2])), ) def test_standalone_functions(): """ Tests standalone functions in coil_optimize """ P = 2 * np.array([[2, 0.5], [0.5, 1]]) q = np.array([1.0, 1.0]) G = np.array([[-1.0, 0.0], [0.0, -1.0]]) h =
np.array([0.0, 0.0])
numpy.array
"""implementation of argmin step""" from scipy import optimize import numpy as np from BanditPricing import randUnitVector def argmin(eta, s_radius, barrier, g_bar_aggr_t, g_tilde, d, max_iter = 1e4): #implement argmin_ball(eta * (g_bar_1:t + g_tilde_t+1)^T x + barrier(x) #argmin is over ball with radius r TOL = 1e-10 # numerical error allowed #g_bar_aggr_t = complex_to_real(g_bar_aggr_t) #g_tilde = complex_to_real(g_tilde) #init_pt = complex_to_real(randUnitVector(d)*s_radius/2) cons = {'type': 'ineq', 'fun': lambda x: s_radius - np.linalg.norm(x), 'jac': lambda x: x / np.linalg.norm(x) if np.linalg.norm(x) > TOL else np.zeros(x.shape)} res = optimize.minimize(fun=obj, x0=randUnitVector(d)*s_radius/2, args=(eta, barrier, g_bar_aggr_t, g_tilde), constraints=cons, options={'disp': False, 'maxiter': max_iter}) return res['x'] def obj(x, eta, barrier, g_bar_aggr_t, g_tilde): return eta *
np.dot(g_bar_aggr_t + g_tilde, x)
numpy.dot
from keras.utils.vis_utils import plot_model from keras.models import Model from keras.models import load_model from keras.layers import Input, GaussianNoise from keras.layers import Dense from keras.layers import Flatten from keras.layers import Dropout from keras.layers import Embedding from keras.layers.convolutional import Conv1D from keras.layers.convolutional import MaxPooling1D from keras.layers.merge import concatenate from time import time from keras.callbacks import TensorBoard, ReduceLROnPlateau import numpy as np from sklearn.model_selection import train_test_split import importlib util = importlib.import_module('util') START_FROM_SCRATCH = True def define_model(lengths, tokenizers): inputs = [] embeddings = [] noises = [] flattens = [] convs = [] drops = [] pools = [] for (length, tokenizer) in zip(lengths, tokenizers): vocab_size = len(tokenizer.word_index) + 1 inputs.append(Input(shape=(length,))) embeddings.append(Embedding(vocab_size, min(vocab_size, 100))(inputs[-1])) noises.append(GaussianNoise(stddev=0.1)(embeddings[-1])) if length > 50: convs.append(Conv1D(filters=32, kernel_size=4, activation='relu')(noises[-1])) drops.append(Dropout(0.5)(convs[-1])) convs.append(Conv1D(filters=32, kernel_size=4, activation='relu')(drops[-1])) drops.append(Dropout(0.5)(convs[-1])) pools.append(MaxPooling1D(pool_size=2)(drops[-1])) flattens.append(Flatten()(pools[-1])) else: flat = Flatten()(noises[-1]) flattens.append(Dense(10, activation='relu')(flat)) #inputs2 = Input(shape=(length,)) #embedding1 = Embedding(vocab_size, 100)(inputs1) #inputs2 = Input(shape=(length,)) #embedding2 = Embedding(vocab_size, 100)(inputs2) #conv2 = Conv1D(filters=32, kernel_size=6, activation='relu')(embedding2) #drop2 = Dropout(0.5)(conv2) #pool2 = MaxPooling1D(pool_size=2)(drop2) #flat2 = Flatten()(pool2) #inputs3 = Input(shape=(length,)) #embedding3 = Embedding(vocab_size, 100)(inputs3) #conv3 = Conv1D(filters=32, kernel_size=8, activation='relu')(embedding3) #drop3 = Dropout(0.5)(conv3) #pool3 = MaxPooling1D(pool_size=2)(drop3) #flat3 = Flatten()(pool3) #merged = concatenate([flat1, flat2, flat3]) merged = concatenate(flattens) dense1 = Dense(20, activation='relu')(merged) outputs = Dense(2, activation='sigmoid')(dense1) #model = Model(inputs=[inputs1, inputs2, inputs3], outputs=outputs) model = Model(inputs=inputs, outputs=outputs) model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) model.summary() plot_model(model, show_shapes=True, to_file='nn_multichannel.png') return model #dataset='trec07' dataset='imap-mail' model_name = dataset [X, y_labels] = util.load_dataset(file_identifier=dataset, prefix='eval') [tokenizers, lengths] = util.load_dataset(file_identifier=model_name, prefix='tokenizers') x_input = [] for i in range(0, len(tokenizers)): if lengths[i] > 600: # reduce the document length to the first N words old_length = lengths[i] lengths[i] = 600 print("Reducing document-length from %d to %d" % (old_length, lengths[i])) print("Shape: ", X[i+1].shape) x = X[i+1][:,0:600] # x.resize(600) print("New Shape: ", x.shape) x_input.append(x) else: x_input.append(np.array(X[i+1])) print('Max document length: %d' % lengths[i]) vocab_size = len(tokenizers[i].word_index) + 1 tokenizer_size = tokenizers[i].num_words print('Tokenizer/Vocabulary size: %d / %d ' % (tokenizer_size, vocab_size)) y_labels =
np.array(y_labels)
numpy.array
""" Slightly edited verions of some functions from postprocess from DNest4/python/classic.py """ import os import copy import numpy as np from matplotlib import pyplot as plt def logsumexp(values): biggest = np.max(values) x = values - biggest result = np.log(np.sum(np.exp(x))) + biggest return result def logdiffexp(x1, x2): biggest = x1 xx1 = x1 - biggest xx2 = x2 - biggest result = np.log(np.exp(xx1) - np.exp(xx2)) + biggest return result def loadtxt_rows(filename, rows, single_precision=False): """ Load only certain rows """ # Open the file f = open(filename, "r") # Storage results = {} # Row number i = 0 # Number of columns ncol = None while(True): # Read the line and split by whitespace line = f.readline() cells = line.split() # Quit when you see a different number of columns if ncol is not None and len(cells) != ncol: break # Non-comment lines if cells[0] != "#": # If it's the first one, get the number of columns if ncol is None: ncol = len(cells) # Otherwise, include in results if i in rows: if single_precision: results[i] = np.array([float(cell) for cell in cells], dtype="float32") else: results[i] = np.array([float(cell) for cell in cells]) i += 1 results["ncol"] = ncol return results # postprocess from DNest4/python/classic.py, with minor edits to data loading def postprocess(temperature=1., numResampleLogX=1, plot=True, rundir=".", \ cut=0., save=True, zoom_in=True, compression_bias_min=1., verbose=True,\ compression_scatter=0., moreSamples=1., compression_assert=None, single_precision=False): try: levels_orig = np.atleast_2d(np.loadtxt(os.path.join(rundir, "levels.txt"), comments="#")) except: return None # some error during file reading try: sample_info = np.atleast_2d(np.loadtxt(os.path.join(rundir, "sample_info.txt"), comments="#")) except: return None # some error during file reading # Remove regularisation from levels_orig if we asked for it if compression_assert is not None: levels_orig[1:,0] = -np.cumsum(compression_assert*np.ones(levels_orig.shape[0] - 1)) cut = int(cut*sample_info.shape[0]) sample_info = sample_info[cut:, :] if plot: plt.figure(1) plt.plot(sample_info[:,0], "k") plt.xlabel("Iteration") plt.ylabel("Level") plt.figure(2) plt.subplot(2,1,1) plt.plot(np.diff(levels_orig[:,0]), "k") plt.ylabel("Compression") plt.xlabel("Level") xlim = plt.gca().get_xlim() plt.axhline(-1., color='g') plt.axhline(-np.log(10.), color='g', linestyle="--") plt.ylim(ymax=0.05) plt.subplot(2,1,2) good = np.nonzero(levels_orig[:,4] > 0)[0] plt.plot(levels_orig[good,3]/levels_orig[good,4], "ko-") plt.xlim(xlim) plt.ylim([0., 1.]) plt.xlabel("Level") plt.ylabel("MH Acceptance") # Convert to lists of tuples logl_levels = [(levels_orig[i,1], levels_orig[i, 2]) for i in range(0, levels_orig.shape[0])] # logl, tiebreaker logl_samples = [(sample_info[i, 1], sample_info[i, 2], i) for i in range(0, sample_info.shape[0])] # logl, tiebreaker, id logx_samples = np.zeros((sample_info.shape[0], numResampleLogX)) logp_samples = np.zeros((sample_info.shape[0], numResampleLogX)) logP_samples = np.zeros((sample_info.shape[0], numResampleLogX)) P_samples = np.zeros((sample_info.shape[0], numResampleLogX)) logz_estimates = np.zeros((numResampleLogX, 1)) H_estimates = np.zeros((numResampleLogX, 1)) # Find sandwiching level for each sample sandwich = sample_info[:,0].copy().astype('int') for i in range(0, sample_info.shape[0]): while sandwich[i] < levels_orig.shape[0]-1 and logl_samples[i] > logl_levels[sandwich[i] + 1]: sandwich[i] += 1 for z in range(0, numResampleLogX): # Make a monte carlo perturbation of the level compressions levels = levels_orig.copy() compressions = -np.diff(levels[:,0]) compressions *= compression_bias_min + (1. - compression_bias_min)*np.random.rand() compressions *= np.exp(compression_scatter*np.random.randn(compressions.size)) levels[1:, 0] = -compressions levels[:, 0] = np.cumsum(levels[:,0]) # For each level for i in range(0, levels.shape[0]): # Find the samples sandwiched by this level which = np.nonzero(sandwich == i)[0] logl_samples_thisLevel = [] # (logl, tieBreaker, ID) for j in range(0, len(which)): logl_samples_thisLevel.append(copy.deepcopy(logl_samples[which[j]])) logl_samples_thisLevel = sorted(logl_samples_thisLevel) N = len(logl_samples_thisLevel) # Generate intermediate logx values logx_max = levels[i, 0] if i == levels.shape[0]-1: logx_min = -1E300 else: logx_min = levels[i+1, 0] Umin = np.exp(logx_min - logx_max) if N == 0 or numResampleLogX > 1: U = Umin + (1. - Umin)*np.random.rand(len(which)) else: U = Umin + (1. - Umin)*np.linspace(1./(N+1), 1. - 1./(N+1), N) logx_samples_thisLevel = np.sort(logx_max + np.log(U))[::-1] for j in range(0, which.size): logx_samples[logl_samples_thisLevel[j][2]][z] = logx_samples_thisLevel[j] if j != which.size - 1: left = logx_samples_thisLevel[j+1] elif i == levels.shape[0]-1: left = -1E300 else: left = levels[i+1][0] if j != 0: right = logx_samples_thisLevel[j-1] else: right = levels[i][0] logp_samples[logl_samples_thisLevel[j][2]][z] = np.log(0.5) + logdiffexp(right, left) logl = sample_info[:,1]/temperature logp_samples[:,z] = logp_samples[:,z] - logsumexp(logp_samples[:,z]) logP_samples[:,z] = logp_samples[:,z] + logl logz_estimates[z] = logsumexp(logP_samples[:,z]) logP_samples[:,z] -= logz_estimates[z] P_samples[:,z] = np.exp(logP_samples[:,z]) H_estimates[z] = -logz_estimates[z] + np.sum(P_samples[:,z]*logl) if plot: plt.figure(3) plt.subplot(2,1,1) plt.plot(logx_samples[:,z], sample_info[:,1], 'k.', label='Samples') plt.plot(levels[1:,0], levels[1:,1], 'g.', label='Levels') plt.legend(numpoints=1, loc='lower left') plt.ylabel('log(L)') plt.title(str(z+1) + "/" + str(numResampleLogX) + ", log(Z) = " + str(logz_estimates[z][0])) # Use all plotted logl values to set ylim combined_logl = np.hstack([sample_info[:,1], levels[1:, 1]]) combined_logl = np.sort(combined_logl) lower = combined_logl[int(0.1*combined_logl.size)] upper = combined_logl[-1] diff = upper - lower lower -= 0.05*diff upper += 0.05*diff if zoom_in: plt.ylim([lower, upper]) xlim = plt.gca().get_xlim() if plot: plt.subplot(2,1,2) plt.plot(logx_samples[:,z], P_samples[:,z], 'k.') plt.ylabel('Posterior Weights') plt.xlabel('log(X)') plt.xlim(xlim) P_samples = np.mean(P_samples, 1) P_samples = P_samples/np.sum(P_samples) logz_estimate = np.mean(logz_estimates) logz_error = np.std(logz_estimates) H_estimate = np.mean(H_estimates) H_error = np.std(H_estimates) ESS = np.exp(-np.sum(P_samples*np.log(P_samples+1E-300))) errorbar1 = "" errorbar2 = "" if numResampleLogX > 1: errorbar1 += " +- " + str(logz_error) errorbar2 += " +- " + str(H_error) if verbose: print("log(Z) = " + str(logz_estimate) + errorbar1) print("Information = " + str(H_estimate) + errorbar2 + " nats.") print("Effective sample size = " + str(ESS)) # Resample to uniform weight N = int(moreSamples*ESS) w = P_samples w = w/np.max(w) rows = np.empty(N, dtype="int64") for i in range(0, N): while True: which = np.random.randint(sample_info.shape[0]) if np.random.rand() <= w[which]: break rows[i] = which + cut # Get header row f = open(os.path.join(rundir, "sample.txt"), "r") line = f.readline() if line[0] == "#": header = line[1:] else: header = "" f.close() try: sample = loadtxt_rows(os.path.join(rundir, "sample.txt"), set(rows), single_precision) except: return None # some error during file reading posterior_sample = None if single_precision: posterior_sample =
np.empty((N, sample["ncol"]), dtype="float32")
numpy.empty
# This file is part of qdpy. # # qdpy is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # qdpy is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with qdpy. If not, see <http://www.gnu.org/licenses/>. """A collection of functions to plot containers using Matplotlib.""" import os import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable from functools import reduce from operator import mul from typing import Optional, Tuple, List, Iterable, Iterator, Any, TypeVar, Generic, Union, Sequence, MutableSet, MutableSequence, Type, Callable, Generator, Mapping, MutableMapping, overload from qdpy.utils import is_iterable from qdpy import containers from qdpy import algorithms ########### Plots ########### {{{1 # TODO refactor name, etc def plotGridSubplots(data, outputFilename, cmap, featuresBounds=((0., 1.), (0., 1.), (0., 1.), (0., 1.)), fitnessBounds=(0., 1.), drawCbar = True, xlabel = "", ylabel = "", cBarLabel = "", nbBins = None, nbTicks = None, binSizeInInches = 0.30): """TODO""" # Verify data dimension is supported by this funtion if len(data.shape) > 4: raise ValueError("plotGridSubplots only supports up to 4 dimensions.") elif len(data.shape) <= 2: plotGrid(data, outputFilename, cmap, featuresBounds=featuresBounds, fitnessBounds=fitnessBounds, drawCbar=drawCbar, xlabel=xlabel, ylabel=ylabel, cBarLabel=cBarLabel, nbBins=nbBins, nbTicks=nbTicks) return # Verify dimension is even if len(data.shape) % 2 == 1: data = data.reshape((data.shape[0], 1) + data.shape[1:]) featuresBounds = (featuresBounds[0], (0., 0.)) + tuple(featuresBounds[1:]) if nbBins != None: nbBins = (nbBins[0], 1) + nbBins[1:] if not nbBins: nbBins = data.shape #data[0,:,:,:] = np.linspace(0., 1., nbBins[1] * nbBins[2] * nbBins[3]).reshape((nbBins[1], nbBins[2], nbBins[3])) # Compute figure infos from nbBins horizNbBins = nbBins[::2] horizNbBinsProd = reduce(mul, horizNbBins, 1) vertNbBins = nbBins[1::2] vertNbBinsProd = reduce(mul, vertNbBins, 1) totProp = horizNbBinsProd + vertNbBinsProd upperlevelTot = nbBins[0] + nbBins[1] # Determine figure size from nbBins infos #figsize = [2.1 + 10. * horizNbBinsProd / upperlevelTot, 1. + 10. * vertNbBinsProd / upperlevelTot] #if figsize[1] < 2: # figsize[1] = 2. figsize = [2.1 + horizNbBinsProd * binSizeInInches, 1. + vertNbBinsProd * binSizeInInches] # Create figure fig, axes = plt.subplots(nrows=nbBins[1], ncols=nbBins[0], figsize=figsize) # Create subplots for x in range(nbBins[0]): for y in range(nbBins[1]): ax = plt.subplot(nbBins[1], nbBins[0], (nbBins[1] - y - 1) * nbBins[0] + x + 1) #ax = axes[x,y] cax = drawGridInAx(data[x, y, 0:nbBins[2], 0:nbBins[3]], ax, cmap=cmap, featuresBounds=featuresBounds[-2:], fitnessBounds=fitnessBounds[-2:], aspect="equal", xlabel=xlabel, ylabel=ylabel, nbBins=(nbBins[2], nbBins[3]), nbTicks=nbTicks) plt.tight_layout() if drawCbar: fig.subplots_adjust(right=0.85, wspace=0.40) #cbarAx = fig.add_axes([0.90, 0.15, 0.01, 0.7]) if figsize[0] < 4.: cbarAx = fig.add_axes([0.75, 0.15, 0.02, 0.7]) elif figsize[0] < 6.: cbarAx = fig.add_axes([0.80, 0.15, 0.02, 0.7]) elif figsize[0] < 10.: cbarAx = fig.add_axes([0.85, 0.15, 0.02, 0.7]) else: cbarAx = fig.add_axes([0.90, 0.15, 0.02, 0.7]) cbar = fig.colorbar(cax, cax=cbarAx, format="%.2f") cbar.ax.tick_params(labelsize=20) cbar.ax.set_ylabel(cBarLabel, fontsize=22) fig.savefig(outputFilename) # TODO refactor name, etc def drawGridInAx(data, ax, cmap, featuresBounds, fitnessBounds, aspect="equal", xlabel = "", ylabel = "", nbBins=None, nbTicks = 5): # Determine bounds vmin = fitnessBounds[0] if np.isnan(vmin) or np.isinf(vmin): vmin =
np.nanmin(data)
numpy.nanmin
# coding: utf-8 # <h1 align="center"> Lending Club Loan Analysis </h1> <br> # ## Company Information: # Lending Club is a peer to peer lending company based in the United States, in which investors provide funds for potential borrowers and investors earn a profit depending on the risk they take (the borrowers credit score). Lending Club provides the "bridge" between investors and borrowers. For more basic information about the company please check out the wikipedia article about the company. <br><br> # # # <a src="https://en.wikipedia.org/wiki/Lending_Club"> Lending Club Information </a> # # # # # ## How Lending Club Works? # <img src="http://echeck.org/wp-content/uploads/2016/12/Showing-how-the-lending-club-works-and-makes-money-1.png"><br><br> # # # ## Outline: <br><br> # I. Introduction <br> # a) [General Information](#general_information)<br> # b) [Similar Distributions](#similar_distributions)<br><br> # # II. <b>Good Loans vs Bad Loans</b><br> # a) [Types of Loans](#types_of_loans)<br> # b) [Loans issued by Region](#by_region)<br> # c) [A Deeper Look into Bad Loans](#deeper_bad_loans)<br><br> # # III. <b>The Business Perspective</b><br> # a) [Understanding the Operative side of Business](#operative_side)<br> # b) [Analysis by Income Category](#income_category) <br><br> # # IV. <b>Assesing Risks</b><br> # a) [Understanding the Risky Side of Business](#risky_side)<br> # b) [The importance of Credit Scores](#credit_scores)<br> # c) [What determines a bad loan](#determines_bad_loan)<br> # d) [Defaulted Loans](#defaulted_loans) # # ## References: # 1) <a src="https://www.kaggle.com/arthurtok/global-religion-1945-2010-plotly-pandas-visuals"> Global Religion 1945-2010: Plotly & Pandas visuals</a> by Anisotropic <br> # 2) <a src="https://www.kaggle.com/vigilanf/loan-metrics-by-state"> Loan Metrics By State </a> by <NAME><br> # 3) Hands on Machine Learning by <NAME> <br> # 4) <a src="https://www.youtube.com/watch?v=oYbVFhK_olY&list=PLSPWNkAMSvv5DKeSVDbEbUKSsK4Z-GgiP"> Deep Learning with Neural Networks and TensorFlow </a> by Sentdex # # Introduction: # ## General Information: # <a id="general_information"></a> # In[ ]: # Import our libraries we are going to use for our data analysis. import pandas as pd import seaborn as sns import numpy as np import matplotlib.pyplot as plt # Plotly visualizations from plotly import tools import plotly.plotly as py import plotly.figure_factory as ff import plotly.graph_objs as go from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot init_notebook_mode(connected=True) # plotly.tools.set_credentials_file(username='AlexanderBach', api_key='o4fx6i1MtEIJQxfWYvU1') get_ipython().run_line_magic('matplotlib', 'inline') df = pd.read_csv('../input/loan.csv', low_memory=False) # Copy of the dataframe original_df = df.copy() df.head() # In[ ]: df.info() # In[ ]: # Replace the name of some columns df = df.rename(columns={"loan_amnt": "loan_amount", "funded_amnt": "funded_amount", "funded_amnt_inv": "investor_funds", "int_rate": "interest_rate", "annual_inc": "annual_income"}) # Drop irrelevant columns df.drop(['id', 'member_id', 'emp_title', 'url', 'desc', 'zip_code', 'title'], axis=1, inplace=True) # ## Similar Distributions: # <a id="similar_distributions"></a> # We will start by exploring the distribution of the loan amounts and see when did the loan amount issued increased significantly. <br> # # <h4> What we need to know: </h4> <br> # <ul> # <li> Understand what amount was <b>mostly issued</b> to borrowers. </li> # <li> Which <b>year</b> issued the most loans. </li> # <li> The distribution of loan amounts is a <b>multinomial distribution </b>.</li> # </ul> # # # # <h4> Summary: </h4><br> # <ul> # <li> Most of the <b>loans issued</b> were in the range of 10,000 to 20,000 USD. </li> # <li> The <b>year of 2015</b> was the year were most loans were issued.</li> # <li> Loans were issued in an <b>incremental manner</b>. (Possible due to a recovery in the U.S economy) </li> # <li> The loans <b>applied</b> by potential borrowers, the amount <b>issued</b> to the borrowers and the amount <b>funded</b> by investors are similarly distributed, <b>meaning</b> that it is most likely that qualified borrowers are going to get the loan they had applied for. </li> # # </ul> # # # # # In[ ]: fig, ax = plt.subplots(1, 3, figsize=(16,5)) loan_amount = df["loan_amount"].values funded_amount = df["funded_amount"].values investor_funds = df["investor_funds"].values sns.distplot(loan_amount, ax=ax[0], color="#F7522F") ax[0].set_title("Loan Applied by the Borrower", fontsize=14) sns.distplot(funded_amount, ax=ax[1], color="#2F8FF7") ax[1].set_title("Amount Funded by the Lender", fontsize=14) sns.distplot(investor_funds, ax=ax[2], color="#2EAD46") ax[2].set_title("Total committed by Investors", fontsize=14) # In[ ]: # Lets' transform the issue dates by year. df['issue_d'].head() dt_series = pd.to_datetime(df['issue_d']) df['year'] = dt_series.dt.year # In[ ]: # The year of 2015 was the year were the highest amount of loans were issued # This is an indication that the economy is quiet recovering itself. plt.figure(figsize=(12,8)) sns.barplot('year', 'loan_amount', data=df, palette='tab10') plt.title('Issuance of Loans', fontsize=16) plt.xlabel('Year', fontsize=14) plt.ylabel('Average loan amount issued', fontsize=14) # <h1 align="center"> Good Loans vs Bad Loans: </h1> # <h2>Types of Loans: </h2> # <a id="types_of_loans"></a> # <img src="http://strongarticle.com/wp-content/uploads/2017/09/1f42d6e77042d87f3bb6ae171ebbc530.jpg"> # <br><br> # In this section, we will see what is the amount of bad loans Lending Club has declared so far, of course we have to understand that there are still loans that are at a risk of defaulting in the future. # # <h4> What we need to know: </h4> # <ul> # <li> The amount of bad loans could <b>increment</b> as the days pass by, since we still have a great amount of current loans. </li> # <li> <b>Average annual income</b> is an important key metric for finding possible opportunities of investments in a specific region. </li> # # </ul> # # <h4> Summary: </h4> # <ul> # <li> Currently, <b>bad loans</b> consist 7.60% of total loans but remember that we still have <b>current loans</b> which have the risk of becoming bad loans. (So this percentage is subjected to possible changes.) </li> # <li> The <b> NorthEast </b> region seems to be the most attractive in term of funding loans to borrowers. </li> # <li> The <b> SouthWest </b> and <b> West</b> regions have experienced a slight increase in the "median income" in the past years. </li> # <li> <b>Average interest</b> rates have declined since 2012 but this might explain the <b>increase in the volume</b> of loans. </li> # <li> <b>Employment Length</b> tends to be greater in the regions of the <b>SouthWest</b> and <b>West</b></li> # <li> Clients located in the regions of <b>NorthEast</b> and <b>MidWest</b> have not experienced a drastic increase in debt-to-income(dti) as compared to the other regions. </li> # </ul> # In[ ]: df["loan_status"].value_counts() # In[ ]: # Determining the loans that are bad from loan_status column bad_loan = ["Charged Off", "Default", "Does not meet the credit policy. Status:Charged Off", "In Grace Period", "Late (16-30 days)", "Late (31-120 days)"] df['loan_condition'] = np.nan def loan_condition(status): if status in bad_loan: return 'Bad Loan' else: return 'Good Loan' df['loan_condition'] = df['loan_status'].apply(loan_condition) # In[ ]: f, ax = plt.subplots(1,2, figsize=(16,8)) colors = ["#3791D7", "#D72626"] labels ="Good Loans", "Bad Loans" plt.suptitle('Information on Loan Conditions', fontsize=20) df["loan_condition"].value_counts().plot.pie(explode=[0,0.25], autopct='%1.2f%%', ax=ax[0], shadow=True, colors=colors, labels=labels, fontsize=12, startangle=70) # ax[0].set_title('State of Loan', fontsize=16) ax[0].set_ylabel('% of Condition of Loans', fontsize=14) # sns.countplot('loan_condition', data=df, ax=ax[1], palette=colors) # ax[1].set_title('Condition of Loans', fontsize=20) # ax[1].set_xticklabels(['Good', 'Bad'], rotation='horizontal') palette = ["#3791D7", "#E01E1B"] sns.barplot(x="year", y="loan_amount", hue="loan_condition", data=df, palette=palette, estimator=lambda x: len(x) / len(df) * 100) ax[1].set(ylabel="(%)") # <h2> Loans Issued by Region</h2> # <a id="by_region"></a> # In this section we want to analyze loans issued by region in order to see region patters that will allow us to understand which region gives Lending Club.<br><br> # # ## Summary: <br> # <ul> # <li> <b> SouthEast</b> , <b>West </b> and <b>NorthEast</b> regions had the highest amount lof loans issued. </li> # <li> <b>West </b> and <b>SouthWest </b> had a rapid increase in debt-to-income starting in 2012. </li> # <li><b>West </b> and <b>SouthWest </b> had a rapid decrease in interest rates (This might explain the increase in debt to income). </li> # </ul> # In[ ]: df['addr_state'].unique() # Make a list with each of the regions by state. west = ['CA', 'OR', 'UT','WA', 'CO', 'NV', 'AK', 'MT', 'HI', 'WY', 'ID'] south_west = ['AZ', 'TX', 'NM', 'OK'] south_east = ['GA', 'NC', 'VA', 'FL', 'KY', 'SC', 'LA', 'AL', 'WV', 'DC', 'AR', 'DE', 'MS', 'TN' ] mid_west = ['IL', 'MO', 'MN', 'OH', 'WI', 'KS', 'MI', 'SD', 'IA', 'NE', 'IN', 'ND'] north_east = ['CT', 'NY', 'PA', 'NJ', 'RI','MA', 'MD', 'VT', 'NH', 'ME'] df['region'] = np.nan def finding_regions(state): if state in west: return 'West' elif state in south_west: return 'SouthWest' elif state in south_east: return 'SouthEast' elif state in mid_west: return 'MidWest' elif state in north_east: return 'NorthEast' df['region'] = df['addr_state'].apply(finding_regions) # In[ ]: # This code will take the current date and transform it into a year-month format df['complete_date'] = pd.to_datetime(df['issue_d']) group_dates = df.groupby(['complete_date', 'region'], as_index=False).sum() group_dates['issue_d'] = [month.to_period('M') for month in group_dates['complete_date']] group_dates = group_dates.groupby(['issue_d', 'region'], as_index=False).sum() group_dates = group_dates.groupby(['issue_d', 'region'], as_index=False).sum() group_dates['loan_amount'] = group_dates['loan_amount']/1000 df_dates = pd.DataFrame(data=group_dates[['issue_d','region','loan_amount']]) # In[ ]: plt.style.use('dark_background') cmap = plt.cm.Set3 by_issued_amount = df_dates.groupby(['issue_d', 'region']).loan_amount.sum() by_issued_amount.unstack().plot(stacked=False, colormap=cmap, grid=False, legend=True, figsize=(15,6)) plt.title('Loans issued by Region', fontsize=16) # In[ ]: employment_length = ['10+ years', '< 1 year', '1 year', '3 years', '8 years', '9 years', '4 years', '5 years', '6 years', '2 years', '7 years', 'n/a'] # Create a new column and convert emp_length to integers. lst = [df] df['emp_length_int'] = np.nan for col in lst: col.loc[col['emp_length'] == '10+ years', "emp_length_int"] = 10 col.loc[col['emp_length'] == '9 years', "emp_length_int"] = 9 col.loc[col['emp_length'] == '8 years', "emp_length_int"] = 8 col.loc[col['emp_length'] == '7 years', "emp_length_int"] = 7 col.loc[col['emp_length'] == '6 years', "emp_length_int"] = 6 col.loc[col['emp_length'] == '5 years', "emp_length_int"] = 5 col.loc[col['emp_length'] == '4 years', "emp_length_int"] = 4 col.loc[col['emp_length'] == '3 years', "emp_length_int"] = 3 col.loc[col['emp_length'] == '2 years', "emp_length_int"] = 2 col.loc[col['emp_length'] == '1 year', "emp_length_int"] = 1 col.loc[col['emp_length'] == '< 1 year', "emp_length_int"] = 0.5 col.loc[col['emp_length'] == 'n/a', "emp_length_int"] = 0 # In[ ]: # Loan issued by Region and by Credit Score grade # Change the colormap for tomorrow! sns.set_style('whitegrid') f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2) cmap = plt.cm.inferno by_interest_rate = df.groupby(['year', 'region']).interest_rate.mean() by_interest_rate.unstack().plot(kind='area', stacked=True, colormap=cmap, grid=False, legend=False, ax=ax1, figsize=(16,12)) ax1.set_title('Average Interest Rate by Region', fontsize=14) by_employment_length = df.groupby(['year', 'region']).emp_length_int.mean() by_employment_length.unstack().plot(kind='area', stacked=True, colormap=cmap, grid=False, legend=False, ax=ax2, figsize=(16,12)) ax2.set_title('Average Employment Length by Region', fontsize=14) # plt.xlabel('Year of Issuance', fontsize=14) by_dti = df.groupby(['year', 'region']).dti.mean() by_dti.unstack().plot(kind='area', stacked=True, colormap=cmap, grid=False, legend=False, ax=ax3, figsize=(16,12)) ax3.set_title('Average Debt-to-Income by Region', fontsize=14) by_income = df.groupby(['year', 'region']).annual_income.mean() by_income.unstack().plot(kind='area', stacked=True, colormap=cmap, grid=False, ax=ax4, figsize=(16,12)) ax4.set_title('Average Annual Income by Region', fontsize=14) ax4.legend(bbox_to_anchor=(-1.0, -0.5, 1.8, 0.1), loc=10,prop={'size':12}, ncol=5, mode="expand", borderaxespad=0.) # ## A Deeper Look into Bad Loans: # <a id="deeper_bad_loans"></a> # # <h4> What we need to know: </h4> # <ul> # <li>The number of loans that were classified as bad loans for each region by its <b>loan status</b>. (This will be shown in a dataframe below.)</li> # <li> This won't give us the exact reasons why a loan is categorized as a bad loan (other variables that might have influence the condition of the loan) but it will give us a <b> deeper insight on the level of risk </b> in a particular region. </li> # </ul> # # <h4> Summary: </h4> # <ul> # <li>The regions of the <b> West </b> and <b> SouthEast </b> had a higher percentage in most of the b "bad" loan statuses.</li> # <li> The <b>NorthEast</b> region had a higher percentage in <b>Grace Period</b> and <b>Does not meet Credit Policy</b> loan status. However, both of these are not considered as bad as <b>default</b> for instance. </li> # <li> Based on this small and brief summary we can conclude that the <b>West</b> and <b>SouthEast</b> regions have the most undesirable loan status, but just by a slightly higher percentage compared to the <b>NorthEast</b> region. </li> # <li> Again, this does not tell us what causes a loan to be a <b> bad loan </b>, but it gives us some idea about <b>the level of risk</b> within the regions across the United States. </li> # </ul> # In[ ]: # We have 67429 loans categorized as bad loans badloans_df = df.loc[df["loan_condition"] == "Bad Loan"] # loan_status cross loan_status_cross = pd.crosstab(badloans_df['region'], badloans_df['loan_status']).apply(lambda x: x/x.sum() * 100) number_of_loanstatus = pd.crosstab(badloans_df['region'], badloans_df['loan_status']) # Round our values loan_status_cross['Charged Off'] = loan_status_cross['Charged Off'].apply(lambda x: round(x, 2)) loan_status_cross['Default'] = loan_status_cross['Default'].apply(lambda x: round(x, 2)) loan_status_cross['Does not meet the credit policy. Status:Charged Off'] = loan_status_cross['Does not meet the credit policy. Status:Charged Off'].apply(lambda x: round(x, 2)) loan_status_cross['In Grace Period'] = loan_status_cross['In Grace Period'].apply(lambda x: round(x, 2)) loan_status_cross['Late (16-30 days)'] = loan_status_cross['Late (16-30 days)'].apply(lambda x: round(x, 2)) loan_status_cross['Late (31-120 days)'] = loan_status_cross['Late (31-120 days)'].apply(lambda x: round(x, 2)) number_of_loanstatus['Total'] = number_of_loanstatus.sum(axis=1) # number_of_badloans number_of_loanstatus # In[ ]: charged_off = loan_status_cross['Charged Off'].values.tolist() default = loan_status_cross['Default'].values.tolist() not_meet_credit = loan_status_cross['Does not meet the credit policy. Status:Charged Off'].values.tolist() grace_period = loan_status_cross['In Grace Period'].values.tolist() short_pay = loan_status_cross['Late (16-30 days)'] .values.tolist() long_pay = loan_status_cross['Late (31-120 days)'].values.tolist() charged = go.Bar( x=['MidWest', 'NorthEast', 'SouthEast', 'SouthWest', 'West'], y= charged_off, name='Charged Off', marker=dict( color='rgb(192, 148, 246)' ), text = '%' ) defaults = go.Bar( x=['MidWest', 'NorthEast', 'SouthEast', 'SouthWest', 'West'], y=default, name='Defaults', marker=dict( color='rgb(176, 26, 26)' ), text = '%' ) credit_policy = go.Bar( x=['MidWest', 'NorthEast', 'SouthEast', 'SouthWest', 'West'], y= not_meet_credit, name='Does not meet Credit Policy', marker = dict( color='rgb(229, 121, 36)' ), text = '%' ) grace = go.Bar( x=['MidWest', 'NorthEast', 'SouthEast', 'SouthWest', 'West'], y= grace_period, name='Grace Period', marker = dict( color='rgb(147, 147, 147)' ), text = '%' ) short_pays = go.Bar( x=['MidWest', 'NorthEast', 'SouthEast', 'SouthWest', 'West'], y= short_pay, name='Late Payment (16-30 days)', marker = dict( color='rgb(246, 157, 135)' ), text = '%' ) long_pays = go.Bar( x=['MidWest', 'NorthEast', 'SouthEast', 'SouthWest', 'West'], y= long_pay, name='Late Payment (31-120 days)', marker = dict( color = 'rgb(238, 76, 73)' ), text = '%' ) data = [charged, defaults, credit_policy, grace, short_pays, long_pays] layout = go.Layout( barmode='stack', title = '% of Bad Loan Status by Region', xaxis=dict(title='US Regions') ) fig = go.Figure(data=data, layout=layout) iplot(fig, filename='stacked-bar') # In[ ]: # Average interest rates clients pay df['interest_rate'].mean() # Average annual income of clients df['annual_income'].mean() # <h1 align="center"> The Business Perspective </h1> # <h2 > Understanding the Operative Side of Business </h2> # <a id="operative_side"></a> # <img src="http://bestcredit.sg/wp-content/uploads/2017/07/licensed-money-lender.jpg"><br><br> # Now we will have a closer look at the <b> operative side </b> of business by state. This will give us a clearer idea in which state we have a higher operating activity. This will allow us to ask further questions such as Why do we have a higher level of operating activity in this state? Could it be because of economic factors? or the risk level is low and returns are fairly decent? Let's explore! # # <h4> What we need to know: </h4> # <ul> # <li> We will focus on <b>three key metrics</b>: Loans issued by state (Total Sum), Average interest rates charged to customers and average annual income of all customers by state. </li> # <li> The purpose of this analysis is to see states that give high returns at a descent risk. </li> # # </ul> # # <h4> Summary: </h4> # <ul> # <li> <b>California, Texas, New York and Florida</b> are the states in which the highest amount of loans were issued. </li> # <li> Interesting enough, all four states have a approximate <b>interest rate of 13%</b> which is at the same level of the average interest rate for all states (13.24%) </li> # <li> California, Texas and New York are <b>all above the average annual income</b> (with the exclusion of Florida), this might give possible indication why most loans are issued in these states. </li> # </ul> # In[ ]: # Plotting by states # Grouping by our metrics # First Plotly Graph (We evaluate the operative side of the business) by_loan_amount = df.groupby(['region','addr_state'], as_index=False).loan_amount.sum() by_interest_rate = df.groupby(['region', 'addr_state'], as_index=False).interest_rate.mean() by_income = df.groupby(['region', 'addr_state'], as_index=False).annual_income.mean() # Take the values to a list for visualization purposes. states = by_loan_amount['addr_state'].values.tolist() average_loan_amounts = by_loan_amount['loan_amount'].values.tolist() average_interest_rates = by_interest_rate['interest_rate'].values.tolist() average_annual_income = by_income['annual_income'].values.tolist() from collections import OrderedDict # Figure Number 1 (Perspective for the Business Operations) metrics_data = OrderedDict([('state_codes', states), ('issued_loans', average_loan_amounts), ('interest_rate', average_interest_rates), ('annual_income', average_annual_income)]) metrics_df = pd.DataFrame.from_dict(metrics_data) metrics_df = metrics_df.round(decimals=2) metrics_df.head() # Think of a way to add default rate # Consider adding a few more metrics for the future # In[ ]: # Now it comes the part where we plot out plotly United States map import plotly.plotly as py import plotly.graph_objs as go for col in metrics_df.columns: metrics_df[col] = metrics_df[col].astype(str) scl = [[0.0, 'rgb(210, 241, 198)'],[0.2, 'rgb(188, 236, 169)'],[0.4, 'rgb(171, 235, 145)'], [0.6, 'rgb(140, 227, 105)'],[0.8, 'rgb(105, 201, 67)'],[1.0, 'rgb(59, 159, 19)']] metrics_df['text'] = metrics_df['state_codes'] + '<br>' +'Average loan interest rate: ' + metrics_df['interest_rate'] + '<br>'+'Average annual income: ' + metrics_df['annual_income'] data = [ dict( type='choropleth', colorscale = scl, autocolorscale = False, locations = metrics_df['state_codes'], z = metrics_df['issued_loans'], locationmode = 'USA-states', text = metrics_df['text'], marker = dict( line = dict ( color = 'rgb(255,255,255)', width = 2 ) ), colorbar = dict( title = "$s USD") ) ] layout = dict( title = 'Lending Clubs Issued Loans <br> (A Perspective for the Business Operations)', geo = dict( scope = 'usa', projection=dict(type='albers usa'), showlakes = True, lakecolor = 'rgb(255, 255, 255)') ) fig = dict(data=data, layout=layout) iplot(fig, filename='d3-cloropleth-map') # ## Analysis by Income Category: # <a id="income_category"></a> # In this section we will create different <b> income categories </b> in order to detect important patters and go more into depth in our analysis. # # **What we need to know:** <br> # <ul> # <li><b>Low income category:</b> Borrowers that have an annual income lower or equal to 100,000 usd.</li> # <li> <b> Medium income category:</b> Borrowers that have an annual income higher than 100,000 usd but lower or equal to 200,000 usd. </li> # <li><b> High income category: </b> Borrowers that have an annual income higher tha 200,000 usd. </li> # </ul> # # **Summary:** # <ul> # <li>Borrowers that made part of the <b>high income category</b> took higher loan amounts than people from <b>low</b> and <b>medium income categories.</b> Of course, people with higher annual incomes are more likely to pay loans with a higher amount. (First row to the left of the subplots) </li> # <li> Loans that were borrowed by the <b>Low income category</b> had a slightly higher change of becoming a bad loan. (First row to the right of the subplots) </li> # <li>Borrowers with <b>High</b> and <b> Medium</b> annual incomes had a longer employment length than people with lower incomes.(Second row to the left of the subplots) </li> # <li> Borrowers with a lower income had on average <b>higher interest rates</b> while people with a higher annual income had <b>lower interest rates</b> on their loans. (Second row to the right of the subplots)</li> # # </ul> # In[ ]: # Let's create categories for annual_income since most of the bad loans are located below 100k df['income_category'] = np.nan lst = [df] for col in lst: col.loc[col['annual_income'] <= 100000, 'income_category'] = 'Low' col.loc[(col['annual_income'] > 100000) & (col['annual_income'] <= 200000), 'income_category'] = 'Medium' col.loc[col['annual_income'] > 200000, 'income_category'] = 'High' # In[ ]: # Let's transform the column loan_condition into integrers. lst = [df] df['loan_condition_int'] = np.nan for col in lst: col.loc[df['loan_condition'] == 'Bad Loan', 'loan_condition_int'] = 0 # Negative (Bad Loan) col.loc[df['loan_condition'] == 'Good Loan', 'loan_condition_int'] = 1 # Positive (Good Loan) # In[ ]: fig, ((ax1, ax2), (ax3, ax4))= plt.subplots(nrows=2, ncols=2, figsize=(14,6)) # Change the Palette types tomorrow! sns.violinplot(x="income_category", y="loan_amount", data=df, palette="Set2", ax=ax1 ) sns.violinplot(x="income_category", y="loan_condition_int", data=df, palette="Set2", ax=ax2) sns.boxplot(x="income_category", y="emp_length_int", data=df, palette="Set2", ax=ax3) sns.boxplot(x="income_category", y="interest_rate", data=df, palette="Set2", ax=ax4) # <h1 align="center"> Assesing Risks </h1> # <h2> Understanding the Risky side of Business </h2> # <a id="risky_side"></a> # # Although the <b> operative side of business </b> is important, we have to also analyze the level of risk in each state. Credit scores are important metrics to analyze the level of risk of an individual customer. However, there are also other important metrics to somehow estimate the level of risk of other states. <br><br> # # <h4> What we need to know: </h4> # <ul> # <li> <b>Debt-to-income</b> is an important metric since it says approximately the level of debt of each individual consumer with respect to its total income. </li> # <li> The <b>average length of employment</b> tells us a better story about the labor market in each state which is helpful to assess the levelof risk. </li> # </ul> # # <h4> Summary: </h4> # <ul> # <li> <b>IOWA</b> has the highest level of default ratio neverthless, the amount of loans issued in that state is <b>too low</b>. (Number of Bad loans is equal to 3) </li> # <li> California and Texas seem to have the lowest risk and the highest possible return for investors. However, I will look more deeply into these states and create other metrics analyze the level of risk for each state. </li> # # </ul> # # # **Note: I will be updating these section sooner or later (Stay in touch!)** # In[ ]: by_condition = df.groupby('addr_state')['loan_condition'].value_counts()/ df.groupby('addr_state')['loan_condition'].count() by_emp_length = df.groupby(['region', 'addr_state'], as_index=False).emp_length_int.mean().sort_values(by="addr_state") loan_condition_bystate = pd.crosstab(df['addr_state'], df['loan_condition'] ) cross_condition = pd.crosstab(df["addr_state"], df["loan_condition"]) # Percentage of condition of loan percentage_loan_contributor = pd.crosstab(df['addr_state'], df['loan_condition']).apply(lambda x: x/x.sum() * 100) condition_ratio = cross_condition["Bad Loan"]/cross_condition["Good Loan"] by_dti = df.groupby(['region', 'addr_state'], as_index=False).dti.mean() state_codes = sorted(states) # Take to a list default_ratio = condition_ratio.values.tolist() average_dti = by_dti['dti'].values.tolist() average_emp_length = by_emp_length["emp_length_int"].values.tolist() number_of_badloans = loan_condition_bystate['Bad Loan'].values.tolist() percentage_ofall_badloans = percentage_loan_contributor['Bad Loan'].values.tolist() # Figure Number 2 risk_data = OrderedDict([('state_codes', state_codes), ('default_ratio', default_ratio), ('badloans_amount', number_of_badloans), ('percentage_of_badloans', percentage_ofall_badloans), ('average_dti', average_dti), ('average_emp_length', average_emp_length)]) # Figure 2 Dataframe risk_df = pd.DataFrame.from_dict(risk_data) risk_df = risk_df.round(decimals=3) risk_df.head() # In[ ]: # Now it comes the part where we plot out plotly United States map import plotly.plotly as py import plotly.graph_objs as go for col in risk_df.columns: risk_df[col] = risk_df[col].astype(str) scl = [[0.0, 'rgb(202, 202, 202)'],[0.2, 'rgb(253, 205, 200)'],[0.4, 'rgb(252, 169, 161)'], [0.6, 'rgb(247, 121, 108 )'],[0.8, 'rgb(232, 70, 54)'],[1.0, 'rgb(212, 31, 13)']] risk_df['text'] = risk_df['state_codes'] + '<br>' +'Number of Bad Loans: ' + risk_df['badloans_amount'] + '<br>' + 'Percentage of all Bad Loans: ' + risk_df['percentage_of_badloans'] + '%' + '<br>' + 'Average Debt-to-Income Ratio: ' + risk_df['average_dti'] + '<br>'+'Average Length of Employment: ' + risk_df['average_emp_length'] data = [ dict( type='choropleth', colorscale = scl, autocolorscale = False, locations = risk_df['state_codes'], z = risk_df['default_ratio'], locationmode = 'USA-states', text = risk_df['text'], marker = dict( line = dict ( color = 'rgb(255,255,255)', width = 2 ) ), colorbar = dict( title = "%") ) ] layout = dict( title = 'Lending Clubs Default Rates <br> (Analyzing Risks)', geo = dict( scope = 'usa', projection=dict(type='albers usa'), showlakes = True, lakecolor = 'rgb(255, 255, 255)') ) fig = dict(data=data, layout=layout) iplot(fig, filename='d3-cloropleth-map') # ## The Importance of Credit Scores: # <a id="credit_scores"></a> # Credit scores are important metrics for assesing the overall level of risk. In this section we will analyze the level of risk as a whole and how many loans were bad loans by the type of grade received in the credit score of the customer. # # <h4> What we need to know: </h4> # <ul> # <li> The lower the grade of the credit score, the higher the risk for investors. </li> # <li> There are different factors that influence on the level of risk of the loan.</li> # </ul> # # <h4> Summary: </h4> # <ul> # <li> The scores that has a lower grade received a larger amounts of loans (which might had contributed to a higher level of risk). </li> # <li> Logically, the <b>lower the grade the higher the interest</b> the customer had to pay back to investors.</li> # <li> Interstingly, customers with a <b>grade</b> of "C" were more likely to default on the loan </li> # <ul> # In[ ]: # Let's visualize how many loans were issued by creditscore f, ((ax1, ax2)) = plt.subplots(1, 2) cmap = plt.cm.coolwarm by_credit_score = df.groupby(['year', 'grade']).loan_amount.mean() by_credit_score.unstack().plot(legend=False, ax=ax1, figsize=(14, 4), colormap=cmap) ax1.set_title('Loans issued by Credit Score', fontsize=14) by_inc = df.groupby(['year', 'grade']).interest_rate.mean() by_inc.unstack().plot(ax=ax2, figsize=(14, 4), colormap=cmap) ax2.set_title('Interest Rates by Credit Score', fontsize=14) ax2.legend(bbox_to_anchor=(-1.0, -0.3, 1.7, 0.1), loc=5, prop={'size':12}, ncol=7, mode="expand", borderaxespad=0.) # In[ ]: fig = plt.figure(figsize=(16,12)) ax1 = fig.add_subplot(221) ax2 = fig.add_subplot(222) ax3 = fig.add_subplot(212) cmap = plt.cm.coolwarm_r loans_by_region = df.groupby(['grade', 'loan_condition']).size() loans_by_region.unstack().plot(kind='bar', stacked=True, colormap=cmap, ax=ax1, grid=False) ax1.set_title('Type of Loans by Grade', fontsize=14) loans_by_grade = df.groupby(['sub_grade', 'loan_condition']).size() loans_by_grade.unstack().plot(kind='bar', stacked=True, colormap=cmap, ax=ax2, grid=False) ax2.set_title('Type of Loans by Sub-Grade', fontsize=14) by_interest = df.groupby(['year', 'loan_condition']).interest_rate.mean() by_interest.unstack().plot(ax=ax3, colormap=cmap) ax3.set_title('Average Interest rate by Loan Condition', fontsize=14) ax3.set_ylabel('Interest Rate (%)', fontsize=12) # <h2>What Determines a Bad Loan </h2> # <a id="determines_bad_loan"></a> # My main aim in this section is to find the main factors that causes for a loan to be considered a <b>"Bad Loan"</b>. Logically, we could assume that factors such as a low credit grade or a high debt to income could be possible contributors in determining whether a loan is at a high risk of being defaulted. <br><br> # # <h4> What we need to know: </h4> # <ul> # <li> There might be possible factors that contribute in whether a loan is bad or not. </li> # <li> Factors that increase risk include: low annual income, high debt to income, high interest rates, low grade, among others. </li> # </ul> # # <h4> Summary: </h4> # <ul> # <li> The types of bad loans in the last year are having a tendency to<b> decline</b>, except for late payments (might indicate an economical recovery.) </li> # <li> <b>Mortgage </b> was the variable from the home ownership column that used the highest amount borrowed within loans that were considered to be bad.</li> # <li> There is a slight <b>increase</b> on people who have mortgages that are applying for a loan.</li> # <li>People who have a mortgage (depending on other factors as well within the mortgage) are more likely to ask for <bhigher loan amounts than other people who have other types of home ownerships. </li> # </ul> # In[ ]: # Just get me the numeric variables numeric_variables = df.select_dtypes(exclude=["object"]) # In[ ]: # We will use df_correlations dataframe to analyze our correlations. df_correlations = df.corr() trace = go.Heatmap(z=df_correlations.values, x=df_correlations.columns, y=df_correlations.columns, colorscale=[[0.0, 'rgb(165,0,38)'], [0.1111111111111111, 'rgb(215,48,39)'], [0.2222222222222222, 'rgb(244,109,67)'], [0.3333333333333333, 'rgb(253,174,97)'], [0.4444444444444444, 'rgb(254,224,144)'], [0.5555555555555556, 'rgb(224,243,248)'], [0.6666666666666666, 'rgb(171,217,233)'], [0.7777777777777778, 'rgb(116,173,209)'], [0.8888888888888888, 'rgb(69,117,180)'], [1.0, 'rgb(49,54,149)']], colorbar = dict( title = 'Level of Correlation', titleside = 'top', tickmode = 'array', tickvals = [-0.52,0.2,0.95], ticktext = ['Negative Correlation','Low Correlation','Positive Correlation'], ticks = 'outside' ) ) layout = {"title": "Correlation Heatmap"} data=[trace] fig = dict(data=data, layout=layout) iplot(fig, filename='labelled-heatmap') # This data looks a little but messy maybe if we focus our correlation heatmap into columns that are more worth it we might actually see a trend with the **condition of the loan**. # In[ ]: title = 'Bad Loans: Loan Statuses' labels = bad_loan # All the elements that comprise a bad loan. len(labels) colors = ['rgba(236, 112, 99, 1)', 'rgba(235, 152, 78, 1)', 'rgba(52, 73, 94, 1)', 'rgba(128, 139, 150, 1)', 'rgba(255, 87, 51, 1)', 'rgba(255, 195, 0, 1)'] mode_size = [8,8,8,8,8,8] line_size = [2,2,2,2,2,2] x_data = [ sorted(df['year'].unique().tolist()), sorted(df['year'].unique().tolist()), sorted(df['year'].unique().tolist()), sorted(df['year'].unique().tolist()), sorted(df['year'].unique().tolist()), sorted(df['year'].unique().tolist()), ] # type of loans charged_off = df['loan_amount'].loc[df['loan_status'] == 'Charged Off'].values.tolist() defaults = df['loan_amount'].loc[df['loan_status'] == 'Default'].values.tolist() not_credit_policy = df['loan_amount'].loc[df['loan_status'] == 'Does not meet the credit policy. Status:Charged Off'].values.tolist() grace_period = df['loan_amount'].loc[df['loan_status'] == 'In Grace Period'].values.tolist() short_late = df['loan_amount'].loc[df['loan_status'] == 'Late (16-30 days)'].values.tolist() long_late = df['loan_amount'].loc[df['loan_status'] == 'Late (31-120 days)'].values.tolist() y_data = [ charged_off, defaults, not_credit_policy, grace_period, short_late, long_late, ] p_charged_off = go.Scatter( x = x_data[0], y = y_data[0], name = 'A. Charged Off', line = dict( color = colors[0], width = 3, dash='dash') ) p_defaults = go.Scatter( x = x_data[1], y = y_data[1], name = 'A. Defaults', line = dict( color = colors[1], width = 3, dash='dash') ) p_credit_policy = go.Scatter( x = x_data[2], y = y_data[2], name = 'Not Meet C.P', line = dict( color = colors[2], width = 3, dash='dash') ) p_graced = go.Scatter( x = x_data[3], y = y_data[3], name = 'A. Graced Period', line = dict( color = colors[3], width = 3, dash='dash') ) p_short_late = go.Scatter( x = x_data[4], y = y_data[4], name = 'Late (16-30 days)', line = dict( color = colors[4], width = 3, dash='dash') ) p_long_late = go.Scatter( x = x_data[5], y = y_data[5], name = 'Late (31-120 days)', line = dict( color = colors[5], width = 3, dash='dash') ) data=[p_charged_off, p_defaults, p_credit_policy, p_graced, p_short_late, p_long_late] layout = dict(title = 'Types of Bad Loans <br> (Amount Borrowed Throughout the Years)', xaxis = dict(title = 'Year'), yaxis = dict(title = 'Amount Issued'), ) fig = dict(data=data, layout=layout) iplot(fig, filename='line-mode') # In[ ]: import seaborn as sns plt.figure(figsize=(18,18)) # Create a dataframe for bad loans bad_df = df.loc[df['loan_condition'] == 'Bad Loan'] plt.subplot(211) g = sns.boxplot(x='home_ownership', y='loan_amount', hue='loan_condition', data=bad_df, color='r') g.set_xticklabels(g.get_xticklabels(),rotation=45) g.set_xlabel("Type of Home Ownership", fontsize=12) g.set_ylabel("Loan Amount", fontsize=12) g.set_title("Distribution of Amount Borrowed \n by Home Ownership", fontsize=16) plt.subplot(212) g1 = sns.boxplot(x='year', y='loan_amount', hue='home_ownership', data=bad_df, palette="Set3") g1.set_xticklabels(g1.get_xticklabels(),rotation=45) g1.set_xlabel("Type of Home Ownership", fontsize=12) g1.set_ylabel("Loan Amount", fontsize=12) g1.set_title("Distribution of Amount Borrowed \n through the years", fontsize=16) plt.subplots_adjust(hspace = 0.6, top = 0.8) plt.show() # ## Defaulted Loans and Level of Risk: # <a id="defaulted_loans"></a> # From all the bad loans the one we are most interested about are the loans that are defaulted. Therefore, in this section we will implement an in-depth analysis of these types of Loans and see if we can gain any insight as to which features have a high correlation with the loan being defaulted. # # ## Main Aim: # <ul> # <li> Determine patters that will allow us to understand somehow factors that contribute to a loan being <b>defaulted</b> </li> # </ul> # # ## Summary: # <ul> # <li>In the last year recorded, the <b>Midwest </b> and <b> SouthEast </b> regions had the most defaults. </li> # <li>Loans that have a <b>high interest rate</b>(above 13.23%) are more likely to become a <b>bad loan </b>. </li> # <li>Loans that have a longer <b> maturity date (60 months) </b> are more likely to be a bad loan. </li> # </ul> # # # In[ ]: # Get the loan amount for loans that were defaulted by each region. northe_defaults = df['loan_amount'].loc[(df['region'] == 'NorthEast') & (df['loan_status'] == 'Default')].values.tolist() southw_defaults = df['loan_amount'].loc[(df['region'] == 'SouthWest') & (df['loan_status'] == 'Default')].values.tolist() southe_defaults = df['loan_amount'].loc[(df['region'] == 'SouthEast') & (df['loan_status'] == 'Default')].values.tolist() west_defaults = df['loan_amount'].loc[(df['region'] == 'West') & (df['loan_status'] == 'Default')].values.tolist() midw_defaults = df['loan_amount'].loc[(df['region'] == 'MidWest') & (df['loan_status'] == 'Default')].values.tolist() # Cumulative Values y0_stck=northe_defaults y1_stck=[y0+y1 for y0, y1 in zip(northe_defaults, southw_defaults)] y2_stck=[y0+y1+y2 for y0, y1, y2 in zip(northe_defaults, southw_defaults, southe_defaults)] y3_stck=[y0+y1+y2+y3 for y0, y1, y2, y3 in zip(northe_defaults, southw_defaults, southe_defaults, west_defaults)] y4_stck=[y0+y1+y2+y3+y4 for y0, y1, y2, y3, y4 in zip(northe_defaults, southw_defaults, southe_defaults, west_defaults, midw_defaults)] # Make original values strings and add % for hover text y0_txt=['$' + str(y0) for y0 in northe_defaults] y1_txt=['$' + str(y1) for y1 in southw_defaults] y2_txt=['$' + str(y2) for y2 in southe_defaults] y3_txt=['$' + str(y3) for y3 in west_defaults] y4_txt=['$'+ str(y4) for y4 in midw_defaults] year = sorted(df["year"].unique().tolist()) NorthEast_defaults = go.Scatter( x= year, y= y0_stck, text=y0_txt, hoverinfo='x+text', name='NorthEast', mode= 'lines', line=dict(width=0.5, color='rgb(131, 90, 241)'), fill='tonexty' ) SouthWest_defaults = go.Scatter( x=year, y=y1_stck, text=y1_txt, hoverinfo='x+text', name='SouthWest', mode= 'lines', line=dict(width=0.5, color='rgb(255, 140, 0)'), fill='tonexty' ) SouthEast_defaults = go.Scatter( x= year, y= y2_stck, text=y2_txt, hoverinfo='x+text', name='SouthEast', mode= 'lines', line=dict(width=0.5, color='rgb(240, 128, 128)'), fill='tonexty' ) West_defaults = go.Scatter( x= year, y= y3_stck, text=y3_txt, hoverinfo='x+text', name='West', mode= 'lines', line=dict(width=0.5, color='rgb(135, 206, 235)'), fill='tonexty' ) MidWest_defaults = go.Scatter( x= year, y= y4_stck, text=y4_txt, hoverinfo='x+text', name='MidWest', mode= 'lines', line=dict(width=0.5, color='rgb(240, 230, 140)'), fill='tonexty' ) data = [NorthEast_defaults, SouthWest_defaults, SouthEast_defaults, West_defaults, MidWest_defaults] layout = dict(title = 'Amount Defaulted by Region', xaxis = dict(title = 'Year'), yaxis = dict(title = 'Amount Defaulted') ) fig = dict(data=data, layout=layout) iplot(fig, filename='basic-area-no-bound') # In[ ]: df['interest_rate'].describe() # Average interest is 13.26% Anything above this will be considered of high risk let's see if this is true. df['interest_payments'] = np.nan lst = [df] for col in lst: col.loc[col['interest_rate'] <= 13.23, 'interest_payments'] = 'Low' col.loc[col['interest_rate'] > 13.23, 'interest_payments'] = 'High' df.head() # In[ ]: df['term'].value_counts() # In[ ]: from scipy.stats import norm plt.figure(figsize=(20,10)) palette = ['#009393', '#930000'] plt.subplot(221) ax = sns.countplot(x='interest_payments', data=df, palette=palette, hue='loan_condition') ax.set_title('The impact of interest rate \n on the condition of the loan', fontsize=14) ax.set_xlabel('Level of Interest Payments', fontsize=12) ax.set_ylabel('Count') plt.subplot(222) ax1 = sns.countplot(x='interest_payments', data=df, palette=palette, hue='term') ax1.set_title('The impact of maturity date \n on interest rates', fontsize=14) ax1.set_xlabel('Level of Interest Payments', fontsize=12) ax1.set_ylabel('Count') plt.subplot(212) low = df['loan_amount'].loc[df['interest_payments'] == 'Low'].values high = df['loan_amount'].loc[df['interest_payments'] == 'High'].values ax2= sns.distplot(low, color='#009393', label='Low Interest Payments', fit=norm, fit_kws={"color":"#483d8b"}) # Dark Blue Norm Color ax3 = sns.distplot(high, color='#930000', label='High Interest Payments', fit=norm, fit_kws={"color":"#c71585"}) # Red Norm Color plt.axis([0, 36000, 0, 0.00016]) plt.legend() plt.show() # ## Interest Rate by Loan Status: # The main aim in this section is to compare the average interest rate for the loan status belonging to each type of loans (Good loan or bad loan) and see if there is any significant difference in the average of interest rate for each of the groups. # # ## Summary: # <ul> # <li> <b> Bad Loans: </b> Most of the loan statuses belonging to this group pay a interest ranging from 15% - 16%. </li> # <li><b>Good Loans:</b> Most of the loan statuses belonging to this group pay interest ranging from 12% - 13%. </li> # <li>There has to be a better assesment of risk since there is not that much of a difference in interest payments from <b>Good Loans</b> and <b>Bad Loans</b>. </li> # <li> Remember, most loan statuses are <b>Current</b> so there is a risk that at the end of maturity some of these loans might become bad loans. </li> # </ul> # In[ ]: import plotly.plotly as py import plotly.graph_objs as go # Interest rate good loans avg_fully_paid = round(np.mean(df['interest_rate'].loc[df['loan_status'] == 'Fully Paid'].values), 2) avg_current = round(np.mean(df['interest_rate'].loc[df['loan_status'] == 'Current'].values), 2) avg_issued = round(
np.mean(df['interest_rate'].loc[df['loan_status'] == 'Issued'].values)
numpy.mean
import matplotlib.pyplot as plt import data import solver import numpy as np from mpl_toolkits.mplot3d import Axes3D class DataVisual: def __init__(self): pass def draw_scatter(self): my_data = data.Data() sol = solver.Solver() sol.get_saveDis_simpleV_mileageCost_Fre() left = sol.left max_left = 0 for i in range(len(left)): if np.sum(left[i]) > max_left: max_left = np.sum(left[i]) max_left = max_left / 20 color = [] for i in range(len(left)): color.append(int(min(np.sqrt(np.sum(left[i]) / max_left), 1) * 19)) print(color) main_x = sol.machine_x main_y = sol.machine_y x, y, _, _ = my_data.get_info() cm = plt.cm.get_cmap('RdYlBu') fig = plt.figure() ax = fig.add_subplot(1, 1, 1) ax.set_title('provider scatter picture') ax.set_xlabel('x') ax.set_ylabel('y') ax.scatter(x, y, marker='.', c=color, cmap=cm, label='provider') ax.scatter(main_x, main_y, marker='x', s=50, label='center') plt.xlim(xmax=np.max(x)+0.1, xmin=np.min(x)-0.1) plt.ylim(ymax=np.max(y)+0.1, ymin=np.min(y)-0.1) plt.legend() plt.show() def draw_carNum(self): percent = [] car_num = 600 for i in range(11): percent.append(int(((i - 5) / 10 + 1) * car_num)) total_dis1 = [] total_price1 = [] total_dis2 = [] total_price2 = [] total_dis3 = [] for pc in percent: sol = solver.Solver(car_num=pc) res1 = sol.get_saveDisSto_simpleV_mileageStockCost_Fre() res2 = sol.get_saveDis_simpleV_mileageCost_Fre() res3 = sol.get_trad_simpleV_mileageCost_noFre() total_dis1.append(res1.total_dis) total_price1.append(res1.total_price) total_dis2.append(res2.total_dis) total_price2.append(res2.total_price) total_dis3.append(res3.total_dis) fig1 = plt.figure() ax1 = fig1.add_subplot(1, 1, 1) ax1.set_title('harvest-distance picture') ax1.set_xlabel('vehicle') ax1.set_ylabel('km') ax1.plot(percent, total_dis1, label='storage and distance') ax1.plot(percent, total_dis2, label='only distance') ax1.plot(percent, total_dis3, label='traditional') fig1.legend() fig2 = plt.figure() ax2 = fig2.add_subplot(1, 1, 1) ax2.set_title('harvest-price picture') ax2.set_xlabel('vehicle') ax2.set_ylabel('yuan') ax2.plot(percent, total_price1, label='storage and distance') ax2.plot(percent, total_price2, label='only distance') fig2.legend() plt.show() def draw_carType(self): vv = [26.42, 54.79, 68.36, 70.5, 85.79] fig = plt.figure() ax = fig.add_subplot(1, 1, 1) ax.set_xlabel('v/m^3') ax.set_ylabel('price/yuan') ax.set_title('cartype-price picture') y = [] for v in vv: sol = solver.Solver(car_x=v, car_y=1, car_z=1) res = sol.get_saveDisSto_simpleV_mileageStockCost_Fre(disPrice_coe=5.2*v/70.5) y.append(res.total_price) ax.plot(vv, y, label='car_type') plt.legend() plt.show() def draw_carType_new(self): vv = [26.42, 54.79, 68.36, 70.5, 85.79] fig = plt.figure() ax = fig.add_subplot(1, 1, 1) ax.set_xlabel('v/m^3') ax.set_ylabel('distance/km') ax.set_title('cartype-distance picture') y = [] for v in vv: sol = solver.Solver(car_x=v, car_y=1, car_z=1) res = sol.get_saveDisSto_simpleV_mileageStockCost_Fre(disPrice_coe=5.2*v/70.5) y.append(res.total_dis) ax.plot(vv, y, label='car_type') plt.legend() plt.show() def draw_carV(self): avg_v = 60 percent = [] for i in range(11): percent.append(int(((i - 5) / 10 + 1) * avg_v)) sol = solver.Solver() fig = plt.figure() ax = fig.add_subplot(1, 1, 1) ax.set_xlabel('v/m*s^-2') ax.set_ylabel('price/yuan') ax.set_title('carV-price picture') y = [] for pc in percent: res = sol.get_saveDisSto_simpleV_mileageStockCost_Fre(avg_v=pc) y.append(res.total_price) ax.plot(percent, y, label='the v of car') plt.legend() plt.show() def draw_carV_new(self): avg_v = 60 percent = [] for i in range(11): percent.append(int(((i - 5) / 10 + 1) * avg_v)) sol = solver.Solver() fig = plt.figure() ax = fig.add_subplot(1, 1, 1) ax.set_xlabel('v/m*s^-2') ax.set_ylabel('distance/km') ax.set_title('carV-distance picture') y = [] for pc in percent: res = sol.get_saveDisSto_simpleV_mileageStockCost_Fre(avg_v=pc) y.append(res.total_dis) ax.plot(percent, y, label='the v of car') plt.legend() plt.show() def draw_position(self): sol = solver.Solver() sol.get_saveDis_simpleV_mileageCost_Fre() main_x = sol.machine_x main_y = sol.machine_y X = np.arange(-0.5, 0.5, 0.1) Y = np.arange(-0.5, 0.5, 0.1) print(X) print(Y) X, Y = np.meshgrid(X, Y) print(main_x) print(main_y) Z =
np.zeros_like(X)
numpy.zeros_like
from gensim.models.word2vec import LineSentence from gensim.models import Word2Vec import linecache import sys from keras.models import Sequential from keras.layers import Dense, Embedding, LSTM, TimeDistributed, Input, Bidirectional, Activation from keras.models import Model from keras.preprocessing import sequence from keras.models import load_model from sklearn.model_selection import train_test_split import logging import string import pickle import numpy as np from sklearn import metrics from sklearn.model_selection import KFold import logging import sys logger = logging.getLogger(__name__) logger.setLevel(level=logging.INFO) file_handler = logging.FileHandler( '/home/cry/chengxiao/dataset/tscanc/SARD_119_399/result/log/119_df_result.txt') file_handler.setLevel(level=logging.INFO) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') file_handler.setFormatter(formatter) logger.addHandler(file_handler) # StreamHandler stream_handler = logging.StreamHandler(sys.stdout) stream_handler.setFormatter(formatter) stream_handler.setLevel(level=logging.INFO) logger.addHandler(stream_handler) NUM_EPOCHS = 50 BATCH_SIZE = 64 HIDDEN_LAYER_SIZE = 64 EMBEDDING_SIZE = 50 MAX_SENTENCE_LENGTH = 50 def appendApiInfo(lenFileVec, info): """在info末加入cgd在源文件中具体行的api,用于构建sel数据库. Args: lenFileVec: 所有cgd的数量 info: 所有cgd的信息 Returns: None Raises: IOError: An error occurred accessing the bigtable.Table object. """ logger.info('解析源文件中cgd的api...'.encode('utf-8')) inforoot = u'/Users/chengxiao/Desktop/VulDeepecker/ml/resource/CWE-399/source_files/' for cdgIndex in range(lenFileVec): # print(info[cdgIndex]) # print("%d %s"%(cdgIndex,info[cdgIndex][1])) srcFilePath = inforoot + info[cdgIndex][1] # srcFilePath = info[cdgIndex][2] srcFileLine = int(info[cdgIndex][3]) # srcfile = open(srcFilePath, 'r', encoding='utf-8') srcFunc = linecache.getline(srcFilePath, srcFileLine).strip() alphac = 0 srcFilePathtmp = srcFilePath while ((not srcFunc) and (alphac != 26)): srcFilePathtmp = srcFilePath[:srcFilePath.index('.')] + string.ascii_lowercase[alphac] \ + srcFilePath[srcFilePath.index('.'):] srcFunc = linecache.getline(srcFilePathtmp, srcFileLine).strip() linescount = len(linecache.getlines(srcFilePathtmp)) + 1 srcFileLine = srcFileLine - linescount - 2 alphac = alphac + 1 info[cdgIndex].append(srcFunc) logger.info('解析api成功!'.encode('utf-8')) def fixVec(fileIntVec, model, info, tao, type): """向量处理. 对于长度小于tao的向量,如果是前向api,后补0,否则前补0; 对于长度大雨tao的向量,如果是前向api,删后,否则删前; Args: fileIntVec: (已将token转成int)codeGadget的tokenIntlist集合 [cg1,cg2,...] cg1:[tk1Int, tk2Int, ...] model: 训练模型 info: 训练集信息(源码位置,函数类型,行号) tao: 预定义向量长度 type: 0 or 1(forw backw) Returns: None Raises: IOError: An error occurred accessing the bigtable.Table object. """ logger.info('修正向量...'.encode('utf-8')) ipt = [] inforoot = u'/Users/chengxiao/Desktop/VulDeepecker/ml/resource/CWE-399/source_files/' for cdgIndex in range(len(fileIntVec)): # 通过info读源文件再判断 cdgInts = fileIntVec[cdgIndex] # srcFilePath = inforoot + info[cdgIndex][1] # srcFuncType = info[cdgIndex][2] # srcFileLine = int(info[cdgIndex][3]) # srcfile = open(srcFilePath, 'r', encoding='utf-8') # srcFunc = info[cdgIndex][4] # srcFunc = srcfile.readline(srcFileLine) # print(srcFunc) if len(cdgInts) < tao: # 补0 # print(info[cdgIndex][1]) fixvec = (tao - len(cdgInts)) * [0] # print(fixvec) if (type == 1): srcFuncType = info[cdgIndex][2] # TODO(jumormt): 如何判断api为forward if (srcFuncType == 'inputfunc'): # forward 后补0 fileIntVec[cdgIndex].extend(fixvec) else: fixvec.extend(cdgInts) fileIntVec[cdgIndex] = fixvec else: fixvec.extend(cdgInts) fileIntVec[cdgIndex] = fixvec # print(len(fileIntVec[cdgIndex])) # print(fileIntVec[cdgIndex]) if len(cdgInts) > tao: # 截断 # print(info[cdgIndex][1]) if (type == 1): srcFuncType = info[cdgIndex][2] # TODO(jumormt): 如何判断api为forward if (srcFuncType == 'inputfunc'): # forward 删后 fileIntVec[cdgIndex] = fileIntVec[cdgIndex][:tao] else: fileIntVec[cdgIndex] = fileIntVec[cdgIndex][-tao:] else: fileIntVec[cdgIndex] = fileIntVec[cdgIndex][-tao:] # print(len(fileIntVec[cdgIndex])) # print(fileIntVec[cdgIndex]) # print(fileIntVec[cdgIndex]) # print(len(fileIntVec[cdgIndex])) # ---------------------- logger.info('修正向量成功!'.encode('utf-8')) def saveVec(picklefile, fileIntVec, target, info): """划分数据集并保存数据. 将数据划分成8:2并使用pickle模块存储, x_train 和 x_test存放训练集和测试集向量, y_train 和 y_test存放target和info的ziplist Args: fileIntVec: (已将token转成int)codeGadget的tokenIntlist集合 [cg1,cg2,...] cg1:[tk1Int, tk2Int, ...] info: 训练集信息(源码位置,函数类型,行号) target: 数据集标记 Returns: None Raises: IOError: An error occurred accessing the bigtable.Table object. """ logger.info('划分数据集...'.encode('utf-8')) # 划分数据集 Y = list(zip(target, info)) # X = sequence.pad_sequences(fileIntVec, maxlen=MAX_SENTENCE_LENGTH) x_train, x_test, y_train, y_test = train_test_split(fileIntVec, Y, test_size=0.1, random_state=6) logger.info('划分数据集成功!'.encode('utf-8')) logger.info('保存数据集...'.encode('utf-8')) # 保存数据 try: with open(picklefile, 'wb') as pfile: pickle.dump( { 'x_train': x_train, 'x_test': x_test, 'y_train': y_train, 'y_test': y_test, }, pfile, pickle.HIGHEST_PROTOCOL ) except Exception as e: logger.info('Unable to save data to', picklefile, ':', e) raise logger.info('Data cached in pickle file.') def loadVec(picklefile): """读取序列化后的向量数据. 读取训练集和测试集 Args: picklefile: picklefile的位置 Returns: x_train: 训练集 x_test: 测试集 y_train: 训练集的(label,info)list y_test: 测试集的(label, info)list Raises: IOError: An error occurred accessing the bigtable.Table object. """ logger.info('载入数据集...'.encode('utf-8')) try: with open(picklefile, 'rb') as f: pickleData = pickle.load(f) x_train = pickleData['x_train'] y_train = pickleData['y_train'] x_test = pickleData['x_test'] y_test = pickleData['y_test'] del pickleData except Exception as e: logger.info('Unable to load data:', picklefile, ':', e) raise logger.info('载入数据集成功!'.encode('utf-8')) return x_train, y_train, x_test, y_test # # TODO(Jumormt): 建立双向lstm模型 # def createModel(inputLen, maxIndex, wordSize): # """创建神经网络. # # 创建双向lstm神经网络,包括输入层,循环层,输出层等。 # # Args: # inputLen: 输入向量维度 # maxIndex:词向量最大index # wordSize: 词向量维度(暂时为1) # # Returns: # model:网络模型 # # Raises: # IOError: An error occurred accessing the bigtable.Table object. # """ # logger.info('创建blstm神经网络...') # inpt = Input(shape=(inputLen,), dtype='int32') # # embedded = Embedding(maxIndex + 1, wordSize, input_length=inputLen, mask_zero=True)(inpt) # blstm = Bidirectional(LSTM(64, input_shape=(inputLen, 1), return_sequences=True), merge_mode='sum')(inpt) # output = TimeDistributed(Dense(1, activation='sigmoid'))(blstm) # model = Model(input = inpt, output = output) # model.compile(loss='binary_crossentropy', optimizer = 'adamax', metrics = ['accuracy']) # logger.info('创建blstm神经网络成功!') # return model # TODO(Jumormt): 建立双向lstm模型 def createModel(inputLen, maxIndex, wordSize): """创建神经网络. 创建双向lstm神经网络,包括输入层,循环层,输出层等。 Args: inputLen: 输入向量维度 maxIndex:词向量最大index wordSize: 词向量维度(暂时为1) Returns: model:网络模型 Raises: IOError: An error occurred accessing the bigtable.Table object. """ logger.info('创建blstm神经网络...'.encode('utf-8')) model = Sequential() # model.add(Embedding(maxIndex + 1, wordSize, input_length=inputLen, mask_zero=True)) model.add(Embedding(maxIndex + 1, wordSize, input_length=inputLen)) model.add(Bidirectional(LSTM(HIDDEN_LAYER_SIZE, dropout=0.5, recurrent_dropout=0.5))) model.add(Dense(1)) model.add(Activation("sigmoid")) model.compile(loss='binary_crossentropy', optimizer='adamax', metrics=['binary_accuracy']) logger.info('创建blstm神经网络成功!'.encode('utf-8')) return model def main(): # logging.basicConfig(filename=u'~/ml/out/log/logger.log', level=logging.INFO) # 获取训练集------------------------------------ # sentences = Text8Corpus(u"~/ml/resource/text8") # sentences = [['first', 'sentence'], ['second', 'sentence']] logger.info('载入文本数据...'.encode('utf-8')) resourcepath = u"~/ml/resource/" # datapath = u"~/ml/resource/test_error_case.txt" # datapath = u"~/ml/resource/cwe119_cgd_result.txt" # datapath = u"~/ml/resource/test_output.txt" # datapath = u"/Users/chengxiao/Desktop/VulDeepecker/ml/resource/cwe/cwe399/cwe399_cgd_result.txt" # datapath = u"/Users/chengxiao/Desktop/VulDeepecker/ml/resource/cwe/cwe119/cwe119_cgd_result.txt" # datapath = u"/Users/chengxiao/Desktop/VulDeepecker/资料/project/CGDSymbolization/src/main/resources/output1.txt" # datapath = u"/Users/chengxiao/Downloads/119/sard_sym.txt" # datapath = u"/Users/chengxiao/Downloads/CWE-840/sard_sym.txt" # datapath = u"/home/cry/chengxiao/dataset/VulDeepeckerDB/840_sym.txt" datapath = u"/home/cry/chengxiao/dataset/VulDeepeckerDB/cwe119_cgd_result.txt" sentences = LineSentence(datapath) fileVec = [] # codeGadget的tokenlist集合 [cg1,cg2,...] cg1:[tk1, tk2, ...] info = [] # codeGadget的信息集合 [序号, src位置, 函数类型, 行数, api] target = [] # codeGadget的标记 cdgVec = [] # 待加入fileVec的当前cdg的tokenlist currentCdgVec = [] # 当前cdg的token集合,二维数组 for line in sentences: """ functype = ['Off_by_One_Error_in_Methods', 'Buffer_Overflow_fgets', 'cppfunc', 'Buffer_Overflow_LowBound', 'MultiByte_String_Length', 'inputfunc', 'Buffer_Overflow_boundedcpy', 'Format_String_Attack', 'Buffer_Overflow_scanf', 'String_Termination_Error', 'Buffer_Overflow_Indexes', 'cfunc', 'Buffer_Overflow_unbounded', 'API', 'Buffer_Overflow_cpycat', 'Missing_Precision'] """ currentCdgVec.append(line) if (line[0] == "---------------------------------"): currentCdgVec.pop() # 移除分隔符 currentCdgTarget = currentCdgVec.pop() target.append(int(currentCdgTarget[0])) # target # print(currentCdgTarget[0]) infoLine = currentCdgVec[0] # print(infoLine) infoVec = [] infoVec.append(infoLine[0]) srcLocList = infoLine[:len(infoLine) - 2][1:] srcLoc = " ".join(srcLocList) # 将src位置合并为一个字符串 infoVec.append(srcLoc) # src位置 # infoVec.append(infoLine[len(infoLine)-3]) #函数类型 infoVec.append(infoLine[len(infoLine) - 2]) # 行号 infoVec.append(infoLine[len(infoLine) - 1]) # api info.append(infoVec) # print("before") # print(currentCdgVec[0]) del currentCdgVec[0] # print("after") # print(currentCdgVec[0]) # print(infoVec) for tokenLine in currentCdgVec: # print(tokenLine) cdgVec.extend(tokenLine) # print(cdgVec) fileVec.append(cdgVec) currentCdgVec = [] cdgVec = [] # if (len(line) == 4 and line[0].isdigit() # and line[3].isdigit()): # info.append(" ".join(line)) # info.append(line) # continue # if (len(line) == 1 and (line[0] == "0" or line[0] == "1")): # fileVec.append(cdgVec) # target.append(int(line[0])) # cdgVec = [] # continue # if (line[0] == "---------------------------------"): # continue # cdgVec.extend(line) # print(info) # appendApiInfo(len(fileVec), info) logger.info('载入文本数据成功!'.encode('utf-8')) # f = open("/home/centos/ml/resource/model2output.txt","w") # print(fileVec,file = f) # print(info,file = f) # print(target,file =f) # for i in range(1,10): # print(fileVec[i]) # 训练模型------------------------------------ logger.info('训练word2vec模型中...'.encode('utf-8')) # outpm = u"/Users/chengxiao/Desktop/VulDeepecker/ml/resource/model/word2vec_1102_test.model" outpm = u"/home/cry/chengxiao/dataset/VulDeepeckerDB/model/word2vec_1102_test.model" model = Word2Vec(sentences, min_count=0, size=1) logger.info('词袋模型训练成功!'.encode('utf-8')) model.save(outpm) # model = Word2Vec.load(outpm) # 构建向量------------------------------------ # wordVc = model.wv.index2entity # mp = {} # for i in range(len(wordVc)): # mp[wordVc[i]] = i # # # print(model.wv.index2entity.index("=")) # print(model.wv.word_vec("=")) # print(mp["="]) # wordDic = model.wv.vocab.keys() # print(type(wordDic)) logger.info('构建向量数据库...'.encode('utf-8')) i = 0 fileIntVec = [] # (已将token转成int)codeGadget的tokenIntlist集合 [cg1,cg2,...] cg1:[tk1Int, tk2Int, ...] for cdgs in fileVec: cdgInts = [] for token in cdgs: if token in model.wv.vocab: cdgInts.append(model.wv.vocab[token].index + 1) else: cdgInts.append(0) # print(cdgInts) fileIntVec.append(cdgInts) fixVec(fileIntVec, model, info, MAX_SENTENCE_LENGTH, 1) for i in range(1, 6): print(i) print(fileVec[i]) print(fileIntVec[i]) sys.stdout.flush() logger.info('构建向量数据库成功!'.encode('utf-8')) # ---------------------- # 保存向量化数据 picklefile = u"/home/cry/chengxiao/dataset/VulDeepeckerDB/vecdata/vecdata.pickle" # saveVec(picklefile, fileIntVec, target, info) # 载入向量化数据 # x_train, y_train_r, x_test, y_test_r = loadVec(picklefile) # y_train = [i[0] for i in y_train_r] # trainInfo = [i[1] for i in y_train_r] # y_test = [i[0] for i in y_test_r] # test_info = [i[1] for i in y_test_r] # 载入picklefile # try: # with open(picklefile, 'rb') as f: # pickleData = pickle.load(f) # x_train = pickleData['x_train'] # y_train = pickleData['y_train'] # x_test = pickleData['x_test'] # y_test = pickleData['y_test'] # del pickleData # except Exception as e: # print('Unable to load data:', picklefile, ':', e) # raise # 创建神经网络------------------------------------ maxindex = len(model.wv.index2entity) kf = KFold(n_splits=10, shuffle=True) tprList = list() fprList = list() fnrList = list() f1List = list() AUCList = list() accuracyList = list() kfcount = 1 fileIntVec = np.array(fileIntVec) target = np.array(target) for train_idx, test_idx in kf.split(fileIntVec): logger.info("split: {}".format(kfcount)) kfcount = kfcount + 1 x_train, y_train = fileIntVec[train_idx], target[train_idx] x_test, y_test = fileIntVec[test_idx], target[test_idx] blstmCgdModel = createModel(MAX_SENTENCE_LENGTH, maxindex, EMBEDDING_SIZE) print(blstmCgdModel.metrics_names) blstmCgdModel.fit(x_train, y_train, batch_size=BATCH_SIZE, epochs=NUM_EPOCHS, verbose=2) # blstmCgdModel.save('/Users/chengxiao/Desktop/VulDeepecker/ml/resource/model/model-total-1105-test.h5') # blstmCgdModel = load_model('model-total-1102.h5') # print(type(x_test)) # y_result = blstmCgdModel.predict_classes(x_train) # metricss = blstmCgdModel.evaluate(x_test, y_test, verbose=0) y_result = blstmCgdModel.predict_classes(x_test) # print('f1: %.8f' % metrics.f1_score(y_test, y_result)) TP = 0 TN = 0 FP = 0 FN = 0 for i in range(len(y_result)): if (y_test[i] == 1): if (y_result[i] == 1): TP = TP + 1 else: FN = FN + 1 else: if (y_result[i] == 1): FP = FP + 1 else: TN = TN + 1 TPR = round(TP / (TP + FN), 10) logger.info("tpr: {}".format(TPR)) FPR = round(FP / (FP + TN), 10) logger.info("fpr: {}".format(FPR)) FNR = round(FN / (TP + FN), 10) logger.info("fnr: {}".format(FNR)) if (TP + FP != 0): P = round(TP / (TP + FP), 10) logger.info("f1: {}".format(round(2 * P * TPR / (P + TPR), 10))) accuracy = metrics.accuracy_score(y_test, y_result) logger.info("accuracy: {}".format(accuracy)) AUC = metrics.roc_auc_score(y_test, y_result) logger.info('AUC: %.8f' % AUC) tprList.append(TPR) fprList.append(FPR) fnrList.append(FNR) accuracyList.append(accuracy) AUCList.append(AUC) # ji = int(1) # for i in range(len(y_result)): # print("%d %d %d"%(i,y_result[i][0],y_train[i])) # for item in y_result: # print("%d %s" % (ji,item[0])) # ji=ji+1 # print(y_result) # logger.info(metricss) logger.info("tpr: {}".format(np.mean(tprList))) logger.info("fpr: {}".format(np.mean(fprList))) logger.info("fnr: {}".format(
np.mean(fnrList)
numpy.mean
import os import numpy as np import pandas as pd import pickle from tqdm import tqdm from util.table_structure_infer import tb_struc_infer class Evaluator(object): def __init__(self, opt): self.data_list = open(os.path.join(opt.dataroot, opt.phase+'.txt'), 'r', encoding='UTF-8').readlines() if opt.phase == 'test' and opt.max_test_size != float("inf"): self.data_list = self.data_list[0:opt.max_test_size] self.gt_dict, self.gt_box_sum, self.gt_fgRel_sum, self.gt_bgRel_sum, self.pred_dict = self.create_gt_dict(self.data_list) def reset(self): self.matched_fgRel = 0.0 self.matched_bgRel = 0.0 self.pred_fgRel_sum = 0.0 self.pred_bgRel_sum = 0.0 self.pred_lloc_sum = 0.0 self.pred_rowSt_sum = 0.0 self.pred_rowEd_sum = 0.0 self.pred_colSt_sum = 0.0 self.pred_colEd_sum = 0.0 def summary(self, eval_mode = 'edge_rel | lloc'): metric = '' select_metric = 0.0 if 'edge_rel' in eval_mode: print('Evaluation for neighbor relationship detection') for tb_name in tqdm(self.gt_dict.keys()): pred_fg_ind = np.where(self.pred_dict[tb_name]['edge_rel']>0) pred_bg_ind = np.where(self.pred_dict[tb_name]['edge_rel']==0) self.pred_fgRel_sum += pred_fg_ind[0].shape[0] self.pred_bgRel_sum += pred_bg_ind[0].shape[0] self.matched_fgRel += np.where(self.pred_dict[tb_name]['edge_rel'][pred_fg_ind]==self.gt_dict[tb_name]['edge_rel'][pred_fg_ind])[0].shape[0] self.matched_bgRel += np.where(self.pred_dict[tb_name]['edge_rel'][pred_bg_ind]==self.gt_dict[tb_name]['edge_rel'][pred_bg_ind])[0].shape[0] fg_precision = self.matched_fgRel / self.pred_fgRel_sum if self.pred_fgRel_sum!=0 else 0 fg_recall = self.matched_fgRel / self.gt_fgRel_sum if self.gt_fgRel_sum!=0 else 0 bg_precision = self.matched_bgRel / self.pred_bgRel_sum if self.pred_bgRel_sum!=0 else 0 bg_recall = self.matched_bgRel / self.gt_bgRel_sum if self.gt_bgRel_sum!=0 else 0 fg_f1 = 2*(fg_precision*fg_recall)/(fg_precision+fg_recall) if fg_precision+fg_recall != 0 else 0 select_metric += fg_f1 metric += 'Fg_Precision: {:.4f}, Fg_Recall: {:.4f}, Bg_Precision: {:.4f}, Bg_Recall: {:.4f}\n'.format(\ fg_precision, fg_recall, bg_precision, bg_recall) if 'lloc' in eval_mode: print('Evaluation for cell location inference') for tb_name in tqdm(self.gt_dict.keys()): self.pred_dict[tb_name]['lloc'] = tb_struc_infer(self.pred_dict[tb_name]['edge_rel'], self.gt_dict[tb_name]['bbox']) self.pred_rowSt_sum +=
np.where(self.pred_dict[tb_name]['lloc'][:,0] == self.gt_dict[tb_name]['lloc'][:,0])
numpy.where
""" Tests for dit.math.sampling. """ from __future__ import division import pytest import numpy as np import dit.math.sampling as module import dit.example_dists from dit.exceptions import ditException #sample(dist, size=None, rand=None, prng=None): def test_sample1(): # Basic sample d = dit.example_dists.Xor() dit.math.prng.seed(0) x = module.sample(d) assert x == '101' # with log dist dit.math.prng.seed(0) d.set_base(3.5) x = module.sample(d) assert x == '101' def test_sample2(): # Specified prng d = dit.example_dists.Xor() dit.math.prng.seed(0) x = module.sample(d, prng=dit.math.prng) assert x == '101' def test_sample3(): # Specified rand number d = dit.example_dists.Xor() x = module.sample(d, rand=.3) assert x == '011' def test_sample4(): # More than one random number d = dit.example_dists.Xor() dit.math.prng.seed(0) x = module.sample(d, 6) assert x == ['101', '101', '101', '101', '011', '101'] def test_sample5(): # Bad prng d = dit.example_dists.Xor() with pytest.raises(ditException): module.sample(d, prng=3) def test_sample6(): # Not enough rands d = dit.example_dists.Xor() with pytest.raises(ditException): module.sample(d, 5, rand=[.1]*3) def test_sample_discrete_python1(): # Specified rand number d = dit.example_dists.Xor() x = module._sample_discrete__python(d.pmf, .5) assert x == 2 def test_sample_discrete_python2(): # Specified rand number d = dit.example_dists.Xor() x = module._samples_discrete__python(d.pmf, np.array([.5, .3, .2])) assert np.allclose(x, np.array([2, 1, 0])) def test_sample_discrete_python3(): # Specified rand number d = dit.example_dists.Xor() out = np.zeros((3,)) module._samples_discrete__python(d.pmf, np.array([.5, .3, .2]), out=out) assert np.allclose(out, np.array([2, 1, 0])) def test_ball_smoke(): dit.math.prng.seed(0) x = module.ball(3) x_ = np.array([ 0.21324626, 0.4465436 , -0.65226253]) assert
np.allclose(x, x_)
numpy.allclose
from bw2calc.errors import ( OutsideTechnosphere, NonsquareTechnosphere, EmptyBiosphere, InconsistentGlobalIndex, ) from bw2calc.lca import LCA from pathlib import Path import bw_processing as bwp import json import numpy as np import pytest from collections.abc import Mapping fixture_dir = Path(__file__).resolve().parent / "fixtures" ###### ### Basic functionality ###### def test_example_db_basic(): mapping = dict(json.load(open(fixture_dir / "bw2io_example_db_mapping.json"))) print(mapping) packages = [ fixture_dir / "bw2io_example_db.zip", fixture_dir / "ipcc_simple.zip", ] lca = LCA( {mapping["Driving an electric car"]: 1}, data_objs=packages, ) lca.lci() lca.lcia() assert lca.supply_array.sum() assert lca.technosphere_matrix.sum() assert lca.score def test_basic(): packages = [fixture_dir / "basic_fixture.zip"] lca = LCA({1: 1}, data_objs=packages) lca.lci() answer = np.zeros((2,)) answer[lca.dicts.activity[101]] = 1 answer[lca.dicts.activity[102]] = 0.5 assert np.allclose(answer, lca.supply_array) def test_basic_negative_production(): pass def test_basic_substitution(): pass def test_basic_nonunitary_production(): pass def test_circular_inputs(): pass ###### ### __init__ ###### def test_invalid_datapackage(): packages = ["basic_fixture.zip"] with pytest.raises(TypeError): LCA({1: 1}, data_objs=packages) def test_demand_not_mapping(): packages = [fixture_dir / "basic_fixture.zip"] with pytest.raises(ValueError): LCA((1, 1), data_objs=packages) def test_demand_mapping_but_not_dict(): class M(Mapping): def __getitem__(self, key): return 1 def __iter__(self): return iter((1,)) def __len__(self): return 1 packages = [fixture_dir / "basic_fixture.zip"] lca = LCA(M(), data_objs=packages) lca.lci() answer = np.zeros((2,)) answer[lca.dicts.activity[101]] = 1 answer[lca.dicts.activity[102]] = 0.5 assert np.allclose(answer, lca.supply_array) ###### ### __next__ ###### def test_next_data_array(): packages = [fixture_dir / "array_sequential.zip"] lca = LCA({1: 1}, data_objs=packages, use_arrays=True) lca.lci() lca.lcia() for x in range(1, 5): assert lca.biosphere_matrix.sum() == x next(lca) def test_next_only_vectors(): packages = [fixture_dir / "basic_fixture.zip"] lca = LCA({1: 1}, data_objs=packages) lca.lci() lca.lcia() current = lca.characterized_inventory.sum() next(lca) assert lca.characterized_inventory.sum() == current def test_next_plain_monte_carlo(): packages = [ fixture_dir / "mc_basic.zip", ] mc = LCA({3: 1}, data_objs=packages, use_distributions=True) mc.lci() mc.lcia() first = mc.score next(mc) assert first != mc.score def test_next_monte_carlo_as_iterator(): packages = [ fixture_dir / "mc_basic.zip", ] mc = LCA({3: 1}, data_objs=packages, use_distributions=True) mc.lci() mc.lcia() for _, _ in zip(mc, range(10)): assert mc.score > 0 def test_next_monte_carlo_all_matrices_change(): packages = [ fixture_dir / "mc_basic.zip", ] mc = LCA({3: 1}, data_objs=packages, use_distributions=True) mc.lci() mc.lcia() a = [ mc.technosphere_matrix.sum(), mc.biosphere_matrix.sum(), mc.characterization_matrix.sum(), ] next(mc) b = [ mc.technosphere_matrix.sum(), mc.biosphere_matrix.sum(), mc.characterization_matrix.sum(), ] print(a, b) for x, y in zip(a, b): assert x != y ###### ### build_demand_array ###### def test_build_demand_array(): packages = [fixture_dir / "basic_fixture.zip"] lca = LCA({1: 1}, data_objs=packages) lca.lci() assert lca.demand_array.shape == (2,) assert lca.demand_array.sum() == 1 assert lca.demand_array[lca.dicts.product[1]] == 1 def test_build_demand_array_pass_dict(): packages = [fixture_dir / "basic_fixture.zip"] lca = LCA({1: 1}, data_objs=packages) lca.lci() lca.build_demand_array({2: 5}) assert lca.demand_array.shape == (2,) assert lca.demand_array.sum() == 5 assert lca.demand_array[lca.dicts.product[2]] == 5 def test_build_demand_array_outside_technosphere(): packages = [fixture_dir / "basic_fixture.zip"] lca = LCA({100: 1}, data_objs=packages) with pytest.raises(OutsideTechnosphere): lca.lci() def test_build_demand_array_activity_not_product(): packages = [fixture_dir / "basic_fixture.zip"] lca = LCA({101: 1}, data_objs=packages) with pytest.raises(ValueError): lca.lci() def test_build_demand_array_pass_object(): packages = [fixture_dir / "basic_fixture.zip"] class Foo: pass obj = Foo() with pytest.raises(ValueError): LCA(obj, data_objs=packages) ###### ### load_lci_data ###### def test_load_lci_data(): packages = [fixture_dir / "basic_fixture.zip"] lca = LCA({1: 1}, data_objs=packages) lca.lci() tm = np.array([[1, 0], [-0.5, 1]]) assert np.allclose(lca.technosphere_matrix.toarray(), tm) assert lca.dicts.product[1] == 0 assert lca.dicts.product[2] == 1 assert lca.dicts.activity[101] == 0 assert lca.dicts.activity[102] == 1 assert lca.dicts.biosphere[1] == 0 def test_load_lci_data_nonsquare_technosphere(): dp = bwp.create_datapackage() data_array = np.array([1, 1, 0.5, 2, 3]) indices_array = np.array( [(1, 101), (2, 102), (2, 101), (3, 101), (3, 102)], dtype=bwp.INDICES_DTYPE ) flip_array = np.array([0, 0, 1, 1, 1], dtype=bool) dp.add_persistent_vector( matrix="technosphere_matrix", data_array=data_array, name="technosphere", indices_array=indices_array, flip_array=flip_array, ) lca = LCA({1: 1}, data_objs=[dp]) with pytest.raises(NonsquareTechnosphere): lca.lci() # lca.lci() # tm = np.array([ # [1, 0], # [-0.5, 1], # [-2, -3] # ]) # assert np.allclose(lca.technosphere_matrix.toarray(), tm) # assert lca.dicts.product[1] == 0 # assert lca.dicts.product[2] == 1 # assert lca.dicts.product[3] == 2 # assert lca.dicts.activity[101] == 0 # assert lca.dicts.activity[102] == 1 def test_load_lci_data_empty_biosphere_warning(): lca = LCA({1: 1}, data_objs=[fixture_dir / "empty_biosphere.zip"]) with pytest.warns(UserWarning): lca.lci() ###### ### remap_inventory_dicts ###### def test_remap_inventory_dicts(): packages = [fixture_dir / "basic_fixture.zip"] lca = LCA( {1: 1}, data_objs=packages, remapping_dicts={"product": {1: ("foo", "bar")}, "biosphere": {1: "z"}}, ) lca.lci() lca.remap_inventory_dicts() tm = np.array([[1, 0], [-0.5, 1]]) assert np.allclose(lca.technosphere_matrix.toarray(), tm) assert lca.dicts.product[("foo", "bar")] == 0 assert lca.dicts.product[2] == 1 assert lca.dicts.activity[101] == 0 assert lca.dicts.activity[102] == 1 assert lca.dicts.biosphere["z"] == 0 ###### ### load_lcia_data ###### def test_load_lcia_data(): packages = [fixture_dir / "basic_fixture.zip"] lca = LCA({1: 1}, data_objs=packages) lca.lci() lca.lcia() cm = np.array([[1]]) assert np.allclose(lca.characterization_matrix.toarray(), cm) def test_load_lcia_data_multiple_characterization_packages(): dp = bwp.create_datapackage() data_array = np.array([1, 1, 0.5]) indices_array = np.array([(1, 101), (2, 102), (2, 101)], dtype=bwp.INDICES_DTYPE) flip_array =
np.array([0, 0, 1], dtype=bool)
numpy.array
# ============================================================================ # 9. 当該住戸の外皮の部位の面積等を用いずに外皮性能を評価する方法 # ============================================================================ import numpy as np from math import ceil, floor from pyhees.section3_2_b import get_H from pyhees.section3_2_c import get_nu_H, get_nu_C import pyhees.section3_4 as eater # ============================================================================ # 9.2 主開口方位 # ============================================================================ # 標準住戸における主開口方位は南西とする。 # ============================================================================ # 9.3 外皮平均熱貫流率 # ============================================================================ def __calc_U_A(house_insulation_type, floor_bath_insulation, U_roof, U_wall, U_door, U_window, U_floor_bath, U_floor_other, U_base_etrc, U_base_bath, U_base_other, Psi_prm_etrc, Psi_prm_bath, Psi_prm_other, Psi_HB_roof, Psi_HB_wall, Psi_HB_floor, Psi_HB_roof_wall, Psi_HB_wall_wall, Psi_HB_wall_floor): """ 外皮平均熱貫流率 Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸 floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない U_roof(float): 屋根又は天井の熱貫流率 U_wall(float): 壁の熱貫流率 U_door(float): ドアの熱貫流率 U_window(float): 窓の熱貫流率 U_floor_bath(float): 浴室の床の熱貫流率 U_floor_other(float): その他の熱貫流率 U_base_etrc(float): 玄関等の基礎の熱貫流率 U_base_bath(float): 浴室の基礎の熱貫流率 U_base_other(float): その他の基礎の熱貫流率 Psi_prm_etrc(float): 玄関等の土間床等の外周部の線熱貫流率 Psi_prm_bath(float): 浴室の土間床等の外周部の線熱貫流率 Psi_prm_other(float): その他の土間床等の外周部の線熱貫流率 Psi_HB_roof(float): 屋根または天井の熱橋の線熱貫流率 Psi_HB_wall(float): 壁の熱橋の線熱貫流率 Psi_HB_floor(float): 床の熱橋の線熱貫流率 Psi_HB_roof_wall(float): 屋根または天井と壁の熱橋の線熱貫流率 Psi_HB_wall_wall(float): 壁と壁の熱橋の線熱貫流率 Psi_HB_wall_floor(float): 壁と床の熱橋の線熱貫流率 Returns: float: 外皮平均熱貫流率 """ # 単位温度差当たりの外皮熱損失量[W/K] (9b) q = get_q(house_insulation_type, floor_bath_insulation, U_roof, U_wall, U_door, U_window, U_floor_bath, U_floor_other, U_base_etrc, U_base_bath, U_base_other, Psi_prm_etrc, Psi_prm_bath, Psi_prm_other, Psi_HB_roof, Psi_HB_wall, Psi_HB_floor, Psi_HB_roof_wall, Psi_HB_wall_wall, Psi_HB_wall_floor ) # 外部部位の面積の合計 (m2) A_dash_env = get_A_dash_env(house_insulation_type, floor_bath_insulation) # 外皮平均熱貫流率 (9a) U_A = get_U_A(q, A_dash_env) return U_A def get_U_A(q, A_dash_env): """外皮平均熱貫流率 (9a) Args: q(float): 単位温度差当たりの外皮熱損失量 (W/K) A_dash_env(float): 標準住戸における外皮の部位の面積の合計 (m2) Returns: float: 外皮平均熱貫流率 """ U_A_raw = q / A_dash_env U_A = ceil(U_A_raw * 100) / 100 return U_A def get_q(house_insulation_type, floor_bath_insulation, U_roof, U_wall, U_door, U_window, U_floor_bath, U_floor_other, U_base_etrc, U_base_bath, U_base_other, Psi_prm_etrc, Psi_prm_bath, Psi_prm_other, Psi_HB_roof, Psi_HB_wall, Psi_HB_floor, Psi_HB_roof_wall, Psi_HB_wall_wall, Psi_HB_wall_floor ): """単位温度差当たりの外皮熱損失量[W/K] (9b) (主開口方位は南西とする) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' U_roof(float): 屋根又は天井の熱貫流率 U_wall(float): 壁の熱貫流率 U_door(float): ドアの熱貫流率 U_window(float): 窓の熱貫流率 U_floor_bath(float): 浴室の床の熱貫流率 U_floor_other(float): その他の熱貫流率 U_base_etrc(float): 玄関等の基礎の熱貫流率 U_base_bath(float): 浴室の基礎の熱貫流率 U_base_other(float): その他の基礎の熱貫流率 Psi_prm_etrc(float): 玄関等の土間床等の外周部の線熱貫流率 Psi_prm_bath(float): 浴室の土間床等の外周部の線熱貫流率 Psi_prm_other(float): その他の土間床等の外周部の線熱貫流率 Psi_HB_roof(float): 屋根または天井の熱橋の線熱貫流率 Psi_HB_wall(float): 壁の熱橋の線熱貫流率 Psi_HB_floor(float): 床の熱橋の線熱貫流率 Psi_HB_roof_wall(float): 屋根または天井と壁の熱橋の線熱貫流率 Psi_HB_wall_wall(float): 壁と壁の熱橋の線熱貫流率 Psi_HB_wall_floor(float): 壁と床の熱橋の線熱貫流率 Returns: float: 単位温度差当たりの外皮熱損失量[W/K] """ A_dash_roof = get_A_dash_roof() A_dash_wall_0 = get_A_dash_wall_0() A_dash_wall_90 = get_A_dash_wall_90() A_dash_wall_180 = get_A_dash_wall_180() A_dash_wall_270 = get_A_dash_wall_270() A_dash_door_0 = get_A_dash_door_0() A_dash_door_90 = get_A_dash_door_90() A_dash_door_180 = get_A_dash_door_180() A_dash_door_270 = get_A_dash_door_270() A_dash_window_0 = get_A_dash_window_0() A_dash_window_90 = get_A_dash_window_90() A_dash_window_180 = get_A_dash_window_180() A_dash_window_270 = get_A_dash_window_270() A_dash_floor_bath = get_A_dash_floor_bath(house_insulation_type, floor_bath_insulation) A_dash_floor_other = get_A_dash_floor_other(house_insulation_type, floor_bath_insulation) A_dash_base_etrc_OS_0 = get_A_dash_base_etrc_OS_0() A_dash_base_etrc_OS_90 = get_A_dash_base_etrc_OS_90() A_dash_base_etrc_OS_180 = get_A_dash_base_etrc_OS_180() A_dash_base_etrc_OS_270 = get_A_dash_base_etrc_OS_270() A_dash_base_etrc_IS = get_A_dash_base_etrc_IS(house_insulation_type, floor_bath_insulation) A_dash_base_bath_OS_0 = get_A_dash_base_bath_OS_0(house_insulation_type, floor_bath_insulation) A_dash_base_bath_OS_90 = get_A_dash_base_bath_OS_90(house_insulation_type, floor_bath_insulation) A_dash_base_bath_OS_180 = get_A_dash_base_bath_OS_180(house_insulation_type, floor_bath_insulation) A_dash_base_bath_OS_270 = get_A_dash_base_bath_OS_270(house_insulation_type, floor_bath_insulation) A_dash_base_bath_IS = get_A_dash_base_bath_IS(house_insulation_type, floor_bath_insulation) A_dash_base_other_OS_0 = get_A_dash_base_other_OS_0(house_insulation_type, floor_bath_insulation) A_dash_base_other_OS_90 = get_A_dash_base_other_OS_90(house_insulation_type, floor_bath_insulation) A_dash_base_other_OS_180 = get_A_dash_base_other_OS_180(house_insulation_type, floor_bath_insulation) A_dash_base_other_OS_270 = get_A_dash_base_other_OS_270(house_insulation_type, floor_bath_insulation) A_dash_base_other_IS = get_A_dash_base_other_IS(house_insulation_type, floor_bath_insulation) L_dash_prm_etrc_OS_0 = get_L_dash_prm_etrc_OS_0() L_dash_prm_etrc_OS_90 = get_L_dash_prm_etrc_OS_90() L_dash_prm_etrc_OS_180 = get_L_dash_prm_etrc_OS_180() L_dash_prm_etrc_OS_270 = get_L_dash_prm_etrc_OS_270() L_dash_prm_etrc_IS = get_L_dash_prm_etrc_IS(house_insulation_type, floor_bath_insulation) L_dash_prm_bath_OS_0 = get_L_dash_prm_bath_OS_0(house_insulation_type, floor_bath_insulation) L_dash_prm_bath_OS_90 = get_L_dash_prm_bath_OS_90(house_insulation_type, floor_bath_insulation) L_dash_prm_bath_OS_180 = get_L_dash_prm_bath_OS_180(house_insulation_type, floor_bath_insulation) L_dash_prm_bath_OS_270 = get_L_dash_prm_bath_OS_270(house_insulation_type, floor_bath_insulation) L_dash_prm_bath_IS = get_L_dash_prm_bath_IS(house_insulation_type, floor_bath_insulation) L_dash_prm_other_OS_0 = get_L_dash_prm_other_OS_0(house_insulation_type, floor_bath_insulation) L_dash_prm_other_OS_90 = get_L_dash_prm_other_OS_90(house_insulation_type, floor_bath_insulation) L_dash_prm_other_OS_180 = get_L_dash_prm_other_OS_180(house_insulation_type, floor_bath_insulation) L_dash_prm_other_OS_270 = get_L_dash_prm_other_OS_270(house_insulation_type, floor_bath_insulation) L_dash_prm_other_IS = get_L_dash_prm_other_IS(house_insulation_type, floor_bath_insulation) L_dash_HB_roof_top = get_L_dash_HB_roof_top() L_dash_HB_wall_0 = get_L_dash_HB_wall_0() L_dash_HB_wall_90 = get_L_dash_HB_wall_90() L_dash_HB_wall_180 = get_L_dash_HB_wall_180() L_dash_HB_wall_270 = get_L_dash_HB_wall_270() L_dash_HB_floor_IS = get_L_dash_HB_floor_IS(house_insulation_type, floor_bath_insulation) L_dash_HB_roof_wall_top_0 = get_L_dash_HB_roof_wall_top_0() L_dash_HB_roof_wall_top_90 = get_L_dash_HB_roof_wall_top_90() L_dash_HB_roof_wall_top_180 = get_L_dash_HB_roof_wall_top_180() L_dash_HB_roof_wall_top_270 = get_L_dash_HB_roof_wall_top_270() L_dash_HB_wall_wall_0_90 = get_L_dash_HB_wall_wall_0_90() L_dash_HB_wall_wall_90_180 = get_L_dash_HB_wall_wall_90_180() L_dash_HB_wall_wall_180_270 = get_L_dash_HB_wall_wall_180_270() L_dash_HB_wall_wall_270_0 = get_L_dash_HB_wall_wall_270_0() L_dash_HB_wall_floor_0_IS = get_L_dash_HB_wall_floor_0_IS() L_dash_HB_wall_floor_90_IS = get_L_dash_HB_wall_floor_90_IS() L_dash_HB_wall_floor_180_IS = get_L_dash_HB_wall_floor_180_IS() L_dash_HB_wall_floor_270_IS = get_L_dash_HB_wall_floor_270_IS() # 温度差係数 H_OS = get_H_OS() H_IS = get_H_IS() q_list = [ # 屋根又は天井 A_dash_roof * H_OS * U_roof, # 壁 (A_dash_wall_0 + A_dash_wall_90 + A_dash_wall_180 + A_dash_wall_270) * H_OS * U_wall, # ドア (A_dash_door_0 + A_dash_door_90 + A_dash_door_180 + A_dash_door_270) * H_OS * U_door, # 窓 (A_dash_window_0 + A_dash_window_90 + A_dash_window_180 + A_dash_window_270) * H_OS * U_window, # floor bath A_dash_floor_bath * H_IS * U_floor_bath, # floor other A_dash_floor_other * H_IS * U_floor_other, # 玄関等の基礎 ((A_dash_base_etrc_OS_0 + A_dash_base_etrc_OS_90 + A_dash_base_etrc_OS_180 + A_dash_base_etrc_OS_270) * H_OS + A_dash_base_etrc_IS * H_IS) * U_base_etrc, # 浴室の床 ((A_dash_base_bath_OS_0 + A_dash_base_bath_OS_90 + A_dash_base_bath_OS_180 + A_dash_base_bath_OS_270) * H_OS + A_dash_base_bath_IS * H_IS) * U_base_bath, # その他 ((A_dash_base_other_OS_0 + A_dash_base_other_OS_90 + A_dash_base_other_OS_180 + A_dash_base_other_OS_270) * H_OS + A_dash_base_other_IS * H_IS) * U_base_other, # 玄関等の土間床等の外周部 ((L_dash_prm_etrc_OS_0 + L_dash_prm_etrc_OS_90 + L_dash_prm_etrc_OS_180 + L_dash_prm_etrc_OS_270) * H_OS + L_dash_prm_etrc_IS * H_IS) * Psi_prm_etrc, # 浴室の土間床等の外周部 ((L_dash_prm_bath_OS_0 + L_dash_prm_bath_OS_90 + L_dash_prm_bath_OS_180 + L_dash_prm_bath_OS_270) * H_OS + L_dash_prm_bath_IS * H_IS) * Psi_prm_bath, # その他の土間床等の外周部 ((L_dash_prm_other_OS_0 + L_dash_prm_other_OS_90 + L_dash_prm_other_OS_180 + L_dash_prm_other_OS_270) * H_OS + L_dash_prm_other_IS * H_IS) * Psi_prm_other, # 屋根または天井の熱橋 L_dash_HB_roof_top * H_OS * Psi_HB_roof, # 壁の熱橋 (L_dash_HB_wall_0 + L_dash_HB_wall_90 + L_dash_HB_wall_180 + L_dash_HB_wall_270) * H_OS * Psi_HB_wall, # 床の熱橋 L_dash_HB_floor_IS * H_IS * Psi_HB_floor, # 屋根または天井と壁の熱橋 (L_dash_HB_roof_wall_top_0 + L_dash_HB_roof_wall_top_90 + L_dash_HB_roof_wall_top_180 + L_dash_HB_roof_wall_top_270) * H_OS * Psi_HB_roof_wall, # 壁と壁の熱橋 (L_dash_HB_wall_wall_0_90 + L_dash_HB_wall_wall_90_180 + L_dash_HB_wall_wall_180_270 + L_dash_HB_wall_wall_270_0) * H_OS * Psi_HB_wall_wall, # 壁と床の熱橋 (L_dash_HB_wall_floor_0_IS + L_dash_HB_wall_floor_90_IS + L_dash_HB_wall_floor_180_IS + L_dash_HB_wall_floor_270_IS) * H_OS * Psi_HB_wall_floor, ] q = sum(q_list) return q # ============================================================================ # 9.4 暖房期の平均日射熱取得率及び冷房期の平均日射熱取得率 # ============================================================================ def get_eta_A_H(m_H, A_dash_env): """暖房期の平均日射熱取得率 (10a) Args: m_H(float): 単位日射強度当たりの暖房期の日射熱取得量 (W/(W/m2)) A_dash_env(float): 標準住戸における外皮の部位の面積の合計 (m2) Returns: float: 暖房期の平均日射熱取得率 """ if m_H is None: return None etr_A_H = m_H / A_dash_env * 100 return floor(etr_A_H * 10) / 10 def get_m_H(region, house_insulation_type, floor_bath_insulation, U_roof, U_wall, U_door, U_base_etrc, U_base_bath, U_base_other, Psi_HB_roof, Psi_HB_wall, Psi_HB_floor, Psi_HB_roof_wall, Psi_HB_wall_wall, Psi_HB_wall_floor, etr_d, f_H=None): """単位日射強度当たりの暖房期の日射熱取得量[W/(W/m2)] (10b) Args: region(int): 省エネルギー地域区分 house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' U_roof(float): 屋根又は天井の熱貫流率 U_wall(float): 壁の熱貫流率 U_door(float): ドアの熱貫流率 U_base_etrc(float): 玄関等の基礎の熱貫流率 U_base_bath(float): 浴室の基礎の熱貫流率 U_base_other(float): その他の基礎の熱貫流率 Psi_HB_roof(float): 屋根または天井の熱橋の線熱貫流率 Psi_HB_wall(float): 壁の熱橋の線熱貫流率 Psi_HB_floor(float): 床の熱橋の線熱貫流率 Psi_HB_roof_wall(float): 屋根または天井と壁の熱橋の線熱貫流率 Psi_HB_wall_wall(float): 壁と壁の熱橋の線熱貫流率 Psi_HB_wall_floor(float): 壁と床の熱橋の線熱貫流率 etr_d(float): 暖房期の垂直面日射熱取得率 (-) f_H(float, optional): 暖房期の取得日射熱補正係数 (-) (Default value = None) Returns: float: 単位日射強度当たりの暖房期の日射熱取得量[W/(W/m2)] """ if region == 8: return None A_dash_roof = get_A_dash_roof() A_dash_wall_0 = get_A_dash_wall_0() A_dash_wall_90 = get_A_dash_wall_90() A_dash_wall_180 = get_A_dash_wall_180() A_dash_wall_270 = get_A_dash_wall_270() A_dash_door_0 = get_A_dash_door_0() A_dash_door_90 = get_A_dash_door_90() A_dash_door_180 = get_A_dash_door_180() A_dash_door_270 = get_A_dash_door_270() A_dash_window_0 = get_A_dash_window_0() A_dash_window_90 = get_A_dash_window_90() A_dash_window_180 = get_A_dash_window_180() A_dash_window_270 = get_A_dash_window_270() A_dash_base_etrc_OS_0 = get_A_dash_base_etrc_OS_0() A_dash_base_etrc_OS_90 = get_A_dash_base_etrc_OS_90() A_dash_base_etrc_OS_180 = get_A_dash_base_etrc_OS_180() A_dash_base_etrc_OS_270 = get_A_dash_base_etrc_OS_270() A_dash_base_bath_OS_0 = get_A_dash_base_bath_OS_0(house_insulation_type, floor_bath_insulation) A_dash_base_bath_OS_90 = get_A_dash_base_bath_OS_90(house_insulation_type, floor_bath_insulation) A_dash_base_bath_OS_180 = get_A_dash_base_bath_OS_180(house_insulation_type, floor_bath_insulation) A_dash_base_bath_OS_270 = get_A_dash_base_bath_OS_270(house_insulation_type, floor_bath_insulation) A_dash_base_other_OS_0 = get_A_dash_base_other_OS_0(house_insulation_type, floor_bath_insulation) A_dash_base_other_OS_90 = get_A_dash_base_other_OS_90(house_insulation_type, floor_bath_insulation) A_dash_base_other_OS_180 = get_A_dash_base_other_OS_180(house_insulation_type, floor_bath_insulation) A_dash_base_other_OS_270 = get_A_dash_base_other_OS_270(house_insulation_type, floor_bath_insulation) L_dash_HB_roof_top = get_L_dash_HB_roof_top() L_dash_HB_wall_0 = get_L_dash_HB_wall_0() L_dash_HB_wall_90 = get_L_dash_HB_wall_90() L_dash_HB_wall_180 = get_L_dash_HB_wall_180() L_dash_HB_wall_270 = get_L_dash_HB_wall_270() L_dash_HB_roof_wall_top_0 = get_L_dash_HB_roof_wall_top_0() L_dash_HB_roof_wall_top_90 = get_L_dash_HB_roof_wall_top_90() L_dash_HB_roof_wall_top_180 = get_L_dash_HB_roof_wall_top_180() L_dash_HB_roof_wall_top_270 = get_L_dash_HB_roof_wall_top_270() L_dash_HB_wall_wall_0_90 = get_L_dash_HB_wall_wall_0_90() L_dash_HB_wall_wall_90_180 = get_L_dash_HB_wall_wall_90_180() L_dash_HB_wall_wall_180_270 = get_L_dash_HB_wall_wall_180_270() L_dash_HB_wall_wall_270_0 = get_L_dash_HB_wall_wall_270_0() L_dash_HB_wall_floor_0_IS = get_L_dash_HB_wall_floor_0_IS() L_dash_HB_wall_floor_90_IS = get_L_dash_HB_wall_floor_90_IS() L_dash_HB_wall_floor_180_IS = get_L_dash_HB_wall_floor_180_IS() L_dash_HB_wall_floor_270_IS = get_L_dash_HB_wall_floor_270_IS() # 方位係数:主方位=南西 nu_H_top = get_nu_H(region, '上面') nu_H_0 = get_nu_H(region, '南西') nu_H_90 = get_nu_H(region, '北西') nu_H_180 = get_nu_H(region, '北東') nu_H_270 = get_nu_H(region, '南東') # 付録Cより:方位の異なる外皮の部位(一般部位又は開口部)に接する熱橋等の方位係数は、異なる方位の方位係数の平均値とする。 nu_H_top_0 = (get_nu_H(region, '上面') + get_nu_H(region, '南西')) / 2 nu_H_top_90 = (get_nu_H(region, '上面') + get_nu_H(region, '北西')) / 2 nu_H_top_180 = (get_nu_H(region, '上面') + get_nu_H(region, '北東')) / 2 nu_H_top_270 = (get_nu_H(region, '上面') + get_nu_H(region, '南東')) / 2 nu_H_0_90 = (get_nu_H(region, '南西') + get_nu_H(region, '北西')) / 2 nu_H_90_180 = (get_nu_H(region, '北西') + get_nu_H(region, '北東')) / 2 nu_H_180_270 = (get_nu_H(region, '北東') + get_nu_H(region, '南東')) / 2 nu_H_270_0 = (get_nu_H(region, '南東') + get_nu_H(region, '南西')) / 2 nu_H_0_IS = (get_nu_H(region, '南西') + get_nu_H(region, '下面')) / 2 nu_H_90_IS = (get_nu_H(region, '北西') + get_nu_H(region, '下面')) / 2 nu_H_180_IS = (get_nu_H(region, '北東') + get_nu_H(region, '下面')) / 2 nu_H_270_IS = (get_nu_H(region, '南東') + get_nu_H(region, '下面')) / 2 # 屋根又は天井・壁・ドアの日射熱取得率 eta_H_roof = calc_eta_H_roof(U_roof) eta_H_wall = calc_eta_H_wall(U_wall) eta_H_door = calc_eta_H_door(U_door) # 窓の日射熱取得率 eta_H_window_0, eta_H_window_90, eta_H_window_180, eta_H_window_270 = calc_eta_H_window(region, etr_d, f_H) # 玄関等・浴室・その他の基礎の日射熱取得率 eta_H_base_etrc = calc_eta_H_base_etrc(U_base_etrc) eta_H_base_bath = calc_eta_H_base_bath(U_base_bath) eta_H_base_other = calc_eta_H_base_other(U_base_other) # 熱橋の日射熱取得率 eta_dash_H_HB_roof = calc_eta_dash_H_HB_roof(Psi_HB_roof) eta_dash_H_HB_wall = calc_eta_dash_H_HB_wall(Psi_HB_wall) eta_dash_H_HB_roof_wall = calc_eta_dash_H_HB_roof_wall(Psi_HB_roof_wall) eta_dash_H_HB_wall_wall = calc_eta_dash_H_HB_wall_wall(Psi_HB_wall_wall) eta_dash_H_HB_wall_floor = calc_eta_dash_H_HB_wall_floor(Psi_HB_wall_floor) m_H_list = [ # roof A_dash_roof * nu_H_top * eta_H_roof, # wall (A_dash_wall_0 * nu_H_0 + A_dash_wall_90 * nu_H_90 + A_dash_wall_180 * nu_H_180 + A_dash_wall_270 * nu_H_270) * eta_H_wall, # door (A_dash_door_0 * nu_H_0 + A_dash_door_90 * nu_H_90 + A_dash_door_180 * nu_H_180 + A_dash_door_270 * nu_H_270) * eta_H_door, # window (A_dash_window_0 * nu_H_0 * eta_H_window_0 + A_dash_window_90 * nu_H_90 * eta_H_window_90 + A_dash_window_180 * nu_H_180 * eta_H_window_180 + A_dash_window_270 * nu_H_270 * eta_H_window_270), # base entrance (A_dash_base_etrc_OS_0 * nu_H_0 + A_dash_base_etrc_OS_90 * nu_H_90 + A_dash_base_etrc_OS_180 * nu_H_180 + A_dash_base_etrc_OS_270 * nu_H_270) * eta_H_base_etrc, # base bath (A_dash_base_bath_OS_0 * nu_H_0 + A_dash_base_bath_OS_90 * nu_H_90 + A_dash_base_bath_OS_180 * nu_H_180 + A_dash_base_bath_OS_270 * nu_H_270) * eta_H_base_bath, # base other (A_dash_base_other_OS_0 * nu_H_0 + A_dash_base_other_OS_90 * nu_H_90 + A_dash_base_other_OS_180 * nu_H_180 + A_dash_base_other_OS_270 * nu_H_270) * eta_H_base_other, # HB roof L_dash_HB_roof_top * nu_H_top * eta_dash_H_HB_roof, # HB wall (L_dash_HB_wall_0 * nu_H_0 + L_dash_HB_wall_90 * nu_H_90 + L_dash_HB_wall_180 * nu_H_180 + L_dash_HB_wall_270 * nu_H_270) * eta_dash_H_HB_wall, # HB roof_wall (L_dash_HB_roof_wall_top_0 * nu_H_top_0 + L_dash_HB_roof_wall_top_90 * nu_H_top_90 + L_dash_HB_roof_wall_top_180 * nu_H_top_180 + L_dash_HB_roof_wall_top_270 * nu_H_top_270) * eta_dash_H_HB_roof_wall, # HB wall_wall (L_dash_HB_wall_wall_0_90 * nu_H_0_90 + L_dash_HB_wall_wall_90_180 * nu_H_90_180 + L_dash_HB_wall_wall_180_270 * nu_H_180_270 + L_dash_HB_wall_wall_270_0 * nu_H_270_0) * eta_dash_H_HB_wall_wall, # HB wall_floor (L_dash_HB_wall_floor_0_IS * nu_H_0_IS + L_dash_HB_wall_floor_90_IS * nu_H_90_IS + L_dash_HB_wall_floor_180_IS * nu_H_180_IS + L_dash_HB_wall_floor_270_IS * nu_H_270_IS) * eta_dash_H_HB_wall_floor ] m_H = sum(m_H_list) return m_H def get_eta_A_C(m_C, A_dash_env): """冷房期の平均日射熱取得率 (-) (11a) Args: m_C(float): 単位日射強度当たりの冷房期の日射熱取得量 (W/(W/m2)) A_dash_env(float): 標準住戸における外皮の部位の面積の合計 (m2) Returns: float: 冷房期の平均日射熱取得率 (-) """ etr_A_C = m_C / A_dash_env * 100 return ceil(etr_A_C * 10) / 10 def get_m_C(region, house_insulation_type, floor_bath_insulation, U_roof, U_wall, U_door, U_base_etrc, U_base_bath, U_base_other, Psi_HB_roof, Psi_HB_wall, Psi_HB_floor, Psi_HB_roof_wall, Psi_HB_wall_wall, Psi_HB_wall_floor, etr_d, f_C=None): """単位日射強度当たりの冷房期の日射熱取得量[W/(W/m2)] (11b) Args: region(int): 省エネルギー地域区分 house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' U_roof(float): 屋根又は天井の熱貫流率 U_wall(float): 壁の熱貫流率 U_door(float): ドアの熱貫流率 U_base_etrc(float): 玄関等の基礎の熱貫流率 U_base_bath(float): 浴室の基礎の熱貫流率 U_base_other(float): その他の基礎の熱貫流率 Psi_HB_roof(float): 屋根または天井の熱橋の線熱貫流率 Psi_HB_wall(float): 壁の熱橋の線熱貫流率 Psi_HB_floor(float): 床の熱橋の線熱貫流率 Psi_HB_roof_wall(float): 屋根または天井と壁の熱橋の線熱貫流率 Psi_HB_wall_wall(float): 壁と壁の熱橋の線熱貫流率 Psi_HB_wall_floor(float): 壁と床の熱橋の線熱貫流率 etr_d(float): 暖房期の垂直面日射熱取得率 (-) f_C(float, optional): 冷房期の取得日射熱補正係数 (-) (Default value = None) Returns: float: 単位日射強度当たりの冷房期の日射熱取得量[W/(W/m2)] """ A_dash_roof = get_A_dash_roof() A_dash_wall_0 = get_A_dash_wall_0() A_dash_wall_90 = get_A_dash_wall_90() A_dash_wall_180 = get_A_dash_wall_180() A_dash_wall_270 = get_A_dash_wall_270() A_dash_door_0 = get_A_dash_door_0() A_dash_door_90 = get_A_dash_door_90() A_dash_door_180 = get_A_dash_door_180() A_dash_door_270 = get_A_dash_door_270() A_dash_window_0 = get_A_dash_window_0() A_dash_window_90 = get_A_dash_window_90() A_dash_window_180 = get_A_dash_window_180() A_dash_window_270 = get_A_dash_window_270() A_dash_base_etrc_OS_0 = get_A_dash_base_etrc_OS_0() A_dash_base_etrc_OS_90 = get_A_dash_base_etrc_OS_90() A_dash_base_etrc_OS_180 = get_A_dash_base_etrc_OS_180() A_dash_base_etrc_OS_270 = get_A_dash_base_etrc_OS_270() A_dash_base_bath_OS_0 = get_A_dash_base_bath_OS_0(house_insulation_type, floor_bath_insulation) A_dash_base_bath_OS_90 = get_A_dash_base_bath_OS_90(house_insulation_type, floor_bath_insulation) A_dash_base_bath_OS_180 = get_A_dash_base_bath_OS_180(house_insulation_type, floor_bath_insulation) A_dash_base_bath_OS_270 = get_A_dash_base_bath_OS_270(house_insulation_type, floor_bath_insulation) A_dash_base_other_OS_0 = get_A_dash_base_other_OS_0(house_insulation_type, floor_bath_insulation) A_dash_base_other_OS_90 = get_A_dash_base_other_OS_90(house_insulation_type, floor_bath_insulation) A_dash_base_other_OS_180 = get_A_dash_base_other_OS_180(house_insulation_type, floor_bath_insulation) A_dash_base_other_OS_270 = get_A_dash_base_other_OS_270(house_insulation_type, floor_bath_insulation) L_dash_HB_roof_top = get_L_dash_HB_roof_top() L_dash_HB_wall_0 = get_L_dash_HB_wall_0() L_dash_HB_wall_90 = get_L_dash_HB_wall_90() L_dash_HB_wall_180 = get_L_dash_HB_wall_180() L_dash_HB_wall_270 = get_L_dash_HB_wall_270() L_dash_HB_roof_wall_top_0 = get_L_dash_HB_roof_wall_top_0() L_dash_HB_roof_wall_top_90 = get_L_dash_HB_roof_wall_top_90() L_dash_HB_roof_wall_top_180 = get_L_dash_HB_roof_wall_top_180() L_dash_HB_roof_wall_top_270 = get_L_dash_HB_roof_wall_top_270() L_dash_HB_wall_wall_0_90 = get_L_dash_HB_wall_wall_0_90() L_dash_HB_wall_wall_90_180 = get_L_dash_HB_wall_wall_90_180() L_dash_HB_wall_wall_180_270 = get_L_dash_HB_wall_wall_180_270() L_dash_HB_wall_wall_270_0 = get_L_dash_HB_wall_wall_270_0() L_dash_HB_wall_floor_0_IS = get_L_dash_HB_wall_floor_0_IS() L_dash_HB_wall_floor_90_IS = get_L_dash_HB_wall_floor_90_IS() L_dash_HB_wall_floor_180_IS = get_L_dash_HB_wall_floor_180_IS() L_dash_HB_wall_floor_270_IS = get_L_dash_HB_wall_floor_270_IS() # 方位係数:主方位=南西 nu_C_top = get_nu_C(region, '上面') nu_C_0 = get_nu_C(region, '南西') nu_C_90 = get_nu_C(region, '北西') nu_C_180 = get_nu_C(region, '北東') nu_C_270 = get_nu_C(region, '南東') # 付録Cより:方位の異なる外皮の部位(一般部位又は開口部)に接する熱橋等の方位係数は、異なる方位の方位係数の平均値とする。 nu_C_top_0 = (get_nu_C(region, '上面') + get_nu_C(region, '南西')) / 2 nu_C_top_90 = (get_nu_C(region, '上面') + get_nu_C(region, '北西')) / 2 nu_C_top_180 = (get_nu_C(region, '上面') + get_nu_C(region, '北東')) / 2 nu_C_top_270 = (get_nu_C(region, '上面') + get_nu_C(region, '南東')) / 2 nu_C_0_90 = (get_nu_C(region, '南西') + get_nu_C(region, '北西')) / 2 nu_C_90_180 = (get_nu_C(region, '北西') + get_nu_C(region, '北東')) / 2 nu_C_180_270 = (get_nu_C(region, '北東') + get_nu_C(region, '南東')) / 2 nu_C_270_0 = (get_nu_C(region, '南東') + get_nu_C(region, '南西')) / 2 nu_C_0_IS = (get_nu_C(region, '南西') + get_nu_C(region, '下面')) / 2 nu_C_90_IS = (get_nu_C(region, '北西') + get_nu_C(region, '下面')) / 2 nu_C_180_IS = (get_nu_C(region, '北東') + get_nu_C(region, '下面')) / 2 nu_C_270_IS = (get_nu_C(region, '南東') + get_nu_C(region, '下面')) / 2 # 屋根又は天井・壁・ドアの日射熱取得率 eta_C_roof = calc_eta_C_roof(U_roof) eta_C_wall = calc_eta_C_wall(U_wall) eta_C_door = calc_eta_C_door(U_door) # 窓の日射熱取得率 eta_C_window_0, eta_C_window_90, eta_C_window_180, eta_C_window_270 = calc_eta_C_window(region, etr_d, f_C) # 玄関等・浴室・その他の基礎の日射熱取得率 eta_C_base_etrc = calc_eta_C_base_etrc(U_base_etrc) eta_C_base_bath = calc_eta_C_base_bath(U_base_bath) eta_C_base_other = calc_eta_C_base_other(U_base_other) # 熱橋の日射熱取得率 eta_dash_C_HB_roof = calc_eta_dash_C_HB_roof(Psi_HB_roof) eta_dash_C_HB_wall = calc_eta_dash_C_HB_wall(Psi_HB_wall) eta_dash_C_HB_roof_wall = calc_eta_dash_C_HB_roof_wall(Psi_HB_roof_wall) eta_dash_C_HB_wall_wall = calc_eta_dash_C_HB_wall_wall(Psi_HB_wall_wall) eta_dash_C_HB_wall_floor = calc_eta_dash_C_HB_wall_floor(Psi_HB_wall_floor) m_C_list = [ # roof A_dash_roof * nu_C_top * eta_C_roof, # wall (A_dash_wall_0 * nu_C_0 + A_dash_wall_90 * nu_C_90 + A_dash_wall_180 * nu_C_180 + A_dash_wall_270 * nu_C_270) * eta_C_wall, # door (A_dash_door_0 * nu_C_0 + A_dash_door_90 * nu_C_90 + A_dash_door_180 * nu_C_180 + A_dash_door_270 * nu_C_270) * eta_C_door, # window (A_dash_window_0 * nu_C_0 * eta_C_window_0 + A_dash_window_90 * nu_C_90 * eta_C_window_90 + A_dash_window_180 * nu_C_180 * eta_C_window_180 + A_dash_window_270 * nu_C_270 * eta_C_window_270), # base entrance (A_dash_base_etrc_OS_0 * nu_C_0 + A_dash_base_etrc_OS_90 * nu_C_90 + A_dash_base_etrc_OS_180 * nu_C_180 + A_dash_base_etrc_OS_270 * nu_C_270) * eta_C_base_etrc, # base bath (A_dash_base_bath_OS_0 * nu_C_0 + A_dash_base_bath_OS_90 * nu_C_90 + A_dash_base_bath_OS_180 * nu_C_180 + A_dash_base_bath_OS_270 * nu_C_270) * eta_C_base_bath, # base other (A_dash_base_other_OS_0 * nu_C_0 + A_dash_base_other_OS_90 * nu_C_90 + A_dash_base_other_OS_180 * nu_C_180 + A_dash_base_other_OS_270 * nu_C_270) * eta_C_base_other, # HB roof L_dash_HB_roof_top * nu_C_top * eta_dash_C_HB_roof, # HB wall (L_dash_HB_wall_0 * nu_C_0 + L_dash_HB_wall_90 * nu_C_90 + L_dash_HB_wall_180 * nu_C_180 + L_dash_HB_wall_270 * nu_C_270) * eta_dash_C_HB_wall, # HB roof_wall (L_dash_HB_roof_wall_top_0 * nu_C_top_0 + L_dash_HB_roof_wall_top_90 * nu_C_top_90 + L_dash_HB_roof_wall_top_180 * nu_C_top_180 + L_dash_HB_roof_wall_top_270 * nu_C_top_270) * eta_dash_C_HB_roof_wall, # HB wall_wall (L_dash_HB_wall_wall_0_90 * nu_C_0_90 + L_dash_HB_wall_wall_90_180 * nu_C_90_180 + L_dash_HB_wall_wall_180_270 * nu_C_180_270 + L_dash_HB_wall_wall_270_0 * nu_C_270_0) * eta_dash_C_HB_wall_wall, # HB wall_floor (L_dash_HB_wall_floor_0_IS * nu_C_0_IS + L_dash_HB_wall_floor_90_IS * nu_C_90_IS + L_dash_HB_wall_floor_180_IS * nu_C_180_IS + L_dash_HB_wall_floor_270_IS * nu_C_270_IS) * eta_dash_C_HB_wall_floor ] m_C = sum(m_C_list) return m_C # ============================================================================ # 9.5 床面積の合計に対する外皮の部位の面積の合計の比 # ============================================================================ def get_r_env(A_dash_env, A_dash_A): """床面積の合計に対する外皮の部位の面積の合計の比 (12) Args: A_dash_env(float): 標準住戸における外皮の部位の面積の合計 (m2) A_dash_A(float): 標準住戸における床面積の合計 (m2) Returns: float: 床面積の合計に対する外皮の部位の面積の合計の比 (-) """ return A_dash_env / A_dash_A # ============================================================================ # 9.6 標準住戸における外皮の部位の面積及び土間床等の外周部の長さ等 # ============================================================================ def calc_U_A(insulation_structure, house_structure_type, floor_bath_insulation=None, bath_insulation_type=None, U_roof=None, U_wall=None, U_door=None, U_window=None, U_floor_bath=None, U_floor_other=None, U_base_etrc=None, U_base_bath=None, U_base_other=None, Psi_prm_etrc=None, Psi_prm_bath=None, Psi_prm_other=None, Psi_HB_roof=None, Psi_HB_wall=None, Psi_HB_floor=None, Psi_HB_roof_wall=None, Psi_HB_wall_wall=None, Psi_HB_wall_floor=None): """断熱構造による住戸の種類に応じてU_A値を計算する Args: insulation_structure(structure: structure: str): 断熱構造による住戸の種類 house_structure_type(structure_type: structure_type: str): 木造'または'鉄筋コンクリート造'または'鉄骨造' floor_bath_insulation(str, optional): 浴室床の断熱 (Default value = None) bath_insulation_type(str, optional): 浴室の断熱タイプ※ (Default value = None) U_roof(float, optional): 屋根又は天井の熱貫流率 (Default value = None) U_wall(float, optional): 壁の熱貫流率 (Default value = None) U_door(float, optional): ドアの熱貫流率 (Default value = None) U_window(float, optional): 窓の熱貫流率 (Default value = None) U_floor_bath(float, optional): 浴室の床の熱貫流率 (Default value = None) U_floor_other(float, optional): その他の熱貫流率 (Default value = None) Psi_prm_etrc(float, optional): 玄関等の土間床等の外周部の線熱貫流率 (Default value = None) Psi_prm_bath(float, optional): 浴室の土間床等の外周部の線熱貫流率 (Default value = None) Psi_prm_other(float, optional): その他の土間床等の外周部の線熱貫流率 (Default value = None) Psi_HB_roof(float, optional): 屋根または天井の熱橋の線熱貫流率 (Default value = None) Psi_HB_wall(float, optional): 壁の熱橋の線熱貫流率 (Default value = None) Psi_HB_floor(float, optional): 床の熱橋の線熱貫流率 (Default value = None) Psi_HB_roof_wall(float, optional): 屋根または天井と壁の熱橋の線熱貫流率 (Default value = None) Psi_HB_wall_wall(float, optional): 壁と壁の熱橋の線熱貫流率 (Default value = None) Psi_HB_wall_floor(float, optional): 壁と床の熱橋の線熱貫流率 (Default value = None) U_base_etrc: Default value = None) U_base_bath: Default value = None) U_base_other: Default value = None) Returns: tuple: 外皮平均熱貫流率 (U_A), 外皮の部位の熱貫流率 (U) """ # 断熱構造による住戸の種類 if insulation_structure == '床断熱住戸の場合': U = get_U('床断熱住戸', house_structure_type, floor_bath_insulation, bath_insulation_type, U_roof, U_wall, U_door, U_window, U_floor_bath, U_floor_other, U_base_etrc, U_base_bath, U_base_other, Psi_prm_etrc, Psi_prm_bath, Psi_prm_other, Psi_HB_roof, Psi_HB_wall, Psi_HB_floor, Psi_HB_roof_wall, Psi_HB_wall_wall, Psi_HB_wall_floor) U_A = __calc_U_A(**U) elif insulation_structure == '基礎断熱住戸の場合': U = get_U('基礎断熱住戸', house_structure_type, floor_bath_insulation, bath_insulation_type, U_roof, U_wall, U_door, U_window, U_floor_bath, U_floor_other, U_base_etrc, U_base_bath, U_base_other, Psi_prm_etrc, Psi_prm_bath, Psi_prm_other, Psi_HB_roof, Psi_HB_wall, Psi_HB_floor, Psi_HB_roof_wall, Psi_HB_wall_wall, Psi_HB_wall_floor) U_A = __calc_U_A(**U) elif insulation_structure == '玄関等及び浴室を除いた部分の外皮が床と土間床等の外周部の基礎のいずれにも該当する場合': # 玄関等及び浴室を除いた部分の外皮が床と土間床等の外周部の基礎のいずれにも該当する場合は、 # 表3の標準住戸における部位の面積及び土間床等の外周部の長さ等の値について、表3(い)欄に示す値及び # 表3(ろ)欄に示す値の両方を式(9a)及び式(9b)で表される外皮平均熱貫流率の計算に適用し、 # 外皮平均熱貫流率の値が大きい方の場合を採用する U_0 = get_U('床断熱住戸', house_structure_type, floor_bath_insulation, bath_insulation_type, U_roof, U_wall, U_door, U_window, U_floor_bath, U_floor_other, U_base_etrc, U_base_bath, U_base_other, Psi_prm_etrc, Psi_prm_bath, Psi_prm_other, Psi_HB_roof, Psi_HB_wall, Psi_HB_floor, Psi_HB_roof_wall, Psi_HB_wall_wall, Psi_HB_wall_floor) U_1 = get_U('基礎断熱住戸', house_structure_type, floor_bath_insulation, bath_insulation_type, U_roof, U_wall, U_door, U_window, U_floor_bath, U_floor_other, U_base_etrc, U_base_bath, U_base_other, Psi_prm_etrc, Psi_prm_bath, Psi_prm_other, Psi_HB_roof, Psi_HB_wall, Psi_HB_floor, Psi_HB_roof_wall, Psi_HB_wall_wall, Psi_HB_wall_floor) U_A_0 = __calc_U_A(**U_0) U_A_1 = __calc_U_A(**U_1) if U_A_0 > U_A_1: U = U_0 U_A = U_A_0 else: U = U_1 U_A = U_A_1 else: raise ValueError(insulation_structure) return U_A, U def get_table_3(i, house_insulation_type, floor_bath_insulation=None): """表3 標準住戸における部位の面積及び土間床等の外周部の長さ等 Args: i(int): 表3における行番号 house_insulation_type(str): 床断熱'または'基礎断熱' floor_bath_insulation(str, optional): 床断熱'または'基礎断熱'または'浴室の床及び基礎が外気等に面していない' (Default value = None) Returns: float: 標準住戸における部位の面積及び土間床等の外周部の長さ等 (m)または(m2) """ table_3 = [ (262.46, 262.46, 266.10, 275.69), 90.0, 50.85, 34.06, 22.74, 48.49, 22.97, 0.0, 1.89, 1.62, 0.0, 19.11, 2.01, 3.05, 3.68, (3.31, 3.31, 0.00, 0.00), (45.05, 45.05, 45.05, 0.00), 0.00, 0.33, 0.25, 0.00, (0.57, 0.57, 0.57, 0.00), (0.00, 0.00, 0.00, 0.00), (0.00, 0.00, 0.91, 0.91), (0.00, 0.00, 0.91, 0.91), (0.00, 0.00, 0.00, 0.00), (0.00, 0.00, 1.82, 0.00), (0.00, 0.00, 0.00, 5.30), (0.00, 0.00, 0.00, 0.58), (0.00, 0.00, 0.00, 3.71), (0.00, 0.00, 0.00, 2.40), (0.00, 0.00, 0.00, 0.00), 0.00, 1.82, 1.37, 0.00, (3.19, 3.19, 3.19, 0.00), (0.00, 0.00, 0.00, 0.00), (0.00, 0.00, 1.82, 1.82), (0.00, 0.00, 1.82, 1.82), (0.00, 0.00, 0.00, 0.00), (0.00, 0.00, 3.64, 0.00), (0.00, 0.00, 0.00, 10.61), (0.00, 0.00, 0.00, 1.15), (0.00, 0.00, 0.00, 7.42), (0.00, 0.00, 0.00, 4.79), (0.00, 0.00, 0.00, 0.00), 15.40, 13.89, 5.60, 5.60, 10.32, (19.04, 19.04, 19.04, 0.0), 10.61, 14.23, 27.2, 4.79, 5.60, 17.2, 5.6, 5.6, 10.61, 2.97, 9.24, 4.79, ] if house_insulation_type == '床断熱住戸': if floor_bath_insulation == '浴室の床及び基礎が外気等に面していない': return table_3[i][0] elif floor_bath_insulation == '床断熱': return table_3[i][1] elif floor_bath_insulation == '基礎断熱': return table_3[i][2] else: raise ValueError(floor_bath_insulation) elif house_insulation_type == '基礎断熱住戸': return table_3[i][3] elif house_insulation_type == None: return table_3[i] else: raise ValueError(house_insulation_type) def get_A_dash_env(house_insulation_type, floor_bath_insulation): """標準住戸における外皮の部位の面積の合計 (m2) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 標準住戸における外皮の部位の面積の合計 (m2) """ return get_table_3(0, house_insulation_type, floor_bath_insulation) def get_A_dash_A(): """床面積の合計 (m2) Args: Returns: float: 床面積の合計 (m2) """ return get_table_3(1, None) def get_A_dash_roof(): """屋根又は天井の面積 (m2) Args: Returns: float: 屋根又は天井の面積 (m2) """ return get_table_3(2, None) def get_A_dash_wall_0(): """主開口方向から時計回りに0°の方向に面した壁の面積 (m2) Args: Returns: float: 主開口方向から時計回りに0°の方向に面した壁の面積 (m2) """ return get_table_3(3, None) def get_A_dash_wall_90(): """主開口方向から時計回りに90°の方向に面した壁の面積 (m2) Args: Returns: float: 主開口方向から時計回りに90°の方向に面した壁の面積 (m2) """ return get_table_3(4, None) def get_A_dash_wall_180(): """主開口方向から時計回りに180°の方向に面した壁の面積 (m2) Args: Returns: float: 主開口方向から時計回りに180°の方向に面した壁の面積 (m2) """ return get_table_3(5, None) def get_A_dash_wall_270(): """主開口方向から時計回りに270°の方向に面した壁の面積 (m2) Args: Returns: float: 主開口方向から時計回りに270°の方向に面した壁の面積 (m2) """ return get_table_3(6, None) def get_A_dash_door_0(): """主開口方向から時計回りに0°の方向に面したドアの面積 (m2) Args: Returns: float: 主開口方向から時計回りに0°の方向に面したドアの面積 (m2) """ return get_table_3(7, None) def get_A_dash_door_90(): """主開口方向から時計回りに90°の方向に面したドアの面積 (m2) Args: Returns: float: 主開口方向から時計回りに90°の方向に面したドアの面積 (m2) """ return get_table_3(8, None) def get_A_dash_door_180(): """主開口方向から時計回りに180°の方向に面したドアの面積 (m2) Args: Returns: float: 主開口方向から時計回りに180°の方向に面したドアの面積 (m2) """ return get_table_3(9, None) def get_A_dash_door_270(): """主開口方向から時計回りに270°の方向に面したドアの面積 (m2) Args: Returns: float: 主開口方向から時計回りに270°の方向に面したドアの面積 (m2) """ return get_table_3(10, None) def get_A_dash_window_0(): """主開口方向から時計回りに0°の方向に面した窓の面積 (m2) Args: Returns: float: 主開口方向から時計回りに0°の方向に面した窓の面積 (m2) """ return get_table_3(11, None) def get_A_dash_window_90(): """主開口方向から時計回りに90°の方向に面した窓の面積 (m2) Args: Returns: float: 主開口方向から時計回りに90°の方向に面した窓の面積 (m2) """ return get_table_3(12, None) def get_A_dash_window_180(): """主開口方向から時計回りに180°の方向に面した窓の面積 (m2) Args: Returns: float: 主開口方向から時計回りに180°の方向に面した窓の面積 (m2) """ return get_table_3(13, None) def get_A_dash_window_270(): """主開口方向から時計回りに270°の方向に面した窓の面積 (m2) Args: Returns: float: 主開口方向から時計回りに270°の方向に面した窓の面積 (m2) """ return get_table_3(14, None) def get_A_dash_floor_bath(house_insulation_type, floor_bath_insulation): """浴室の床の面積 (m2) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 浴室の床の面積 (m2) """ return get_table_3(15, house_insulation_type, floor_bath_insulation) def get_A_dash_floor_other(house_insulation_type, floor_bath_insulation): """浴室の床の面積 (m2) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 浴室の床の面積 (m2) """ return get_table_3(16, house_insulation_type, floor_bath_insulation) def get_A_dash_base_etrc_OS_0(): """主開口方向から時計回りに0°の方向の外気に面した玄関等の基礎の面積 (m2) Args: Returns: float: 主開口方向から時計回りに0°の方向の外気に面した玄関等の基礎の面積 (m2) """ return get_table_3(17, None) def get_A_dash_base_etrc_OS_90(): """主開口方向から時計回りに90°の方向の外気に面した玄関等の基礎の面積 (m2) Args: Returns: float: 主開口方向から時計回りに90°の方向の外気に面した玄関等の基礎の面積 (m2) """ return get_table_3(18, None) def get_A_dash_base_etrc_OS_180(): """主開口方向から時計回りに180°の方向の外気に面した玄関等の基礎の面積 (m2) Args: Returns: float: 主開口方向から時計回りに180°の方向の外気に面した玄関等の基礎の面積 (m2) """ return get_table_3(19, None) def get_A_dash_base_etrc_OS_270(): """主開口方向から時計回りに270°の方向の外気に面した玄関等の基礎の面積 (m2) Args: Returns: float: 主開口方向から時計回りに270°の方向の外気に面した玄関等の基礎の面積 (m2) """ return get_table_3(20, None) def get_A_dash_base_etrc_IS(house_insulation_type, floor_bath_insulation): """床下に面した玄関等の基礎の面積 (m2) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 床下に面した玄関等の基礎の面積 (m2) """ return get_table_3(21, house_insulation_type, floor_bath_insulation) def get_A_dash_base_bath_OS_0(house_insulation_type, floor_bath_insulation): """主開口方向から時計回りに0°の方向の外気に面した浴室の基礎の面積 (m2) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 主開口方向から時計回りに0°の方向の外気に面した浴室の基礎の面積 (m2) """ return get_table_3(22, house_insulation_type, floor_bath_insulation) def get_A_dash_base_bath_OS_90(house_insulation_type, floor_bath_insulation): """主開口方向から時計回りに90°の方向の外気に面した浴室の基礎の面積 (m2) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 主開口方向から時計回りに90°の方向の外気に面した浴室の基礎の面積 (m2) """ return get_table_3(23, house_insulation_type, floor_bath_insulation) def get_A_dash_base_bath_OS_180(house_insulation_type, floor_bath_insulation): """主開口方向から時計回りに180°の方向の外気に面した浴室の基礎の面積 (m2) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 主開口方向から時計回りに180°の方向の外気に面した浴室の基礎の面積 (m2) """ return get_table_3(24, house_insulation_type, floor_bath_insulation) def get_A_dash_base_bath_OS_270(house_insulation_type, floor_bath_insulation): """主開口方向から時計回りに270°の方向の外気に面した浴室の基礎の面積 (m2) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 主開口方向から時計回りに270°の方向の外気に面した浴室の基礎の面積 (m2) """ return get_table_3(25, house_insulation_type, floor_bath_insulation) def get_A_dash_base_bath_IS(house_insulation_type, floor_bath_insulation): """床下に面した浴室の基礎の面積 (m2) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 床下に面した浴室の基礎の面積 (m2) """ return get_table_3(26, house_insulation_type, floor_bath_insulation) def get_A_dash_base_other_OS_0(house_insulation_type, floor_bath_insulation): """主開口方向から時計回りに0°の方向の外気に面したその他の基礎の面積 (m2) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 主開口方向から時計回りに0°の方向の外気に面したその他の基礎の面積 (m2) """ return get_table_3(27, house_insulation_type, floor_bath_insulation) def get_A_dash_base_other_OS_90(house_insulation_type, floor_bath_insulation): """主開口方向から時計回りに90°の方向の外気に面したその他の基礎の面積 (m2) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 主開口方向から時計回りに90°の方向の外気に面したその他の基礎の面積 (m2) """ return get_table_3(28, house_insulation_type, floor_bath_insulation) def get_A_dash_base_other_OS_180(house_insulation_type, floor_bath_insulation): """主開口方向から時計回りに180°の方向の外気に面したその他の基礎の面積 (m2) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 主開口方向から時計回りに180°の方向の外気に面したその他の基礎の面積 (m2) """ return get_table_3(29, house_insulation_type, floor_bath_insulation) def get_A_dash_base_other_OS_270(house_insulation_type, floor_bath_insulation): """主開口方向から時計回りに270°の方向の外気に面したその他の基礎の面積 (m2) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 主開口方向から時計回りに270°の方向の外気に面したその他の基礎の面積 (m2) """ return get_table_3(30, house_insulation_type, floor_bath_insulation) def get_A_dash_base_other_IS(house_insulation_type, floor_bath_insulation): """床下に面したその他の基礎の面積 (m2) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 床下に面したその他の基礎の面積 (m2) """ return get_table_3(31, house_insulation_type, floor_bath_insulation) def get_L_dash_prm_etrc_OS_0(): """主開口方向から時計回りに0°の方向の外気に面した玄関等の土間床等の外周部の長さ (m) Args: Returns: float: 主開口方向から時計回りに0°の方向の外気に面した玄関等の土間床等の外周部の長さ (m) """ return get_table_3(32, None) def get_L_dash_prm_etrc_OS_90(): """主開口方向から時計回りに90°の方向の外気に面した玄関等の土間床等の外周部の長さ (m) Args: Returns: float: 主開口方向から時計回りに90°の方向の外気に面した玄関等の土間床等の外周部の長さ (m) """ return get_table_3(33, None) def get_L_dash_prm_etrc_OS_180(): """主開口方向から時計回りに180°の方向の外気に面した玄関等の土間床等の外周部の長さ (m) Args: Returns: float: 主開口方向から時計回りに180°の方向の外気に面した玄関等の土間床等の外周部の長さ (m) """ return get_table_3(34, None) def get_L_dash_prm_etrc_OS_270(): """主開口方向から時計回りに270°の方向の外気に面した玄関等の土間床等の外周部の長さ (m) Args: Returns: float: 主開口方向から時計回りに270°の方向の外気に面した玄関等の土間床等の外周部の長さ (m) """ return get_table_3(35, None) def get_L_dash_prm_etrc_IS(house_insulation_type, floor_bath_insulation): """床下に面した玄関等の土間床等の外周部の長さ (m) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 床下に面した玄関等の土間床等の外周部の長さ (m) """ return get_table_3(36, house_insulation_type, floor_bath_insulation) def get_L_dash_prm_bath_OS_0(house_insulation_type, floor_bath_insulation): """主開口方向から時計回りに0°の方向の外気に面した浴室の土間床等の外周部の長さ (m) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 主開口方向から時計回りに0°の方向の外気に面した浴室の土間床等の外周部の長さ (m) """ return get_table_3(37, house_insulation_type, floor_bath_insulation) def get_L_dash_prm_bath_OS_90(house_insulation_type, floor_bath_insulation): """主開口方向から時計回りに90°の方向の外気に面した浴室の土間床等の外周部の長さ (m) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 主開口方向から時計回りに90°の方向の外気に面した浴室の土間床等の外周部の長さ (m) """ return get_table_3(38, house_insulation_type, floor_bath_insulation) def get_L_dash_prm_bath_OS_180(house_insulation_type, floor_bath_insulation): """主開口方向から時計回りに180°の方向の外気に面した浴室の土間床等の外周部の長さ (m) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 主開口方向から時計回りに180°の方向の外気に面した浴室の土間床等の外周部の長さ (m) """ return get_table_3(39, house_insulation_type, floor_bath_insulation) def get_L_dash_prm_bath_OS_270(house_insulation_type, floor_bath_insulation): """主開口方向から時計回りに270°の方向の外気に面した浴室の土間床等の外周部の長さ (m) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 主開口方向から時計回りに270°の方向の外気に面した浴室の土間床等の外周部の長さ (m) """ return get_table_3(40, house_insulation_type, floor_bath_insulation) def get_L_dash_prm_bath_IS(house_insulation_type, floor_bath_insulation): """床下に面した浴室の土間床等の外周部の長さ (m) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 床下に面した浴室の土間床等の外周部の長さ (m) """ return get_table_3(41, house_insulation_type, floor_bath_insulation) def get_L_dash_prm_other_OS_0(house_insulation_type, floor_bath_insulation): """主開口方向から時計回りに0°の方向の外気に面したその他の土間床等の外周部の長さ (m) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 主開口方向から時計回りに0°の方向の外気に面したその他の土間床等の外周部の長さ (m) """ return get_table_3(42, house_insulation_type, floor_bath_insulation) def get_L_dash_prm_other_OS_90(house_insulation_type, floor_bath_insulation): """主開口方向から時計回りに90°の方向の外気に面したその他の土間床等の外周部の長さ (m) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 主開口方向から時計回りに90°の方向の外気に面したその他の土間床等の外周部の長さ (m) """ return get_table_3(43, house_insulation_type, floor_bath_insulation) def get_L_dash_prm_other_OS_180(house_insulation_type, floor_bath_insulation): """主開口方向から時計回りに180°の方向の外気に面したその他の土間床等の外周部の長さ (m) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 主開口方向から時計回りに180°の方向の外気に面したその他の土間床等の外周部の長さ (m) """ return get_table_3(44, house_insulation_type, floor_bath_insulation) def get_L_dash_prm_other_OS_270(house_insulation_type, floor_bath_insulation): """主開口方向から時計回りに270°の方向の外気に面したその他の土間床等の外周部の長さ (m) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 主開口方向から時計回りに270°の方向の外気に面したその他の土間床等の外周部の長さ (m) """ return get_table_3(45, house_insulation_type, floor_bath_insulation) def get_L_dash_prm_other_IS(house_insulation_type, floor_bath_insulation): """床下に面したその他の土間床等の外周部の長さ (m) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 床下に面したその他の土間床等の外周部の長さ (m) """ return get_table_3(46, house_insulation_type, floor_bath_insulation) def get_L_dash_HB_roof_top(): """上面に面した屋根又は天井の熱橋の長さ (m) Args: Returns: float: 上面に面した屋根又は天井の熱橋の長さ (m) """ return get_table_3(47, None) def get_L_dash_HB_wall_0(): """主開口方向から時計回りに0°の方向の外気に面した壁の熱橋の長さ (m) Args: Returns: float: 主開口方向から時計回りに0°の方向の外気に面した壁の熱橋の長さ (m) """ return get_table_3(48, None) def get_L_dash_HB_wall_90(): """主開口方向から時計回りに90°の方向の外気に面した壁の熱橋の長さ (m) Args: Returns: float: 主開口方向から時計回りに90°の方向の外気に面した壁の熱橋の長さ (m) """ return get_table_3(49, None) def get_L_dash_HB_wall_180(): """主開口方向から時計回りに180°の方向の外気に面した壁の熱橋の長さ (m) Args: Returns: float: 主開口方向から時計回りに180°の方向の外気に面した壁の熱橋の長さ (m) """ return get_table_3(50, None) def get_L_dash_HB_wall_270(): """主開口方向から時計回りに270°の方向の外気に面した壁の熱橋の長さ (m) Args: Returns: float: 主開口方向から時計回りに270°の方向の外気に面した壁の熱橋の長さ (m) """ return get_table_3(51, None) def get_L_dash_HB_floor_IS(house_insulation_type, floor_bath_insulation): """床下に面した床の熱橋の長さ (m) Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 床断熱住戸'または'基礎断熱住戸'または'浴室の床及び基礎が外気等に面していない' Returns: float: 床下に面した床の熱橋の長さ (m) """ return get_table_3(52, house_insulation_type, floor_bath_insulation) def get_L_dash_HB_roof_wall_top(): """上面に面した屋根又は天井と壁の熱橋長さ (m) Args: Returns: float: 面に面した屋根又は天井と壁の熱橋長さ (m) """ return get_table_3(53, None) def get_L_dash_HB_roof_wall_top_0(): """主開口方向から時計回りに0°の方向の外気に面した屋根又は天井と壁の熱橋長さ (m) Args: Returns: float: 主開口方向から時計回りに0°の方向の外気に面した屋根又は天井と壁の熱橋長さ (m) """ return get_table_3(53, None) def get_L_dash_HB_roof_wall_top_90(): """主開口方向から時計回りに90°の方向の外気に面した屋根又は天井と壁の熱橋長さ (m) Args: Returns: float: 主開口方向から時計回りに90°の方向の外気に面した屋根又は天井と壁の熱橋長さ (m) """ return get_table_3(54, None) def get_L_dash_HB_roof_wall_top_180(): """主開口方向から時計回りに180°の方向の外気に面した屋根又は天井と壁の熱橋長さ (m) Args: Returns: float: 主開口方向から時計回りに180°の方向の外気に面した屋根又は天井と壁の熱橋長さ (m) """ return get_table_3(55, None) def get_L_dash_HB_roof_wall_top_270(): """主開口方向から時計回りに270°の方向の外気に面した屋根又は天井と壁の熱橋長さ (m) Args: Returns: float: 主開口方向から時計回りに270°の方向の外気に面した屋根又は天井と壁の熱橋長さ (m) """ return get_table_3(56, None) def get_L_dash_HB_wall_wall_0_90(): """主開口方向から時計回りに0°の方向の外気に面した壁と壁の熱橋長さ (m) Args: Returns: float: 主開口方向から時計回りに0°の方向の外気に面した壁と壁の熱橋長さ (m) """ return get_table_3(57, None) def get_L_dash_HB_wall_wall_90_180(): """主開口方向から時計回りに90°の方向の外気に面した壁と壁の熱橋長さ (m) Args: Returns: float: 主開口方向から時計回りに90°の方向の外気に面した屋壁と壁の熱橋長さ (m) """ return get_table_3(58, None) def get_L_dash_HB_wall_wall_180_270(): """主開口方向から時計回りに180°の方向の外気に面した壁と壁の熱橋長さ (m) Args: Returns: float: 主開口方向から時計回りに180°の方向の外気に面した壁と壁の熱橋長さ (m) """ return get_table_3(59, None) def get_L_dash_HB_wall_wall_270_0(): """主開口方向から時計回りに270°の方向の外気に面した壁と壁の熱橋長さ (m) Args: Returns: float: 主開口方向から時計回りに270°の方向の外気に面した壁と壁の熱橋長さ (m) """ return get_table_3(60, None) def get_L_dash_HB_wall_floor_0_IS(): """主開口方向から時計回りに0°の方向の外気に面した壁と床の熱橋長さ (m) Args: Returns: float: 主開口方向から時計回りに0°の方向の外気に面した壁と床の熱橋長さ (m) """ return get_table_3(61, None) def get_L_dash_HB_wall_floor_90_IS(): """主開口方向から時計回りに90°の方向の外気に面した壁と床の熱橋長さ (m) Args: Returns: float: 主開口方向から時計回りに90°の方向の外気に面した壁と床の熱橋長さ (m) """ return get_table_3(62, None) def get_L_dash_HB_wall_floor_180_IS(): """主開口方向から時計回りに180°の方向の外気に面した壁と床の熱橋長さ (m) Args: Returns: float: 主開口方向から時計回りに180°の方向の外気に面した壁と床の熱橋長さ (m) """ return get_table_3(63, None) def get_L_dash_HB_wall_floor_270_IS(): """主開口方向から時計回りに270°の方向の外気に面した壁と床の熱橋長さ (m) Args: Returns: float: 主開口方向から時計回りに270°の方向の外気に面した壁と床の熱橋長さ (m) """ return get_table_3(64, None) # ============================================================================ # 9.7 外皮の部位及び熱橋等の温度差係数 # ============================================================================ def get_H_OS(): """屋根又は天井の温度差係数 (-) Args: Returns: float: 屋根又は天井の温度差係数 (-) """ adjacent_type = '外気' return get_H(adjacent_type) def get_H_IS(): """壁の温度差係数 (-) Args: Returns: float: 壁の温度差係数 (-) """ adjacent_type = '外気に通じていない空間・外気に通じる床裏' return get_H(adjacent_type) # ============================================================================ # 9.8 外皮の部位及び熱橋等の方位係数 # ============================================================================ # 標準住戸における外皮の部位及び熱橋等の方位係数は、地域の区分・方位・期間に応じて付録Cに定める方法により求めた値とする。 # ============================================================================ # 9.9 外皮の部位の熱貫流率及び熱橋等の線熱貫流率 # ============================================================================ def get_U(house_insulation_type, house_structure_type, floor_bath_insulation=None, bath_insulation_type=None, U_roof=None, U_wall=None, U_door=None, U_window=None, U_floor_bath=None, U_floor_other=None, U_base_etrc=None, U_base_bath=None, U_base_other=None, Psi_prm_etrc=None, Psi_prm_bath=None, Psi_prm_other=None, Psi_HB_roof=None, Psi_HB_wall=None, Psi_HB_floor=None, Psi_HB_roof_wall=None, Psi_HB_wall_wall=None, Psi_HB_wall_floor=None): """屋根又は天井・壁・ドア・窓・熱橋等の熱貫流率 Args: house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' house_structure_type(structure_type: structure_type: str): 木造'または'鉄筋コンクリート造'または'鉄骨造' floor_bath_insulation(str, optional): 浴室床の断熱 (Default value = None) bath_insulation_type(str, optional): 浴室の断熱タイプ※ (Default value = None) U_roof(float, optional): 屋根又は天井の熱貫流率 (Default value = None) U_wall(float, optional): 壁の熱貫流率 (Default value = None) U_door(float, optional): ドアの熱貫流率 (Default value = None) U_window(float, optional): 窓の熱貫流率 (Default value = None) U_floor_bath(float, optional): 浴室の床の熱貫流率 (Default value = None) U_floor_other(float, optional): その他の熱貫流率 (Default value = None) Psi_prm_etrc(float, optional): 玄関等の土間床等の外周部の線熱貫流率 (Default value = None) Psi_prm_bath(float, optional): 浴室の土間床等の外周部の線熱貫流率 (Default value = None) Psi_prm_other(float, optional): その他の土間床等の外周部の線熱貫流率 (Default value = None) Psi_HB_roof(float, optional): 屋根または天井の熱橋の線熱貫流率 (Default value = None) Psi_HB_wall(float, optional): 壁の熱橋の線熱貫流率 (Default value = None) Psi_HB_floor(float, optional): 床の熱橋の線熱貫流率 (Default value = None) Psi_HB_roof_wall(float, optional): 屋根または天井と壁の熱橋の線熱貫流率 (Default value = None) Psi_HB_wall_wall(float, optional): 壁と壁の熱橋の線熱貫流率 (Default value = None) Psi_HB_wall_floor(float, optional): 壁と床の熱橋の線熱貫流率 (Default value = None) U_base_etrc: Default value = None) U_base_bath: Default value = None) U_base_other: Default value = None) Returns: dict: 屋根又は天井・壁・ドア・窓・熱橋等の熱貫流率 """ # 屋根又は天井・壁・ドア・窓の熱貫流率 if house_insulation_type == '床断熱住戸': # 浴室の断熱構造 if floor_bath_insulation == '床断熱': U_floor_bath = get_U_floor_bath( U_floor_bath=U_floor_bath, U_floor_other=U_floor_other, house_insulation_type=house_insulation_type, floor_bath_insulation='浴室部分の外皮を床とする' ) Psi_prm_etrc = get_psi_prm_etrc(Psi_prm_etrc) Psi_prm_bath = 0 U_base_bath = 0 elif floor_bath_insulation == '基礎断熱': U_floor_bath = 0 Psi_prm_etrc = get_psi_prm_etrc(Psi_prm_etrc) Psi_prm_bath = get_psi_prm_bath(Psi_prm_bath, Psi_prm_other, house_insulation_type) U_base_bath = get_U_base_bath(U_base_bath, U_base_other, house_insulation_type, floor_bath_insulation) elif floor_bath_insulation == '浴室の床及び基礎が外気等に面していない': U_floor_bath = get_U_floor_bath( U_floor_bath=U_floor_bath, U_floor_other=U_floor_other, house_insulation_type=house_insulation_type, floor_bath_insulation=floor_bath_insulation ) Psi_prm_etrc = get_psi_prm_etrc(Psi_prm_etrc) Psi_prm_bath = 0 U_base_bath = 0 else: raise ValueError(floor_bath_insulation) U_roof = get_U_roof(U_roof) U_wall = get_U_wall(U_wall) U_door = get_U_door(U_door) U_window = get_U_window(U_window) U_floor_other = get_U_floor_other(U_floor_other) U_base_etrc = get_U_base_etrc(U_base_etrc) U_base_other = 0 Psi_prm_other = 0 elif house_insulation_type == '基礎断熱住戸': U_roof = get_U_roof(U_roof) U_wall = get_U_wall(U_wall) U_door = get_U_door(U_door) U_window = get_U_window(U_window) U_floor_bath = 0 U_floor_other = 0 U_base_etrc = get_U_base_etrc(U_base_etrc) U_base_bath = get_U_base_bath(U_base_bath, U_base_other, house_insulation_type, floor_bath_insulation) U_base_bath = get_U_base_bath(U_base_bath, U_base_other, house_insulation_type, floor_bath_insulation) U_base_other = get_U_base_other(U_base_other) Psi_prm_etrc = get_psi_prm_etrc(Psi_prm_etrc) Psi_prm_bath = get_psi_prm_bath( psi_prm_bath=Psi_prm_bath, phi_prm_other=Psi_prm_other, house_insulation_type=house_insulation_type ) Psi_prm_other = get_psi_prm_other(Psi_prm_other, house_insulation_type) else: raise ValueError(house_insulation_type) # 熱橋 Psi_HB_roof = get_psi_HB_roof(Psi_HB_roof, house_structure_type) Psi_HB_wall = get_psi_HB_wall(Psi_HB_wall, house_structure_type) Psi_HB_floor = get_psi_HB_floor(Psi_HB_floor, house_structure_type) Psi_HB_roof_wall = get_psi_HB_roof_wall(Psi_HB_roof_wall, house_structure_type) Psi_HB_wall_wall = get_psi_HB_wall_wall(Psi_HB_wall_wall, house_structure_type) Psi_HB_wall_floor = get_psi_HB_wall_floor(Psi_HB_wall_floor, house_structure_type) return { 'house_insulation_type': house_insulation_type, 'floor_bath_insulation': floor_bath_insulation, 'U_roof': U_roof, 'U_door': U_door, 'U_wall': U_wall, 'U_window': U_window, 'U_floor_bath': U_floor_bath, 'U_floor_other': U_floor_other, 'U_base_etrc': U_base_etrc, 'U_base_bath': U_base_bath, 'U_base_other': U_base_other, 'Psi_prm_etrc': Psi_prm_etrc, 'Psi_prm_bath': Psi_prm_bath, 'Psi_prm_other': Psi_prm_other, 'Psi_HB_roof': Psi_HB_roof, 'Psi_HB_wall': Psi_HB_wall, 'Psi_HB_floor': Psi_HB_floor, 'Psi_HB_roof_wall': Psi_HB_roof_wall, 'Psi_HB_wall_wall': Psi_HB_wall_wall, 'Psi_HB_wall_floor': Psi_HB_wall_floor, } def get_U_roof(U_roof, H_roof=None): """9.9.1 屋根又は天井の熱貫流率 Args: U_roof(float): 屋根又は天井の熱貫流率 H_roof(float, optional): 屋根又は天井の温度差係数 (Default value = None) Returns: float: 9屋根又は天井の熱貫流率 """ if type(U_roof) in [list, tuple]: return U_roof[np.argmax(np.array(U_roof) * np.array(H_roof))] else: return U_roof def get_U_wall(U_wall, H_wall=None): """9.9.2 壁の熱貫流率 Args: U_wall(float): 壁の熱貫流率 H_wall(float, optional): 壁の温度差係数 (Default value = None) Returns: float: 壁の熱貫流率 """ if type(U_wall) in [list, tuple]: return U_wall[np.argmax(np.array(U_wall) * np.array(H_wall))] else: return U_wall def get_U_door(U_door, H_door=None): """9.9.3 ドアの熱貫流率 Args: U_door(float): ドアの熱貫流率 H_door(float, optional): ドアの温度差係数 (Default value = None) Returns: float: ドアの熱貫流率 """ if type(U_door) in [list, tuple]: return U_door[np.argmax(np.array(U_door) * np.array(H_door))] else: return U_door def get_U_window(U_window, H_window=None): """9.9.4 窓の熱貫流率 Args: U_window(float): 窓の熱貫流率 H_window(float, optional): 窓の温度差係数 (Default value = None) Returns: float: 窓の熱貫流率 """ if type(U_window) in [list, tuple]: return U_window[np.argmax(np.array(U_window) * np.array(H_window))] else: return U_window def get_U_floor_other(U_floor_other, H_floor_other=None): """9.9.5 その他の床の熱貫流率 Args: U_floor_other(float): その他の床の熱貫流率 H_floor_other(float, optional): その他の床の温度差係数 (Default value = None) Returns: float: その他の床の熱貫流率 """ if type(U_floor_other) in [list, tuple]: return U_floor_other[np.argmax(np.array(U_floor_other) * np.array(H_floor_other))] else: return U_floor_other def get_U_floor_bath(U_floor_bath, U_floor_other, house_insulation_type, floor_bath_insulation, H_floor_bath=None): """9.9.6 浴室の床の熱貫流率 Args: U_floor_bath(float): 浴室の床の熱貫流率 U_floor_other(float): その他の熱貫流率 house_insulation_type(str): 床断熱住戸'または'基礎断熱住戸' floor_bath_insulation(str): 浴室床の断熱 H_floor_bath(float, optional): 浴室の床の温度差係数 (Default value = None) Returns: float: 浴室の床の熱貫流率 """ if house_insulation_type == '床断熱住戸': if floor_bath_insulation == '浴室部分の外皮を床とする': if type(U_floor_bath) in [list, tuple]: return U_floor_bath[np.argmax(np.array(U_floor_bath) *
np.array(H_floor_bath)
numpy.array
# coding: utf-8 # # Table of Contents # <p><div class="lev2 toc-item"><a href="#过程逻辑" data-toc-modified-id="过程逻辑-01"><span class="toc-item-num">0.1&nbsp;&nbsp;</span>过程逻辑</a></div> # In[153]: import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns get_ipython().magic('matplotlib inline') import numpy_indexed as npi from sklearn.datasets.samples_generator import make_blobs from itertools import combinations,permutations # In[154]: def vdm(cols,clu): m_u = np.unique(cols,return_counts=True) vdm_value = np.zeros(len(list(combinations(m_u[0],2)))) for k in np.unique(clu): m_ui = np.unique(cols[np.where(clu == k)],return_counts=True) m_ui0,m_ui1 = m_ui array_diff = np.setdiff1d(m_u[0],m_ui[0]) print(array_diff) m_ui1 = np.append(m_ui1,[0]*len(array_diff)) m_ui0 = np.append(m_ui0,array_diff) print(m_ui0,m_ui1,) s_mui = sorted(zip(m_ui0,m_ui1),key=lambda x:x[0]) s_mui1 = np.array([y for x,y in s_mui]) clu_rate = zip(m_u[0],s_mui1/m_u[1]) clu_sq = [np.square(c[0][1]-c[1][1]) for c in combinations(clu_rate,2)] print(clu_sq) vdm_value += np.array(clu_sq) print(vdm_value) ret = dict(zip(combinations(m_u[0],2),vdm_value)) return ret # In[155]: class Kmean: def __init__(self,k,iter_num): self.k = k self.iter_num = iter_num def get_init_vector(self,X): distance,max_cores = 0,'' for i in combinations(X,self.k): npt = np.array(list(combinations(i,2))) ret = np.sqrt(np.square(npt[:,0] - npt[:,1]).sum(axis=1)).sum() if ret > distance: distance,max_cores = ret,i return np.array(max_cores) def train(self,X): init_vetor = avg_vector = self.get_init_vector(X) get_nearcore = lambda x:np.argmin(
np.square(avg_vector - x)
numpy.square
''' /** * © Copyright (C) 2016-2020 Xilinx, Inc * * Licensed under the Apache License, Version 2.0 (the "License"). You may * not use this file except in compliance with the License. A copy of the * License is located at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ ''' # Author: <EMAIL> # Date: 11 Feb 2020 import os import numpy as np import cv2 import sys ############################################################################### # project folders ############################################################################### def get_script_directory(): path = os.getcwd() return path # get current directory SCRIPT_DIR = get_script_directory() print("fcn_config.py runs from ", SCRIPT_DIR) # dataset top level folder DATASET_DIR = os.path.join(SCRIPT_DIR, "../workspace/dataset1") # train, validation, test and calibration folders SEG_TRAIN_DIR = os.path.join(DATASET_DIR, "annotations_prepped_train") IMG_TRAIN_DIR = os.path.join(DATASET_DIR, "images_prepped_train") SEG_TEST_DIR = os.path.join(DATASET_DIR, "annotations_prepped_test") IMG_TEST_DIR = os.path.join(DATASET_DIR, "images_prepped_test") # input directories dir_data = DATASET_DIR dir_train_seg_inp = SEG_TRAIN_DIR dir_train_img_inp = IMG_TRAIN_DIR dir_test_seg_inp = SEG_TEST_DIR dir_test_img_inp = IMG_TEST_DIR # output directories dir_train_img = os.path.join(DATASET_DIR, "img_train") dir_train_seg = os.path.join(DATASET_DIR, "seg_train") dir_test_img = os.path.join(DATASET_DIR, "img_test") dir_test_seg = os.path.join(DATASET_DIR, "seg_test") dir_calib_img = os.path.join(DATASET_DIR, "img_calib") dir_calib_seg = os.path.join(DATASET_DIR, "seg_calib") dir_valid_img = os.path.join(DATASET_DIR, "img_valid") dir_valid_seg = os.path.join(DATASET_DIR, "seg_valid") # Augmented images folder #AUG_IMG_DIR = os.path.join(SCRIPT_DIR,'aug_img/cifar10') # Keras model folder KERAS_MODEL_DIR = os.path.join(SCRIPT_DIR, "../keras_model") # TF checkpoints folder CHKPT_MODEL_DIR = os.path.join(SCRIPT_DIR, "../workspace/tf_chkpts") # TensorBoard folder TB_LOG_DIR = os.path.join(SCRIPT_DIR, "../workspace/tb_logs") ############################################################################### # global variables ############################################################################### #Size of images WIDTH = 224 HEIGHT = 224 #normalization factor NORM_FACTOR = 127.5 #number of classes NUM_CLASSES = 12 # names of classes CLASS_NAMES = ("Sky", "Wall", "Pole", "Road", "Sidewalk", "Vegetation", "Sign", "Fence", "vehicle", "Pedestrian", "Bicyclist", "miscellanea") BATCH_SIZE = 32 EPOCHS = 200 ####################################################################################################### # colors for segmented (COCO) classes colorB = [128, 232, 70, 156, 153, 153, 30, 0, 35, 152, 180, 60, 0, 142, 70, 100, 100, 230, 32] colorG = [ 64, 35, 70, 102, 153, 153, 170, 220, 142, 251, 130, 20, 0, 0, 0, 60, 80, 0, 11] colorR = [128, 244, 70, 102, 190, 153, 250, 220, 107, 152, 70, 220, 255, 0, 0, 0, 0, 0, 119] CLASS_COLOR = list() for i in range(0, 19): CLASS_COLOR.append([colorR[i], colorG[i], colorB[i]]) COLORS =
np.array(CLASS_COLOR, dtype="float32")
numpy.array
import json import numpy as np import scipy.stats as st import pickle import matplotlib import matplotlib.pyplot as plt from matplotlib import gridspec matplotlib.use('TkAgg') print(matplotlib.get_configdir()) if __name__ == '__main__': nodes = 6 number_test = 0 # fr = open('./emulator/MIMII/saxsNew.pkl', 'rb') # saxs = pickle.load(fr) # ss, aa, xx = saxs # s = ss[number_test] # x = xx[number_test] path_csv = 'measurement/pICA_'+str(nodes)+'details.csv' node_details = np.loadtxt(path_csv, delimiter=',', usecols=np.arange( 1, nodes+2, 1)) len_subset = node_details[0,:] process_latency = node_details[1,:] separation_accuracy = node_details[2, :] with plt.style.context(['science', 'ieee']): fig_width = 6.5 barwidth = 0.15 # bardistance = barwidth * 1.2 colordict = { 'compute_forward': '#0077BB', 'store_forward': '#DDAA33', 'darkblue': '#024B7A', 'lightblue': '#3F9ABF', 'midblue': '#7ACFE5' } markerdict = { 'compute_forward': 'o', 'store_forward': 'v', 'store_forward_ia': 's' } plt.rcParams.update({'font.size': 11}) fig = plt.figure(figsize=(fig_width, fig_width / 1.618)) ax = fig.add_subplot(1, 1, 1) ax.yaxis.grid(True, linestyle='--', which='major', color='lightgrey', alpha=0.5, linewidth=0.2) x_index =
np.arange(nodes + 1)
numpy.arange
import numpy import h5py import pympi from mpi4py import MPI comm = MPI.COMM_WORLD rank = comm.Get_rank() size = comm.Get_size() bias, grid_size, box_size, bin_size, bins_to_use = (1.3, 2048, 1600.0, 30, 5) density_file, momentumx_file, momentumy_file, momentumz_file = () deltagk_file, deltamk_file, deltavk_file = () num_particle, box_size, grid_size = (4096**3, 1600.0, 2048) mpi = pympi.snapshot(num_particle=num_particle, box_size=box_size, grid_size=grid_size, comm=comm) bins_large = numpy.linspace(4e-3, 4e-2, 5+1) bins_small = numpy.linspace(1.0, 2.0, 5+1) lsize = bins_large.size - 1 ssize = bins_small.size - 1 bins_large_size = lsize bins_small_size = ssize kfreq = numpy.fft.fftfreq(mpi.grid_size, mpi.grid_spacing) * numpy.pi * 2 kfreq = kfreq.astype(numpy.float64) kx = numpy.empty((mpi.grids_per_core, mpi.grid_size, mpi.grid_size), dtype=numpy.float64) ky = numpy.empty((mpi.grids_per_core, mpi.grid_size, mpi.grid_size), dtype=numpy.float64) kz = numpy.empty((mpi.grids_per_core, mpi.grid_size, mpi.grid_size), dtype=numpy.float64) for i in range(mpi.grids_per_core): for j in range(mpi.grid_size): for k in range(mpi.grid_size): kz[i,j,k] = kfreq[k] ky[i,j,k] = kfreq[j] kx[i,j,k] = kfreq[mpi.start_grid + i] knorm = numpy.sqrt(kx**2 + ky**2 + kz**2) if rank == 0: knorm[0,0,0] = 0.00001 def transfer(data): recvdata = None senddata = numpy.concatenate( (numpy.ravel(data.real), numpy.ravel(data.imag) )) if rank == 0: recvdata = numpy.empty(size * len(senddata), dtype=numpy.float64) comm.Gather(senddata, recvdata, root=0) if rank == 0: d = recvdata.reshape(size, len(senddata)).sum(0) d_list = numpy.split(d, 2) data_real, data_imag = [ numpy.reshape( x, (bins_large_size, bins_small_size)) for x in alpha_list] result = data_real + 1j * data_imag return result ############################################################################################################### alpha_mnn = numpy.zeros((bins_large_size, bins_small_size), dtype=numpy.complex128) alpha_nmn = numpy.zeros((bins_large_size, bins_small_size), dtype=numpy.complex128) alpha_final = numpy.zeros((bins_large_size, bins_small_size), dtype=numpy.complex128) alpha_final_inv = numpy.zeros((bins_large_size, bins_small_size), dtype=numpy.complex128) for n in xrange(ssize): W_nu = numpy.logical_and(knorm > bins_small[n], knorm <= bins_small[n+1]).astype(numpy.int16) function1 = mpi.ifft(W_nu) function3 = mpi.ifft(function1 * function1) for m in xrange(lsize): W_mu = numpy.logical_and(knorm > bins_large[m], knorm <= bins_large[m+1]).astype(numpy.int16) alpha_mnn[m,n] = numpy.sum(function3 * W_mu * knorm**2) function2 = mpi.ifft(W_nu * knorm**2) function3 = mpi.ifft(function1 * function2) for m in xrange(lsize): W_mu = numpy.logical_and(knorm > bins_large[m], knorm <= bins_large[m+1]).astype(numpy.int16) alpha_nmn[m,n] = numpy.sum(function3 * W_mu) alpha_final = transfer(alpha_mnn) alpha_final_inv = transfer(alpha_nmn) gamma_x_mnn = numpy.zeros((bins_large.size-1,bins_small.size-1), dtype=numpy.complex128) gamma_y_mnn = numpy.zeros((bins_large.size-1,bins_small.size-1), dtype=numpy.complex128) gamma_z_mnn = numpy.zeros((bins_large.size-1,bins_small.size-1), dtype=numpy.complex128) gamma_mnn = numpy.zeros((bins_large.size-1,bins_small.size-1), dtype=numpy.complex128) gamma_final = numpy.zeros((bins_large.size-1,bins_small.size-1), dtype=numpy.complex128) for n in xrange(ssize): W_nu = numpy.logical_and(knorm > bins_small[n], knorm <= bins_small[n+1]).astype(numpy.int16) function1 = mpi.ifft(W_nu) function2x = mpi.ifft(W_nu * kx) function2y = mpi.ifft(W_nu * ky) function2z = mpi.ifft(W_nu * kz) productx = mpi.ifft(function1 * function2x) producty = mpi.ifft(function1 * function2y) productz = mpi.ifft(function1 * function2z) for m in xrange(lsize): W_mu = numpy.logical_and(knorm > bins_large[m], knorm <= bins_large[m+1]).astype(numpy.int16) gamma_x_mnn[m,n] = numpy.sum(kx * W_mu * productx) gamma_y_mnn[m,n] = numpy.sum(ky * W_mu * producty) gamma_z_mnn[m,n] = numpy.sum(kz * W_mu * productz) gamma_mnn = gamma_x_mnn + gamma_y_mnn + gamma_z_mnn gamma_final = transfer(gamma_mnn) ######################################################################################################### B_x_mnn = numpy.zeros((lsize,ssize), dtype=numpy.complex128) B_y_mnn = numpy.zeros((lsize,ssize), dtype=numpy.complex128) B_z_mnn = numpy.zeros((lsize,ssize), dtype=numpy.complex128) B_mnn = numpy.zeros((lsize,ssize), dtype=numpy.complex128) B_x_nmn = numpy.zeros((lsize, ssize), dtype=numpy.complex128) B_y_nmn = numpy.zeros((lsize, ssize), dtype=numpy.complex128) B_z_nmn = numpy.zeros((lsize, ssize), dtype=numpy.complex128) B_nmn = numpy.zeros((lsize, ssize), dtype=numpy.complex128) B_final = numpy.zeros((lsize, ssize), dtype=numpy.complex128) B_final_inv = numpy.zeros((lsize,ssize), dtype=numpy.complex128) density_k = h5py.File(deltagk_file, "r+")['d'][mpi.start_grid:mpi.end_grid,:,:] momentum_kx = h5py.File(momentumx_file, "r+")['d'][mpi.start_grid:mpi.end_grid, :, :] momentum_ky = h5py.File(momentumy_file, "r+")['d'][mpi.start_grid:mpi.end_grid, :, :] momentum_kz = h5py.File(momentumz_file, "r+")['d'][mpi.start_grid:mpi.end_grid, :, :] ############################################################################################################### for n in xrange(ssize): W_nu = numpy.logical_and(knorm > bins_small[n], knorm <= bins_small[n+1]).astype(numpy.int16) function1 = mpi.ifft(W_nu * density_k) function2 = mpi.ifft(W_nu * momentum_kx) product = mpi.ifft(function1 * function2) for m in xrange(lsize): W_mu = numpy.logical_and(knorm > bins_large[m], knorm <= bins_large[m+1]).astype(numpy.int16) B_x_mnn[m,n] = numpy.sum(1j * kx * W_mu * density_k * product) function1 = mpi.ifft(1j * kx * W_nu * density_k) product = mpi.ifft(function1 * function2) for m in xrange(lsize): W_mu = numpy.logical_and(knorm > bins_large[m], knorm <= bins_large[m+1]).astype(numpy.int16) B_x_nmn[m,n] = numpy.sum(W_mu * density_k * product) ############################################################################################################### for n in xrange(ssize): W_nu = numpy.logical_and(knorm > bins_small[n], knorm <= bins_small[n+1]).astype(numpy.int16) function1 = mpi.ifft(W_nu * density_k) function2 = mpi.ifft(W_nu * momentum_ky) product = mpi.ifft(function1 * function2) for m in xrange(lsize): W_mu = numpy.logical_and(knorm > bins_large[m], knorm <= bins_large[m+1]).astype(numpy.int16) B_y_mnn[m,n] = numpy.sum(1j * ky * W_mu * density_k * product) function1 = mpi.ifft(1j * ky * W_nu * density_k) product = mpi.ifft(function1 * function2) for m in xrange(lsize): W_mu = numpy.logical_and(knorm > bins_large[m], knorm <= bins_large[m+1]).astype(numpy.int16) B_y_nmn[m,n] = numpy.sum(W_mu * density_k * product) ############################################################################################################### for n in xrange(ssize): W_nu = numpy.logical_and(knorm > bins_small[n], knorm <= bins_small[n+1]).astype(numpy.int16) function1 = mpi.ifft(W_nu * density_k) function2 = mpi.ifft(W_nu * momentum_kz) product = mpi.ifft(function1 * function2) for m in xrange(lsize): W_mu =
numpy.logical_and(knorm > bins_large[m], knorm <= bins_large[m+1])
numpy.logical_and
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import time from typing import Callable, Optional, Any import numpy as np from ..common.typetools import ArrayLike from ..common import testing from . import recaster from . import optimizerlib def test_message() -> None: message = recaster.Message(1, 2, blublu=3) np.testing.assert_equal(message.done, False) np.testing.assert_equal(message.args, [1, 2]) np.testing.assert_equal(message.kwargs, {"blublu": 3}) message.result = 3 np.testing.assert_equal(message.done, True) np.testing.assert_equal(message.result, 3) def fake_caller(func: Callable[[int], int]) -> int: output = 0 for k in range(10): output += func(k) return output @testing.parametrized( finished=(10, 30), unfinished=(2, None), # should not hang at deletion! ) def test_messaging_thread(num_iter: int, output: Optional[int]) -> None: thread = recaster.MessagingThread(fake_caller) num_answers = 0 while num_answers < num_iter: if thread.messages and not thread.messages[0].done: thread.messages[0].result = 3 num_answers += 1 time.sleep(0.001) with testing.skip_error_on_systems(AssertionError, systems=("Windows",)): # TODO fix np.testing.assert_equal(thread.output, output) def test_automatic_thread_deletion() -> None: thread = recaster.MessagingThread(fake_caller) assert thread.is_alive() def fake_cost_function(x: ArrayLike) -> float: return float(np.sum(np.array(x) ** 2)) class FakeOptimizer(recaster.SequentialRecastOptimizer): def get_optimization_function(self) -> Callable[[Callable[..., Any]], ArrayLike]: # create a new instance to avoid deadlock return self.__class__(self.parametrization, self.budget, self.num_workers)._optim_function def _optim_function(self, func: Callable[..., Any]) -> ArrayLike: suboptim = optimizerlib.OnePlusOne(parametrization=2, budget=self.budget) recom = suboptim.minimize(func) return recom.get_standardized_data(reference=self.parametrization) def test_recast_optimizer() -> None: optimizer = FakeOptimizer(parametrization=2, budget=100) optimizer.minimize(fake_cost_function) assert optimizer._messaging_thread is not None np.testing.assert_equal(optimizer._messaging_thread._thread.call_count, 100) def test_recast_optimizer_with_error() -> None: optimizer = FakeOptimizer(parametrization=2, budget=100)
np.testing.assert_raises(TypeError, optimizer.minimize)
numpy.testing.assert_raises
# -*- coding: utf-8 -*- """ Created on Mon Jun 29 16:41:56 2020 @author: <NAME> """ """ Apply different deep learning models on PAMAP2 dataset. ANN,CNN and RNN were applied. """ import numpy as np import matplotlib.pyplot as plt import tensorflow as tf import h5py from tensorflow.keras import regularizers from tensorflow.keras.layers import ( Input, Conv2D, Dense, Flatten, Dropout, LSTM, GlobalMaxPooling1D, MaxPooling2D, BatchNormalization, ) from tensorflow.keras.models import Model from tensorflow.keras.optimizers import Adam from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix import itertools from datetime import datetime import os class Models: def __init__(self, path): self.path = path self.model_name = None self.X = None self.y = None self.x_train = None self.x_test = None self.y_train = None self.y_test = None def read_h5(self): file = h5py.File(path, "r") X = file.get("inputs") y = file.get("labels") # print(type(X)) # print(type(y)) self.X = np.array(X) self.y = np.array(y) self.x_train, self.x_test, self.y_train, self.y_test = train_test_split( self.X, self.y, test_size=0.4, random_state=1 ) print("X = ", self.X.shape) print("y =", self.y.shape) print(set(self.y)) # return X,y def cnn_model(self, n_epochs=50): # K = len(set(y_train)) # print(K) K = len(set(self.y)) # X = np.expand_dims(X, -1) self.x_train = np.expand_dims(self.x_train, -1) self.x_test = np.expand_dims(self.x_test, -1) # print(X) # print(X[0].shape) # i = Input(shape=X[0].shape) i = Input(shape=self.x_train[0].shape) x = Conv2D( 32, (3, 3), strides=2, activation="relu", padding="same", kernel_regularizer=regularizers.l2(0.0005), )(i) x = BatchNormalization()(x) x = MaxPooling2D((2, 2))(x) x = Dropout(0.2)(x) x = Conv2D( 64, (3, 3), strides=2, activation="relu", padding="same", kernel_regularizer=regularizers.l2(0.0005), )(x) x = BatchNormalization()(x) x = Dropout(0.4)(x) x = Conv2D( 128, (3, 3), strides=2, activation="relu", padding="same", kernel_regularizer=regularizers.l2(0.0005), )(x) x = BatchNormalization()(x) x = MaxPooling2D((2, 2))(x) x = Dropout(0.2)(x) x = Flatten()(x) x = Dropout(0.2)(x) x = Dense(1024, activation="relu")(x) x = Dropout(0.2)(x) x = Dense(K, activation="softmax")(x) self.model = Model(i, x) self.model.compile( optimizer=Adam(lr=0.001), loss="sparse_categorical_crossentropy", metrics=["accuracy"], ) # self.r = model.fit(X, y, validation_split = 0.4, epochs = 50, batch_size = 32 ) self.r = self.model.fit( self.x_train, self.y_train, validation_data=(self.x_test, self.y_test), epochs=n_epochs, batch_size=32, ) print(self.model.summary()) # It is better than using keras do the splitting!! return self.r def dnn_model(self): # K = len(set(y_train)) # print(K) K = len(set(self.y)) print(self.x_train[0].shape) i = Input(shape=self.x_train[0].shape) x = Flatten()(i) x = Dense(128, activation="relu")(x) x = Dense(128, activation="relu")(x) x = Dropout(0.2)(x) x = Dense(256, activation="relu")(x) x = Dense(256, activation="relu")(x) x = Dense(256, activation="relu")(x) # x = Dropout(0.2)(x) x = Dense(1024, activation="relu")(x) x = Dense(K, activation="softmax")(x) self.model = Model(i, x) self.model.compile( optimizer=Adam(lr=0.001), loss="sparse_categorical_crossentropy", metrics=["accuracy"], ) """ K = len(set(self.y)) model = tf.keras.models.Sequential([ tf.keras.layers.Flatten(input_shape=self.x_train[0].shape), tf.keras.layers.Dense(256, activation = 'relu'), tf.keras.layers.Dropout(0.5), tf.keras.layers.Dense(256, activation = 'relu'), tf.keras.layers.Dropout(0.2), tf.keras.layers.Dense(K,activation = 'softmax') ]) model.compile(optimizer = Adam(lr=0.0005), loss = 'sparse_categorical_crossentropy', metrics = ['accuracy']) """ self.r = self.model.fit( self.x_train, self.y_train, validation_data=(self.x_test, self.y_test), epochs=50, ) print(self.model.summary()) return self.r def rnn_model(self): K = len(set(self.y)) i = Input(shape=self.x_train[0].shape) x = LSTM(256, return_sequences=True)(i) x = Dense(128, activation="relu")(x) x = GlobalMaxPooling1D()(x) x = Dense(K, activation="softmax")(x) self.model = Model(i, x) self.model.compile( optimizer=Adam(lr=0.001), loss="sparse_categorical_crossentropy", metrics=["accuracy"], ) self.r = self.model.fit( self.x_train, self.y_train, validation_data=(self.x_test, self.y_test), epochs=50, batch_size=32, ) # self.r = model.fit(X, y, validation_split = 0.2, epochs = 10, batch_size = 32 ) print(self.model.summary()) return self.r def draw(self, path_to_model_folder): f1 = plt.figure(1) plt.title("Loss") plt.plot(self.r.history["loss"], label="loss") plt.plot(self.r.history["val_loss"], label="val_loss") plt.legend() f1.show() # new: doesnt work (also not with plt) - no line in the chart # f1.savefig(path_to_model_folder + '/training_loss.png') f2 = plt.figure(2) plt.plot(self.r.history["accuracy"], label="accuracy") plt.plot(self.r.history["val_accuracy"], label="val_accuracy") plt.legend() f2.show() # new: doesnt work (also not with plt) - no line in the chart # f2.savefig(path_to_model_folder + '/training_acc.png') # summary, confusion matrix and heatmap def evaluation(self, model_folder_path): K = len(set(self.y_train)) self.y_pred = self.model.predict(self.x_test).argmax(axis=1) # accuracy accuracy =
np.sum(self.y_pred == self.y_test)
numpy.sum
# coding=utf-8 # Copyright (c) 2019 Alibaba PAI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import six from easytransfer.engines.distribution import Process import numpy as np class LabelingPostprocessor(Process): """ Postprocessor for sequence labeling, merge the sub-tokens and output the tag for each word """ def __init__(self, label_enumerate_values, output_schema, thread_num=None, input_queue=None, output_queue=None, prediction_colname="predictions", job_name='LabelingPostprocessor'): super(LabelingPostprocessor, self).__init__( job_name, thread_num, input_queue, output_queue, batch_size=1) self.prediction_colname = prediction_colname self.label_enumerate_values = label_enumerate_values self.output_schema = output_schema if label_enumerate_values is not None: self.idx_label_map = dict() for (i, label) in enumerate(label_enumerate_values.split(",")): if six.PY2: self.idx_label_map[i] = label.encode("utf8") else: self.idx_label_map[i] = label def process(self, in_data): """ Post-process the model outputs Args: in_data (`dict`): a dict of model outputs Returns: ret (`dict`): a dict of post-processed model outputs """ if self.label_enumerate_values is None: return in_data tmp = {key: val for key, val in in_data.items()} if self.prediction_colname in tmp: raw_preds = tmp[self.prediction_colname] tok_to_orig_indexes = [[int(t) for t in lst.split(",")] for lst in tmp["tok_to_orig_index"][0][0].split(" ")] new_preds = [] for idx, (raw_pred, tok_to_orig_index) in enumerate(zip(raw_preds, tok_to_orig_indexes)): final_pred = list() prev_token_idx = -1 for k in range(min(len(raw_pred), len(tok_to_orig_index))): token_pred = raw_pred[k] token_orig_idx = tok_to_orig_index[k] if token_orig_idx == -1: continue if token_orig_idx == prev_token_idx: continue if token_pred == -1 or token_pred > len(self.idx_label_map): token_pred = len(self.idx_label_map) - 1 if self.idx_label_map[token_pred] == "[CLS]" or self.idx_label_map[token_pred] == "[SEP]": token_pred = len(self.idx_label_map) - 1 final_pred.append(self.idx_label_map[token_pred]) prev_token_idx = token_orig_idx raw_sequence_length = max(tok_to_orig_index) + 1 while len(final_pred) < raw_sequence_length: final_pred.append(self.idx_label_map[len(self.idx_label_map) - 1]) new_preds.append(" ".join(final_pred)) tmp[self.prediction_colname] =
np.array(new_preds)
numpy.array
import matplotlib.pyplot as plt import numpy.random as npr import numpy as np import tensorflow as tf import pickle as cPickle from sklearn.manifold import TSNE def one_hot(x,n): if type(x) == list: x = np.array(x) x = x.flatten() o_h = np.zeros((len(x),n)) o_h[np.arange(len(x)),x] = 1 return o_h def computeTSNE(fileName='./for_tsne.pkl'): with open(fileName,'r') as f: fx, src_fx, src_labels, trg_fx, adda_trg_fx, trg_labels = cPickle.load(f) src_labels = np.argmax(src_labels,1) trg_labels = np.argmax(trg_labels,1) print ('Computing T-SNE.') model = TSNE(n_components=2, random_state=0) print ('0') TSNE_hA_0 = model.fit_transform(np.vstack((src_fx,fx))) #~ print '1' #~ TSNE_hA_1 = model.fit_transform(fx) #~ print '2' #~ TSNE_hA_2 = model.fit_transform(src_fx) print ('3') TSNE_hA_3 = model.fit_transform(np.vstack((src_fx,fx,trg_fx))) print ('4') TSNE_hA_4 = model.fit_transform(np.vstack((src_fx,fx,adda_trg_fx))) plt.figure(0) plt.scatter(TSNE_hA_0[:,0], TSNE_hA_0[:,1], c = np.hstack((src_labels,src_labels))) plt.figure(1) plt.scatter(TSNE_hA_0[:,0], TSNE_hA_0[:,1], c = np.hstack((np.ones((500,)), 2 * np.ones((500,))))) #~ plt.figure(2) #~ plt.scatter(TSNE_hA_1[:,0], TSNE_hA_1[:,1], c = colors_12) #~ plt.figure(3) #~ plt.scatter(TSNE_hA_2[:,0], TSNE_hA_2[:,1], c = colors_12) plt.figure(4) plt.scatter(TSNE_hA_3[:,0], TSNE_hA_3[:,1], c = np.hstack((np.ones((500,)), 2 * np.ones((500,)), 3 * np.ones((500,))))) plt.figure(5) plt.scatter(TSNE_hA_3[:,0], TSNE_hA_3[:,1], c = np.hstack((src_labels,src_labels,trg_labels))) plt.figure(6) plt.scatter(TSNE_hA_4[:,0], TSNE_hA_4[:,1], c = np.hstack((np.ones((500,)), 2 *
np.ones((500,))
numpy.ones
import numpy as np import Activators # 引入自定义的激活器模块 import math # 获取卷积区域。input_array为单通道或多通道的矩阵顺。i为横向偏移,j为纵向偏移,stride为步幅,filter_width为过滤器宽度,filter_height为过滤器的高度 def get_patch(input_array, i, j, filter_width, filter_height, stride): ''' 从输入数组中获取本次卷积的区域, 自动适配输入为2D和3D的情况 ''' start_i = i * stride start_j = j * stride if input_array.ndim == 2: # 如果只有一个通道 return input_array[start_i:start_i + filter_height, start_j: start_j + filter_width] elif input_array.ndim == 3: # 如果有多个通道,也就是深度上全选 return input_array[:, start_i: start_i + filter_height, start_j: start_j + filter_width] # [深度、高度、宽度] # 获取一个2D区域的最大值所在的索引 def get_max_index(array): location = np.where(array == np.max(array)) # 获取最大值的位置where return location[0], location[1] # 计算一个过滤器的卷积运算,输出一个二维数据。每个通道的输入是图片,但是可能不是一个通道,所以这里自动适配输入为2D和3D的情况。 def conv(input_array, kernel_array, output_array, stride, bias): output_width = output_array.shape[1] # 获取输出的宽度。一个过滤器产生的输出一定是一个通道 output_height = output_array.shape[0] # 获取输出的高度 kernel_width = kernel_array.shape[-1] # 过滤器的宽度。有可能有多个通道。多通道时shape=[深度、高度、宽度],单通道时shape=[高度、宽度] kernel_height = kernel_array.shape[-2] # 过滤器的高度。有可能有多个通道。多通道时shape=[深度、高度、宽度],单通道时shape=[高度、宽度] # print(output_width,output_height,kernel_width,kernel_height) for i in range(output_height): for j in range(output_width): juanjiqu = get_patch(input_array, i, j, kernel_width, kernel_height, stride) # 获取输入的卷积区。(单通道或多通道) # 这里是对每个通道的两个矩阵对应元素相乘求和,再将每个通道的和值求和 kernel_values = ( np.multiply(juanjiqu, kernel_array)).sum() # 卷积区与过滤器卷积运算。1,一个通道内,卷积区矩阵与过滤器矩阵对应点相乘后,求和值。2、将每个通道的和值再求和。 output_array[i][j] = kernel_values + bias # 将卷积结果加上偏量 def conv1(input_array, kernel_array, output_array, stride, bias): output_width = output_array.shape[1] # 获取输出的宽度。一个过滤器产生的输出一定是一个通道 output_height = output_array.shape[0] # 获取输出的高度 kernel_width = kernel_array.shape[-1] # 过滤器的宽度。有可能有多个通道。多通道时shape=[深度、高度、宽度],单通道时shape=[高度、宽度] kernel_height = kernel_array.shape[-2] # 过滤器的高度。有可能有多个通道。多通道时shape=[深度、高度、宽度],单通道时shape=[高度、宽度] # print(output_width,output_height,kernel_width,kernel_height) for i in range(output_height): for j in range(output_width): juanjiqu = get_patch(input_array, i, j, kernel_width, kernel_height, stride) # 获取输入的卷积区。(单通道或多通道) # 这里是对每个通道的两个矩阵对应元素相乘求和,再将每个通道的和值求和 kernel_values = ( np.multiply(juanjiqu, kernel_array)).sum() # 卷积区与过滤器卷积运算。1,一个通道内,卷积区矩阵与过滤器矩阵对应点相乘后,求和值。2、将每个通道的和值再求和。 output_array[i][j] = kernel_values + bias # 将卷积结果加上偏量 return output_array # 为数组增加Zero padding。zp步长,自动适配输入为2D和3D的情况 def padding(input_array, zp): if zp == 0: # 如果不补0 return input_array else: if input_array.ndim == 3: # 如果输入有多个通道 input_width = input_array.shape[2] # 获取输入的宽度 input_height = input_array.shape[1] # 获取输入的宽度 input_depth = input_array.shape[0] # 获取输入的深度 padded_array = np.zeros((input_depth, input_height + 2 * zp, input_width + 2 * zp)) # 先定义一个补0后大小的全0矩阵 # print(input_height) # 8 # print(padded_array.shape[2]) padded_array[:, zp: zp + input_height, zp: zp + input_width] = input_array # 每个通道上,将中间部分替换成输入,这样就变成了原矩阵周围补0 的形式 return padded_array # 12*16*16 elif input_array.ndim == 2: # 如果输入只有一个通道 input_width = input_array.shape[1] # 获取输入的宽度 input_height = input_array.shape[0] # 虎丘输入的高度 padded_array = np.zeros((input_height + 2 * zp, input_width + 2 * zp)) # 先定义一个补0后大小的全0矩阵 padded_array[zp: zp + input_height, zp: zp + input_width] = input_array # 将中间部分替换成输入,这样就变成了原矩阵周围补0 的形式 return padded_array # 对numpy数组进行逐个元素的操作。op为函数。element_wise_op函数实现了对numpy数组进行按元素操作,并将返回值写回到数组中 def element_wise_op(array, op): for i in
np.nditer(array, op_flags=['readwrite'])
numpy.nditer
""" Max-p regions algorithm Source: <NAME>, <NAME>, and <NAME> (2020) "Efficient regionalization for spatially explicit neighborhood delineation." International Journal of Geographical Information Science. Accepted 2020-04-12. """ from ..BaseClass import BaseSpOptHeuristicSolver from .base import (w_to_g, move_ok, ok_moves, region_neighbors, _centroid, _closest, _seeds, is_neighbor) import matplotlib.pyplot as plt from scipy.spatial.distance import pdist, squareform import pandas as pd import geopandas as gp import time import numpy as np from copy import deepcopy from scipy.sparse.csgraph import connected_components ITERCONSTRUCT=999 ITERSA=10 def maxp(gdf, w, attrs_name, threshold_name, threshold, top_n, max_iterations_construction=ITERCONSTRUCT, max_iterations_sa=ITERSA, verbose=True): """ Arguments --------- gdf: geodataframe w: pysal W attrs_name: list of strings for attribute names (cols of gdf) threshold_name: string (name of threshold variable) threshold: numeric value for threshold top_n: int Max number of candidate regions for enclave assignment max_iterations_construction: int max number of iterations for construction phase max_iterations_SA: int max number of iterations for customized simulated annealing verbose: boolean True Returns ------- max_p: int number of regions labels: array region ids for observations """ attr = gdf[attrs_name].values threshold_array = gdf[threshold_name].values distance_matrix = squareform(pdist(attr, metric='cityblock')) n,k = attr.shape arr = np.arange(n) max_p, rl_list = construction_phase(arr, attr, threshold_array, distance_matrix, w, threshold, top_n, max_iterations_construction) if verbose: print("max_p: ", max_p) print('number of good partitions:', len(rl_list)) alpha = 0.998 tabuLength = 10 max_no_move = attr.size best_obj_value = np.inf best_label = None best_fn = None best_sa_time = np.inf for irl, rl in enumerate(rl_list): label, regionList, regionSpatialAttr = rl if verbose: print(irl) for saiter in range(max_iterations_sa): sa_start_time = time.time() finalLabel, finalRegionList, finalRegionSpatialAttr = performSA( label, regionList, regionSpatialAttr, threshold_array, w, distance_matrix, threshold, alpha, tabuLength, max_no_move) sa_end_time = time.time() totalWithinRegionDistance = calculateWithinRegionDistance( finalRegionList, distance_matrix) if verbose: print("totalWithinRegionDistance after SA: ") print(totalWithinRegionDistance) if totalWithinRegionDistance < best_obj_value: best_obj_value = totalWithinRegionDistance best_label = finalLabel best_fn = irl best_sa_time = sa_end_time - sa_start_time if verbose: print("best objective value:") print(best_obj_value) return max_p, best_label def construction_phase(arr, attr, threshold_array, distance_matrix, weight, spatialThre, random_assign_choice, max_it=999): labels_list = [] pv_list = [] max_p = 0 maxp_labels = None maxp_regionList = None maxp_regionSpatialAttr = None for _ in range(max_it): labels = [0] * len(threshold_array) C = 0 regionSpatialAttr = {} enclave = [] regionList = {} np.random.shuffle(arr) labeledID = [] for arr_index in range(0, len(threshold_array)): P = arr[arr_index] if not (labels[P] == 0): continue NeighborPolys = deepcopy(weight.neighbors[P]) if len(NeighborPolys) < 0: labels[P] = -1 else: C += 1 labeledID, spatialAttrTotal = growClusterForPoly( labels, threshold_array, P, NeighborPolys, C, weight, spatialThre) print('spatialAttrTotal, LabelID ', (spatialAttrTotal, labeledID)) if spatialAttrTotal < spatialThre: enclave.extend(labeledID) else: regionList[C] = labeledID regionSpatialAttr[C] = spatialAttrTotal num_regions = len(regionList) for i, l in enumerate(labels): if l == -1: enclave.append(i) if num_regions < max_p: continue else: max_p = num_regions maxp_labels, maxp_regionList, maxp_regionSpatialAttr = assignEnclave( enclave, labels, regionList, regionSpatialAttr, threshold_array, weight, distance_matrix, random_assign=random_assign_choice) pv_list.append(max_p) labels_list.append( [maxp_labels, maxp_regionList, maxp_regionSpatialAttr]) realLabelsList = [] realmaxpv = max(pv_list) for ipv, pv in enumerate(pv_list): if pv == realmaxpv: realLabelsList.append(labels_list[ipv]) return [realmaxpv, realLabelsList] def growClusterForPoly(labels, threshold_array, P, NeighborPolys, C, weight, spatialThre): labels[P] = C labeledID = [P] spatialAttrTotal = threshold_array[P] i = 0 while i < len(NeighborPolys): if spatialAttrTotal >= spatialThre: break Pn = NeighborPolys[i] if labels[Pn] == 0: labels[Pn] = C labeledID.append(Pn) spatialAttrTotal += threshold_array[Pn] if spatialAttrTotal < spatialThre: PnNeighborPolys = weight.neighbors[Pn] for pnn in PnNeighborPolys: if not pnn in NeighborPolys: NeighborPolys.append(pnn) i += 1 return labeledID, spatialAttrTotal def assignEnclave(enclave, labels, regionList, regionSpatialAttr, threshold_array, weight, distance_matrix, random_assign=1): enclave_index = 0 while len(enclave) > 0: ec = enclave[enclave_index] ecNeighbors = weight.neighbors[ec] minDistance = np.Inf assignedRegion = 0 ecNeighborsList = [] ecTopNeighborsList = [] for ecn in ecNeighbors: if ecn in enclave: continue rm = np.array(regionList[labels[ecn]]) totalDistance = distance_matrix[ec, rm].sum() ecNeighborsList.append((ecn, totalDistance)) ecNeighborsList = sorted(ecNeighborsList, key=lambda tup: tup[1]) top_num = min([len(ecNeighborsList), random_assign]) if top_num > 0: ecn_index = np.random.randint(top_num) assignedRegion = labels[ecNeighborsList[ecn_index][0]] if assignedRegion == 0: enclave_index += 1 else: labels[ec] = assignedRegion regionList[assignedRegion].append(ec) regionSpatialAttr[assignedRegion] += threshold_array[ec] del enclave[enclave_index] enclave_index = 0 return [ deepcopy(labels), deepcopy(regionList), deepcopy(regionSpatialAttr) ] def calculateWithinRegionDistance(regionList, distance_matrix): totalWithinRegionDistance = 0 for k, v in regionList.items(): nv = np.array(v) regionDistance = distance_matrix[nv, :][:, nv].sum() / 2 totalWithinRegionDistance += regionDistance return totalWithinRegionDistance def pickMoveArea(labels, regionLists, regionSpatialAttrs, threshold_array, weight, distance_matrix, threshold): potentialAreas = [] labels_array = np.array(labels) for k, v in regionSpatialAttrs.items(): rla = np.array(regionLists[k]) rasa = threshold_array[rla] lostSA = v - rasa pas_indices = np.where(lostSA > threshold)[0] if pas_indices.size > 0: for pasi in pas_indices: leftAreas = np.delete(rla, pasi) ws = weight.sparse cc = connected_components(ws[leftAreas, :][:, leftAreas]) if cc[0] == 1: potentialAreas.append(rla[pasi]) else: continue return potentialAreas def checkMove(poa, labels, regionLists, threshold_array, weight, distance_matrix, threshold): poaNeighbor = weight.neighbors[poa] donorRegion = labels[poa] rm = np.array(regionLists[donorRegion]) lostDistance = distance_matrix[poa, rm].sum() potentialMove = None minAddedDistance = np.Inf for poan in poaNeighbor: recipientRegion = labels[poan] if donorRegion != recipientRegion: rm =
np.array(regionLists[recipientRegion])
numpy.array
#!/usr/bin/env python import sys from datetime import datetime, timedelta import numpy as np import requests import json from lxml import html GOOD_RESPONSE = '✅' BAD_RESPONSE = '❌' POOR_RESPONSE = '🔴' NO_RESPONSE = '⚪' EXCEPTIONAL_RESPONSE = '🔵' WARNING_RESPONSE = '⚠️' print_console = True print_pdf = False dns_trt_thresholds = { 'fail': 120, 'warn': 50 } diff_hours = 24 # Hours to look back at pan_service_dict = { "Prisma Access": 'q8kbg3n63tmp', "Prisma Cloud Management": "61lhr4ly5h9b", "Prisma Cloud": '1nvndw0xz3nd', "Prisma SaaS": 'f0q7vkhppsgw', } # we will be using slack blocks for this response in place of text. def blocks_section(wanted_text): return { "type": "section", "text": { "type": "mrkdwn", "text": wanted_text } } def blocks_divider(): return { "type": "divider" } def pBold(str_to_print): return '*' + str_to_print + '*' def pFail(str_to_print): return str_to_print + " " + POOR_RESPONSE def pPass(str_to_print): return str_to_print + " " + GOOD_RESPONSE def pWarn(str_to_print): return str_to_print + " " + WARNING_RESPONSE def pExceptional(str_to_print): return str_to_print + " " + EXCEPTIONAL_RESPONSE def pUnderline(str_to_print): return '_' + str_to_print + '_' def dns_trt_classifier(dns_trt_time): if dns_trt_time > dns_trt_thresholds['fail']: return pFail(str(dns_trt_time)) elif dns_trt_time > dns_trt_thresholds['warn']: return pWarn(str(dns_trt_time)) else: return pPass(str(dns_trt_time)) def metric_classifier(value, expected, error_percentage_as_decimal, warn_percentage_as_decimal=0.05): if value < (expected - (expected * error_percentage_as_decimal)): return pFail(str(value)) elif value >= expected + (expected * error_percentage_as_decimal * 2): return pExceptional(str(value)) elif value >= expected - (expected * warn_percentage_as_decimal): return pPass(str(value)) else: return pWarn(str(value)) class dbbox: dl = u'\u255a' ul = u'\u2554' dc = u'\u2569' uc = u'\u2566' lc = u'\u2560' u = u'\u2550' c = u'\u256c' l = u'\u2551' P1 = "P1" H1 = "H1" H2 = "H2" B1 = "B1" B2 = "B2" END_SECTION = "END_SECTION" def vprint(text, style="B1", buffer=None): if buffer is None: buffer = [] if print_console: if text == "END_SECTION": buffer.append(blocks_divider()) buffer.append(blocks_section(" ")) elif style == "P1": buffer.append(blocks_divider()) buffer.append(blocks_section(pBold(text))) buffer.append(blocks_divider()) elif style == "H1": buffer.append(blocks_divider()) buffer.append(blocks_section(pBold(text))) buffer.append(blocks_divider()) elif style == "H2": buffer.append(blocks_divider()) buffer.append(blocks_section(pBold(text))) buffer.append(blocks_divider()) elif style == "B1": buffer.append(blocks_section(text)) elif style == "B2": buffer.append(blocks_section("• " + text)) return buffer elif print_pdf == True: return None else: return None def getpanstatus(webcontent, str_service): services_list = webcontent.xpath('//*[@data-component-id="' + str_service + '"]/span') if (len(services_list) == 4): service_status = (services_list[2].text).lstrip().rstrip() else: service_status = (services_list[1].text).lstrip().rstrip() return service_status def site_health_header(site_id, sdk, idname): sites_id2n = idname.generate_sites_map() vpnpaths_id2n = idname.generate_anynets_map() site_count = 0 search_ratio = 0 site_name = sites_id2n.get(site_id) # Output queue for slack blocks. blocks = [] vprint("Health Check for SITE: " + pUnderline(pBold(site_name)) + " SITE ID: " + pBold(site_id), B1, buffer=blocks) # vprint(END_SECTION, buffer=blocks) # Check if elements are online site_elements = [] element_count = 0 resp = sdk.get.elements() if resp.cgx_status: vprint("ION Status for site", H1, buffer=blocks) element_list = resp.cgx_content.get("items", None) # EVENT_LIST contains an list of all returned events if len(element_list) >= 0: for element in element_list: # Loop through each EVENT in the EVENT_LIST if element['site_id'] == site_id: element_count += 1 site_elements.append(element['id']) # if element_count > 1: # print(dbbox.l) output_buffer = "ION found NAME: " + pBold(str(element['name'])) + " ION ID: " + \ pBold(str(element['id'])) if element['connected'] is True: output_buffer += "\n ION Status: " + pPass("CONNECTED") else: output_buffer += "\n ION Status: " + pFail("OFFLINE (!!!)") vprint(output_buffer, B1, buffer=blocks) if element_count == 0: vprint("ION Status: " + pBold("No IONS for site found"), B1, buffer=blocks) vprint(END_SECTION, buffer=blocks) # give back the slack message. return blocks def site_health_alarms(site_id, sdk, idname): # Output queue for slack blocks. blocks = [] ################### ALARMS ################### ### Get last 5 ALARMS for last diff_hours hours dt_now = str(datetime.now().isoformat()) dt_start = str((datetime.today() - timedelta(hours=diff_hours)).isoformat()) dt_yesterday = str((datetime.today() - timedelta(hours=48)).isoformat()) event_filter = '{"limit":{"count":5,"sort_on":"time","sort_order":"descending"},"view":{"summary":false},' \ '"severity":[],"query":{"site":["' + site_id + \ '"],"category":[],"code":[],"correlation_id":[],"type":["alarm"]}, ' \ '"start_time": "' + dt_start + '", "end_time": "' + dt_now + '"}' resp = sdk.post.events_query(event_filter) if resp.cgx_status: vprint("Last 5 Alarms for site within the past " + str(diff_hours) + " hours", H1, buffer=blocks) alarms_list = resp.cgx_content.get("items", None) if len(alarms_list) == 0: vprint("No Alarms found in the past " + str(diff_hours) + " hours", B1, buffer=blocks) else: for alarm in alarms_list: vprint("ALARM: " + str(alarm['code']), B1, buffer=blocks) vprint("Acknowledged: " + str(alarm['cleared']), B2, buffer=blocks) if alarm['severity'] == "minor": vprint("Severity : " + pWarn(str(alarm['severity'])), B2, buffer=blocks) elif alarm['severity'] == "major": vprint("Severity : " + pFail(str(alarm['severity'])), B2, buffer=blocks) else: vprint("Severity : " + str(alarm['severity']), B2, buffer=blocks) vprint("Timestamp : " + str(alarm['time']), B2, buffer=blocks) else: vprint(pFail("ERROR in SCRIPT. Could not get ALARMS"), B1, buffer=blocks) ### Get SUMMARY ALARMS for last diff_hours hours alarm_summary_dict = {} event_filter = '{"limit":{"count":1000,"sort_on":"time","sort_order":"descending"},"view":{"summary":false},' \ '"severity":[],"query":{"site":["' + site_id + \ '"],"category":[],"code":[],"correlation_id":[],"type":["alarm"]}, "start_time": "' + dt_start + \ '", "end_time": "' + dt_now + '"}' resp = sdk.post.events_query(event_filter) if resp.cgx_status: vprint("Alarm Summaries for the past " + pUnderline(str(diff_hours)) + pBold(" hours"), H2, buffer=blocks) alarms_list = resp.cgx_content.get("items", None) if len(alarms_list) > 0: for alarm in alarms_list: if alarm['code'] in alarm_summary_dict.keys(): alarm_summary_dict[alarm['code']] += 1 else: alarm_summary_dict[alarm['code']] = 1 for alarm_code in alarm_summary_dict.keys(): vprint("CODE: " + str(alarm_code), B1, buffer=blocks) vprint("TOTAL Count: " + pUnderline(str(alarm_summary_dict[alarm_code])), B2, buffer=blocks) else: vprint("No Alarm summaries", B1, buffer=blocks) else: vprint(pFail("ERROR in SCRIPT. Could not get ALARMS"), B1, buffer=blocks) vprint(END_SECTION, buffer=blocks) # give back the slack message. return blocks def site_health_alerts(site_id, sdk, idname): # Output queue for slack blocks. blocks = [] dt_now = str(datetime.now().isoformat()) dt_start = str((datetime.today() - timedelta(hours=diff_hours)).isoformat()) dt_yesterday = str((datetime.today() - timedelta(hours=48)).isoformat()) ################### ALERTS ################### ### Get last 5 ALERTS for last diff_hours hours event_filter = '{"limit":{"count":5,"sort_on":"time","sort_order":"descending"},"view":{"summary":false},' \ '"severity":[],"query":{"site":["' + site_id + \ '"],"category":[],"code":[],"correlation_id":[],"type":["alert"]}, "start_time": "' + dt_start + \ '", "end_time": "' + dt_now + '"}' resp = sdk.post.events_query(event_filter) if resp.cgx_status: vprint("Last 5 Alerts for site within the past " + str(diff_hours) + " hours", H1, buffer=blocks) alerts_list = resp.cgx_content.get("items", None) if len(alerts_list) == 0: vprint("No Alerts found", B1, buffer=blocks) else: for alert in alerts_list: vprint("ALERT CODE: " + pBold(str(alert['code'])), B1, buffer=blocks) if 'reason' in alert['info'].keys(): vprint("REASON : " + str(alert['info']['reason']), B2, buffer=blocks) if 'process_name' in alert['info'].keys(): vprint("PROCESS : " + str(alert['info']['process_name']), B2, buffer=blocks) if 'detail' in alert['info'].keys(): vprint("DETAIL : " + str(alert['info']['detail']), B2, buffer=blocks) if alert['severity'] == "minor": vprint("SEVERITY : " + pWarn(str(alert['severity'])), B2, buffer=blocks) elif alert['severity'] == "major": vprint("SEVERITY : " + pFail(str(alert['severity'])), B2, buffer=blocks) else: vprint("SEVERITY : " + (str(alert['severity'])), B2, buffer=blocks) vprint("TIMESTAMP : " + str(alert['time']), B2, buffer=blocks) else: vprint("ERROR in SCRIPT. Could not get Alerts", buffer=blocks) ### Get ALERTS summary for last diff_hours hours alert_summary_dict = {} event_filter = '{"limit":{"count":1000,"sort_on":"time","sort_order":"descending"},"view":{"summary":false},' \ '"severity":[],"query":{"site":["' + site_id + \ '"],"category":[],"code":[],"correlation_id":[],"type":["alert"]}, ' \ '"start_time": "' + dt_start + '", "end_time": "' + dt_now + '"}' resp = sdk.post.events_query(event_filter) if resp.cgx_status: vprint("Alert Summaries for the past " + pUnderline(str(diff_hours)) + pBold(" hours"), H1, buffer=blocks) alerts_list = resp.cgx_content.get("items", None) if len(alerts_list) > 0: for alert in alerts_list: if alert['code'] in alert_summary_dict.keys(): alert_summary_dict[alert['code']] += 1 else: alert_summary_dict[alert['code']] = 1 for alert_code in alert_summary_dict.keys(): vprint("CODE: " + str(alert_code), B1, buffer=blocks) vprint("TOTAL Count: " + pUnderline(str(alert_summary_dict[alert_code])), B2, buffer=blocks) else: vprint("No Alarm summaries", B1, buffer=blocks) else: vprint(pFail("ERROR in SCRIPT. Could not get Alerts"), B1, buffer=blocks) vprint(END_SECTION, buffer=blocks) # give back the slack message. return blocks def site_health_links(site_id, sdk, idname): sites_id2n = idname.generate_sites_map() vpnpaths_id2n = idname.generate_anynets_map() site_count = 0 search_ratio = 0 site_name = sites_id2n.get(site_id) dt_now = str(datetime.now().isoformat()) dt_start = str((datetime.today() - timedelta(hours=diff_hours)).isoformat()) dt_yesterday = str((datetime.today() - timedelta(hours=48)).isoformat()) # Output queue for slack blocks. blocks1 = [] blocks2 = [] blocks3 = [] elements_id_to_name = idname.generate_elements_map() site_id_to_name = idname.generate_sites_map() wan_label_id_to_name = idname.generate_waninterfacelabels_map() wan_if_id_to_name = idname.generate_waninterfaces_map() wan_interfaces_resp = sdk.get.waninterfaces(site_id) wan_interfaces_list = wan_interfaces_resp.cgx_content.get("items") ### GET LINKS status (VPN/PHYS) topology_filter = '{"type":"basenet","nodes":["' + site_id + '"]}' resp = sdk.post.topology(topology_filter) if resp.cgx_status: topology_list = resp.cgx_content.get("links", None) vprint("VPN STATUS", H1, buffer=blocks1) vpn_count = 0 output_buffer = "" for links in topology_list: if (links['type'] == 'vpn') and links['source_site_name'] == site_name: if vpn_count > 0: output_buffer += '\n' vpn_count += 1 # print(dbbox.l + format(vpnpaths_id_to_name.get(links['path_id'], links['path_id']))) output_buffer += f"VPN {vpn_count}-> SITE:{site_name} " \ f"[ION:{elements_id_to_name[links['source_node_id']]}] ---> " \ f"{wan_if_id_to_name[links['source_wan_if_id']]}:{links['source_wan_network']} " \ f"{dbbox.u * 3}{dbbox.c}{dbbox.u * 3} {links['target_wan_network']}:" \ f"{wan_if_id_to_name[links['target_wan_if_id']]} <--- [" \ f"{elements_id_to_name[links['target_node_id']]}] {links['target_site_name']}" if links['status'] == "up": output_buffer += "\n STATUS: " + pPass("UP") else: output_buffer += "\n STATUS: " + pFail("DOWN") # flush the buffer if vpn_count == 0: vprint("No SDWAN VPN links found at site", B1, buffer=blocks1) else: # got links vprint(output_buffer, B1, buffer=blocks1) vprint(END_SECTION, buffer=blocks1) pcm_metrics_array_up = [] pcm_metrics_array_down = [] vprint("PHYSICAL LINK STATUS", P1, buffer=blocks2) stub_count = 0 for links in topology_list: if links['type'] == 'internet-stub': stub_count += 1 if 'target_circuit_name' in links.keys(): vprint("Physical LINK: " + pBold(str(links['network'])) + ":" + pUnderline( str(links['target_circuit_name'])), H1, buffer=blocks2) else: vprint("Physical LINK: " + pBold(str(links['network'])), H1, buffer=blocks2) output_buffer = "" if links['status'] == "up": output_buffer += " STATUS: " + pPass("UP") elif links['status'] == "init": output_buffer += " STATUS: " + pWarn("INIT") else: output_buffer += " STATUS: " + pFail("DOWN") ###PCM BANDWIDTH CAPACITY MEASUREMENTS pcm_request = '{"start_time":"' + dt_start + 'Z","end_time":"' + dt_now + \ 'Z","interval":"5min","view":{"summary":false,"individual":"direction"},' \ '"filter":{"site":["' + site_id + '"],"path":["' + \ links['path_id'] + '"]},"metrics":[{"name":"PathCapacity","statistics":["average"],' \ '"unit":"Mbps"}]}' pcm_resp = sdk.post.metrics_monitor(pcm_request) pcm_metrics_array_up.clear() pcm_metrics_array_down.clear() measurements_up = 0 measurements_down = 0 z_count_down = 0 z_count_up = 0 if pcm_resp.cgx_status: # stop error with default value direction = "Upload" pcm_metric = pcm_resp.cgx_content.get("metrics", None)[0]['series'] if pcm_metric[0]['view']['direction'] == 'Ingress': direction = "Download" for series in pcm_metric: if direction == "Download": for datapoint in series['data'][0]['datapoints']: if datapoint['value'] is None: # pcm_metrics_array_down.append(0) z_count_down += 1 else: pcm_metrics_array_down.append(datapoint['value']) measurements_down += 1 direction = 'Upload' else: for datapoint in series['data'][0]['datapoints']: if datapoint['value'] is None: # pcm_metrics_array_up.append(0) z_count_up += 1 else: pcm_metrics_array_up.append(datapoint['value']) measurements_up += 1 direction = 'Download' output_buffer += "\nConfigured Bandwidth/Throughput for the site:" # Initialize in case no match, no exception upload = None download = None for wan_int in wan_interfaces_list: if wan_int['id'] == links['path_id']: upload = wan_int['link_bw_up'] download = wan_int['link_bw_down'] output_buffer += "\nMaximum BW Download : " + str(wan_int['link_bw_down']) output_buffer += "\nMaximum BW Upload : " + str(wan_int['link_bw_up']) error_percentage = 0.1 warn_percentage = 0.05 output_buffer += "\nMeasured Link Capacity (PCM) STATS for the last 24 hours" \ "\nTHRESHOLDS: " + pFail("") + \ ">=" + (str(error_percentage * 100)) + \ "% | " + pWarn("") + \ ">=" + (str(warn_percentage * 100)) + \ "% | " + pPass("") + \ "=Within " + (str(warn_percentage * 100)) + \ "% | " + pExceptional("") + \ "=" + (str(error_percentage * 100 * 2)) + \ "% Above expected" output_buffer += "Upload - Calculated from " + str(measurements_up) + \ " Measurements in the past 24 Hours in mbits" if len(pcm_metrics_array_up) == 0: pcm_metrics_array_up.append(0) if len(pcm_metrics_array_down) == 0: pcm_metrics_array_down.append(0) np_array = np.array(pcm_metrics_array_up) # vprint("Zeros:" + str(z_count_up), B1) output_buffer += "\n25th percentile : " \ "" + metric_classifier(round(np.percentile(np_array, 25), 3), upload, error_percentage, warn_percentage) output_buffer += "\n50th Percentile(AVG) : " \ "" + metric_classifier(round(np.average(np_array), 3), upload, error_percentage, warn_percentage) output_buffer += "\n75th percentile : " \ "" + metric_classifier(round(np.percentile(np_array, 75), 3), upload, error_percentage, warn_percentage) output_buffer += "\n95th percentile : " \ "" + metric_classifier(round(np.percentile(np_array, 95), 3), upload, error_percentage, warn_percentage) output_buffer += "\nMax Value : " \ "" + metric_classifier(round(np.amax(np_array), 3), upload, error_percentage, warn_percentage) output_buffer += "\nDownload - Calculated from " + str(measurements_up) + \ " Measurements in the past 24 Hours" np_array = np.array(pcm_metrics_array_down) # vprint("Zeros:" + str(z_count_down), B1) output_buffer += "\n25th percentile : " \ "" + metric_classifier(round(np.percentile(np_array, 25), 3), download, error_percentage, warn_percentage) output_buffer += "\n50th Percentile(AVG) : " \ "" + metric_classifier(round(
np.average(np_array)
numpy.average
from base.base_test import BaseTest from tqdm import tqdm import numpy as np from utils.utils_plotting import * import cv2 import gc def accuracy(a, b): c = np.equal(a, b).astype(float) acc = sum(c) / len(c) return acc def print_alphas_conv(alp): for i in range(np.shape(alp)[1]): curr_im = alp[:,i,:,:,:] def normalize_im(im): im_new = im.astype(np.float64) minimum = im_new.min() maximum = im_new.max() im_norm = 255 * (im_new - minimum) / (maximum - minimum) im_norm = im_norm.astype(np.uint8) return im_norm class ExampleTesterPlotAttention(BaseTest): def __init__(self, sess, model, data_test, config, logger): super(ExampleTesterPlotAttention, self).__init__(sess, model, config, logger) self.data_test = data_test # calculate number of training and validation steps per epochs self.num_iter_data = data_test.len_lines // self.config.batch_size def test(self): losses_val = [] accs_add_val = [] accs_mul_val = [] predictions_add_val = [] predictions_mul_val = [] gt_classes_val = [] loop_test = tqdm(range(self.num_iter_data)) # iterate over steps (batches) for _ in loop_test: accu_add, accu_mul, loss, predictions_add, predictions_mul, gt_classes, a = self.test_step() losses_val.append(loss) accs_add_val.append(accu_add) accs_mul_val.append(accu_mul) # collect also the actual predictions to create confusion matrix predictions_add_val =
np.append(predictions_add_val, predictions_add)
numpy.append
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @File : dataset.py @Time : 2022/01/27 09:14:07 @Author : <NAME> @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2021-2022, SAIL-Lab ''' ######################################## import area ######################################## # common library import os import warnings import pandas as pd import numpy as np from tqdm import tqdm from Bio import PDB from Bio import SeqIO from Bio import pairwise2 from Bio.PDB import Selection, NeighborSearch ######################################## function area ######################################## amino2id = { 'U': 0, 'X': 21, 'A': 1, 'R': 2, 'N': 3, 'D': 4, 'C': 5, 'Q': 6, 'E': 7, 'G': 8, 'H': 9, 'I': 10, 'L': 11, 'K': 12, 'M': 13, 'F': 14, 'P': 15, 'S': 16, 'T': 17, 'W': 18, 'Y': 19, 'V': 20, } id2amino = {value:key for key, value in amino2id.items()} amino3to1 = { 'CYS': 'C', 'ASP': 'D', 'SER': 'S', 'GLN': 'Q', 'LYS': 'K', 'ILE': 'I', 'PRO': 'P', 'THR': 'T', 'PHE': 'F', 'ASN': 'N', 'GLY': 'G', 'HIS': 'H', 'LEU': 'L', 'ARG': 'R', 'TRP': 'W', 'ALA': 'A', 'VAL':'V', 'GLU': 'E', 'TYR': 'Y', 'MET': 'M' } def fasta_process(fasta_file): with open(fasta_file, 'r') as f: lines = f.readlines() return lines[1].strip() def pssm_process(fname,seq): num_pssm_cols = 44 pssm_col_names = [str(j) for j in range(num_pssm_cols)] if os.path.exists(fname) == 0: print(fname) return np.zeros((120,20)) with open(fname,'r') as f: tmp_pssm = pd.read_csv(f,delim_whitespace=True,names=pssm_col_names).dropna().values[:,2:22].astype(float) if tmp_pssm.shape[0] != len(seq): print(tmp_pssm.shape[0], len(seq)) raise ValueError('PSSM file is in wrong format or incorrect!') return tmp_pssm def hmm_process(fname,seq): num_hhm_cols = 22 hhm_col_names = [str(j) for j in range(num_hhm_cols)] if os.path.exists(fname) == 0: print(fname) return np.zeros((120,30)) with open(fname,'r') as f: hhm = pd.read_csv(f,delim_whitespace=True,names=hhm_col_names) pos1 = (hhm['0']=='HMM').idxmax()+3 num_cols = len(hhm.columns) hhm = hhm[pos1:-1].values[:,:num_hhm_cols].reshape([-1,44]) hhm[hhm=='*']='9999' if hhm.shape[0] != len(seq): print(hhm.shape[0], len(seq)) raise ValueError('HHM file is in wrong format or incorrect!') return hhm[:,2:-12].astype(float) def spd3_feature_sincos(x,seq): ASA = x[:,0] rnam1_std = "ACDEFGHIKLMNPQRSTVWYX" ASA_std = (115, 135, 150, 190, 210, 75, 195, 175, 200, 170, 185, 160, 145, 180, 225, 115, 140, 155, 255, 230, 1) dict_rnam1_ASA = dict(zip(rnam1_std, ASA_std)) ASA_div = np.array([dict_rnam1_ASA[i] for i in seq]) ASA = (ASA/ASA_div)[:,None] angles = x[:,1:5] HSEa = x[:,5:7] HCEprob = x[:,-3:] angles = np.deg2rad(angles) angles = np.concatenate([np.sin(angles),np.cos(angles)],1) return np.concatenate([ASA,angles,HSEa,HCEprob],1) def spd33_process(fname,seq): if os.path.exists(fname) == 0: print(fname) return np.zeros((120,14)) with open(fname,'r') as f: spd3_features = pd.read_csv(f,delim_whitespace=True).values[:,3:].astype(float) tmp_spd3 = spd3_feature_sincos(spd3_features,seq) if tmp_spd3.shape[0] != len(seq): print(tmp_spd3.shape[0], len(seq)) raise ValueError('SPD3 file is in wrong format or incorrect!') return tmp_spd3 def label_process(fname, seq): with open(fname, 'r') as f: lines = f.readlines() sequence, label = lines[1].strip(), lines[2].strip() if not len(seq) == len(sequence) == len(label): print(fname) print(seq) print(sequence) print(label) assert False return [int(num) for num in label] ######################################## main area ######################################## if __name__ == '__main__': # warning warnings.filterwarnings("ignore") data_path = './source' result_path = './preprocess' data = pd.read_csv(f'{data_path}/dataset.csv', sep=',') data_pdb, data_H, data_L, data_A = data['pdb'].values, data['Hchain'].values, data['Lchain'].values, data['antigen_chain'].values # refernce: https://github.com/eliberis/parapred # H1: 24-34; H2: 50-56; H3: 89-97 ; 11 + 7 + 9 + (4 * 3) = 39 # L1: 26-32; L2: 52-56; L3: 95-102; 7 + 5 + 8 + (4 * 3) = 32 extra_index, distance = 2, 4.5 cdr_ranges = {'H1':[-extra_index + 24, 34 + extra_index], 'H2':[-extra_index + 50, 56 + extra_index], 'H3':[-extra_index + 89, 97 + extra_index], 'L1':[-extra_index + 26, 32 + extra_index], 'L2':[-extra_index + 52, 56 + extra_index], 'L3':[-extra_index + 95, 102 + extra_index]} ######################################## 1. from pdb to chain ######################################## for pdb_id, H_id, L_id, A_id in tqdm(zip(data_pdb, data_H, data_L, data_A), total=len(data_pdb)): # prepared pdb model = PDB.PDBParser(PERMISSIVE=1, QUIET=1).get_structure(pdb_id, f'{data_path}/features/pdb/{pdb_id}.pdb')[0] # antigen chain maybe multichain A_id = [A_id] if len(A_id) == 1 else A_id.split(' | ') # save chain for chain_id in [H_id, L_id] + A_id: io = PDB.PDBIO() io.set_structure(model[chain_id]) if os.path.exists(f'{data_path}/features/chain/{pdb_id}{chain_id}.pdb'): continue io.save(f'{data_path}/features/chain/{pdb_id}{chain_id}.pdb') ######################################## 2. from chain to fasta ######################################## for pdb_id, H_id, L_id in tqdm(zip(data_pdb, data_H, data_L), total=len(data_pdb)): for record in SeqIO.parse(f'{data_path}/features/chain/{pdb_id}{H_id}.pdb', 'pdb-atom'): if f'????:{H_id}' == record.id or H_id == record.id or H_id == record.id[-1]: with open(f'{data_path}/features/fasta/{pdb_id}{H_id}.fasta','w') as fw: fw.write(f'>{pdb_id}{H_id}\n') fw.write("".join(list(record.seq)) + '\n') for record in SeqIO.parse(f'{data_path}/features/chain/{pdb_id}{L_id}.pdb', 'pdb-atom'): if f'????:{L_id}' == record.id or L_id == record.id or L_id == record.id[-1]: with open(f'{data_path}/features/fasta/{pdb_id}{L_id}.fasta','w') as fw: fw.write(f'>{pdb_id}{L_id}\n') fw.write("".join(list(record.seq)) + '\n') ####################################### 3. from fasta to check pssm, hmm and spd33 ######################################## for name in tqdm(os.listdir(f'{data_path}/features/fasta')): name = name.split('.')[0] pdb_id, chain_id = name[:-1], name[-1] sequence = fasta_process(f'{data_path}/features/fasta/{name}.fasta') if not os.path.exists(f'{data_path}/features/pssm/{name}.pssm') \ and os.path.exists(f'{data_path}/features/hmm/{name}.hhm') \ and os.path.exists(f'{data_path}/features/spd33/{name}.spd33'): print(name) continue pssm = pssm_process(f'{data_path}/features/pssm/{name}.pssm', sequence) hmm = hmm_process(f'{data_path}/features/hmm/{name}.hhm', sequence) spd33 = spd33_process(f'{data_path}/features/spd33/{name}.spd33', sequence) if not len(sequence) == pssm.shape[0] == hmm.shape[0] == spd33.shape[0]: print(name) continue ######################################## 4. construct label ######################################## for pdb_id, H_id, L_id, A_id in tqdm(zip(data_pdb, data_H, data_L, data_A), total=len(data_pdb)): # prepared pdb model = PDB.PDBParser(PERMISSIVE=1, QUIET=1).get_structure(pdb_id, f'{data_path}/features/pdb/{pdb_id}.pdb')[0] # get antigen chain if '|' in A_id: A_ids = A_id.split(' | ') A_atoms = [a for c in A_ids for a in Selection.unfold_entities(model[c], target_level='A')] A_chain = None else: A_atoms = Selection.unfold_entities(model[A_id], target_level='A') A_chain = model[A_id] A_search = NeighborSearch(A_atoms) # H_chain H_chain = model[H_id] # collect label H_temp_label = list() for residue in H_chain: if residue.get_resname() in amino3to1.keys(): if any(len(A_search.search(a.coord, distance)) > 0 for a in residue.get_unpacked_list()): H_temp_label.append("1") else: H_temp_label.append("0") # alignment label H_label = list() H_Chain_fasta = fasta_process(f'{data_path}/features/fasta/{pdb_id}{H_id}.fasta') sequence = "".join([amino3to1[residue.get_resname()] for residue in H_chain if residue.get_resname() in amino3to1.keys()]) if sequence == H_Chain_fasta: H_label = H_temp_label else: alignments = pairwise2.align.globalxx(H_Chain_fasta, sequence) standard_fasta = alignments[0].seqA align_sequence = alignments[0].seqB for idx, aa in enumerate(standard_fasta): if aa == align_sequence[idx]: try: cls = H_temp_label.pop(0) except: print(idx, aa) print(standard_fasta) print(align_sequence) assert False H_label.append(cls) else: H_label.append("0") assert len(H_label) == len(H_Chain_fasta) # write file with open(f'{data_path}/features/label/{pdb_id}{H_id}.txt', 'w') as fw: fw.write(f'>{pdb_id}{H_id}\n') fw.write(H_Chain_fasta + '\n') fw.write("".join(H_label) + '\n') # L_chain L_chain = model[L_id] # collect label L_temp_label = list() for residue in L_chain: if residue.get_resname() in amino3to1.keys(): if any(len(A_search.search(a.coord, distance)) > 0 for a in residue.get_unpacked_list()): L_temp_label.append("1") else: L_temp_label.append("0") # alignment label L_label = list() L_Chain_fasta = fasta_process(f'{data_path}/features/fasta/{pdb_id}{L_id}.fasta') sequence = "".join([amino3to1[residue.get_resname()] for residue in L_chain if residue.get_resname() in amino3to1.keys()]) if sequence == L_Chain_fasta: L_label = L_temp_label else: alignments = pairwise2.align.globalxx(L_Chain_fasta, sequence) standard_fasta = alignments[0].seqA align_sequence = alignments[0].seqB for idx, aa in enumerate(standard_fasta): if aa == align_sequence[idx]: try: cls = L_temp_label.pop(0) except: print(idx, aa) print(standard_fasta) print(align_sequence) assert False L_label.append(cls) else: L_label.append("0") assert len(L_label) == len(L_Chain_fasta) # write file with open(f'{data_path}/features/label/{pdb_id}{L_id}.txt', 'w') as fw: fw.write(f'>{pdb_id}{L_id}\n') fw.write(L_Chain_fasta + '\n') fw.write("".join(L_label) + '\n') ######################################## 5. construct concatenate cdrs ######################################## with open(f'{data_path}/total_277.fasta', 'w') as fw: for pdb_id, H_id, L_id in tqdm(zip(data_pdb, data_H, data_L), total=len(data_pdb)): H_Chain_fasta = fasta_process(f'{data_path}/features/fasta/{pdb_id}{H_id}.fasta') H_Chain_pssm = pssm_process(f'{data_path}/features/pssm/{pdb_id}{H_id}.pssm', H_Chain_fasta) H_Chain_hmm = hmm_process(f'{data_path}/features/hmm/{pdb_id}{H_id}.hhm', H_Chain_fasta) H_Chain_spd33 = spd33_process(f'{data_path}/features/spd33/{pdb_id}{H_id}.spd33', H_Chain_fasta) H_Chain_label = label_process(f'{data_path}/features/label/{pdb_id}{H_id}.txt', H_Chain_fasta) L_Chain_fasta = fasta_process(f'{data_path}/features/fasta/{pdb_id}{L_id}.fasta') L_Chain_pssm = pssm_process(f'{data_path}/features/pssm/{pdb_id}{L_id}.pssm', L_Chain_fasta) L_Chain_hmm = hmm_process(f'{data_path}/features/hmm/{pdb_id}{L_id}.hhm', L_Chain_fasta) L_Chain_spd33 = spd33_process(f'{data_path}/features/spd33/{pdb_id}{L_id}.spd33', L_Chain_fasta) L_Chain_label = label_process(f'{data_path}/features/label/{pdb_id}{L_id}.txt', L_Chain_fasta) # construct concatenate label cdrs, pssms, hmms, spd33s, labels = list(), list(), list(), list(), list() for cdr in ['H1', 'H2', 'H3']: start, end = cdr_ranges[cdr] try: fasta = H_Chain_fasta[start:end] pssm = H_Chain_pssm[start:end] hmm = H_Chain_hmm[start:end] spd33 = H_Chain_spd33[start:end] label = H_Chain_label[start:end] except: print(f'{pdb_id}{H_id}') assert False # H1 U H2 U H3 U cdrs.extend([amino2id[amino] for amino in fasta] + [amino2id['U']]) pssms.extend(np.vstack([pssm, np.array([0] * pssm.shape[-1])])) hmms.extend(np.vstack([hmm, np.array([0] * hmm.shape[-1])])) spd33s.extend(np.vstack([spd33, np.array([0] * spd33.shape[-1])])) labels.extend(label + [0]) for cdr in ['L1', 'L2', 'L3']: try: fasta = L_Chain_fasta[start:end] pssm = L_Chain_pssm[start:end] hmm = L_Chain_hmm[start:end] spd33 = L_Chain_spd33[start:end] label = L_Chain_label[start:end] except: print(f'{pdb_id}{L_id}') assert False # H1 U H2 U H3 U L1 U L2 U L3 if cdr != 'L3': cdrs.extend([amino2id[amino] for amino in fasta] + [amino2id['U']]) pssms.extend(np.vstack([pssm, np.array([0] * pssm.shape[-1])])) hmms.extend(np.vstack([hmm,
np.array([0] * hmm.shape[-1])
numpy.array
""" Script goal, to produce trends in netcdf files This script can also be used in P03 if required """ #============================================================================== __title__ = "Global Vegetation Trends" __author__ = "<NAME>" __version__ = "v1.0(28.03.2019)" __email__ = "<EMAIL>" #============================================================================== # +++++ Check the paths and set ex path to fireflies folder +++++ import os import sys if not os.getcwd().endswith("fireflies"): if "fireflies" in os.getcwd(): p1, p2, _ = os.getcwd().partition("fireflies") os.chdir(p1+p2) else: raise OSError( "This script was called from an unknown path. CWD can not be set" ) sys.path.append(os.getcwd()) #============================================================================== # Import packages import numpy as np import pandas as pd import argparse import datetime as dt from collections import OrderedDict import warnings as warn from scipy import stats import xarray as xr from numba import jit import bottleneck as bn import scipy as sp import glob # from netCDF4 import Dataset, num2date, date2num # from scipy import stats # import statsmodels.stats.multitest as smsM # Import plotting and colorpackages import matplotlib.pyplot as plt import matplotlib.colors as mpc import matplotlib as mpl import palettable import seaborn as sns import cartopy.crs as ccrs import cartopy.feature as cpf from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER # Import debugging packages import ipdb print("numpy version : ", np.__version__) print("pandas version : ", pd.__version__) print("xarray version : ", xr.__version__) #============================================================================== def main(): # ========== Set up the params ========== arraysize = 10000 # size of the area to test mat = 40.0 # how long before a forest reaches maturity germ = 10.0 # how long before a burnt site can germinate burnfrac = 0.10 # how much burns # burnfrac = BurntAreaFraction(year=2016)/2 # nburnfrac = 0.0 # how much burns in other years nburnfrac = 0.02 # how much burns in other years # nburnfrac = BurntAreaFraction(year=2018)/2.0 # how much burns in other years # nburnfrac = np.mean([BurntAreaFraction(year=int(yr)) for yr in [2015, 2017, 2018]]) # how much burns in other years firefreqL = [25, 20, 15, 11, 5, 4, 3, 2, 1] # how often the fires happen years = 200 # number of years to loop over RFfrac = 0.04 # The fraction that will fail to recuit after a fire iterations = 100 # ========== Create empty lists to hold the variables ========== obsMA = OrderedDict() obsMF = OrderedDict() obsGF = OrderedDict() obsSF = OrderedDict() obsMAstd = OrderedDict() obsMFstd = OrderedDict() obsGFstd = OrderedDict() obsSFstd = OrderedDict() # ========== Loop over the fire frequency list ========== for firefreq in firefreqL: print("Testing with a %d year fire frequency" % firefreq) # ************VECTORISE THIS LOOP ********* iymean = [] ifmat = [] ifgerm = [] ifsap = [] for it in np.arange(iterations): print("Iteration %d of %d" % (it, iterations)) # ========== Make an array ========== array = np.zeros( arraysize) rucfail = np.ones( arraysize) index = np.arange( arraysize) # ========== Make the entire array mature forest ========== array[:] = mat # ========== Create the empty arrays ========== ymean = [] fmat = [] fgerm = [] fsap = [] rfhold = 0 #the left over fraction of RF # ========== start the loop ========== # ************VECTORISE THIS LOOP ********* for year in range(0, years): # Loop over every year in case i want to add major fire events # print(year) if year % firefreq == 0: # FIre year array, rucfail, rfhold = firetime(array, index, mat, germ, burnfrac, rucfail, RFfrac, rfhold) else: # non fire year array, rucfail, rfhold = firetime(array, index, mat, germ, nburnfrac, rucfail, RFfrac, rfhold) # Mean years ymean.append(np.mean(array)) # Fraction of mature forest\ fmat.append(np.sum(array>=mat)/float(arraysize)) # Fraction of germinating forest fsap.append(np.sum(np.logical_and((array>germ), (array<mat)))/float(np.sum((array>germ)))) # Fraction of germinating forest fgerm.append(np.sum(array>germ)/float(arraysize)) # if year>60 and firefreq == 1: iymean.append(np.array(ymean)) ifmat.append (np.array(fmat)) ifgerm.append (np.array(fgerm)) ifsap .append (
np.array(fsap)
numpy.array
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Includes the Biopac data source class """ import pandas as pd import numpy as np from scipy.io import loadmat from scipy.interpolate import UnivariateSpline from data_source import DataSource from schema import Schema, Or, Optional def _val(x, pos, label_bin): return np.mean(x) def _std(x, pos, label_bin): return x.std(axis=0) def _sem(x, pos, label_bin): return x.sem(axis=0) def _var(x, pos, label_bin): return np.var(x) class Biopac(DataSource): def __init__(self, config, schedule): # Call the parent class init super(Biopac, self).__init__(config, schedule) self.panels = {'bpm': {'VAL': _val, 'SEM': _sem}, 'rr': {'VAL': _val, 'STD': _std}, 'twave': {'VAL': _val, 'SEM': _sem}} def load(self, file_paths): """Override for load method to include .mat compatibility.""" self.data['samples'] = pd.read_csv(file_paths['samples'], comment="#", delimiter="\t", skipinitialspace=True, header=None, index_col=False, names=['bpm', 'rr', 'twave']) raw_mat = loadmat(file_paths['labels']) events = raw_mat['events'][:, 0] self.data['labels'] = pd.DataFrame({'flag': events}, index=np.arange(events.size)) def merge_data(self): """ Clean and merge the samples and labels data. """ # TODO(janmtl): return an error if the files have not been loaded yet. # Clean the samples data frame and the labels data frame self.data['samples'] = self._clean_samples(self.data['samples']) self.data['labels'] = self._clean_labels(self.data['labels']) self.label_config = self._label_config_to_df(self.config) # Combine the labels data with the labels configuration self.data['labels'] = self._merge_labels_and_config( labels=self.data['labels'], config=self.label_config) @staticmethod def _label_config_to_df(config): """Convert the label configuration dictionary to a data frame.""" labels_list = [] for event_type, label_config in config.iteritems(): pattern = label_config['pattern'] if isinstance(pattern, dict): for event_group, flag in label_config['pattern'].iteritems(): labels_list.append({ 'Label': event_type, 'Condition': event_group, 'Duration': label_config['duration'], 'N_Bins': label_config['bins'], 'Left_Trim': label_config.get('left_trim', 0), 'Right_Trim': label_config.get('right_trim', 0), 'flag': flag}) elif isinstance(pattern, int): labels_list.append({ 'Label': event_type, 'Condition': np.nan, 'Duration': label_config['duration'], 'N_Bins': label_config['bins'], 'Left_Trim': label_config.get('left_trim', 0), 'Right_Trim': label_config.get('right_trim', 0), 'flag': pattern}) else: raise Exception('Bad Biopac config flag {}'.format(pattern)) return pd.DataFrame(labels_list) @staticmethod def _clean_labels(labels): """ Turn the Biopac flag channel into a data frame of label flags and start times. """ # TODO(janmtl): finish this docstring flags = labels['flag'].values low_offset = np.append(-255, flags) high_offset = np.append(flags, flags[-1]) sel = ((low_offset-high_offset) != 0)[:-1] event_flags = flags[sel] start_times = np.where((low_offset-high_offset) != 0)[0] labels = pd.DataFrame({'flag': event_flags, 'Start_Time': start_times}) labels = labels[(labels['flag'] != 255)] return labels @staticmethod def _clean_samples(samples): """ . """ scale = 0.55 samples.index = samples.index*100 for col_name, col in samples.iteritems(): x = col.index y = col.values spl = UnivariateSpline(x, y, k=5, s=scale*len(x)) samples[col_name] = spl(x) samples['pos'] = True return samples @staticmethod def _merge_labels_and_config(labels, config): """ Merge together the contents of the labels file with the label configuration dictionary. """ labels = pd.merge(labels, config, on='flag') labels = labels.sort_values(by='Start_Time', axis=0) return labels def create_label_bins(self, labels): """Replace the N_Bins column with Bin_Index and the Duration column with End_Time. This procedure grows the number of rows in the labels data frame.""" total_bins = labels['N_Bins'].sum() label_bins = pd.DataFrame(columns=['Order', 'ID', 'Label', 'Condition', 'Bin_Order', 'Start_Time', 'End_Time', 'Bin_Index'], index=np.arange(0, total_bins)) idx = 0 for _, label in labels.iterrows(): n_bins = label['N_Bins'] cuts = np.linspace(start=label['Start_Time'] + label['Left_Trim'], stop=(label['Start_Time'] + label['Duration'] - label['Right_Trim']), num=n_bins+1) label_info = np.tile(label.as_matrix(columns=['Label', 'Condition']), (n_bins, 1)) # Order and ID label_bins.iloc[idx:idx+n_bins, 0:2] = np.nan # Label, Condition label_bins.iloc[idx:idx+n_bins, 2:4] = label_info # Bin_Order label_bins.iloc[idx:idx+n_bins, 4] = idx+
np.arange(0, n_bins, 1)
numpy.arange
from corvus.structures import Handler, Exchange, Loop, Update import corvutils.pyparsing as pp import os, sys, subprocess, shutil #, resource import re import numpy as np #from CifFile import ReadCif #from cif2cell.uctools import * # Debug: FDV import pprint pp_debug = pprint.PrettyPrinter(indent=4) # Define dictionary of implemented calculations implemented = {} strlistkey = lambda L:','.join(sorted(L)) subs = lambda L:[{L[j] for j in range(len(L)) if 1<<j&k} for k in range(1,1<<len(L))] for s in subs(['potlist','atomlist']): key = strlistkey(s) autodesc = 'Basic FEFF ' + ', '.join(s) + ' from ABINIT cell definition' input = ['acell','znucl','xred','rprim','natom'] cost = 1 implemented[key] = {'type':'Exchange','out':list(s),'req':input, 'desc':autodesc,'cost':cost} implemented['feffAtomicData'] = {'type':'Exchange','out':['feffAtomicData'],'cost':1, 'req':['cluster','absorbing_atom'],'desc':'Calculate atomic data using FEFF.'} implemented['feffSCFPotentials'] = {'type':'Exchange','out':['feffSCFPotentials'],'cost':1, 'req':['cluster','absorbing_atom','feffAtomicData'],'desc':'Calculate SCF potentials using FEFF.'} implemented['feffCrossSectionsAndPhases'] = {'type':'Exchange','out':['feffCrossSectionsAndPhases'],'cost':1, 'req':['cluster','absorbing_atom','feffSCFPotentials'],'desc':'Calculate atomic cross sections and phases using FEFF.'} implemented['feffGreensFunction'] = {'type':'Exchange','out':['feffGreensFunction'],'cost':1, 'req':['cluster','absorbing_atom','feffCrossSectionsAndPhases'],'desc':'Calculate Greens function using FEFF.'} implemented['feffPaths'] = {'type':'Exchange','out':['feffPaths'],'cost':1, 'req':['cluster','absorbing_atom','feffGreensFunction'],'desc':'Calculate paths using FEFF.'} implemented['feffFMatrices'] = {'type':'Exchange','out':['feffFMatrices'],'cost':1, 'req':['cluster','absorbing_atom','feffPaths'],'desc':'Calculate scattering matrices using FEFF.'} implemented['xanes'] = {'type':'Exchange','out':['xanes'],'cost':1, 'req':['cluster','absorbing_atom'],'desc':'Calculate XANES using FEFF.'} implemented['feffXES'] = {'type':'Exchange','out':['feffXES'],'cost':1, 'req':['cluster','absorbing_atom'],'desc':'Calculate XANES using FEFF.'} implemented['feffRIXS'] = {'type':'Exchange','out':['feffRIXS'],'cost':1, 'req':['cluster','absorbing_atom'],'desc':'Calculate XANES using FEFF.'} implemented['opcons'] = {'type':'Exchange','out':['opcons'],'cost':1, 'req':['cif_input'],'desc':'Calculate optical constants using FEFF.'} # Added by FDV # Trying to implement and EXAFS with optimized geometry and ab initio DW factors implemented['opt_dynmat_s2_exafs'] = {'type':'Exchange', 'out':['opt_dynmat_s2_exafs'], 'cost':3, 'req':['opt_dynmat','absorbing_atom'], 'desc':'Calculate EXAFS with optimized geometry and ab initio DW factors from a dynamical matrix using FEFF.'} class Feff(Handler): def __str__(self): return 'FEFF Handler' @staticmethod def canProduce(output): if isinstance(output, list) and output and isinstance(output[0], str): return strlistkey(output) in implemented elif isinstance(output, str): return output in implemented else: raise TypeError('Output should be token or list of tokens') @staticmethod def requiredInputFor(output): if isinstance(output, list) and output and isinstance(output[0], str): unresolved = {o for o in output if not Feff.canProduce(o)} canProduce = (o for o in output if Feff.canProduce(o)) additionalInput = (set(implemented[o]['req']) for o in canProduce) return list(set.union(unresolved,*additionalInput)) elif isinstance(output, str): if output in implemented: return implemented[output]['req'] else: return [output] else: raise TypeError('Output should be token or list of tokens') @staticmethod def cost(output): if isinstance(output, list) and output and isinstance(output[0], str): key = strlistkey(output) elif isinstance(output, str): key = output else: raise TypeError('Output should be token or list of tokens') if key not in implemented: raise LookupError('Corvus cannot currently produce ' + key + ' using FEFF') return implemented[key]['cost'] @staticmethod def sequenceFor(output,inp=None): if isinstance(output, list) and output and isinstance(output[0], str): key = strlistkey(output) elif isinstance(output, str): key = output else: raise TypeError('Output should be token of list of tokens') if key not in implemented: raise LookupError('Corvus cannot currently produce ' + key + ' using FEFF') f = lambda subkey : implemented[key][subkey] if f('type') is 'Exchange': return Exchange(Feff, f('req'), f('out'), cost=f('cost'), desc=f('desc')) @staticmethod def prep(config): if 'xcIndexStart' in config: if config['xcIndexStart'] > 0: subdir = config['pathprefix'] + str(config['xcIndex']) + '_FEFF' xcDir = os.path.join(config['cwd'], subdir) else: xcDir = config['xcDir'] else: subdir = config['pathprefix'] + str(config['xcIndex']) + '_FEFF' xcDir = os.path.join(config['cwd'], subdir) # Make new output directory if if doesn't exist if not os.path.exists(xcDir): os.makedirs(xcDir) # Store current Exchange directory in configuration config['xcDir'] = xcDir #@staticmethod #def setDefaults(input,target): # JJ Kas - run now performs all 3 methods, i.e., generateInput, run, translateOutput # Maybe we should also include prep here. Is there a reason that we want to limit the directory names # to automated Corvus_FEFFNN? Also if we have prep included here, we can decide on making a new directory # or not. @staticmethod def run(config, input, output): # Set os specific executable ending if os.name == 'nt': win_exe = '.exe' else: win_exe = '' # set atoms and potentials # Set directory to feff executables. # Debug: FDV # pp_debug.pprint(config) feffdir = config['feff'] # Debug: FDV # sys.exit() # Copy feff related input to feffinput here. Later we will be overriding some settings, # so we want to keep the original input intact. feffInput = {key:input[key] for key in input if key.startswith('feff.')} # Generate any data that is needed from generic input and populate feffInput with # global data (needed for all feff runs.) if 'feff.target' in input or 'cluster' not in input: if 'cif_input' in input: # Prefer using cif for input, but still use REAL space # Replace path with absolute path feffInput['feff.cif'] = [[os.path.abspath(input['cif_input'][0][0])]] if 'feff.reciprocal' not in input: feffInput['feff.real'] = [[True]] if 'cluster' in input: atoms = getFeffAtomsFromCluster(input) setInput(feffInput,'feff.atoms',atoms) potentials = getFeffPotentialsFromCluster(input) setInput(feffInput,'feff.potentials',potentials) debyeOpts = getFeffDebyeOptions(input) if 'feff.exchange' in feffInput: exch = feffInput['feff.exchange'] else: exch = [[0, 0.0, 0.0, 2]] if 'spectral_broadening' in input: exch[0][2] = input['spectral_broadening'][0][0] if 'fermi_shift' in input: exch[0][1] = input['fermi_shift'][0][0] feffInput['feff.exchange'] = exch if debyeOpts is not None: setInput(feffInput,'feff.debye',debyeOpts) # Set directory for this exchange dir = config['xcDir'] # Set input file inpf = os.path.join(dir, 'feff.inp') # Loop over targets in output. Not sure if there will ever be more than one output target here. for target in output: if (target == 'feffAtomicData'): # Set output and error files with open(os.path.join(dir, 'corvus.FEFF.stdout'), 'w') as out, open(os.path.join(dir, 'corvus.FEFF.stderr'), 'w') as err: # Write input file for FEFF. writeAtomicInput(feffInput,inpf) # Loop over executable: This is specific to feff. Other codes # will more likely have only one executable. # Run rdinp and atomic part of calculation execs = ['rdinp','atomic','screen'] for exe in execs: if 'feff.MPI.CMD' in feffInput: executable = [feffInput.get('feff.MPI.CMD')[0] + win_exe] args = feffInput.get('feff.MPI.ARGS',[['']])[0] + [os.path.join(feffdir,exe) + win_exe] else: executable = [os.path.join(feffdir,exe)] args = [''] runExecutable('',dir,executable,args,out,err) # For this case, I am only passing the directory for now so # that other executables in FEFF can use the atomic data. output[target] = dir elif (target == 'feffSCFPotentials'): # Set output and error files with open(os.path.join(dir, 'corvus.FEFF.stdout'), 'w') as out, open(os.path.join(dir, 'corvus.FEFF.stderr'), 'w') as err: # Write input file for FEFF. writeSCFInput(feffInput,inpf) # Loop over executable: This is specific to feff. Other codes # will more likely have only one executable. Here I am running # rdinp again since writeSCFInput may have different cards than # Run rdinp and atomic part of calculation execs = ['rdinp','atomic', 'pot', 'screen'] for exe in execs: if 'feff.MPI.CMD' in feffInput: executable = feffInput.get('feff.MPI.CMD')[0] args = feffInput.get('feff.MPI.ARGS',[['']])[0] + [os.path.join(feffdir,exe)] else: executable = [os.path.join(feffdir,exe)] args = [''] runExecutable('',dir,executable,args,out,err) # For this case, I am only passing the directory for now so # that other executables in FEFF can use the atomic data. output[target] = dir elif (target == 'feffCrossSectionsAndPhases'): # Set output and error files with open(os.path.join(dir, 'corvus.FEFF.stdout'), 'w') as out, open(os.path.join(dir, 'corvus.FEFF.stderr'), 'w') as err: # Write input file for FEFF. writeCrossSectionsInput(feffInput,inpf) # Loop over executable: This is specific to feff. Other codes # will more likely have only one executable. Here I am running # rdinp again since writeSCFInput may have different cards than # Run rdinp and atomic part of calculation execs = ['rdinp','atomic','screen', 'pot', 'xsph'] for exe in execs: if 'feff.MPI.CMD' in feffInput: executable = feffInput.get('feff.MPI.CMD')[0] args = feffInput.get('feff.MPI.ARGS',[['']])[0] + [os.path.join(feffdir,exe)] else: executable = [os.path.join(feffdir,exe)] args = [''] runExecutable('',dir,executable,args,out,err) output[target] = dir elif (target == 'feffGreensFunction'): # Set output and error files with open(os.path.join(dir, 'corvus.FEFF.stdout'), 'w') as out, open(os.path.join(dir, 'corvus.FEFF.stderr'), 'w') as err: # Write input file for FEFF. writeGreensFunctionInput(feffInput,inpf) # Loop over executable: This is specific to feff. Other codes # will more likely have only one executable. Here I am running # rdinp again since writeSCFInput may have different cards than execs = ['rdinp','atomic','pot','screen','xsph','fms','mkgtr'] for exe in execs: if 'feff.MPI.CMD' in feffInput: executable = feffInput.get('feff.MPI.CMD')[0] args = feffInput.get('feff.MPI.ARGS',[['']])[0] + [os.path.join(feffdir,exe)] else: executable = [os.path.join(feffdir,exe)] args = [''] runExecutable('',dir,executable,args,out,err) # For this case, I am only passing the directory for now so # that other executables in FEFF can use the atomic data. output[target] = dir elif (target == 'feffPaths'): # Set output and error files with open(os.path.join(dir, 'corvus.FEFF.stdout'), 'w') as out, open(os.path.join(dir, 'corvus.FEFF.stderr'), 'w') as err: # Write input file for FEFF. writePathsInput(feffInput,inpf) # Loop over executable: This is specific to feff. Other codes # will more likely have only one executable. Here I am running # rdinp again since writeSCFInput may have different cards than execs = ['rdinp','atomic','pot','screen','xsph','fms','mkgtr','path'] for exe in execs: if 'feff.MPI.CMD' in feffInput: executable = feffInput.get('feff.MPI.CMD')[0] args = feffInput.get('feff.MPI.ARGS',[['']])[0] + [os.path.join(feffdir,exe)] else: executable = [os.path.join(feffdir,exe)] args = [''] runExecutable('',dir,executable,args,out,err) # For this case, I am only passing the directory for now so # that other executables in FEFF can use the atomic data. output[target] = dir elif (target == 'feffFMatrices'): # Set output and error files with open(os.path.join(dir, 'corvus.FEFF.stdout'), 'w') as out, open(os.path.join(dir, 'corvus.FEFF.stderr'), 'w') as err: # Write input file for FEFF. writeFMatricesInput(feffInput,inpf) # Loop over executable: This is specific to feff. Other codes # will more likely have only one executable. Here I am running # rdinp again since writeSCFInput may have different cards than execs = ['rdinp','atomic','pot','screen','xsph','fms','mkgtr','path','genfmt'] for exe in execs: if 'feff.MPI.CMD' in feffInput: executable = feffInput.get('feff.MPI.CMD')[0] args = feffInput.get('feff.MPI.ARGS',[['']])[0] + [os.path.join(feffdir,exe)] else: executable = [os.path.join(feffdir,exe)] args = [''] runExecutable('',dir,executable,args,out,err) output[target] = dir elif (target == 'xanes'): # Loop over edges. For now just run in the same directory. Should change this later. for i,edge in enumerate(input['feff.edge'][0]): feffInput['feff.edge'] = [[edge]] # Set output and error files with open(os.path.join(dir, 'corvus.FEFF.stdout'), 'w') as out, open(os.path.join(dir, 'corvus.FEFF.stderr'), 'w') as err: # Write input file for FEFF. writeXANESInput(feffInput,inpf) # Loop over executable: This is specific to feff. Other codes # will more likely have only one executable. Here I am running # rdinp again since writeSCFInput may have different cards than execs = ['rdinp','atomic','pot','screen','opconsat','xsph','fms','mkgtr','path','genfmt','ff2x','sfconv'] for exe in execs: if 'feff.MPI.CMD' in feffInput: executable = [feffInput.get('feff.MPI.CMD')[0][0] + win_exe] args = feffInput.get('feff.MPI.ARGS',[['']])[0] + [os.path.join(feffdir,exe) + win_exe] else: executable = [os.path.join(feffdir,exe)] args = [''] runExecutable('',dir,executable,args,out,err) outFile=os.path.join(dir,'xmu.dat') w,xmu = np.loadtxt(outFile,usecols = (0,3)).T if i==0: xmu_arr = [xmu] w_arr = [w] else: xmu_arr = xmu_arr + [xmu] w_arr = w_arr + [w] # Now combine energy grids, interpolate files, and sum. wtot = np.unique(np.append(w_arr[0],w_arr[1:])) xmutot = np.zeros_like(wtot) xmuterp_arr = [] for i,xmu_elem in enumerate(xmu_arr): xmuterp_arr = xmuterp_arr + [np.interp(wtot,w_arr[i],xmu_elem)] xmutot = xmutot + np.interp(wtot,w_arr[i],xmu_elem) #output[target] = np.array([wtot,xmutot] + xmuterp_arr).tolist() output[target] = np.array([wtot,xmutot]).tolist() #print output[target] elif (target == 'feffXES'): # Set output and error files with open(os.path.join(dir, 'corvus.FEFF.stdout'), 'w') as out, open(os.path.join(dir, 'corvus.FEFF.stderr'), 'w') as err: # Write input file for FEFF. writeXESInput(feffInput,inpf) # Loop over executable: This is specific to feff. Other codes # will more likely have only one executable. execs = ['rdinp','atomic','pot','screen','opconsat','xsph','fms','mkgtr','path','genfmt','ff2x','sfconv'] for exe in execs: if 'feff.MPI.CMD' in feffInput: executable = feffInput.get('feff.MPI.CMD')[0] args = feffInput.get('feff.MPI.ARGS',[['']])[0] + [os.path.join(feffdir,exe)] else: executable = [os.path.join(feffdir,exe)] args = [''] runExecutable('',dir,executable,args,out,err) # For this case, I am only passing the directory for now so # that other executables in FEFF can use the data. outFile=os.path.join(dir,'xmu.dat') output[target] = np.loadtxt(outFile,usecols = (0,3)).T.tolist() elif (target == 'feffRIXS'): # For RIXS, need to run multiple times as follows. # Core-Core RIXS # 1. Run for the deep core-level. # 2. Run for the shallow core-level. # 3. Collect files. # 4. Run rixs executable. # Core-valence RIXS # 1. Run for the deep core-level. # 2. Run for the valence level. # 3. Run and XES calculation. # 4. Run rixs executable. # Set global settings for all runs. # Set default energy grid setInput(feffInput,'feff.egrid',[['e_grid', -10, 10, 0.05],['k_grid', 'last', 4, 0.025]]) setInput(feffInput,'feff.exchange',[[0, 0.0, -20.0, 0]]) setInput(feffInput,'feff.corehole',[['RPA']],Force=True) # maybe not this one. Need 'NONE' for valence setInput(feffInput,'feff.edge',[['K','VAL']]) edges = feffInput['feff.edge'][0] # Save original state of input savedInput = dict(feffInput) # Loop over edges and run XANES for each edge: # Save deep edge edge0 = edges[0] nEdge=0 for edge in edges: nEdge = nEdge + 1 # Make directory dirname = os.path.join(dir,edge) if not os.path.exists(dirname): os.mkdir(dirname) if edge.upper() != "VAL": outFileName='rixsET.dat' # Delete XES input key if 'feff.xes' in feffInput: del feffInput['feff.xes'] # Set edge. setInput(feffInput,'feff.edge',[[edge]],Force=True) # Set icore to other edge setInput(feffInput,'feff.icore',[[getICore(edge0)]],Force=True) # Set corehole RPA setInput(feffInput,'feff.corehole',[['RPA']],Force=True) # Set default energy grid setInput(feffInput,'feff.egrid',[['e_grid', -10, 10, 0.05],['k_grid', 'last', 4, 0.025]]) # Set RLPRINT setInput(feffInput,'feff.rlprint',[[True]],Force=True) feffinp = os.path.join(dirname, 'feff.inp') # Write XANES input for this run writeXANESInput(feffInput,feffinp) else: # This is a valence calculation. Calculate NOHOLE and XES # XANES calculation outFileName='rixsET-sat.dat' # Find out if we are using a valence hole for valence calculation. # Set edge. setInput(feffInput,'feff.edge',[[edge0]],Force=True) if len(edges) == nEdge+1: # Set corehole RPA setInput(feffInput,'feff.corehole',[['RPA']],Force=True) # We want to use this core-state as the core hole in place of the valence # Set screen parameters setInput(feffInput,'feff.screen',[['icore', getICore(edges[nEdge])]],Force=True) else: # Set corehole NONE setInput(feffInput,'feff.corehole',[['NONE']],Force=True) # Write wscrn.dat to VAL directory wscrnFileW = os.path.join(dirname,'wscrn.dat') writeList(wscrnLines,wscrnFileW) # Set icore to deep edge setInput(feffInput,'feff.icore',[[getICore(edge0)]],Force=True) # Set default energy grid setInput(feffInput,'feff.egrid',[['e_grid', -10, 10, 0.05],['k_grid', 'last', 4, 0.025]]) # Set RLPRINT setInput(feffInput,'feff.rlprint',[[True]],Force=True) # # Run XES for the deep level # Save XANES card, but delete from input xanesInput = {} if 'feff.xanes' in feffInput: setInput(xanesInput, 'feff.xanes', feffInput['feff.xanes']) del feffInput['feff.xanes'] # Set XES options # Set default energy grid del feffInput['feff.egrid'] setInput(feffInput,'feff.egrid',[['e_grid', -40, 10, 0.1]]) setInput(feffInput,'feff.xes', [[-20, 10, 0.1]]) xesdir = os.path.join(dir,'XES') if not os.path.exists(xesdir): os.mkdir(xesdir) feffinp = os.path.join(xesdir,'feff.inp') # Write XES input. writeXESInput(feffInput,feffinp) # Run executables to get XES # Set output and error files with open(os.path.join(xesdir, 'corvus.FEFF.stdout'), 'w') as out, open(os.path.join(xesdir, 'corvus.FEFF.stderr'), 'w') as err: execs = ['rdinp','atomic','pot','screen','opconsat','xsph','fms','mkgtr','path','genfmt','ff2x','sfconv'] for exe in execs: if 'feff.MPI.CMD' in feffInput: executable = feffInput.get('feff.MPI.CMD')[0] args = feffInput.get('feff.MPI.ARGS',[['']])[0] + [os.path.join(feffdir,exe)] else: executable = [os.path.join(feffdir,exe)] args = [''] runExecutable('',xesdir,executable,args,out,err) # Make xes.dat from xmu.dat xmuFile = open(os.path.join(xesdir,'xmu.dat')) xesFile = os.path.join(dir,'xes.dat') xesLines=[] for line in xmuFile: if line.lstrip()[0] != '#': fields=line.split() xesLines = xesLines + [str(xmu - float(fields[1])) + ' ' + fields[3]] elif 'Mu' in line: fields = line.strip().split() xmu = float(fields[2][3:len(fields[2])-3]) # Write lines in reverse order so that column 1 is sorted correctly. writeList(xesLines[::-1],xesFile) # Now make input file for XANES calculation. if 'feff.xanes' in xanesInput: feffInput['feff.xanes'] = xanesInput['feff.xanes'] del feffInput['feff.xes'] # Set default energy grid setInput(feffInput,'feff.egrid',[['e_grid', -10, 10, 0.05],['k_grid', 'last', 4, 0.025]],Force=True) feffinp = os.path.join(dirname, 'feff.inp') # Write XANES input for this run writeXANESInput(feffInput,feffinp) # Run XANES for this edge # Set output and error files with open(os.path.join(dirname, 'corvus.FEFF.stdout'), 'w') as out, open(os.path.join(dirname, 'corvus.FEFF.stderr'), 'w') as err: execs = ['rdinp','atomic','pot','screen','opconsat','xsph','fms','mkgtr','path','genfmt','ff2x','sfconv'] for exe in execs: if 'feff.MPI.CMD' in feffInput: executable = feffInput.get('feff.MPI.CMD')[0] args = feffInput.get('feff.MPI.ARGS',[['']])[0] + [os.path.join(feffdir,exe)] else: executable = [os.path.join(feffdir,exe)] args = [''] runExecutable('',dirname,executable,args,out,err) # Now copy files from this edge to main directory shutil.copyfile(os.path.join(dirname,'wscrn.dat'), os.path.join(dir,'wscrn_' + str(nEdge) + '.dat')) shutil.copyfile(os.path.join(dirname,'phase.bin'), os.path.join(dir,'phase_' + str(nEdge) + '.bin')) shutil.copyfile(os.path.join(dirname,'gg.bin'), os.path.join(dir,'gg_' + str(nEdge) + '.bin')) shutil.copyfile(os.path.join(dirname,'xsect.dat'), os.path.join(dir,'xsect_' + str(nEdge) + '.dat')) shutil.copyfile(os.path.join(dirname,'xmu.dat'), os.path.join(dir,'xmu_' + str(nEdge) + '.dat')) shutil.copyfile(os.path.join(dirname,'rl.dat'), os.path.join(dir,'rl_' + str(nEdge) + '.dat')) shutil.copyfile(os.path.join(dirname,'.dimensions.dat'), os.path.join(dir,'.dimensions.dat')) # If this is the first edge, get the screened potential. if nEdge == 1: wscrnLines = [] with open(os.path.join(dirname,'wscrn.dat'),'r') as wscrnFileR: for wscrnLine in wscrnFileR.readlines(): if wscrnLine.lstrip()[0] == '#': wscrnLines = wscrnLines + [wscrnLine.strip()] else: wscrnFields = wscrnLine.strip().split() wscrnLines = wscrnLines + [wscrnFields[0] + ' 0.0 0.0'] # Finally, run rixs executable feffInput = savedInput setInput(feffInput,'feff.rixs', [[0.1, 0.1]]) feffinp = os.path.join(dir, 'feff.inp') # Write XANES input for this run writeXANESInput(feffInput,feffinp) # Set output and error files with open(os.path.join(dir, 'corvus.FEFF.stdout'), 'w') as out, open(os.path.join(dir, 'corvus.FEFF.stderr'), 'w') as err: execs = ['rdinp','atomic','rixs'] for exe in execs: if 'feff.MPI.CMD' in feffInput: executable = feffInput.get('feff.MPI.CMD')[0] args = feffInput.get('feff.MPI.ARGS',[['']])[0] + [os.path.join(feffdir,exe)] else: executable = [os.path.join(feffdir,exe)] args = [''] runExecutable('',dir,executable,args,out,err) outFile=os.path.join(dir,outFileName) output[target] = np.loadtxt(outFile).T.tolist() ## OPCONS BEGIN elif (target == 'opcons'): # Opcons imports import copy #import matplotlib.pyplot as plt from corvus.controls import generateAndRunWorkflow # Define some constants hart = 2*13.605698 alpinv = 137.03598956 bohr = 0.529177249 # Used in fixing element symbols only_alpha = re.compile('[^a-zA-Z]') # Set prefix for sdtout of feff runs. runExecutable.prefix = '\t\t\t' # Copy general input to local one input2 = copy.deepcopy(input) # Modify the common values of local input input2['feff.setedge'] = input.get('feff.setedge',[[True]]) input2['feff.absolute'] = [[True]] input2['feff.rgrid'] = [[0.01]] # Copy general config to local one config2 = copy.deepcopy(config) # Set directory to run in. config2['cwd'] = config['xcDir'] # Set xcIndexStart to -1 so that xcDir will be set below rather than in prep. config2['xcIndexStart'] = -1 # Use absolute units for everything. config2['feff.absolute'] = [[True]] # Initialize variables that collect results (?) NumberDensity = [] vtot = 0.0 xas_arr = [] xas0_arr = [] en_arr = [] component_labels = [] # The logic of the lines below is weird: In opcons calculations the absorber is chosen on the fly by looping over all unique atoms if 'absorbing_atom' not in input: absorbers = [] else: absorbers = input['absorbing_atom'][0] # Build a list of absorbers for the system # I think this also build a fake cluster to go in the input if 'cif_input' in input2: cifFile = ReadCif(os.path.abspath(input2['cif_input'][0][0])) cif_dict = cifFile[list(cifFile.keys())[0]] cell_data = CellData() cell_data.getFromCIF(cif_dict) cell_data.primitive() symmult = [] cluster = [] i=1 for ia,a in enumerate(cell_data.atomdata): # This loops over sites in the original cif symmult = symmult + [len(a)] element = list(a[0].species.keys())[0] component_labels = component_labels + [element + str(i)] if 'absorbing_atom' not in input: absorbers = absorbers + [ia+1] cluster = cluster + [['Cu', 0.0, 0.0, ia*2.0 ]] i += 1 if 'cluster' not in input2: input2['cluster'] = cluster # Debug: FDV # print('ABSORBERS') # pp_debug.pprint(absorbers) # OPCONS LOOP SETUP BEGIN ------------------------------------------------------------------------------------- # Added by FDV # Creating a list to collect the inputs for delayed execution WF_Params_Dict = {} # For each atom in absorbing_atoms run a full-spectrum calculation (all edges, XANES + EXAFS) for absorber in absorbers: print('') print("##########################################################") print(" Component: " + component_labels[absorber-1]) print("##########################################################") print('') ### BEGIN INPUT GEN -------------------------------------------------------------------------------------------- input2['absorbing_atom'] = [[absorber]] input2['feff.target'] = [[absorber]] if 'cif_input' in input2: input2['feff.target'] = [[absorber]] element = list(cell_data.atomdata[absorber-1][0].species.keys())[0] if 'number_density' not in input: NumberDensity = NumberDensity + [symmult[absorber - 1]] else: # This only works if all elements are treated as the same for our calculation element = input['cluster'][absorber-1][0] if 'number_density' not in input: n_element = 0 for atm in input['cluster']: if element in atm: n_element += 1 NumberDensity = NumberDensity + [n_element] print('Number in unit cell: ' + str(NumberDensity[-1])) ### END INPUT GEN -------------------------------------------------------------------------------------------- # For each edge for this atom, run a XANES and EXAFS run # Commented out by FDV, unused, simplifying # FirstEdge = True Item_Absorber = {} for edge in feff_edge_dict[only_alpha.sub('',element)]: Item_Edge = {} print("\t" + edge) print("\t\t" + 'XANES') ### BEGIN INPUT GEN -------------------------------------------------------------------------------------------- input2['feff.edge'] = [[edge]] # Run XANES input2['taget_list'] = [['xanes']] # Set energy grid for XANES. input2['feff.egrid'] = [['e_grid', -10, 10, 0.1], ['k_grid','last',5,0.07]] input2['feff.control'] = [[1,1,1,1,1,1]] config2['xcDir'] = os.path.join(config2['cwd'],component_labels[absorber-1],edge,'XANES') targetList = [['xanes']] if 'feff.scf' in input: input2['feff.scf'] = input['feff.scf'] else: input2['feff.scf'] = [[4.0,0,100,0.1,0]] if 'feff.fms' in input: input2['feff.fms'] = input['feff.fms'] else: input2['feff.fms'] = [[6.0]] input2['feff.rpath'] = [[0.1]] ### END INPUT GEN -------------------------------------------------------------------------------------------- # Added by FDV Item_xanes = { 'config2':copy.deepcopy(config2), 'input2':copy.deepcopy(input2), 'targetList':copy.deepcopy(targetList) } # Commented out by FDV, unused, simplifying # FirstEdge = False ### BEGIN INPUT GEN -------------------------------------------------------------------------------------------- print("\t\t" + 'EXAFS') xanesDir = config2['xcDir'] exafsDir = os.path.join(config2['cwd'],component_labels[absorber-1],edge,'EXAFS') config2['xcDir'] = exafsDir input2['feff.control'] = [[0, 1, 1, 1, 1, 1]] input2['feff.egrid'] = [['k_grid', -20, -2, 1], ['k_grid',-2,0,0.07], ['k_grid', 0, 40, 0.07],['exp_grid', 'last', 500000.0, 10.0]] if 'feff.fms' in input: input2['feff.rpath'] = [[max(input['feff.fms'][0][0],0.1)]] else: input2['feff.rpath'] = [[6.0]] input2['feff.fms'] = [[0.0]] ### END INPUT GEN -------------------------------------------------------------------------------------------- # Added by FDV Item_exafs = { 'config2':copy.deepcopy(config2), 'input2':copy.deepcopy(input2), 'targetList':copy.deepcopy(targetList) } Item_Absorber[edge] = { 'xanes':Item_xanes, 'exafs':Item_exafs } print('') WF_Params_Dict[absorber] = Item_Absorber print('') # OPCONS LOOP SETUP END --------------------------------------------------------------------------------------- # Debug: FDV print('#### FDV ####') print('#### All WF Params ####') pp_debug.pprint(WF_Params_Dict) # Monty has issue on 2.7, so will just use pickle import pickle pickle.dump(WF_Params_Dict,open('WF_Params_Dict.pickle','wb')) # Debug # sys.exit() # OPCONS LOOP RUN BEGIN --------------------------------------------------------------------------------------- # For each atom in absorbing_atoms run a full-spectrum calculation (all edges, XANES + EXAFS) for absorber in absorbers: print('') print("##########################################################") print(" Component: " + component_labels[absorber-1]) print("##########################################################") print('') print('--- FDV ---', 'absorber', absorber) for edge in WF_Params_Dict[absorber].keys(): print("\t" + edge) print("\t\t" + 'XANES') # Added by FDV # Modified by FDV # Commented out and moved to an independent loop print('--- FDV ---', 'edge', edge) config2 = WF_Params_Dict[absorber][edge]['xanes']['config2'] input2 = WF_Params_Dict[absorber][edge]['xanes']['input2'] targetList = WF_Params_Dict[absorber][edge]['xanes']['targetList'] if 'opcons.usesaved' not in input: generateAndRunWorkflow(config2, input2,targetList) else: # Run if xmu.dat doesn't exist. if not os.path.exists(os.path.join(config2['xcDir'],'xmu.dat')): generateAndRunWorkflow(config2, input2,targetList) else: print("\t\t\txmu.dat already calculated. Skipping.") ### BEGIN INPUT GEN -------------------------------------------------------------------------------------------- print("\t\t" + 'EXAFS') xanesDir = config2['xcDir'] exafsDir = os.path.join(config2['cwd'],component_labels[absorber-1],edge,'EXAFS') if not os.path.exists(exafsDir): os.makedirs(exafsDir) shutil.copyfile(os.path.join(xanesDir,'apot.bin'), os.path.join(exafsDir,'apot.bin')) shutil.copyfile(os.path.join(xanesDir,'pot.bin'), os.path.join(exafsDir,'pot.bin')) # Modified by FDV # Commented out and moved to an independent loop config2 = WF_Params_Dict[absorber][edge]['exafs']['config2'] input2 = WF_Params_Dict[absorber][edge]['exafs']['input2'] targetList = WF_Params_Dict[absorber][edge]['exafs']['targetList'] if 'opcons.usesaved' not in input2: generateAndRunWorkflow(config2, input2,targetList) else: # Run if xmu.dat doesn't exist. if not os.path.exists(os.path.join(config2['xcDir'],'xmu.dat')): generateAndRunWorkflow(config2, input2,targetList) print('') print('') # OPCONS LOOP RUN END ----------------------------------------------------------------------------------------- # OPCONS LOOP ANA BEGIN --------------------------------------------------------------------------------------- # For each atom in absorbing_atoms run a full-spectrum calculation (all edges, XANES + EXAFS) emin = 100000.0 for iabs,absorber in enumerate(absorbers): print('') print("##########################################################") print(" Component: " + component_labels[absorber-1]) print("##########################################################") print('') # Commented out by FDV, unused, simplifying # FirstEdge = True for edge in WF_Params_Dict[absorber].keys(): print("\t" + edge) print("\t\t" + 'XANES') # Added by FDV config2 = WF_Params_Dict[absorber][edge]['xanes']['config2'] input2 = WF_Params_Dict[absorber][edge]['xanes']['input2'] targetList = WF_Params_Dict[absorber][edge]['xanes']['targetList'] ### BEGIN OUTPUT ANA -------------------------------------------------------------------------------------------- if 'cif_input' in input: # Get total volume from cif in atomic units. vtot = cell_data.volume()*(cell_data.lengthscale/bohr)**3 else: # Get norman radii from xmu.dat with open(os.path.join(config2['xcDir'],'xmu.dat')) as f: for line in f: # Go through the lines one at a time words = line.split() if 'Rnm=' in words: vtot = vtot + (float(words[words.index('Rnm=')+1])/bohr)**3*4.0/3.0*np.pi break f.close() outFile = os.path.join(config2['xcDir'],'xmu.dat') e1,k1,xanes = np.loadtxt(outFile,usecols = (0,2,3)).T xanes = np.maximum(xanes,0.0) ### END OUTPUT ANA -------------------------------------------------------------------------------------------- # Added by FDV config2 = WF_Params_Dict[absorber][edge]['exafs']['config2'] input2 = WF_Params_Dict[absorber][edge]['exafs']['input2'] targetList = WF_Params_Dict[absorber][edge]['exafs']['targetList'] ### BEGIN OUTPUT ANA -------------------------------------------------------------------------------------------- outFile = os.path.join(config2['xcDir'],'xmu.dat') e2,k2,exafs,mu0 = np.loadtxt(outFile,usecols = (0,2,3,4)).T exafs = np.maximum(exafs,0.0) mu0 = np.maximum(mu0,0.0) e0 = e2[100] - (k2[100]*bohr)**2/2.0*hart emin = min(e0/2.0/hart,emin) # Interpolate onto a union of the two energy-grids and smoothly go from one to the other between e_tot = np.unique(np.append(e1,e2)) k_tot = np.where(e_tot > e0, np.sqrt(2.0*np.abs(e_tot-e0)/hart), -np.sqrt(2.0*np.abs(e0 - e_tot)/hart))/bohr kstart = 3.0 kfin = 4.0 weight1 = np.cos((np.minimum(np.maximum(k_tot,kstart),kfin)-kstart)/(kfin-kstart)*np.pi/2)**2 weight2 = 1.0 - weight1 #NumberDensity[iabs] = NumberDensity[iabs]/2.0 print('Number density', NumberDensity[iabs], vtot, NumberDensity[iabs]/vtot) xas_element = NumberDensity[iabs]*(np.interp(e_tot,e1,xanes)*weight1 + np.interp(e_tot,e2,exafs)*weight2) xas0_element = NumberDensity[iabs]*np.interp(e_tot,e2,mu0) xas_element[np.where(e_tot < e1[0])] = NumberDensity[iabs]*np.interp(e_tot[np.where(e_tot < e1[0])],e2,mu0) xas_arr = xas_arr + [xas_element] xas0_arr = xas0_arr + [xas0_element] en_arr = en_arr + [e_tot] #plt.plot(e_tot, xas_element) #plt.show() ### END OUTPUT ANA -------------------------------------------------------------------------------------------- print('') print('') # OPCONS LOOP ANA END ----------------------------------------------------------------------------------------- # POST LOOP ANALYSYS: If everything is correct we should not have to change anything below # Interpolate onto common grid from 0 to 500000 eV # Make common grid as union of all grids. energy_grid = np.unique(np.concatenate(en_arr)) # Now loop through all elements and add xas from each element xas_tot = np.zeros_like(energy_grid) xas0_tot = np.zeros_like(energy_grid) for i,en in enumerate(en_arr): xas_tot = xas_tot + np.interp(energy_grid,en,xas_arr[i],left=0.0,right=0.0) xas0_tot = xas0_tot + np.interp(energy_grid,en,xas0_arr[i],left=0.0,right=0.0) xas_tot = xas_tot/vtot xas0_tot = xas0_tot/vtot # transform to eps2. xas_tot*-4pi/apha/\omega*bohr**2 energy_grid = energy_grid/hart eps2 = xas_tot*4*np.pi*alpinv*bohr**2/energy_grid eps2 = eps2[np.where(energy_grid > emin)] eps2_bg = xas0_tot*4*np.pi*alpinv*bohr**2/energy_grid eps2_bg = eps2_bg[np.where(energy_grid > emin)] energy_grid = energy_grid[np.where(energy_grid > emin)] #plt.plot(energy_grid,eps2) #plt.show() if False: # Test with Lorentzian eps2 = -5.0/((energy_grid - 277.0)**2 + 5.0**2) + 5.0/((energy_grid + 277.0)**2 + 5.0**2) # Perform KK-transform print('Performaing KK-transform of eps2:') print('') w,eps1_bg = kk_transform(energy_grid, eps2_bg) w,eps1 = kk_transform(energy_grid, eps2) eps2 = np.interp(w,energy_grid,eps2) eps1 = eps1 + 1.0 eps2_bg = np.interp(w,energy_grid,eps2_bg) eps1_bg = eps1_bg + 1.0 eps_bg = eps1_bg + 1j*eps2_bg eps = eps1 + 1j*eps2 # Transform to optical constants index_of_refraction = np.sqrt(eps) index_of_refraction_bg = np.sqrt(eps_bg) reflectance = np.abs((index_of_refraction-1)/(index_of_refraction+1))**2 reflectance_bg = np.abs((index_of_refraction_bg-1)/(index_of_refraction_bg+1))**2 absorption = 2*w*1.0/alpinv*
np.imag(index_of_refraction)
numpy.imag
import importlib.resources import numpy as np from hexrd import constants from hexrd import symmetry, symbols from hexrd.spacegroup import Allowed_HKLs from hexrd.ipfcolor import sphere_sector, colorspace from hexrd.valunits import valWUnit import hexrd.resources import warnings import h5py from pathlib import Path from scipy.interpolate import interp1d import time eps = constants.sqrt_epsf class unitcell: ''' >> @AUTHOR: <NAME>, Lawrence Livermore National Lab, <EMAIL> >> @DATE: 10/09/2018 SS 1.0 original @DATE: 10/15/2018 SS 1.1 added space group handling >> @DETAILS: this is the unitcell class ''' # initialize the unitcell class # need lattice parameters and space group data from HDF5 file def __init__(self, lp, sgnum, atomtypes, charge, atominfo, U, dmin, beamenergy, sgsetting=0): self._tstart = time.time() self.pref = 0.4178214 self.atom_type = atomtypes self.chargestates = charge self.atom_pos = atominfo self._dmin = dmin self.lparms = lp self.U = U ''' initialize interpolation from table for anomalous scattering ''' self.InitializeInterpTable() ''' sets x-ray energy calculate wavelength also calculates anomalous form factors for xray scattering ''' self.voltage = beamenergy * 1000.0 ''' calculate symmetry ''' self.sgsetting = sgsetting self.sgnum = sgnum self._tstop = time.time() self.tinit = self._tstop - self._tstart def GetPgLg(self): ''' simple subroutine to get point and laue groups to maintain consistency for planedata initialization in the materials class ''' for k in list(_pgDict.keys()): if self.sgnum in k: pglg = _pgDict[k] self._pointGroup = pglg[0] self._laueGroup = pglg[1] self._supergroup = pglg[2] self._supergroup_laue = pglg[3] def CalcWavelength(self): # wavelength in nm self.wavelength = constants.cPlanck * \ constants.cLight / \ constants.cCharge / \ self.voltage self.wavelength *= 1e9 self.CalcAnomalous() def calcBetaij(self): self.betaij = np.zeros([self.atom_ntype, 3, 3]) for i in range(self.U.shape[0]): U = self.U[i, :] self.betaij[i, :, :] = np.array([[U[0], U[3], U[4]], [U[3], U[1], U[5]], [U[4], U[5], U[2]]]) self.betaij[i, :, :] *= 2. * np.pi**2 * self._aij def calcmatrices(self): a = self.a b = self.b c = self.c alpha = np.radians(self.alpha) beta = np.radians(self.beta) gamma = np.radians(self.gamma) ca = np.cos(alpha) cb = np.cos(beta) cg = np.cos(gamma) sa = np.sin(alpha) sb = np.sin(beta) sg = np.sin(gamma) tg = np.tan(gamma) ''' direct metric tensor ''' self._dmt = np.array([[a**2, a*b*cg, a*c*cb], [a*b*cg, b**2, b*c*ca], [a*c*cb, b*c*ca, c**2]]) self._vol = np.sqrt(np.linalg.det(self.dmt)) if(self.vol < 1e-5): warnings.warn('unitcell volume is suspiciously small') ''' reciprocal metric tensor ''' self._rmt = np.linalg.inv(self.dmt) ''' direct structure matrix ''' self._dsm = np.array([[a, b*cg, c*cb], [0., b*sg, -c*(cb*cg - ca)/sg], [0., 0., self.vol/(a*b*sg)]]) self._dsm[np.abs(self._dsm) < eps] = 0. ''' reciprocal structure matrix ''' self._rsm = np.array([[1./a, 0., 0.], [-1./(a*tg), 1./(b*sg), 0.], [b*c*(cg*ca - cb)/(self.vol*sg), a*c*(cb*cg - ca)/(self.vol*sg), a*b*sg/self.vol]]) self._rsm[np.abs(self._rsm) < eps] = 0. ast = self.CalcLength([1, 0, 0], 'r') bst = self.CalcLength([0, 1, 0], 'r') cst = self.CalcLength([0, 0, 1], 'r') self._aij = np.array([[ast**2, ast*bst, ast*cst], [bst*ast, bst**2, bst*cst], [cst*ast, cst*bst, cst**2]]) ''' transform between any crystal space to any other space. choices are 'd' (direct), 'r' (reciprocal) and 'c' (cartesian)''' def TransSpace(self, v_in, inspace, outspace): if(inspace == 'd'): if(outspace == 'r'): v_out = np.dot(v_in, self.dmt) elif(outspace == 'c'): v_out = np.dot(self.dsm, v_in) else: raise ValueError( 'inspace in ''d'' but outspace can''t be identified') elif(inspace == 'r'): if(outspace == 'd'): v_out = np.dot(v_in, self.rmt) elif(outspace == 'c'): v_out = np.dot(self.rsm, v_in) else: raise ValueError( 'inspace in ''r'' but outspace can''t be identified') elif(inspace == 'c'): if(outspace == 'r'): v_out = np.dot(v_in, self.rsm) elif(outspace == 'd'): v_out = np.dot(v_in, self.dsm) else: raise ValueError( 'inspace in ''c'' but outspace can''t be identified') else: raise ValueError('incorrect inspace argument') return v_out ''' calculate dot product of two vectors in any space 'd' 'r' or 'c' ''' def CalcDot(self, u, v, space): if(space == 'd'): dot = np.dot(u, np.dot(self.dmt, v)) elif(space == 'r'): dot = np.dot(u, np.dot(self.rmt, v)) elif(space == 'c'): dot = np.dot(u, v) else: raise ValueError('space is unidentified') return dot ''' calculate dot product of two vectors in any space 'd' 'r' or 'c' ''' def CalcLength(self, u, space): if(space == 'd'): vlen = np.sqrt(np.dot(u, np.dot(self.dmt, u))) elif(space == 'r'): vlen = np.sqrt(np.dot(u, np.dot(self.rmt, u))) elif(space == 'c'): vlen = np.linalg.norm(u) else: raise ValueError('incorrect space argument') return vlen ''' normalize vector in any space 'd' 'r' or 'c' ''' def NormVec(self, u, space): ulen = self.CalcLength(u, space) return u/ulen ''' calculate angle between two vectors in any space''' def CalcAngle(self, u, v, space): ulen = self.CalcLength(u, space) vlen = self.CalcLength(v, space) dot = self.CalcDot(u, v, space)/ulen/vlen angle = np.arccos(dot) return angle ''' calculate cross product between two vectors in any space. cross product of two vectors in direct space is a vector in reciprocal space cross product of two vectors in reciprocal space is a vector in direct space the outspace specifies if a conversion needs to be made @NOTE: iv is the switch (0/1) which will either turn division by volume of the unit cell on or off.''' def CalcCross(self, p, q, inspace, outspace, vol_divide=False): iv = 0 if(vol_divide): vol = self.vol else: vol = 1.0 pxq = np.array([p[1]*q[2]-p[2]*q[1], p[2]*q[0]-p[0]*q[2], p[0]*q[1]-p[1]*q[0]]) if(inspace == 'd'): ''' cross product vector is in reciprocal space and can be converted to direct or cartesian space ''' pxq *= vol if(outspace == 'r'): pass elif(outspace == 'd'): pxq = self.TransSpace(pxq, 'r', 'd') elif(outspace == 'c'): pxq = self.TransSpace(pxq, 'r', 'c') else: raise ValueError( 'inspace is ''d'' but outspace is unidentified') elif(inspace == 'r'): ''' cross product vector is in direct space and can be converted to any other space ''' pxq /= vol if(outspace == 'r'): pxq = self.TransSpace(pxq, 'd', 'r') elif(outspace == 'd'): pass elif(outspace == 'c'): pxq = self.TransSpace(pxq, 'd', 'c') else: raise ValueError( 'inspace is ''r'' but outspace is unidentified') elif(inspace == 'c'): ''' cross product is already in cartesian space so no volume factor is involved. can be converted to any other space too ''' if(outspace == 'r'): pxq = self.TransSpace(pxq, 'c', 'r') elif(outspace == 'd'): pxq = self.TransSpace(pxq, 'c', 'd') elif(outspace == 'c'): pass else: raise ValueError( 'inspace is ''c'' but outspace is unidentified') else: raise ValueError('inspace is unidentified') return pxq def GenerateRecipPGSym(self): self.SYM_PG_r = self.SYM_PG_d[0, :, :] self.SYM_PG_r = np.broadcast_to(self.SYM_PG_r, [1, 3, 3]) self.SYM_PG_r_laue = self.SYM_PG_d[0, :, :] self.SYM_PG_r_laue = np.broadcast_to(self.SYM_PG_r_laue, [1, 3, 3]) for i in range(1, self.npgsym): g = self.SYM_PG_d[i, :, :] g = np.dot(self.dmt, np.dot(g, self.rmt)) g = np.round(np.broadcast_to(g, [1, 3, 3])) self.SYM_PG_r = np.concatenate((self.SYM_PG_r, g)) for i in range(1, self.SYM_PG_d_laue.shape[0]): g = self.SYM_PG_d_laue[i, :, :] g = np.dot(self.dmt, np.dot(g, self.rmt)) g = np.round(np.broadcast_to(g, [1, 3, 3])) self.SYM_PG_r_laue = np.concatenate((self.SYM_PG_r_laue, g)) self.SYM_PG_r = self.SYM_PG_r.astype(np.int32) self.SYM_PG_r_laue = self.SYM_PG_r_laue.astype(np.int32) def GenerateCartesianPGSym(self): ''' use the direct point group symmetries to generate the symmetry operations in the cartesian frame. this is used to reduce directions to the standard stereographi tringle ''' self.SYM_PG_c = [] self.SYM_PG_c_laue = [] for sop in self.SYM_PG_d: self.SYM_PG_c.append(np.dot(self.dsm, np.dot(sop, self.rsm.T))) self.SYM_PG_c = np.array(self.SYM_PG_c) self.SYM_PG_c[np.abs(self.SYM_PG_c) < eps] = 0. if(self._pointGroup == self._laueGroup): self.SYM_PG_c_laue = self.SYM_PG_c else: for sop in self.SYM_PG_d_laue: self.SYM_PG_c_laue.append( np.dot(self.dsm, np.dot(sop, self.rsm.T))) self.SYM_PG_c_laue = np.array(self.SYM_PG_c_laue) self.SYM_PG_c_laue[np.abs(self.SYM_PG_c_laue) < eps] = 0. ''' use the point group symmetry of the supergroup to generate the equivalent operations in the cartesian reference frame SS 11/23/2020 added supergroup symmetry operations SS 11/24/2020 fix monoclinic groups separately since the supergroup for monoclinic is orthorhombic ''' supergroup = self._supergroup sym_supergroup = symmetry.GeneratePGSYM(supergroup) supergroup_laue = self._supergroup_laue sym_supergroup_laue = symmetry.GeneratePGSYM(supergroup_laue) if((self.latticeType == 'monoclinic' or self.latticeType == 'triclinic')): ''' for monoclinic groups c2 and c2h, the supergroups are orthorhombic, so no need to convert from direct to cartesian as they are identical ''' self.SYM_PG_supergroup = sym_supergroup self.SYM_PG_supergroup_laue = sym_supergroup_laue else: self.SYM_PG_supergroup = [] self.SYM_PG_supergroup_laue = [] for sop in sym_supergroup: self.SYM_PG_supergroup.append( np.dot(self.dsm, np.dot(sop, self.rsm.T))) self.SYM_PG_supergroup = np.array(self.SYM_PG_supergroup) self.SYM_PG_supergroup[np.abs(self.SYM_PG_supergroup) < eps] = 0. for sop in sym_supergroup_laue: self.SYM_PG_supergroup_laue.append( np.dot(self.dsm, np.dot(sop, self.rsm.T))) self.SYM_PG_supergroup_laue = np.array(self.SYM_PG_supergroup_laue) self.SYM_PG_supergroup_laue[np.abs( self.SYM_PG_supergroup_laue) < eps] = 0. ''' the standard setting for the monoclinic system has the b-axis aligned with the 2-fold axis. this needs to be accounted for when reduction to the standard stereographic triangle is performed. the siplest way is to rotate all symmetry elements by 90 about the x-axis the supergroups for the monoclinic groups are orthorhombic so they need not be rotated as they have the c* axis already aligned with the z-axis SS 12/10/2020 ''' if(self.latticeType == 'monoclinic'): om = np.array([[1., 0., 0.], [0., 0., 1.], [0., -1., 0.]]) for i, s in enumerate(self.SYM_PG_c): ss = np.dot(om, np.dot(s, om.T)) self.SYM_PG_c[i, :, :] = ss for i, s in enumerate(self.SYM_PG_c_laue): ss = np.dot(om, np.dot(s, om.T)) self.SYM_PG_c_laue[i, :, :] = ss ''' for the triclinic group c1, the supergroups are the monoclinic group m therefore we need to rotate the mirror to be perpendicular to the z-axis same shouldn't be done for the group ci, since the supergroup is just the triclinic group c1!! SS 12/10/2020 ''' if(self._pointGroup == 'c1'): om = np.array([[1., 0., 0.], [0., 0., 1.], [0., -1., 0.]]) for i, s in enumerate(self.SYM_PG_supergroup): ss = np.dot(om, np.dot(s, om.T)) self.SYM_PG_supergroup[i, :, :] = ss for i, s in enumerate(self.SYM_PG_supergroup_laue): ss = np.dot(om, np.dot(s, om.T)) self.SYM_PG_supergroup_laue[i, :, :] = ss def CalcOrbit(self, v, reduceToUC=True): """ @date 03/04/2021 SS 1.0 original @details calculate the equivalent position for the space group symmetry. this function will replace the code in the CalcPositions subroutine. @params v is the factional coordinates in direct space reduceToUC reduces the position to the fundamental fractional unit cell (0-1) """ asym_pos = [] n = 1 if v.shape[0] != 3: raise RuntimeError("fractional coordinate in not 3-d") r = v # using wigner-sietz notation r = np.hstack((r, 1.)) asym_pos = np.broadcast_to(r[0:3], [1, 3]) for symmat in self.SYM_SG: # get new position rnew = np.dot(symmat, r) rr = rnew[0:3] if reduceToUC: # reduce to fundamental unitcell with fractional # coordinates between 0-1 rr = np.modf(rr)[0] rr[rr < 0.] += 1. rr[np.abs(rr) < 1.0E-6] = 0. # check if this is new isnew = True for j in range(n): v = rr - asym_pos[j] dist = self.CalcLength(v, 'd') if dist < 1E-3: isnew = False break # if its new add this to the list if(isnew): asym_pos = np.vstack((asym_pos, rr)) n += 1 numat = n return asym_pos, numat def CalcStar(self, v, space, applyLaue=False): ''' this function calculates the symmetrically equivalent hkls (or uvws) for the reciprocal (or direct) point group symmetry. ''' if(space == 'd'): if(applyLaue): sym = self.SYM_PG_d_laue else: sym = self.SYM_PG_d elif(space == 'r'): if(applyLaue): sym = self.SYM_PG_r_laue else: sym = self.SYM_PG_r else: raise ValueError('CalcStar: unrecognized space.') vsym = np.atleast_2d(v) for s in sym: vp = np.dot(s, v) # check if this is new isnew = True for vec in vsym: vv = vp - vec dist = self.CalcLength(vv, space) if dist < 1E-3: isnew = False break if(isnew): vsym = np.vstack((vsym, vp)) return vsym def CalcPositions(self): ''' calculate the asymmetric positions in the fundamental unitcell used for structure factor calculations ''' numat = [] asym_pos = [] for i in range(self.atom_ntype): v = self.atom_pos[i, 0:3] apos, n = self.CalcOrbit(v) asym_pos.append(apos) numat.append(n) self.numat = np.array(numat) self.asym_pos = asym_pos def remove_duplicate_atoms(self, atom_pos=None, tol=1e-3): """ @date 03/04/2021 SS 1.0 original @details it was requested that a functionality be added which can remove duplicate atoms from the atom_pos field such that no two atoms are closer that the distance specified by "tol" (lets assume its in A) steps involved are as follows: 1. get the star (or orbit) oe each point in atom_pos 2. if any points in the orbits are within tol, then remove the second point (the first point will be preserved by convention) 3. update the densities, interptables for structure factors etc. @params tol tolerance of distance between points specified in A """ if atom_pos is None: atom_pos = self.atom_pos atom_pos_fixed = [] """ go through the atom_pos and remove the atoms that are duplicate """ for i in range(atom_pos.shape[0]): pos = atom_pos[i, 0:3] occ = atom_pos[i, 3] v1, n1 = self.CalcOrbit(pos) for j in range(i+1, atom_pos.shape[0]): isclose = False atom_pos_fixed.append(np.hstack([pos, occ])) pos = atom_pos[j, 0:3] occ = atom_pos[j, 3] v2, n2 = self.CalcOrbit(pos) for v in v2: vv = np.tile(v, [v1.shape[0], 1]) vv = vv - v1 for vvv in vv: # check if distance less than tol # the factor of 10 is for A --> nm if self.CalcLength(vvv, 'd') < tol/10.: # if true then its a repeated atom isclose = True break if isclose: break if isclose: break else: atom_pos_fixed.append(np.hstack([pos, occ])) return np.array(atom_pos_fixed) def CalcDensity(self): ''' calculate density, average atomic weight (avA) and average atomic number(avZ) ''' self.avA = 0.0 self.avZ = 0.0 for i in range(self.atom_ntype): ''' atype is atom type i.e. atomic number numat is the number of atoms of atype atom_pos(i,3) has the occupation factor ''' atype = self.atom_type[i] numat = self.numat[i] occ = self.atom_pos[i, 3] # -1 due to 0 indexing in python self.avA += numat * constants.atom_weights[atype-1] * occ self.avZ += numat * atype self.density = self.avA / (self.vol * 1.0E-21 * constants.cAvogadro) av_natom = np.dot(self.numat, self.atom_pos[:, 3]) self.avA /= av_natom self.avZ /= np.sum(self.numat) ''' calculate the maximum index of diffraction vector along each of the three reciprocal basis vectors ''' def init_max_g_index(self): """ added 03/17/2021 SS """ self.ih = 1 self.ik = 1 self.il = 1 def CalcMaxGIndex(self): self.init_max_g_index() while (1.0 / self.CalcLength( np.array([self.ih, 0, 0], dtype=np.float64), 'r') > self.dmin): self.ih = self.ih + 1 while (1.0 / self.CalcLength( np.array([0, self.ik, 0], dtype=np.float64), 'r') > self.dmin): self.ik = self.ik + 1 while (1.0 / self.CalcLength( np.array([0, 0, self.il], dtype=np.float64), 'r') > self.dmin): self.il = self.il + 1 def InitializeInterpTable(self): self.f1 = {} self.f2 = {} self.f_anam = {} data = importlib.resources.open_binary(hexrd.resources, 'Anomalous.h5') with h5py.File(data, 'r') as fid: for i in range(0, self.atom_ntype): Z = self.atom_type[i] elem = constants.ptableinverse[Z] gid = fid.get('/'+elem) data = gid.get('data') self.f1[elem] = interp1d(data[:, 7], data[:, 1]) self.f2[elem] = interp1d(data[:, 7], data[:, 2]) def CalcAnomalous(self): for i in range(self.atom_ntype): Z = self.atom_type[i] elem = constants.ptableinverse[Z] f1 = self.f1[elem](self.wavelength) f2 = self.f2[elem](self.wavelength) frel = constants.frel[elem] Z = constants.ptable[elem] self.f_anam[elem] = np.complex(f1+frel-Z, f2) def CalcXRFormFactor(self, Z, charge, s): ''' we are using the following form factors for x-aray scattering: 1. coherent x-ray scattering, f0 tabulated in Acta Cryst. (1995). A51,416-431 2. Anomalous x-ray scattering (complex (f'+if")) tabulated in J. Phys. Chem. Ref. Data, 24, 71 (1995) and J. Phys. Chem. Ref. Data, 29, 597 (2000). 3. Thompson nuclear scattering, fNT tabulated in Phys. Lett. B, 69, 281 (1977). the anomalous scattering is a complex number (f' + if"), where the two terms are given by f' = f1 + frel - Z f" = f2 f1 and f2 have been tabulated as a function of energy in Anomalous.h5 in hexrd folder overall f = (f0 + f' + if" +fNT) ''' elem = constants.ptableinverse[Z] if charge == '0': sfact = constants.scatfac[elem] else: sfact = constants.scatfac[f"{elem}{charge}"] fe = sfact[5] fNT = constants.fNT[elem] frel = constants.frel[elem] f_anomalous = self.f_anam[elem] for i in range(5): fe += sfact[i] * np.exp(-sfact[i+6]*s) return (fe+fNT+f_anomalous) def CalcXRSF(self, hkl): ''' the 1E-2 is to convert to A^-2 since the fitting is done in those units ''' s = 0.25 * self.CalcLength(hkl, 'r')**2 * 1E-2 sf = np.complex(0., 0.) for i in range(0, self.atom_ntype): Z = self.atom_type[i] charge = self.chargestates[i] ff = self.CalcXRFormFactor(Z, charge, s) if(self.aniU): T = np.exp(-np.dot(hkl, np.dot(self.betaij[i, :, :], hkl))) else: T = np.exp(-8.0*np.pi**2 * self.U[i]*s) ff *= self.atom_pos[i, 3] * T for j in range(self.asym_pos[i].shape[0]): arg = 2.0 * np.pi * np.sum(hkl * self.asym_pos[i][j, :]) sf = sf + ff * np.complex(np.cos(arg), -np.sin(arg)) return np.abs(sf)**2 ''' calculate bragg angle for a reflection. returns Nan if the reflections is not possible for the voltage/wavelength ''' def CalcBraggAngle(self, hkl): glen = self.CalcLength(hkl, 'r') sth = self.wavelength * glen * 0.5 return np.arcsin(sth) def ChooseSymmetric(self, hkllist, InversionSymmetry=True): ''' this function takes a list of hkl vectors and picks out a subset of the list picking only one of the symmetrically equivalent one. The convention is to choose the hkl with the most positive components. ''' mask = np.ones(hkllist.shape[0], dtype=np.bool) laue = InversionSymmetry for i, g in enumerate(hkllist): if(mask[i]): geqv = self.CalcStar(g, 'r', applyLaue=laue) for r in geqv[1:, ]: rid = np.where(np.all(r == hkllist, axis=1)) mask[rid] = False hkl = hkllist[mask, :].astype(np.int32) hkl_max = [] for g in hkl: geqv = self.CalcStar(g, 'r', applyLaue=laue) loc = np.argmax(np.sum(geqv, axis=1)) gmax = geqv[loc, :] hkl_max.append(gmax) return np.array(hkl_max).astype(np.int32) def SortHKL(self, hkllist): ''' this function sorts the hkllist by increasing |g| i.e. decreasing d-spacing. If two vectors are same length, then they are ordered with increasing priority to l, k and h ''' glen = [] for g in hkllist: glen.append(np.round(self.CalcLength(g, 'r'), 8)) # glen = np.atleast_2d(np.array(glen,dtype=np.float)).T dtype = [('glen', float), ('max', int), ('sum', int), ('h', int), ('k', int), ('l', int)] a = [] for i, gl in enumerate(glen): g = hkllist[i, :] a.append((gl, np.max(g), np.sum(g), g[0], g[1], g[2])) a = np.array(a, dtype=dtype) isort =
np.argsort(a, order=['glen', 'max', 'sum', 'l', 'k', 'h'])
numpy.argsort
#!/usr/bin/env python3 """ @author: <NAME> This script contains all functions used for text pre-processing and for computing Jensen-Shannon Divergence (JSD), Random JSD, and Coherence. """ from textblob import TextBlob, Word from nltk.util import ngrams from nltk.probability import FreqDist from scipy.spatial import distance from sklearn.feature_extraction.text import CountVectorizer import sklearn import numpy as np import swifter import pandas as pd from ast import literal_eval from scipy import sparse # ------------------------------------------------------------------------------------ # f = open('stop_words.txt', 'r') stop_words = [word.rstrip('\n') for word in f] def preprocess_text(doc, n_grams='one'): """ Pre-processing using TextBlob: tokenizing, converting to lower-case, and lemmatization based on POS tagging, removing stop-words, and retaining tokens greater than length 2 We can also choose to include n_grams (n = 1,2,3) in the final output Argument(s): 'doc' - a string of words or sentences. 'n_grams' - one: only unigrams (tokens consisting of one word each) - two: only bigrams - two_plus: unigrams + bigrams - three: only trigrams - three_plus: unigrams + bigrams + trigrams Output: 'reuslt_singles' - a list of pre-processed tokens (individual words) of each sentence in 'doc' 'result_ngrams' - a list of pre-processed tokens (including n-grams) of each sentence in 'doc' """ blob = TextBlob(doc).lower() # lang = blob.detect_language() # print(lang) # if lang != 'en': # blob = blob.translate(to = 'en') result_singles = [] tag_dict = {"J": 'a', # Adjective "N": 'n', # Noun "V": 'v', # Verb "R": 'r'} # Adverb # For all other types of parts of speech (including those not classified at all) # the tag_dict object maps to 'None' # the method w.lemmatize() defaults to 'Noun' as POS for those classified as 'None' for sent in blob.sentences: words_and_tags = [(w, tag_dict.get(pos[0])) for w, pos in sent.tags] lemmatized_list = [w.lemmatize(tag) for w, tag in words_and_tags] for i in range(len(lemmatized_list)): if lemmatized_list[i] not in stop_words and len(lemmatized_list[i].lower()) > 2 and not lemmatized_list[i].isdigit(): result_singles.append(lemmatized_list[i].lower()) result_bigrams = ['_'.join(x) for x in ngrams(result_singles, 2)] # result_bigrams = [ # token for token in result_bigrams if token != 'psychological_association'] result_trigrams = ['_'.join(x) for x in ngrams(result_singles, 3)] result_two_plus = result_singles + result_bigrams result_three_plus = result_singles + result_bigrams + result_trigrams if n_grams == 'one': result = result_singles elif n_grams == 'two': result = result_bigrams elif n_grams == 'three': result = result_trigrams elif n_grams == 'two_plus': result = result_two_plus elif n_grams == 'three_plus': result = result_three_plus return result # ------------------------------------------------------------------------------------ # def get_frequency(processed_text_list): """ Using a built-in NLTK function that generates tuples We get the frequency distribution of all words/n-grams in a tokenized list We can get the proportion of the the token as a fraction of the total corpus size ----> N/A We can also sort these frequencies and proportions in descending order in a dictionary object ----> N/A Argument(s): 'processed_text_list' - A list of pre-processed tokens Output(s): freq_dict - A dictionary of tokens and their respective frequencies in descending order """ # prop_dict - A dictionary of tokens and their respective proportions as a fraction of the total corpus # combined_dict - A dictionary whose values are both frequencies and proportions combined within a list # """ word_frequency = FreqDist(word for word in processed_text_list) # sorted_counts = sorted(word_frequency.items(), key = lambda x: x[1], reverse = True) # freq_dict = dict(sorted_counts) freq_dict = dict(word_frequency) # prop_dict = {key : freq_dict[key] * 1.0 / sum(freq_dict.values()) for key, value in freq_dict.items()} # combined_dict = {key : [freq_dict[key], freq_dict[key] * 1.0 / sum(freq_dict.values())] for key, value in freq_dict.items()} return freq_dict # , prop_dict, combined_dict # ------------------------------------------------------------------------------------ # def merge_vocab_dictionary(vocab_column): """ Takes any number of token frequency dictionaries and merges them while summing the respective frequencies and then calculates the proportion of the the tokens as a fraction of the total corpus size and saves to text and CSV files Argument(s): vocab_column - A list/pandas column of dictionary objects Output(s): merged_freq_dict - A list object containing the frequencies of all merged dictionary tokens """ merged_freq_dict = {} for dictionary in vocab_column: for key, value in dictionary.items(): # d.items() in Python 3+ merged_freq_dict.setdefault(key, []).append(1) for key, value in merged_freq_dict.items(): merged_freq_dict[key] = sum(value) # # In case we also want proportion of frequency along with counts # total_sum = sum(merged_freq_dict.values()) # merged_prop_dict = {key : merged_freq_dict[key] * 1.0 / total_sum for key, value in merged_freq_dict.items()} # merged_combined_dict = {key : [merged_freq_dict[key], (merged_freq_dict[key] * 1.0 / total_sum)] for key, value in merged_freq_dict.items()} return merged_freq_dict # ------------------------------------------------------------------------------------ # def remove_less_than(frequency_dict, min_threshold = 1): """ Remove any tokens that appear fewer than the min_threshold number of times in a token-frequency dictionary Argument(s): 'frequency_dict' - a dictionary of token-frequency pairs 'min_threshold' - Minimum threshold of token frequency to be retained Output: 'retained' - a dictionary of all token-frequency pairs after removing tokens with frequency less than min_threshold """ retained_dict = {key : value for key, value in frequency_dict.items() if (value > min_threshold)} return retained_dict # ------------------------------------------------------------------------------------ # def filter_after_preprocess(processed_tokens, retained_dict): """ Removes any tokens not in the retained_dict from a list of processed tokens Argument(s): processed_tokens - a list of pre-processed token retained_dict - a token-frequency dictionary of tokens retained after removing tokens up to min_threshold frequency Output: filtered - a list of tokens remaining after filtering out those that are absent from retained_dict """ filtered = [] for token in processed_tokens: if token in retained_dict.keys(): filtered.append(token) return filtered # ------------------------------------------------------------------------------------ # def vectorize(text, corpus_by_cluster, count_vectorizer): """ Takes a list and converts it into a vector of document-term probability based on the given corpus Argument(s): text - a list of pre-processed tokens corpus_by_cluster - a list of the corpus tokens count_vectorizer - scikit-learn's Countvectorizer() Output: article_prob_vec - a list of document-term probabilities """ article_count_mat = count_vectorizer.transform([' '.join(text)]) article_sum = sparse.diags(1/article_count_mat.sum(axis=1).A.ravel()) article_prob_vec = (article_sum @ article_count_mat).toarray() return article_prob_vec # ------------------------------------------------------------------------------------ # def calculate_jsd(doc_prob_vec, cluster_prob_vec): """ Computes the Jensen-Shannon Distance (square root of Jensen-Shannon Divergence) Argument(s): doc_prob_vec - a list of document-term probabilites cluster_prob_vec - a list of corpus-term probabilites Output: jsd - Jensen-Shannon Distance between the doc_prob_vec and cluster_prob_vec """ jsd = distance.jensenshannon(doc_prob_vec.tolist()[0], cluster_prob_vec) return jsd # ------------------------------------------------------------------------------------ # def compute_jsd(data_text, name, val, cluster_num): """ Computes the JSD for a cluster dataframe where each row is an article Argument(s): data_text - an article cluster dataframe name - type of edge-weight used (no-weight, scopus frequency weight, normalized cluster frequency) val - inflation value used (for MCL) cluster_num - cluster number to compute JSD for Output: result_dict - a dictionary of JSD output for one cluster """ original_cluster_size = len(data_text) data_text = data_text.dropna() final_cluster_size = len(data_text) if final_cluster_size < 10: result_dict = { 'weight': name, 'inflation': val, 'cluster': cluster_num, 'total_size': original_cluster_size, 'pre_jsd_size': final_cluster_size, 'missing_values': (original_cluster_size-final_cluster_size), 'post_jsd_size': None, 'jsd_nans': None, 'mean_jsd': None, 'min_jsd': None, 'percentile_25_jsd': None, 'median_jsd': None, 'percentile_75_jsd': None, 'max_jsd': None, 'std_dev_jsd': None, 'total_unique_unigrams': None, 'final_unique_unigrams': None, 'size_1_unigram_prop': None} else: # data_text['all_text'] = data_text["title"] + " " + data_text["abstract_text"] # data_text['processed_all_text'] = data_text["all_text"].swifter.progress_bar(False).apply(preprocess_text) # If pre-processing is already done: data_text['processed_all_text'] = data_text['processed_all_text'].str.split() data_text['processed_all_text_frequencies'] = data_text['processed_all_text'].swifter.progress_bar(False).apply(get_frequency) data_all_text_frequency = merge_vocab_dictionary(data_text['processed_all_text_frequencies']) retained_dict = remove_less_than(data_all_text_frequency) data_text['filtered_text'] = data_text['processed_all_text'].swifter.progress_bar(False).apply(filter_after_preprocess, args = (retained_dict,)) mcl_all_text = data_text.filtered_text.tolist() corpus_by_article = [' '.join(text) for text in mcl_all_text] corpus_by_cluster = [' '.join(corpus_by_article)] count_vectorizer = CountVectorizer(lowercase=False, vocabulary=list(set(corpus_by_cluster[0].split()))) cluster_count_mat = count_vectorizer.fit_transform(corpus_by_cluster) data_text['probability_vector'] = data_text['filtered_text'].swifter.progress_bar(False).apply(vectorize, args=(corpus_by_cluster, count_vectorizer,)) cluster_sum = sparse.diags(1/cluster_count_mat.sum(axis=1).A.ravel()) cluster_prob_vec = (cluster_sum @ cluster_count_mat).toarray().tolist()[0] data_text['JS_distance'] = data_text['probability_vector'].swifter.progress_bar(False).apply(calculate_jsd, args = (cluster_prob_vec,)) data_text = data_text.dropna() data_text['JS_divergence'] = np.square(data_text['JS_distance']) jsd_cluster_size = len(data_text) jsd_min = min(data_text['JS_divergence']) jsd_25_percentile =
np.percentile(data_text['JS_divergence'], 25)
numpy.percentile
# -*- coding: utf-8 -*- """ Copyright 2018 NAVER Corp. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ import os import tensorflow as tf import numpy as np import time import math from kin_kor_char_parser import decompose_str_as_one_hot LOCAL_DATASET_PATH = '../sample_data/kin/' from soy.soy.nlp.tokenizer import CohesionTokenizer, RegexTokenizer from gensim.models import Word2Vec class KinQueryDataset: """ 지식인 데이터를 읽어서, tuple (데이터, 레이블)의 형태로 리턴하는 파이썬 오브젝트 입니다. """ def __init__(self, dataset_path: str, max_length: int): """ :param dataset_path: 데이터셋 root path :param max_length: 문자열의 최대 길이 400 """ # 데이터, 레이블 각각의 경로 queries_path = os.path.join(dataset_path, 'train', 'train_data') labels_path = os.path.join(dataset_path, 'train', 'train_label') # 지식인 데이터를 읽고 preprocess까지 진행합니다 self.test_idx = -1 with open(queries_path, 'rt', encoding='utf8') as f: #self.queries1, self.queries2,self.queries1_test,self.queries2_test,self.test_idx = preprocess2(f.readlines(), max_length,test_data=True) self.queries1, self.queries2= preprocess2(f.readlines(), max_length,test_data=False) #self.queries,self.queries_test,self.test_idx = preprocess_origin(f.readlines(),max_length,test_data=True) # 지식인 레이블을 읽고 preprocess까지 진행합니다. with open(labels_path) as f: self.labels = np.array([[np.float32(x)] for x in f.readlines()]) if self.test_idx != -1: self.labels_test = self.labels[self.test_idx:] self.labels = self.labels[:self.test_idx] print("test data splited size %d" % self.test_idx) def __len__(self): """ :return: 전체 데이터의 수를 리턴합니다 """ return len(self.labels) def __getitem__(self, idx): """ :param idx: 필요한 데이터의 인덱스 :return: 인덱스에 맞는 데이터, 레이블 pair를 리턴합니다 """ return self.queries1[idx], self.queries2[idx] ,self.labels[idx] def add_noise(query): query = query + (query * (0.001) * ((np.random.rand(1) - 0.5))) query = np.rint(query) query = query.astype(np.int32) return query def data_augmentation(queries1,queries2,labels): # Add noise in query data def get_noised_queries(queries): # Expand query numpy array size q_expand = np.zeros((len(queries) * 2, len(queries[0])), dtype=np.int32) np.random.seed(int(time.time())) for i in range(len(q_expand)): if i < len(queries): q_expand[i] = queries[i] else: noised_val = add_noise(queries[i - len(queries)]) q_expand[i] = noised_val return q_expand def get_double_labels(labels): l_expand = np.zeros((len(labels) * 2,1), dtype=np.int32) for i in range(len(l_expand)): if i < len(labels): l_expand[i] = labels[i] else: l_expand[i] = labels[i - len(labels)] return l_expand q1_expand = get_noised_queries(queries1) q2_expand = get_noised_queries(queries2) l_expand = get_double_labels(labels) return q1_expand, q2_expand, l_expand def preprocess2(data: list, max_length: int, test_data: bool): """ 입력을 받아서 딥러닝 모델이 학습 가능한 포맷으로 변경하는 함수입니다. 기본 제공 알고리즘은 char2vec이며, 기본 모델이 MLP이기 때문에, 입력 값의 크기를 모두 고정한 벡터를 리턴합니다. 문자열의 길이가 고정값보다 길면 긴 부분을 제거하고, 짧으면 0으로 채웁니다. :param data: 문자열 리스트 ([문자열1, 문자열2, ...]) :param max_length: 문자열의 최대 길이 :return: 벡터 리스트 ([[0, 1, 5, 6], [5, 4, 10, 200], ...]) max_length가 4일 때 """ query1 =[] query2 =[] for d in data: q1,q2 = d.split('\t') query1.append(q1) query2.append(q2.replace('\n','')) vectorized_data1 = [decompose_str_as_one_hot(datum, warning=False) for datum in query1] vectorized_data2 = [decompose_str_as_one_hot(datum, warning=False) for datum in query2] if test_data : data_size = (len(data)) test_size = (int)(data_size * 0.03) train_size = data_size - test_size zero_padding1 = np.zeros((train_size, max_length), dtype=np.int32) zero_padding2 = np.zeros((train_size, max_length), dtype=np.int32) zero_padding1_test = np.zeros((test_size, max_length), dtype=np.int32) zero_padding2_test = np.zeros((test_size, max_length), dtype=np.int32) for idx, seq in enumerate(vectorized_data1): if idx < train_size: length = len(seq) if length >= max_length: length = max_length zero_padding1[idx, :length] = np.array(seq)[:length] else: zero_padding1[idx, :length] = np.array(seq) else: length = len(seq) if length >= max_length: length = max_length zero_padding1_test[idx - train_size, :length] = np.array(seq)[:length] else: zero_padding1_test[idx - train_size, :length] = np.array(seq) for idx, seq in enumerate(vectorized_data2): if idx < train_size: length = len(seq) if length >= max_length: length = max_length zero_padding2[idx, :length] = np.array(seq)[:length] else: zero_padding2[idx, :length] = np.array(seq) else: length = len(seq) if length >= max_length: length = max_length zero_padding2_test[idx - train_size, :length] = np.array(seq)[:length] else: zero_padding2_test[idx - train_size, :length] = np.array(seq) return zero_padding1,zero_padding2, zero_padding1_test,zero_padding2_test, train_size else: data_size = (len(data)) test_size = (int)(data_size * 0.03) train_size = data_size - test_size zero_padding1 = np.zeros((data_size, max_length), dtype=np.int32) zero_padding2 = np.zeros((data_size, max_length), dtype=np.int32) for idx, seq in enumerate(vectorized_data1): length = len(seq) if length >= max_length: length = max_length zero_padding1[idx, :length] = np.array(seq)[:length] else: zero_padding1[idx, :length] =
np.array(seq)
numpy.array
__license__ = """ Copyright (c) 2012 mpldatacursor developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ import numpy as np import matplotlib.transforms as mtransforms from mpl_toolkits import mplot3d #-- Artist-specific pick info functions -------------------------------------- def _coords2index(im, x, y, inverted=False): """ Converts data coordinates to index coordinates of the array. Parameters ----------- im : An AxesImage instance The image artist to operation on x : number The x-coordinate in data coordinates. y : number The y-coordinate in data coordinates. inverted : bool, optional If True, convert index to data coordinates instead of data coordinates to index. Returns -------- i, j : Index coordinates of the array associated with the image. """ xmin, xmax, ymin, ymax = im.get_extent() if im.origin == 'upper': ymin, ymax = ymax, ymin data_extent = mtransforms.Bbox([[ymin, xmin], [ymax, xmax]]) array_extent = mtransforms.Bbox([[0, 0], im.get_array().shape[:2]]) trans = mtransforms.BboxTransformFrom(data_extent) +\ mtransforms.BboxTransformTo(array_extent) if inverted: trans = trans.inverted() return trans.transform_point([y,x]).astype(int) def image_props(event): """ Get information for a pick event on an ``AxesImage`` artist. Returns a dict of "i" & "j" index values of the image for the point clicked, and "z": the (uninterpolated) value of the image at i,j. Parameters ----------- event : PickEvent The pick event to process Returns -------- props : dict A dict with keys: z, i, j """ x, y = event.mouseevent.xdata, event.mouseevent.ydata i, j = _coords2index(event.artist, x, y) z = event.artist.get_array()[i,j] if z.size > 1: # Override default numpy formatting for this specific case. Bad idea? z = ', '.join('{:0.3g}'.format(item) for item in z) return dict(z=z, i=i, j=j) def line_props(event): """ Get information for a pick event on a Line2D artist (as created with ``plot``.) This will yield x and y values that are interpolated between vertices (instead of just being the position of the mouse) or snapped to the nearest vertex if only the vertices are drawn. Parameters ----------- event : PickEvent The pick event to process Returns -------- props : dict A dict with keys: x & y """ xclick, yclick = event.mouseevent.xdata, event.mouseevent.ydata i = event.ind[0] xorig, yorig = event.artist.get_xydata().T # For points-only lines, snap to the nearest point. linestyle = event.artist.get_linestyle() if linestyle in ['none', ' ', '', None, 'None']: return dict(x=xorig[i], y=yorig[i]) # ax.step is actually implemented as a Line2D with a different drawstyle... xs_data = xorig[max(i - 1, 0) : i + 2] ys_data = yorig[max(i - 1, 0) : i + 2] drawstyle = event.artist.drawStyles[event.artist.get_drawstyle()] if drawstyle == "_draw_lines": pass elif drawstyle == "_draw_steps_pre": xs_data = _interleave(xs_data, xs_data[:-1]) ys_data = _interleave(ys_data, ys_data[1:]) elif drawstyle == "_draw_steps_post": xs_data = _interleave(xs_data, xs_data[1:]) ys_data = _interleave(ys_data, ys_data[:-1]) elif drawstyle == "_draw_steps_mid": mid_xs = (xs_data[:-1] + xs_data[1:]) / 2 xs_data = _interleave(xs_data, np.column_stack([mid_xs, mid_xs])) ys_data = _interleave( ys_data, np.column_stack([ys_data[:-1], ys_data[1:]])) else: raise ValueError( "Unknown drawstyle: {}".format(event.artist.get_drawstyle())) # The artist transform may be different from the axes transform (e.g., # axvline/axhline) artist_transform = event.artist.get_transform() axes_transform = event.artist.axes.transData xs_screen, ys_screen = ( artist_transform.transform( np.column_stack([xs_data, ys_data]))).T xclick_screen, yclick_screen = ( axes_transform.transform([xclick, yclick])) x_screen, y_screen = _interpolate_line(xs_screen, ys_screen, xclick_screen, yclick_screen) x, y = axes_transform.inverted().transform([x_screen, y_screen]) return dict(x=x, y=y) def _interleave(a, b): """Interleave arrays a and b; b may have multiple columns and must be shorter by 1. """ b = np.column_stack([b]) # Turn b into a column array. nx, ny = b.shape c = np.zeros((nx + 1, ny + 1)) c[:, 0] = a c[:-1, 1:] = b return c.ravel()[:-(c.shape[1] - 1)] def _interpolate_line(xorig, yorig, xclick, yclick): """Find the nearest point on a polyline segment to the point *xclick* *yclick*.""" candidates = [] # The closest point may be a vertex. for x, y in zip(xorig, yorig): candidates.append((np.hypot(xclick - x, yclick - y), (x, y))) # Or it may be a projection on a segment. for (x0, x1), (y0, y1) in zip(zip(xorig, xorig[1:]), zip(yorig, yorig[1:])): vec1 =
np.array([x1 - x0, y1 - y0])
numpy.array
import numpy as np import pandas as pd import vectorbt as vbt from scipy.signal import argrelextrema from sklearn.model_selection import train_test_split from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler from sklearn.neural_network import MLPClassifier from sklearn.neighbors import KNeighborsClassifier from sklearn.svm import SVC from sklearn.gaussian_process import GaussianProcessClassifier from sklearn.gaussian_process.kernels import RBF from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier from sklearn.naive_bayes import GaussianNB from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis from sklearn.metrics import classification_report class Historian: def buy_and_hold(self, close): # returns a portfolio based on buy and hold strategy portfolio = vbt.Portfolio.from_holding( close, init_cash=1000, freq='D') return portfolio def create_portfolio(self, close, signals): # returns a portfolio based on signals portfolio = vbt.Portfolio.from_signals( close, signals, ~signals, init_cash=1000, freq='D' ) return portfolio def fill(self, arr, method='ffill', type='bool'): # forward fills or nearest fills an array df = pd.DataFrame(arr) s = df.iloc[:, 0] if method == 'ffill': s = s.fillna(method='ffill') s = pd.to_numeric(s) s = s.interpolate(method='nearest').astype(type) out = s.to_numpy().flatten() return out def get_optimal_signals(self, close, n=10, method='ffill'): # finds the optimal signals for an array of prices close = np.array(close) mins = argrelextrema(close, np.less_equal, order=n)[0] maxs = argrelextrema(close, np.greater_equal, order=n)[0] signals = np.empty_like(close, dtype='object') signals[:] = np.nan signals[mins] = True signals[maxs] = False return self.fill(signals, method=method) def generate_random(self, close, num=10**4): # generate random strategies good_signals = [] portfolios = [] sortinos = [] calmars = [] num_strats = num top_n = 25 prob = self.get_optimal_signals(close).mean() for _ in range(num_strats): signals = pd.DataFrame.vbt.signals.generate_random( (len(close), 1), prob=prob)[0] portfolio = vbt.Portfolio.from_signals( close, signals, ~signals, init_cash=1000, freq='D') sortinos.append(portfolio.sortino_ratio()) calmars.append(portfolio.calmar_ratio()) good_signals.append(signals) portfolios.append(portfolio) top_s = set(np.argpartition(sortinos, -top_n)[-top_n:]) top_c = set(np.argpartition(calmars, -top_n)[-top_n:]) top_idxs = top_s.intersection(top_c) portfolios = [portfolio for idx, portfolio in enumerate( portfolios) if idx in top_idxs] good_signals = [signal for idx, signal in enumerate( good_signals) if idx in top_idxs] return good_signals def undersample(self, X, y, n=2): # undersample, split train / test data, and standardize df = pd.DataFrame(X) df['y'] = y df = df.dropna() y = df['y'].to_numpy() X = df.drop('y', axis=1).to_numpy() X_train, X_test, y_train, y_test = \ train_test_split(X, y, test_size=.2) train_true = 0 train_false = 0 X_train_new = [] y_train_new = [] train_num = len(y_train) - sum(y_train) # use arr[mask]all[:num] instead to get for idx, signal in enumerate(y_train): if signal and train_true < train_num: train_true += 1 elif not signal and train_false < train_num: train_false += 1 else: continue X_train_new.append(X_train[idx]) y_train_new.append(y_train[idx]) X_train =
np.array(X_train_new)
numpy.array
# This module has been generated automatically from space group information # obtained from the Computational Crystallography Toolbox # """ Space groups This module contains a list of all the 230 space groups that can occur in a crystal. The variable space_groups contains a dictionary that maps space group numbers and space group names to the corresponding space group objects. .. moduleauthor:: <NAME> <<EMAIL>> """ #----------------------------------------------------------------------------- # Copyright (C) 2013 The Mosaic Development Team # # Distributed under the terms of the BSD License. The full license is in # the file LICENSE.txt, distributed as part of this software. #----------------------------------------------------------------------------- import numpy as N class SpaceGroup(object): """ Space group All possible space group objects are created in this module. Other modules should access these objects through the dictionary space_groups rather than create their own space group objects. """ def __init__(self, number, symbol, transformations): """ :param number: the number assigned to the space group by international convention :type number: int :param symbol: the Hermann-Mauguin space-group symbol as used in PDB and mmCIF files :type symbol: str :param transformations: a list of space group transformations, each consisting of a tuple of three integer arrays (rot, tn, td), where rot is the rotation matrix and tn/td are the numerator and denominator of the translation vector. The transformations are defined in fractional coordinates. :type transformations: list """ self.number = number self.symbol = symbol self.transformations = transformations self.transposed_rotations = N.array([N.transpose(t[0]) for t in transformations]) self.phase_factors = N.exp(N.array([(-2j*N.pi*t[1])/t[2] for t in transformations])) def __repr__(self): return "SpaceGroup(%d, %s)" % (self.number, repr(self.symbol)) def __len__(self): """ :return: the number of space group transformations :rtype: int """ return len(self.transformations) def symmetryEquivalentMillerIndices(self, hkl): """ :param hkl: a set of Miller indices :type hkl: Scientific.N.array_type :return: a tuple (miller_indices, phase_factor) of two arrays of length equal to the number of space group transformations. miller_indices contains the Miller indices of each reflection equivalent by symmetry to the reflection hkl (including hkl itself as the first element). phase_factor contains the phase factors that must be applied to the structure factor of reflection hkl to obtain the structure factor of the symmetry equivalent reflection. :rtype: tuple """ hkls = N.dot(self.transposed_rotations, hkl) p = N.multiply.reduce(self.phase_factors**hkl, -1) return hkls, p space_groups = {} transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(1, 'P 1', transformations) space_groups[1] = sg space_groups['P 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(2, 'P -1', transformations) space_groups[2] = sg space_groups['P -1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(3, 'P 1 2 1', transformations) space_groups[3] = sg space_groups['P 1 2 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(4, 'P 1 21 1', transformations) space_groups[4] = sg space_groups['P 1 21 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(5, 'C 1 2 1', transformations) space_groups[5] = sg space_groups['C 1 2 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(6, 'P 1 m 1', transformations) space_groups[6] = sg space_groups['P 1 m 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(7, 'P 1 c 1', transformations) space_groups[7] = sg space_groups['P 1 c 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(8, 'C 1 m 1', transformations) space_groups[8] = sg space_groups['C 1 m 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(9, 'C 1 c 1', transformations) space_groups[9] = sg space_groups['C 1 c 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(10, 'P 1 2/m 1', transformations) space_groups[10] = sg space_groups['P 1 2/m 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(11, 'P 1 21/m 1', transformations) space_groups[11] = sg space_groups['P 1 21/m 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(12, 'C 1 2/m 1', transformations) space_groups[12] = sg space_groups['C 1 2/m 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(13, 'P 1 2/c 1', transformations) space_groups[13] = sg space_groups['P 1 2/c 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(14, 'P 1 21/c 1', transformations) space_groups[14] = sg space_groups['P 1 21/c 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(15, 'C 1 2/c 1', transformations) space_groups[15] = sg space_groups['C 1 2/c 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(16, 'P 2 2 2', transformations) space_groups[16] = sg space_groups['P 2 2 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(17, 'P 2 2 21', transformations) space_groups[17] = sg space_groups['P 2 2 21'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(18, 'P 21 21 2', transformations) space_groups[18] = sg space_groups['P 21 21 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(19, 'P 21 21 21', transformations) space_groups[19] = sg space_groups['P 21 21 21'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(20, 'C 2 2 21', transformations) space_groups[20] = sg space_groups['C 2 2 21'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(21, 'C 2 2 2', transformations) space_groups[21] = sg space_groups['C 2 2 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(22, 'F 2 2 2', transformations) space_groups[22] = sg space_groups['F 2 2 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(23, 'I 2 2 2', transformations) space_groups[23] = sg space_groups['I 2 2 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(24, 'I 21 21 21', transformations) space_groups[24] = sg space_groups['I 21 21 21'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(25, 'P m m 2', transformations) space_groups[25] = sg space_groups['P m m 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(26, 'P m c 21', transformations) space_groups[26] = sg space_groups['P m c 21'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(27, 'P c c 2', transformations) space_groups[27] = sg space_groups['P c c 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(28, 'P m a 2', transformations) space_groups[28] = sg space_groups['P m a 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(29, 'P c a 21', transformations) space_groups[29] = sg space_groups['P c a 21'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(30, 'P n c 2', transformations) space_groups[30] = sg space_groups['P n c 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(31, 'P m n 21', transformations) space_groups[31] = sg space_groups['P m n 21'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(32, 'P b a 2', transformations) space_groups[32] = sg space_groups['P b a 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(33, 'P n a 21', transformations) space_groups[33] = sg space_groups['P n a 21'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(34, 'P n n 2', transformations) space_groups[34] = sg space_groups['P n n 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(35, 'C m m 2', transformations) space_groups[35] = sg space_groups['C m m 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(36, 'C m c 21', transformations) space_groups[36] = sg space_groups['C m c 21'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(37, 'C c c 2', transformations) space_groups[37] = sg space_groups['C c c 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(38, 'A m m 2', transformations) space_groups[38] = sg space_groups['A m m 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(39, 'A b m 2', transformations) space_groups[39] = sg space_groups['A b m 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(40, 'A m a 2', transformations) space_groups[40] = sg space_groups['A m a 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(41, 'A b a 2', transformations) space_groups[41] = sg space_groups['A b a 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(42, 'F m m 2', transformations) space_groups[42] = sg space_groups['F m m 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(43, 'F d d 2', transformations) space_groups[43] = sg space_groups['F d d 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(44, 'I m m 2', transformations) space_groups[44] = sg space_groups['I m m 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(45, 'I b a 2', transformations) space_groups[45] = sg space_groups['I b a 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(46, 'I m a 2', transformations) space_groups[46] = sg space_groups['I m a 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(47, 'P m m m', transformations) space_groups[47] = sg space_groups['P m m m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(48, 'P n n n :2', transformations) space_groups[48] = sg space_groups['P n n n :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(49, 'P c c m', transformations) space_groups[49] = sg space_groups['P c c m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(50, 'P b a n :2', transformations) space_groups[50] = sg space_groups['P b a n :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(51, 'P m m a', transformations) space_groups[51] = sg space_groups['P m m a'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(52, 'P n n a', transformations) space_groups[52] = sg space_groups['P n n a'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(53, 'P m n a', transformations) space_groups[53] = sg space_groups['P m n a'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(54, 'P c c a', transformations) space_groups[54] = sg space_groups['P c c a'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(55, 'P b a m', transformations) space_groups[55] = sg space_groups['P b a m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(56, 'P c c n', transformations) space_groups[56] = sg space_groups['P c c n'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(57, 'P b c m', transformations) space_groups[57] = sg space_groups['P b c m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(58, 'P n n m', transformations) space_groups[58] = sg space_groups['P n n m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(59, 'P m m n :2', transformations) space_groups[59] = sg space_groups['P m m n :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(60, 'P b c n', transformations) space_groups[60] = sg space_groups['P b c n'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(61, 'P b c a', transformations) space_groups[61] = sg space_groups['P b c a'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(62, 'P n m a', transformations) space_groups[62] = sg space_groups['P n m a'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(63, 'C m c m', transformations) space_groups[63] = sg space_groups['C m c m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(64, 'C m c a', transformations) space_groups[64] = sg space_groups['C m c a'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(65, 'C m m m', transformations) space_groups[65] = sg space_groups['C m m m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(66, 'C c c m', transformations) space_groups[66] = sg space_groups['C c c m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(67, 'C m m a', transformations) space_groups[67] = sg space_groups['C m m a'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(68, 'C c c a :2', transformations) space_groups[68] = sg space_groups['C c c a :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(69, 'F m m m', transformations) space_groups[69] = sg space_groups['F m m m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,3,3]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([4,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([4,4,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([4,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([4,4,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([2,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,0,3]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,1,1]) trans_den = N.array([4,4,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,-1,1]) trans_den = N.array([2,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,-1,1]) trans_den = N.array([4,4,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([2,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,1,1]) trans_den = N.array([4,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,3,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([2,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([4,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(70, 'F d d d :2', transformations) space_groups[70] = sg space_groups['F d d d :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(71, 'I m m m', transformations) space_groups[71] = sg space_groups['I m m m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(72, 'I b a m', transformations) space_groups[72] = sg space_groups['I b a m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(73, 'I b c a', transformations) space_groups[73] = sg space_groups['I b c a'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(74, 'I m m a', transformations) space_groups[74] = sg space_groups['I m m a'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(75, 'P 4', transformations) space_groups[75] = sg space_groups['P 4'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,3]) trans_den = N.array([1,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(76, 'P 41', transformations) space_groups[76] = sg space_groups['P 41'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(77, 'P 42', transformations) space_groups[77] = sg space_groups['P 42'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,3]) trans_den = N.array([1,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(78, 'P 43', transformations) space_groups[78] = sg space_groups['P 43'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(79, 'I 4', transformations) space_groups[79] = sg space_groups['I 4'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,3]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,3]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,5]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,5]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(80, 'I 41', transformations) space_groups[80] = sg space_groups['I 41'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(81, 'P -4', transformations) space_groups[81] = sg space_groups['P -4'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(82, 'I -4', transformations) space_groups[82] = sg space_groups['I -4'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(83, 'P 4/m', transformations) space_groups[83] = sg space_groups['P 4/m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(84, 'P 42/m', transformations) space_groups[84] = sg space_groups['P 42/m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(85, 'P 4/n :2', transformations) space_groups[85] = sg space_groups['P 4/n :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(86, 'P 42/n :2', transformations) space_groups[86] = sg space_groups['P 42/n :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(87, 'I 4/m', transformations) space_groups[87] = sg space_groups['I 4/m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-3,-3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,5,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,-1,-1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(88, 'I 41/a :2', transformations) space_groups[88] = sg space_groups['I 41/a :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(89, 'P 4 2 2', transformations) space_groups[89] = sg space_groups['P 4 2 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(90, 'P 4 21 2', transformations) space_groups[90] = sg space_groups['P 4 21 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,3]) trans_den = N.array([1,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,3]) trans_den = N.array([1,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,4]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(91, 'P 41 2 2', transformations) space_groups[91] = sg space_groups['P 41 2 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([2,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([2,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(92, 'P 41 21 2', transformations) space_groups[92] = sg space_groups['P 41 21 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(93, 'P 42 2 2', transformations) space_groups[93] = sg space_groups['P 42 2 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(94, 'P 42 21 2', transformations) space_groups[94] = sg space_groups['P 42 21 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,3]) trans_den = N.array([1,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,3]) trans_den = N.array([1,1,4]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(95, 'P 43 2 2', transformations) space_groups[95] = sg space_groups['P 43 2 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([2,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([2,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(96, 'P 43 21 2', transformations) space_groups[96] = sg space_groups['P 43 21 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(97, 'I 4 2 2', transformations) space_groups[97] = sg space_groups['I 4 2 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,3]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,3]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,3]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,3]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,5]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,5]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,5]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,5]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(98, 'I 41 2 2', transformations) space_groups[98] = sg space_groups['I 41 2 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(99, 'P 4 m m', transformations) space_groups[99] = sg space_groups['P 4 m m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(100, 'P 4 b m', transformations) space_groups[100] = sg space_groups['P 4 b m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(101, 'P 42 c m', transformations) space_groups[101] = sg space_groups['P 42 c m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(102, 'P 42 n m', transformations) space_groups[102] = sg space_groups['P 42 n m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(103, 'P 4 c c', transformations) space_groups[103] = sg space_groups['P 4 c c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(104, 'P 4 n c', transformations) space_groups[104] = sg space_groups['P 4 n c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(105, 'P 42 m c', transformations) space_groups[105] = sg space_groups['P 42 m c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(106, 'P 42 b c', transformations) space_groups[106] = sg space_groups['P 42 b c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(107, 'I 4 m m', transformations) space_groups[107] = sg space_groups['I 4 m m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(108, 'I 4 c m', transformations) space_groups[108] = sg space_groups['I 4 c m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,3]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,3]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,3]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,3]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,5]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,5]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,5]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,5]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(109, 'I 41 m d', transformations) space_groups[109] = sg space_groups['I 41 m d'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,3]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,3]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,5]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,5]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(110, 'I 41 c d', transformations) space_groups[110] = sg space_groups['I 41 c d'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(111, 'P -4 2 m', transformations) space_groups[111] = sg space_groups['P -4 2 m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(112, 'P -4 2 c', transformations) space_groups[112] = sg space_groups['P -4 2 c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(113, 'P -4 21 m', transformations) space_groups[113] = sg space_groups['P -4 21 m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(114, 'P -4 21 c', transformations) space_groups[114] = sg space_groups['P -4 21 c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(115, 'P -4 m 2', transformations) space_groups[115] = sg space_groups['P -4 m 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(116, 'P -4 c 2', transformations) space_groups[116] = sg space_groups['P -4 c 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(117, 'P -4 b 2', transformations) space_groups[117] = sg space_groups['P -4 b 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(118, 'P -4 n 2', transformations) space_groups[118] = sg space_groups['P -4 n 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(119, 'I -4 m 2', transformations) space_groups[119] = sg space_groups['I -4 m 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(120, 'I -4 c 2', transformations) space_groups[120] = sg space_groups['I -4 c 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(121, 'I -4 2 m', transformations) space_groups[121] = sg space_groups['I -4 2 m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,3]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,3]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,3]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,3]) trans_den = N.array([2,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,5]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,5]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,5]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,5]) trans_den = N.array([1,2,4]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(122, 'I -4 2 d', transformations) space_groups[122] = sg space_groups['I -4 2 d'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(123, 'P 4/m m m', transformations) space_groups[123] = sg space_groups['P 4/m m m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(124, 'P 4/m c c', transformations) space_groups[124] = sg space_groups['P 4/m c c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(125, 'P 4/n b m :2', transformations) space_groups[125] = sg space_groups['P 4/n b m :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(126, 'P 4/n n c :2', transformations) space_groups[126] = sg space_groups['P 4/n n c :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(127, 'P 4/m b m', transformations) space_groups[127] = sg space_groups['P 4/m b m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(128, 'P 4/m n c', transformations) space_groups[128] = sg space_groups['P 4/m n c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(129, 'P 4/n m m :2', transformations) space_groups[129] = sg space_groups['P 4/n m m :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(130, 'P 4/n c c :2', transformations) space_groups[130] = sg space_groups['P 4/n c c :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(131, 'P 42/m m c', transformations) space_groups[131] = sg space_groups['P 42/m m c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(132, 'P 42/m c m', transformations) space_groups[132] = sg space_groups['P 42/m c m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(133, 'P 42/n b c :2', transformations) space_groups[133] = sg space_groups['P 42/n b c :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(134, 'P 42/n n m :2', transformations) space_groups[134] = sg space_groups['P 42/n n m :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(135, 'P 42/m b c', transformations) space_groups[135] = sg space_groups['P 42/m b c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(136, 'P 42/m n m', transformations) space_groups[136] = sg space_groups['P 42/m n m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(137, 'P 42/n m c :2', transformations) space_groups[137] = sg space_groups['P 42/n m c :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(138, 'P 42/n c m :2', transformations) space_groups[138] = sg space_groups['P 42/n c m :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(139, 'I 4/m m m', transformations) space_groups[139] = sg space_groups['I 4/m m m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(140, 'I 4/m c m', transformations) space_groups[140] = sg space_groups['I 4/m c m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-3,-1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-3,-1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,5,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,3,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,5,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,3,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,-1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,-1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(141, 'I 41/a m d :2', transformations) space_groups[141] = sg space_groups['I 41/a m d :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-3,-1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-3,-3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,5,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,3,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,5,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,-1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,-1,-1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(142, 'I 41/a c d :2', transformations) space_groups[142] = sg space_groups['I 41/a c d :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(143, 'P 3', transformations) space_groups[143] = sg space_groups['P 3'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(144, 'P 31', transformations) space_groups[144] = sg space_groups['P 31'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(145, 'P 32', transformations) space_groups[145] = sg space_groups['P 32'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(146, 'R 3 :H', transformations) space_groups[146] = sg space_groups['R 3 :H'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(147, 'P -3', transformations) space_groups[147] = sg space_groups['P -3'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(148, 'R -3 :H', transformations) space_groups[148] = sg space_groups['R -3 :H'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(149, 'P 3 1 2', transformations) space_groups[149] = sg space_groups['P 3 1 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(150, 'P 3 2 1', transformations) space_groups[150] = sg space_groups['P 3 2 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(151, 'P 31 1 2', transformations) space_groups[151] = sg space_groups['P 31 1 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(152, 'P 31 2 1', transformations) space_groups[152] = sg space_groups['P 31 2 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(153, 'P 32 1 2', transformations) space_groups[153] = sg space_groups['P 32 1 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(154, 'P 32 2 1', transformations) space_groups[154] = sg space_groups['P 32 2 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(155, 'R 3 2 :H', transformations) space_groups[155] = sg space_groups['R 3 2 :H'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(156, 'P 3 m 1', transformations) space_groups[156] = sg space_groups['P 3 m 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(157, 'P 3 1 m', transformations) space_groups[157] = sg space_groups['P 3 1 m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(158, 'P 3 c 1', transformations) space_groups[158] = sg space_groups['P 3 c 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(159, 'P 3 1 c', transformations) space_groups[159] = sg space_groups['P 3 1 c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(160, 'R 3 m :H', transformations) space_groups[160] = sg space_groups['R 3 m :H'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,7]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,7]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,7]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,5]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,5]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,5]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(161, 'R 3 c :H', transformations) space_groups[161] = sg space_groups['R 3 c :H'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(162, 'P -3 1 m', transformations) space_groups[162] = sg space_groups['P -3 1 m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(163, 'P -3 1 c', transformations) space_groups[163] = sg space_groups['P -3 1 c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(164, 'P -3 m 1', transformations) space_groups[164] = sg space_groups['P -3 m 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(165, 'P -3 c 1', transformations) space_groups[165] = sg space_groups['P -3 c 1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(166, 'R -3 m :H', transformations) space_groups[166] = sg space_groups['R -3 m :H'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,7]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,7]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,7]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,2,2]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,1]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,1]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,2,1]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,5]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,5]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,5]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([2,1,1]) trans_den = N.array([3,3,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,-1]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,-1]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([2,1,-1]) trans_den = N.array([3,3,6]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(167, 'R -3 c :H', transformations) space_groups[167] = sg space_groups['R -3 c :H'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(168, 'P 6', transformations) space_groups[168] = sg space_groups['P 6'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,5]) trans_den = N.array([1,1,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(169, 'P 61', transformations) space_groups[169] = sg space_groups['P 61'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,5]) trans_den = N.array([1,1,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(170, 'P 65', transformations) space_groups[170] = sg space_groups['P 65'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(171, 'P 62', transformations) space_groups[171] = sg space_groups['P 62'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(172, 'P 64', transformations) space_groups[172] = sg space_groups['P 64'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(173, 'P 63', transformations) space_groups[173] = sg space_groups['P 63'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(174, 'P -6', transformations) space_groups[174] = sg space_groups['P -6'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(175, 'P 6/m', transformations) space_groups[175] = sg space_groups['P 6/m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(176, 'P 63/m', transformations) space_groups[176] = sg space_groups['P 63/m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(177, 'P 6 2 2', transformations) space_groups[177] = sg space_groups['P 6 2 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,5]) trans_den = N.array([1,1,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,5]) trans_den = N.array([1,1,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,6]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(178, 'P 61 2 2', transformations) space_groups[178] = sg space_groups['P 61 2 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,5]) trans_den = N.array([1,1,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,6]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,5]) trans_den = N.array([1,1,6]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(179, 'P 65 2 2', transformations) space_groups[179] = sg space_groups['P 65 2 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(180, 'P 62 2 2', transformations) space_groups[180] = sg space_groups['P 62 2 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,2]) trans_den = N.array([1,1,3]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(181, 'P 64 2 2', transformations) space_groups[181] = sg space_groups['P 64 2 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(182, 'P 63 2 2', transformations) space_groups[182] = sg space_groups['P 63 2 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(183, 'P 6 m m', transformations) space_groups[183] = sg space_groups['P 6 m m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(184, 'P 6 c c', transformations) space_groups[184] = sg space_groups['P 6 c c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(185, 'P 63 c m', transformations) space_groups[185] = sg space_groups['P 63 c m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(186, 'P 63 m c', transformations) space_groups[186] = sg space_groups['P 63 m c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(187, 'P -6 m 2', transformations) space_groups[187] = sg space_groups['P -6 m 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(188, 'P -6 c 2', transformations) space_groups[188] = sg space_groups['P -6 c 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(189, 'P -6 2 m', transformations) space_groups[189] = sg space_groups['P -6 2 m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(190, 'P -6 2 c', transformations) space_groups[190] = sg space_groups['P -6 2 c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(191, 'P 6/m m m', transformations) space_groups[191] = sg space_groups['P 6/m m m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(192, 'P 6/m c c', transformations) space_groups[192] = sg space_groups['P 6/m c c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(193, 'P 63/m c m', transformations) space_groups[193] = sg space_groups['P 63/m c m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,1,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(194, 'P 63/m m c', transformations) space_groups[194] = sg space_groups['P 63/m m c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(195, 'P 2 3', transformations) space_groups[195] = sg space_groups['P 2 3'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(196, 'F 2 3', transformations) space_groups[196] = sg space_groups['F 2 3'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(197, 'I 2 3', transformations) space_groups[197] = sg space_groups['I 2 3'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(198, 'P 21 3', transformations) space_groups[198] = sg space_groups['P 21 3'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(199, 'I 21 3', transformations) space_groups[199] = sg space_groups['I 21 3'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(200, 'P m -3', transformations) space_groups[200] = sg space_groups['P m -3'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(201, 'P n -3 :2', transformations) space_groups[201] = sg space_groups['P n -3 :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(202, 'F m -3', transformations) space_groups[202] = sg space_groups['F m -3'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([4,4,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,3,3]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([4,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([4,4,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([4,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,3,3]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,3,3]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([4,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([4,4,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([4,4,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([4,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([4,4,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([4,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([4,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([4,4,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,1,1]) trans_den = N.array([4,4,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([2,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,0,3]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([3,1,1]) trans_den = N.array([4,4,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([3,0,3]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([2,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([2,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,0,3]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,1,1]) trans_den = N.array([4,4,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,-1,1]) trans_den = N.array([4,4,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,-1,1]) trans_den = N.array([2,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,-1,1]) trans_den = N.array([4,4,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,-1,1]) trans_den = N.array([2,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,-1,1]) trans_den = N.array([2,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,-1,1]) trans_den = N.array([4,4,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,3,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([2,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,1,1]) trans_den = N.array([4,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([3,3,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([3,1,1]) trans_den = N.array([4,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([2,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([2,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,1,1]) trans_den = N.array([4,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,3,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([2,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([4,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([4,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([2,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([2,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,-1]) trans_den = N.array([4,2,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(203, 'F d -3 :2', transformations) space_groups[203] = sg space_groups['F d -3 :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(204, 'I m -3', transformations) space_groups[204] = sg space_groups['I m -3'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(205, 'P a -3', transformations) space_groups[205] = sg space_groups['P a -3'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(206, 'I a -3', transformations) space_groups[206] = sg space_groups['I a -3'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(207, 'P 4 3 2', transformations) space_groups[207] = sg space_groups['P 4 3 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(208, 'P 42 3 2', transformations) space_groups[208] = sg space_groups['P 42 3 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(209, 'F 4 3 2', transformations) space_groups[209] = sg space_groups['F 4 3 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(210, 'F 41 3 2', transformations) space_groups[210] = sg space_groups['F 41 3 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(211, 'I 4 3 2', transformations) space_groups[211] = sg space_groups['I 4 3 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([3,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(212, 'P 43 3 2', transformations) space_groups[212] = sg space_groups['P 43 3 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([3,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([3,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(213, 'P 41 3 2', transformations) space_groups[213] = sg space_groups['P 41 3 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([3,3,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([3,5,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,5,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,5,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,5,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,3,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,5,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,3,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([3,5,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([3,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(214, 'I 41 3 2', transformations) space_groups[214] = sg space_groups['I 41 3 2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(215, 'P -4 3 m', transformations) space_groups[215] = sg space_groups['P -4 3 m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(216, 'F -4 3 m', transformations) space_groups[216] = sg space_groups['F -4 3 m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(217, 'I -4 3 m', transformations) space_groups[217] = sg space_groups['I -4 3 m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(218, 'P -4 3 n', transformations) space_groups[218] = sg space_groups['P -4 3 n'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(219, 'F -4 3 c', transformations) space_groups[219] = sg space_groups['F -4 3 c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,3,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([3,3,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([3,5,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,5,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,5,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,5,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([3,3,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,5,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([3,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,3,5]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([3,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([3,5,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([3,3,3]) trans_den = N.array([4,4,4]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(220, 'I -4 3 d', transformations) space_groups[220] = sg space_groups['I -4 3 d'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(221, 'P m -3 m', transformations) space_groups[221] = sg space_groups['P m -3 m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,-1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,-1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(222, 'P n -3 n :2', transformations) space_groups[222] = sg space_groups['P n -3 n :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,-1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(223, 'P m -3 n', transformations) space_groups[223] = sg space_groups['P m -3 n'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,-1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,-1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,-1,-1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(224, 'P n -3 m :2', transformations) space_groups[224] = sg space_groups['P n -3 m :2'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(225, 'F m -3 m', transformations) space_groups[225] = sg space_groups['F m -3 m'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([-1,0,0]) trans_den = N.array([2,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([-1,1,1]) trans_den = N.array([2,2,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([2,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([2,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,0]) trans_den = N.array([1,2,1]) transformations.append((rot, trans_num, trans_den)) sg = SpaceGroup(226, 'F m -3 c', transformations) space_groups[226] = sg space_groups['F m -3 c'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,1,1]) trans_den = N.array([1,4,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([1,0,1]) trans_den = N.array([4,1,4]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans_num = N.array([1,1,0]) trans_den = N.array([4,4,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans_num =
N.array([1,1,0])
numpy.array
"""Generate a single discrete time SIR model. """ from . import data_model import numpy as np from scipy import stats import xarray as xr # Generate Betas # Beta, or the growth rate of the infection, depends on the covariates. # Here we implement three different functional forms for the dependency. SPLIT_TIME = 100 def generate_betas_from_single_random_covariate(num_locations): """Beta depend on a single covariate that is randomly generated. Args: num_locations: an int representing the number of locations to simulate Returns: beta: an xr.DataArray consisting of the growth rate for each epidemic v: an xr.DataArray consisting of the randomly generated covariate for each location alpha: an xr.DataArray consisting of the weights for each covariate """ v = xr.DataArray( np.random.uniform(0.0, 1.0, (num_locations, 1)), dims=['location', 'static_covariate']) alpha = xr.DataArray(np.ones(1), dims=['static_covariate']) beta = 0.4 * np.exp(alpha @ v) return beta, v, alpha def generate_betas_effect_mod(num_locations): """Betas depend on 2 discrete, randomly generated effects. Args: num_locations: an int representing the number of locations to simulate Returns: beta: an xr.DataArray consisting of the growth rate for each epidemic v: an xr.DataArray consisting of the randomly generated covariate for each location alpha: an xr.DataArray consisting of the weights for each covariate """ v = xr.DataArray(np.random.binomial(1, 0.5, size=(num_locations, 2)), dims={'location': num_locations, 'static_covariate': 2}) hd = v.values[:, 0] ws = v.values[:, 1] beta_np = np.exp(np.log(1.5) + np.log(2.0) * (hd == 1) * (ws == 0)) beta = xr.DataArray(beta_np, dims={'location': num_locations}) return beta, v, xr.DataArray(np.array([1, 1]), dims={'static_covariate': 2}) def generate_betas_many_cov2(num_locations, num_pred=1, num_not_pred=2): """Betas depend on real valued vector of covariates. Args: num_locations: an int representing the number of locations to simulate. num_pred: an int representing the number of covariates that affect beta. num_not_pred: an int representing the number of covariates that do not affect beta. Returns: beta: an xr.DataArray consisting of the growth rate for each epidemic v: an xr.DataArray consisting of the randomly generated covariate for each location alpha: an xr.DataArray consisting of the weights for each covariate """ # generate random covariates # sample from range -1, 1 uniformly v = xr.DataArray(np.random.uniform( low=-1.0, high=1.0, size=(num_locations, num_pred + num_not_pred)), dims={'location': num_locations, 'static_covariate': num_pred+num_not_pred}) # construct weights for each covariate alpha_1 = np.ones(num_pred) alpha_0 = np.zeros(num_not_pred) alpha = xr.DataArray(np.concatenate((alpha_1, alpha_0), axis=0), dims={'static_covariate': num_pred+num_not_pred}) # this has a different functional form than we've seen before beta_np = 1 + np.exp(np.matmul(alpha.values, v.values.T)) beta = xr.DataArray(beta_np, dims={'location': num_locations}) return beta, v, alpha def gen_dynamic_beta_random_time(num_locations, num_time_steps): """Betas change at a random time between 1 and num_time_steps-1. Args: num_locations: an int representing the number of locations to simulate num_time_steps: an int representing the number of time steps to simulate Returns: beta: an xr.DataArray consisting of the growth rate for each epidemic with dimensions (location, time) v: an xr.DataArray consisting of the randomly generated covariate for each location with dimensions (location, time, 1) alpha: an xr.DataArray consisting of the weights for each covariate with dimension 1. """ time = np.random.randint(1, num_time_steps-1, num_locations) cov = np.zeros((num_locations, num_time_steps, 1)) for i in range(num_locations): cov[i][time[i]:] = 1 v = xr.DataArray(cov, dims=['location', 'time', 'dynamic_covariate']) alpha = np.random.uniform(-1., 0.)*xr.DataArray(np.ones(1), dims=['dynamic_covariate']) beta = 0.4 * np.exp(alpha @ v) return beta, v, alpha def gen_social_distancing_weight(num_locations): alpha = np.random.uniform(-1., 0., 1) return alpha def new_sir_simulation_model(num_locations, num_time_steps, num_static_covariates, num_dynamic_covariates=0): """Return a zero data_model.new_model with extra simulation parameters. Args: num_locations: int representing the number of locations to model epidemics for num_time_steps: int representing the maximum number of time steps the epidemic can have num_static_covariates: int representing the number of static covariates for each location num_dynamic_covariates: int representing the number of dynamic covariates for each location. Returns: ds: an xr.Dataset representing the new infections and covariates for each location and representing the simulation parameters. All datavalues are initialized to 0. """ if num_time_steps < SPLIT_TIME: raise ValueError('num_time_steps must be at least %d' % (SPLIT_TIME,)) ds = data_model.new_model(num_locations, num_time_steps, num_static_covariates, num_dynamic_covariates) ds['canonical_split_time'] = SPLIT_TIME ds['canonical_split_time'].attrs['description'] = ( 'Int representing the canonical time at which to split the data.') ds['static_weights'] = data_model.new_dataarray( {'static_covariate': num_static_covariates}) # TODO(edklein) should population_size be a covariate? ds['population_size'] = data_model.new_dataarray({'location': num_locations}) ds['population_size'].attrs[ 'description'] = 'Int representing the population size in each location.' ds['fraction_infected'] = data_model.new_dataarray({ 'location': num_locations }) ds['fraction_infected'].attrs['description'] = ( 'Float representing the fraction of the population ' 'infected at the day %d.' % (SPLIT_TIME,)) ds['start_time'] = data_model.new_dataarray({ 'location': num_locations }) ds['start_time'].attrs['description'] = ( 'Int representing the infection start time at each location') ds['recovery_rate'] = data_model.new_dataarray({'location': num_locations}) ds['recovery_rate'].attrs[ 'description'] = ('Float representing the recovery rate in each location.' ' This is used in the SIR simulation of the epidemic.') if num_dynamic_covariates > 0: ds['dynamic_weights'] = data_model.new_dataarray( {'time': num_time_steps, 'dynamic_covariate': num_dynamic_covariates}) ds['growth_rate'] = data_model.new_dataarray({'location': num_locations, 'time': num_time_steps}) ds['growth_rate'].attrs[ 'description'] = ('Float representing the growth rate in each location' ' at each point in time.' 'This is used in the SIR simulation of the epidemic.') else: ds['growth_rate'] = data_model.new_dataarray({'location': num_locations}) ds['growth_rate'].attrs[ 'description'] = ('Float representing the growth rate in each location.' 'This is used in the SIR simulation of the epidemic.') return ds def _helper_ground_truth_setup(population_size, num_time_steps): """A helper function that sets up time0 of an SIR simulation. This helper function calculates the number of susceptible, infected, and recovered individuals at the begining of a simulation. It returns these values to be used as initial values in _helper_ground_truth_loop. Args: population_size: a xr.DataArray representing the population size in each location num_time_steps: an int representing the number of simulation 'days' to run at each location. Returns: new_infections: a DataArray with shape (location, time). The infections at time 0 are initialized to 1 in all locations. num_susceptible: a DataArray with shape (location,) containing the number of susceptible individuals in each location at time 0. num_infected: a DataArray with shape (location,) containing the number of infected individuals (1) in each location at time 0. num_recovered: a DataArray with shape (location,) containing the number of recovered individuals in each location at time 0. """ num_locations = population_size.sizes['location'] num_recovered = data_model.new_dataarray({ 'location': num_locations, }).astype(int) new_infections = data_model.new_dataarray({ 'location': num_locations, 'time': num_time_steps }).astype(int) # at each start time, we have 1 infection new_infections[dict(time=0)] = 1 # setup for t-0 num_infected = new_infections.sel(time=0).copy() num_susceptible = population_size.copy() num_susceptible -= num_infected return new_infections, num_susceptible, num_infected, num_recovered def _helper_ground_truth_loop(num_susceptible, num_recovered, num_infected, beta_time_t, gamma, population_size, prob_infection_constant): """A helper function to calculate SIR for one time step of an SIR simulation. This helper function calculates the number of susceptible, infected, and recovered individuals at one time step. It returns these values to be used as initial values in the next call. Args: num_susceptible: a DataArray with shape (location,) containing the number of susceptible individuals in each location at time t. num_infected: a DataArray with shape (location,) containing the number of infected individuals (1) in each location at time t. num_recovered: a DataArray with shape (location,) containing the number of recovered individuals in each location at time t. beta_time_t: a xr.DataArray representing the growth rate of the disease in each location at time t. gamma: a xr.DataArray representing the recovery rate of the disease in each location population_size: a xr.DataArray representing the population size in each location prob_infection_constant: a float representing a constant that we multiply the probability of becoming infected by. We noticed that a value of 1. led to curves that were short in time and clustered in time. By changing this to less than 1., our models fit better. Returns: num_new_infections: a DataArray with shape (location,) containing the number of *new* infections that occured at thime t+1. num_susceptible: a DataArray with shape (location,) containing the number of susceptible individuals in each location at time t+1. num_infected: a DataArray with shape (location,) containing the number of infected individuals (1) in each location at time t+1. num_recovered: a DataArray with shape (location,) containing the number of recovered individuals in each location at time t+1. """ # Calculate the probability that a person becomes infected # Python3 doesn't seem to work, so force a float frac_pop_infected = num_infected.astype(float) / population_size prob_infected = prob_infection_constant * ( 1 - np.exp(-frac_pop_infected * beta_time_t)) # Make sure prob_infected is between 0 and 1 prob_infected = prob_infected.where(prob_infected > 0, 0) prob_infected = prob_infected.where(prob_infected < 1, 1) # Determine the number of new infections # By drawing from a binomial distribution # Record the number of infections that occured at this time point num_new_infections = stats.binom.rvs( num_susceptible.astype(int), prob_infected) # Calculate the probability that a person recovers prob_recover = 1 -
np.exp(-gamma)
numpy.exp
import itertools import cmath from pauxy.systems.hubbard import Hubbard from pauxy.trial_wavefunction.free_electron import FreeElectron from pauxy.trial_wavefunction.harmonic_oscillator import HarmonicOscillator from pauxy.estimators.ci import simple_fci_bose_fermi, simple_fci from pauxy.estimators.hubbard import local_energy_hubbard_holstein, local_energy_hubbard from pauxy.systems.hubbard_holstein import HubbardHolstein from pauxy.utils.linalg import reortho from pauxy.estimators.greens_function import gab_spin import scipy import numpy import scipy.sparse.linalg from scipy.linalg import expm from scipy.optimize import minimize import time from pauxy.utils.io import read_fortran_complex_numbers from pauxy.utils.linalg import diagonalise_sorted from pauxy.estimators.mixed import local_energy try: from jax.config import config config.update("jax_enable_x64", True) import jax from jax import grad, jit import jax.numpy as np import jax.scipy.linalg as LA import numpy from pauxy.trial_wavefunction.coherent_state import gab, compute_exp except ModuleNotFoundError: from pauxy.estimators.greens_function import gab import numpy np = numpy def gradient(x, nbasis, nup, ndown, T, U, g, m, w0, c0,restricted, relax_gamma): grad = numpy.array(jax.grad(objective_function)(x, nbasis, nup, ndown, T, U, g, m, w0, c0,restricted, relax_gamma)) return grad def hessian(x, nbasis, nup, ndown, T, U, g, m, w0, c0, restricted, relax_gamma): H = numpy.array(jax.hessian(objective_function)(x, nbasis, nup, ndown, T, U, g, m, w0, c0,restricted,relax_gamma)) return H def objective_function (x, nbasis, nup, ndown, T, U, g, m, w0, c0, restricted,relax_gamma): nbasis = int(round(nbasis)) nup = int(round(nup)) ndown = int(round(ndown)) nbsf = nbasis nocca = nup noccb = ndown nvira = nbasis - nocca nvirb = nbasis - noccb nova = nocca*nvira novb = noccb*nvirb daia = np.array(x[:nova],dtype=np.float64) daib = np.array(x[nova:nova+novb],dtype=np.float64) daia = daia.reshape((nvira, nocca)) daib = daib.reshape((nvirb, noccb)) if (restricted): daib = jax.ops.index_update(daib, jax.ops.index[:,:], daia) theta_a = np.zeros((nbsf, nbsf),dtype=np.float64) theta_b = np.zeros((nbsf, nbsf),dtype=np.float64) theta_a = jax.ops.index_update(theta_a, jax.ops.index[nocca:nbsf,:nocca], daia) theta_a = jax.ops.index_update(theta_a, jax.ops.index[:nocca, nocca:nbsf], -np.transpose(daia)) theta_b = jax.ops.index_update(theta_b, jax.ops.index[noccb:nbsf,:noccb], daib) theta_b = jax.ops.index_update(theta_b, jax.ops.index[:noccb, noccb:nbsf], -np.transpose(daib)) Ua = np.eye(nbsf,dtype=np.float64) tmp = np.eye(nbsf,dtype=np.float64) Ua = compute_exp(Ua, tmp, theta_a) C0a = np.array(c0[:nbsf*nbsf].reshape((nbsf,nbsf)),dtype=np.float64) Ca = C0a.dot(Ua) Ga = gab(Ca[:,:nocca], Ca[:,:nocca]) if (noccb > 0): C0b = np.array(c0[nbsf*nbsf:].reshape((nbsf,nbsf)),dtype=np.float64) Ub = np.eye(nbsf) tmp = np.eye(nbsf) Ub = compute_exp(Ub, tmp, theta_b) Cb = C0b.dot(Ub) Gb = gab(Cb[:,:noccb], Cb[:,:noccb]) else: Gb = np.zeros_like(Ga) G = np.array([Ga, Gb],dtype=np.float64) ni = np.diag(G[0]+G[1]) nia = np.diag(G[0]) nib = np.diag(G[1]) sqrttwomw = np.sqrt(m * w0*2.0) phi = np.zeros(nbsf) gamma = np.array(x[nova+novb:], dtype=np.float64) if (not relax_gamma): gamma = g * np.sqrt(2.0 /(m *w0**3)) * np.ones(nbsf) Eph = w0 * np.sum(phi*phi) Eeph = np.sum ((gamma * m * w0**2 - g * sqrttwomw) * 2.0 * phi / sqrttwomw * ni) Eeph += np.sum((gamma**2 * m*w0**2 / 2.0 - g * gamma * sqrttwomw) * ni) Eee = np.sum((U*np.ones(nbsf) + gamma**2 * m*w0**2 - 2.0 * g * gamma * sqrttwomw) * nia * nib) alpha = gamma * numpy.sqrt(m * w0 / 2.0) const = np.exp(-alpha**2/2.) const_mat = np.array((nbsf,nbsf),dtype=np.float64) const_mat = np.einsum("i,j->ij",const,const) Ekin = np.sum(const_mat* T[0] * G[0] + const_mat*T[1] * G[1]) etot = Eph + Eeph + Eee + Ekin return etot.real class LangFirsov(object): def __init__(self, system, trial, verbose=False): self.verbose = verbose if verbose: print ("# Parsing free electron input options.") init_time = time.time() self.name = "lang_firsov" self.type = "lang_firsov" self.trial_type = complex self.initial_wavefunction = trial.get('initial_wavefunction', 'lang_firsov') if verbose: print ("# Diagonalising one-body Hamiltonian.") (self.eigs_up, self.eigv_up) = diagonalise_sorted(system.T[0]) (self.eigs_dn, self.eigv_dn) = diagonalise_sorted(system.T[1]) self.restricted = trial.get('restricted', False) self.reference = trial.get('reference', None) self.read_in = trial.get('read_in', None) self.psi = numpy.zeros(shape=(system.nbasis, system.nup+system.ndown), dtype=self.trial_type) assert (system.name == "HubbardHolstein") self.m = system.m self.w0 = system.w0 self.nocca = system.nup self.noccb = system.ndown if self.read_in is not None: if verbose: print ("# Reading trial wavefunction from %s"%(self.read_in)) try: self.psi = numpy.load(self.read_in) self.psi = self.psi.astype(self.trial_type) except OSError: if verbose: print("# Trial wavefunction is not in native numpy form.") print("# Assuming Fortran GHF format.") orbitals = read_fortran_complex_numbers(self.read_in) tmp = orbitals.reshape((2*system.nbasis, system.ne), order='F') ups = [] downs = [] # deal with potential inconsistency in ghf format... for (i, c) in enumerate(tmp.T): if all(abs(c[:system.nbasis]) > 1e-10): ups.append(i) else: downs.append(i) self.psi[:, :system.nup] = tmp[:system.nbasis, ups] self.psi[:, system.nup:] = tmp[system.nbasis:, downs] else: # I think this is slightly cleaner than using two separate # matrices. if self.reference is not None: self.psi[:, :system.nup] = self.eigv_up[:, self.reference] self.psi[:, system.nup:] = self.eigv_dn[:, self.reference] else: self.psi[:, :system.nup] = self.eigv_up[:, :system.nup] self.psi[:, system.nup:] = self.eigv_dn[:, :system.ndown] nocca = system.nup noccb = system.ndown nvira = system.nbasis-system.nup nvirb = system.nbasis-system.ndown self.virt = numpy.zeros((system.nbasis, nvira+nvirb)) self.virt[:, :nvira] = self.eigv_up[:,nocca:nocca+nvira] self.virt[:, nvira:nvira+nvirb] = self.eigv_dn[:,noccb:noccb+nvirb] gup = gab(self.psi[:, :system.nup], self.psi[:, :system.nup]).T if (system.ndown > 0): gdown = gab(self.psi[:, system.nup:], self.psi[:, system.nup:]).T else: gdown = numpy.zeros_like(gup) self.G = numpy.array([gup, gdown]) self.relax_gamma = trial.get('relax_gamma',False) # For interface compatability self.coeffs = 1.0 self.ndets = 1 self.bp_wfn = trial.get('bp_wfn', None) self.error = False self.eigs = numpy.append(self.eigs_up, self.eigs_dn) self.eigs.sort() self.gamma = system.g * numpy.sqrt(2.0 / (system.m*system.w0**3)) * numpy.ones(system.nbasis) print("# Initial gamma = {}".format(self.gamma)) self.run_variational(system) print("# Variational Lang-Firsov Energy = {}".format(self.energy)) self.initialisation_time = time.time() - init_time self.init = self.psi.copy() self.shift = numpy.zeros(system.nbasis) self.calculate_energy(system) self._rchol = None self._eri = None self._UVT = None print("# Lang-Firsov optimized gamma = {}".format(self.gamma)) print("# Lang-Firsov optimized shift = {}".format(self.shift)) print("# Lang-Firsov optimized energy = {}".format(self.energy)) if verbose: print ("# Updated lang_firsov.") if verbose: print ("# Finished initialising Lang-Firsov trial wavefunction.") def run_variational(self, system): nbsf = system.nbasis nocca = system.nup noccb = system.ndown nvira = system.nbasis - nocca nvirb = system.nbasis - noccb # nova = nocca*nvira novb = noccb*nvirb # x = numpy.zeros(nova+novb) Ca = numpy.zeros((nbsf,nbsf)) Ca[:,:nocca] = self.psi[:,:nocca] Ca[:,nocca:] = self.virt[:,:nvira] Cb = numpy.zeros((nbsf,nbsf)) Cb[:,:noccb] = self.psi[:,nocca:] Cb[:,noccb:] = self.virt[:,nvira:] # if (system.ndown > 0): c0 = numpy.zeros(nbsf*nbsf*2) c0[:nbsf*nbsf] = Ca.ravel() c0[nbsf*nbsf:] = Cb.ravel() else: c0 = numpy.zeros(nbsf*nbsf) c0[:nbsf*nbsf] = Ca.ravel() if self.relax_gamma: xtmp = numpy.zeros(nova+novb+nbsf) xtmp[:nova+novb] = x xtmp[nova+novb:nova+novb+nbsf] = self.gamma x = xtmp.copy() # self.shift = numpy.zeros(nbsf) self.energy = 1e6 for i in range (5): # Try 10 times res = minimize(objective_function, x, args=(float(system.nbasis), float(system.nup), float(system.ndown), system.T, system.U, system.g, system.m, system.w0, c0, self.restricted, self.relax_gamma), method='L-BFGS-B', jac=gradient, options={'disp':False}) e = res.fun if (self.verbose): print("# macro iter {} energy is {}".format(i, e)) if (e < self.energy and
numpy.abs(self.energy - e)
numpy.abs
import os import cv2 import sys import pdb import math import json import torch import random import argparse import numpy as np import torchvision import tensorboardX import torch.optim as optim import torchvision.utils as vutils from envs import * from PIL import Image from base.common import * def norm_angles(ags): # ags - angles in radians (batch_size, ) array return np.arctan2(np.sin(ags), np.cos(ags)) def evaluate_pose_transfer(loader, agent, split, opts): """ Evaluation of reconstruction agent on pose task Evaluation function - evaluates the agent over fixed grid locations as starting points and returns the overall average reconstruction error. """ # ---- Initial setup ---- depleted = False agent.policy.eval() azim_errors_all = [] elev_errors_all = [] while not depleted: # ---- Sample batch of data ---- if opts.actorType == 'demo_sidekick' or opts.actorType == 'saved_trajectories' or opts.actorType == 'peek_saliency': pano, pano_maps, depleted = loader.next_batch(split) pano_rewards = None elif opts.expert_rewards: pano, pano_rewards, depleted = loader.next_batch(split) pano_maps = None else: pano, depleted = loader.next_batch(split) pano_rewards, pano_maps = None, None # Initial setup for evaluating over a grid of views curr_err = 0 curr_count = 0 curr_err_batch = 0 batch_size = pano.shape[0] # Compute the performance with the initial state # starting at fixed grid locations if opts.start_view == 0: # Randomly sample one location from grid elevations = [random.randint(0, opts.N-1)] azimuths = [random.randint(0, opts.M-1)] elif opts.start_view == 1: # Sample only the center location from grid elevations = [opts.N//2] azimuths = [opts.M//2-1] elif opts.start_view == 2: elevations = range(0, opts.N, 2) azimuths = range(0, opts.M, 2) valid_out_elevations = np.array(range(0, opts.N)) valid_out_azimuths = np.array(range(0, opts.M)) for i in elevations: for j in azimuths: start_idx = [[i, j] for _ in range(batch_size)] state = State(pano, pano_rewards, start_idx, opts) # Enable view memorization for testing by default if opts.actorType == 'demo_sidekick' or opts.actorType == 'saved_trajectories' or opts.actorType == 'peek_saliency': _, rec_errs, _, _, _, visited_idxes, decoded_all, _, _, _ = agent.gather_trajectory(state, eval_opts={'greedy': opts.greedy, 'memorize_views': True}, pano_maps=pano_maps, opts=opts) else: _, rec_errs, _, _, _, visited_idxes, decoded_all, _, _, _ = agent.gather_trajectory(state, eval_opts={'greedy': opts.greedy, 'memorize_views': True}) # sampled_target_idx stix = [np.random.choice(valid_out_elevations, size=batch_size), np.random.choice( valid_out_azimuths, size=batch_size)] target_views = state.views_prepro_shifted[range(batch_size), stix[0], stix[1]] # (batch_size, C, 32, 32) belief_viewgrid = decoded_all[-1].cpu().data.numpy() # (batch_size, N, M, C, 32, 32) target_views_unsq = target_views[:, np.newaxis, np.newaxis, :, :, :] per_view_scores = -((belief_viewgrid - target_views_unsq)**2) per_view_scores = per_view_scores.reshape(batch_size, opts.N, opts.M, -1).mean(axis=3) # (batch_size, N, M) predicted_target_locs = np.unravel_index(np.argmax(per_view_scores.reshape(batch_size, -1), axis=1), (opts.N, opts.M)) predicted_target_angles = [] gt_target_angles = [] for b in range(batch_size): e, a = predicted_target_locs[0][b], predicted_target_locs[1][b] predicted_target_angles.append(opts.idx_to_angles[(e, a)]) e, a = stix[0][b], stix[1][b] gt_target_angles.append(opts.idx_to_angles[(e, a)]) predicted_target_angles = np.array(predicted_target_angles) gt_target_angles = np.array(gt_target_angles) azim_err = norm_angles(predicted_target_angles[:, 1] - gt_target_angles[:, 1]) elev_err = norm_angles(predicted_target_angles[:, 0] - gt_target_angles[:, 0]) azim_errors_all.append(np.abs(azim_err)) elev_errors_all.append(np.abs(elev_err)) agent.policy.train() azim_errors_all = np.concatenate(azim_errors_all, axis=0) elev_errors_all = np.concatenate(elev_errors_all, axis=0) avg_azim_err = math.degrees(np.mean(azim_errors_all)) avg_elev_err = math.degrees(np.mean(elev_errors_all)) return avg_azim_err, avg_elev_err def evaluate_pose(loader, agent, split, opts): """ Evaluation of the Pose agent itself Evaluation function - evaluates the agent over fixed grid locations as starting points and returns the overall average reconstruction error. """ # ---- Initial setup ---- depleted = False agent.policy.eval() azim_errors_all = [] elev_errors_all = [] decoded_images = [] while not depleted: # ---- Sample batch of data ---- if opts.actorType == 'demo_sidekick' or opts.actorType == 'saved_trajectories' or opts.actorType == 'peek_saliency': pano, pano_maps, depleted = loader.next_batch(split) pano_rewards = None elif opts.expert_rewards: pano, pano_rewards, depleted = loader.next_batch(split) pano_maps = None else: pano, depleted = loader.next_batch(split) pano_rewards, pano_maps = None, None # Initial setup for evaluating over a grid of views batch_size = pano.shape[0] # Compute the performance with the initial state # starting at fixed grid locations if opts.start_view == 0: # Randomly sample one location from grid elevations = [random.randint(0, opts.N-1)] azimuths = [random.randint(0, opts.M-1)] elif opts.start_view == 1: # Sample only the center location from grid elevations = [opts.N//2] azimuths = [opts.M//2-1] elif opts.start_view == 2: elevations = range(0, opts.N, 2) azimuths = range(0, opts.M, 2) valid_out_elevations = np.array(range(0, opts.N)) valid_out_azimuths = np.array(range(0, opts.M)) elev_to_vis = elevations[random.randint(0, len(elevations)-1)] azim_to_vis = azimuths[random.randint(0, len(azimuths)-1)] for i in elevations: for j in azimuths: start_idx = [[i, j] for _ in range(batch_size)] state = State(pano, pano_rewards, start_idx, opts) # Enable view memorization for testing by default if opts.actorType == 'demo_sidekick' or opts.actorType == 'saved_trajectories' or opts.actorType == 'peek_saliency': _, _, _, _, _, visited_idxes, decoded_all, _, _, _ = agent.gather_trajectory(state, eval_opts={'greedy': opts.greedy, 'memorize_views': True}, pano_maps=pano_maps, opts=opts) else: _, _, _, _, _, visited_idxes, decoded_all, _, _, _ = agent.gather_trajectory(state, eval_opts={'greedy': opts.greedy, 'memorize_views': True}, pano_maps=pano_maps, opts=opts) # sampled_target_idx stix = [np.random.choice(valid_out_elevations, size=batch_size), np.random.choice( valid_out_azimuths, size=batch_size)] target_views = state.views_prepro_shifted[range(batch_size), stix[0], stix[1]] # (batch_size, C, 32, 32) belief_viewgrid = decoded_all[-1].cpu().data.numpy() # (batch_size, N, M, C, 32, 32) target_views_unsq = target_views[:, np.newaxis, np.newaxis, :, :, :] per_view_scores = -((belief_viewgrid - target_views_unsq)**2) per_view_scores = per_view_scores.reshape(batch_size, opts.N, opts.M, -1).mean(axis=3) # (batch_size, N, M) predicted_target_locs = np.unravel_index(np.argmax(per_view_scores.reshape(batch_size, -1), axis=1), (opts.N, opts.M)) predicted_target_angles = [] gt_target_angles = [] for b in range(batch_size): e, a = predicted_target_locs[0][b], predicted_target_locs[1][b] predicted_target_angles.append(opts.idx_to_angles[(e, a)]) e, a = stix[0][b], stix[1][b] gt_target_angles.append(opts.idx_to_angles[(e, a)]) predicted_target_angles = np.array(predicted_target_angles) gt_target_angles = np.array(gt_target_angles) azim_err = norm_angles(predicted_target_angles[:, 1] - gt_target_angles[:, 1]) elev_err = norm_angles(predicted_target_angles[:, 0] - gt_target_angles[:, 0]) azim_errors_all.append(np.abs(azim_err)) elev_errors_all.append(np.abs(elev_err)) # For some random initial state, print the decoded images at all time steps if i == elev_to_vis and j == azim_to_vis: curr_decoded_plus_true = None for dec_idx in range(len(decoded_all)): decoded = decoded_all[dec_idx].data.cpu() curr_decoded = decoded.numpy() # Rotate it forward by the start index # Shifting all the images by equal amount since the start idx is same for all elev_start = start_idx[0][0] azim_start = start_idx[0][1] if not opts.knownAzim: curr_decoded = np.roll(curr_decoded, azim_start, axis=2) if not opts.knownElev: curr_decoded = np.roll(curr_decoded, elev_start, axis=1) # Fill in the true views here for jdx, jdx_v in enumerate(visited_idxes): if jdx > dec_idx: break for idx in range(batch_size): elev_curr = jdx_v[idx][0] azim_curr = jdx_v[idx][1] curr_decoded[idx, elev_curr, azim_curr, :, :, :] = state.views_prepro[idx, elev_curr, azim_curr, :, :, :] curr_decoded = curr_decoded * 255 for c in range(opts.num_channels): curr_decoded[:, :, :, c, :, :] += opts.mean[c] if opts.num_channels == 1: # convert to 3 channeled image by repeating grayscale curr_decoded = np.repeat(curr_decoded, 3, axis=3) jdx_v = visited_idxes[dec_idx] for idx in range(batch_size): # fill in some red margin elev_curr = jdx_v[idx][0] azim_curr = jdx_v[idx][1] curr_decoded[idx, elev_curr, azim_curr, :, 0:3, :] = 0 curr_decoded[idx, elev_curr, azim_curr, :, -3:, :] = 0 curr_decoded[idx, elev_curr, azim_curr, :, :, 0:3] = 0 curr_decoded[idx, elev_curr, azim_curr, :, :, -3:] = 0 curr_decoded[idx, elev_curr, azim_curr, 0, 0:3, :] = 255 curr_decoded[idx, elev_curr, azim_curr, 0, -3:, :] = 255 curr_decoded[idx, elev_curr, azim_curr, 0, :, 0:3] = 255 curr_decoded[idx, elev_curr, azim_curr, 0, :, -3:] = 255 # Need to convert from B x N x M x C x 32 x 32 to B x 1 x C x N*32 x M*32 # Convert from B x N x M x C x 32 x 32 to B x C x N x 32 x M x 32 and then reshape curr_decoded = curr_decoded.transpose((0, 3, 1, 4, 2, 5)).reshape(batch_size, 1, 3, opts.N*32, opts.M*32) true_state = np.array(state.views) start_idx = state.start_idx if opts.num_channels == 1: # convert to 3 channeled image by repeating grayscale true_state = np.repeat(true_state, 3, axis=3) # Fill in red margin for starting states of each true panorama for idx in range(batch_size): true_state[idx, start_idx[idx][0], start_idx[idx][1], :, 0:3, :] = 0 true_state[idx, start_idx[idx][0], start_idx[idx][1], :, -3:, :] = 0 true_state[idx, start_idx[idx][0], start_idx[idx][1], :, :, 0:3] = 0 true_state[idx, start_idx[idx][0], start_idx[idx][1], :, :, -3:] = 0 true_state[idx, start_idx[idx][0], start_idx[idx][1], 0, 0:3, :] = 255 true_state[idx, start_idx[idx][0], start_idx[idx][1], 0, -3:, :] = 255 true_state[idx, start_idx[idx][0], start_idx[idx][1], 0, :, 0:3] = 255 true_state[idx, start_idx[idx][0], start_idx[idx][1], 0, :, -3:] = 255 # Fill in blue margin for the GT view whose pose needs to be estimated for idx in range(batch_size): elev_idx = stix[0][idx] # Assumes that the azimuth is unknown initially azim_idx = (start_idx[idx][1] + stix[1][idx]) % (opts.M) true_state[idx, elev_idx, azim_idx, :, 0:3, :] = 0 true_state[idx, elev_idx, azim_idx, :, -3:, :] = 0 true_state[idx, elev_idx, azim_idx, :, :, 0:3] = 0 true_state[idx, elev_idx, azim_idx, :, :, -3:] = 0 true_state[idx, elev_idx, azim_idx, 2, 0:3, :] = 255 true_state[idx, elev_idx, azim_idx, 2, -3:, :] = 255 true_state[idx, elev_idx, azim_idx, 2, :, 0:3] = 255 true_state[idx, elev_idx, azim_idx, 2, :, -3:] = 255 # Fill in green margin for the view corresponding to the predicted pose for idx in range(batch_size): elev_idx = predicted_target_locs[0][idx] # Assumes that the azimuth is unknown initially azim_idx = (start_idx[idx][1] + predicted_target_locs[1][idx]) % (opts.M) true_state[idx, elev_idx, azim_idx, :, 0:3, :] = 0 true_state[idx, elev_idx, azim_idx, :, -3:, :] = 0 true_state[idx, elev_idx, azim_idx, :, :, 0:3] = 0 true_state[idx, elev_idx, azim_idx, :, :, -3:] = 0 true_state[idx, elev_idx, azim_idx, 1, 0:3, :] = 255 true_state[idx, elev_idx, azim_idx, 1, -3:, :] = 255 true_state[idx, elev_idx, azim_idx, 1, :, 0:3] = 255 true_state[idx, elev_idx, azim_idx, 1, :, -3:] = 255 true_state = true_state.transpose((0, 3, 1, 4, 2, 5)).reshape(batch_size, 1, 3, opts.N*32, opts.M*32) # Draw arrows representing the actions on the true_state for idx in range(batch_size): true_state_curr = true_state[idx, 0].transpose(1, 2, 0).copy() for jdx in range(1, len(visited_idxes)): elev_curr = visited_idxes[jdx][idx][0] azim_curr = visited_idxes[jdx][idx][1] elev_prev = visited_idxes[jdx-1][idx][0] azim_prev = visited_idxes[jdx-1][idx][1] arrow_start = (azim_prev * 32 + 16, elev_prev * 32 + 16) arrow_end = (azim_curr * 32 + 16, elev_curr * 32 + 16) draw_arrow(true_state_curr, arrow_start, arrow_end, (255, 0, 0)) true_state[idx, 0] = true_state_curr.transpose(2, 0, 1) if curr_decoded_plus_true is None: curr_decoded_plus_true = curr_decoded else: curr_decoded_plus_true = np.concatenate([curr_decoded_plus_true, curr_decoded], axis=1) curr_decoded_plus_true =
np.concatenate([true_state, curr_decoded_plus_true], axis=1)
numpy.concatenate
import collections from abc import ABC from typing import Tuple, List, Dict import numpy as np class StepInformationProvider(ABC): """ This class calculates certain values which are used frequently in reward generators. A single instance of this class can be shared between a set of (sub)generators to prevent multiple calculations of costly intermediate results. :param maze: (np.ndarray) two dimensional array defining the maze where 0 indicates passable terrain and 1 indicates an obstacle :param goal: (list) A point coordinate in form [x, y] ([column, row]) defining the goal. :param goal_range: (int) Range around the goal position which should be treated as 'goal reached'. :param n_particles: (int) Total number of robots. :param action_map: (dict) Map containing allowed actions. """ def __init__( self, maze: np.ndarray, goal: Tuple[int, int], goal_range: int, n_particles: int, action_map: Dict[int, Tuple[int, int]], relative: bool = False, ): self.goal_range = goal_range self.n_particles = n_particles self.initial_robot_locations = None self.action_map = action_map self.maze = maze self.goal = goal self.relative = relative self.last_locations = None self.last_action = None self._cost = None self._max_start_cost = None self._max_cost = None self._particle_cost = None self._total_start_cost = None self._total_cost = None self._unique_particles = None self._done = False self._step_reward = 0.0 self._mean_cost = None self._ep_len_estimate = None self._convex_corners = None def reset(self, locations): self.initial_robot_locations = np.copy(locations) self.last_locations = locations self._done = False if self.relative: self._ep_len_estimate = None self._total_start_cost = None self._max_start_cost = None def step(self, action, locations): self._step_reward = 0.0 self.last_locations = locations self.last_action = action self._step_reset() def stepped_generator(self, done, reward): self._step_reward += reward if done: self._done = True def _step_reset(self): self._max_cost = None self._particle_cost = None self._total_cost = None self._unique_particles = None def _calculate_cost_map(self, maze, goal) -> np.ndarray: """ Calculates the cost map based on a given goal position via bfs """ queue = collections.deque([goal]) # [x, y] pairs in point notation order! seen = np.zeros(maze.shape, dtype=int) seen[goal[1], goal[0]] = 1 cost = np.zeros(maze.shape, dtype=int) height, width = maze.shape while queue: x, y = queue.popleft() for action in self.action_map.values(): x2, y2 = x + action[1], y + action[0] if ( 0 <= x2 < width and 0 <= y2 < height and maze[y2, x2] != 1 and seen[y2, x2] != 1 ): queue.append([x2, y2]) seen[y2, x2] = 1 cost[y2, x2] = cost[y, x] + 1 return cost def _count_convex_corners(self) -> Tuple[int, int, int, int]: """ Calculates the number of convex corners :return: (Tuple[int, int, int, int]) Tuple containing the number of convex corners for nw, ne, sw and se convex corners. """ nw = ne = sw = se = 0 for ix, iy in np.ndindex(self.maze.shape): if self.maze[ix, iy] == 0: if self.maze[ix + 1, iy] == 1 and self.maze[ix, iy + 1] == 1: sw += 1 elif self.maze[ix + 1, iy] == 1 and self.maze[ix, iy - 1] == 1: se += 1 elif self.maze[ix - 1, iy] == 1 and self.maze[ix, iy + 1] == 1: nw += 1 elif self.maze[ix - 1, iy] == 1 and self.maze[ix, iy - 1] == 1: ne += 1 return (nw, ne, sw, se) def _count_freespace(self): free = 0 idxes = np.argwhere(self.maze == 0) for iy, ix in idxes: if (self.maze[iy - 1 : iy + 1, ix - 1 : ix + 1] == 0).all(): free += 1 return free def set_particle_count(self, n_particles): self.n_particles = n_particles self._total_start_cost = None @property def convex_corners(self) -> Tuple[int, int, int, int]: if self._convex_corners is None: self._convex_corners = self._count_convex_corners() return self._convex_corners @property def costmap(self) -> np.ndarray: if self._cost is None: self._cost = self._calculate_cost_map(self.maze, self.goal) return self._cost @property def max_start_cost(self) -> float: if self._max_start_cost is None: if self.relative: self._max_start_cost = np.max(self.particle_cost) else: self._max_start_cost = np.max(self.costmap) return self._max_start_cost @property def particle_cost(self) -> np.ndarray: if self._particle_cost is None: self._particle_cost = self.costmap.ravel()[ ( self.last_locations[:, 1] + self.last_locations[:, 0] * self.costmap.shape[1] ) ] return self._particle_cost @property def episode_length_estimate(self) -> int: if self._ep_len_estimate is None: points = np.argwhere(self.maze == 0) extremes = np.argmax(points, axis=0) if np.sum(points[extremes[0]]) > np.sum(points[extremes[1]]): extreme = points[extremes[0]] else: extreme = points[extremes[1]] costmap = self._calculate_cost_map(self.maze, (extreme[1], extreme[0])) self._ep_len_estimate = int( 0.75 * np.max(costmap) * np.log(self.mean_cost * np.min(self.convex_corners)) ) return self._ep_len_estimate @property def mean_cost(self) -> int: if self._mean_cost is None: self._mean_cost =
np.ma.masked_equal(self.costmap, 0)
numpy.ma.masked_equal
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() # 创建3d图形的两种方式 # ax = Axes3D(fig) ax = fig.add_subplot(111, projection='3d') # X, Y value X = np.arange(-5, 5, 0.2) Y = np.arange(-5, 5, 0.2) X, Y =
np.meshgrid(X, Y)
numpy.meshgrid
# -*- coding: utf-8 -*- """ Created on Tue Mar 3 15:10:24 2020 @author: Nicolai ---------------- """ import numpy as np import time from scipy.stats import cauchy import testFunctions as tf def L_SHADE(population, p, H, function, minError, maxGeneration): ''' implementation of L-SHADE based on: \n Improving the Search Performance of SHADE Using Linear Population Size Reduction\n by Tanabe and Fukunaga\n adaptions: * no constraint handling implemented * population size reduction based on generation insteas of function evaluation Parameters ---------- population: numpy array 2D numpy array where lines are candidates and colums is the dimension p: float ]0,1] percentage of best individuals for current-to-p-best mutation H: int size of the memory function: function fitness function that is optimised minError: float stopping condition on function value maxGeneration: int stopping condition on max number of generation Returns ------- history: tuple tupel[0] - popDynamic\n tupel[1] - FEDynamic\n tupel[2] - FDynamic\n tupel[3] - CRDynamic\n Examples -------- >>> import numpy as np >>> def sphere(x): return np.dot(x,x) >>> maxError = -1*np.inf >>> maxGen = 10**3 >>> H = 50 >>> population = 100*np.random.rand(50,2) >>> p = 0.1 >>> (popDynamic, FEDynamic, FDynamic, CRDynamic) = L_SHADE(population, p, H, sphere, maxError, maxGen) ''' # initialisation of variables populationSize, dimension = population.shape functionValue = np.asarray([function(candidate) for candidate in population]) genCount = 1 F = 0.5 CR = 0.5 archive = np.array([population[0]]) # temorary arrays for holding the population and its function values # during a generation trailPopulation = np.copy(population) trailFunctionValue = np.copy(functionValue) # memory for control parameters mCR = 0.5*np.ones(H) mF = 0.5*np.ones(H) # k is the running memory index k = 0 # population size reduction parameter NGmin = int(np.ceil(1/p)) NGinit = populationSize popDynamic = [] FEDynamic = [] FDynamic = [] CRDynamic = [] popDynamic.append(np.copy(population)) FEDynamic.append(np.copy(functionValue)) FDynamic.append(np.copy(mF)) CRDynamic.append(np.copy(mCR)) while(genCount < maxGeneration and np.min(functionValue) > minError): # success history S for control parameters sCR = [] sF = [] sCRtemp = [] sFtemp = [] for i in range(populationSize): F = selectF(mF) sFtemp.append(F) vi = mutationCurrentToPBest1(population, archive, i, functionValue, F, p) CR = selectCR(mCR) sCRtemp.append(CR) ui = crossoverBIN(
np.array([population[i]])
numpy.array
"""MIT License Copyright (c) 2019 schellekensv Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.""" """Contains tools to compute the sketch the dataset.""" # Main imports import numpy as np import matplotlib.pyplot as plt # For verbose import scipy.optimize import sys # For error handling from copy import copy ####################################### ### 1: Frequency sampling functions ### ####################################### # 1.0: dithering def drawDithering(m,bounds = None): '''Draws m samples a <= x < b, with bounds=(a,b) (default: (0,2*pi)).''' if bounds is None: (lowb,highb) = (0,2*np.pi) else: (lowb,highb) = bounds return np.random.uniform(low=lowb,high=highb,size=m) # 1.1: frequency sampling functions # 1.1.1: gaussian sampling def drawFrequencies_Gaussian(d,m,Sigma = None): '''draws frequencies according to some sampling pattern''' if Sigma is None: Sigma = np.identity(d) Om = np.random.multivariate_normal(np.zeros(d), np.linalg.inv(Sigma), m).T # inverse of sigma return Om # 1.1.2: folded gaussian sampling def drawFrequencies_FoldedGaussian(d,m,Sigma = None): '''draws frequencies according to some sampling pattern omega = R*Sigma^{-1/2}*phi, for R from folded Gaussian with variance 1, phi uniform''' if Sigma is None: Sigma = np.identity(d) R = np.abs(np.random.randn(m)) # folded standard normal distribution radii phi = np.random.randn(d,m) phi = phi / np.linalg.norm(phi,axis=0) # normalize -> randomly sampled from unit sphere SigFact = np.linalg.inv(np.linalg.cholesky(Sigma)) Om = SigFact@phi*R return Om # 1.1.3: adapted radius sampling def sampleFromPDF(pdf,x,nsamples=1): '''x is a vector (the support of the pdf), pdf is the values of pdf eval at x''' # Note that this can be more general than just the adapted radius distribution pdf = pdf/np.sum(pdf) # ensure pdf is normalized cdf = np.cumsum(pdf) # necessary? cdf[-1] = 1. sampleCdf = np.random.uniform(0,1,nsamples) sampleX = np.interp(sampleCdf, cdf, x) return sampleX def pdfAdaptedRadius(r,KMeans=False): '''up to a constant''' if KMeans: return r*np.exp(-(r**2)/2) # Dont take the gradient according to sigma into account else: return np.sqrt(r**2 + (r**4)/4)*np.exp(-(r**2)/2) def drawFrequencies_AdaptedRadius(d,m,Sigma = None,KMeans=False): '''draws frequencies according to some sampling pattern omega = R*Sigma^{-1/2}*phi, for R from adapted with variance 1, phi uniform''' if Sigma is None: Sigma = np.identity(d) # Sample the radii r = np.linspace(0,5,2001) R = sampleFromPDF(pdfAdaptedRadius(r,KMeans),r,nsamples=m) phi = np.random.randn(d,m) phi = phi / np.linalg.norm(phi,axis=0) # normalize -> randomly sampled from unit sphere SigFact = np.linalg.inv(np.linalg.cholesky(Sigma)) Om = SigFact@phi*R return Om def pdf_diffOfGaussians(r,GMM_upper=None,GMM_lower=None): """Here, GMM is given in terms of SD and not variance""" if isinstance(GMM_upper,tuple): (weights_upper,sigmas_upper) = GMM_upper elif GMM_upper is None: weights_upper = np.array([]) # Empty array else: (weights_upper,sigmas_upper) = (np.array([1.]),np.array([GMM_upper])) if isinstance(GMM_lower,tuple): (weights_lower,sigmas_lower) = GMM_lower elif GMM_lower is None: weights_lower = np.array([]) else: (weights_lower,sigmas_lower) = (np.array([1.]),np.array([GMM_lower])) res = np.zeros(r.shape) # Add for k in range(weights_upper.size): res += weights_upper[k]*np.exp(-0.5*(r**2)/(sigmas_upper[k]**2)) # Substract for k in range(weights_lower.size): res -= weights_lower[k]*np.exp(-0.5*(r**2)/(sigmas_lower[k]**2)) # Ensure pdf is positive pdf_is_negative = res < 0 if any(pdf_is_negative): print(res[:5]) # Print a warning if the negative pdf values are significant (not due to rounding errors) tol = 1e-8 if np.max(np.abs(res[np.where(pdf_is_negative)[0]])) > tol: print("WARNING: negative pdf values detected and replaced by zero, check the validity of your input") # Correct the negative values res[np.where(pdf_is_negative)[0]] = 0. return res def drawFrequencies_diffOfGaussians(d,m,GMM_upper,GMM_lower=None,verbose=0): '''draws frequencies according to some sampling pattern omega = R*Sigma^{-1/2}*phi, TODO, phi uniform''' # reasonable sampling n_Rs = 1001 if isinstance(GMM_upper,tuple): R_max = 4*np.max(GMM_upper[1]) # GMM_upper is (weights, cov)-type tuple else: R_max = 4*GMM_upper r = np.linspace(0,R_max,n_Rs) if verbose > 0: plt.plot(r,pdf_diffOfGaussians(r,GMM_upper,GMM_lower)) plt.xlabel('frequency norm r') plt.ylabel('pdf(r)') plt.show() # sample from the diff of gaussians pdf R = sampleFromPDF(pdf_diffOfGaussians(r,GMM_upper,GMM_lower),r,nsamples=m) phi = np.random.randn(d,m) phi = phi / np.linalg.norm(phi,axis=0) # normalize -> randomly sampled from unit sphere Om = phi*R return Om # General function for convenience def drawFrequencies(drawType,d,m,Sigma = None,nb_cat_per_dim=None): """Draw the 'frequencies' or projection matrix Omega for sketching. Arguments: - drawType: a string indicating the sampling pattern (Lambda) to use, one of the following: -- "gaussian" or "G" : Gaussian sampling > Lambda = N(0,Sigma^{-1}) -- "foldedGaussian" or "FG" : Folded Gaussian sampling (i.e., the radius is Gaussian) -- "adaptedRadius" or "AR" : Adapted Radius heuristic - d: int, dimension of the data to sketch - m: int, number of 'frequencies' to draw (the target sketch dimension) - Sigma: is either: -- (d,d)-numpy array, the covariance of the data (note that we typically use Sigma^{-1} in the frequency domain). -- a tuple (w,cov) describing a scale mixture of Gaussians where, -- w: (K,)-numpy array, the weights of the scale mixture -- cov: (K,d,d)-numpy array, the K different covariances in the mixture -- None: same as Sigma = identity matrix (belongs to (d,d)-numpy array case) If Sigma is None (default), we assume that data was normalized s.t. Sigma = identity. - nb_cat_per_dim: (d,)-array of ints, the number of categories per dimension for integer data, if its i-th entry = 0 (resp. > 0), dimension i is assumed to be continuous (resp. int.). By default all entries are assumed to be continuous. Frequencies for int data is drawn as follows: 1. Chose one dimension among the categorical ones, set Omega along all others to zero 2. For the chosen dimension with C categories, we draw its component omega ~ U({0,...,C-1}) * 2*pi/C Returns: - Omega: (d,m)-numpy array containing the 'frequency' projection matrix """ # Parse drawType input if drawType.lower() in ["drawfrequencies_gaussian","gaussian","g"]: drawFunc = drawFrequencies_Gaussian elif drawType.lower() in ["drawfrequencies_foldedgaussian","foldedgaussian","folded_gaussian","fg"]: drawFunc = drawFrequencies_FoldedGaussian elif drawType.lower() in ["drawfrequencies_adapted","adaptedradius","adapted_radius","ar"]: drawFunc = drawFrequencies_AdaptedRadius elif drawType.lower() in ["drawfrequencies_adapted_kmeans","adaptedradius_kmeans","adapted_radius_kmeans","arkm","ar-km"]: drawFunc = lambda _a,_b,_c : drawFrequencies_AdaptedRadius(_a,_b,_c,KMeans=True) else: raise ValueError("drawType not recognized") # Handle no input if Sigma is None: Sigma = np.identity(d) # Handle if isinstance(Sigma,np.ndarray): Omega = drawFunc(d,m,Sigma) # Handle mixture-type input elif isinstance(Sigma,tuple): (w,cov) = Sigma # unpack K = w.size # Assign the frequencies to the mixture components assignations = np.random.choice(K,m,p=w) Omega = np.zeros((d,m)) for k in range(K): active_index = (assignations == k) if any(active_index): Omega[:,np.where(active_index)[0]] = drawFunc(d,active_index.sum(),cov[k]) elif (isinstance(Sigma,float) or isinstance(Sigma,int)) and Sigma > 0: Omega = drawFunc(d,m,Sigma*np.eye(d)) else: raise ValueError("Sigma not recognized") # If needed, overwrite the integer entries if nb_cat_per_dim is not None: intg_index = np.nonzero(nb_cat_per_dim)[0] d_intg = np.size(intg_index) Omega_intg = np.zeros((d_intg,m)) for intgdim_localindex,intg_globalindex in enumerate(intg_index): C = nb_cat_per_dim[intg_globalindex] Omega_intg[intgdim_localindex,:] = (2*np.pi/C)*np.random.randint(0,C,(1,m)) # Mask masks_pool = np.eye(d_intg) masks = masks_pool[np.random.choice(d_intg,m)].T Omega_intg = Omega_intg*masks Omega[intg_index] = Omega_intg return Omega # The following funtions allows to estimate Sigma (some utils first, main function is "estimate_Sigma") # Optimization problem to fit a GMM curve to the data def _fun_grad_fit_sigmas(p,R,z): """ Function and gradient to solve the optimization problem min_{w,sigs2} sum_{i = 1}^n ( z[i] - sum_{k=1}^K w[k]*exp(-R[i]^2*sig2[k]/2) )^2 Arguments: - p, a (2K,) numpy array obtained by stacking - w : (K,) numpy array - sigs2 : (K,) numpy array - R: (n,) numpy array, data to fit (x label) - z: (n,) numpy array, data to fit (y label) Returns: - The function evaluation - The gradient """ K = p.size//2 w = p[:K] sigs2 = p[K:] n = R.size # Naive implementation, TODO better? fun = 0 grad = np.zeros(2*K) for i in range(n): fun += (z[i] - [email protected](-(sigs2*R[i]**2)/2.))**2 grad[:K] += (z[i] - [email protected](-(sigs2*R[i]**2)/2.)) * (- np.exp(-(sigs2*R[i]**2)/2.)) # grad of w grad[K:] += (z[i] - [email protected](-(sigs2*R[i]**2)/2.)) * (- w * np.exp(-(sigs2*R[i]**2)/2.)) * (-0.5*R[i]**2) # grad of sigma2 return (fun,grad) # For normalization in the optimization problem def _callback_fit_sigmas(p): K = p.size//2 p[:K] /= np.sum(p[:K]) def estimate_Sigma_from_sketch(z,Phi,K=1,c=20,mode='max',sigma2_bar=None,weights_bar=None,should_plot=False): # Parse if mode == 'max': mode_criterion = np.argmax elif mode == 'min': mode_criterion = np.argmin else: raise ValueError("Unrecocgnized mode ({})".format(mode)) # sort the freqs by norm Rs = np.linalg.norm(Phi.Omega,axis=0) i_sort = np.argsort(Rs) Rs = Rs[i_sort] z_sort = z[i_sort]/Phi.c_norm # sort and normalize individual entries to 1 # Initialization # number of freqs per box s = Phi.m//c # init point if sigma2_bar is None: sigma2_bar = np.random.uniform(0.3,1.6,K) if weights_bar is None: weights_bar = np.ones(K)/K # find the indices of the max of each block jqs = np.empty(c) for ic in range(c): j_max = mode_criterion(np.abs(z_sort)[ic*s:(ic+1)*s]) + ic*s jqs[ic] = j_max jqs = jqs.astype(int) R_tofit = Rs[jqs] z_tofit = np.abs(z_sort)[jqs] # Set up the fitting opt. problem f = lambda p: _fun_grad_fit_sigmas(p,R_tofit,z_tofit) # cost p0 = np.zeros(2*K) # initial point p0[:K] = weights_bar # w p0[K:] = sigma2_bar # Bounds of the optimization problem bounds = [] for k in range(K): bounds.append([1e-5,1]) # bounds for the weigths for k in range(K): bounds.append([5e-4*sigma2_bar[k],2e3*sigma2_bar[k]]) # bounds for the sigmas -> cant cange too much # Solve the sigma^2 optimization problem sol = scipy.optimize.minimize(f, p0,jac = True, bounds = bounds,callback=_callback_fit_sigmas) p = sol.x weights_bar = np.array(p[:K])/np.sum(p[:K]) sigma2_bar = np.array(p[K:]) # Plot if required if should_plot: plt.figure(figsize=(10,5)) rfit = np.linspace(0,Rs.max(),100) zfit = np.zeros(rfit.shape) for k in range(K): zfit += weights_bar[k]*np.exp(-(sigma2_bar[k]*rfit**2)/2.) plt.plot(Rs,np.abs(z_sort),'.') plt.plot(R_tofit,z_tofit,'.') plt.plot(rfit,zfit) plt.xlabel('R') plt.ylabel('|z|') plt.show() return sigma2_bar def estimate_Sigma(dataset,m0,K=None,c=20,n0=None,drawFreq_type = "AR",nIterations=5,mode='max',verbose=0): """Automatically estimates the "Sigma" parameter(s) (the scale of data clusters) for generating the sketch operator. We assume here that Sigma = sigma2_bar * identity matrix. To estimate sigma2_bar, lightweight sketches of size m0 are generated from (a small subset of) the dataset with candidate values for sigma2_bar. Then, sigma2_bar is updated by fitting a Gaussian to the absolute values of the obtained sketch. Cfr. https://arxiv.org/pdf/1606.02838.pdf, sec 3.3.3. Arguments: - dataset: (n,d) numpy array, the dataset X: n examples in dimension d - m0: int, number of candidate 'frequencies' to draw (can be typically smaller than m). - K: int (default 1), number of scales to fit (if > 1 we fit a scale mixture) - c: int (default 20), number of 'boxes' (i.e. number of maxima of sketch absolute values to fit) - n0: int or None, if given, n0 samples from the dataset are subsampled to be used for Sigma estimation - drawType: a string indicating the sampling pattern (Lambda) to use in the pre-sketches, either: -- "gaussian" or "G" : Gaussian sampling > Lambda = N(0,Sigma^{-1}) -- "foldedGaussian" or "FG" : Folded Gaussian sampling (i.e., the radius is Gaussian) -- "adaptedRadius" or "AR" : Adapted Radius heuristic - nIterations: int (default 5), the maximum number of iteration (typically stable after 2 iterations) - mode: 'max' (default) or 'min', describe which sketch entries per block to fit - verbose: 0,1 or 2, amount of information to print (default: 0, no info printed). Useful for debugging. Returns: If K = 1: - Sigma: (d,d)-numpy array, the (diagonal) estimated covariance of the clusters in the dataset; If K > 1: a tuple (w,Sigma) representing the scale mixture model, where: - w: (K,)-numpy array, the weigths of the scale mixture (sum to 1) - Sigma: (K,d,d)-numpy array, the dxd covariances in the scale mixture """ return_format_is_matrix = K is None K = 1 if K is None else K (n,d) = dataset.shape # X is the subsampled dataset containing only n0 examples if n0 is not None and n0<n: X = dataset[np.random.choice(n,n0,replace=False)] else: X = dataset # Check if we dont overfit the empirical Fourier measurements if (m0 < (K * 2)*c): print("WARNING: overfitting regime detected for frequency sampling fitting") # Initialization #maxNorm = np.max(np.linalg.norm(X,axis=1)) sigma2_bar = np.random.uniform(0.3,1.6,K) weights_bar = np.ones(K)/K # Actual algorithm for i in range(nIterations): # Draw frequencies according to current estimate sigma2_bar_matrix = np.outer(sigma2_bar,np.eye(d)).reshape(K,d,d) # covariances in (K,d,d) format Omega0 = drawFrequencies(drawFreq_type,d,m0,Sigma = (weights_bar,sigma2_bar_matrix)) # Compute unnormalized complex exponential sketch Phi0 = SimpleFeatureMap("ComplexExponential",Omega0) z0 = computeSketch(X,Phi0) should_plot = verbose > 1 or (verbose > 0 and i >= nIterations - 1) sigma2_bar = estimate_Sigma_from_sketch(z0,Phi0,K,c,mode,sigma2_bar,weights_bar,should_plot) if return_format_is_matrix: Sigma = sigma2_bar[0]*np.eye(d) else: sigma2_bar_matrix = np.outer(sigma2_bar,np.eye(d)).reshape(K,d,d) # covariances in (K,d,d) format Sigma = (weights_bar,sigma2_bar_matrix) return Sigma ####################################### ### 2: Feature map functions ### ####################################### # 2.1: Common sketch nonlinearities and derivatives def _complexExponential(t,T=2*np.pi): return np.exp(1j*(2*np.pi)*t/T) def _complexExponential_grad(t,T=2*np.pi): return ((1j*2*np.pi)/T)*np.exp(1j*(2*np.pi)*t/T) def _universalQuantization(t,Delta=np.pi,centering=True): if centering: return ( (t // Delta) % 2 )*2-1 # // stands for "int division else: return ( (t // Delta) % 2 ) # centering=false => quantization is between 0 and +1 def _universalQuantization_complex(t,Delta=np.pi,centering=True): return _universalQuantization(t-Delta/2,Delta=Delta,centering=centering) + 1j*_universalQuantization(t-Delta,Delta=Delta,centering=centering) def _sawtoothWave(t,T=2*np.pi,centering=True): if centering: return ( t % T )/T*2-1 else: return ( t % T )/T # centering=false => output is between 0 and +1 def _sawtoothWave_complex(t,T=2*np.pi,centering=True): return _sawtoothWave(t-T/4,T=T,centering=centering) + 1j*_sawtoothWave(t-T/2,T=T,centering=centering) def _triangleWave(t,T=2*np.pi): return (2*(t % T)/T ) - (4*(t % T)/T - 2)*( (t // T) % 2 ) - 1 def _fourierSeriesEvaluate(t,coefficients,T=2*np.pi): """T = period coefficients = F_{-K}, ... , F_{-1}, F_{0}, F_{1}, ... F_{+K}""" K = (coefficients.shape[0]-1)/2 ks = np.arange(-K,K+1) # Pre-alloc ft = np.zeros(t.shape) + 0j for i in range(2*int(K)+1): ft += coefficients[i]*np.exp(1j*(2*np.pi)*ks[i]*t/T) return ft # dict of nonlinearities and their gradient returned as a tuple _dico_nonlinearities = { "complexexponential":(_complexExponential,_complexExponential_grad), "universalquantization":(_universalQuantization,None), "universalquantization_complex":(_universalQuantization_complex,None), "sawtooth":(_sawtoothWave,None), "sawtooth_complex":(_sawtoothWave_complex,None), "cosine": (lambda x: np.cos(x),lambda x: -np.sin(x)) } # 2.2 FeatureMap objects # Abstract feature map class class FeatureMap: """Template for a generic Feature Map. Useful to check if an object is an instance of FeatureMap.""" def __init__(self): pass def __call__(self): raise NotImplementedError("The way to compute the feature map is not specified.") def grad(self): raise NotImplementedError("The way to compute the gradient of the feature map is not specified.") # TODO find a better name class SimpleFeatureMap(FeatureMap): """Feature map the type Phi(x) = c_norm*f(Omega^T*x + xi).""" def __init__(self, f, Omega, xi = None, c_norm = 1.): """ - f can be one of the following: -- a string for one of the predefined feature maps: -- "complexExponential" -- "universalQuantization" -- "cosine" -- a callable function -- a tuple of function (specify the derivative too) """ # 1) extract the feature map self.name = None if isinstance(f, str): try: (self.f,self.f_grad) = _dico_nonlinearities[f.lower()] self.name = f # Keep the feature function name in memory so that we know we have a specific fct except KeyError: raise NotImplementedError("The provided feature map name f is not implemented.") elif callable(f): (self.f,self.f_grad) = (f,None) elif (isinstance(f,tuple)) and (len(f) == 2) and (callable(f[0]) and callable(f[1])): (self.f,self.f_grad) = f else: raise ValueError("The provided feature map f does not match any of the supported types.") # 2) extract Omega the projection matrix TODO allow callable Omega for fast transform if (isinstance(Omega,np.ndarray) and Omega.ndim == 2): self.Omega = Omega (self.d,self.m) = Omega.shape else: raise ValueError("The provided projection matrix Omega should be a (d,m) numpy array.") # 3) extract the dithering if xi is None: self.xi = np.zeros(self.m) else: self.xi = xi # 4) extract the normalization constant if isinstance(c_norm, str): if c_norm.lower() in ['unit','normalized']: self.c_norm = 1./np.sqrt(self.m) else: raise NotImplementedError("The provided c_norm name is not implemented.") else: self.c_norm = c_norm # magic operator to be able to call the FeatureMap object as a function def __call__(self,x): return self.c_norm*self.f(np.matmul(self.Omega.T,x.T).T + self.xi) # Evaluate the feature map at x def grad(self,x): """Gradient (Jacobian matrix) of Phi, as a (d,m)-numpy array""" return self.c_norm*self.f_grad(np.matmul(self.Omega.T,x.T).T + self.xi)*self.Omega ####################################### ### 3: Actual sketching functions ### ####################################### ################################# # 3.1 GENERAL SKETCHING ROUTINE # ################################# def computeSketch(dataset, featureMap, datasetWeights = None, batch_size = None): """ Computes the sketch of a dataset given a generic feature map. More precisely, evaluates z = sum_{x_i in X} w_i * Phi(x_i) where X is the dataset, Phi is the sketch feature map, w_i are weights assigned to the samples (typically 1/n). Arguments: - dataset : (n,d) numpy array, the dataset X: n examples in dimension d - featureMap : the feature map Phi, given as one of the following: -- a function, z_x_i = featureMap(x_i), where x_i and z_x_i are (n,)- and (m,)-numpy arrays, respectively -- a FeatureMap instance (e.g., constructed as featureMap = SimpleFeatureMap("complexExponential",Omega) ) - datasetWeights : (n,) numpy array, optional weigths w_i in the sketch (default: None, corresponds to w_i = 1/n) Returns: - sketch : (m,) numpy array, the sketch as defined above """ # TODOs: # - add possibility to specify classes and return one sketch per class # - defensive programming # - efficient implementation, take advantage of parallelism (n,d) = dataset.shape # number of samples, dimension # Determine the sketch dimension and sanity check: the dataset is nonempty and the map works if isinstance(featureMap,FeatureMap): # featureMap is the argument, FeatureMap is the class m = featureMap.m else: try: m = featureMap(dataset[0]).shape[0] except: raise ValueError("Unexpected error while calling the sketch feature map:", sys.exc_info()[0]) sketch = np.zeros(m) # Split the batches if batch_size is None: batch_size = int(1e6/m) # Rough heuristic, best batch size will vary on different machines nb_batches = int(np.ceil(n/batch_size)) if datasetWeights is None: for b in range(nb_batches): sketch = sketch + featureMap(dataset[b*batch_size:(b+1)*batch_size]).sum(axis=0) sketch /= n else: sketch = datasetWeights@featureMap(X) return sketch ################################# # 3.2 PRIVATE SKETCHING METHODS # ################################# def sensisitivty_sketch(featureMap,n = 1,DPdef = 'UDP',sensitivity_type = 1): """ Computes the sensitity of a provided sketching function. The noisy sketch operator A(X) is given by A(X) := (1/n)*[sum_{x_i in X} featureMap(x_i)] + w where w is Laplacian or Gaussian noise. Arguments: - featureMap, the sketch the sketch featureMap (Phi), provided as either: -- a FeatureMap object with a known sensitivity (i.e., complex exponential or universal quantization periodic map) -- (m,featureMapName,c_normalization): tuple (deprectated, only useful for code not supporting FeatureMap objects), that should contain: -- m: int, the sketch dimension -- featureMapName: string, name of sketch feature function f, values supported: -- 'complexExponential' (f(t) = exp(i*t)) -- 'universalQuantization_complex' (f(t) = sign(exp(i*t))) -- c_normalization: real, the constant before the sketch feature function (e.g., 1. (default), 1./sqrt(m),...) - n: int, number of sketch contributions being averaged (default = 1, useful to add noise on n independently) - DPdef: string, name of the Differential Privacy variant considered, i.e. the neighbouring relation ~: -- 'remove', 'add', 'remove/add', 'UDP' or 'standard': D~D' iff D' = D U {x'} (or vice versa) -- 'replace', 'BDP': D~D' iff D' = D \ {x} U {x'} (or vice versa) - sensitivity_type: int, 1 (default) for L1 sensitivity, 2 for L2 sensitivity. Returns: a positive real, the L1 or L2 sensitivity of the sketching operator defined above. Cfr: Differentially Private Compressive K-means, https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=8682829. """ # TODO include real cases (cosine, real universal quantization) # The sensitivity is of the type: c_feat*c_ if isinstance(featureMap,FeatureMap): m = featureMap.m featureMapName = featureMap.name c_normalization = featureMap.c_norm elif (isinstance(featureMap,tuple)) and (len(featureMap) == 3): (m,featureMapName,c_normalization) = featureMap else: raise ValueError('The featureMap argument does not match one of the supported formats.') # Sensitivity is given by S = c_featureMap * c_sensitivity_type * c_DPdef, check all three conditions (ughh) if featureMapName.lower() == 'complexexponential': if sensitivity_type == 1: if DPdef.lower() in ['remove','add','remove/add','standard','udp']: return m*np.sqrt(2)*(c_normalization/n) elif DPdef.lower() in ['replace','bdp']: return 2*m*np.sqrt(2)*(c_normalization/n) elif sensitivity_type == 2: if DPdef.lower() in ['remove','add','remove/add','standard','udp']: return np.sqrt(m)*(c_normalization/n) elif DPdef.lower() in ['replace','bdp']: return np.sqrt(m)*np.sqrt(2)*(c_normalization/n) elif featureMapName.lower() == 'universalquantization_complex': # Assuming normalized in [-1,+1], TODO check real/complex case? if sensitivity_type == 1: if DPdef.lower() in ['remove','add','remove/add','standard','udp']: return m*2*(c_normalization/n) elif DPdef.lower() in ['replace','bdp']: return 2*m*2*(c_normalization/n) elif sensitivity_type == 2: if DPdef.lower() in ['remove','add','remove/add','standard','udp']: return np.sqrt(m)*np.sqrt(2)*(c_normalization/n) elif DPdef.lower() in ['replace','bdp']: return np.sqrt(2)*np.sqrt(m)*np.sqrt(2)*(c_normalization/n) print(sensitivity_type) raise Exception('You provided ({},{});\nThe sensitivity for this (feature map,DP definition) combination is not implemented.'.format(featureMapName.lower(),DPdef.lower())) return None def computeSketch_DP(dataset, featureMap, epsilon, delta = 0,DPdef = 'UDP',useImproveGaussMechanism=True,budget_split_num = None): """ Computes the Differentially Private sketch of a dataset given a generic feature map. More precisely, evaluates the DP sketching mechanism: z = ( sum_{x_i in X} Phi(x_i) + w_num )/( |X| + w_den ) where X is the dataset, Phi is the sketch feature map, w_num and w_den are Laplacian or Gaussian random noise. Arguments: - dataset : (n,d) numpy array, the dataset X: n examples in dimension d - featureMap, the sketch the sketch featureMap (Phi), provided as either: -- a FeatureMap object with a known sensitivity (i.e., complex exponential or universal quantization periodic map) -- (featureMap(x_i),m,featureMapName,c_normalization): tuple (deprectated, only useful for old code), that should contain: -- featMap: a function, z_x_i = featMap(x_i), where x_i and z_x_i are (n,)- and (m,)-numpy arrays, respectively -- m: int, the sketch dimension -- featureMapName: string, name of sketch feature function f, values supported: -- 'complexExponential' (f(t) = exp(i*t)) -- 'universalQuantization' (f(t) = sign(exp(i*t))) -- c_normalization: real, the constant before the sketch feature function (e.g., 1. (default), 1./sqrt(m),...) - epsilon: real > 0, the privacy parameter epsilon - delta: real >= 0, the privacy parameter delta in approximate DP; if delta=0 (default), we have "pure" DP. - DPdef: string, name of the Differential Privacy variant considered, i.e. the neighbouring relation ~: -- 'remove', 'add', 'remove/add', 'UDP' or 'standard' (default): D~D' iff D' = D U {x'} (or vice versa) -- 'replace', 'BDP': D~D' iff D' = D \ {x} U {x'} (or vice versa) - useImproveGaussMechanism: bool, if True (default) use the improved Gaussian mechanism[1] rather than usual bounds[2]. - budget_split_num: 0 < real < 1, fraction of epsilon budget to allocate to the numerator (ignored in BDP). By default, we assign a fraction of (2*m)/(2*m+1) on the numerator. Returns: - sketch : (m,) numpy array, the differentially private sketch as defined above """ # Extract dataset size (n,d) = dataset.shape # Compute the nonprivate, usual sketch if isinstance(featureMap,FeatureMap): z_clean = computeSketch(dataset, featureMap) elif (isinstance(featureMap,tuple)) and (callable(featureMap[0])): featMap = featureMap[0] featureMap = featureMap[1:] z_clean = computeSketch(dataset, featMap) if epsilon == np.inf: # Non-private return z_clean useBDP = DPdef.lower() in ['replace','bdp'] # otherwise assume UDP, TODO DEFENSIVE # We will need the sketch size m = z_clean.size # Split privacy budget if useBDP: # Then no noise on the denom budget_split_num = 1. elif budget_split_num is None: budget_split_num = (2*m)/(2*m + 1) # TODO defensive programming to block budget split > 1? epsilon_num = budget_split_num*epsilon # Compute numerator noise if delta > 0: # Gaussian mechanism S = sensisitivty_sketch(featureMap,DPdef = DPdef,sensitivity_type = 2) # L2 if useImproveGaussMechanism: # Use the sharpened bounds from .third_party import calibrateAnalyticGaussianMechanism sigma = calibrateAnalyticGaussianMechanism(epsilon_num, delta, S) else: # use usual bounds if epsilon >= 1: raise Exception('WARNING: with epsilon >= 1 the sigma bound doesn\'t hold! Privacy is NOT ensured!') sigma = np.sqrt(2*np.log(1.25/delta))*S/epsilon_num noise_num = np.random.normal(scale = sigma, size=m) + 1j*np.random.normal(scale = sigma, size=m) # TODO real else: # Laplacian mechanism S = sensisitivty_sketch(featureMap,DPdef = DPdef,sensitivity_type = 1) # L1 beta = S/epsilon_num # L1 sensitivity/espilon noise_num = np.random.laplace(scale = beta, size=m) + 1j*np.random.laplace(scale = beta, size=m) # Add denominator noise if needed if useBDP: # Then no noise on the denom return z_clean + (noise_num/n) else: num = (z_clean*n) + noise_num beta_den = 1/(epsilon - epsilon_num) # rest of the privacy budget den = n + np.random.laplace(scale = beta_den) return num/den ## Useful: compute the sketch of a GMM def fourierSketchOfGaussian(mu,Sigma,Omega,xi=None,scst=None): res = np.exp(1j*(mu@Omega) -np.einsum('ij,ij->i', np.dot(Omega.T, Sigma), Omega.T)/2.) if xi is not None: res = res*np.exp(1j*xi) if scst is not None: # Sketch constant, eg 1/sqrt(m) res = scst*res return res def fourierSketchOfGMM(GMM,featureMap): '''Returns the complex exponential sketch of a Gaussian Mixture Model Parameters ---------- GMM: (weigths,means,covariances) tuple, the Gaussian Mixture Model, with - weigths: (K,)-numpy array containing the weigthing factors of the Gaussians - means: (K,d)-numpy array containing the means of the Gaussians - covariances: (K,d,d)-numpy array containing the covariance matrices of the Gaussians featureMap: the sketch the sketch featureMap (Phi), provided as either: - a SimpleFeatureMap object (i.e., complex exponential or universal quantization periodic map) - (Omega,xi): tuple with the (d,m) Fourier projection matrix and the (m,) dither (see above) Returns ------- z: (m,)-numpy array containing the sketch of the provided GMM ''' # Parse GMM input (w,mus,Sigmas) = GMM K = w.size # Parse featureMap input if isinstance(featureMap,SimpleFeatureMap): Omega = featureMap.Omega xi = featureMap.xi d = featureMap.d m = featureMap.m scst = featureMap.c_norm # Sketch normalization constant, e.g. 1/sqrt(m) elif isinstance(featureMap,tuple): (Omega,xi) = featureMap (d,m) = Omega.shape scst = 1. # This type of argument passing does't support different normalizations else: raise ValueError('The featureMap argument does not match one of the supported formats.') z = 1j*np.zeros(m) for k in range(K): z += fourierSketchOfGaussian(mus[k],Sigmas[k],Omega,xi,scst) return z def fourierSketchOfBox(box,featureMap,nb_cat_per_dim=None, dimensions_to_consider=None): '''Returns the complex exponential sketch of the indicator function on a parallellipiped (box). For dimensions that flagged as integer, considers the indicator on a set of integers instead. Parameters ---------- box: (d,2)-numpy array, the boundaries of the box (x in R^d is in the box iff box[i,0] <= x_i <= box[i,1]) featureMap: the sketch the sketch featureMap (Phi), provided as either: - a SimpleFeatureMap object (is assumed to use the complex exponential map) - (Omega,xi): tuple with the (d,m) Fourier projection matrix and the (m,) dither (see above) Additional Parameters --------------------- nb_cat_per_dim: (d,)-array of ints, the number of categories per dimension for integer data, if its i-th entry = 0 (resp. > 0), dimension i is assumed to be continuous (resp. int.). By default all entries are assumed to be continuous. dimensions_to_consider: array of ints (between 0 and d-1), [0,1,...d-1] by default. The box is restricted to the prescribed dimensions. This is helpful to solve problems on a subsets of all dimensions. Returns ------- z: (m,)-numpy array containing the sketch of the indicator function on the provided box ''' ## Parse input # Parse box input (d,_) = box.shape c_box = (box[:,1]+box[:,0])/2 # Center of the box in each dimension l_box = (box[:,1]-box[:,0])/2 # Length (well, half of the length) of the box in each dimension # Parse featureMap input if isinstance(featureMap,SimpleFeatureMap): Omega = featureMap.Omega xi = featureMap.xi d = featureMap.d m = featureMap.m scst = featureMap.c_norm # Sketch normalization constant, e.g. 1/sqrt(m) elif isinstance(featureMap,tuple): (Omega,xi) = featureMap (d,m) = Omega.shape scst = 1. # This type of argument passing does't support different normalizations else: raise ValueError('The featureMap argument does not match one of the supported formats.') # Parse nb_cat_per_dim if nb_cat_per_dim is None: nb_cat_per_dim = np.zeros(d) # Parse dimensions to consider if dimensions_to_consider is None: dimensions_to_consider = np.arange(d) ## Compute sketch z = scst*np.exp(1j*xi) for i in dimensions_to_consider: mask_valid = np.abs(Omega[i]) > 1e-15 # CHECK IF INTEGER OR CONTINUOUS if nb_cat_per_dim[i] > 0: low_int = box[i,0] high_int = box[i,1] + 1 # python counting convention C = high_int - low_int newTerm = np.ones(m) + 1j*
np.zeros(m)
numpy.zeros
import matplotlib.pyplot as plt import numpy as np x = np.linspace(-5,5,100) def relu(x): x=np.copy(x) x[x<0] = 0 return x def sign(x): y=np.copy(x) y[x<0]=-1 y[x>=0]=1 return y def step(x): y=np.copy(x) y[x<0]=0 #y[x==0]=0.5 y[x>=0]=1 return y def tanh(x): return (np.exp(x)-np.exp(-x))/(np.exp(x)+np.exp(-x)) def sigmoid(x): return (1 / (1 +
np.exp(-x)
numpy.exp
import math import gc import os import pickle from math import pi import numpy as np import pandas as pd import pytorch_lightning as pl from omegaconf import DictConfig from scipy.fft import fft from scipy.signal import blackman from scipy.signal import hilbert from sklearn.model_selection import GroupKFold from sklearn.preprocessing import RobustScaler from torch.utils.data import DataLoader from src.utils.technical_utils import load_obj class VentilatorDataModule(pl.LightningDataModule): def __init__(self, cfg: DictConfig): super().__init__() self.cfg = cfg def prepare_data(self): pass def make_features(self, data): if "pressure" not in data.columns: data['pressure'] = 0 data['RC_sum'] = data['R'] + data['C'] data['RC_div'] = data['R'] / data['C'] data['R'] = data['R'].astype(str) data['C'] = data['C'].astype(str) data['RC'] = data['R'] + data['C'] data = pd.get_dummies(data) data['u_in_cumsum'] = (data['u_in']).groupby(data['breath_id']).cumsum() # data['time_step_lag'] = data.groupby('breath_id')['time_step'].shift(1) data['time_step_lag'] = data.groupby('breath_id')['time_step'].shift(2) data['u_in_lag'] = data.groupby('breath_id')['u_in'].shift(1) data['u_out_lag'] = data.groupby('u_out')['u_in'].shift(1) return data.fillna(0) def make_features1(self, data): data['area'] = data['time_step'] * data['u_in'] data['area'] = data.groupby('breath_id')['area'].cumsum() data['u_in_cumsum'] = (data['u_in']).groupby(data['breath_id']).cumsum() data['u_in_lag1'] = data.groupby('breath_id')['u_in'].shift(1) data['u_out_lag1'] = data.groupby('breath_id')['u_out'].shift(1) data['u_in_lag_back1'] = data.groupby('breath_id')['u_in'].shift(-1) data['u_out_lag_back1'] = data.groupby('breath_id')['u_out'].shift(-1) data['u_in_lag2'] = data.groupby('breath_id')['u_in'].shift(2) data['u_out_lag2'] = data.groupby('breath_id')['u_out'].shift(2) data['u_in_lag_back2'] = data.groupby('breath_id')['u_in'].shift(-2) data['u_out_lag_back2'] = data.groupby('breath_id')['u_out'].shift(-2) data['u_in_lag3'] = data.groupby('breath_id')['u_in'].shift(3) data['u_out_lag3'] = data.groupby('breath_id')['u_out'].shift(3) data['u_in_lag_back3'] = data.groupby('breath_id')['u_in'].shift(-3) data['u_out_lag_back3'] = data.groupby('breath_id')['u_out'].shift(-3) data['u_in_lag4'] = data.groupby('breath_id')['u_in'].shift(4) data['u_out_lag4'] = data.groupby('breath_id')['u_out'].shift(4) data['u_in_lag_back4'] = data.groupby('breath_id')['u_in'].shift(-4) data['u_out_lag_back4'] = data.groupby('breath_id')['u_out'].shift(-4) data = data.fillna(0) data['breath_id__u_in__max'] = data.groupby(['breath_id'])['u_in'].transform('max') data['breath_id__u_out__max'] = data.groupby(['breath_id'])['u_out'].transform('max') data['u_in_diff1'] = data['u_in'] - data['u_in_lag1'] data['u_out_diff1'] = data['u_out'] - data['u_out_lag1'] data['u_in_diff2'] = data['u_in'] - data['u_in_lag2'] data['u_out_diff2'] = data['u_out'] - data['u_out_lag2'] data['breath_id__u_in__diffmax'] = data.groupby(['breath_id'])['u_in'].transform('max') - data['u_in'] data['breath_id__u_in__diffmean'] = data.groupby(['breath_id'])['u_in'].transform('mean') - data['u_in'] data['breath_id__u_in__diffmax'] = data.groupby(['breath_id'])['u_in'].transform('max') - data['u_in'] data['breath_id__u_in__diffmean'] = data.groupby(['breath_id'])['u_in'].transform('mean') - data['u_in'] data['u_in_diff3'] = data['u_in'] - data['u_in_lag3'] data['u_out_diff3'] = data['u_out'] - data['u_out_lag3'] data['u_in_diff4'] = data['u_in'] - data['u_in_lag4'] data['u_out_diff4'] = data['u_out'] - data['u_out_lag4'] data['cross'] = data['u_in'] * data['u_out'] data['cross2'] = data['time_step'] * data['u_out'] data['R'] = data['R'].astype(str) data['C'] = data['C'].astype(str) data['R__C'] = data["R"].astype(str) + '__' + data["C"].astype(str) data = pd.get_dummies(data) data.drop(['id', 'breath_id'], axis=1, inplace=True) if 'pressure' in data.columns: data.drop('pressure', axis=1, inplace=True) return data def make_features2(self, data): data['area'] = data['time_step'] * data['u_in'] data['area'] = data.groupby('breath_id')['area'].cumsum() data['u_in_cumsum'] = (data['u_in']).groupby(data['breath_id']).cumsum() data['u_in_lag1'] = data.groupby('breath_id')['u_in'].shift(1) data['u_out_lag1'] = data.groupby('breath_id')['u_out'].shift(1) data['u_in_lag_back1'] = data.groupby('breath_id')['u_in'].shift(-1) data['u_out_lag_back1'] = data.groupby('breath_id')['u_out'].shift(-1) data['u_in_lag2'] = data.groupby('breath_id')['u_in'].shift(2) data['u_out_lag2'] = data.groupby('breath_id')['u_out'].shift(2) data['u_in_lag_back2'] = data.groupby('breath_id')['u_in'].shift(-2) data['u_out_lag_back2'] = data.groupby('breath_id')['u_out'].shift(-2) data['u_in_lag3'] = data.groupby('breath_id')['u_in'].shift(3) data['u_out_lag3'] = data.groupby('breath_id')['u_out'].shift(3) data['u_in_lag_back3'] = data.groupby('breath_id')['u_in'].shift(-3) data['u_out_lag_back3'] = data.groupby('breath_id')['u_out'].shift(-3) data['u_in_lag4'] = data.groupby('breath_id')['u_in'].shift(4) data['u_out_lag4'] = data.groupby('breath_id')['u_out'].shift(4) data['u_in_lag_back4'] = data.groupby('breath_id')['u_in'].shift(-4) data['u_out_lag_back4'] = data.groupby('breath_id')['u_out'].shift(-4) data = data.fillna(0) data['breath_id__u_in__max'] = data.groupby(['breath_id'])['u_in'].transform('max') data['breath_id__u_out__max'] = data.groupby(['breath_id'])['u_out'].transform('max') data['u_in_diff1'] = data['u_in'] - data['u_in_lag1'] data['u_out_diff1'] = data['u_out'] - data['u_out_lag1'] data['u_in_diff2'] = data['u_in'] - data['u_in_lag2'] data['u_out_diff2'] = data['u_out'] - data['u_out_lag2'] data['breath_id__u_in__diffmax'] = data.groupby(['breath_id'])['u_in'].transform('max') - data['u_in'] data['breath_id__u_in__diffmean'] = data.groupby(['breath_id'])['u_in'].transform('mean') - data['u_in'] data['breath_id__u_in__diffmax'] = data.groupby(['breath_id'])['u_in'].transform('max') - data['u_in'] data['breath_id__u_in__diffmean'] = data.groupby(['breath_id'])['u_in'].transform('mean') - data['u_in'] data['u_in_diff1'] = data['u_in'] - data['u_in_lag1'] data['u_out_diff1'] = data['u_out'] - data['u_out_lag1'] data['u_in_diff2'] = data['u_in'] - data['u_in_lag2'] data['u_out_diff2'] = data['u_out'] - data['u_out_lag2'] data['u_in_diff3'] = data['u_in'] - data['u_in_lag3'] data['u_out_diff3'] = data['u_out'] - data['u_out_lag3'] data['u_in_diff4'] = data['u_in'] - data['u_in_lag4'] data['u_out_diff4'] = data['u_out'] - data['u_out_lag4'] data['cross'] = data['u_in'] * data['u_out'] data['cross2'] = data['time_step'] * data['u_out'] data['one'] = 1 data['count'] = (data['one']).groupby(data['breath_id']).cumsum() data['u_in_cummean'] = data['u_in_cumsum'] / data['count'] data['breath_id_lag'] = data['breath_id'].shift(1).fillna(0) data['breath_id_lag2'] = data['breath_id'].shift(2).fillna(0) data['breath_id_lagsame'] = np.select([data['breath_id_lag'] == data['breath_id']], [1], 0) data['breath_id_lag2same'] = np.select([data['breath_id_lag2'] == data['breath_id']], [1], 0) data['breath_id__u_in_lag'] = data['u_in'].shift(1).fillna(0) data['breath_id__u_in_lag'] = data['breath_id__u_in_lag'] * data['breath_id_lagsame'] data['breath_id__u_in_lag2'] = data['u_in'].shift(2).fillna(0) data['breath_id__u_in_lag2'] = data['breath_id__u_in_lag2'] * data['breath_id_lag2same'] data['R'] = data['R'].astype(str) data['C'] = data['C'].astype(str) data['R__C'] = data["R"].astype(str) + '__' + data["C"].astype(str) data = pd.get_dummies(data) data.drop(['id', 'breath_id', 'one', 'count', 'breath_id_lag', 'breath_id_lag2', 'breath_id_lagsame', 'breath_id_lag2same'], axis=1, inplace=True) if 'pressure' in data.columns: data.drop('pressure', axis=1, inplace=True) return data def make_features3(self, data): data['area'] = data['time_step'] * data['u_in'] data['area'] = data.groupby('breath_id')['area'].cumsum() data['u_in_cumsum'] = (data['u_in']).groupby(data['breath_id']).cumsum() data['u_in_lag1'] = data.groupby('breath_id')['u_in'].shift(1) data['u_out_lag1'] = data.groupby('breath_id')['u_out'].shift(1) data['u_in_lag_back1'] = data.groupby('breath_id')['u_in'].shift(-1) data['u_out_lag_back1'] = data.groupby('breath_id')['u_out'].shift(-1) data['u_in_lag2'] = data.groupby('breath_id')['u_in'].shift(2) data['u_out_lag2'] = data.groupby('breath_id')['u_out'].shift(2) data['u_in_lag_back2'] = data.groupby('breath_id')['u_in'].shift(-2) data['u_out_lag_back2'] = data.groupby('breath_id')['u_out'].shift(-2) data['u_in_lag3'] = data.groupby('breath_id')['u_in'].shift(3) data['u_out_lag3'] = data.groupby('breath_id')['u_out'].shift(3) data['u_in_lag_back3'] = data.groupby('breath_id')['u_in'].shift(-3) data['u_out_lag_back3'] = data.groupby('breath_id')['u_out'].shift(-3) data['u_in_lag4'] = data.groupby('breath_id')['u_in'].shift(4) data['u_out_lag4'] = data.groupby('breath_id')['u_out'].shift(4) data['u_in_lag_back4'] = data.groupby('breath_id')['u_in'].shift(-4) data['u_out_lag_back4'] = data.groupby('breath_id')['u_out'].shift(-4) data = data.fillna(0) data['breath_id__u_in__max'] = data.groupby(['breath_id'])['u_in'].transform('max') data['breath_id__u_out__max'] = data.groupby(['breath_id'])['u_out'].transform('max') data['u_in_diff1'] = data['u_in'] - data['u_in_lag1'] data['u_out_diff1'] = data['u_out'] - data['u_out_lag1'] data['u_in_diff2'] = data['u_in'] - data['u_in_lag2'] data['u_out_diff2'] = data['u_out'] - data['u_out_lag2'] data['breath_id__u_in__diffmax'] = data.groupby(['breath_id'])['u_in'].transform('max') - data['u_in'] data['breath_id__u_in__diffmean'] = data.groupby(['breath_id'])['u_in'].transform('mean') - data['u_in'] data['breath_id__u_in__diffmax'] = data.groupby(['breath_id'])['u_in'].transform('max') - data['u_in'] data['breath_id__u_in__diffmean'] = data.groupby(['breath_id'])['u_in'].transform('mean') - data['u_in'] data['u_in_diff1'] = data['u_in'] - data['u_in_lag1'] data['u_out_diff1'] = data['u_out'] - data['u_out_lag1'] data['u_in_diff2'] = data['u_in'] - data['u_in_lag2'] data['u_out_diff2'] = data['u_out'] - data['u_out_lag2'] data['u_in_diff3'] = data['u_in'] - data['u_in_lag3'] data['u_out_diff3'] = data['u_out'] - data['u_out_lag3'] data['u_in_diff4'] = data['u_in'] - data['u_in_lag4'] data['u_out_diff4'] = data['u_out'] - data['u_out_lag4'] data['cross'] = data['u_in'] * data['u_out'] data['cross2'] = data['time_step'] * data['u_out'] data['one'] = 1 data['count'] = (data['one']).groupby(data['breath_id']).cumsum() data['u_in_cummean'] = data['u_in_cumsum'] / data['count'] data['breath_id_lag'] = data['breath_id'].shift(1).fillna(0) data['breath_id_lag2'] = data['breath_id'].shift(2).fillna(0) data['breath_id_lagsame'] = np.select([data['breath_id_lag'] == data['breath_id']], [1], 0) data['breath_id_lag2same'] =
np.select([data['breath_id_lag2'] == data['breath_id']], [1], 0)
numpy.select