prompt
stringlengths 19
879k
| completion
stringlengths 3
53.8k
| api
stringlengths 8
59
|
---|---|---|
# Imports: standard library
import os
import sys
import argparse
import datetime
import tempfile
import multiprocessing as mp
from time import time
from typing import Dict, List, Type, Tuple, Union, Callable
from itertools import product
# Imports: third party
import h5py
import numpy as np
import pytest
import neurokit2 as nk
# Imports: first party
import tensormap
from definitions.edw import EDW_FILES
from ml4c3.arguments import parse_args
from ingest.icu.writers import Writer
from definitions.globals import TENSOR_EXT
from tensormap.TensorMap import TensorMap, Interpretation, get_local_timestamps
from tensormap.icu_signals import get_tmap as GET_SIGNAL_TMAP
from ingest.icu.data_objects import (
Event,
Procedure,
Medication,
StaticData,
Measurement,
ICUDataObject,
BedmasterAlarm,
BedmasterSignal,
)
from tensormap.icu_list_signals import get_tmap as GET_LIST_TMAP
# pylint: disable=redefined-outer-name, unused-argument, missing-class-docstring
def pytest_configure():
def tff(tm, hd5):
return hd5[f"/{tm.name}"][:]
pytest.TFF = tff
pytest.N_TENSORS = 50
pytest.CONTINUOUS_TMAPS = [
TensorMap(
f"{n}d_cont",
shape=tuple(range(2, n + 2)),
interpretation=Interpretation.CONTINUOUS,
tensor_from_file=tff,
)
for n in range(1, 6)
]
pytest.CATEGORICAL_TMAPS = [
TensorMap(
f"{n}d_cat",
shape=tuple(range(2, n + 2)),
interpretation=Interpretation.CATEGORICAL,
channel_map={f"c_{i}": i for i in range(n + 1)},
tensor_from_file=tff,
)
for n in range(1, 6)
]
pytest.TMAPS_UP_TO_4D = pytest.CONTINUOUS_TMAPS[:-1] + pytest.CATEGORICAL_TMAPS[:-1]
pytest.TMAPS_5D = pytest.CONTINUOUS_TMAPS[-1:] + pytest.CATEGORICAL_TMAPS[-1:]
pytest.MULTIMODAL_UP_TO_4D = [
list(x)
for x in product(pytest.CONTINUOUS_TMAPS[:-1], pytest.CATEGORICAL_TMAPS[:-1])
]
pytest.SEGMENT_IN = TensorMap(
"2d_for_segment_in",
shape=(32, 32, 1),
interpretation=Interpretation.CONTINUOUS,
metrics=["mse"],
tensor_from_file=tff,
)
pytest.SEGMENT_OUT = TensorMap(
"2d_for_segment_out",
shape=(32, 32, 2),
interpretation=Interpretation.CATEGORICAL,
channel_map={"yes": 0, "no": 1},
tensor_from_file=tff,
)
pytest.MOCK_TMAPS = {
tmap.name: tmap for tmap in pytest.CONTINUOUS_TMAPS + pytest.CATEGORICAL_TMAPS
}
pytest.example_mrn = "123"
pytest.example_visit_id = "345"
pytest.run_id = "1234567"
pytest.run_id_par = "12345678"
pytest.datadir = os.path.join(os.path.dirname(__file__), "icu_ingest", "data")
# CrossRef
pytest.cross_ref_file = os.path.join(pytest.datadir, "xref_file.csv")
pytest.cross_ref_file_tens = os.path.join(pytest.datadir, "xref_file_tensorize.csv")
# BedMaster
pytest.bedmaster_dir = os.path.join(pytest.datadir, "bedmaster")
pytest.mat_file = os.path.join(pytest.bedmaster_dir, "bedmaster_file-123_5_v4.mat")
pytest.bedmaster_matching = os.path.join(pytest.datadir, "bedmaster_matching_files")
# EDW
pytest.edw_dir = os.path.join(pytest.datadir, "edw")
pytest.edw_patient_dir = os.path.join(
pytest.edw_dir,
pytest.example_mrn,
pytest.example_visit_id,
)
pytest.adt_path = os.path.join(pytest.edw_dir, "adt.csv")
# Alarms
pytest.alarms_dir = os.path.join(pytest.datadir, "bedmaster_alarms")
pytest_configure()
class Utils:
@staticmethod
def build_hd5s(
path: str,
tensor_maps: List[TensorMap],
n=5,
) -> Dict[Tuple[str, TensorMap], np.ndarray]:
"""
Builds hd5s at path given TensorMaps. Only works for Continuous and
Categorical TensorMaps.
"""
out = {}
for i in range(n):
hd5_path = os.path.join(path, f"{i}{TENSOR_EXT}")
with h5py.File(hd5_path, "w") as hd5:
for tm in tensor_maps:
if tm.is_continuous:
value = np.full(tm.shape, fill_value=i, dtype=np.float32)
elif tm.is_categorical:
value = np.zeros(tm.shape, dtype=np.float32)
value[..., i % tm.shape[-1]] = 1
else:
raise NotImplementedError(
"Cannot automatically build hd5 from interpretation"
f' "{tm.interpretation}"',
)
hd5.create_dataset(f"/{tm.name}", data=value)
out[(hd5_path, tm)] = value
return out
@pytest.fixture(scope="session")
def utils() -> Type[Utils]:
return Utils
# The purpose of this fixture is to always use the fake testing TMaps.
# The function which retrieves tmaps is update_tmaps from TensorMap.py;
# However, that function is usually imported directly, i.e.
#
# from ml4c3.TensorMap import update_tmaps
#
# This import creates a new object with the same name in the importing file,
# and now needs to be mocked too, e.g.
#
# mock ml4c3.arguments.update_tmaps --> mock_update_tmaps
#
# https://stackoverflow.com/a/45466846
@pytest.fixture(autouse=True)
def use_testing_tmaps(monkeypatch):
def mock_update_tmaps(tmap_name: str, tmaps: Dict[str, TensorMap]):
return pytest.MOCK_TMAPS
monkeypatch.setattr(tensormap.TensorMap, "update_tmaps", mock_update_tmaps)
baseline_default_arguments = [
"--input_tensors",
"3d_cont",
"--output_tensors",
"1d_cat",
"--conv_x",
"3",
"--conv_y",
"3",
"--conv_z",
"3",
"--pool_x",
"1",
"--pool_y",
"1",
"--pool_z",
"1",
"--num_workers",
"1",
"--epochs",
"2",
"--batch_size",
"2",
"--dense_layers",
"4",
"--conv_blocks",
"4",
"--conv_block_size",
"3",
"--optimizer",
"adam",
"--activation_layer",
"relu",
"--learning_rate",
"0.001",
]
@pytest.fixture(scope="function")
def default_arguments(tmpdir_factory, utils: Utils) -> argparse.Namespace:
temp_dir = tmpdir_factory.mktemp("data")
utils.build_hd5s(temp_dir, pytest.MOCK_TMAPS.values(), n=pytest.N_TENSORS)
hd5_dir = str(temp_dir)
sys.argv = [
".",
"train",
"--tensors",
hd5_dir,
"--output_folder",
hd5_dir,
]
sys.argv.extend(baseline_default_arguments)
args = parse_args()
return args
@pytest.fixture(scope="function")
def default_arguments_infer(tmpdir_factory, utils: Utils) -> argparse.Namespace:
temp_dir = tmpdir_factory.mktemp("data")
utils.build_hd5s(temp_dir, pytest.MOCK_TMAPS.values(), n=pytest.N_TENSORS)
hd5_dir = str(temp_dir)
sys.argv = [
".",
"infer",
"--tensors",
hd5_dir,
"--output_folder",
hd5_dir,
]
sys.argv.extend(baseline_default_arguments)
args = parse_args()
return args
@pytest.fixture(scope="function")
def default_arguments_explore(tmpdir_factory, utils: Utils) -> argparse.Namespace:
temp_dir = tmpdir_factory.mktemp("data")
utils.build_hd5s(temp_dir, pytest.MOCK_TMAPS.values(), n=pytest.N_TENSORS)
hd5_dir = str(temp_dir)
sys.argv = [
".",
"explore",
"--tensors",
hd5_dir,
"--output_folder",
hd5_dir,
]
args = parse_args()
return args
def pytest_exception_interact(node, call, report):
for child in mp.active_children():
child.terminate()
@pytest.fixture(scope="function")
def matfile() -> h5py.File:
with h5py.File(pytest.mat_file, "r") as mat_file:
yield mat_file
@pytest.fixture(scope="function")
def empty_matfile() -> h5py.File:
with tempfile.NamedTemporaryFile(delete=False) as _file:
with h5py.File(_file.name, "w") as mat_file:
mat_file.create_group("vs")
mat_file.create_group("wv")
yield _file
try:
os.remove(_file.name)
except OSError:
pass
@pytest.fixture(scope="module")
def temp_file():
with tempfile.NamedTemporaryFile(delete=False) as _file:
yield _file
@pytest.fixture(scope="function")
def temp_dir():
with tempfile.TemporaryDirectory() as _tmp_dir:
yield _tmp_dir
@pytest.fixture(scope="session")
def test_scale_units() -> Dict[str, Dict[str, Union[int, float, str]]]:
# fmt: off
return {
"CUFF": {"scaling_factor": 1, "units": "mmHg"},
"HR": {"scaling_factor": 0.5, "units": "Bpm"},
"I": {"scaling_factor": 0.0243, "units": "mV"},
"II": {"scaling_factor": 0.0243, "units": "mV"},
"V": {"scaling_factor": 0.0243, "units": "mV"},
"SPO2": {"scaling_factor": 0.039, "units": "%"},
"RR": {"scaling_factor": 0.078, "units": "UNKNOWN"},
"VNT_PRES": {"scaling_factor": 1, "units": "UNKNOWN"},
"VNT_FLOW": {"scaling_factor": 1, "units": "UNKNOWN"},
"CO2": {"scaling_factor": 1, "units": "UNKNOWN"},
}
# fmt: on
class FakeSignal:
"""
Mock signal objects for use in testing.
"""
def __init__(self):
self.today = datetime.date.today()
@staticmethod
def get_bedmaster_signal() -> BedmasterSignal:
starting_time = int(time())
sample_freq = 60
duration_sec = 10
n_points = duration_sec * sample_freq
m_signal = BedmasterSignal(
name="Some_signal",
source="waveform",
channel="ch10",
value=np.array(np.random.randint(40, 100, n_points)),
time=np.arange(starting_time, starting_time + duration_sec, 0.25),
units="mmHg",
sample_freq=np.array(
[(sample_freq, 0), (120, n_points / 10)],
dtype="float,int",
),
scale_factor=np.random.randint(0, 5),
time_corr_arr=np.packbits(np.random.randint(0, 2, 100).astype(np.bool)),
samples_per_ts=np.array([15] * int(duration_sec / 0.25)),
)
return m_signal
@staticmethod
def get_static_data() -> StaticData:
static_data = StaticData(
department_id=np.array([1234, 12341]),
department_nm=np.array(["BLAKE1", "BLAKE2"]).astype("S"),
room_bed=np.array(["123 - 222", "456 - 333"]).astype("S"),
move_time=np.array(["2021-05-15 06:47:00", "2021-05-25 06:47:00"]).astype(
"S",
),
weight=np.random.randint(50, 100),
height=np.random.randint(150, 210) / 100,
admin_type="testing",
admin_date="1995-08-06 00:00:00.0000000",
birth_date="1920-05-06 00:00:00.0000000",
race=str(np.random.choice(["Asian", "Native American", "Black"])),
sex=str(np.random.choice(["male", "female"])),
end_date="2020-07-10 12:00:00.0000000",
end_stay_type=str(np.random.choice(["discharge", "death"])),
local_time=["UTC-4:00"],
medical_hist=np.array(
["ID: 245324; NAME: Diabetes; COMMENTS: typeI; DATE: UNKNOWN"],
).astype("S"),
surgical_hist=np.array(
["ID: 241324; NAME: VASECTOMY; COMMENTS: Sucessfully; DATE: UNKNOWN"],
).astype("S"),
tobacco_hist="STATUS: Yes - Quit; COMMENT: 10 years ago",
alcohol_hist="STATUS: Yes; COMMENT: a little",
admin_diag="aortic valve repair.",
)
return static_data
@staticmethod
def get_measurement() -> Measurement:
starting_time = int(time())
measurement = Measurement(
name="Some_Measurment",
source=str(
np.random.choice(
[
EDW_FILES["lab_file"]["source"],
EDW_FILES["vitals_file"]["source"],
],
),
),
value=np.array(np.random.randint(40, 100, 100)),
time=np.array(list(range(starting_time, starting_time + 100))),
units=str(np.random.choice(["mmHg", "bpm", "%"])),
data_type=str(np.random.choice(["categorical", "numerical"])),
metadata={"Some_Metadata": np.array(np.random.randint(0, 1, 100))},
)
return measurement
@staticmethod
def get_medication() -> Medication:
starting_time = int(time())
medication = Medication(
name="Some_medication_in_g/ml",
dose=np.array(np.random.randint(0, 2, 10)),
units=str(np.random.choice(["g/ml", "mg", "pills"])),
start_date=np.array(list(range(starting_time, starting_time + 100, 10))),
action=np.random.choice(["Given", "New bag", "Rate Change"], 10).astype(
"S",
),
route=str(np.random.choice(["Oral", "Nasal", "Otic"])),
wt_based_dose=bool(np.random.randint(0, 2)),
)
return medication
@staticmethod
def get_procedure() -> Procedure:
starting_time = int(time())
procedure = Procedure(
name="Some_procedure",
source=EDW_FILES["other_procedures_file"]["source"],
start_date=np.array(list(range(starting_time, starting_time + 100, 5))),
end_date=np.array(
list(range(starting_time + 10000, starting_time + 10100, 5)),
),
)
return procedure
@staticmethod
def get_demo() -> StaticData:
return FakeSignal.get_static_data()
@staticmethod
def get_measurements() -> Dict[str, Measurement]:
starting_time = int(time())
measurements_dic = {
"creatinine": EDW_FILES["lab_file"]["source"],
"ph_arterial": EDW_FILES["lab_file"]["source"],
"pulse": EDW_FILES["vitals_file"]["source"],
"r_phs_ob_bp_systolic_outgoing": EDW_FILES["vitals_file"]["source"],
}
measurements = {
measurement_name: Measurement(
name=measurement_name,
source=f"{measurements_dic[measurement_name]}",
value=np.array(np.random.randint(40, 100, 100)),
time=np.array(list(range(starting_time, starting_time + 100))),
units=str(np.random.choice(["mmHg", "bpm", "%"])),
data_type=str(np.random.choice(["categorical", "numerical"])),
)
for measurement_name in measurements_dic
}
sys = np.random.randint(40, 100, 250)
dias = np.random.randint(80, 160, 250)
measurements["blood_pressure"] = Measurement(
name="blood_pressure",
source=EDW_FILES["vitals_file"]["source"],
value=np.array(
[f"{sys[i]}/{dias[i]}" for i in range(0, len(sys))],
dtype="S",
),
time=np.array(list(range(starting_time - 50000, starting_time, 200))),
units="",
data_type="categorical",
)
return measurements
@staticmethod
def get_procedures() -> Dict[str, Procedure]:
starting_time = int(time())
start_times = np.array(list(range(starting_time, starting_time + 1000, 100)))
end_times = np.array(
list(range(starting_time + 100, starting_time + 1100, 100)),
)
procedures_dic = {
"colonoscopy": EDW_FILES["surgery_file"]["source"],
"hemodialysis": EDW_FILES["other_procedures_file"]["source"],
"transfuse_red_blood_cells": EDW_FILES["transfusions_file"]["source"],
}
procedures = {
procedure_name: Procedure(
name=procedure_name,
source=f"{procedures_dic[procedure_name]}",
start_date=start_times,
end_date=end_times,
)
for procedure_name in procedures_dic
}
return procedures
@staticmethod
def get_medications() -> Dict[str, Medication]:
starting_time = int(time())
meds_list = [
"aspirin_325_mg_tablet",
"cefazolin_2_gram|50_ml_in_dextrose_iso-osmotic_intravenous_piggyback",
"lactated_ringers_iv_bolus",
"norepinephrine_infusion_syringe_in_swfi_80_mcg|ml_cmpd_central_mgh",
"sodium_chloride_0.9_%_intravenous_solution",
"aspirin_500_mg_tablet",
]
medications = {
med: Medication(
name=med,
dose=np.array(np.random.randint(0, 2, 10)),
units=str(np.random.choice(["g/ml", "mg", "pills"])),
start_date=np.array(
list(range(starting_time, starting_time + 100, 10)),
),
action= | np.random.choice(["Given", "New bag", "Rate Change"], 10) | numpy.random.choice |
import trimesh
import math as m
import numpy as np
import glob
import os
import scipy
def change_coordinates(coords, p_from='C', p_to='S'):
if p_from == p_to:
return coords
elif p_from == 'S' and p_to == 'C':
beta = coords[..., 0]
alpha = coords[..., 1]
r = 1.
out = np.empty(beta.shape + (3,))
ct = np.cos(beta)
cp = np.cos(alpha)
st = np.sin(beta)
sp = np.sin(alpha)
out[..., 0] = r * st * cp # x
out[..., 1] = r * st * sp # y
out[..., 2] = r * ct # z
return out
elif p_from == 'C' and p_to == 'S':
x = coords[..., 0]
y = coords[..., 1]
z = coords[..., 2]
out = np.empty(x.shape + (2,))
out[..., 0] = np.arccos(z) # beta
out[..., 1] = np.arctan2(y, x) # alpha
return out
else:
raise ValueError('Unknown conversion:' + str(p_from) + ' to ' + str(p_to))
def make_sgrid_(b):
theta = np.linspace(0, m.pi, num=b)
phi = np.linspace(0, 2*m.pi, num=b)
theta_m, phi_m = np.meshgrid(theta, phi)
sgrid = change_coordinates(np.c_[theta_m[..., None], phi_m[..., None]], p_from='S', p_to='C')
sgrid = sgrid.reshape((-1, 3))
print(sgrid.shape)
return sgrid
def render_model(mesh, sgrid):
# Cast rays
# triangle_indices = mesh.ray.intersects_first(ray_origins=sgrid, ray_directions=-sgrid)
s_or = np.zeros(sgrid.shape)
index_tri, index_ray, loc = mesh.ray.intersects_id(
ray_origins=-sgrid, ray_directions=sgrid, multiple_hits=False, return_locations=True)
loc = loc.reshape((-1, 3)) # fix bug if loc is empty
final_loc = np.zeros((sgrid.shape[0],3))
final_loc[index_ray] = loc
return final_loc
def cart2sph(coords):
x = coords[..., 0]
y = coords[..., 1]
z = coords[..., 2]
r = np.sqrt(np.power(x,2) + np.power(y,2) + np.power(z,2))
xy = np.sqrt(np.power(x,2) + np.power(y,2))
print(x.shape)
print(r.shape)
out = np.empty(x.shape + (3,))
out[..., 0] = np.arctan2(xy,z)
out[..., 1] = np.arctan2(y, x) + m.pi
# out[..., 0] = np.arccos(z) # beta
# out[..., 1] = np.arctan2(y, x) # alpha
out[..., 2] = np.sqrt(np.power(x,2) + np.power(y,2) + np.power(z,2))
# print(out)
return out
def radial_poly(rho, m, n):
if n == 0 and m == 0:
return np.ones(rho.shape)
if n == 1 and m == 1:
return rho
if n == 2 and m == 0:
return 2.0 * np.power(rho,2) - 1
if n == 2 and m == 2:
return np.power(rho,2)
if n == 3 and m == 1:
return 3.0* np.power(rho, 3) - 2.0 * rho
if n == 3 and m == 3:
return np.power(rho,3)
if n == 4 and m == 0:
return 6.0 * np.power(rho,4) - 6.0 * np.power(rho,2) + 1
if n == 4 and m == 2:
return 4.0* np.power(rho, 4) - 3.0 * np.power(rho,2)
if n == 4 and m == 4:
return np.power(rho,4)
if n == 5 and m == 1:
return 10.0* | np.power(rho, 5) | numpy.power |
import numpy as np
import random
from rl_main.main_constants import MAX_EPISODES
class Policy_Iteration:
def __init__(self, env, gamma):
self.env = env
# discount rate
self.gamma = gamma
self.max_iteration = MAX_EPISODES
self.n_states = self.env.get_n_states()
self.n_actions = self.env.get_n_actions()
self.terminal_states = self.env.get_terminal_states()
self.goal_states = self.env.get_goal_states()
self.state_values = | np.zeros([self.n_states], dtype=float) | numpy.zeros |
import logging
from astropy import units as u
from astropy.coordinates import Angle
import numpy as np
from scipy.interpolate import interp1d
try:
from spectral_cube import SpectralCube
except ModuleNotFoundError:
# Error handling
pass
import os.path
directory = os.path.dirname(__file__)
track_dict = {
"3kf":"3kF_lbvRBD.dat", "3kpc_far":"3kF_lbvRBD.dat",
"3kn":"3kN_lbvRBD.dat", "3kpc_near":"3kN_lbvRBD.dat",
"aqr":"AqR_lbvRBD.dat", "aquila_rift":"AqR_lbvRBD.dat",
"aqs":"AqS_lbvRBD.dat", "aquila_spur":"AqS_lbvRBD.dat",
"cnn":"CnN_lbvRBD.dat", "connecting_near":"CnN_lbvRBD.dat",
"cnx":"CnX_lbvRBD.dat", "connecting_extension":"CnX_lbvRBD.dat",
"crn":"CrN_lbvRBD.dat", "carina_near":"CrN_lbvRBD.dat",
"crf":"CrF_lbvRBD.dat", "carina_far":"CrF_lbvRBD.dat",
"ctn":"CtN_lbvRBD.dat", "centaurus_near":"CtN_lbvRBD.dat",
"ctf":"CtF_lbvRBD.dat", "centaurus_far":"CtF_lbvRBD.dat",
"loc":"Loc_lbvRBD.dat", "local":"Loc_lbvRBD.dat",
"los":"LoS_lbvRBD.dat", "local_spur":"LoS_lbvRBD.dat",
"nor":"Nor_lbvRBD.dat", "norma":"Nor_lbvRBD.dat",
"osc":"OSC_lbvRBD.dat", "outer_centaurus":"OSC_lbvRBD.dat",
"outer_scutum":"OSC_lbvRBD.dat", "outer_scutum_centaurus":"OSC_lbvRBD.dat",
"outer":"Out_lbvRBD.dat", "out":"Out_lbvRBD.dat",
"per":"Per_lbvRBD.dat", "perseus":"Per_lbvRBD.dat",
"scn":"ScN_lbvRBD.dat", "scutum_near":"ScN_lbvRBD.dat",
"scf":"ScF_lbvRBD.dat", "scutum_far":"ScF_lbvRBD.dat",
"sgn":"SgN_lbvRBD.dat", "sagittarius_near":"SgN_lbvRBD.dat",
"sgf":"SgF_lbvRBD.dat", "sagittarius_far":"SgF_lbvRBD.dat"
}
def get_lbv_track(filename = None, reid_track = None, **kwargs):
"""
returns (longitude, latitude, velocity, radius, beta, distance) for spiral arm tracks
Parameters
----------
filename:'str', optional, must be keyword
Filename of custom LBV track to be read in
reid_track:'str', optional, must be keyword
Spiral Arm track from Reid et al. (2016) to read in
Options are not case sensitive:
3kpc Arm:
Far: "3kf", "3kpc_far"
Near: "3kn", "3kpc_near"
Aquila Rift: "AqR", "Aquila_Rift"
Aquila Spur: "AqS", "Aquila_Spur"
Connecting Arm:
Near: "CnN", "Connecting_Near"
Extension: "CnX", "Connecting_Extension"
Carina Arm:
Near: "CrN", "Carina_Near"
Far: "CrF", "Carina_Far"
Centaurus Arm:
Near: "CtN", "Centaurus_Near"
Far: "CtF", "Centaurus_Far"
Local Arm:
"Loc", "Local"
Spur?: "LoS", "Local_Spur"
Norma Arm:
"Nor", "Norma"
Outer Scutum Centaurus Arm:
"OSC", "Outer_Scutum", "Outer_Centaurus", "Outer_Scutum_Centaurus"
Outer Arm:
"Outer", "Out"
Perseus Arm:
"Per", "Perseus"
Scutum Arm:
Near: "ScN", "Scutum_Near"
Far: "ScF", "Scutum_Far"
Sagittarius Arm:
Near: "SgN", "Sagittarius_Near"
Far: "SgF", "Sagittarius_Far"
kwargs:
optional keywords passed to np.genfromtxt
"""
# Check for Reid Track Match:
if reid_track is not None:
try:
filename = os.path.join(directory, "data", "Reid16_SpiralArms", track_dict[reid_track.lower()])
except KeyError:
raise KeyError("Reid et al. (2016) Spiral Arm track for {} was not found!".format(reid_track))
else:
logging.warning("Not using provided data files - expecting columns to be ordered as lbv_RBD.")
# Try reading in data:
if not "comments" in kwargs:
# Default comments flag in Reid lbv_RBD Tracks
kwargs["comments"] = "!"
track = np.genfromtxt(filename, **kwargs)
# Check shape
if track.shape[1] != 6:
logging.warning("Track file did not have expected number of columns - adding in columns of 0s")
new_track = np.zeros((track.shape[0], 6))
for column in range(track.shape[1]):
new_track[:,column] = track[:,column]
track = new_track
return track
def get_spiral_slice(survey, track = None, filename = None,
brange = None, lrange = None,
interpolate = True, wrap_at_180 = False,
vel_width = None, return_track = False):
"""
Returns SkySurvey object isolated to velocity ranges corresponding to specified spiral arm
Parameters
----------
survey: 'whampy.skySurvey'
input skySurvey
track: 'np.ndarray', 'str', optional, must be keyword
if 'numpy array', lbv_RBD track data
if 'str', name of spiral arm from Reid et al. (2016)
filename: 'str', optional, must be keyword
filename of track file to read in using whampy.lbvTracks.get_lbv_track
brange: 'list', 'u.Quantity'
min,max latitude to restrict data to
Default of +/- 40 deg
lrange: 'list', 'u.Quantity'
min,max longitude to restrict data to
Default of full track extent
interpolate: 'bool', optional, must be keyword
if True, interpolates velocity to coordinate of pointings
if False, ... do nothing ... for now
Future: slices have velocities set by track
wrap_at_180: `bool`, optional, must be keyword
if True, wraps longitude angles at 180d
use if mapping accross Galactic Center
vel_width: `number`, `u.Quantity`, optional, must be keyword
velocity width to isolate in km/s
return_track: `bool`, optional, must be keyword
if True, will also return the spiral arm track as the second element of a tuple
"""
# Check Track Data
if track is not None:
if not track.__class__ is np.ndarray:
track = get_lbv_track(reid_track = track)
else:
if track.shape[1] < 2:
raise TypeError("track should have at least two columns (l,v) or up to 6 (lbvRBD).")
elif filename is None:
raise SyntaxError("No track or track filename provided!")
else:
track = get_lbv_track(filename = filename)
if wrap_at_180:
wrap_at = "180d"
else:
wrap_at = "360d"
# Check velocity width
if vel_width is None:
logging.warning("No Velocity width specified, using default of 16 km/s.")
vel_width = 16*u.km/u.s
elif not isinstance(vel_width, u.Quantity):
vel_width *= u.km/u.s
logging.warning("No units specified for vel_width, assuming km/s.")
#Extract Needed track informattion
if track.shape[1] == 2:
lon_track = track[:,0] * u.deg
lon_track = Angle(lon_track).wrap_at(wrap_at)
vel_track = track[:,1] * u.km/u.s
else: # Reid et al. (2016) format
lon_track = track[:,0] * u.deg
lon_track = Angle(lon_track).wrap_at(wrap_at)
vel_track = track[:,2] * u.km/u.s
# Set Default latitude range
if brange is None:
brange = [-40,40]*u.deg
elif isinstance(brange, u.Quantity):
brange = brange.to(u.deg)
else:
brange = brange * u.deg
logging.warning("No units specified for latitude range, assuming Degrees!")
# Set Longitude Range
if lrange is None:
lrange = [ | np.min(lon_track.value) | numpy.min |
#######################
#<NAME>
#Orbit Propagator Ver2
#UTAT Space Systems
#Orbit Propagator Project (ADCS)
#Dec 28th, 2020
#Version 2.1: Jan 9, 2020
#######################
from scipy.integrate import solve_ivp
import numpy as np
import matplotlib.pyplot as plt
from convert_to_vectors2 import vectors
#Define constants##########################
radius=6378.0
mu=6.67408*(10**-20)*5.972*(10**24) #G*m
###########################################
#Define inputs#############################
eccentricity=0.7
semi_maj_axis=9000
inclination=0
raan=0
periapsis=3.49
t0=0
time_step=5
time_interval=20000
###########################################
def magnitude(a,b,c):
r=(a)**2+(b)**2+(c)**2
r= | np.sqrt(r) | numpy.sqrt |
import math
import numpy as np
import pandas as pd
from scipy import integrate
import numpy as np
from scipy.special import kl_div
from scipy.stats import ks_2samp, wasserstein_distance
import torch
from scipy.stats import ks_2samp, wasserstein_distance, ttest_ind
### sys relative to root dir
import sys
from os.path import dirname, realpath
sys.path.append(dirname(dirname(dirname(realpath(__file__)))))
### absolute imports wrt root
from codes.utilities.custom_logging import ezLogging
def calc_feature_distances(refiners, validation_data, device):
'''
TODO...get the source from the room
Find the best refiner and discriminator from the list of refiners and discriminators using the feature distances.
Parameters:
refiners (list(torch.nn)): list of refiners
validation_data (simganData): SimGAN dataset
Returns:
'''
#N_samples = 100
all_real = validation_data.real_raw.squeeze()#[:N_samples]
all_simulated = validation_data.simulated_raw#[:N_samples]
simulated_tensor = torch.tensor(all_simulated, dtype=torch.float, device=device)
# Calculate kl_div and wasserstein distance for features
fe = FeatureExtractor()
real_features = fe.get_features(all_real)
feature_scores = {}
for id_R, R in enumerate(refiners):
refined_tensor = R(simulated_tensor.clone())
refined = refined_tensor.detach().numpy().squeeze()
refined_features = fe.get_features(refined)
# Normalize features
mins = np.expand_dims(np.min(np.concatenate([real_features, refined_features], axis=1), axis=1), axis=1)
maxs = np.expand_dims(np.max(np.concatenate([real_features, refined_features], axis=1), axis=1), axis=1)
normalized_real_features = (real_features - mins) / (maxs - mins)
normalized_refined_features = (refined_features - mins) / (maxs - mins)
kl_div, wasserstein_dist, ks_stat, pval = get_sampled_distribution_relation_scores(normalized_real_features.T, normalized_refined_features.T, bin=True)
feature_scores[id_R] = {'kl_div': kl_div, 'wasserstein_dist': wasserstein_dist, 'ks_stat': ks_stat, 'sampled_pval': pval}
mins = np.expand_dims(np.min(np.concatenate([real_features, real_features], axis=1), axis=1), axis=1)
maxs = np.expand_dims(np.max(np.concatenate([real_features, real_features], axis=1), axis=1), axis=1)
normalized_real_features = (real_features - mins) / (maxs - mins)
feature_scores = pd.DataFrame.from_dict(feature_scores, orient='index')
return feature_scores
def calc_t_tests(refiners, validation_data, device):
'''
Find the best refiner and discriminator from the list of refiners and discriminators using Welsh's t-tests.
Parameters:
refiners (list(torch.nn)): list of refiners
validation_data (simganData): SimGAN dataset
Returns:
'''
all_real = validation_data.real_raw.squeeze()
all_simulated = validation_data.simulated_raw
simulated_tensor = torch.tensor(all_simulated, dtype=torch.float, device=device)
# Calculate kl_div and wasserstein distance for features
fe = FeatureExtractor()
real_features = fe.get_features(all_real)
feature_scores = {}
for id_R, R in enumerate(refiners):
refined_tensor = R(simulated_tensor.clone())
refined = refined_tensor.detach().numpy().squeeze()
refined_features = fe.get_features(refined)
# Normalize features
mins = np.expand_dims(np.min(np.concatenate([real_features, refined_features], axis=1), axis=1), axis=1)
maxs = np.expand_dims(np.max(np.concatenate([real_features, refined_features], axis=1), axis=1), axis=1)
normalized_real_features = (real_features - mins) / (maxs - mins)
normalized_refined_features = (refined_features - mins) / (maxs - mins)
condensed_wave_p_val = get_wave_t_test(normalized_real_features.T, normalized_refined_features.T)
auc_p_val = get_auc_t_test(normalized_real_features.T, normalized_refined_features.T)
kl_div, wasserstein_dist, ks_stat, pval = get_condensed_wave_dist(normalized_real_features.T, normalized_refined_features.T)
avg_feat_p_val = get_multi_feature_average_t_test(normalized_real_features.T, normalized_refined_features.T)
num_significant_feat = get_num_significant(normalized_real_features.T, normalized_refined_features.T, alpha=0.05)
feature_scores[id_R] = {'condensed_kl_div': kl_div, 'condensed_wasserstein_dist': wasserstein_dist, 'condensed_ks_stat': ks_stat,\
'condensed_ks_pval': pval, 'auc_pval': auc_p_val, 'condensed_wave_pval': condensed_wave_p_val, \
'num_sig': num_significant_feat, 'avg_feat_pval': avg_feat_p_val}
mins = np.expand_dims(np.min(np.concatenate([real_features, real_features], axis=1), axis=1), axis=1)
maxs = np.expand_dims(np.max(np.concatenate([real_features, real_features], axis=1), axis=1), axis=1)
normalized_real_features = (real_features - mins) / (maxs - mins)
feature_scores = pd.DataFrame.from_dict(feature_scores, orient='index')
return feature_scores
def estimated_trials(n, m):
'''
For two unequally sized distributions, we want to randomly select a batch of m samples
from both distributions and compare them. We want to continue sampling and comparing
until we are confident that all n samples from the larger distributions have been sampled
at least once.
This problem is an extension of the coupon collector problem
https://en.wikipedia.org/wiki/Coupon_collector%27s_problem
Specifically, we are looking into a Batched coupon collector problem
Unfortunately this solution is mathematically impossible due to the size of n
https://math.stackexchange.com/questions/3278200/iteratively-replacing-3-chocolates-in-a-box-of-10/3278285#3278285
So we are running a simplified version by splitting the dataset into batches of samples,
where we use n/m as the number of samples and assume m is 1. This means we are instead
comparing across batches instead of samples, meaning we will be confident that each batch
will be sampled at least once.
This function returns the expected number of times we need to sample the
distributions in order to see all n/m batches if we continue sampling batches of size m.
Parameters:
n (int): size of larger distribution
m (int): batch size
Returns:
expected_trials (int): number of trials needed to sample everything once
'''
num_batches = n//m
euler_mascheroni = 0.5772156649
expected_trials = num_batches * np.log(num_batches) + euler_mascheroni * num_batches + 0.5
return int(expected_trials)
def divide_pad_distributions(dist1, dist2, batch_size):
'''
Divide the distributions to be evenly divisible by the batch size and pad the
distributions to fit the correct size. To pad the batches
that are too small, we simply select random samples from the overall distribution.
Parameters:
dist1 (ndarray): NxD numpy array
dist2 (ndarray): MxD numpy array
batch_size (int): given batch size of distribution
Returns:
padded_dist1 (ndarray), padded_dist2 (ndarray): two numpy arrays, each with batches of samples of size batch_size
'''
split_dist1 = np.array_split(dist1, math.ceil(len(dist1)/batch_size))
split_dist2 = np.array_split(dist2, math.ceil(len(dist2)/batch_size))
for i, batch in enumerate(split_dist1):
if len(batch) != batch_size:
random_samples = dist1[np.random.randint(dist1.shape[0], size=(batch_size - len(split_dist1[i]))), :]
split_dist1[i] = np.vstack((split_dist1[i], random_samples))
for j, batch in enumerate(split_dist2):
if len(batch) != batch_size:
random_samples = dist2[np.random.randint(dist2.shape[0], size=(batch_size - len(split_dist2[j]))), :]
split_dist2[j] = np.vstack((split_dist2[j], random_samples))
return split_dist1, split_dist2
def get_full_kl_div(dist1, dist2, batch_size, bin = True, clip_negatives=True, clip_lower_bound=0.0001):
'''
Calculate the kl divergence between the 2 distributions based on matching each batch with each other
Parameters:
dist1 (ndarray): NxD numpy array
dist2 (ndarray): MxD numpy array
batch_size (int): given batch size of distribution
clip_negatives (boolean): indicates whether we should clip the lower end of the disributions, can be useful to prevent infinite kl divergence
clip_lower_bound (float): the lower bound to clip values at
Returns:
mean_kl_div (ndarray), median_kl_dv (ndarray): two numpy arrays, each with shape (D,), of the kl divergences
'''
if clip_negatives:
# Clip values to positive to give reasonable values
dist1 = np.clip(dist1, clip_lower_bound, dist1.max())
dist2 = np.clip(dist2, clip_lower_bound, dist2.max())
# Shuffle arrays
np.random.shuffle(dist1)
np.random.shuffle(dist2)
dist1, dist2 = divide_pad_distributions(dist1, dist2, batch_size)
#print("Number of combinations: ", len(dist1) * len(dist2))
log_counter = 0
kl_divs = None
for real_batch in dist1:
dist1_sample = real_batch
np.random.shuffle(dist1_sample)
for sim_batch in dist2:
dist2_sample = sim_batch
np.random.shuffle(dist2_sample)
axis = 1 if bin else 0
if kl_divs is not None:
kl_divs = np.vstack((kl_divs, kl_div(dist1_sample, dist2_sample).sum(axis=axis)))
else:
kl_divs = kl_div(dist1_sample, dist2_sample).sum(axis=axis)
#print("Combo: ", log_counter)
log_counter += 1
return np.mean(kl_divs), np.median(kl_divs)
def get_sampled_kl_div(dist1, dist2, batch_size, bin = True, clip_negatives=True, clip_lower_bound=0.0001):
'''
Calculate the kl divergence between the 2 distributions based on random sampling
Parameters:
dist1 (ndarray): NxD numpy array
dist2 (ndarray): MxD numpy array
batch_size (int): given batch size of distribution
clip_negatives (boolean): indicates whether we should clip the lower end of the disributions, can be useful to prevent infinite kl divergence
clip_lower_bound (float): the lower bound to clip values at
Returns:
mean_kl_div (ndarray), median_kl_dv (ndarray): two numpy arrays, each with shape (D,), of the kl divergences
'''
larger_dist_size = max(len(dist1), len(dist2))
num_trials = estimated_trials(larger_dist_size, batch_size)
#print("Number of trials: ", num_trials)
if clip_negatives:
# Clip values to positive to give reasonable values
dist1 = np.clip(dist1, clip_lower_bound, dist1.max())
dist2 = np.clip(dist2, clip_lower_bound, dist2.max())
# Shuffle arrays
np.random.shuffle(dist1)
np.random.shuffle(dist2)
dist1, dist2 = divide_pad_distributions(dist1, dist2, batch_size)
kl_divs = None
for i in range(num_trials):
#print("Trial started: ", i)
dist1_sample = dist1[np.random.randint(len(dist1))]
dist2_sample = dist2[np.random.randint(len(dist2))]
np.random.shuffle(dist1_sample)
np.random.shuffle(dist2_sample)
axis = 1 if bin else 0
if kl_divs is not None:
kl_divs = np.vstack((kl_divs, kl_div(dist1_sample, dist2_sample).sum(axis=axis)))
else:
kl_divs = kl_div(dist1_sample, dist2_sample).sum(axis=axis)
return np.mean(kl_divs), np.median(kl_divs)
def get_average_kl_div(dist1, dist2, bin=True, clip_negatives=True, clip_lower_bound=0.0001):
'''
Calculate the kl divergence between the 2 distributions
Parameters:
dist1 (ndarray): NxD numpy array
dist2 (ndarray): NxD numpy array
clip_negatives (boolean): indicates whether we should clip the lower end of the disributions, can be useful to prevent infinite kl divergence
clip_lower_bound (float): the lower bound to clip values at
Returns:
mean_kl_div (ndarray), median_kl_dv (ndarray): two numpy arrays, each with shape (D,), of the kl divergences
'''
if clip_negatives:
# Clip values to positive to give reasonable values
dist1 = np.clip(dist1, clip_lower_bound, dist1.max())
dist2 = np.clip(dist2, clip_lower_bound, dist2.max())
# Shuffle arrays
np.random.shuffle(dist1)
np.random.shuffle(dist2)
axis = 1 if bin else 0
kl_divs = kl_div(dist1, dist2).sum(axis=axis)
return np.mean(kl_divs), np.median(kl_divs)
def get_full_wasserstein(dist1, dist2, batch_size, bin=True):
'''
Estimate the average wasserstein distance between the 2 distributions based on matching each batch with each other
Parameters:
dist1 (ndarray): NxD numpy array
dist2 (ndarray): MxD numpy array
batch_size (int): given batch size of distribution
Returns:
mean_wasserstein_dist (ndarray), median_wasserstein_dist (ndarray): two numpy arrays, each with shape (D,), of the average wasserstein divergences
'''
# Shuffle arrays
np.random.shuffle(dist1)
np.random.shuffle(dist2)
dist1, dist2 = divide_pad_distributions(dist1, dist2, batch_size)
#print("Number of combinations: ", len(dist1) * len(dist2))
log_counter = 0
wassersteins = list()
for real_batch in dist1:
dist1_sample = real_batch
np.random.shuffle(dist1_sample)
for sim_batch in dist2:
dist2_sample = sim_batch
np.random.shuffle(dist2_sample)
if bin:
for j in range(len(dist1_sample[0])):
wassersteins.append(wasserstein_distance(dist1_sample[:, j], dist2_sample[:, j]))
else:
for j in range(batch_size):
# compute 1d wasserstein between 2 random signals
wassersteins.append(wasserstein_distance(dist1_sample[j].squeeze(), dist2_sample[j].squeeze()))
#print("Combo: ", log_counter)
log_counter += 1
return np.mean(np.array(wassersteins)), np.median(np.array(wassersteins))
def get_sampled_wasserstein(dist1, dist2, batch_size, bin=True):
'''
Estimate the average wasserstein distance between the 2 distributions based on random sampling
Parameters:
dist1 (ndarray): NxD numpy array
dist2 (ndarray): MxD numpy array
batch_size (int): given batch size of distribution
Returns:
mean_wasserstein_dist (ndarray), median_wasserstein_dist (ndarray): two numpy arrays, each with shape (D,), of the average wasserstein divergences
'''
larger_dist_size = max(len(dist1), len(dist2))
num_trials = estimated_trials(larger_dist_size, batch_size)
#print("Number of trials: ", num_trials)
# Shuffle arrays
np.random.shuffle(dist1)
np.random.shuffle(dist2)
dist1, dist2 = divide_pad_distributions(dist1, dist2, batch_size)
wassersteins = list()
for i in range(num_trials):
#print("Trial started: ", i)
dist1_sample = dist1[np.random.randint(len(dist1))]
dist2_sample = dist2[np.random.randint(len(dist2))]
np.random.shuffle(dist1_sample)
np.random.shuffle(dist2_sample)
if bin:
for j in range(len(dist1_sample[0])):
wassersteins.append(wasserstein_distance(dist1_sample[:, j], dist2_sample[:, j]))
else:
for j in range(batch_size):
# compute 1d wasserstein between 2 random signals
wassersteins.append(wasserstein_distance(dist1_sample[j].squeeze(), dist2_sample[j].squeeze()))
return np.mean(np.array(wassersteins)), np.median(np.array(wassersteins))
def estimate_average_wasserstein(dist1, dist2, bin=True):
'''
Estimate the average wasserstein distance between the 2 distributions
Parameters:
dist1 (ndarray): NxD numpy array
dist2 (ndarray): NxD numpy array
num_rounds (int): number of samples to draw and find avg. wasserstein difference between
Returns:
mean_wasserstein_dist (ndarray), median_wasserstein_dist (ndarray): two numpy arrays, each with shape (D,), of the average wasserstein divergences
'''
wassersteins = list()
if bin:
for j in range(len(dist1[0])):
wassersteins.append(wasserstein_distance(dist1[:, j], dist2[:, j]))
else:
for j in range(len(dist1)):
# compute 1d wasserstein between 2 random signals
wassersteins.append(wasserstein_distance(dist1[j].squeeze(), dist2[j].squeeze()))
return np.mean(wassersteins), np.median(wassersteins)
def get_full_ks_stat(dist1, dist2, batch_size, use_median=False, bin=True):
'''
Estimate the average ks-stat between the 2 distributions based on matching each batch with each other
Parameters:
dist1 (ndarray): NxD numpy array
dist2 (ndarray): MxD numpy array
batch_size (int): given batch size of distribution
Returns:
mean_ks_stat (ndarray), mean_pvalue (ndarray): two numpy arrays, each with shape (D,), of the mean ks stats/pvalue
'''
# Shuffle arrays
np.random.shuffle(dist1)
np.random.shuffle(dist2)
dist1, dist2 = divide_pad_distributions(dist1, dist2, batch_size)
#print("Number of combinations: ", len(dist1) * len(dist2))
log_counter = 0
ks_stats = list()
for real_batch in dist1:
dist1_sample = real_batch
np.random.shuffle(dist1_sample)
for sim_batch in dist2:
dist2_sample = sim_batch
| np.random.shuffle(dist2_sample) | numpy.random.shuffle |
# -*- coding: utf-8 -*-
# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
# pylint: disable=invalid-name,missing-docstring
from test.python.common import QiskitTestCase
import json
import unittest
import numpy as np
from numpy.linalg import norm
import qiskit
import qiskit._compiler
from qiskit import ClassicalRegister
from qiskit import QuantumCircuit
from qiskit import QuantumJob
from qiskit import QuantumRegister
from qiskit.backends.local.qasm_simulator_cpp import (QasmSimulatorCpp,
cx_error_matrix,
x90_error_matrix)
class TestLocalQasmSimulatorCpp(QiskitTestCase):
"""
Test job_processor module.
"""
def setUp(self):
self.seed = 88
self.qasm_filename = self._get_resource_path('qasm/example.qasm')
with open(self.qasm_filename, 'r') as qasm_file:
self.qasm_text = qasm_file.read()
self.qasm_ast = qiskit.qasm.Qasm(data=self.qasm_text).parse()
self.qasm_be = qiskit.unroll.CircuitBackend(['u1', 'u2', 'u3', 'id', 'cx'])
self.qasm_circ = qiskit.unroll.Unroller(self.qasm_ast, self.qasm_be).execute()
qr = QuantumRegister(2, 'q')
cr = ClassicalRegister(2, 'c')
qc = QuantumCircuit(qr, cr)
qc.h(qr[0])
qc.measure(qr[0], cr[0])
self.qc = qc
# create qobj
compiled_circuit1 = qiskit._compiler.compile_circuit(self.qc, format='json')
compiled_circuit2 = qiskit._compiler.compile_circuit(self.qasm_circ, format='json')
self.qobj = {'id': 'test_qobj',
'config': {
'max_credits': 3,
'shots': 2000,
'backend_name': 'local_qasm_simulator_cpp',
'seed': 1111
},
'circuits': [
{
'name': 'test_circuit1',
'compiled_circuit': compiled_circuit1,
'basis_gates': 'u1,u2,u3,cx,id',
'layout': None,
},
{
'name': 'test_circuit2',
'compiled_circuit': compiled_circuit2,
'basis_gates': 'u1,u2,u3,cx,id',
'layout': None,
}
]}
# Simulator backend
try:
self.backend = QasmSimulatorCpp()
except FileNotFoundError as fnferr:
raise unittest.SkipTest(
'cannot find {} in path'.format(fnferr))
self.q_job = QuantumJob(self.qobj,
backend=self.backend,
preformatted=True)
def test_x90_coherent_error_matrix(self):
X90 = np.array([[1, -1j], [-1j, 1]]) / np.sqrt(2)
U = x90_error_matrix(0., 0.).dot(X90)
target = X90
self.assertAlmostEqual(norm(U - target), 0.0, places=10,
msg="identity error matrix")
U = x90_error_matrix(np.pi / 2., 0.).dot(X90)
target = -1j * np.array([[0, 1], [1, 0]])
self.assertAlmostEqual(norm(U - target), 0.0, places=10)
U = x90_error_matrix(0., np.pi / 2.).dot(X90)
target = np.array([[1., -1], [1, 1.]]) / np.sqrt(2.)
self.assertAlmostEqual(norm(U - target), 0.0, places=10)
U = x90_error_matrix(np.pi / 2, np.pi / 2.).dot(X90)
target = np.array([[0., -1], [1, 0.]])
self.assertAlmostEqual(norm(U - target), 0.0, places=10)
U = x90_error_matrix(0.02, -0.03)
self.assertAlmostEqual(norm(U.dot(U.conj().T) - np.eye(2)), 0.0,
places=10, msg="Test error matrix is unitary")
def test_cx_coherent_error_matrix(self):
CX = np.array([[1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0], [0, 1, 0, 0]])
U = cx_error_matrix(0., 0.).dot(CX)
target = CX
self.assertAlmostEqual(norm(U - target), 0.0, places=10,
msg="identity error matrix")
U = cx_error_matrix(np.pi / 2., 0.).dot(CX)
target = np.array([[1, 0, 1j, 0],
[0, -1j, 0, 1],
[1j, 0, 1, 0],
[0, 1, 0, -1j]]) / np.sqrt(2)
self.assertAlmostEqual(norm(U - target), 0.0, places=10)
U = cx_error_matrix(0.03, -0.04)
self.assertAlmostEqual(norm(U.dot(U.conj().T) - np.eye(4)), 0.0,
places=10, msg="Test error matrix is unitary")
def test_run_qobj(self):
result = self.backend.run(self.q_job).result()
shots = self.qobj['config']['shots']
threshold = 0.04 * shots
counts = result.get_counts('test_circuit2')
target = {'100 100': shots / 8, '011 011': shots / 8,
'101 101': shots / 8, '111 111': shots / 8,
'000 000': shots / 8, '010 010': shots / 8,
'110 110': shots / 8, '001 001': shots / 8}
self.assertDictAlmostEqual(counts, target, threshold)
def test_qobj_measure_opt(self):
filename = self._get_resource_path('qobj/cpp_measure_opt.json')
with open(filename, 'r') as file:
q_job = QuantumJob(json.load(file),
backend=self.backend,
preformatted=True)
result = self.backend.run(q_job).result()
shots = q_job.qobj['config']['shots']
expected_data = {
'measure (opt)': {
'deterministic': True,
'counts': {'00': shots},
'statevector': np.array([1, 0, 0, 0])},
'x0 measure (opt)': {
'deterministic': True,
'counts': {'01': shots},
'statevector': np.array([0, 1, 0, 0])},
'x1 measure (opt)': {
'deterministic': True,
'counts': {'10': shots},
'statevector': np.array([0, 0, 1, 0])},
'x0 x1 measure (opt)': {
'deterministic': True,
'counts': {'11': shots},
'statevector': np.array([0, 0, 0, 1])},
'y0 measure (opt)': {
'deterministic': True,
'counts': {'01': shots},
'statevector': np.array([0, 1j, 0, 0])},
'y1 measure (opt)': {
'deterministic': True,
'counts': {'10': shots},
'statevector': np.array([0, 0, 1j, 0])},
'y0 y1 measure (opt)': {
'deterministic': True,
'counts': {'11': shots},
'statevector': np.array([0, 0, 0, -1j])},
'h0 measure (opt)': {
'deterministic': False,
'counts': {'00': shots / 2, '01': shots / 2},
'statevector': np.array([1 / np.sqrt(2), 1 / np.sqrt(2), 0, 0])},
'h1 measure (opt)': {
'deterministic': False,
'counts': {'00': shots / 2, '10': shots / 2},
'statevector': np.array([1 / np.sqrt(2), 0, 1 / np.sqrt(2), 0])},
'h0 h1 measure (opt)': {
'deterministic': False,
'counts': {'00': shots / 4, '01': shots / 4,
'10': shots / 4, '11': shots / 4},
'statevector': np.array([0.5, 0.5, 0.5, 0.5])},
'bell measure (opt)': {
'deterministic': False,
'counts': {'00': shots / 2, '11': shots / 2},
'statevector': np.array([1 / np.sqrt(2), 0, 0, 1 / np.sqrt(2)])}
}
for name in expected_data:
# Check counts:
counts = result.get_counts(name)
expected_counts = expected_data[name]['counts']
if expected_data[name].get('deterministic', False):
self.assertEqual(counts, expected_counts,
msg=name + ' counts')
else:
threshold = 0.04 * shots
self.assertDictAlmostEqual(counts, expected_counts,
threshold, msg=name + 'counts')
# Check snapshot
snapshots = result.get_snapshots(name)
self.assertEqual(set(snapshots), {'0'},
msg=name + ' snapshot keys')
self.assertEqual(len(snapshots['0']), 3,
msg=name + ' snapshot length')
state = snapshots['0']['statevector'][0]
expected_state = expected_data[name]['statevector']
fidelity = np.abs(expected_state.dot(state.conj())) ** 2
self.assertAlmostEqual(fidelity, 1.0, places=10,
msg=name + ' snapshot fidelity')
rho = snapshots['0']['density_matrix']
self.assertAlmostEqual(np.trace(rho), 1)
prob = snapshots['0']['probabilities']
self.assertAlmostEqual(np.sum(prob), 1)
def test_qobj_measure_opt_flag(self):
filename = self._get_resource_path('qobj/cpp_measure_opt_flag.json')
with open(filename, 'r') as file:
q_job = QuantumJob(json.load(file),
backend=self.backend,
preformatted=True)
result = self.backend.run(q_job).result()
shots = q_job.qobj['config']['shots']
sampled_measurements = {
'measure (sampled)': True,
'trivial (sampled)': True,
'reset1 (shots)': False,
'reset2 (shots)': False,
'reset3 (shots)': False,
'gate1 (shots)': False,
'gate2 (shots)': False,
'gate3 (shots)': False,
'gate4 (shots)': False
}
for name in sampled_measurements:
snapshots = result.get_snapshots(name)
# Check snapshot keys
self.assertEqual(set(snapshots), {'0'},
msg=name + ' snapshot keys')
# Check number of snapshots
# there should be 1 for measurement sampling optimization
# and there should be >1 for each shot beign simulated.
num_snapshots = len(snapshots['0'].get('statevector', []))
if sampled_measurements[name] is True:
self.assertEqual(num_snapshots, 1,
msg=name + ' snapshot length')
else:
self.assertEqual(num_snapshots, shots,
msg=name + ' snapshot length')
def test_qobj_reset(self):
filename = self._get_resource_path('qobj/cpp_reset.json')
with open(filename, 'r') as file:
q_job = QuantumJob(json.load(file),
backend=self.backend,
preformatted=True)
result = self.backend.run(q_job).result()
expected_data = {
'reset': {'statevector': np.array([1, 0])},
'x reset': {'statevector': np.array([1, 0])},
'y reset': {'statevector': np.array([1, 0])},
'h reset': {'statevector': np.array([1, 0])}
}
for name in expected_data:
# Check snapshot is |0> state
snapshots = result.get_snapshots(name)
self.assertEqual(set(snapshots), {'0'},
msg=name + ' snapshot keys')
self.assertEqual(len(snapshots['0']), 1,
msg=name + ' snapshot length')
state = snapshots['0']['statevector'][0]
expected_state = expected_data[name]['statevector']
fidelity = np.abs(expected_state.dot(state.conj())) ** 2
self.assertAlmostEqual(fidelity, 1.0, places=10,
msg=name + ' snapshot fidelity')
def test_qobj_save_load(self):
filename = self._get_resource_path('qobj/cpp_save_load.json')
with open(filename, 'r') as file:
q_job = QuantumJob(json.load(file),
backend=self.backend,
preformatted=True)
result = self.backend.run(q_job).result()
snapshots = result.get_snapshots('save_command')
self.assertEqual(set(snapshots), {'0', '1', '10', '11'},
msg='snapshot keys')
state0 = snapshots['0']['statevector'][0]
state10 = snapshots['10']['statevector'][0]
state1 = snapshots['1']['statevector'][0]
state11 = snapshots['11']['statevector'][0]
expected_state0 = np.array([1, 0])
expected_state10 = np.array([1 / np.sqrt(2), 1 / np.sqrt(2)])
fidelity0 = np.abs(expected_state0.dot(state0.conj())) ** 2
fidelity1 = np.abs(expected_state0.dot(state1.conj())) ** 2
fidelity10 = np.abs(expected_state10.dot(state10.conj())) ** 2
fidelity11 = np.abs(expected_state10.dot(state11.conj())) ** 2
self.assertAlmostEqual(fidelity0, 1.0, places=10, msg='snapshot 0')
self.assertAlmostEqual(fidelity10, 1.0, places=10, msg='snapshot 0')
self.assertAlmostEqual(fidelity1, 1.0, places=10, msg='snapshot 0')
self.assertAlmostEqual(fidelity11, 1.0, places=10, msg='snapshot 0')
def test_qobj_single_qubit_gates(self):
filename = self._get_resource_path('qobj/cpp_single_qubit_gates.json')
with open(filename, 'r') as file:
q_job = QuantumJob(json.load(file),
backend=self.backend,
preformatted=True)
result = self.backend.run(q_job).result()
expected_data = {
'snapshot': {
'statevector': np.array([1, 0])},
'id(U)': {
'statevector': np.array([1, 0])},
'id(u3)': {
'statevector': np.array([1, 0])},
'id(u1)': {
'statevector': np.array([1, 0])},
'id(direct)': {
'statevector': np.array([1, 0])},
'x(U)': {
'statevector': np.array([0, 1])},
'x(u3)': {
'statevector': np.array([0, 1])},
'x(direct)': {
'statevector': np.array([0, 1])},
'y(U)': {
'statevector': np.array([0, 1j])},
'y(u3)': {
'statevector': np.array([0, 1j])},
'y(direct)': {
'statevector': np.array([0, 1j])},
'h(U)': {
'statevector': np.array([1 / np.sqrt(2), 1 / np.sqrt(2)])},
'h(u3)': {
'statevector': np.array([1 / np.sqrt(2), 1 / np.sqrt(2)])},
'h(u2)': {
'statevector': np.array([1 / np.sqrt(2), 1 / np.sqrt(2)])},
'h(direct)': {
'statevector': np.array([1 / np.sqrt(2), 1 / np.sqrt(2)])},
'h(direct) z(U)': {
'statevector': np.array([1 / np.sqrt(2), -1 / np.sqrt(2)])},
'h(direct) z(u3)': {
'statevector': np.array([1 / np.sqrt(2), -1 / np.sqrt(2)])},
'h(direct) z(u1)': {
'statevector': np.array([1 / np.sqrt(2), -1 / np.sqrt(2)])},
'h(direct) z(direct)': {
'statevector': np.array([1 / np.sqrt(2), -1 / np.sqrt(2)])},
'h(direct) s(U)': {
'statevector': np.array([1 / np.sqrt(2), 1j / np.sqrt(2)])},
'h(direct) s(u3)': {
'statevector': np.array([1 / np.sqrt(2), 1j / np.sqrt(2)])},
'h(direct) s(u1)': {
'statevector': np.array([1 / np.sqrt(2), 1j / np.sqrt(2)])},
'h(direct) s(direct)': {
'statevector': np.array([1 / np.sqrt(2), 1j / np.sqrt(2)])},
'h(direct) sdg(U)': {
'statevector': np.array([1 / np.sqrt(2), -1j / np.sqrt(2)])},
'h(direct) sdg(u3)': {
'statevector': np.array([1 / np.sqrt(2), -1j / np.sqrt(2)])},
'h(direct) sdg(u1)': {
'statevector': np.array([1 / np.sqrt(2), -1j / np.sqrt(2)])},
'h(direct) sdg(direct)': {
'statevector': np.array([1 / np.sqrt(2), -1j / np.sqrt(2)])},
'h(direct) t(U)': {
'statevector': np.array([1 / np.sqrt(2), 0.5 + 0.5j])},
'h(direct) t(u3)': {
'statevector': np.array([1 / np.sqrt(2), 0.5 + 0.5j])},
'h(direct) t(u1)': {
'statevector': np.array([1 / np.sqrt(2), 0.5 + 0.5j])},
'h(direct) t(direct)': {
'statevector': np.array([1 / np.sqrt(2), 0.5 + 0.5j])},
'h(direct) tdg(U)': {
'statevector': np.array([1 / np.sqrt(2), 0.5 - 0.5j])},
'h(direct) tdg(u3)': {
'statevector': np.array([1 / np.sqrt(2), 0.5 - 0.5j])},
'h(direct) tdg(u1)': {
'statevector': np.array([1 / np.sqrt(2), 0.5 - 0.5j])},
'h(direct) tdg(direct)': {
'statevector': np.array([1 / np.sqrt(2), 0.5 - 0.5j])}
}
for name in expected_data:
# Check snapshot
snapshots = result.get_snapshots(name)
self.assertEqual(set(snapshots), {'0'},
msg=name + ' snapshot keys')
self.assertEqual(len(snapshots['0']), 1,
msg=name + ' snapshot length')
state = snapshots['0']['statevector'][0]
expected_state = expected_data[name]['statevector']
inner_product = expected_state.dot(state.conj())
self.assertAlmostEqual(inner_product, 1.0, places=10,
msg=name + ' snapshot fidelity')
def test_qobj_two_qubit_gates(self):
filename = self._get_resource_path('qobj/cpp_two_qubit_gates.json')
with open(filename, 'r') as file:
q_job = QuantumJob(json.load(file),
backend=self.backend,
preformatted=True)
result = self.backend.run(q_job).result()
expected_data = {
'h0 CX01': {
'statevector': np.array([1 / np.sqrt(2), 0, 0, 1 / np.sqrt(2)])},
'h0 CX10': {
'statevector': np.array([1 / np.sqrt(2), 1 / np.sqrt(2), 0, 0])},
'h1 CX01': {
'statevector': np.array([1 / np.sqrt(2), 0, 1 / np.sqrt(2), 0])},
'h1 CX10': {
'statevector': np.array([1 / np.sqrt(2), 0, 0, 1 / np.sqrt(2)])},
'h0 cx01': {
'statevector': np.array([1 / np.sqrt(2), 0, 0, 1 / np.sqrt(2)])},
'h0 cx10': {
'statevector': np.array([1 / np.sqrt(2), 1 / np.sqrt(2), 0, 0])},
'h1 cx01': {
'statevector': np.array([1 / np.sqrt(2), 0, 1 / np.sqrt(2), 0])},
'h1 cx10': {
'statevector': np.array([1 / np.sqrt(2), 0, 0, 1 / np.sqrt(2)])},
'h0 cz01': {
'statevector': np.array([1 / np.sqrt(2), 1 / np.sqrt(2), 0, 0])},
'h0 cz10': {
'statevector': np.array([1 / np.sqrt(2), 1 / np.sqrt(2), 0, 0])},
'h1 cz01': {
'statevector': np.array([1 / np.sqrt(2), 0, 1 / np.sqrt(2), 0])},
'h1 cz10': {
'statevector': np.array([1 / np.sqrt(2), 0, 1 / np.sqrt(2), 0])},
'h0 h1 cz01': {'statevector': np.array([0.5, 0.5, 0.5, -0.5])},
'h0 h1 cz10': {'statevector': np.array([0.5, 0.5, 0.5, -0.5])},
'h0 rzz01': {
'statevector': np.array([1 / np.sqrt(2), 1j / np.sqrt(2), 0, 0])},
'h0 rzz10': {
'statevector': np.array([1 / np.sqrt(2), 1j / np.sqrt(2), 0, 0])},
'h1 rzz01': {
'statevector': np.array([1 / np.sqrt(2), 0, 1j / np.sqrt(2), 0])},
'h1 rzz10': {
'statevector': np.array([1 / np.sqrt(2), 0, 1j / np.sqrt(2), 0])},
'h0 h1 rzz01': {'statevector': np.array([0.5, 0.5j, 0.5j, 0.5])},
'h0 h1 rzz10': {'statevector': np.array([0.5, 0.5j, 0.5j, 0.5])}
}
for name in expected_data:
# Check snapshot
snapshots = result.get_snapshots(name)
self.assertEqual(set(snapshots), {'0'},
msg=name + ' snapshot keys')
self.assertEqual(len(snapshots['0']), 1,
msg=name + ' snapshot length')
state = snapshots['0']['statevector'][0]
expected_state = expected_data[name]['statevector']
fidelity = np.abs(expected_state.dot(state.conj())) ** 2
self.assertAlmostEqual(fidelity, 1.0, places=10,
msg=name + ' snapshot fidelity')
def test_conditionals(self):
filename = self._get_resource_path('qobj/cpp_conditionals.json')
with open(filename, 'r') as file:
q_job = QuantumJob(json.load(file),
backend=self.backend,
preformatted=True)
result = self.backend.run(q_job).result()
expected_data = {
'single creg (c0=0)': {
'statevector': np.array([1, 0, 0, 0])},
'single creg (c0=1)': {
'statevector': np.array([0, 0, 0, 1])},
'two creg (c1=0)': {
'statevector': | np.array([1, 0, 0, 0]) | numpy.array |
# --------------------------------------------------------
# Flow-Guided Feature Aggregation
# Copyright (c) 2017 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
"""
given a imagenet vid imdb, compute mAP
"""
import numpy as np
import os
import cPickle
import cv2
import math as mh
import json
from scipy.optimize import linear_sum_assignment
from collections import Counter
from bbox.bbox_transform import bbox_overlaps
from utils.image import xmlread
import pdb
def get_vid_det_np(video):
# video[cls][img] = N x 5 array [x1, y1, x2, y2, score]
cur_video_result = []
for cls_idx, per_cls_boxes in enumerate(video):
for id, per_img_boxes in enumerate(per_cls_boxes):
for box in per_img_boxes:
det_l = box[0]
det_t = box[1]
det_w = box[2] - box[0] + 1
det_h = box[3] - box[1] + 1
score = box[4]
det_array = np.array([id, -1, det_l, det_t, det_w, det_h, score, cls_idx+1, -1, -1, -1])
cur_video_result.append(det_array)
return np.vstack(cur_video_result)
def parse_vid_gt(filename, frame_seg_id, class_to_index):
tree = xmlread(filename)
cur_frame_result = []
for obj in tree.findall('object'):
obj_dict = dict()
bbox = obj.find('bndbox')
obj_dict['label'] = class_to_index[obj.find('name').text]
obj_dict['bbox'] = [float(bbox.find('xmin').text),
float(bbox.find('ymin').text),
float(bbox.find('xmax').text),
float(bbox.find('ymax').text)]
gt_l = obj_dict['bbox'][0]
gt_t = obj_dict['bbox'][1]
gt_w = obj_dict['bbox'][2] - obj_dict['bbox'][0] + 1
gt_h = obj_dict['bbox'][3] - obj_dict['bbox'][1] + 1
obj_dict['track_id'] = int(obj.find('trackid').text)
gt_array = np.array([frame_seg_id, obj_dict['track_id'], gt_l, gt_t, gt_w, gt_h, 1, obj_dict['label'], -1, -1, -1])
cur_frame_result.append(gt_array)
return cur_frame_result
def get_stability_err(gt, det):
gt_x = (gt[0] + gt[2]) / 2.
gt_y = (gt[1] + gt[3]) / 2.
det_x = (det[0] + det[2]) / 2.
det_y = (det[1] + det[3]) / 2.
gt_w = gt[2] - gt[0] + 1
gt_h = gt[3] - gt[1] + 1
det_w = det[2] - det[0] + 1
det_h = det[3] - det[1] + 1
return (det_x - gt_x) * 1. / gt_w, (det_y - gt_y) * 1. / gt_h, \
(1. * det_w / det_h) / (1. * gt_w / gt_h)-1,\
np.sqrt(1. * det_w * det_h) / np.sqrt(1. * gt_w * gt_h)-1
def count_continue_seq(seq):
if len(seq) == 1: return 0
n = len(seq) - 1
frag = [seq[i] != seq[i - 1] for i in xrange(1, len(seq))]
return | np.sum(frag) | numpy.sum |
#!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "<NAME>" at 12:29, 20/04/2020 %
# %
# Email: <EMAIL> %
# Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 %
# Github: https://github.com/thieu1995 %
#-------------------------------------------------------------------------------------------------------%
from numpy.random import seed, permutation
from numpy import dot, ones
from opfunu.cec.cec2010.utils import *
def F1(solution=None, name="Shifted Elliptic Function", shift_data_file="f01_o.txt"):
problem_size = len(solution)
check_problem_size(problem_size)
shift_data = load_shift_data__(shift_data_file)[:problem_size]
z = solution - shift_data
return f2_elliptic__(z)
def F2(solution=None, name="Shifted Rastrigin’s Function", shift_data_file="f02_o.txt"):
problem_size = len(solution)
check_problem_size(problem_size)
shift_data = load_shift_data__(shift_data_file)[:problem_size]
z = solution - shift_data
return f3_rastrigin__(z)
def F3(solution=None, name="Shifted Ackley’s Function", shift_data_file="f03_o.txt"):
problem_size = len(solution)
check_problem_size(problem_size)
shift_data = load_shift_data__(shift_data_file)[:problem_size]
z = solution - shift_data
return f4_ackley__(z)
def F4(solution=None, name="Single-group Shifted and m-rotated Elliptic Function", shift_data_file="f04_op.txt", matrix_data_file="f04_m.txt", m_group=50):
problem_size = len(solution)
check_problem_size(problem_size)
matrix = load_matrix_data__(matrix_data_file)
op_data = load_matrix_data__(shift_data_file)
if problem_size == 1000:
shift_data = op_data[:1, :].reshape(-1)
permu_data = (op_data[1:, :].reshape(-1) - ones(problem_size)).astype(int)
else:
seed(0)
shift_data = op_data[:1,:].reshape(-1)[:problem_size]
permu_data = permutation(problem_size)
z = solution - shift_data
idx1 = permu_data[:m_group]
idx2 = permu_data[m_group:]
z_rot_elliptic = dot(z[idx1], matrix[:m_group, :m_group])
z_elliptic = z[idx2]
return f2_elliptic__(z_rot_elliptic) * 10**6 + f2_elliptic__(z_elliptic)
def F5(solution=None, name="Single-group Shifted and m-rotated Rastrigin’s Function", shift_data_file="f05_op.txt", matrix_data_file="f05_m.txt", m_group=50):
problem_size = len(solution)
check_problem_size(problem_size)
matrix = load_matrix_data__(matrix_data_file)
op_data = load_matrix_data__(shift_data_file)
if problem_size == 1000:
shift_data = op_data[:1, :].reshape(-1)
permu_data = (op_data[1:, :].reshape(-1) - ones(problem_size)).astype(int)
else:
seed(0)
shift_data = op_data[:1, :].reshape(-1)[:problem_size]
permu_data = permutation(problem_size)
z = solution - shift_data
idx1 = permu_data[:m_group]
idx2 = permu_data[m_group:]
z_rot_rastrigin = dot(z[idx1], matrix[:m_group, :m_group])
z_rastrigin = z[idx2]
return f3_rastrigin__(z_rot_rastrigin) * 10 ** 6 + f3_rastrigin__(z_rastrigin)
def F6(solution=None, name="Single-group Shifted and m-rotated Ackley’s Function", shift_data_file="f06_op.txt", matrix_data_file="f06_m.txt", m_group=50):
problem_size = len(solution)
check_problem_size(problem_size)
matrix = load_matrix_data__(matrix_data_file)
op_data = load_matrix_data__(shift_data_file)
if problem_size == 1000:
shift_data = op_data[:1, :].reshape(-1)
permu_data = (op_data[1:, :].reshape(-1) - ones(problem_size)).astype(int)
else:
seed(0)
shift_data = op_data[:1, :].reshape(-1)[:problem_size]
permu_data = permutation(problem_size)
z = solution - shift_data
idx1 = permu_data[:m_group]
idx2 = permu_data[m_group:]
z_rot_ackley = dot(z[idx1], matrix[:m_group, :m_group])
z_ackley = z[idx2]
return f4_ackley__(z_rot_ackley) * 10 ** 6 + f4_ackley__(z_ackley)
def F7(solution=None, name="Single-group Shifted m-dimensional Schwefel’s Problem 1.2", shift_data_file="f07_op.txt", m_group=50):
problem_size = len(solution)
check_problem_size(problem_size)
op_data = load_matrix_data__(shift_data_file)
if problem_size == 1000:
shift_data = op_data[:1, :].reshape(-1)
permu_data = (op_data[1:, :].reshape(-1) - ones(problem_size)).astype(int)
else:
seed(0)
shift_data = op_data[:1, :].reshape(-1)[:problem_size]
permu_data = permutation(problem_size)
z = solution - shift_data
idx1 = permu_data[:m_group]
idx2 = permu_data[m_group:]
z_schwefel = z[idx1]
z_shpere = z[idx2]
return f5_schwefel__(z_schwefel) * 10 ** 6 + f1_sphere__(z_shpere)
def F8(solution=None, name=" Single-group Shifted m-dimensional Rosenbrock’s Function", shift_data_file="f08_op.txt", m_group=50):
problem_size = len(solution)
check_problem_size(problem_size)
op_data = load_matrix_data__(shift_data_file)
if problem_size == 1000:
shift_data = op_data[:1, :].reshape(-1)
permu_data = (op_data[1:, :].reshape(-1) - ones(problem_size)).astype(int)
else:
seed(0)
shift_data = op_data[:1, :].reshape(-1)[:problem_size]
permu_data = permutation(problem_size)
z = solution - shift_data
idx1 = permu_data[:m_group]
idx2 = permu_data[m_group:]
z_rosenbrock = z[idx1]
z_sphere = z[idx2]
return f6_rosenbrock__(z_rosenbrock) * 10 ** 6 + f1_sphere__(z_sphere)
def F9(solution=None, name="D/2m-group Shifted and m-rotated Elliptic Function", shift_data_file="f09_op.txt", matrix_data_file="f09_m.txt", m_group=50):
problem_size = len(solution)
epoch = int(problem_size / (2 * m_group))
check_problem_size(problem_size)
check_m_group("F9", problem_size, 2*m_group)
matrix = load_matrix_data__(matrix_data_file)
op_data = load_matrix_data__(shift_data_file)
if problem_size == 1000:
shift_data = op_data[:1, :].reshape(-1)
permu_data = (op_data[1:, :].reshape(-1) - ones(problem_size)).astype(int)
else:
seed(0)
shift_data = op_data[:1, :].reshape(-1)[:problem_size]
permu_data = permutation(problem_size)
z = solution - shift_data
result = 0.0
for i in range(0, epoch):
idx1 = permu_data[i*m_group:(i+1)*m_group]
z1 = dot(z[idx1], matrix[:len(idx1), :len(idx1)])
result += f2_elliptic__(z1)
idx2 = permu_data[int(problem_size/2):problem_size]
z2 = z[idx2]
result += f2_elliptic__(z2)
return result
def F10(solution=None, name="D/2m-group Shifted and m-rotated Rastrigin’s Function", shift_data_file="f10_op.txt", matrix_data_file="f10_m.txt", m_group=50):
problem_size = len(solution)
epoch = int(problem_size / (2 * m_group))
check_problem_size(problem_size)
check_m_group("F10", problem_size, 2*m_group)
matrix = load_matrix_data__(matrix_data_file)
op_data = load_matrix_data__(shift_data_file)
if problem_size == 1000:
shift_data = op_data[:1, :].reshape(-1)
permu_data = (op_data[1:, :].reshape(-1) - ones(problem_size)).astype(int)
else:
seed(0)
shift_data = op_data[:1, :].reshape(-1)[:problem_size]
permu_data = permutation(problem_size)
z = solution - shift_data
result = 0.0
for i in range(0, epoch):
idx1 = permu_data[i * m_group:(i + 1) * m_group]
z1 = dot(z[idx1], matrix[:len(idx1), :len(idx1)])
result += f3_rastrigin__(z1)
idx2 = permu_data[int(problem_size / 2):problem_size]
z2 = z[idx2]
result += f3_rastrigin__(z2)
return result
def F11(solution=None, name="D/2m-group Shifted and m-rotated Ackley’s Function", shift_data_file="f11_op.txt", matrix_data_file="f11_m.txt", m_group=50):
problem_size = len(solution)
epoch = int(problem_size / (2 * m_group))
check_problem_size(problem_size)
check_m_group("F11", problem_size, 2*m_group)
matrix = load_matrix_data__(matrix_data_file)
op_data = load_matrix_data__(shift_data_file)
if problem_size == 1000:
shift_data = op_data[:1, :].reshape(-1)
permu_data = (op_data[1:, :].reshape(-1) - ones(problem_size)).astype(int)
else:
seed(0)
shift_data = op_data[:1, :].reshape(-1)[:problem_size]
permu_data = permutation(problem_size)
z = solution - shift_data
result = 0.0
for i in range(0, epoch):
idx1 = permu_data[i * m_group:(i + 1) * m_group]
z1 = dot(z[idx1], matrix[:len(idx1), :len(idx1)])
result += f4_ackley__(z1)
idx2 = permu_data[int(problem_size / 2):problem_size]
z2 = z[idx2]
result += f4_ackley__(z2)
return result
def F12(solution=None, name="D/2m-group Shifted m-dimensional Schwefel’s Problem 1.2", shift_data_file="f12_op.txt", m_group=50):
problem_size = len(solution)
epoch = int(problem_size / (2 * m_group))
check_problem_size(problem_size)
check_m_group("F12", problem_size, 2*m_group)
op_data = load_matrix_data__(shift_data_file)
if problem_size == 1000:
shift_data = op_data[:1, :].reshape(-1)
permu_data = (op_data[1:, :].reshape(-1) - ones(problem_size)).astype(int)
else:
seed(0)
shift_data = op_data[:1, :].reshape(-1)[:problem_size]
permu_data = permutation(problem_size)
z = solution - shift_data
result = 0.0
for i in range(0, epoch):
idx1 = permu_data[i * m_group:(i + 1) * m_group]
result += f5_schwefel__(z[idx1])
idx2 = permu_data[int(problem_size / 2):problem_size]
result += f1_sphere__(z[idx2])
return result
def F13(solution=None, name="D/2m-group Shifted m-dimensional Rosenbrock’s Function", shift_data_file="f13_op.txt", m_group=50):
problem_size = len(solution)
epoch = int(problem_size / (2 * m_group))
check_problem_size(problem_size)
check_m_group("F13", problem_size, 2*m_group)
op_data = load_matrix_data__(shift_data_file)
if problem_size == 1000:
shift_data = op_data[:1, :].reshape(-1)
permu_data = (op_data[1:, :].reshape(-1) - ones(problem_size)).astype(int)
else:
seed(0)
shift_data = op_data[:1, :].reshape(-1)[:problem_size]
permu_data = permutation(problem_size)
z = solution - shift_data
result = 0.0
for i in range(0, epoch):
idx1 = permu_data[i * m_group:(i + 1) * m_group]
result += f6_rosenbrock__(z[idx1])
idx2 = permu_data[int(problem_size / 2):problem_size]
result += f1_sphere__(z[idx2])
return result
def F14(solution=None, name="D/2m-group Shifted and m-rotated Elliptic Function", shift_data_file="f14_op.txt", matrix_data_file="f14_m.txt", m_group=50):
problem_size = len(solution)
epoch = int(problem_size / m_group)
check_problem_size(problem_size)
check_m_group("F14", problem_size, m_group)
matrix = load_matrix_data__(matrix_data_file)
op_data = load_matrix_data__(shift_data_file)
if problem_size == 1000:
shift_data = op_data[:1, :].reshape(-1)
permu_data = (op_data[1:, :].reshape(-1) - ones(problem_size)).astype(int)
else:
seed(0)
shift_data = op_data[:1, :].reshape(-1)[:problem_size]
permu_data = permutation(problem_size)
z = solution - shift_data
result = 0.0
for i in range(0, epoch):
idx1 = permu_data[i * m_group:(i + 1) * m_group]
result += f2_elliptic__(dot(z[idx1], matrix))
return result
def F15(solution=None, name="D/2m-group Shifted and m-rotated Rastrigin’s Function", shift_data_file="f15_op.txt", matrix_data_file="f15_m.txt", m_group=50):
problem_size = len(solution)
epoch = int(problem_size / m_group)
check_problem_size(problem_size)
check_m_group("F15", problem_size, m_group)
matrix = load_matrix_data__(matrix_data_file)
op_data = load_matrix_data__(shift_data_file)
if problem_size == 1000:
shift_data = op_data[:1, :].reshape(-1)
permu_data = (op_data[1:, :].reshape(-1) - ones(problem_size)).astype(int)
else:
seed(0)
shift_data = op_data[:1, :].reshape(-1)[:problem_size]
permu_data = permutation(problem_size)
z = solution - shift_data
result = 0.0
for i in range(0, epoch):
idx1 = permu_data[i * m_group:(i + 1) * m_group]
result += f3_rastrigin__(dot(z[idx1], matrix))
return result
def F16(solution=None, name="D/2m-group Shifted and m-rotated Ackley’s Function", shift_data_file="f16_op.txt", matrix_data_file="f16_m.txt", m_group=50):
problem_size = len(solution)
epoch = int(problem_size / m_group)
check_problem_size(problem_size)
check_m_group("F16", problem_size, m_group)
matrix = load_matrix_data__(matrix_data_file)
op_data = load_matrix_data__(shift_data_file)
if problem_size == 1000:
shift_data = op_data[:1, :].reshape(-1)
permu_data = (op_data[1:, :].reshape(-1) - ones(problem_size)).astype(int)
else:
seed(0)
shift_data = op_data[:1, :].reshape(-1)[:problem_size]
permu_data = permutation(problem_size)
z = solution - shift_data
result = 0.0
for i in range(0, epoch):
idx1 = permu_data[i * m_group:(i + 1) * m_group]
result += f4_ackley__(dot(z[idx1], matrix))
return result
def F17(solution=None, name="D/2m-group Shifted m-dimensional Schwefel’s Problem 1.2", shift_data_file="f17_op.txt", m_group=50):
problem_size = len(solution)
epoch = int(problem_size / m_group)
check_problem_size(problem_size)
check_m_group("F17", problem_size, m_group)
op_data = load_matrix_data__(shift_data_file)
if problem_size == 1000:
shift_data = op_data[:1, :].reshape(-1)
permu_data = (op_data[1:, :].reshape(-1) - ones(problem_size)).astype(int)
else:
seed(0)
shift_data = op_data[:1, :].reshape(-1)[:problem_size]
permu_data = permutation(problem_size)
z = solution - shift_data
result = 0.0
for i in range(0, epoch):
idx1 = permu_data[i * m_group:(i + 1) * m_group]
result += f5_schwefel__(z[idx1])
return result
def F18(solution=None, name="D/2m-group Shifted m-dimensional Rosenbrock’s Function", shift_data_file="f18_op.txt", m_group=50):
problem_size = len(solution)
epoch = int(problem_size / m_group)
check_problem_size(problem_size)
check_m_group("F18", problem_size, m_group)
op_data = load_matrix_data__(shift_data_file)
if problem_size == 1000:
shift_data = op_data[:1, :].reshape(-1)
permu_data = (op_data[1:, :].reshape(-1) - ones(problem_size)).astype(int)
else:
seed(0)
shift_data = op_data[:1, :].reshape(-1)[:problem_size]
permu_data = | permutation(problem_size) | numpy.random.permutation |
import unittest
from hypothesis import given
import numpy as np
import scipy
from meta_analysis import Maps
from globals_test import random_permitted_case_3D, random_permitted_case_1D, empty_maps, random_maps, gray_mask, template, atlas, affine, fmri_img
class ToArrayTestCase(unittest.TestCase):
def setUp(self):
self.array2D = np.random.rand(2, 2)
self.array4D = np.random.rand(3, 3, 3, 1)
self.array4D_2 = np.random.rand(3, 3, 3, 2)
self.array3D = np.random.rand(3, 3, 3)
def test_array_2D(self):
maps = Maps(self.array2D, Ni=2, Nj=1, Nk=1)
self.assertTrue(np.array_equal(maps.to_array(), self.array2D.reshape((2, 1, 1, 2))))
def test_array_2D_one(self):
maps = Maps(self.array2D, Ni=2, Nj=1, Nk=1)
self.assertTrue(np.array_equal(maps.to_array(0), self.array2D.reshape((2, 1, 1, 2))[:, :, :, 0]))
self.assertTrue(np.array_equal(maps.to_array(1), self.array2D.reshape((2, 1, 1, 2))[:, :, :, 1]))
def test_array_3D(self):
maps = Maps(self.array3D)
self.assertTrue(np.array_equal(maps.to_array(), self.array3D))
def test_array_4D(self):
maps = Maps(self.array4D)
self.assertTrue(np.array_equal(maps.to_array(), self.array4D[:, :, :, 0]))
def test_array_4D_one(self):
maps = Maps(self.array4D)
self.assertTrue(np.array_equal(maps.to_array(0), self.array4D[:, :, :, 0]))
def test_array_4D_2_all(self):
maps = Maps(self.array4D_2)
self.assertTrue(np.array_equal(maps.to_array(), self.array4D_2))
def test_array_4D_2_one(self):
maps = Maps(self.array4D_2)
self.assertTrue(np.array_equal(maps.to_array(0), self.array4D_2[:, :, :, 0]))
class ToImgTestCase(unittest.TestCase):
def setUp(self):
self.array2D = np.random.rand(2, 2)
self.array4D = np.random.rand(3, 3, 3, 1)
self.array4D_2 = np.random.rand(3, 3, 3, 2)
self.array3D = np.random.rand(3, 3, 3)
self.affine = | np.eye(4) | numpy.eye |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This file is part of pyunicorn.
# Copyright (C) 2008--2019 <NAME> and pyunicorn authors
# URL: <http://www.pik-potsdam.de/members/donges/software>
# License: BSD (3-clause)
#
# Please acknowledge and cite the use of this software and its authors
# when results are used in publications or published elsewhere.
#
# You can use the following reference:
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
# and <NAME>, "Unified functional network and nonlinear time series analysis
# for complex systems science: The pyunicorn package"
"""
Provides classes for analyzing spatially embedded complex networks, handling
multivariate data and generating time series surrogates.
Written by <NAME>.
CMSI Method Reference: [Pompe2011]_
"""
# array object and fast numerics
import numpy
#
# Define class CouplingAnalysisPurePython
#
class CouplingAnalysisPurePython:
"""
Contains methods to calculate coupling matrices from large arrays
of scalar time series.
Comprises linear and information theoretic measures, lagged
and directed (causal) couplings.
"""
#
# Definitions of internal methods
#
def __init__(self, dataarray, only_tri=False, silence_level=0):
"""
Initialize an instance of CouplingAnalysisPurePython.
Possible choices for only_tri:
- "True" will calculate only the upper triangle of the coupling
matrix, excluding the diagonal, assuming symmetry (not for directed
measures)
- "False" will calculate the whole matrix (asymmetry somes from
different integration ranges)
:type dataarray: 4D, 3D or 2D Numpy array [time, index, index] or
[time, index]
:arg dataarray: The time series array with time in first dimension
:arg bool only_tri: Symmetric/asymmetric assumption on coupling matrix.
:arg int silence_level: The inverse level of verbosity of the object.
"""
# only_tri will calculate the upper triangle excluding the diagonal
# only. This assumes stationarity on the time series
self.only_tri = only_tri
# Set silence level
self.silence_level = silence_level
# Flatten observable anomaly array along lon/lat dimension to allow
# for more convinient indexing and transpose the whole array as this
# is faster in loops
if numpy.ndim(dataarray) == 4:
(self.total_time, n_lev, n_lat, n_lon) = dataarray.shape
self.N = n_lev * n_lat * n_lon
self.dataarray = numpy.\
fastCopyAndTranspose(dataarray.reshape(-1, self.N))
if numpy.ndim(dataarray) == 3:
(self.total_time, n_lat, n_lon) = dataarray.shape
self.N = n_lat * n_lon
self.dataarray = numpy.\
fastCopyAndTranspose(dataarray.reshape(-1, self.N))
elif numpy.ndim(dataarray) == 2:
(self.total_time, self.N) = dataarray.shape
self.dataarray = numpy.fastCopyAndTranspose(dataarray)
else:
print("irregular array shape...")
self.dataarray = numpy.fastCopyAndTranspose(dataarray)
# factorials below 10 in a list for permutation patterns
self.factorial = \
numpy.array([1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880])
self.patternized = False
self.has_fft = False
self.originalFFT = None
# lag_mode dict
self.lag_modi = {"all": 0, "sum": 1, "max": 2}
def __str__(self):
"""
Return a string representation of the CouplingAnalysisPurePython
object.
"""
shape = self.dataarray.shape
return 'CouplingAnalysisPurePython: %i variables, %i timesteps.' % (
shape[0], shape[1])
#
# Define methods to calculate correlation strength and lags
#
#
# Routines for calculating Cross Correlation
#
def cross_correlation(self, tau_max=0, lag_mode='all'):
"""
Returns the normalized cross correlation from all pairs of nodes from
a range of time lags.
The calculation ranges are shown below::
(-------------------------total_time--------------------------)
(---tau_max---)(---------corr_range------------)(---tau_max---)
CC is calculated about corr_range and with the other time series
shifted by tau
Possible choices for lag_mode:
- "all" will return the full function for all lags, possible large
memory need if only_tri is True, only the upper triangle contains the
values, the lower one is zeros
- "sum" will return the sum over positive and negative lags seperatly,
each inclunding tau=0 corrmat[0] is the positive sum, corrmat[1] the
negative sum
- "max" will return only the maximum coupling (in corrmat[0]) and its
lag (in corrmat[1])
:arg int tau_max: maximum lag in both directions, including last lag
:arg str lag_mode: the output mode
:rtype: 3D numpy array (float) [index, index, index]
:return: correlation matrix with different lag_mode choices
"""
# Normalize anomaly time series to zero mean and unit variance for all
# lags, array contains normalizations for all lags
corr_range = self.total_time - 2*tau_max
normalized_array = numpy.empty((2*tau_max + 1, self.N, corr_range),
dtype="float32")
for t in range(2*tau_max + 1):
# Remove mean value from time series at each vertex (grid point)
normalized_array[t] = self.dataarray[:, t:t+corr_range] - \
self.dataarray[:, t:t+corr_range].\
mean(axis=1).reshape(self.N, 1)
# Normalize the variance of anomalies to one
normalized_array[t] /= normalized_array[t].\
std(axis=1).reshape(self.N, 1)
# Correct for grid points with zero variance in their time series
normalized_array[t][numpy.isnan(normalized_array[t])] = 0
return self._calculate_cc(normalized_array, corr_range=corr_range,
tau_max=tau_max, lag_mode=lag_mode)
def shuffled_surrogate_for_cc(self, fourier=False, tau_max=1,
lag_mode='all'):
"""
Returns a correlation matrix calculated with an independently shuffled
surrogate of the dataarray of length corr_range for all taus.
:arg int corr_range: length of sample
:arg int tau_max: maximum lag in both directions, including last lag
:arg str lag_mode: output mode
:rtype: 3D numpy array (float) [index, index, index]
:return: correlation matrix with different lag_mode choices
"""
corr_range = self.total_time - 2*tau_max
# Shuffle a copy of dataarray separatly for each node
array = numpy.copy(self.dataarray)
if fourier:
array = self.correlatedNoiseSurrogates(array)
else:
for i in range(self.N):
numpy.random.shuffle(array[i])
sample_array = numpy.zeros((1, self.N, corr_range), dtype="float32")
sample_array[0] = array[:, :corr_range]
sample_array[0] -= sample_array[0].mean(axis=1).reshape(self.N, 1)
sample_array[0] /= sample_array[0].std(axis=1).reshape(self.N, 1)
sample_array[0, numpy.isnan(sample_array[0])] = 0
res = self._calculate_cc(sample_array, corr_range=corr_range,
tau_max=0, lag_mode='all')
if lag_mode == 'all':
corrmat = numpy.repeat(res, 2*tau_max + 1, axis=0)
elif lag_mode == 'sum':
corrmat = numpy.array([abs(res[0]), abs(res[0])]) * (tau_max+1.)
elif lag_mode == 'max':
corrmat = numpy.array([abs(res[0]),
numpy.random.randint(-tau_max, tau_max+1,
(self.N, self.N))])
return corrmat
def time_surrogate_for_cc(self, sample_range=100, tau_max=1,
lag_mode='all'):
"""
Returns a joint shuffled surrogate of the full dataarray of length
sample_range for all taus.
Used for time evolution analysis. First one initializes the
CouplingAnalysis class with the full dataarray and then this function
is called for every single surrogate.
:arg int sample_range: length of sample
:arg int tau_max: maximum lag in both directions, including last lag
:arg str lag_mode: output mode
:rtype: 3D numpy array (float) [index, index, index]
:return: correlation matrix with different lag_mode choices
"""
perm = numpy.random.permutation(
range(tau_max, self.total_time - tau_max))[:sample_range]
sample_array = numpy.empty((2*tau_max + 1, self.N, sample_range),
dtype="float32")
for t in range(2 * tau_max + 1):
tau = t - tau_max
sample_array[t] = self.dataarray[:, perm + tau]
sample_array[t] -= sample_array[t].mean(axis=1).reshape(self.N, 1)
sample_array[t] /= sample_array[t].std(axis=1).reshape(self.N, 1)
sample_array[t][numpy.isnan(sample_array[t])] = 0
return self._calculate_cc(sample_array, corr_range=sample_range,
tau_max=tau_max, lag_mode=lag_mode)
def _calculate_cc(self, array, corr_range, tau_max, lag_mode):
"""
Returns the CC matrix.
:arg int tau_max: maximum lag in both directions, including last lag
:arg str lag_mode: output mode
:rtype: 3D numpy array (float) [index, index, index]
:return: correlation matrix with different lag_mode choices
## lag_mode dict
mode = self.lag_modi[lag_mode]
"""
# lag_mode dict
mode = self.lag_modi[lag_mode]
only_tri = int(self.only_tri)
if lag_mode == 'all':
corrmat = numpy.zeros((2*tau_max + 1, self.N, self.N),
dtype='float32')
elif lag_mode == 'sum':
corrmat = numpy.zeros((2, self.N, self.N), dtype='float32')
elif lag_mode == 'max':
corrmat = numpy.zeros((2, self.N, self.N), dtype='float32')
# loop over all node pairs, NOT symmetric due to time shifts!
for i in range(self.N-only_tri):
for j in range((i+1)*only_tri, self.N):
if mode == 2:
maxcross = 0.0
argmax = 0
# loop over taus INCLUDING the last tau value
for t in range(2*tau_max+1):
# here the actual cross correlation is calculated
crossij = (array[tau_max, i, :] * array[t, j, :]).mean()
# fill in values in matrix depending on lag_mode
if mode == 0:
corrmat[t, i, j] = crossij
elif mode == 1:
if t <= tau_max:
corrmat[1, i, j] += numpy.abs(crossij)
if t >= tau_max:
corrmat[0, i, j] += numpy.abs(crossij)
elif mode == 2:
# calculate max and argmax by comparing to previous
# value and storing max
if numpy.abs(crossij) > maxcross:
maxcross = numpy.abs(crossij)
argmax = t
if mode == 2:
corrmat[0, i, j] = maxcross
corrmat[1, i, j] = argmax - tau_max
if self.only_tri:
if lag_mode == 'all':
corrmat = corrmat + corrmat.transpose(0, 2, 1)[::-1]
elif lag_mode == 'sum':
corrmat[0] += corrmat[1].transpose()
corrmat[1] = corrmat[0].transpose()
elif lag_mode == 'max':
corrmat[0] += corrmat[0].transpose()
corrmat[1] -= corrmat[1].transpose()
return corrmat
#
# Routines for calculating Mutual Information with adaptive bins
#
def mutual_information(self, bins=16, tau_max=0, lag_mode='all'):
"""
Returns the normalized mutual information from all pairs of nodes from
a range of time lags.
MI = H_x + H_y - H_xy
Uses adaptive bins, where each marginal bin contains the same number of
samples. Then the marginal entropies have equal probable distributions
H_x = H_y = log(bins)
The calculation ranges are shown below::
(-------------------------total_time--------------------------)
(---tau_max---)(---------corr_range------------)(---tau_max---)
MI is calculated about corr_range and with the other time series
shifted by tau
Possible choices for lag_mode:
- "all" will return the full function for all lags, possible large
memory need if only_tri is True, only the upper triangle contains the
values, the lower one is zeros
- "sum" will return the sum over positive and negative lags seperatly,
each inclunding tau=0 corrmat[0] is the positive sum, corrmat[1] the
negative sum
- "max" will return only the maximum coupling (in corrmat[0]) and its
lag (in corrmat[1])
:arg int bins: number of bins for estimating MI
:arg int tau_max: maximum lag in both directions, including last lag
:arg str lag_mode: output mode
:rtype: 3D numpy array (float) [index, index, index]
:return: correlation matrix with different lag_mode choices
"""
if bins < 255:
dtype = 'uint8'
else:
dtype = 'int16'
# Normalize anomaly time series to zero mean and unit variance for all
# lags, array contains normalizations for all lags
corr_range = self.total_time - 2*tau_max
# get the bin quantile steps
bin_edge = numpy.ceil(corr_range/float(bins))
symbolic_array = numpy.empty((2*tau_max + 1, self.N, corr_range),
dtype=dtype)
for t in range(2*tau_max + 1):
array = self.dataarray[:, t:t+corr_range]
# get the lower edges of the bins for every time series
edges = numpy.sort(array, axis=1)[:, ::bin_edge]
bins = edges.shape[1]
# This gives the symbolic time series
symbolic_array[t] = \
(array.reshape(self.N, corr_range, 1)
>= edges.reshape(self.N, 1, bins)).sum(axis=2) - 1
return self._calculate_mi(symbolic_array, corr_range=corr_range,
bins=bins, tau_max=tau_max,
lag_mode=lag_mode)
def mutual_information_edges(self, bins=16, tau=0, lag_mode='all'):
"""
Returns the normalized mutual information from all pairs of nodes from
a range of time lags.
MI = H_x + H_y - H_xy
Uses adaptive bins, where each marginal bin contains the same number of
samples. Then the marginal entropies have equal probable distributions
H_x = H_y = log(bins)
The calculation ranges are shown below::
(-------------------------total_time--------------------------)
(---tau_max---)(---------corr_range------------)(---tau_max---)
MI is calculated about corr_range and with the other time series
shifted by tau
Possible choices for lag_mode:
- "all" will return the full function for all lags, possible large
memory need if only_tri is True, only the upper triangle contains the
values, the lower one is zeros
- "sum" will return the sum over positive and negative lags seperatly,
each inclunding tau=0 corrmat[0] is the positive sum, corrmat[1] the
negative sum
- "max" will return only the maximum coupling (in corrmat[0]) and its
lag (in corrmat[1])
:arg int bins: number of bins for estimating MI
:arg int tau_max: maximum lag in both directions, including last lag
:arg str lag_mode: output mode
:rtype: 2D numpy array (float) [index, index]
:return: bin edges for zero lag
"""
# get the bin quantile steps
bin_edge = numpy.ceil(self.total_time/float(bins))
array = self.dataarray[:, :]
array[:-tau, 1] = array[tau, 1]
# get the lower edges of the bins for every time series
edges = numpy.sort(array, axis=1)[:, ::bin_edge]
bins = edges.shape[1]
return edges
def shuffled_surrogate_for_mi(self, fourier=False, bins=16, tau_max=0,
lag_mode='all'):
"""
Returns a shuffled surrogate of normalized mutual information from all
pairs of nodes from a range of time lags.
:arg int bins: number of bins for estimating MI
:arg int tau_max: maximum lag in both directions, including last lag
:arg str lag_mode: output mode
:rtype: 3D numpy array (float) [index, index, index]
:return: correlation matrix with different lag_mode choices
"""
if bins < 255:
dtype = 'uint8'
else:
dtype = 'int16'
# Normalize anomaly time series to zero mean and unit variance for all
# lags, array contains normalizations for all lags
corr_range = self.total_time - 2*tau_max
# Shuffle a copy of dataarray seperatly for each node
array = numpy.copy(self.dataarray)
if fourier:
array = self.correlatedNoiseSurrogates(array)
else:
for i in range(self.N):
numpy.random.shuffle(array[i])
# get the bin quantile steps
bin_edge = numpy.ceil(corr_range/float(bins))
symbolic_array = numpy.empty((1, self.N, corr_range), dtype=dtype)
array = array[:, :corr_range]
# get the lower edges of the bins for every time series
edges = numpy.sort(array, axis=1)[:, ::bin_edge]
bins = edges.shape[1]
# This gives the symbolic time series
symbolic_array[0] = \
(array.reshape(self.N, corr_range, 1)
>= edges.reshape(self.N, 1, bins)).sum(axis=2) - 1
res = self._calculate_mi(symbolic_array, corr_range=corr_range,
bins=bins, tau_max=0, lag_mode='all')
if lag_mode == 'all':
corrmat = | numpy.repeat(res, 2*tau_max + 1, axis=0) | numpy.repeat |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import random
from typing import Any
from .utils import BasicBrain
class PERD3QNAgent(BasicBrain):
""" Prioritized Experience Replay Dueling Double Deep Q Network
Parameters:
-----------
input_dim : int, default 153
The input dimension
output_dim : int, default 8
The output dimension
exploration : int, default 1000
The number of epochs to explore the environment before learning
soft_update_freq : int, default 200
The frequency at which to align the target and eval nets
train_freq : int, default 20
The frequency at which to train the agent
learning_rate : float, default 1e-3
Learning rate
batch_size : int
The number of training samples to work through before the model's internal parameters are updated.
gamma : float, default 0.98
Discount factor. How far out should rewards in the future influence the policy?
capacity : int, default 10_000
Capacity of replay buffer
load_model : str, default False
Path to an existing model
training : bool, default True,
Whether to continue training or not
"""
def __init__(self, input_dim=153, output_dim=8, exploration=1000, soft_update_freq=200, train_freq=20,
learning_rate=1e-3, batch_size=64, capacity=10000, gamma=0.99, load_model=False, training=True):
super().__init__(input_dim, output_dim, "PERD3QN")
self.target_net = DuelingDDQN(input_dim, output_dim)
self.eval_net = DuelingDDQN(input_dim, output_dim)
self.eval_net.load_state_dict(self.target_net.state_dict())
self.optimizer = torch.optim.Adam(self.eval_net.parameters(), lr=learning_rate)
self.buffer = PrioritizedReplayBuffer(capacity)
self.loss_fn = nn.MSELoss()
self.exploration = exploration
self.soft_update_freq = soft_update_freq
self.train_freq = train_freq
self.batch_size = batch_size
self.gamma = gamma
self.n_epi = 0
self.epsilon = 0.9
self.epsilon_min = 0.05
self.decay = 0.99
self.training = training
if not self.training:
self.epsilon = 0
if load_model:
self.eval_net.load_state_dict(torch.load(load_model))
self.eval_net.eval()
if self.training:
self.target_net.load_state_dict(torch.load(load_model))
self.target_net.eval()
self.optimizer = torch.optim.Adam(self.eval_net.parameters(), lr=learning_rate)
def get_action(self, state, n_epi):
if self.training:
if n_epi > self.n_epi:
if self.epsilon > self.epsilon_min:
self.epsilon = self.epsilon * self.decay
self.n_epi = n_epi
action = self.eval_net.act(torch.FloatTensor(np.expand_dims(state, 0)), self.epsilon)
return action
def memorize(self, obs, action, reward, next_obs, done):
self.buffer.store(obs, action, reward, next_obs, done)
def train(self):
observation, action, reward, next_observation, done, indices, weights = self.buffer.sample(self.batch_size)
observation = torch.FloatTensor(observation)
action = torch.LongTensor(action)
reward = torch.FloatTensor(reward)
next_observation = torch.FloatTensor(next_observation)
done = torch.FloatTensor(done)
q_values = self.eval_net.forward(observation)
next_q_values = self.target_net.forward(next_observation)
next_q_value = next_q_values.max(1)[0].detach()
q_value = q_values.gather(1, action.unsqueeze(1)).squeeze(1)
expected_q_value = reward + self.gamma * (1 - done) * next_q_value
loss = self.loss_fn(q_value, expected_q_value)
priorities = torch.abs(next_q_value - q_value).detach().numpy()
self.buffer.update_priorities(indices, priorities)
self.optimizer.zero_grad()
loss.backward()
self.optimizer.step()
def learn(self, age, dead, action, state, reward, state_prime, done, n_epi):
self.memorize(state, action, reward, state_prime, done)
if n_epi > self.exploration:
if age % self.train_freq == 0 or dead:
self.train()
if n_epi % self.soft_update_freq == 0:
self.target_net.load_state_dict(self.eval_net.state_dict())
def apply_gaussian_noise(self):
with torch.no_grad():
self.target_net.fc.weight.add_(torch.randn(self.target_net.fc.weight.size()))
self.target_net.load_state_dict(self.eval_net.state_dict())
class PrioritizedReplayBuffer(object):
def __init__(self, capacity, alpha=.6, beta=.4, beta_increment=1000):
self.capacity = capacity
self.alpha = alpha
self.beta = beta
self.beta_increment = beta_increment
self.pos = 0
self.memory = []
self.priorities = np.zeros([self.capacity], dtype=np.float32)
def store(self, observation, action, reward, next_observation, done):
observation = np.expand_dims(observation, 0)
next_observation = np.expand_dims(next_observation, 0)
max_prior = np.max(self.priorities) if self.memory else 1.0
if len(self.memory) < self.capacity:
self.memory.append([observation, action, reward, next_observation, done])
else:
self.memory[self.pos] = [observation, action, reward, next_observation, done]
self.priorities[self.pos] = max_prior
self.pos += 1
self.pos = self.pos % self.capacity
def sample(self, batch_size):
if len(self.memory) < self.capacity:
probs = self.priorities[: len(self.memory)]
else:
probs = self.priorities
probs = probs ** self.alpha
probs = probs / np.sum(probs)
indices = np.random.choice(len(self.memory), batch_size, p=probs)
samples = [self.memory[idx] for idx in indices]
weights = (len(self.memory) * probs[indices]) ** (- self.beta)
if self.beta < 1:
self.beta += self.beta_increment
weights = weights / np.max(weights)
weights = np.array(weights, dtype=np.float32)
observation, action, reward, next_observation, done = zip(* samples)
return np.concatenate(observation, 0), action, reward, | np.concatenate(next_observation, 0) | numpy.concatenate |
import torch
import numpy as np
import torch.nn.functional as F
from torch_geometric.data import Data, DataLoader
import matplotlib.pyplot as plt
from utilities import *
from nn_conv import NNConv_old
from timeit import default_timer
class KernelNN(torch.nn.Module):
def __init__(self, width, ker_width, depth, ker_in, in_width=1, out_width=1):
super(KernelNN, self).__init__()
self.depth = depth
self.fc1 = torch.nn.Linear(in_width, width)
kernel = DenseNet([ker_in, ker_width, ker_width, width**2], torch.nn.ReLU)
self.conv1 = NNConv_old(width, width, kernel, aggr='mean')
self.fc2 = torch.nn.Linear(width, 1)
def forward(self, data):
x, edge_index, edge_attr = data.x, data.edge_index, data.edge_attr
x = self.fc1(x)
for k in range(self.depth):
x = F.relu(self.conv1(x, edge_index, edge_attr))
x = self.fc2(x)
return x
TRAIN_PATH = 'data/piececonst_r241_N1024_smooth1.mat'
TEST_PATH = 'data/piececonst_r241_N1024_smooth2.mat'
r = 4
s = int(((241 - 1)/r) + 1)
n = s**2
m = 100
k = 1
radius_train = 0.1
radius_test = 0.1
print('resolution', s)
ntrain = 100
ntest = 40
batch_size = 1
batch_size2 = 2
width = 64
ker_width = 1024
depth = 6
edge_features = 6
node_features = 6
epochs = 200
learning_rate = 0.0001
scheduler_step = 50
scheduler_gamma = 0.8
path = 'UAI1_r'+str(s)+'_n'+ str(ntrain)
path_model = 'model/'+path+''
path_train_err = 'results/'+path+'train.txt'
path_test_err = 'results/'+path+'test.txt'
path_image = 'image/'+path+''
path_train_err = 'results/'+path+'train'
path_test_err16 = 'results/'+path+'test16'
path_test_err31 = 'results/'+path+'test31'
path_test_err61 = 'results/'+path+'test61'
path_image_train = 'image/'+path+'train'
path_image_test16 = 'image/'+path+'test16'
path_image_test31 = 'image/'+path+'test31'
path_image_test61 = 'image/'+path+'test61'
t1 = default_timer()
reader = MatReader(TRAIN_PATH)
train_a = reader.read_field('coeff')[:ntrain,::r,::r].reshape(ntrain,-1)
train_a_smooth = reader.read_field('Kcoeff')[:ntrain,::r,::r].reshape(ntrain,-1)
train_a_gradx = reader.read_field('Kcoeff_x')[:ntrain,::r,::r].reshape(ntrain,-1)
train_a_grady = reader.read_field('Kcoeff_y')[:ntrain,::r,::r].reshape(ntrain,-1)
train_u = reader.read_field('sol')[:ntrain,::r,::r].reshape(ntrain,-1)
train_u64 = reader.read_field('sol')[:ntrain,::r,::r].reshape(ntrain,-1)
reader.load_file(TEST_PATH)
test_a = reader.read_field('coeff')[:ntest,::4,::4].reshape(ntest,-1)
test_a_smooth = reader.read_field('Kcoeff')[:ntest,::4,::4].reshape(ntest,-1)
test_a_gradx = reader.read_field('Kcoeff_x')[:ntest,::4,::4].reshape(ntest,-1)
test_a_grady = reader.read_field('Kcoeff_y')[:ntest,::4,::4].reshape(ntest,-1)
test_u = reader.read_field('sol')[:ntest,::4,::4].reshape(ntest,-1)
a_normalizer = GaussianNormalizer(train_a)
train_a = a_normalizer.encode(train_a)
test_a = a_normalizer.encode(test_a)
as_normalizer = GaussianNormalizer(train_a_smooth)
train_a_smooth = as_normalizer.encode(train_a_smooth)
test_a_smooth = as_normalizer.encode(test_a_smooth)
agx_normalizer = GaussianNormalizer(train_a_gradx)
train_a_gradx = agx_normalizer.encode(train_a_gradx)
test_a_gradx = agx_normalizer.encode(test_a_gradx)
agy_normalizer = GaussianNormalizer(train_a_grady)
train_a_grady = agy_normalizer.encode(train_a_grady)
test_a_grady = agy_normalizer.encode(test_a_grady)
test_a = test_a.reshape(ntest,61,61)
test_a_smooth = test_a_smooth.reshape(ntest,61,61)
test_a_gradx = test_a_gradx.reshape(ntest,61,61)
test_a_grady = test_a_grady.reshape(ntest,61,61)
test_u = test_u.reshape(ntest,61,61)
test_a16 =test_a[:ntest,::4,::4].reshape(ntest,-1)
test_a_smooth16 = test_a_smooth[:ntest,::4,::4].reshape(ntest,-1)
test_a_gradx16 = test_a_gradx[:ntest,::4,::4].reshape(ntest,-1)
test_a_grady16 = test_a_grady[:ntest,::4,::4].reshape(ntest,-1)
test_u16 = test_u[:ntest,::4,::4].reshape(ntest,-1)
test_a31 =test_a[:ntest,::2,::2].reshape(ntest,-1)
test_a_smooth31 = test_a_smooth[:ntest,::2,::2].reshape(ntest,-1)
test_a_gradx31 = test_a_gradx[:ntest,::2,::2].reshape(ntest,-1)
test_a_grady31 = test_a_grady[:ntest,::2,::2].reshape(ntest,-1)
test_u31 = test_u[:ntest,::2,::2].reshape(ntest,-1)
test_a =test_a.reshape(ntest,-1)
test_a_smooth = test_a_smooth.reshape(ntest,-1)
test_a_gradx = test_a_gradx.reshape(ntest,-1)
test_a_grady = test_a_grady.reshape(ntest,-1)
test_u = test_u.reshape(ntest,-1)
u_normalizer = GaussianNormalizer(train_u)
train_u = u_normalizer.encode(train_u)
# test_u = y_normalizer.encode(test_u)
meshgenerator = SquareMeshGenerator([[0,1],[0,1]],[s,s])
edge_index = meshgenerator.ball_connectivity(radius_train)
grid = meshgenerator.get_grid()
# meshgenerator.get_boundary()
# edge_index_boundary = meshgenerator.boundary_connectivity2d(stride = stride)
data_train = []
for j in range(ntrain):
edge_attr = meshgenerator.attributes(theta=train_a[j,:])
# edge_attr_boundary = meshgenerator.attributes_boundary(theta=train_u[j,:])
data_train.append(Data(x=torch.cat([grid, train_a[j,:].reshape(-1, 1),
train_a_smooth[j,:].reshape(-1, 1), train_a_gradx[j,:].reshape(-1, 1), train_a_grady[j,:].reshape(-1, 1)
], dim=1),
y=train_u[j,:], coeff=train_a[j,:],
edge_index=edge_index, edge_attr=edge_attr,
# edge_index_boundary=edge_index_boundary, edge_attr_boundary= edge_attr_boundary
))
print('train grid', grid.shape, 'edge_index', edge_index.shape, 'edge_attr', edge_attr.shape)
meshgenerator = SquareMeshGenerator([[0,1],[0,1]],[16,16])
edge_index = meshgenerator.ball_connectivity(radius_test)
grid = meshgenerator.get_grid()
# meshgenerator.get_boundary()
# edge_index_boundary = meshgenerator.boundary_connectivity2d(stride = stride)
data_test16 = []
for j in range(ntest):
edge_attr = meshgenerator.attributes(theta=test_a16[j,:])
# edge_attr_boundary = meshgenerator.attributes_boundary(theta=test_a[j, :])
data_test16.append(Data(x=torch.cat([grid, test_a16[j,:].reshape(-1, 1),
test_a_smooth16[j,:].reshape(-1, 1), test_a_gradx16[j,:].reshape(-1, 1), test_a_grady16[j,:].reshape(-1, 1)
], dim=1),
y=test_u16[j, :], coeff=test_a16[j,:],
edge_index=edge_index, edge_attr=edge_attr,
# edge_index_boundary=edge_index_boundary, edge_attr_boundary=edge_attr_boundary
))
print('16 grid', grid.shape, 'edge_index', edge_index.shape, 'edge_attr', edge_attr.shape)
# print('edge_index_boundary', edge_index_boundary.shape, 'edge_attr', edge_attr_boundary.shape)
meshgenerator = SquareMeshGenerator([[0,1],[0,1]],[31,31])
edge_index = meshgenerator.ball_connectivity(radius_test)
grid = meshgenerator.get_grid()
# meshgenerator.get_boundary()
# edge_index_boundary = meshgenerator.boundary_connectivity2d(stride = stride)
data_test31 = []
for j in range(ntest):
edge_attr = meshgenerator.attributes(theta=test_a31[j,:])
# edge_attr_boundary = meshgenerator.attributes_boundary(theta=test_a[j, :])
data_test31.append(Data(x=torch.cat([grid, test_a31[j,:].reshape(-1, 1),
test_a_smooth31[j,:].reshape(-1, 1), test_a_gradx31[j,:].reshape(-1, 1), test_a_grady31[j,:].reshape(-1, 1)
], dim=1),
y=test_u31[j, :], coeff=test_a31[j,:],
edge_index=edge_index, edge_attr=edge_attr,
# edge_index_boundary=edge_index_boundary, edge_attr_boundary=edge_attr_boundary
))
print('31 grid', grid.shape, 'edge_index', edge_index.shape, 'edge_attr', edge_attr.shape)
# print('edge_index_boundary', edge_index_boundary.shape, 'edge_attr', edge_attr_boundary.shape)
meshgenerator = SquareMeshGenerator([[0,1],[0,1]],[61,61])
edge_index = meshgenerator.ball_connectivity(radius_test)
grid = meshgenerator.get_grid()
# meshgenerator.get_boundary()
# edge_index_boundary = meshgenerator.boundary_connectivity2d(stride = stride)
data_test61 = []
for j in range(ntest):
edge_attr = meshgenerator.attributes(theta=test_a[j,:])
# edge_attr_boundary = meshgenerator.attributes_boundary(theta=test_a[j, :])
data_test61.append(Data(x=torch.cat([grid, test_a[j,:].reshape(-1, 1),
test_a_smooth[j,:].reshape(-1, 1), test_a_gradx[j,:].reshape(-1, 1), test_a_grady[j,:].reshape(-1, 1)
], dim=1),
y=test_u[j, :], coeff=test_a[j,:],
edge_index=edge_index, edge_attr=edge_attr,
# edge_index_boundary=edge_index_boundary, edge_attr_boundary=edge_attr_boundary
))
print('61 grid', grid.shape, 'edge_index', edge_index.shape, 'edge_attr', edge_attr.shape)
# print('edge_index_boundary', edge_index_boundary.shape, 'edge_attr', edge_attr_boundary.shape)
train_loader = DataLoader(data_train, batch_size=batch_size, shuffle=True)
test_loader16 = DataLoader(data_test16, batch_size=batch_size2, shuffle=False)
test_loader31 = DataLoader(data_test31, batch_size=batch_size2, shuffle=False)
test_loader61 = DataLoader(data_test61, batch_size=batch_size2, shuffle=False)
##################################################################################################
### training
##################################################################################################
t2 = default_timer()
print('preprocessing finished, time used:', t2-t1)
device = torch.device('cuda')
model = KernelNN(width,ker_width,depth,edge_features,node_features).cuda()
optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate, weight_decay=5e-4)
scheduler = torch.optim.lr_scheduler.StepLR(optimizer, step_size=scheduler_step, gamma=scheduler_gamma)
myloss = LpLoss(size_average=False)
u_normalizer.cuda()
model.train()
ttrain = np.zeros((epochs, ))
ttest16 = np.zeros((epochs,))
ttest31 = np.zeros((epochs,))
ttest61 = np.zeros((epochs,))
for ep in range(epochs):
t1 = default_timer()
train_mse = 0.0
train_l2 = 0.0
for batch in train_loader:
batch = batch.to(device)
optimizer.zero_grad()
out = model(batch)
mse = F.mse_loss(out.view(-1, 1), batch.y.view(-1,1))
# mse.backward()
loss = torch.norm(out.view(-1) - batch.y.view(-1),1)
loss.backward()
l2 = myloss(u_normalizer.decode(out.view(batch_size,-1)), u_normalizer.decode(batch.y.view(batch_size, -1)))
# l2.backward()
optimizer.step()
train_mse += mse.item()
train_l2 += l2.item()
scheduler.step()
t2 = default_timer()
model.eval()
ttrain[ep] = train_l2/(ntrain * k)
print(ep, ' time:', t2-t1, ' train_mse:', train_mse/len(train_loader))
t1 = default_timer()
u_normalizer.cpu()
model = model.cpu()
test_l2_16 = 0.0
test_l2_31 = 0.0
test_l2_61 = 0.0
with torch.no_grad():
for batch in test_loader16:
out = model(batch)
test_l2_16 += myloss(u_normalizer.decode(out.view(batch_size2,-1)),
batch.y.view(batch_size2, -1))
for batch in test_loader31:
out = model(batch)
test_l2_31 += myloss(u_normalizer.decode(out.view(batch_size2, -1)),
batch.y.view(batch_size2, -1))
for batch in test_loader61:
out = model(batch)
test_l2_61 += myloss(u_normalizer.decode(out.view(batch_size2, -1)),
batch.y.view(batch_size2, -1))
ttest16[ep] = test_l2_16 / ntest
ttest31[ep] = test_l2_31 / ntest
ttest61[ep] = test_l2_61 / ntest
t2 = default_timer()
print(' time:', t2-t1, ' train_mse:', train_mse/len(train_loader),
' test16:', test_l2_16/ntest, ' test31:', test_l2_31/ntest, ' test61:', test_l2_61/ntest)
np.savetxt(path_train_err + '.txt', ttrain)
np.savetxt(path_test_err16 + '.txt', ttest16)
np.savetxt(path_test_err31 + '.txt', ttest31)
np.savetxt(path_test_err61 + '.txt', ttest61)
torch.save(model, path_model)
##################################################################################################
### Ploting
##################################################################################################
resolution = s
data = train_loader.dataset[0]
coeff = data.coeff.numpy().reshape((resolution, resolution))
truth = u_normalizer.decode(data.y.reshape(1,-1)).numpy().reshape((resolution, resolution))
approx = u_normalizer.decode(model(data).reshape(1,-1)).detach().numpy().reshape((resolution, resolution))
_min = np.min(np.min(truth))
_max = np.max(np.max(truth))
plt.figure()
plt.subplot(1, 3, 1)
plt.imshow(truth, vmin = _min, vmax=_max)
plt.xticks([], [])
plt.yticks([], [])
plt.colorbar(fraction=0.046, pad=0.04)
plt.title('Ground Truth')
plt.subplot(1, 3, 2)
plt.imshow(approx, vmin = _min, vmax=_max)
plt.xticks([], [])
plt.yticks([], [])
plt.colorbar(fraction=0.046, pad=0.04)
plt.title('Approximation')
plt.subplot(1, 3, 3)
plt.imshow((approx - truth) ** 2)
plt.xticks([], [])
plt.yticks([], [])
plt.colorbar(fraction=0.046, pad=0.04)
plt.title('Error')
plt.subplots_adjust(wspace=0.5, hspace=0.5)
plt.savefig(path_image_train + '.png')
resolution = 16
data = test_loader16.dataset[0]
coeff = data.coeff.numpy().reshape((resolution, resolution))
truth = data.y.numpy().reshape((resolution, resolution))
approx = u_normalizer.decode(model(data).reshape(1,-1)).detach().numpy().reshape((resolution, resolution))
_min = np.min(np.min(truth))
_max = np.max(np.max(truth))
plt.figure()
plt.subplot(1, 3, 1)
plt.imshow(truth, vmin = _min, vmax=_max)
plt.xticks([], [])
plt.yticks([], [])
plt.colorbar(fraction=0.046, pad=0.04)
plt.title('Ground Truth')
plt.subplot(1, 3, 2)
plt.imshow(approx, vmin = _min, vmax=_max)
plt.xticks([], [])
plt.yticks([], [])
plt.colorbar(fraction=0.046, pad=0.04)
plt.title('Approximation')
plt.subplot(1, 3, 3)
plt.imshow((approx - truth) ** 2)
plt.xticks([], [])
plt.yticks([], [])
plt.colorbar(fraction=0.046, pad=0.04)
plt.title('Error')
plt.subplots_adjust(wspace=0.5, hspace=0.5)
plt.savefig(path_image_test16 + '.png')
resolution = 31
data = test_loader31.dataset[0]
coeff = data.coeff.numpy().reshape((resolution, resolution))
truth = data.y.numpy().reshape((resolution, resolution))
approx = u_normalizer.decode(model(data).reshape(1,-1)).detach().numpy().reshape((resolution, resolution))
_min = np.min( | np.min(truth) | numpy.min |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Module for node definition in grid.
"""
from copy import deepcopy
import uuid
import numpy as np
from catplot.grid_components import extract_plane
import catplot.descriptors as dc
class GridNode(object):
""" Abstract base class for other node.
Parameters:
-----------
coordinate: array_like, shape (n, )
The location of node in grid canvas.
color: str, optional, default is "#000000"
Facecolor of node.
size: scalar, optional
size in points^2, default is 400.
style: MarkerStyle, optional, default is 'o'.
alpha: scalar, optional, default is 1
The alpha blending value, between 0 (transparent) and 1 (opaque)
line_width: scalar or array_like, optional, default is 0.
edgecolor: str, optional, default is the color of face.
zorder: float, set the zorder for the artist, default is 0.
labeled: bool, if add a unique id to the node, default is True.
"""
# NOTE: The grid may contains a huge number of nodes,
# so we define __slots__ for saving memery.
#__slots__ = {"coordinate", "color", "size", "style", "alpha",
# "line_width", "line_style", "edgecolor", "zorder"}
def __init__(self, coordinate, **kwargs):
self.coordinate = | np.array(coordinate) | numpy.array |
import numpy as np
import jax.numpy as jnp
import tensorflow as tf
import torch
import pytest
import tsensor as ts
@pytest.mark.parametrize(
"value,expected",
[
# Numpy
( | np.random.randint(1, 10, size=(10, 2, 5)) | numpy.random.randint |
# utility.py
import numpy as np
import pandas as pd
import scipy.stats as stats
from scipy.stats import chi2
from sklearn.preprocessing import LabelEncoder
from sklearn.base import BaseEstimator, TransformerMixin
class DataFrameImputer(BaseEstimator, TransformerMixin):
def __init__(self):
"""Impute missing values
Columns of dtype object are imputed with the most frequent value in the column
Columns of other types are imputed with the mean of column
"""
pass
def fit(self, X, y=None):
self.fill = pd.Series([X[c].value_counts(). index[0]
if X[c].dtype == | np.dtype('O') | numpy.dtype |
""" Class for DLA Surveys
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import os
import imp, glob
import pdb
import warnings
try:
from urllib2 import urlopen # Python 2.7
except ImportError:
from urllib.request import urlopen
from pkg_resources import resource_filename
from astropy.table import Column, Table, vstack
from astropy import units as u
from astropy.stats import poisson_conf_interval as aspci
from astropy import constants as const
from astropy.cosmology import core as acc
from astropy.coordinates import SkyCoord, match_coordinates_sky
from linetools import utils as ltu
from pyigm.surveys.igmsurvey import IGMSurvey
from pyigm.surveys import utils as pyisu
from pyigm import utils as pyigmu
pyigm_path = imp.find_module('pyigm')[1]
lz_boot_file = resource_filename('pyigm', 'data/DLA/dla_lz_boot.fits.gz')
# Class for DLA Survey
class DLASurvey(IGMSurvey):
"""An DLA Survey class
Attributes:
"""
@classmethod
def load_HST16(cls, sample='stat'):
""" HST Survey by Neeleman+16
<NAME>. et al. 2016, ApJ, 818, 113
Parameters
----------
sample : str, optional
Returns
-------
dla_survey
"""
# Read DLAs
dat_file = resource_filename('pyigm', '/data/DLA/HST/HSTDLA.dat')
dlas = Table.read(dat_file, format='ascii')
# Read Quasars
#qsos = Table.read(pyigm_path + '/all_qso_table.txt', format='ascii')
# Read Sightlines
srvy_file = resource_filename('pyigm', '/data/DLA/HST/hstpath.dat')
survey = Table.read(srvy_file, format='ascii')
# Add info to DLA table
ras, decs, zems, scoords = [], [], [], []
for dla in dlas:
mt = np.where(survey['QSO'] == dla['NAME'])[0]
if len(mt) == 0:
pdb.set_trace()
raise ValueError("Uh oh")
else:
mt = mt[0]
# Generate RA/DEC
row = survey[mt]
scoords.append('{:02d}:{:02d}:{:f} {:s}{:02d}:{:02d}:{:f}'.format(
row['RAh'], row['RAm'], row['RAs'], row['DE-'], row['DEd'], row['DEm'],
row['DEs']))
#ras.append(coord.ra.value)
#decs.append(coord.dec.value)
# zem
zems.append(row['ZEM'])
#dlas['RA'] = ras
#dlas['DEC'] = decs
dlas['QSO_ZEM'] = zems
# Instantiate
coords = SkyCoord(scoords, unit=(u.hourangle, u.deg))
dla_survey = cls.from_sfits(dlas, coords)
dla_survey.ref = 'Neeleman+16'
# Fiddle a bit
survey.rename_column('STTMIN', 'Z_START')
survey.rename_column('STTMAX', 'Z_END')
stat = survey['Z_END'] > 0
stat_survey = survey[stat]
# Restrict to statistical sightlines
if sample == 'stat':
stat_survey = stat_survey[stat_survey['F_STT'] == 1]
ras, decs, zems = [], [], []
for row in stat_survey:
coord = ltu.radec_to_coord('J{:02d}{:02d}{:f}{:s}{:02d}{:02d}{:f}'.format(
row['RAh'], row['RAm'], row['RAs'], row['DE-'], row['DEd'], row['DEm'],
row['DEs']))
ras.append(coord.ra.value)
decs.append(coord.dec.value)
stat_survey['RA'] = ras
stat_survey['DEC'] = decs
stat_survey['FLG_BAL'] = 0
# Sightlines
dla_survey.sightlines = stat_survey
# Stat?
if sample in ['all', 'all_sys']:
return dla_survey
mask = dla_stat(dla_survey, stat_survey)
if sample == 'stat':
dla_survey.mask = mask & (dlas['STAT_FLG'] == 1)
else:
dla_survey.mask = ~mask
# Return
return dla_survey
@classmethod
def load_H100(cls, grab_spectra=False, build_abs_sys=True, isys_path=None):
""" Sample of unbiased HIRES DLAs compiled and analyzed by Neeleman+13
<NAME> al. 2013, ApJ, 769, 54
Parameters
----------
build_abs_sys : bool, optional
Build AbsSystem objects (~10s)
Required for a fair bit of other things, e.g. kin
isys_path : str, optional
Read system files from this path
grab_spectra : bool, optional
Grab 1D spectra? (141Mb)
deprecated.. Use igmspec
Return
------
dla_survey : DLASurvey
"""
# Pull from Internet (as necessary)
summ_fil = resource_filename('pyigm', "/data/DLA/H100/H100_DLA.fits")
print('H100: Loading summary file {:s}'.format(summ_fil))
# Ions
ions_fil = resource_filename('pyigm', "/data/DLA/H100/H100_DLA_ions.json")
print('H100: Loading ions file {:s}'.format(ions_fil))
# Transitions
trans_fil = resource_filename('pyigm', "/data/DLA/H100/H100_DLA_clms.tar.gz")
# System files
sys_files = resource_filename('pyigm', "/data/DLA/H100/H100_DLA_sys.tar.gz")
print('H100: Loading systems. This takes ~10s')
dla_survey = pyisu.load_sys_files(sys_files, 'DLA', build_abs_sys=build_abs_sys)
# Reset flag_NHI (which has been wrong)
for key in dla_survey._dict.keys():
dla_survey._dict[key]['flag_NHI'] = 1
# Fill ion Tables
if build_abs_sys:
print("Filling the _ionN tables...")
dla_survey.fill_ions(use_components=True)
dla_survey.ref = 'Neeleman+13'
if not build_abs_sys:
print("Not loading up all the other data. Use build_abs_sys=True for that!")
return dla_survey
# Metallicities
tbl2_file = resource_filename('pyigm', "/data/DLA/H100/H100_table2.dat")
tbl2 = Table.read(tbl2_file, format='cds')
# Parse for matching
names = dla_survey._data['Name']
qsonames = []
zabs = []
for name in names:
prs = name.split('_')
qsonames.append(prs[0])
try:
zabs.append(float(prs[-1][1:]))
except ValueError:
pdb.set_trace()
qsonames = np.array(qsonames)
zabs = | np.array(zabs) | numpy.array |
# -*- coding: utf-8 -*-
'''
Extended Kalman filter
REFERENCE:
[1]. <NAME>, "Optimal State Estimation: Kalman, H Infinity, and Nonlinear Approaches," John Wiley and Sons, Inc., 2006.
'''
from __future__ import division, absolute_import, print_function
__all__ = ['EKFilterAN', 'EKFilterNAN']
import numpy as np
import scipy.linalg as lg
from functools import partial
from .base import FilterBase
from tracklib.math import num_diff, num_diff_hessian
class EKFilterAN(FilterBase):
'''
Additive extended Kalman filter, see[1]
system model:
x_k = f_k-1(x_k-1, u_k-1) + L_k-1*w_k-1
z_k = h_k(x_k) + M_k*v_k
E(w_k*w_j') = Q_k*δ_kj
E(v_k*v_j') = R_k*δ_kj
w_k, v_k, x_0 are uncorrelated to each other
'''
def __init__(self,
f,
L,
h,
M,
Q,
R,
xdim,
zdim,
fjac=None,
hjac=None,
fhes=None,
hhes=None,
order=1,
it=0):
super().__init__()
self._f = lambda x, u: f(x, u)
self._L = L.copy()
self._h = lambda x: h(x)
self._M = M.copy()
self._Q = Q.copy()
self._R = R.copy()
self._xdim = xdim
self._zdim = zdim
if fjac is None:
def fjac(x, u):
F = num_diff(x, partial(self._f, u=u), self._xdim)
return F
self._fjac = fjac
if hjac is None:
def hjac(x):
H = num_diff(x, partial(self._h), self._zdim)
return H
self._hjac = hjac
if fhes is None:
def fhes(x, u):
FH = num_diff_hessian(x, partial(self._f, u=u), self._xdim)
return FH
self._fhes = fhes
if hhes is None:
def hhes(x):
HH = num_diff_hessian(x, self._h, self._zdim)
return HH
self._hhes = hhes
if order == 1 or order == 2:
self._order = order
else:
raise ValueError('order must be 1 or 2')
self._it = it
def __str__(self):
msg = '%s-order additive noise extended Kalman filter' % ('First' if self._order == 1 else 'Second')
return msg
def init(self, state, cov):
self._state = state.copy()
self._cov = cov.copy()
self._init = True
def reset(self, state, cov):
self._state = state.copy()
self._cov = cov.copy()
def predict(self, u=None, **kwargs):
if self._init == False:
raise RuntimeError('filter must be initialized with init() before use')
if len(kwargs) > 0:
if 'L' in kwargs: self._L[:] = kwargs['L']
if 'Q' in kwargs: self._Q[:] = kwargs['Q']
post_state, post_cov = self.state, self._cov
F = self._fjac(post_state, u)
Q_tilde = self._L @ self._Q @ self._L.T
self._state = self._f(post_state, u)
self._cov = F @ post_cov @ F.T + Q_tilde
self._cov = (self._cov + self._cov.T) / 2
if self._order == 2:
FH = self._fhes(post_state, u)
quad = np.array([np.trace(FH[:, :, i] @ post_cov) for i in range(self._xdim)], dtype=float)
self._state += quad / 2
return self._state, self._cov
def correct(self, z, **kwargs):
if self._init == False:
raise RuntimeError('filter must be initialized with init() before use')
if len(kwargs) > 0:
if 'M' in kwargs: self._M[:] = kwargs['M']
if 'R' in kwargs: self._R[:] = kwargs['R']
prior_state, prior_cov = self._state, self._cov
H = self._hjac(prior_state)
z_pred = self._h(prior_state)
if self._order == 2:
HH = self._hhes(prior_state)
quad = np.array([np.trace(HH[:, :, i] @ prior_cov) for i in range(self._zdim)], dtype=float)
z_pred += quad / 2
innov = z - z_pred
R_tilde = self._M @ self._R @ self._M.T
S = H @ prior_cov @ H.T + R_tilde
S = (S + S.T) / 2
K = prior_cov @ H.T @ lg.inv(S)
self._state = prior_state + K @ innov
self._cov = prior_cov - K @ S @ K.T
self._cov = (self._cov + self._cov.T) / 2
for _ in range(self._it):
H = self._hjac(self._state)
z_pred = self._h(self._state) + H @ (prior_state - self._state)
if self._order == 2:
HH = self._hhes(self._state)
quad = np.array([np.trace(HH[:, :, i] @ self._cov) for i in range(self._zdim)], dtype=float)
z_pred += quad / 2
innov = z - z_pred
R_tilde = self._M @ self._R @ self._M.T
S = H @ prior_cov @ H.T + R_tilde
S = (S + S.T) / 2
K = prior_cov @ H.T @ lg.inv(S)
self._state = prior_state + K @ innov
self._cov = prior_cov - K @ S @ K.T
self._cov = (self._cov + self._cov.T) / 2
return self._state, self._cov
def correct_JPDA(self, zs, probs, **kwargs):
if self._init == False:
raise RuntimeError('filter must be initialized with init() before use')
z_len = len(zs)
Ms = kwargs['M'] if 'M' in kwargs else [self._M] * z_len
Rs = kwargs['R'] if 'R' in kwargs else [self._R] * z_len
prior_state, prior_cov = self._state, self._cov
H = self._hjac(prior_state)
z_pred = self._h(prior_state)
if self._order == 2:
HH = self._hhes(prior_state)
quad = np.array([np.trace(HH[:, :, i] @ prior_cov) for i in range(self._zdim)], dtype=float)
z_pred += quad / 2
state_item = 0
cov_item1 = cov_item2 = 0
for i in range(z_len):
S = H @ prior_cov @ H.T + Ms[i] @ Rs[i] @ Ms[i].T
S = (S + S.T) / 2
K = prior_cov @ H.T @ lg.inv(S)
innov = zs[i] - z_pred
incre = np.dot(K, innov)
state_item += probs[i] * incre
cov_item1 += probs[i] * (prior_cov - K @ S @ K.T)
cov_item2 += probs[i] * np.outer(incre, incre)
self._state = prior_state + state_item
self._cov = (1 - np.sum(probs)) * prior_cov + cov_item1 + (cov_item2 - np.outer(state_item, state_item))
self._cov = (self._cov + self._cov.T) / 2
for _ in range(self._it):
H = self._hjac(self._state)
z_pred = self._h(self._state) + H @ (prior_state - self._state)
if self._order == 2:
HH = self._hhes(self._state)
quad = np.array([np.trace(HH[:, :, i] @ self._cov) for i in range(self._zdim)], dtype=float)
z_pred += quad / 2
state_item = 0
cov_item1 = cov_item2 = 0
for i in range(z_len):
S = H @ prior_cov @ H.T + Ms[i] @ Rs[i] @ Ms[i].T
S = (S + S.T) / 2
K = prior_cov @ H.T @ lg.inv(S)
innov = zs[i] - z_pred
incre = np.dot(K, innov)
state_item += probs[i] * incre
cov_item1 += probs[i] * (prior_cov - K @ S @ K.T)
cov_item2 += probs[i] * np.outer(incre, incre)
self._state = prior_state + state_item
self._cov = (1 - | np.sum(probs) | numpy.sum |
import numpy as np
import random
from abc import abstractmethod, ABC
from scipy import signal
class Task(ABC):
"""
Task class.
This allows to select various types of tasks while sharing the same base structure.
Author: <NAME>
"""
def __init__(self):
self.time_v = None
self.state_indices = {'p': 0, 'q': 1, 'r': 2, 'V': 3, 'alpha': 4, 'beta': 5,
'phi': 6, 'theta': 7, 'psi': 8, 'h': 9, 'x': 10, 'y': 11}
self.obs_indices = None
self.track_signals = None
self.track_indices = []
self.signals = {}
self.agent_catalog = self.get_agent_catalog()
return
def organize_indices(self, signals, obs_indices):
track_signals = np.zeros(self.time_v.shape[0])
track_indices = []
for state in signals:
if signals[state].shape[0] != self.time_v.shape[0]:
signals[state] = np.append(signals[state], signals[state][-1])
track_signals = np.vstack([track_signals, signals[state]])
track_indices.append(int(self.state_indices[state]))
track_signals = track_signals[1:]
obs_indices = track_indices + obs_indices
return track_signals, track_indices, obs_indices
def choose_task(self, evaluation, failure, FDD):
if failure[0] is not 'normal':
if evaluation:
if FDD:
task_fun = self.get_task_eval_FDD
else:
task_fun = self.get_task_eval_fail
else:
task_fun = self.get_task_tr_fail
else:
if evaluation:
task_fun = self.get_task_eval
else:
task_fun = self.get_task_tr
return task_fun, evaluation, FDD
@abstractmethod
def get_agent_catalog(self):
catalog = {'normal': None, 'elev_range': None, 'aileron_eff': None, 'rudder_stuck': None,
'horz_tail': None, 'vert_tail': None, 'icing': None, 'cg_shift': None}
return catalog
@abstractmethod
def get_task_tr(self):
self.time_v: np.ndarray = np.arange(0, 20, 0.01)
pass
@abstractmethod
def get_task_eval(self):
self.time_v: np.ndarray = np.arange(0, 80, 0.01)
pass
@abstractmethod
def get_task_tr_fail(self):
pass
@abstractmethod
def get_task_eval_fail(self):
self.time_v: np.ndarray = np.arange(0, 70, 0.01)
pass
@abstractmethod
def get_task_eval_FDD(self):
self.time_v: np.ndarray = np.arange(0, 120, 0.01)
pass
@abstractmethod
def return_signals(self):
pass
class BodyRateTask(Task):
def get_agent_catalog(self):
catalog = super(BodyRateTask, self).get_agent_catalog()
catalog['normal'] = 'body_rates_RG2SG4'
return catalog
def get_task_tr(self):
super(BodyRateTask, self).get_task_tr()
self.signals['p'] = np.hstack([np.zeros(int(2.5 * self.time_v.shape[0] / self.time_v[-1].round())),
5 * np.sin(self.time_v[:int(self.time_v.shape[0] * 3 / 4)] * 0.2 * np.pi * 2),
# 5 * np.sin(time_v[:int(time_v.shape[0] / 4)] * 3.5 * np.pi * 0.2),
# -5 * np.ones(int(2.5 * time_v.shape[0] / time_v[-1].round())),
# 5 * np.ones(int(2.5 * time_v.shape[0] / time_v[-1].round())),
# np.zeros(int(2.5 * time_v.shape[0] / time_v[-1].round())),
])
self.signals['q'] = np.hstack([5 * np.sin(self.time_v[:int(self.time_v.shape[0] * 3 / 4)] * 0.2 * np.pi * 2),
# 5 * np.sin(time_v[:int(time_v.shape[0] / 4)] * 3.5 * np.pi * 0.2),
# -5 * np.ones(int(2.5 * time_v.shape[0] / time_v[-1].round())),
# 5 * np.ones(int(2.5 * time_v.shape[0] / time_v[-1].round())),
np.zeros(int(2.5 * self.time_v.shape[0] / self.time_v[-1].round())),
])
return self.return_signals()
def get_task_eval(self):
super(BodyRateTask, self).get_task_eval()
self.signals['p'] = np.hstack([np.zeros(int(2.5 * self.time_v.shape[0] / self.time_v[-1].round())),
5 * np.sin(self.time_v[:int(self.time_v.shape[0] * 3 / 4)] * 0.2 * np.pi * 2),
# 5 * np.sin(time_v[:int(time_v.shape[0] / 4)] * 3.5 * np.pi * 0.2),
# -5 * np.ones(int(2.5 * time_v.shape[0] / time_v[-1].round())),
# 5 * np.ones(int(2.5 * time_v.shape[0] / time_v[-1].round())),
# np.zeros(int(2.5 * time_v.shape[0] / time_v[-1].round())),
])
self.signals['q'] = np.hstack([5 * np.sin(self.time_v[:int(self.time_v.shape[0] * 3 / 4)] * 0.2 * np.pi * 2),
# 5 * np.sin(time_v[:int(time_v.shape[0] / 4)] * 3.5 * np.pi * 0.2),
# -5 * np.ones(int(2.5 * time_v.shape[0] / time_v[-1].round())),
# 5 * np.ones(int(2.5 * time_v.shape[0] / time_v[-1].round())),
np.zeros(int(2.5 * self.time_v.shape[0] / self.time_v[-1].round())),
])
return self.return_signals()
def get_task_tr_fail(self):
raise NotImplementedError
def get_task_eval_fail(self):
raise NotImplementedError
def get_task_eval_FDD(self):
raise NotImplementedError
def return_signals(self):
self.signals['beta'] = np.zeros(int(self.time_v.shape[0]))
self.obs_indices = [self.state_indices['r']]
self.track_signals, self.track_indices, self.obs_indices = self.organize_indices(self.signals, self.obs_indices)
return self.track_signals, self.track_indices, self.obs_indices, self.time_v, 'body_rates'
couple = ['PZ5QGW', 'GT0PLE']
# couple = ['XQ2G4Q', 'GT0PLE']
# couple = ['PZ5QGW', '9VZ5VE']
class AttitudeTask(Task):
def get_agent_catalog(self):
catalog = super(AttitudeTask, self).get_agent_catalog()
catalog['normal'] = '3attitude_step_' + couple[1]
catalog['elev_range'] = '3attitude_step_Q4N8GV_de'
catalog['aileron_eff'] = '3attitude_step_E919SW_da'
catalog['rudder_stuck'] = '3attitude_step_HNAKCC_dr'
catalog['horz_tail'] = '3attitude_step_R0EV0U_ht'
catalog['vert_tail'] = '3attitude_step_2KGDYQ_vt'
catalog['icing'] = '3attitude_step_9MUWUB_ice'
catalog['cg_shift'] = '3attitude_step_5K6QFG_cg'
return catalog
def get_task_tr(self, init_alt=2000):
super(AttitudeTask, self).get_task_tr()
angle_theta = random.choice([20, 15, -20, -15])
time_v = self.time_v
self.signals['theta'] = np.hstack(
[angle_theta * np.sin(time_v[:np.argwhere(time_v == 1.5)[0, 0]] * 0.16 * np.pi * 2),
angle_theta * np.ones(int(3.5 * time_v.shape[0] / time_v[-1].round())),
angle_theta * np.cos(time_v[:np.argwhere(time_v == 0.5)[0, 0]] * 0.33 * np.pi * 2),
angle_theta / 2 * np.ones(int(4. * time_v.shape[0] / time_v[-1].round())),
angle_theta / 2 * np.cos(time_v[:np.argwhere(time_v == 0.5)[0, 0]] * 0.47 * np.pi * 2),
-angle_theta * np.sin(time_v[:np.argwhere(time_v == 1.5)[0, 0]] * 0.17 * np.pi * 2),
-angle_theta * np.ones(int(3.5 * time_v.shape[0] / time_v[-1].round())),
-angle_theta * np.cos(time_v[:np.argwhere(time_v == 0.5)[0, 0]] * 0.33 * np.pi * 2),
-angle_theta / 2 * np.ones(int(4.5 * time_v.shape[0] / time_v[-1].round())),
])
angle_phi = random.choice([45, 35, 25, -45, -35, -25])
self.signals['phi'] = np.hstack([np.zeros(int(2 * time_v.shape[0] / time_v[-1].round())),
angle_phi * np.sin(time_v[:np.argwhere(time_v == 1)[0, 0]] * 0.25 * np.pi * 2),
angle_phi * np.ones(int(4 * time_v.shape[0] / time_v[-1].round())),
angle_phi * np.cos(time_v[:np.argwhere(time_v == 1)[0, 0]] * 0.25 * np.pi * 2),
np.zeros(int(2 * time_v.shape[0] / time_v[-1].round())),
np.zeros(int(2 * time_v.shape[0] / time_v[-1].round())),
-angle_phi * np.sin(
time_v[:np.argwhere(time_v == 1)[0, 0]] * 0.25 * np.pi * 2),
-angle_phi * np.ones(int(4 * time_v.shape[0] / time_v[-1].round())),
-angle_phi * np.cos(
time_v[:np.argwhere(time_v == 1)[0, 0]] * 0.25 * np.pi * 2),
np.zeros(int(2 * time_v.shape[0] / time_v[-1].round())),
])
return self.return_signals()
def get_task_eval(self, init_alt=2000):
super(AttitudeTask, self).get_task_eval()
time_v = self.time_v
self.signals['theta'] = np.hstack([20 * np.sin(time_v[:np.argwhere(time_v == 5.0)[0, 0]] * 0.05 * np.pi * 2),
20 * np.ones(int(8 * time_v.shape[0] / time_v[-1].round())),
20 * np.cos(time_v[:np.argwhere(time_v == 2.0)[0, 0]] * 0.08 * np.pi * 2),
10 * np.ones(int(15 * time_v.shape[0] / time_v[-1].round())),
10 * np.cos(time_v[:np.argwhere(time_v == 2.0)[0, 0]] * 0.12 * np.pi * 2),
0 * np.ones(int(25 * time_v.shape[0] / time_v[-1].round())),
-15 * np.sin(time_v[:np.argwhere(time_v == 2)[0, 0]] * 0.13 * np.pi * 2),
-15 * np.ones(int(12 * time_v.shape[0] / time_v[-1].round())),
-15 * np.cos(time_v[:np.argwhere(time_v == 4)[0, 0]] * 0.06 * np.pi * 2),
0 * np.ones(int(5 * time_v.shape[0] / time_v[-1].round())),
])
sign = 1
self.signals['phi'] = np.hstack([0 * np.ones(int(5 * time_v.shape[0] / time_v[-1].round())),
sign * 45 * np.sin(
time_v[:np.argwhere(time_v == 2.0)[0, 0]] * 0.13 * np.pi * 2),
sign * 45 * np.ones(int(9 * time_v.shape[0] / time_v[-1].round())),
sign * 45 * np.cos(time_v[:np.argwhere(time_v == 2)[0, 0]] * 0.12 * np.pi * 2),
0 * np.ones(int(4 * time_v.shape[0] / time_v[-1].round())),
-sign * 30 * np.sin(
time_v[:np.argwhere(time_v == 2)[0, 0]] * 0.13 * np.pi * 2),
-sign * 30 * np.ones(int(4 * time_v.shape[0] / time_v[-1].round())),
-sign * 30 * np.cos(
time_v[:np.argwhere(time_v == 2.0)[0, 0]] * 0.12 * np.pi * 2),
0 * np.ones(int(5 * time_v.shape[0] / time_v[-1].round())),
sign * 70 * np.sin(
time_v[:np.argwhere(time_v == 5.5)[0, 0]] * 0.05 * np.pi * 2),
sign * 70 * np.ones(int(8 * time_v.shape[0] / time_v[-1].round())),
sign * 70 * np.cos(
time_v[: | np.argwhere(time_v == 5.5) | numpy.argwhere |
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
# Set random seed for reproducibility
np.random.seed(1000)
width = 15
height = 5
y_final = width - 1
x_final = height - 1
y_wells = [0, 1, 3, 5, 5, 7, 9, 11, 12, 14]
x_wells = [3, 1, 2, 0, 4, 1, 3, 2, 4, 1]
gamma = 0.9
nb_max_epochs = 100000
tolerance = 1e-5
nb_actions = 4
# Initial tunnel rewards
standard_reward = -0.1
tunnel_rewards = np.ones(shape=(height, width)) * standard_reward
for x_well, y_well in zip(x_wells, y_wells):
tunnel_rewards[x_well, y_well] = -5.0
tunnel_rewards[x_final, y_final] = 5.0
policy = np.random.randint(0, nb_actions, size=(height, width)).astype(np.uint8)
tunnel_values = np.zeros(shape=(height, width))
def show_values(t):
fig, ax = plt.subplots(figsize=(15, 6))
ax.matshow(tunnel_values, cmap=cm.Pastel1)
ax.set_xlabel('y')
ax.set_ylabel('x')
ax.set_xticks(np.arange(width))
ax.set_yticks(np.arange(height))
ax.set_title('Values (t={})'.format(t))
for i in range(height):
for j in range(width):
if i == x_final and j == y_final:
msg = 'E'
elif (i, j) in zip(x_wells, y_wells):
msg = r'$\otimes$'
else:
msg = '{:.1f}'.format(tunnel_values[i, j])
ax.text(x=j, y=i, s=msg, va='center', ha='center')
plt.show()
def show_policy(t):
fig, ax = plt.subplots(figsize=(15, 6))
ax.matshow(np.zeros_like(tunnel_values), cmap=cm.Pastel1)
ax.set_xlabel('y')
ax.set_ylabel('x')
ax.set_xticks(np.arange(width))
ax.set_yticks(np.arange(height))
ax.set_title('Policy (t={})'.format(t))
for i in range(height):
for j in range(width):
action = policy[i, j]
if i == x_final and j == y_final:
msg = 'E'
elif (i, j) in zip(x_wells, y_wells):
msg = r'$\otimes$'
else:
if action == 0:
msg = r'$\uparrow$'
elif action == 1:
msg = r'$\rightarrow$'
elif action == 2:
msg = r'$\downarrow$'
else:
msg = r'$\leftarrow$'
ax.text(x=j, y=i, s=msg, va='center', ha='center')
plt.show()
def is_final(x, y):
if (x, y) in zip(x_wells, y_wells) or (x, y) == (x_final, y_final):
return True
return False
def value_evaluation():
old_tunnel_values = tunnel_values.copy()
for i in range(height):
for j in range(width):
rewards = np.zeros(shape=(nb_actions,))
old_values = np.zeros(shape=(nb_actions,))
for k in range(nb_actions):
if k == 0:
if i == 0:
x = 0
else:
x = i - 1
y = j
elif k == 1:
if j == width - 1:
y = width - 1
else:
y = j + 1
x = i
elif k == 2:
if i == height - 1:
x = height - 1
else:
x = i + 1
y = j
else:
if j == 0:
y = 0
else:
y = j - 1
x = i
rewards[k] = tunnel_rewards[x, y]
old_values[k] = old_tunnel_values[x, y]
new_values = | np.zeros(shape=(nb_actions,)) | numpy.zeros |
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
# %% load data, prepare common variables
data = pd.read_csv("datasets/NDBC_buoy_46025.csv", sep=",")[["Hs", "T"]]
x, dx = np.linspace([0.1, 0.1], [30, 12], num=100, retstep=True)
# %% # vc2
from virocon import GlobalHierarchicalModel
from virocon.predefined import get_OMAE2020_Hs_Tz
dist_descriptions, fit_descriptions, semantics = get_OMAE2020_Hs_Tz()
ghm = GlobalHierarchicalModel(dist_descriptions)
ghm.fit(data, fit_descriptions=fit_descriptions)
# %%
from virocon.plotting import plot_2D_isodensity
plot_2D_isodensity(ghm, data, semantics=semantics)
# %%
my_f = ghm.pdf(x)
my_f_expweib = ghm.distributions[0].pdf(x[:, 0])
my_expweib_params = (
ghm.distributions[0].alpha,
ghm.distributions[0].beta,
ghm.distributions[0].delta,
)
my_ln = ghm.distributions[1]
my_givens = my_ln.conditioning_values
my_f_ln = []
for given in my_givens:
my_f_ln.append(my_ln.pdf(x[:, 1], given))
my_f_ln = np.stack(my_f_ln, axis=1)
my_mus = np.array([par["mu"] for par in my_ln.parameters_per_interval])
my_sigmas = np.array([par["sigma"] for par in my_ln.parameters_per_interval])
my_intervals = my_ln.data_intervals
# %% viroconcom
import sys
sys.path.append("../viroconcom")
from viroconcom.fitting import Fit
sample_hs = data["Hs"]
sample_tz = data["T"]
# Define the structure of the probabilistic model that will be fitted to the
# dataset.
dist_description_hs = {
"name": "Weibull_Exp",
"dependency": (None, None, None, None),
"width_of_intervals": 0.5,
}
dist_description_tz = {
"name": "Lognormal_SigmaMu",
"dependency": (0, None, 0), # Shape, Location, Scale
"functions": ("asymdecrease3", None, "lnsquare2"), # Shape, Location, Scale
"min_datapoints_for_fit": 50,
}
# Fit the model to the data.
fit = Fit((sample_hs, sample_tz), (dist_description_hs, dist_description_tz))
# %%
dist0 = fit.mul_var_dist.distributions[0]
mul_var_dist = fit.mul_var_dist
ref_f = mul_var_dist.pdf(x.T)
ref_f_expweib = mul_var_dist.distributions[0].pdf(x[:, 0])
ref_expweib = mul_var_dist.distributions[0]
ref_expweib_params = (
ref_expweib.scale(None),
ref_expweib.shape(None),
ref_expweib.shape2(None),
)
ref_ln = mul_var_dist.distributions[1]
ref_f_ln = []
ref_givens = fit.multiple_fit_inspection_data[1].scale_at
assert all(ref_givens == my_givens)
for given in ref_givens:
y = np.stack([np.full_like(x[:, 1], given), x[:, 1]])
ref_f_ln.append(ref_ln.pdf(x[:, 1], y, (0, None, 0, None)))
ref_f_ln = np.stack(ref_f_ln, axis=1)
ref_mus = np.array(fit.multiple_fit_inspection_data[1].scale_value)
ref_sigmas = np.array(fit.multiple_fit_inspection_data[1].shape_value)
ref_intervals = fit.multiple_fit_inspection_data[1].scale_samples
# %% save reference data
# reference_data = {"ref_expweib_params" : ref_expweib_params,
# "ref_f_expweib" : ref_f_expweib,
# "ref_givens" : ref_givens,
# "ref_mus" : ref_mus,
# "ref_sigmas" : ref_sigmas,
# "ref_f_ln" : ref_f_ln
# }
# for i, ref_interval in enumerate(ref_intervals):
# reference_data[f"ref_interval{i}"] = ref_interval
# np.savez_compressed("reference_data_OMAE2020", **reference_data)
# %%
plt.close("all")
plt.plot(my_f, label="my_f")
plt.plot(ref_f, label="ref_f")
plt.legend()
plt.figure()
plt.plot(x[:, 0], my_f_expweib, label="my_exp_weibull0")
plt.plot(x[:, 0], ref_f_expweib, label="ref_exp_weibull0")
plt.legend()
fig, axes = plt.subplots(3, 4, sharex=True, sharey=True,)
givens = fit.multiple_fit_inspection_data[1].scale_at
for i in range(len(ref_givens)):
ax = axes.flatten()[i]
ax.plot(x[:, 1], my_f_ln[:, i], label="my_exp_weibull1")
ax.plot(x[:, 1], ref_f_ln[:, i], label="ref_exp_weibull1")
ax.hist(fit.multiple_fit_inspection_data[1].scale_samples[i], density=True)
ax.set_title(f"V = {ref_givens[i]}")
ax.legend()
# %%
z = np.linspace(data.Hs.min(), data.Hs.max())
my_mu_x = my_ln.conditioning_values
my_mu_dep = my_ln.conditional_parameters["mu"]
plt.figure()
plt.plot(z, my_mu_dep(z), label="my_mu_func")
plt.scatter(my_mu_x, my_mus, label="my_mu")
ref_mu_x = fit.multiple_fit_inspection_data[1].scale_at
ref_mu_function_param = mul_var_dist.distributions[1].scale
plt.plot(z, np.log(ref_mu_function_param(z)), label="ref_mu_func")
plt.scatter(ref_mu_x, np.log(ref_mus), label="ref_mu")
plt.legend()
plt.figure()
my_sigma_x = my_ln.conditioning_values
my_sigma_dep = my_ln.conditional_parameters["sigma"]
plt.plot(z, my_sigma_dep(z), label="my_sigma_func")
plt.scatter(my_sigma_x, my_sigmas, label="my_sigma")
ref_sigma_x = fit.multiple_fit_inspection_data[1].shape_at
ref_sigma_function_param = mul_var_dist.distributions[1].shape
plt.plot(z, ref_sigma_function_param(z), label="ref_sigma_func")
plt.scatter(ref_sigma_x, ref_sigmas, label="ref_sigma")
plt.legend()
# %%
np.testing.assert_almost_equal(my_f, ref_f)
np.testing.assert_almost_equal(my_expweib_params, ref_expweib_params)
| np.testing.assert_almost_equal(my_f_expweib, ref_f_expweib) | numpy.testing.assert_almost_equal |
import torch
import torch.nn as nn
from mmcv.cnn import normal_init
import numpy as np
import cv2
import math
#import torch.nn.functional as F
from mmdet.core import multi_apply, multiclass_nms, distance2bbox, force_fp32
from ..builder import build_loss
from ..registry import HEADS
from ..utils import bias_init_with_prob, Scale, ConvModule
INF = 1e8
@HEADS.register_module
class MatrixCenterHead(nn.Module):
def __init__(self,
num_classes, # init 80
in_channels,
feat_channels=256,
stacked_convs=1,
strides=(4, 4, 4,
8, 8, 8, 8,
16, 16, 16, 16, 16,
32, 32, 32, 32,
64, 64, 64),
regress_ranges=((-1, 48), (48, 96), (96, 192), (192, 384), (384, INF)),
flags = [[0, 0, 0, 1, 1], [0, 0, 0, 0, 1], [0, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 1, 0, 0, 0]],
index_map = {0:0, 1:1, 2:2,
5:3, 6:4, 7:5, 8:6,
10:7, 11:8, 12:9, 13:10, 14:11,
16:12, 17:13, 18:14, 19:15,
22:16, 23:17, 24:18}, # use i * 5 + j to get the featmap
loss_hm = dict(
type="CenterFocalLoss"
), # 这里实现 CenterFocalLoss
loss_wh = dict(
type="L1Loss",
loss_weight=0.1
),
loss_offset = dict(
type="L1Loss",
loss_weight=1.0
),
conv_cfg=None,
norm_cfg=dict(type='GN', num_groups=32, requires_grad=True)):
super(MatrixCenterHead, self).__init__()
self.num_classes = num_classes
# self.cls_out_channels = num_classes - 1
self.cls_out_channels = num_classes
self.in_channels = in_channels
self.feat_channels = feat_channels
self.stacked_convs = stacked_convs
self.strides = strides
self.regress_ranges = regress_ranges
self.featmap_sizes = None
self.loss_hm = build_loss(loss_hm)
self.loss_wh = build_loss(loss_wh)
self.loss_offset = build_loss(loss_offset)
self.conv_cfg = conv_cfg
self.norm_cfg = norm_cfg
self.fp16_enabled = False
self.flags = flags
self.index_map = index_map
self._init_layers()
def _init_layers(self):
self.cls_convs = nn.ModuleList()
self.wh_convs = nn.ModuleList()
self.offset_convs = nn.ModuleList()
for i in range(self.stacked_convs):
chn = self.in_channels if i == 0 else self.feat_channels
self.cls_convs.append(
ConvModule(
chn,
self.feat_channels,
3,
stride=1,
padding=1,
conv_cfg=self.conv_cfg,
norm_cfg=self.norm_cfg,
bias=self.norm_cfg is None))
self.wh_convs.append(
ConvModule(
chn,
self.feat_channels,
3,
stride=1,
padding=1,
conv_cfg=self.conv_cfg,
norm_cfg=self.norm_cfg,
bias=self.norm_cfg is None))
self.offset_convs.append(
ConvModule(
chn,
self.feat_channels,
3,
stride=1,
padding=1,
conv_cfg=self.conv_cfg,
norm_cfg=self.norm_cfg,
bias=self.norm_cfg is None))
self.center_hm = nn.Conv2d(self.feat_channels, self.cls_out_channels, 3, padding=1, bias=True)
self.center_wh = nn.Conv2d(self.feat_channels, 2, 3, padding=1, bias=True)
self.center_offset = nn.Conv2d(self.feat_channels, 2, 3, padding=1, bias=True)
self.scales = nn.ModuleList([Scale(1.0) for _ in self.strides])
#self.scales = nn.ModuleList([Scale(1.0) for _ in 19])
def init_weights(self):
# for m in self.cls_convs:
# normal_init(m.conv, std=0.01)
# for m in self.wh_convs:
# normal_init(m.conv, std=0.01)
# for m in self.offset_convs:
# normal_init(m.conv, std=0.01)
#bias_hm = bias_init_with_prob(0.01) # 这里的初始化?
#normal_init(self.center_hm, std=0.01, bias=bias_hm)
self.center_hm.bias.data.fill_(-2.19)
nn.init.constant_(self.center_wh.bias, 0)
nn.init.constant_(self.center_offset.bias, 0)
# normal_init(self.center_hm, std=0.01)
# normal_init(self.center_wh, std=0.01)
# normal_init(self.center_offset, std=0.01)
def forward(self, feats):
return multi_apply(self.forward_single, feats, self.scales)
def forward_single(self, x, scale):
cls_feat = x
wh_feat = x
offset_feat = x
for cls_layer in self.cls_convs:
cls_feat = cls_layer(cls_feat)
cls_score = self.center_hm(cls_feat)
for wh_layer in self.wh_convs:
wh_feat = wh_layer(wh_feat)
wh_pred = self.center_wh(wh_feat)
for offset_layer in self.offset_convs:
offset_feat = offset_layer(offset_feat)
offset_pred = self.center_offset(offset_feat)
return cls_score, wh_pred, offset_pred
@force_fp32(apply_to=('cls_scores', 'wh_preds', 'offset_preds'))
def loss(self,
cls_scores,
wh_preds,
offset_preds,
gt_bboxes,
gt_labels,
img_metas,
cfg,
gt_bboxes_ignore=None):
assert len(cls_scores) == len(wh_preds) == len(offset_preds)
featmap_sizes = [featmap.size()[-2:] for featmap in cls_scores]
self.featmap_sizes = featmap_sizes
all_level_points = self.get_points(featmap_sizes, offset_preds[0].dtype,
offset_preds[0].device)
#print(img_metas)
#self.c = img_metas['c']
#self.s = img_metas['s']
self.tensor_dtype = offset_preds[0].dtype
self.tensor_device = offset_preds[0].device
heatmaps, wh_targets, offset_targets = self.center_target(gt_bboxes, gt_labels, img_metas, all_level_points) # 所有层的concat的, 每张图对应一个
num_imgs = cls_scores[0].size(0) # batch_size
#print(num_imgs)
# flatten cls_scores, bbox_preds and centerness
flatten_cls_scores = [
cls_score.permute(0, 2, 3, 1).reshape(-1, self.cls_out_channels)
for cls_score in cls_scores
] # cls_scores(num_levels, batch_size, 80, h, w) => (num_levels, batch_size * w * h, 80)
flatten_wh_preds = [
wh_pred.permute(0, 2, 3, 1).reshape(-1, 2) # batchsize, h, w, 2 => batchsize, h, w, 2
for wh_pred in wh_preds
]
flatten_offset_preds = [
offset_pred.permute(0, 2, 3, 1).reshape(-1, 2)
for offset_pred in offset_preds
]
flatten_cls_scores = torch.cat(flatten_cls_scores)
flatten_wh_preds = torch.cat(flatten_wh_preds)
flatten_offset_preds = torch.cat(flatten_offset_preds)
# targets
flatten_heatmaps = torch.cat(heatmaps)
flatten_wh_targets = torch.cat(wh_targets) # torch.Size([all_level_points, 2])
flatten_offset_targets = torch.cat(offset_targets)
# repeat points to align with bbox_preds
# flatten_points = torch.cat(
# [points.repeat(num_imgs, 1) for points in all_level_points])
# pos_inds = flatten_labels.nonzero().reshape(-1)
#print(flatten_wh_targets.shape)
#print(flatten_wh_targets.nonzero())
center_inds = flatten_wh_targets[...,0].nonzero().reshape(-1)
#print(center_inds)
num_center = len(center_inds)
#print(num_center)
# what about use the centerness * labels to indict an object
# loss_cls = self.loss_cls(
# flatten_cls_scores, flatten_labels, # labels gt is small area
# avg_factor=num_pos + num_imgs) # avoid num_pos is 0
flatten_cls_scores = torch.clamp(flatten_cls_scores.sigmoid_(), min=1e-4, max=1-1e-4)
loss_hm = self.loss_hm(flatten_cls_scores, flatten_heatmaps)
pos_wh_targets = flatten_wh_targets[center_inds]
#print(pos_wh_targets.shape)
pos_wh_preds = flatten_wh_preds[center_inds]
pos_offset_preds = flatten_offset_preds[center_inds]
pos_offset_targets = flatten_offset_targets[center_inds]
if num_center > 0:
# TODO: use the iou loss
# center_points = flatten_points[center_inds]
# center_decoded_bbox_preds = wh_offset2bbox(center_points, pos_wh_preds, pos_offset_preds)
# center_decoded_bbox_targets = wh_offset2bbox(center_points, pos_wh_targets, pos_offset_targets)
loss_wh = self.loss_wh(pos_wh_preds, pos_wh_targets, avg_factor=num_center + num_imgs)
#loss_wh = F.l1_loss(pos_wh_preds, pos_wh_targets, reduction='sum') / (num_center + num_imgs)
#loss_wh = 0.1 * loss_wh
loss_offset = self.loss_offset(pos_offset_preds, pos_offset_targets, avg_factor=num_center + num_imgs)
else:
loss_wh = pos_wh_preds.sum()
loss_offset = pos_offset_preds.sum()
return dict(
loss_hm = loss_hm,
loss_wh = loss_wh,
loss_offset = loss_offset)
def get_points(self, featmap_sizes, dtype, device):
"""Get points according to feature map sizes.
Args:
featmap_sizes (list[tuple]): Multi-level feature map sizes.
dtype (torch.dtype): Type of points.
device (torch.device): Device of points.
Returns:
tuple: points of each image.
"""
mlvl_points = []
for i in range(len(featmap_sizes)):
mlvl_points.append(
self.get_points_single(featmap_sizes[i], self.strides[i],
dtype, device))
return mlvl_points
def get_points_single(self, featmap_size, stride, dtype, device):
h, w = featmap_size
x_range = torch.arange(
0, w * stride, stride, dtype=dtype, device=device) # 以一定间隔取x的值
y_range = torch.arange(
0, h * stride, stride, dtype=dtype, device=device)
y, x = torch.meshgrid(y_range, x_range) # 得到featmap的所有点
points = torch.stack(
(x.reshape(-1), y.reshape(-1)), dim=-1) + stride // 2
return points
def center_target(self, gt_bboxes_list, gt_labels_list, img_metas, all_level_points):
#assert len(self.featmap_sizes) == len(self.regress_ranges)
assert len(self.featmap_sizes) == len(self.strides)
# get heatmaps and targets of each image
# heatmaps in heatmaps_list: [num_points, 80]
# wh_targets: [num_points, 2] => [batch_size, num_points, 2]
heatmaps_list, wh_targets_list, offset_targets_list = multi_apply(
self.center_target_single,
gt_bboxes_list,
gt_labels_list,
img_metas
)
# split to per img, per level
num_points = [center.size(0) for center in all_level_points] # 每一层多少个点 all_level_points [[12414, 2], []]
heatmaps_list = [heatmaps.split(num_points, 0) for heatmaps in heatmaps_list]
wh_targets_list = [wh_targets.split(num_points, 0) for wh_targets in wh_targets_list]
offset_targets_list = [offset_targets.split(num_points, 0) for offset_targets in offset_targets_list]
# concat per level image, 同一层的concat # [(batch_size,featmap_size[1]), ...)
concat_lvl_heatmaps = []
concat_lvl_wh_targets = []
concat_lvl_offset_targets = []
num_levels = len(self.featmap_sizes)
for i in range(num_levels):
concat_lvl_heatmaps.append(
torch.cat([heatmaps[i] for heatmaps in heatmaps_list])) # (num_levels, batch_size * w * h, 80)
concat_lvl_wh_targets.append(
torch.cat(
[wh_targets[i] for wh_targets in wh_targets_list]))
concat_lvl_offset_targets.append(
torch.cat(
[offset_targets[i] for offset_targets in offset_targets_list]))
return concat_lvl_heatmaps, concat_lvl_wh_targets, concat_lvl_offset_targets
def center_target_single(self, gt_bboxes, gt_labels, img_meta):
"""
single image
gt_bboxes:torch.Size([6, 4])
gt_labels:torch.Size([6]) tensor([34, 34, 34, 34, 34, 34], device='cuda:0')
featmap_sizes:(list[tuple]): Multi-level feature map sizes.
regress_ranges=((-1, 64), (64, 128), (128, 256), (256, 512),(512, INF))
"""
# transform the gt_bboxes, gt_labels to numpy
gt_bboxes = gt_bboxes.data.cpu().numpy()
gt_labels = gt_labels.data.cpu().numpy()
#print(gt_bboxes, gt_labels)
num_objs = gt_labels.shape[0]
#print(num_objs)
# heatmaps [level1, level2, level3, level4, level5]
num_levels = len(self.featmap_sizes)
heatmaps_targets = []
wh_targets = []
offset_targets = []
# get the target shape for each image
for i in range(num_levels): # 一共有19层
h, w = self.featmap_sizes[i]
hm = np.zeros((self.cls_out_channels, h, w), dtype=np.float32)
heatmaps_targets.append(hm)
wh = np.zeros((h, w, 2), dtype=np.float32)
wh_targets.append(wh)
offset = np.zeros((h, w, 2), dtype=np.float32)
offset_targets.append(offset)
for k in range(num_objs):
bbox = gt_bboxes[k]
cls_id = gt_labels[k]
if img_meta['flipped']:
bbox[[0, 2]] = img_meta['width'] - bbox[[2, 0]] - 1
# condition: in the regress_ranges
origin_h, origin_w = bbox[3] - bbox[1], bbox[2] - bbox[0]
# 根据h, w在哪一层将output设置为当前层的
index_i = 0
index_j = 0
for i in range(5):
min_regress_distance, max_regress_distance = self.regress_ranges[i]
if (origin_w > min_regress_distance) and (origin_w <= max_regress_distance):
index_i = i
break
for j in range(5):
min_regress_distance, max_regress_distance = self.regress_ranges[j]
if (origin_h > min_regress_distance) and (origin_h <= max_regress_distance):
index_j = j
break
if self.flags[i][j] == 1:
continue
index_level = self.index_map[index_i * 5 + index_j]
output_h, output_w = self.featmap_sizes[index_level]
#print(output_h, output_w)
hm = heatmaps_targets[index_level]
wh = wh_targets[index_level]
offset = offset_targets[index_level]
# c, s is passed by meta
trans_output = get_affine_transform(img_meta['c'], img_meta['s'], 0, [output_w, output_h])
bbox[:2] = affine_transform(bbox[:2], trans_output)
bbox[2:] = affine_transform(bbox[2:], trans_output)
bbox[[0, 2]] = np.clip(bbox[[0, 2]], 0, output_w - 1) #x1, x2
bbox[[1, 3]] = np.clip(bbox[[1, 3]], 0, output_h - 1)
h, w = bbox[3] - bbox[1], bbox[2] - bbox[0]
#print(h, w)
# 转换到当层
if h > 0 and w > 0:
radius = gaussian_radius((math.ceil(h), math.ceil(w)))
radius = max(0, int(radius))
ct = np.array(
[(bbox[0] + bbox[2]) / 2, (bbox[1] + bbox[3]) / 2], dtype=np.float32)
#print(ct)
ct_int = ct.astype(np.int32)
hm[cls_id, ct_int[1], ct_int[0]] = 1
#if (ct_int[1] - 1) > 0:
# hm[cls_id, ct_int[1] - 1, ct_int[0]] = 0.5
#if (ct_int[0] - 1) > 0:
# hm[cls_id, ct_int[1], ct_int[0] - 1] = 0.5
#if (ct_int[1] + 1) < output_h:
# hm[cls_id, ct_int[1] + 1, ct_int[0]] = 0.5
#if (ct_int[0] + 1) < output_w:
# hm[cls_id, ct_int[1], ct_int[0] + 1] = 0.5
draw_umich_gaussian(hm[cls_id], ct_int, radius)
h, w = 1. * h, 1. * w
offset_count = ct - ct_int # h, w
# ct_int即表明在featmap的位置 ct_int[1] * output_w + ct_int[0]
# TODO:如果当前位置有物体的中心,现在是直接覆盖
# 这里设置监督信号,第1位表示w,第2位表示h
# 这里对featmap进行缩放?
# wh[ct_int[1], ct_int[0], 0] = w / output_w# output_h, output_w <= y, x
# wh[ct_int[1], ct_int[0], 1] = h / output_h
# offset[ct_int[1], ct_int[0], 0] = offset_count[0] / output_w
# offset[ct_int[1], ct_int[0], 0] = offset_count[1] / output_h
wh[ct_int[1], ct_int[0], 0] = w
wh[ct_int[1], ct_int[0], 1] = h
offset[ct_int[1], ct_int[0], 0] = offset_count[0]
offset[ct_int[1], ct_int[0], 0] = offset_count[1]
heatmaps_targets[index_level] = hm
wh_targets[index_level] = wh
offset_targets[index_level] = offset
flatten_heatmaps_targets = [
hm.transpose(1, 2, 0).reshape(-1, self.cls_out_channels)
for hm in heatmaps_targets
]
#for i in range(len(flatten_heatmaps_targets)):
# print(flatten_heatmaps_targets[i].shape)
heatmaps_targets = np.concatenate(flatten_heatmaps_targets, axis=0)
#print(heatmaps_targets.shape) # (13343, 80)
#print(heatmaps_targets)
flatten_wh_targets = [
wh.reshape(-1, 2) for wh in wh_targets
]
wh_targets = np.concatenate(flatten_wh_targets)
flatten_offset_targets = [
offset.reshape(-1, 2) for offset in offset_targets
]
offset_targets = np.concatenate(flatten_offset_targets)
# transform the heatmaps_targets, wh_targets, offset_targets into tensor
heatmaps_targets = torch.from_numpy(np.stack(heatmaps_targets))
heatmaps_targets = torch.tensor(heatmaps_targets.detach(), dtype=self.tensor_dtype, device=self.tensor_device)
wh_targets = torch.from_numpy(np.stack(wh_targets))
wh_targets = torch.tensor(wh_targets.detach(), dtype=self.tensor_dtype, device=self.tensor_device)
offset_targets = torch.from_numpy(np.stack(offset_targets))
offset_targets = torch.tensor(offset_targets.detach(), dtype=self.tensor_dtype, device=self.tensor_device)
return heatmaps_targets, wh_targets, offset_targets
# test use
@force_fp32(apply_to=('cls_scores', 'wh_preds', 'offset_preds'))
def get_bboxes(self,
cls_scores,
wh_preds,
offset_preds,
img_metas,
cfg):
assert len(cls_scores) == len(wh_preds) == len(offset_preds)
# cls_scores => [num_levels] => [batch featmap] => [batch, 80, h, w]
# wh_preds => [num_levels] => [featmap] => [2, h, w]
# offset_preds => [num_levels] => [featmap] => [2, h, w]
num_levels = len(cls_scores)
featmap_sizes = [featmap.size()[-2:] for featmap in cls_scores]
result_list = []
#print(cls_scores[0].shape) # torch.Size([1, 80, 84, 56])
#print(img_metas)
for img_id in range(len(img_metas)): # 每个batch中id
cls_score_list = [
cls_scores[i][img_id].detach() for i in range(num_levels)
] # =>[num_levels] => [80, h, w]
wh_pred_list = [
wh_preds[i][img_id].detach() for i in range(num_levels)
]
offset_pred_list = [
offset_preds[i][img_id].detach() for i in range(num_levels)
]
#img_shape = img_metas[img_id]['img_shape']
scale_factor = img_metas[img_id]['scale_factor']
c = img_metas[img_id]['c']
s = img_metas[img_id]['s']
det_bboxes = self.get_bboxes_single(cls_score_list, wh_pred_list,
offset_pred_list,
featmap_sizes, c, s,
scale_factor, cfg) # 对每一张图像进行解调
result_list.append(det_bboxes)
return result_list # [batch_size]
def get_bboxes_single(self,
cls_scores,
wh_preds,
offset_preds,
featmap_sizes,
c,
s,
scale_factor,
cfg):
assert len(cls_scores) == len(wh_preds) == len(offset_preds) == len(featmap_sizes)
detections = []
for cls_score, wh_pred, offset_pred, featmap_size in zip(
cls_scores, wh_preds, offset_preds, featmap_sizes): # 取出每一层的点
assert cls_score.size()[-2:] == wh_pred.size()[-2:] == offset_pred.size()[-2:] == featmap_size
output_h, output_w = featmap_size
#实际上得到了每一层的hm, wh, offset
hm = torch.clamp(cls_score.sigmoid_(), min=1e-4, max=1-1e-4).unsqueeze(0) # 增加一个纬度
#wh_pred[0, :, :] = wh_pred[0, :, :] * output_w
#wh_pred[1, :, :] = wh_pred[1, :, :] * output_h # 2, output_h, output_w
wh = wh_pred.unsqueeze(0) # 这里需要乘以featuremap的尺度
#offset_pred[0, : ,:] = offset_pred[0, : ,:] * output_w
#offset_pred[1, : ,:] = offset_pred[1, : ,:] * output_h
reg = offset_pred.unsqueeze(0)
dets = ctdet_decode(hm, wh, reg=reg, K=40)
dets = post_process(dets, c, s, output_h, output_w, scale=scale_factor, num_classes=self.num_classes)
detections.append(dets)
results = merge_outputs(detections, self.num_classes) # 单张图的结果
return results
#num_classes = 80
def gaussian_radius(det_size, min_overlap=0.7):
height, width = det_size
a1 = 1
b1 = (height + width)
c1 = width * height * (1 - min_overlap) / (1 + min_overlap)
sq1 = np.sqrt(b1 ** 2 - 4 * a1 * c1)
r1 = (b1 + sq1) / 2
a2 = 4
b2 = 2 * (height + width)
c2 = (1 - min_overlap) * width * height
sq2 = np.sqrt(b2 ** 2 - 4 * a2 * c2)
r2 = (b2 + sq2) / 2
a3 = 4 * min_overlap
b3 = -2 * min_overlap * (height + width)
c3 = (min_overlap - 1) * width * height
sq3 = np.sqrt(b3 ** 2 - 4 * a3 * c3)
r3 = (b3 + sq3) / 2
return min(r1, r2, r3)
def gaussian_small_radius(det_size, min_overlap=0.7):
height, width = det_size
a1 = 1
b1 = (height + width)
c1 = width * height * (1 - min_overlap) / (1 + min_overlap)
sq1 = np.sqrt(b1 ** 2 - 4 * a1 * c1)
r1 = (b1 - sq1) / (2 * a1)
a2 = 4
b2 = 2 * (height + width)
c2 = (1 - min_overlap) * width * height
sq2 = np.sqrt(b2 ** 2 - 4 * a2 * c2)
r2 = (b2 - sq2) / (2 * a2)
a3 = 4 * min_overlap
b3 = -2 * min_overlap * (height + width)
c3 = (min_overlap - 1) * width * height
sq3 = | np.sqrt(b3 ** 2 - 4 * a3 * c3) | numpy.sqrt |
import tensorflow as tf
import numpy as np
from copy import copy
from .base import Model
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
class KerasTFModel(Model):
def __init__(self, model, x_dim: int, u_dim: int, p_dim=0, tvp_dim=0, standardScaler=None):
if not standardScaler is None:
raise NotImplementedError("This feature isn't supported yet !")
#if not isinstance(model, (tf.keras.Model)):
# raise ValueError("The provided model isn't a Keras Model object !")
if len(model.input_shape) != 2:
raise NotImplementedError("Recurrent neural network are not supported atm.")
if model.output_shape[-1] != x_dim:
raise ValueError("Your Keras model do not provide a suitable output dim ! \n It must get the same dim as the state dim.")
if model.input_shape[-1] != sum((x_dim, u_dim, p_dim, tvp_dim)):
raise ValueError("Your Keras model do not provide a suitable input dim ! \n It must get the same dim as the sum of all input vars (x, u, p, tvp).")
super(KerasTFModel, self).__init__(x_dim, u_dim, p_dim, tvp_dim)
self.model = model
self.test = None
def __getstate__(self):
result_dict = copy(self.__dict__)
result_dict["model"] = None
return result_dict
def __setstate__(self, d):
self.__dict__ = d
def _gather_input(self, x: np.ndarray, u: np.ndarray, p=None, tvp=None):
output_np = np.concatenate([x, u], axis=1)
if not tvp is None:
output_np = np.concatenate([output_np, tvp], axis=1)
if not p is None:
#TODO check this part
output_np = np.concatenate([output_np, np.array([[p,]*x.shape[0]])], axis=1)
return output_np
def forward(self, x: np.ndarray, u: np.ndarray, p=None, tvp=None):
input_net = self._gather_input(x, u, p=p, tvp=tvp)
return self.model.predict(input_net)
def jacobian(self, x: np.ndarray, u: np.ndarray, p=None, tvp=None):
input_net = self._gather_input(x, u, p=p, tvp=tvp)
input_tf = tf.constant(input_net)
with tf.GradientTape(persistent=False) as tx:
tx.watch(input_tf)
output_tf = self.model(input_tf)
jacobian_tf = tx.jacobian(output_tf, input_tf)
jacobian_np = jacobian_tf.numpy()[:,:,:,:-self.p_dim- self.tvp_dim]
jacobian_np = jacobian_np.reshape(x.shape[0]*self.x_dim, (self.x_dim+self.u_dim)*x.shape[0])
reshape_indexer = sum([ list(np.arange(x.shape[1])+i*(x.shape[1]+u.shape[1])) for i in range(x.shape[0]) ], list()) + \
sum([ list( x.shape[1]+np.arange(u.shape[1])+i*(x.shape[1]+u.shape[1])) for i in range(x.shape[0]) ], list())
jacobian_np = np.take(jacobian_np, reshape_indexer, axis=1)
return jacobian_np
@tf.function
def _hessian_compute(self, input_tf):
hessian_mask = tf.reshape(tf.eye(tf.shape(input_tf)[0]*self.model.output_shape[-1],tf.shape(input_tf)[0]*self.model.output_shape[-1]), (tf.shape(input_tf)[0]*self.model.output_shape[-1],tf.shape(input_tf)[0],self.model.output_shape[-1]))
hessian_mask = tf.cast(hessian_mask, tf.float64)
output_tf = self.model(input_tf)
output_tf = tf.cast(output_tf, tf.float64)
result = tf.map_fn(lambda mask : tf.hessians(output_tf*mask, input_tf)[0] , hessian_mask, dtype=tf.float32)
return result
def hessian(self, x: np.ndarray, u: np.ndarray, p=None, tvp=None):
input_np = self._gather_input(x, u, p=p, tvp=tvp)
input_tf = tf.constant(input_np, dtype=tf.float32)
#if self.test is None:
# self.test = self._hessian_compute.get_concrete_function(input_tf=tf.TensorSpec([input_tf.shape[0], input_tf.shape[1]], tf.float64), output_shape=int(self.model.output_shape[-1]))
#hessian_np = self.test(input_tf, int(self.model.output_shape[-1])).numpy()
hessian_np = self._hessian_compute(input_tf).numpy()
hessian_np = hessian_np[:,:,:-self.p_dim - self.tvp_dim, :, :-self.p_dim - self.tvp_dim]
# TODO a better implem could be by spliting input BEFORE performing the hessian computation !
hessian_np = hessian_np.reshape(x.shape[0], x.shape[1], (input_np.shape[1]-self.p_dim - self.tvp_dim)*input_np.shape[0],( input_np.shape[1]-self.p_dim - self.tvp_dim)*input_np.shape[0])
reshape_indexer = sum([ list(np.arange(x.shape[1])+i*(x.shape[1]+u.shape[1])) for i in range(x.shape[0]) ], list()) + \
sum([ list( x.shape[1]+np.arange(u.shape[1])+i*(x.shape[1]+u.shape[1])) for i in range(x.shape[0]) ], list())
hessian_np = np.take(hessian_np, reshape_indexer, axis=2)
hessian_np = np.take(hessian_np, reshape_indexer, axis=3)
return hessian_np
@tf.function
def rolling_input(input_tf, x_dim, u_dim, rolling_window=2, H=2, forward=True):
# TODO do not take into account p and tvp
x = input_tf[:,0:x_dim]
u = input_tf[:,x_dim:x_dim+u_dim]
if forward:
x_rolling = tf.stack([ tf.reshape(x[i:i+rolling_window, :],(-1,)) for i in range(H)], axis=0)
u_rolling = tf.stack([ tf.reshape(u[i:i+rolling_window, :],(-1,)) for i in range(H)], axis=0)
else:
x_rolling = tf.stack([ tf.reshape( tf.reverse( x[i:i+rolling_window, :] , [0]),(-1,)) for i in range(H)], axis=0)
u_rolling = tf.stack([ tf.reshape( tf.reverse( u[i:i+rolling_window, :] , [0]),(-1,)) for i in range(H)], axis=0)
return tf.concat([x_rolling,u_rolling],axis=1)
class KerasTFModelRollingInput(Model):
def __init__(self, model, x_dim: int, u_dim: int, p_dim=0, tvp_dim=0, rolling_window=2, forward_rolling=True, standardScaler=None):
if not standardScaler is None:
raise NotImplementedError("This feature isn't supported yet !")
# TODO make checking according to rolling_window
#if not isinstance(model, (tf.keras.Model)):
# raise ValueError("The provided model isn't a Keras Model object !")
#if len(model.input_shape) != 2:
# raise NotImplementedError("Recurrent neural network are not supported atm.")
if model.output_shape[-1] != x_dim:
raise ValueError("Your Keras model do not provide a suitable output dim ! \n It must get the same dim as the state dim.")
#if model.input_shape[-1] != sum((x_dim, u_dim, p_dim, tvp_dim)):
# raise ValueError("Your Keras model do not provide a suitable input dim ! \n It must get the same dim as the sum of all input vars (x, u, p, tvp).")
if not isinstance(rolling_window, int) or rolling_window<1:
raise ValueError("Your rolling windows need to be an integer gretter than 1.")
super(KerasTFModelRollingInput, self).__init__(x_dim, u_dim, p_dim, tvp_dim)
self.model = model
self.rolling_window = rolling_window
self.forward_rolling = forward_rolling
self.prev_x, self.prev_u, self.prev_tvp = None, None, None
self.jacobian_proj = None
def __getstate__(self):
result_dict = copy(self.__dict__)
result_dict["prev_x"] = None
result_dict["prev_u"] = None
result_dict["model"] = None
result_dict["prev_tvp"] = None
return result_dict
def __setstate__(self, d):
self.__dict__ = d
def set_prev_data(self, x_prev: np.ndarray, u_prev: np.ndarray, tvp_prev=None):
assert x_prev.shape == (self.rolling_window-1, self.x_dim), f"Your x prev tensor must have the following shape {(self.rolling_window-1, self.x_dim)} (received : {x_prev.shape})"
assert u_prev.shape == (self.rolling_window-1, self.u_dim), f"Your u prev tensor must have the following shape {(self.rolling_window-1, self.u_dim)} (received : {u_prev.shape})"
self.prev_x = x_prev
self.prev_u = u_prev
if not tvp_prev is None:
assert tvp_prev.shape == (self.rolling_window-1, self.tvp_dim), f"Your tvp prev tensor must have the following shape {(self.rolling_window-1, self.tvp_dim)} (received : {tvp_prev.shape})"
self.prev_tvp = tvp_prev
def _gather_input(self, x: np.ndarray, u: np.ndarray, p=None, tvp=None):
assert (not self.prev_x is None) and (not self.prev_u is None), "You must give history window with set_prev_data before calling any inferance function."
x_extended = np.concatenate([self.prev_x, x], axis=0)
u_extended = np.concatenate([self.prev_u, u], axis=0)
output_np = np.concatenate([x_extended, u_extended], axis=1)
if not tvp is None:
tvp_extended = np.concatenate([self.prev_tvp, tvp], axis=0)
output_np = np.concatenate([output_np, tvp_extended], axis=1)
if not p is None:
output_np = np.concatenate([output_np, np.array([[p,]*x.shape[0]])], axis=1)
return output_np
def _gather_input_V2(self, x: np.ndarray, u: np.ndarray, p=None, tvp=None):
assert (not self.prev_x is None) and (not self.prev_u is None), "You must give history window with set_prev_data before calling any inferance function."
x_extended = np.concatenate([self.prev_x, x], axis=0)
u_extended = np.concatenate([self.prev_u, u], axis=0)
if self.forward_rolling:
x_rolling = np.stack([ x_extended[i:i+self.rolling_window, :].reshape(-1) for i in range(x.shape[0])], axis=0)
u_rolling = np.stack([ u_extended[i:i+self.rolling_window, :].reshape(-1) for i in range(x.shape[0])], axis=0)
if not tvp is None:
assert (not self.prev_tvp is None), "You must give history window with set_prev_data before calling any inferance function."
tvp_extended = np.concatenate([self.prev_tvp, tvp], axis=0)
tvp_rolling = np.stack([ tvp_extended[i:i+self.rolling_window, :].reshape(-1) for i in range(x.shape[0])], axis=0)
else:
x_rolling = np.stack([ (x_extended[i:i+self.rolling_window, :])[::-1,:].reshape(-1) for i in range(x.shape[0])], axis=0)
u_rolling = np.stack([ (u_extended[i:i+self.rolling_window, :])[::-1,:].reshape(-1) for i in range(x.shape[0])], axis=0)
if not tvp is None:
assert (not self.prev_tvp is None), "You must give history window with set_prev_data before calling any inferance function."
tvp_extended = np.concatenate([self.prev_tvp, tvp], axis=0)
tvp_rolling = np.stack([ (tvp_extended[i:i+self.rolling_window, :])[::-1,:].reshape(-1) for i in range(x.shape[0])], axis=0)
output_np = | np.concatenate([x_rolling, u_rolling], axis=1) | numpy.concatenate |
from pynwb import NWBFile
from pynwb.behavior import BehavioralEvents
from nwb_conversion_tools.converter import NWBConverter
from pathlib import Path
from datetime import datetime
from scipy.io import loadmat
import pandas as pd
import numpy as np
import uuid
class Bpod2NWB(NWBConverter):
def __init__(self, nwbfile=None, metadata=None, source_paths=None):
"""
Reads behavioral data from bpod files and adds it to nwbfile.
Parameters
----------
nwbfile: pynwb.NWBFile
metadata: dict
source_paths: dict
"""
super().__init__(nwbfile=nwbfile, metadata=metadata, source_paths=source_paths)
# Opens -.mat file and loads data
file_behavior_bpod = Path(self.source_paths['file_behavior_bpod']['path'])
self.fdata = loadmat(file_behavior_bpod, struct_as_record=False, squeeze_me=True)
def create_nwbfile(self, metadata_nwbfile):
"""
Overriding method to get session_start_time form bpod files.
"""
nwbfile_args = dict(identifier=str(uuid.uuid4()),)
nwbfile_args.update(**metadata_nwbfile)
session_start_time = self.get_session_start_time()
nwbfile_args.update(**session_start_time)
self.nwbfile = NWBFile(**nwbfile_args)
def get_session_start_time(self):
"""
Gets session_start_time from bpod file.
Returns
-------
dict
"""
file_behavior_bpod = Path(self.source_paths['file_behavior_bpod']['path'])
# Opens -.mat file and extracts data
fdata = loadmat(file_behavior_bpod, struct_as_record=False, squeeze_me=True)
session_start_date = fdata['SessionData'].Info.SessionDate
session_start_time = fdata['SessionData'].Info.SessionStartTime_UTC
date_time_string = session_start_date + ' ' + session_start_time
date_time_obj = datetime.strptime(date_time_string, '%d-%b-%Y %H:%M:%S')
return {'session_start_time': date_time_obj}
def add_behavioral_events(self):
"""
Adds behavioral events from bpod file to nwbfile.
"""
# Summarized trials data
fdata = self.fdata
n_trials = fdata['SessionData'].nTrials
trials_start_times = fdata['SessionData'].TrialStartTimestamp
# Sweep trials to get behavioral events
tup_ts = np.array([])
port_1_in_ts = | np.array([]) | numpy.array |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 Leland Stanford Junior University
# Copyright (c) 2018 The Regents of the University of California
#
# This file is part of pelicun.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. 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.
#
# 3. Neither the name of the copyright holder nor the names of its 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 HOLDER 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.
#
# You should have received a copy of the BSD 3-Clause License along with
# pelicun. If not, see <http://www.opensource.org/licenses/>.
#
# Contributors:
# <NAME>
"""
This subpackage performs system tests on the control module of pelicun.
"""
import pytest
import numpy as np
from numpy.testing import assert_allclose
from scipy.stats import truncnorm as tnorm
from copy import deepcopy
import os, sys, inspect
current_dir = os.path.dirname(
os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(current_dir)
sys.path.insert(0,os.path.dirname(parent_dir))
from pelicun.control import *
from pelicun.uq import mvn_orthotope_density as mvn_od
from pelicun.tests.test_pelicun import prob_allclose, prob_approx
# -----------------------------------------------------------------------------
# FEMA_P58_Assessment
# -----------------------------------------------------------------------------
def test_FEMA_P58_Assessment_central_tendencies():
"""
Perform a loss assessment with customized inputs that reduce the
dispersion of calculation parameters to negligible levels. This allows us
to test the results against pre-defined reference values in spite of the
randomness involved in the calculations.
"""
base_input_path = 'resources/'
DL_input = base_input_path + 'input data/' + "DL_input_test.json"
EDP_input = base_input_path + 'EDP data/' + "EDP_table_test.out"
A = FEMA_P58_Assessment()
A.read_inputs(DL_input, EDP_input, verbose=False)
A.define_random_variables()
# -------------------------------------------------- check random variables
# EDP
RV_EDP = list(A._EDP_dict.values())[0]
assert RV_EDP.theta[0] == pytest.approx(0.5 * g)
assert RV_EDP.theta[1] == pytest.approx(0.5 * g * 1e-6, abs=1e-7)
assert RV_EDP._distribution == 'lognormal'
# QNT
assert A._QNT_dict is None
#RV_QNT = A._RV_dict['QNT']
#assert RV_QNT is None
# FRG
RV_FRG = list(A._FF_dict.values())
thetas, betas = np.array([rv.theta for rv in RV_FRG]).T
assert_allclose(thetas, np.array([0.444, 0.6, 0.984]) * g, rtol=0.01)
assert_allclose(betas, np.array([0.3, 0.4, 0.5]), rtol=0.01)
rho = RV_FRG[0].RV_set.Rho()
assert_allclose(rho, np.ones((3, 3)), rtol=0.01)
assert np.all([rv.distribution == 'lognormal' for rv in RV_FRG])
# RED
RV_RED = list(A._DV_RED_dict.values())
mus, sigmas = np.array([rv.theta for rv in RV_RED]).T
assert_allclose(mus, np.ones(2), rtol=0.01)
assert_allclose(sigmas, np.array([1e-4, 1e-4]), rtol=0.01)
rho = RV_RED[0].RV_set.Rho()
assert_allclose(rho, np.array([[1, 0], [0, 1]]), rtol=0.01)
assert np.all([rv.distribution == 'normal' for rv in RV_RED])
assert_allclose (RV_RED[0].truncation_limits, [0., 2.], rtol=0.01)
assert_allclose (RV_RED[1].truncation_limits, [0., 4.], rtol=0.01)
# INJ
RV_INJ = list(A._DV_INJ_dict.values())
mus, sigmas = np.array([rv.theta for rv in RV_INJ]).T
assert_allclose(mus, np.ones(4), rtol=0.01)
assert_allclose(sigmas, np.ones(4) * 1e-4, rtol=0.01)
rho = RV_INJ[0].RV_set.Rho()
rho_target = np.zeros((4, 4))
np.fill_diagonal(rho_target, 1.)
assert_allclose(rho, rho_target, rtol=0.01)
assert np.all([rv.distribution == 'normal' for rv in RV_INJ])
assert_allclose(RV_INJ[0].truncation_limits, [0., 10./3.], rtol=0.01)
assert_allclose(RV_INJ[1].truncation_limits, [0., 10./3.], rtol=0.01)
assert_allclose(RV_INJ[2].truncation_limits, [0., 10.], rtol=0.01)
assert_allclose(RV_INJ[3].truncation_limits, [0., 10.], rtol=0.01)
# REP
RV_REP = list(A._DV_REP_dict.values())
thetas, betas = np.array([rv.theta for rv in RV_REP]).T
assert_allclose(thetas, np.ones(6), rtol=0.01)
assert_allclose(betas, np.ones(6) * 1e-4, rtol=0.01)
rho = RV_REP[0].RV_set.Rho()
rho_target = np.zeros((6, 6))
np.fill_diagonal(rho_target, 1.)
assert_allclose(rho, rho_target, rtol=0.01)
assert np.all([rv.distribution == 'lognormal' for rv in RV_REP])
# ------------------------------------------------------------------------
A.define_loss_model()
# QNT (deterministic)
QNT = A._FG_dict['T0001.001']._performance_groups[0]._quantity
assert QNT == pytest.approx(50., rel=0.01)
A.calculate_damage()
# ------------------------------------------------ check damage calculation
# TIME
T_check = A._TIME.describe().T.loc[['hour','month','weekday?'],:]
assert_allclose(T_check['mean'], np.array([11.5, 5.5, 5. / 7.]), rtol=0.05)
assert_allclose(T_check['min'], np.array([0., 0., 0.]), rtol=0.01)
assert_allclose(T_check['max'], np.array([23., 11., 1.]), rtol=0.01)
assert_allclose(T_check['50%'], np.array([12., 5., 1.]), atol=1.0)
assert_allclose(T_check['count'], np.array([10000., 10000., 10000.]),
rtol=0.01)
# POP
P_CDF = A._POP.describe(np.arange(1, 27) / 27.).iloc[:, 0].values[4:]
vals, counts = np.unique(P_CDF, return_counts=True)
assert_allclose(vals, np.array([0., 2.5, 5., 10.]), rtol=0.01)
assert_allclose(counts, np.array([14, 2, 7, 5]), atol=1)
# COL
COL_check = A._COL.describe().T
assert COL_check['mean'].values[0] == pytest.approx(0.5, rel=0.05)
assert len(A._ID_dict['non-collapse']) == pytest.approx(5000, rel=0.05)
assert len(A._ID_dict['collapse']) == pytest.approx(5000, rel=0.05)
# DMG
DMG_check = A._DMG.describe().T
assert_allclose(DMG_check['mean'], np.array([17.074, 17.074, 7.9361]),
rtol=0.1, atol=1.0)
assert_allclose(DMG_check['min'], np.zeros(3), rtol=0.01)
assert_allclose(DMG_check['max'], np.ones(3) * 50.0157, rtol=0.05)
# ------------------------------------------------------------------------
A.calculate_losses()
# -------------------------------------------------- check loss calculation
# RED
DV_RED = A._DV_dict['red_tag'].describe().T
assert_allclose(DV_RED['mean'], np.array([0.341344, 0.1586555]), rtol=0.1)
# INJ - collapse
DV_INJ_C = deepcopy(A._COL[['INJ-0', 'INJ-1']])
DV_INJ_C.dropna(inplace=True)
NC_count = DV_INJ_C.describe().T['count'][0]
assert_allclose(NC_count, np.ones(2) * 5000, rtol=0.05)
# lvl 1
vals, counts = np.unique(DV_INJ_C.iloc[:, 0].values, return_counts=True)
assert_allclose(vals, np.array([0., 2.5, 5., 10.]) * 0.1, rtol=0.01)
assert_allclose(counts / NC_count, np.array([14, 2, 7, 5]) / 28., atol=0.01, rtol=0.1)
# lvl 2
vals, counts = np.unique(DV_INJ_C.iloc[:, 1].values, return_counts=True)
assert_allclose(vals, np.array([0., 2.5, 5., 10.]) * 0.9, rtol=0.01)
assert_allclose(counts / NC_count, np.array([14, 2, 7, 5]) / 28., atol=0.01, rtol=0.1)
# INJ - non-collapse
DV_INJ_NC = deepcopy(A._DV_dict['injuries'])
DV_INJ_NC[0].dropna(inplace=True)
assert_allclose(DV_INJ_NC[0].describe().T['count'], np.ones(2) * 5000,
rtol=0.05)
# lvl 1 DS2
I_CDF = DV_INJ_NC[0].iloc[:, 0]
I_CDF = np.around(I_CDF, decimals=3)
vals, counts = np.unique(I_CDF, return_counts=True)
assert_allclose(vals, np.array([0., 0.075, 0.15, 0.3]), rtol=0.01)
target_prob = np.array(
[0.6586555, 0., 0., 0.] + 0.3413445 * np.array([14, 2, 7, 5]) / 28.)
assert_allclose(counts / NC_count, target_prob, atol=0.01, rtol=0.1)
# lvl 1 DS3
I_CDF = DV_INJ_NC[0].iloc[:, 1]
I_CDF = np.around(I_CDF, decimals=3)
vals, counts = np.unique(I_CDF, return_counts=True)
assert_allclose(vals, np.array([0., 0.075, 0.15, 0.3]), rtol=0.01)
target_prob = np.array(
[0.8413445, 0., 0., 0.] + 0.1586555 * np.array([14, 2, 7, 5]) / 28.)
assert_allclose(counts / NC_count, target_prob, atol=0.01, rtol=0.1)
# lvl 2 DS2
I_CDF = DV_INJ_NC[1].iloc[:, 0]
I_CDF = np.around(I_CDF, decimals=3)
vals, counts = np.unique(I_CDF, return_counts=True)
assert_allclose(vals, np.array([0., 0.025, 0.05, 0.1]), rtol=0.01)
target_prob = np.array(
[0.6586555, 0., 0., 0.] + 0.3413445 * np.array([14, 2, 7, 5]) / 28.)
assert_allclose(counts / NC_count, target_prob, atol=0.01, rtol=0.1)
# lvl2 DS3
I_CDF = DV_INJ_NC[1].iloc[:, 1]
I_CDF = np.around(I_CDF, decimals=3)
vals, counts = np.unique(I_CDF, return_counts=True)
assert_allclose(vals, np.array([0., 0.025, 0.05, 0.1]), rtol=0.01)
target_prob = np.array(
[0.8413445, 0., 0., 0.] + 0.1586555 * np.array([14, 2, 7, 5]) / 28.)
assert_allclose(counts / NC_count, target_prob, atol=0.01, rtol=0.1)
# REP
assert len(A._ID_dict['non-collapse']) == len(A._ID_dict['repairable'])
assert len(A._ID_dict['irreparable']) == 0
# cost
DV_COST = A._DV_dict['rec_cost']
# DS1
C_CDF = DV_COST.iloc[:, 0]
C_CDF = np.around(C_CDF / 10., decimals=0) * 10.
vals, counts = np.unique(C_CDF, return_counts=True)
assert_allclose(vals, [0, 2500], rtol=0.01)
t_prob = 0.3413445
assert_allclose(counts / NC_count, [1. - t_prob, t_prob], rtol=0.1)
# DS2
C_CDF = DV_COST.iloc[:, 1]
C_CDF = np.around(C_CDF / 100., decimals=0) * 100.
vals, counts = np.unique(C_CDF, return_counts=True)
assert_allclose(vals, [0, 25000], rtol=0.01)
t_prob = 0.3413445
assert_allclose(counts / NC_count, [1. - t_prob, t_prob], rtol=0.1)
# DS3
C_CDF = DV_COST.iloc[:, 2]
C_CDF = np.around(C_CDF / 1000., decimals=0) * 1000.
vals, counts = np.unique(C_CDF, return_counts=True)
assert_allclose(vals, [0, 250000], rtol=0.01)
t_prob = 0.1586555
assert_allclose(counts / NC_count, [1. - t_prob, t_prob], rtol=0.1)
# time
DV_TIME = A._DV_dict['rec_time']
# DS1
T_CDF = DV_TIME.iloc[:, 0]
T_CDF = np.around(T_CDF, decimals=1)
vals, counts = np.unique(T_CDF, return_counts=True)
assert_allclose(vals, [0, 2.5], rtol=0.01)
t_prob = 0.3413445
assert_allclose(counts / NC_count, [1. - t_prob, t_prob], rtol=0.1)
# DS2
T_CDF = DV_TIME.iloc[:, 1]
T_CDF = np.around(T_CDF, decimals=0)
vals, counts = np.unique(T_CDF, return_counts=True)
assert_allclose(vals, [0, 25], rtol=0.01)
t_prob = 0.3413445
assert_allclose(counts / NC_count, [1. - t_prob, t_prob], rtol=0.1)
# DS3
T_CDF = DV_TIME.iloc[:, 2]
T_CDF = np.around(T_CDF / 10., decimals=0) * 10.
vals, counts = np.unique(T_CDF, return_counts=True)
assert_allclose(vals, [0, 250], rtol=0.01)
t_prob = 0.1586555
assert_allclose(counts / NC_count, [1. - t_prob, t_prob], rtol=0.1)
# ------------------------------------------------------------------------
A.aggregate_results()
# ------------------------------------------------ check result aggregation
S = A._SUMMARY
SD = S.describe().T
assert_allclose(S[('event time', 'month')], A._TIME['month'] + 1)
assert_allclose(S[('event time', 'weekday?')], A._TIME['weekday?'])
assert_allclose(S[('event time', 'hour')], A._TIME['hour'])
assert_allclose(S[('inhabitants', '')], A._POP.iloc[:, 0])
assert SD.loc[('collapses', 'collapsed'), 'mean'] == pytest.approx(0.5,
rel=0.05)
assert SD.loc[('collapses', 'mode'), 'mean'] == 0.
assert SD.loc[('collapses', 'mode'), 'count'] == pytest.approx(5000,
rel=0.05)
assert SD.loc[('red tagged', ''), 'mean'] == pytest.approx(0.5, rel=0.05)
assert SD.loc[('red tagged', ''), 'count'] == pytest.approx(5000, rel=0.05)
for col in ['irreparable', 'cost impractical', 'time impractical']:
assert SD.loc[('reconstruction', col), 'mean'] == 0.
assert SD.loc[('reconstruction', col), 'count'] == pytest.approx(5000,
rel=0.05)
RC = deepcopy(S.loc[:, ('reconstruction', 'cost')])
RC_CDF = np.around(RC / 1000., decimals=0) * 1000.
vals, counts = np.unique(RC_CDF, return_counts=True)
assert_allclose(vals, np.array([0, 2., 3., 25., 250., 300.]) * 1000.)
t_prob1 = 0.3413445 / 2.
t_prob2 = 0.1586555 / 2.
assert_allclose(counts / 10000.,
[t_prob2, t_prob1 / 2., t_prob1 / 2., t_prob1, t_prob2,
0.5], atol=0.01, rtol=0.1)
RT = deepcopy(S.loc[:, ('reconstruction', 'time-parallel')])
RT_CDF = np.around(RT, decimals=0)
vals, counts = np.unique(RT_CDF, return_counts=True)
assert_allclose(vals, np.array([0, 2., 3., 25., 250., 300.]))
t_prob1 = 0.3413445 / 2.
t_prob2 = 0.1586555 / 2.
assert_allclose(counts / 10000.,
[t_prob2, t_prob1 / 2., t_prob1 / 2., t_prob1, t_prob2,
0.5], atol=0.01, rtol=0.1)
assert_allclose(S.loc[:, ('reconstruction', 'time-parallel')],
S.loc[:, ('reconstruction', 'time-sequential')])
CAS = deepcopy(S.loc[:, ('injuries', 'sev1')])
CAS_CDF = np.around(CAS, decimals=3)
vals, counts = np.unique(CAS_CDF, return_counts=True)
assert_allclose(vals, [0, 0.075, 0.15, 0.25, 0.3, 0.5, 1.])
assert_allclose(counts / 10000.,
np.array([35, 1, 3.5, 2, 2.5, 7, 5]) / 56., atol=0.01,
rtol=0.1)
CAS = deepcopy(S.loc[:, ('injuries', 'sev2')])
CAS_CDF = np.around(CAS, decimals=3)
vals, counts = np.unique(CAS_CDF, return_counts=True)
assert_allclose(vals, [0, 0.025, 0.05, 0.1, 2.25, 4.5, 9.])
assert_allclose(counts / 10000.,
np.array([35, 1, 3.5, 2.5, 2, 7, 5]) / 56., atol=0.01,
rtol=0.1)
def test_FEMA_P58_Assessment_EDP_uncertainty_basic():
"""
Perform a loss assessment with customized inputs that focus on testing the
methods used to estimate the multivariate lognormal distribution of EDP
values. Besides the fitting, this test also evaluates the propagation of
EDP uncertainty through the analysis. Dispersions in other calculation
parameters are reduced to negligible levels. This allows us to test the
results against pre-defined reference values in spite of the randomness
involved in the calculations.
"""
base_input_path = 'resources/'
DL_input = base_input_path + 'input data/' + "DL_input_test_2.json"
EDP_input = base_input_path + 'EDP data/' + "EDP_table_test_2.out"
A = FEMA_P58_Assessment()
A.read_inputs(DL_input, EDP_input, verbose=False)
A.define_random_variables()
# -------------------------------------------------- check random variables
# EDP
RV_EDP = list(A._EDP_dict.values())
thetas, betas = np.array([rv.theta for rv in RV_EDP]).T
assert_allclose(thetas, [9.80665, 12.59198, 0.074081, 0.044932], rtol=0.02)
assert_allclose(betas, [0.25, 0.25, 0.3, 0.4], rtol=0.02)
rho = RV_EDP[0].RV_set.Rho()
rho_target = [
[1.0, 0.6, 0.3, 0.3],
[0.6, 1.0, 0.3, 0.3],
[0.3, 0.3, 1.0, 0.7],
[0.3, 0.3, 0.7, 1.0]]
assert_allclose(rho, rho_target, atol=0.05)
assert np.all([rv.distribution == 'lognormal' for rv in RV_EDP])
# ------------------------------------------------------------------------
A.define_loss_model()
A.calculate_damage()
# ------------------------------------------------ check damage calculation
# COL
COL_check = A._COL.describe().T
col_target = 1.0 - mvn_od(np.log([0.074081, 0.044932]),
np.array([[1, 0.7], [0.7, 1]]) * np.outer(
[0.3, 0.4], [0.3, 0.4]),
upper=np.log([0.1, 0.1]))[0]
assert COL_check['mean'].values[0] == pytest.approx(col_target, rel=0.1)
# DMG
DMG_check = [len(np.where(A._DMG.iloc[:, i] > 0.0)[0]) / 10000. for i in
range(8)]
DMG_1_PID = mvn_od(np.log([0.074081, 0.044932]),
np.array([[1, 0.7], [0.7, 1]]) * np.outer([0.3, 0.4],
[0.3, 0.4]),
lower=np.log([0.05488, 1e-6]), upper=np.log([0.1, 0.1]))[
0]
DMG_2_PID = mvn_od(np.log([0.074081, 0.044932]),
np.array([[1, 0.7], [0.7, 1]]) * np.outer([0.3, 0.4],
[0.3, 0.4]),
lower=np.log([1e-6, 0.05488]), upper=np.log([0.1, 0.1]))[
0]
DMG_1_PFA = mvn_od(np.log([0.074081, 9.80665]),
np.array([[1, 0.3], [0.3, 1]]) * np.outer([0.3, 0.25],
[0.3, 0.25]),
lower=np.log([1e-6, 9.80665]),
upper=np.log([0.1, np.inf]))[0]
DMG_2_PFA = mvn_od(np.log([0.074081, 12.59198]),
np.array([[1, 0.3], [0.3, 1]]) * np.outer([0.3, 0.25],
[0.3, 0.25]),
lower=np.log([1e-6, 9.80665]),
upper=np.log([0.1, np.inf]))[0]
assert DMG_check[0] == pytest.approx(DMG_check[1], rel=0.01)
assert DMG_check[2] == pytest.approx(DMG_check[3], rel=0.01)
assert DMG_check[4] == pytest.approx(DMG_check[5], rel=0.01)
assert DMG_check[6] == pytest.approx(DMG_check[7], rel=0.01)
assert DMG_check[0] == pytest.approx(DMG_1_PID, rel=0.10)
assert DMG_check[2] == pytest.approx(DMG_2_PID, rel=0.10)
assert DMG_check[4] == pytest.approx(DMG_1_PFA, rel=0.10)
assert DMG_check[6] == pytest.approx(DMG_2_PFA, rel=0.10)
# ------------------------------------------------------------------------
A.calculate_losses()
# -------------------------------------------------- check loss calculation
# COST
DV_COST = A._DV_dict['rec_cost']
DV_TIME = A._DV_dict['rec_time']
C_target = [0., 250., 1250.]
T_target = [0., 0.25, 1.25]
# PG 1011 and 1012
P_target = [
mvn_od(np.log([0.074081, 0.044932]),
np.array([[1, 0.7], [0.7, 1]]) * np.outer([0.3, 0.4],
[0.3, 0.4]),
lower=np.log([1e-6, 1e-6]), upper=np.log([0.05488, 0.1]))[0],
mvn_od(np.log([0.074081, 0.044932]),
np.array([[1, 0.7], [0.7, 1]]) * np.outer([0.3, 0.4],
[0.3, 0.4]),
lower=np.log([0.05488, 0.05488]), upper=np.log([0.1, 0.1]))[0],
mvn_od(np.log([0.074081, 0.044932]),
np.array([[1, 0.7], [0.7, 1]]) * np.outer([0.3, 0.4],
[0.3, 0.4]),
lower=np.log([0.05488, 1e-6]), upper=np.log([0.1, 0.05488]))[0],
]
for i in [0, 1]:
C_test, P_test = np.unique(
np.around(DV_COST.iloc[:, i].values / 10., decimals=0) * 10.,
return_counts=True)
C_test = C_test[np.where(P_test > 10)]
T_test, P_test = np.unique(
np.around(DV_TIME.iloc[:, i].values * 100., decimals=0) / 100.,
return_counts=True)
T_test = T_test[np.where(P_test > 10)]
P_test = P_test[np.where(P_test > 10)]
P_test = P_test / 10000.
assert_allclose(P_target, P_test, atol=0.02)
assert_allclose(C_target, C_test, rtol=0.001)
assert_allclose(T_target, T_test, rtol=0.001)
# PG 1021 and 1022
P_target = [
mvn_od(np.log([0.074081, 0.044932]),
np.array([[1, 0.7], [0.7, 1]]) * np.outer([0.3, 0.4],
[0.3, 0.4]),
lower=np.log([1e-6, 1e-6]), upper=np.log([0.1, 0.05488]))[0],
mvn_od(np.log([0.074081, 0.044932]),
np.array([[1, 0.7], [0.7, 1]]) * np.outer([0.3, 0.4],
[0.3, 0.4]),
lower=np.log([0.05488, 0.05488]), upper=np.log([0.1, 0.1]))[0],
mvn_od(np.log([0.074081, 0.044932]),
| np.array([[1, 0.7], [0.7, 1]]) | numpy.array |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
########################################################################################################################
# Copyright © 2019 The George Washington University.
# All Rights Reserved.
#
# Contributors: <NAME> <<EMAIL>>
#
# Licensed under the BSD-3-Clause License (the "License").
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at: https://opensource.org/licenses/BSD-3-Clause
#
# BSD-3-Clause License:
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided
# that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
# following disclaimer.
#
# 2. 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.
#
# 3. Neither the name of the copyright holder nor the names of its 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 HOLDER 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.
########################################################################################################################
"""
Helper functions for post-processing.
"""
import os
import numpy
from clawpack import pyclaw
def get_min_value(solution, field=0):
"""
Get the minimum value in a field in a solution.
"""
min_val = 1e38
for state in solution.states:
min_temp = state.q[field, :, :].min()
if min_temp < min_val:
min_val = min_temp
return min_val
def get_max_value(solution, field=0):
"""
Get the maximum value in a field in a solution.
"""
max_val = 0.
for state in solution.states:
max_temp = state.q[field, :, :].max()
if max_temp > max_val:
max_val = max_temp
return max_val
def get_max_AMR_level(solution):
"""
Get the max AMR level in a solution object.
"""
max_level = 1
for state in solution.states:
p = state.patch
if p.level > max_level:
max_level = p.level
return max_level
def plot_at_axes(solution, ax, field=0, border=False,
min_level=2, max_level=None, vmin=None, vmax=None,
threshold=1e-4, cmap="viridis"):
"""Plot solution.
Plot a field in the q array of a solution object.
Args:
solution [in]: pyClaw solution object.
ax [inout]: matplotlib axes object.
field [in]: target field to be plot:
0 - depth;
1 - hu conservative field;
2 - hv conservative field;
3 - eta (elevation + depth)
border [in]: a boolean indicating whether to plot grid patch borders.
min_levle [in]: the minimum level of AMR grid to be plotted.
max_levle [in]: the maximum level of AMR grid to be plotted.
vmin [in]: value of the minimum value of the colorbar.
vmax [in]: value of the maximum value of the colorbar.
threshold [in]: values below this threshold will be clipped off.
cmap [in]: pyplot colorbar theme.
Return:
pyplot image object/handler, or None.
"""
if vmin is None:
vmin = get_min_value(solution, field)
if vmax is None:
vmax = get_max_value(solution, field)
for state in solution.states:
p = state.patch
if p.level < min_level:
continue
if max_level is not None and max_level < p.level:
continue
x, dx = numpy.linspace(p.lower_global[0], p.upper_global[0],
p.num_cells_global[0]+1, retstep=True)
y, dy = numpy.linspace(p.lower_global[1], p.upper_global[1],
p.num_cells_global[1]+1, retstep=True)
assert numpy.abs(dx-p.delta[0]) < 1e-6, "{} {}".format(dx, p.delta[0])
assert numpy.abs(dy-p.delta[1]) < 1e-6, "{} {}".format(dy, p.delta[1])
im = ax.pcolormesh(
x, y, | numpy.ma.masked_less(state.q[field, :, :], threshold) | numpy.ma.masked_less |
# File :ConPolyProcess.py
# Author :WJ
# Function :
# Time :2021/01/22
# Version :
# Amend :
import matplotlib.pyplot as plt
import numpy as np
import math
import time
def maxPoints(points):
# write your code here
# 神坑,还有一个点的情况,哎
if len(points) == 1:
return 1
# 任意两个点练成一条直线,判断是否再这条直线上
# 获取两个点
max = 0
a = 0
a_max = 0
b_max = 0
MAX = []
A = []
B = []
for i in range(len(points)):
for j in range(len(points)):
if i != j:
pointcount = 0
# 拿到两个点,获得矢量
# 排除一种x2-x1 = 0 的情况
b = points[j, 0] - points[i, 0]
if b == 0:
# 遍历找到都在这条直线上的点
for t in range(len(points)):
if points[t, 0] == points[i, 0]:
pointcount = pointcount + 1
else:
# 根据公式 a= (y2-y1)/(x2-x1)
a = (points[j, 1] - points[i, 1]) / b
b = -a * points[i, 0] + points[i, 1]
# 遍历其他点是否再这条直线上
pointcount = 1
for k in range(len(points)):
if (points[k, 0] != points[i, 0]):
if abs(points[k, 1] - (a * (points[k, 0] - points[i, 0]) + points[i, 1])) / math.sqrt(
1 + a * a) < 1:
pointcount = pointcount + 1
if max < pointcount:
max = pointcount
a_max = a
b_max = b
MAX.append(max)
A.append(a_max)
B.append(b_max)
return MAX[np.argmax(MAX)], A[np.argmax(MAX)], B[np.argmax(MAX)]
def delete_linepoints(data1, a, b, distance=1):
K = []
for k in range(len(data1)):
if abs(data1[k, 1] - (a * data1[k, 0] + b)) / math.sqrt(1 + a * a) < distance:
K.append(k)
K.sort(reverse=True)
line = data1[K, :]
x01 = | np.argmin(line[:, 0]) | numpy.argmin |
# -*- coding: utf-8 -*-
"""
Fast Linear Attitude Estimator
==============================
The Fast Linear Attitude Estimator (FLAE) obtains the attitude quaternion with
an eigenvalue-based solution as proposed by [Wu]_.
A symbolic solution to the corresponding characteristic polynomial is also
derived for a higher computation speed.
One-Dimensional Fusion
----------------------
We assume that we have a single observable (can be measured) frame. The sensor
outputs can be rotated with a :math:`3\\times 3` `Direction Cosine Matrix
<../dcm.html>`_ :math:`\\mathbf{C}` using:
.. math::
\\mathbf{D}^b = \\mathbf{CD}^r
where :math:`\\mathbf{D}^b=\\begin{bmatrix}D_x^b & D_y^b & D_z^b\\end{bmatrix}^T`
is the observation vector in body frame and
:math:`\\mathbf{D}^r=\\begin{bmatrix}D_x^r & D_y^r & D_z^r\\end{bmatrix}^T` is
the observation vector in reference frame. To put it in terms of a quaternion,
we define the loss function :math:`\\mathbf{f}_D(\\mathbf{q})` as:
.. math::
\\mathbf{f}_D(\\mathbf{q}) \\triangleq \\mathbf{CD}^r - \\mathbf{D}^b
where the quaternion :math:`\\mathbf{q}` is defined as:
.. math::
\\begin{array}{rcl}
\\mathbf{q}&=&\\begin{pmatrix}q_w & q_x & q_y & q_z\\end{pmatrix}^T \\\\
&=& \\begin{pmatrix}\\cos\\frac{\\theta}{2} & n_x\\sin\\frac{\\theta}{2} & n_y\\sin\\frac{\\theta}{2} & n_z\\sin\\frac{\\theta}{2}\\end{pmatrix}^T
\\end{array}
The purpose is to *minimize the loss function*. We start by expanding
:math:`\\mathbf{f}_D(\\mathbf{q})`:
.. math::
\\begin{array}{rcl}
\\mathbf{f}_D(\\mathbf{q}) &=& \\mathbf{CD}^r - \\mathbf{D}^b \\\\
&=& \\mathbf{P}_D\\mathbf{q} - \\mathbf{D}^b \\\\
&=& (D_x^r\\mathbf{P}_1 + D_y^r\\mathbf{P}_2 + D_z^r\\mathbf{P}_3)\\mathbf{q} - \\mathbf{D}^b \\\\
&=& D_x^r\\mathbf{C}_1 + D_y^r\\mathbf{C}_2 + D_z^r\\mathbf{C}_3 - \\mathbf{D}^b
\\end{array}
where :math:`\\mathbf{C}_1`, :math:`\\mathbf{C}_2` and :math:`\\mathbf{C}_3`
are the columns of :math:`\\mathbf{C}` represented as:
.. math::
\\begin{array}{rcl}
\\mathbf{C}_1 &=& \\mathbf{P}_1\\mathbf{q} = \\begin{bmatrix}q_w^2+q_x^2-q_y^2-q_z^2 \\\\ 2(q_xq_y + q_wq_z) \\\\ 2(q_xq_z - q_wq_y) \\end{bmatrix} \\\\ && \\\\
\\mathbf{C}_2 &=& \\mathbf{P}_2\\mathbf{q} = \\begin{bmatrix}2(q_xq_y - q_wq_z) \\\\ q_w^2-q_x^2+q_y^2-q_z^2 \\\\2(q_wq_x + q_yq_z) \\end{bmatrix} \\\\ && \\\\
\\mathbf{C}_3 &=& \\mathbf{P}_3\\mathbf{q} = \\begin{bmatrix}2(q_xq_z + q_wq_y) \\\\ 2(q_yq_z - q_wq_x) \\\\ q_w^2-q_x^2-q_y^2+q_z^2 \\end{bmatrix}
\\end{array}
When :math:`\\mathbf{q}` is optimal, it satisfies:
.. math::
\\mathbf{q} = \\mathbf{P}_D^\\dagger \\mathbf{D}^b
where :math:`\\mathbf{P}_D^\\dagger` is the `pseudo-inverse
<https://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_inverse>`_ of
:math:`\\mathbf{P}_D` *if and only if* it has full rank.
.. note::
A matrix is said to have **full rank** if its `rank
<https://en.wikipedia.org/wiki/Rank_(linear_algebra)>`_ is equal to the
largest possible for a matrix of the same dimensions, which is the lesser
of the number of rows and columns.
The analytical form of any pseudo-inverse is normally difficult to obtain, but
thanks to the orthogonality of :math:`\\mathbf{P}_D` we get:
.. math::
\\mathbf{P}_D^\\dagger = \\mathbf{P}_D^T = D_x^r\\mathbf{P}_1^T + D_y^r\\mathbf{P}_2^T + D_z^r\\mathbf{P}_3^T
The orientation :math:`\\mathbf{q}` is obtained from:
.. math::
\\mathbf{P}_D^\\dagger\\mathbf{D}^b - \\mathbf{q} = \\mathbf{Gq}
Solving :math:`\\mathbf{Gq}=0` (*if and only if* :math:`\\mathrm{det}(\\mathbf{G})=0`)
using elementary row transformations we obtain the wanted orthonormal quaternion.
N-Dimensional Fusion
--------------------
We assume having :math:`n` observation equations, such that the error residual
vector is given by augmenting :math:`\\mathbf{f}_D(\\mathbf{q})` as:
.. math::
\\mathbf{f}_{\\Sigma D}(\\mathbf{q}) =
\\begin{bmatrix}
\\sqrt{a_1}(\\mathbf{P}_{D_1}\\mathbf{q}-D_1^b) \\\\
\\sqrt{a_2}(\\mathbf{P}_{D_2}\\mathbf{q}-D_2^b) \\\\
\\vdots \\\\
\\sqrt{a_n}(\\mathbf{P}_{D_n}\\mathbf{q}-D_n^b)
\\end{bmatrix}
When :math:`\\mathbf{f}_{\\Sigma D}(\\mathbf{q})=0`, the equation satisfies:
.. math::
\\begin{array}{rcl}
\\mathbf{P}_{\\Sigma D}\\mathbf{q} &=& \\mathbf{D}_\\Sigma^b \\\\
\\begin{bmatrix}
\\sqrt{a_1}\\mathbf{P}_{D_1} \\\\
\\sqrt{a_2}\\mathbf{P}_{D_2} \\\\
\\vdots \\\\
\\sqrt{a_n}\\mathbf{P}_{D_n}
\\end{bmatrix}\\mathbf{q} &=&
\\begin{bmatrix}
\\sqrt{a_1}\\mathbf{D}_1^b \\\\
\\sqrt{a_2}\\mathbf{D}_2^b \\\\
\\vdots \\\\
\\sqrt{a_n}\\mathbf{D}_n^b
\\end{bmatrix}
\\end{array}
Intuitively, we would solve it with :math:`\mathbf{q}=\\mathbf{P}_{\\Sigma D}^\\dagger\\mathbf{D}_\\Sigma^b`,
but the pseudo-inverse of :math:`\\mathbf{P}_{\\Sigma D}` is very difficult to
compute. However, it is possible to transform the equation by the pseudo-inverse
matrices of :math:`\\mathbf{q}` and :math:`\\mathbf{D}_\\Sigma^b`:
.. math::
\\mathbf{q}^\\dagger = (\\mathbf{D}_\\Sigma^b)^\\dagger \\mathbf{P}_{\\Sigma D}
:math:`\\mathbf{P}_{\\Sigma D}` can be further expanded into:
.. math::
\\mathbf{P}_{\\Sigma D} = \\mathbf{U}_{D_x}\\mathbf{P}_1 + \\mathbf{U}_{D_y}\\mathbf{P}_2 + \\mathbf{U}_{D_z}\\mathbf{P}_3
where :math:`\\mathbf{P}_1`, :math:`\\mathbf{P}_2` and :math:`\\mathbf{P}_3`
are :math:`3\\times 4` matrices, and :math:`\\mathbf{U}_{D_x}`,
:math:`\\mathbf{U}_{D_y}` and :math:`\\mathbf{U}_{D_z}` are :math:`3n\\times 3`
matrices. Hence,
.. math::
(\\mathbf{D}_\\Sigma^b)^\\dagger\\mathbf{P}_{\\Sigma D} = (\\mathbf{D}_\\Sigma^b)^\\dagger\\mathbf{U}_{D_x}\\mathbf{P}_1 + (\\mathbf{D}_\\Sigma^b)^\\dagger\\mathbf{U}_{D_y}\\mathbf{P}_2 + (\\mathbf{D}_\\Sigma^b)^\\dagger\\mathbf{U}_{D_z}\\mathbf{P}_3
The fusion equation finally arrives to:
.. math::
\\mathbf{H}_x\\mathbf{P}_1 + \\mathbf{H}_y\\mathbf{P}_2 + \\mathbf{H}_z\\mathbf{P}_3 - \\mathbf{q}^\\dagger = \\mathbf{0}_{1\\times 4}
where :math:`\\mathbf{H}_x`, :math:`\\mathbf{H}_y` and :math:`\\mathbf{H}_z`
are :math:`1\\times 3` matrices
.. math::
\\begin{array}{rcl}
\\mathbf{H}_x &= (\\mathbf{D}_\\Sigma^b)^\\dagger\\mathbf{U}_{D_x} =&
\\begin{bmatrix} \\sum_{i=1}^n a_iD_{x,i}^rD_{x,i}^b & \\sum_{i=1}^n a_iD_{x,i}^rD_{y,i}^b & \\sum_{i=1}^n a_iD_{x,i}^rD_{z,i}^b & \\end{bmatrix} \\\\ && \\\\
\\mathbf{H}_y &= (\\mathbf{D}_\\Sigma^b)^\\dagger\\mathbf{U}_{D_y} =&
\\begin{bmatrix} \\sum_{i=1}^n a_iD_{y,i}^rD_{x,i}^b & \\sum_{i=1}^n a_iD_{y,i}^rD_{y,i}^b & \\sum_{i=1}^n a_iD_{y,i}^rD_{z,i}^b & \\end{bmatrix} \\\\ && \\\\
\\mathbf{H}_z &= (\\mathbf{D}_\\Sigma^b)^\\dagger\\mathbf{U}_{D_z} =&
\\begin{bmatrix} \\sum_{i=1}^n a_iD_{z,i}^rD_{x,i}^b & \\sum_{i=1}^n a_iD_{z,i}^rD_{y,i}^b & \\sum_{i=1}^n a_iD_{z,i}^rD_{z,i}^b & \\end{bmatrix}
\\end{array}
Refactoring the equation with a transpose operation, we obtain:
.. math::
\\begin{array}{rcl}
\\mathbf{P}_1^T\\mathbf{H}_x^T + \\mathbf{P}_2^T\\mathbf{H}_y^T + \\mathbf{P}_3^T\\mathbf{H}_z^T - \\mathbf{q} &=& \\mathbf{0} \\\\
(\\mathbf{W} - \\mathbf{I})\\mathbf{q} &=& \\mathbf{0}
\\end{array}
where the elements of :math:`\\mathbf{W}` are given by:
.. math::
\\mathbf{W} =
\\begin{bmatrix}
H_{x1} + H_{y2} + H_{z3} & -H_{y3} + H_{z2} & -H_{z1} + H_{x3} & -H_{x2} + H_{y1} \\\\
-H_{y3} + H_{z2} & H_{x1} - H_{y2} - H_{z3} & H_{x2} + H_{y1} & H_{x3} + H_{z1} \\\\
-H_{z1} + H_{x3} & H_{x2} + H_{y1} & H_{y2} - H_{x1} - H_{z3} & H_{y3} + H_{z2} \\\\
-H_{x2} + H_{y1} & H_{x3} + H_{z1} & H_{y3} + H_{x2} & H_{z3} - H_{y2} - H_{x1}
\\end{bmatrix}
Eigenvector solution
--------------------
The simplest solution is to find the eigenvector corresponding to the largest
eigenvalue of :math:`\\mathbf{W}`, as used by `Davenport's <davenport.html>`_
q-method.
This has the advantage of returning a normalized and valid quaternion, which is
used to represent the attitude.
This method's main disadvantage is :math:`(\\mathbf{W}-\\mathbf{I})` suffering
from rank-deficient problems in the sensor outputs, besides its computational
cost.
Characteristic Polynomial
-------------------------
The fusion equation can be transformed by adding a small quaternion error
:math:`\\epsilon \\mathbf{q}`
.. math::
\\mathbf{Wq} = (1+\\epsilon)\\mathbf{q}
recognizing that :math:`1+\\epsilon` is an eigenvalue of :math:`\\mathbf{W}`
the problem is now shifted to find the eigenvalue that is closest to 1.
Analytically the calculation of the eigenvalue of :math:`\\mathbf{W}` builds
first its characteristic polynomial as:
.. math::
\\begin{array}{rcl}
f(\\lambda) &=& \\mathrm{det}(\\mathbf{W}-\\lambda\\mathbf{I}_{4\\times 4}) \\\\
&=& \\lambda^4 + \\tau_1\\lambda^2 + \\tau_2\\lambda + \\tau_3
\\end{array}
where the coefficients are obtained from:
.. math::
\\begin{array}{rcl}
\\tau_1 &=& -2\\big(H_{x1}^2 + H_{x2}^2 + H_{x3}^2 + H_{y1}^2 + H_{y2}^2 + H_{y3}^2 + H_{z1}^2 + H_{z2}^2 + H_{z3}^2\\big) \\\\ && \\\\
\\tau_2 &=& 8\\big(H_{x3}H_{y2}H_{z1} - H_{x2}H_{y3}H_{z1} - H_{x3}H_{y1}H_{z2} + H_{x1}H_{y3}H_{z2} + H_{x2}H_{y1}H_{z3} - H_{x1}H_{y2}H_{z3}\\big) \\\\ && \\\\
\\tau_3 &=& \\mathrm{det}(\\mathbf{W})
\\end{array}
Once :math:`\\lambda` is defined, the eigenvector can be obtained using
elementary row operations (Gaussian elimination).
There are two main methods to compute the optimal :math:`\\lambda`:
**1. Iterative Newton-Raphson method**
This 4th-order characteristic polynomial :math:`f(\\lambda)` can be solved with
the `Newton-Raphson's method <https://en.wikipedia.org/wiki/Newton%27s_method>`_
and the aid of its derivative, which is found to be:
.. math::
f'(\\lambda) = 4\\lambda^3 + 2\\tau_1\\lambda + \\tau_2
The initial value for the root finding process can be set to 1, because
:math:`\\lambda` is very close to it. So, every iteration at :math:`n` updates
:math:`\\lambda` as:
.. math::
\\lambda_{n+1} \\gets \\lambda_n - \\frac{f\\big(\\lambda_n\\big)}{f'\\big(\\lambda_n\\big)}
= \\lambda_n - \\frac{\\lambda_n^4 + \\tau_1\\lambda_n^2 + \\tau_2\\lambda_n + \\tau_3}{4\\lambda_n^3 + 2\\tau_1\\lambda_n + \\tau_2}
The value of :math:`\\lambda` is commonly found after a couple iterations, but
the accuracy is not linear with the iteration steps and will not always achieve
good results.
**2. Symbolic method**
A more precise solution involves a symbolic approach, where four solutions to
the characteristic polynomial are obtained as follows:
.. math::
\\begin{array}{rcl}
\\lambda_1 &=& \\alpha \\Big(T_2 - \\sqrt{k_1 - k_2}\\Big) \\\\ && \\\\
\\lambda_2 &=& \\alpha \\Big(T_2 + \\sqrt{k_1 - k_2}\\Big) \\\\ && \\\\
\\lambda_3 &=& -\\alpha \\Big(T_2 + \\sqrt{k_1 + k_2}\\Big) \\\\ && \\\\
\\lambda_4 &=& -\\alpha \\Big(T_2 - \\sqrt{k_1 + k_2}\\Big) \\\\
\\end{array}
with the helper variables:
.. math::
\\begin{array}{rcl}
\\alpha &=& \\frac{1}{2\\sqrt{6}} \\\\ && \\\\
k_1 &=& -T_2^2-12\\tau_1 \\\\ && \\\\
k_2 &=& \\frac{12\\sqrt{6}\\tau_2}{T_2} \\\\ && \\\\
T_0 &=& 2\\tau_1^3 + 27\\tau_2^2 - 72\\tau_1\\tau_3 \\\\ && \\\\
T_1 &=& \\Big(T_0 + \\sqrt{-4(t_1^2+12\\tau_3)^3 + T_0^2}\\Big)^{\\frac{1}{3}} \\\\ && \\\\
T_2 &=& \\sqrt{-4\\tau_1 + \\frac{2^{\\frac{4}{3}}(\\tau_1^2+12\\tau_3)}{T_1} + 2^{\\frac{2}{3}}T_1}
\\end{array}
Then chose the :math:`\\lambda`, which is closest to 1. This way solving for
:math:`\\lambda` is truly shortened.
Optimal Quaternion
------------------
Having :math:`\\mathbf{N}=\\mathbf{W}-\\lambda\\mathbf{I}_{4\\times 4}`, the
matrix can be transformed via row operations to:
.. math::
\\mathbf{N} \\to \\mathbf{N}' = \\begin{bmatrix}
1 & 0 & 0 & \\chi \\\\ 0 & 1 & 0 & \\rho \\\\ 0 & 0 & 1 & \\upsilon \\\\ 0 & 0 & 0 & \\zeta
\\end{bmatrix}
where :math:`\\zeta` is usually a very small number. To ensure that
:math:`(\\mathbf{W}-\\lambda\\mathbf{I}_{4\\times 4})=\\mathbf{q}=\\mathbf{0}`
has non-zero and unique solution, :math:`\\zeta` is chosen to be 0. Hence:
.. math::
\\mathbf{N}' = \\begin{bmatrix}
1 & 0 & 0 & \\chi \\\\ 0 & 1 & 0 & \\rho \\\\ 0 & 0 & 1 & \\upsilon \\\\ 0 & 0 & 0 & 0
\\end{bmatrix}
Letting :math:`q_w=-1`, the solution to the optimal quaternion is obtained with:
.. math::
\\mathbf{q} = \\begin{pmatrix}q_w\\\\q_x\\\\q_y\\\\q_z\\end{pmatrix} =
\\begin{pmatrix}-1\\\\\\chi\\\\\\rho\\\\\\upsilon\\end{pmatrix}
Finally, the quaternion is normalized to be able to be used as a versor:
.. math::
\\mathbf{q} = \\frac{1}{\\|\\mathbf{q}\\|} \\mathbf{q}
The decisive element of QUEST is its matrix :math:`\\mathbf{K}`, whereas for
FLAE :math:`\\mathbf{W}` plays the same essential role. Both algorithms spend
most of its computation obtaining said matrices.
FLAE has the same accuracy as other similar estimators (QUEST, SVD, etc.), but
with the advantage of being up to 47% faster than the fastest among them.
Another advantage is the symbolic formulation of the characteristic polynomial,
which does not contain any adjoint matrices, leading to a simpler (therefore
faster) calculation of the eigenvalues.
FLAE advocates for the symbolic method to calculate the eigenvalue. However,
the Newton iteration can be also used to achieve a similar performance to that
of QUEST.
References
----------
.. [Wu] <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, et al. Fast Linear
Quaternion Attitude Estimator Using Vector Observations. IEEE Transactions
on Automation Science and Engineering, Institute of Electrical and
Electronics Engineers, 2018.
(https://hal.inria.fr/hal-01513263)
"""
import warnings
import numpy as np
from ..common.mathfuncs import *
warnings.filterwarnings('error')
# Reference Observations in Munich, Germany
from ..utils.wmm import WMM
MAG = WMM(latitude=MUNICH_LATITUDE, longitude=MUNICH_LONGITUDE, height=MUNICH_HEIGHT).magnetic_elements
def _assert_iterables(item, item_name: str = 'iterable'):
if not isinstance(item, (list, tuple, np.ndarray)):
raise TypeError(f"{item_name} must be given as an array. Got {type(item)}")
def _assert_valid_method(method : str, valid_methods : list) -> None:
if method not in valid_methods:
joint_methods = "', '".join(valid_methods[:-1]) + "' or '" + valid_methods[-1]
raise ValueError(f"Given method '{method}' is not valid. Try '{joint_methods}'")
class FLAE:
"""Fast Linear Attitude Estimator
Parameters
----------
acc : numpy.ndarray, default: None
N-by-3 array with measurements of acceleration in in m/s^2
mag : numpy.ndarray, default: None
N-by-3 array with measurements of magnetic field in mT
method : str, default: ``'symbolic'``
Method used to estimate the attitude. Options are: ``'symbolic'``,
``'eig'``, and ``'newton'``.
weights : np.ndarray, default: [0.5, 0.5]
Weights used for each sensor. They must add up to 1.
magnetic_dip : float
Geomagnetic Inclination angle at local position, in degrees. Defaults
to magnetic dip of Munich, Germany.
Raises
------
ValueError
When estimation method is invalid.
Examples
--------
>>> orientation = FLAE()
>>> accelerometer = np.array([-0.2853546, 9.657394, 2.0018768])
>>> magnetometer = np.array([12.32605, -28.825378, -26.586914])
>>> orientation.estimate(acc=accelerometer, mag=magnetometer)
array([-0.45447247, -0.69524546, 0.55014011, -0.08622285])
You can set a different estimation method passing its name to parameter
``method``.
>>> orientation.estimate(acc=accelerometer, mag=magnetometer, method='newton')
array([ 0.42455176, 0.68971918, -0.58315259, -0.06305803])
Or estimate all quaternions at once by giving the data to the constructor.
All estimated quaternions are stored in attribute ``Q``.
>>> orientation = FLAE(acc=acc_data, mag=mag_Data, method='eig')
>>> orientation.Q.shape
(1000, 4)
"""
def __init__(self, acc: np.ndarray = None, mag: np.ndarray = None, method: str = 'symbolic', **kw):
self.acc = acc
self.mag = mag
self.method = method
# Reference measurements
mdip = kw.get('magnetic_dip') # Magnetic dip, in degrees
mag_ref = np.array([MAG['X'], MAG['Y'], MAG['Z']]) if mdip is None else np.array([cosd(mdip), 0., -sind(mdip)])
mag_ref /= np.linalg.norm(mag_ref)
acc_ref = np.array([0.0, 0.0, 1.0])
self.ref = np.vstack((acc_ref, mag_ref))
# Weights of sensors
self.a = kw.get('weights', np.array([0.5, 0.5]))
self.a /= np.sum(self.a)
if self.acc is not None and self.mag is not None:
self.Q = self._compute_all()
def _compute_all(self) -> np.ndarray:
"""
Estimate the quaternions given all data in class Data.
Class Data must have, at least, `acc` and `mag` attributes.
Returns
-------
Q : numpy.ndarray
M-by-4 Array with all estimated quaternions, where M is the number
of samples.
"""
if self.acc.shape != self.mag.shape:
raise ValueError("acc and mag are not the same size")
if self.acc.ndim < 2:
return self.estimate(self.acc, self.mag)
num_samples = len(self.acc)
Q = np.zeros((num_samples, 4))
for t in range(num_samples):
Q[t] = self.estimate(self.acc[t], self.mag[t], method=self.method)
return Q
def _P1Hx(self, Hx: np.ndarray) -> np.ndarray:
return np.array([
[ Hx[0], 0.0, -Hx[2], Hx[1]],
[ 0.0, Hx[0], Hx[1], Hx[2]],
[-Hx[2], Hx[1], -Hx[0], 0.0],
[ Hx[1], Hx[2], 0.0, -Hx[0]]])
def _P2Hy(self, Hy: np.ndarray) -> np.ndarray:
return np.array([
[ Hy[1], Hy[2], 0.0, -Hy[0]],
[ Hy[2], -Hy[1], Hy[0], 0.0],
[ 0.0, Hy[0], Hy[1], Hy[2]],
[-Hy[0], 0.0, Hy[2], -Hy[1]]])
def _P3Hz(self, Hz: np.ndarray) -> np.ndarray:
return np.array([
[ Hz[2], -Hz[1], Hz[0], 0.0],
[-Hz[1], -Hz[2], 0.0, Hz[0]],
[ Hz[0], 0.0, -Hz[2], Hz[1]],
[ 0.0, Hz[0], Hz[1], Hz[2]]])
def estimate(self, acc: np.ndarray, mag: np.ndarray, method: str = 'symbolic') -> np.ndarray:
"""
Estimate a quaternion with the given measurements and weights.
Parameters
----------
acc : numpy.ndarray
Sample of tri-axial Accelerometer.
mag : numpy.ndarray
Sample of tri-axial Magnetometer.
method : str, default: 'symbolic'
Method used to estimate the attitude. Options are: 'symbolic', 'eig'
and 'newton'.
Returns
-------
q : numpy.ndarray
Estimated orienation as quaternion.
Examples
--------
>>> accelerometer = np.array([-0.2853546, 9.657394, 2.0018768])
>>> magnetometer = np.array([12.32605, -28.825378, -26.586914])
>>> orientation = FLAE()
>>> orientation.estimate(acc=accelerometer, mag=magnetometer)
array([-0.45447247, -0.69524546, 0.55014011, -0.08622285])
>>> orientation.estimate(acc=accelerometer, mag=magnetometer, method='eig')
array([ 0.42455176, 0.68971918, -0.58315259, -0.06305803])
>>> orientation.estimate(acc=accelerometer, mag=magnetometer, method='newton')
array([ 0.42455176, 0.68971918, -0.58315259, -0.06305803])
"""
_assert_valid_method(method, ['symbolic', 'eig', 'newton'])
_assert_iterables(acc, 'Gravitational acceleration vector')
_assert_iterables(mag, 'Geomagnetic field vector')
if acc.size != 3:
raise ValueError(f"Accelerometer sample must be a (3,) array. Got array of shape {acc.shape}")
if mag.size != 3:
raise ValueError(f"Magnetometer sample must be a (3,) array. Got array of shape {mag.shape}")
Db = np.r_[[acc/ | np.linalg.norm(acc) | numpy.linalg.norm |
"""
Tests for tools
Author: <NAME>
License: Simplified-BSD
"""
from __future__ import division, absolute_import, print_function
import numpy as np
import pandas as pd
from scipy.linalg import solve_discrete_lyapunov
from statsmodels.tsa.statespace import tools
from statsmodels.tsa.api import acovf
# from .results import results_sarimax
from numpy.testing import (
assert_allclose, assert_equal, assert_array_equal, assert_almost_equal,
assert_raises
)
class TestCompanionMatrix(object):
cases = [
(2, np.array([[0,1],[0,0]])),
([1,-1,-2], np.array([[1,1],
[2,0]])),
([1,-1,-2,-3], np.array([[1,1,0],
[2,0,1],
[3,0,0]])),
([1,-np.array([[1,2],[3,4]]),-np.array([[5,6],[7,8]])],
np.array([[1,2,5,6],
[3,4,7,8],
[1,0,0,0],
[0,1,0,0]]).T)
]
def test_cases(self):
for polynomial, result in self.cases:
assert_equal(tools.companion_matrix(polynomial), result)
class TestDiff(object):
x = np.arange(10)
cases = [
# diff = 1
([1,2,3], 1, None, 1, [1, 1]),
# diff = 2
(x, 2, None, 1, [0]*8),
# diff = 1, seasonal_diff=1, k_seasons=4
(x, 1, 1, 4, [0]*5),
(x**2, 1, 1, 4, [8]*5),
(x**3, 1, 1, 4, [60, 84, 108, 132, 156]),
# diff = 1, seasonal_diff=2, k_seasons=2
(x, 1, 2, 2, [0]*5),
(x**2, 1, 2, 2, [0]*5),
(x**3, 1, 2, 2, [24]*5),
(x**4, 1, 2, 2, [240, 336, 432, 528, 624]),
]
def test_cases(self):
# Basic cases
for series, diff, seasonal_diff, k_seasons, result in self.cases:
# Test numpy array
x = tools.diff(series, diff, seasonal_diff, k_seasons)
assert_almost_equal(x, result)
# Test as Pandas Series
series = pd.Series(series)
# Rewrite to test as n-dimensional array
series = np.c_[series, series]
result = np.c_[result, result]
# Test Numpy array
x = tools.diff(series, diff, seasonal_diff, k_seasons)
| assert_almost_equal(x, result) | numpy.testing.assert_almost_equal |
import os
import glob
import random
import torch
import imageio
import errno
import numpy as np
import tifffile as tiff
import torch.nn as nn
import matplotlib.pyplot as plt
from torch.utils import data
from sklearn.metrics import confusion_matrix
# =============================================
class CustomDataset(torch.utils.data.Dataset):
def __init__(self, imgs_folder, labels_folder, augmentation):
# 1. Initialize file paths or a list of file names.
self.imgs_folder = imgs_folder
self.labels_folder = labels_folder
self.data_augmentation = augmentation
# self.transform = transforms
def __getitem__(self, index):
# 1. Read one data from file (e.g. using num py.fromfile, PIL.Image.open).
# 2. Preprocess the data (e.g. torchvision.Transform).
# 3. Return a data pair (e.g. image and label).
all_images = glob.glob(os.path.join(self.imgs_folder, '*.npy'))
all_labels = glob.glob(os.path.join(self.labels_folder, '*.npy'))
# sort all in the same order
all_labels.sort()
all_images.sort()
#
# label = Image.open(all_labels[index])
# label = tiff.imread(all_labels[index])
label = np.load(all_labels[index])
label = np.array(label, dtype='float32')
# image = tiff.imread(all_images[index])
image = np.load(all_images[index])
image = np.array(image, dtype='float32')
#
labelname = all_labels[index]
path_label, labelname = os.path.split(labelname)
labelname, labelext = os.path.splitext(labelname)
#
c_amount = len(np.shape(label))
#
#
# Reshaping everyting to make sure the order: channel x height x width
if c_amount == 3:
d1, d2, d3 = np.shape(label)
if d1 != min(d1, d2, d3):
label = np.reshape(label, (d3, d1, d2))
#
elif c_amount == 2:
h, w = np.shape(label)
label = np.reshape(label, (1, h, w))
#
d1, d2, d3 = np.shape(image)
#
if d1 != min(d1, d2, d3):
#
image = np.reshape(image, (d3, d1, d2))
#
if self.data_augmentation == 'full':
# augmentation:
augmentation = random.uniform(0, 1)
#
if augmentation < 0.25:
#
c, h, w = np.shape(image)
#
for channel in range(c):
#
image[channel, :, :] = np.flip(image[channel, :, :], axis=0).copy()
image[channel, :, :] = np.flip(image[channel, :, :], axis=1).copy()
#
label = np.flip(label, axis=1).copy()
label = np.flip(label, axis=2).copy()
elif augmentation < 0.5:
#
mean = 0.0
sigma = 0.15
noise = | np.random.normal(mean, sigma, image.shape) | numpy.random.normal |
import os.path
import numpy as np
from lyapunov_reachability.speculation_tabular.base import QBase
import cplex
from cplex.exceptions import CplexSolverError
class LyapunovQAgent(QBase):
def __init__(
self, env, confidence, nb_states, nb_actions, initial_policy, terminal_states, seed=None, strict_done=True,
safe_init=False, baseline_dir=None, baseline_step=None, save_dir='../../spec-tb-lyapunov'):
self.operative_q = np.ones((nb_states, nb_actions))
self.operative_q[terminal_states] = 0.
self.time_q = | np.zeros((nb_states, nb_actions)) | numpy.zeros |
import pickle
import os
import sys
import numpy as np
import torch.utils.data as torch_data
class ScannetDataset(torch_data.Dataset):
def __init__(self, root=None, npoints=10240, split='train', with_dropout=False, with_norm=False, with_rgb=False, sample_rate=None):
super().__init__()
print(' ---- load data from', root)
self.npoints = npoints
self.with_dropout = with_dropout
self.indices = [0, 1, 2]
if with_norm: self.indices += [3, 4, 5]
if with_rgb: self.indices += [6, 7, 8]
print('load scannet dataset <{}> with npoint {}, indices: {}.'.format(split, npoints, self.indices))
data_filename = os.path.join(root, 'scannet_%s_rgb21c_pointid.pickle' % (split))
with open(data_filename, 'rb') as fp:
self.scene_points_list = pickle.load(fp)
self.semantic_labels_list = pickle.load(fp)
scene_points_id = pickle.load(fp)
num_point_all = pickle.load(fp)
if split == 'train':
labelweights = np.zeros(21)
for seg in self.semantic_labels_list:
tmp,_ = np.histogram(seg,range(22))
labelweights += tmp
labelweights = labelweights.astype(np.float32)
labelweights = labelweights/np.sum(labelweights)
# self.labelweights = 1/np.log(1.2+labelweights)
self.labelweights = np.power(np.amax(labelweights[1:]) / labelweights, 1 / 3.0)
elif split == 'eval' or split == 'test':
self.labelweights = np.ones(21)
else:
raise ValueError('split must be train or eval.')
if sample_rate is not None:
num_point = npoints
sample_prob = num_point_all / np.sum(num_point_all)
num_iter = int(np.sum(num_point_all) * sample_rate / num_point)
room_idxs = []
for index in range(len(self.scene_points_list)):
repeat_times = round(sample_prob[index] * num_iter)
repeat_times = int(max(repeat_times, 1))
room_idxs.extend([index] * repeat_times)
self.room_idxs = np.array(room_idxs)
np.random.seed(123)
np.random.shuffle(self.room_idxs)
else:
self.room_idxs = np.arange(len(self.scene_points_list))
print("Totally {} samples in {} set.".format(len(self.room_idxs), split))
def __getitem__(self, index):
index = self.room_idxs[index]
data_set = self.scene_points_list[index]
point_set = data_set[:, :3]
semantic_seg = self.semantic_labels_list[index].astype(np.int32)
coordmax = np.max(point_set, axis=0)
coordmin = np.min(point_set, axis=0)
smpmin = np.maximum(coordmax-[2, 2, 3.0], coordmin)
smpmin[2] = coordmin[2]
smpsz = np.minimum(coordmax-smpmin,[2,2,3.0])
smpsz[2] = coordmax[2]-coordmin[2]
isvalid = False
# randomly choose a point as center point and sample <n_points> points in the box area of center-point
for i in range(10):
curcenter = point_set[np.random.choice(len(semantic_seg),1)[0],:]
curmin = curcenter - [1, 1, 1.5]
curmax = curcenter + [1, 1, 1.5]
curmin[2] = coordmin[2]
curmax[2] = coordmax[2]
curchoice = np.sum((point_set >= (curmin - 0.2)) * (point_set <= (curmax + 0.2)), axis=1) == 3
cur_point_set = point_set[curchoice, :]
cur_data_set = data_set[curchoice, :]
cur_semantic_seg = semantic_seg[curchoice]
if len(cur_semantic_seg) == 0:
continue
mask = np.sum((cur_point_set >= (curmin - 0.01)) * (cur_point_set <= (curmax + 0.01)), axis=1) == 3
vidx = np.ceil((cur_point_set[mask, :] - curmin) / (curmax - curmin) * [31.0, 31.0, 62.0])
vidx = np.unique(vidx[:, 0] * 31.0 * 62.0 + vidx[:, 1] * 62.0 + vidx[:, 2])
isvalid = np.sum(cur_semantic_seg > 0) / len(cur_semantic_seg) >= 0.7 and len(vidx) / 31.0 / 31.0 / 62.0 >= 0.02
if isvalid:
break
choice = np.random.choice(len(cur_semantic_seg), self.npoints, replace=True)
semantic_seg = cur_semantic_seg[choice]
mask = mask[choice]
sample_weight = self.labelweights[semantic_seg]
sample_weight *= mask
selected_points = cur_data_set[choice, :] # np * 6, xyz + rgb
point_set = np.zeros((self.npoints, 9)) # xyz, norm_xyz, rgb
point_set[:, :3] = selected_points[:, :3] # xyz
for i in range(3): # normalized_xyz
point_set[:, 3 + i] = (selected_points[:, i] - coordmin[i]) / (coordmax[i] - coordmin[i])
point_set[:, 6:] = selected_points[:, 3:] / 255.0 # rgb
if self.with_dropout:
dropout_ratio = np.random.random() * 0.875 # 0 ~ 0.875
drop_idx = np.where(np.random.random((self.npoints)) <= dropout_ratio)[0]
point_set[drop_idx, :] = point_set[0, :]
semantic_seg[drop_idx] = semantic_seg[0]
sample_weight[drop_idx] *= 0
point_set = point_set[:, self.indices]
return point_set, semantic_seg, sample_weight
def __len__(self):
return len(self.room_idxs)
# return len(self.scene_points_list)
class ScannetDatasetWholeScene(torch_data.IterableDataset):
def __init__(self, root=None, npoints=10240, split='train', with_norm=True, with_rgb=True):
super().__init__()
print(' ---- load data from', root)
self.npoints = npoints
self.indices = [0, 1, 2]
if with_norm: self.indices += [3, 4, 5]
if with_rgb: self.indices += [6, 7, 8]
print('load scannet <whole scene> dataset <{}> with npoint {}, indices: {}.'.format(split, npoints, self.indices))
self.temp_data = []
self.temp_index = 0
self.now_index = 0
data_filename = os.path.join(root, 'scannet_%s_rgb21c_pointid.pickle' % (split))
with open(data_filename, 'rb') as fp:
self.scene_points_list = pickle.load(fp)
self.semantic_labels_list = pickle.load(fp)
if split == 'train':
labelweights = np.zeros(21)
for seg in self.semantic_labels_list:
tmp,_ = np.histogram(seg,range(22))
labelweights += tmp
labelweights = labelweights.astype(np.float32)
labelweights = labelweights/np.sum(labelweights)
# self.labelweights = 1 / np.log(1.2 + labelweights)
self.labelweights = np.power(np.amax(labelweights[1:]) / labelweights, 1 / 3.0)
elif split == 'eval' or split == 'test':
self.labelweights = np.ones(21)
def get_data(self):
idx = self.temp_index
self.temp_index += 1
return self.temp_data[idx]
def reset(self):
self.temp_data = []
self.temp_index = 0
self.now_index = 0
def __iter__(self):
self.reset()
return self
def __next__(self):
if self.now_index >= len(self.scene_points_list) and self.temp_index >= len(self.temp_data):
raise StopIteration()
if self.temp_index < len(self.temp_data):
return self.get_data()
index = self.now_index
self.now_index += 1
self.temp_data = []
self.temp_index = 0
data_set_ini = self.scene_points_list[index]
point_set_ini = data_set_ini[:,:3]
semantic_seg_ini = self.semantic_labels_list[index].astype(np.int32)
coordmax = np.max(point_set_ini,axis=0)
coordmin = np.min(point_set_ini,axis=0)
nsubvolume_x = np.ceil((coordmax[0]-coordmin[0])/2).astype(np.int32)
nsubvolume_y = np.ceil((coordmax[1]-coordmin[1])/2).astype(np.int32)
point_sets = list()
semantic_segs = list()
sample_weights = list()
isvalid = False
for i in range(nsubvolume_x):
for j in range(nsubvolume_y):
curmin = coordmin+[i*2,j*2,0]
curmax = coordmin+[(i+1)*2,(j+1)*2,coordmax[2]-coordmin[2]]
curchoice = np.sum((point_set_ini>=(curmin-0.2))*(point_set_ini<=(curmax+0.2)),axis=1)==3
cur_point_set = point_set_ini[curchoice,:]
cur_data_set = data_set_ini[curchoice,:]
cur_semantic_seg = semantic_seg_ini[curchoice]
if len(cur_semantic_seg)==0:
continue
mask = np.sum((cur_point_set >= (curmin - 0.001)) * (cur_point_set <= (curmax + 0.001)), axis=1) == 3
choice = np.random.choice(len(cur_semantic_seg), self.npoints, replace=len(cur_semantic_seg) < self.npoints)
semantic_seg = cur_semantic_seg[choice] # N
mask = mask[choice]
if sum(mask) / float(len(mask)) < 0.01:
continue
sample_weight = self.labelweights[semantic_seg]
sample_weight *= mask # N
selected_points = cur_data_set[choice, :] # Nx6
point_set = | np.zeros([self.npoints, 9]) | numpy.zeros |
from __future__ import division, with_statement
from scipy.constants import pi
import scipy.constants as cons
import numpy as np
import scipy.optimize as optimize
import matplotlib.pyplot as plt
import scipy.linalg as LA
# print at line 396
__author__ = 'sbt'
# -*- coding: utf-8 -*-
"""
Contains the ModeAnalysis class, which can simulate the positions of ions in a crystal
of desired size. The class contains methods for the generation of a crystal,
relaxation to a minimum potential energy state, and determination of axial and (eventually) planar modes of motion
by methods derived by Wang, Keith, and Freericks in 2013.
Translated from MATLAB code written by <NAME> by <NAME>.
Standardized and slightly revised by <NAME>.
Be careful. Sometimes when using the exact same parameters this
code will make different crystals with the same potential energy. That is,
crystal are degenerate when reflecting over the axes.
"""
class ModeAnalysis:
"""
Simulates a 2-dimensional ion crystal, determining an equilibrium plane configuration given
Penning trap parameters, and then calculates the eigenvectors and eigenmodes.
For reference the following ion number correspond the closed shells:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
7 19 37 61 91 127 169 217 271 331 397 469 547 631...
"""
#Establish fundamental physical constants as class variables
q = 1.602176565E-19
amu = 1.66057e-27
# m_Be = 9.012182 * amu
k_e = 8.9875517873681764E9 # electrostatic constant k_e = 1 / (4.0 pi epsilon_0)
def __init__(self, N=19, XR=1, Vtrap=(0.0, -1750.0, -1970.0), Ctrap=1.0,
omega_z = 1.58e6, ionmass=None, B=4.4588, frot=180., Vwall=1.,
wall_order=2, quiet=True, precision_solving=True,
method = 'bfgs'):
"""
:param N: integer, number of ions
:param shells: integer, number of shells to instantiate the plasma with
:param Vtrap: array of 3 elements, defines the [end, middle, center] voltages on the trap electrodes.
:param Ctrap: float, constant coefficient on trap potentials
:param B: float, defines strength of axial magnetic field.
:param frot: float, frequency of rotation
:param Vwall: float, strength of wall potential in volts
:param wall_order: integer, defines the order of the rotating wall potential
:param mult: float, mutliplicative factor for simplifying numerical calculations
:param quiet: will print some things if False
:param precision_solving: Determines if perturbations will be made to the crystal to find
a low energy state with a number of attempts based on the
number of ions.
Disable for speed, but recommended.
"""
self.method = method
self.ionmass = ionmass
self.m_Be = self.ionmass * self.amu
self.quiet = quiet
self.precision_solving = precision_solving
# Initialize basic variables such as physical constants
self.Nion = N
# self.shells = shells
# self.Nion = 1 + 6 * np.sum(range(1, shells + 1))
# if no input masses, assume all ions are beryllium
self.m = self.m_Be * np.ones(self.Nion)
# mass order is irrelevant and don't assume it will be fixed
# FUTURE: heavier (than Be) ions will be added to outer shells
# for array of ion positions first half is x, last is y
self.u0 = np.empty(2 * self.Nion) # initial lattice
self.u = np.empty(2 * self.Nion) # equilibrium positions
# trap definitions
self.B = B
self.wcyc = self.q * B / self.m_Be # Beryllium cyclotron frequency
# axial trap coefficients; see Teale's final paper
self.C = Ctrap * np.array([[0.0756, 0.5157, 0.4087],
[-0.0001, -0.005, 0.005],
[1.9197e3, 3.7467e3, -5.6663e3],
[0.6738e7, -5.3148e7, 4.641e7]])
# wall order
if wall_order == 2:
self.Cw3 = 0
if wall_order == 3:
self.Cw2 = 0
self.Cw3 = self.q * Vwall * 3e4
self.relec = 0.01 # rotating wall electrode distance in meters
self.Vtrap = np.array(Vtrap) # [Vend, Vmid, Vcenter] for trap electrodes
self.Coeff = np.dot(self.C, self.Vtrap) # Determine the 0th, first, second, and fourth order
# potentials at trap center
#self.wz = 4.9951e6 # old trapping frequency
#self.wz = np.sqrt(2 * self.q * self.Coeff[2] / self.m_Be) # Compute axial frequency
# print('axial freq=',self.wz/(2e6*np.pi),'MHz')
self.omega_z = omega_z
self.wz = self.omega_z
self.wrot = 2 * pi * frot * 1e3 # Rotation frequency in units of angular fre quency
# Not used vvv
#self.wmag = 0.5 * (self.wcyc - np.sqrt(self.wcyc ** 2 - 2 * self.wz ** 2))
self.wmag=0 # a hack for now
self.V0 = (0.5 * self.m_Be * self.wz ** 2) / self.q # Find quadratic voltage at trap center
#self.Cw = 0.045 * Vwall / 1000 # old trap
self.XR=XR
self.Cw = self.XR*Vwall * 1612 / self.V0 # dimensionless coefficient in front
self.delta = self.Cw
# of rotating wall terms in potential
self.dimensionless() # Make system dimensionless
self.beta = (self.wr*self.wc - self.wr ** 2) -1/2
self.axialEvals = [] # Axial eigenvalues
self.axialEvects = [] # Axial eigenvectors
self.planarEvals = [] # Planar eigenvalues
self.planarEvects = [] # Planar Eigenvectors
self.axialEvalsE = [] # Axial eigenvalues in experimental units
self.planarEvalsE = [] # Planar eigenvalues in experimental units
self.p0 = 0 # dimensionless potential energy of equilibrium crystal
self.r = []
self.rsep = []
self.dx = []
self.dy = []
self.hasrun = False
def dimensionless(self):
"""Calculate characteristic quantities and convert to a dimensionless
system
"""
# characteristic length
self.l0 = ((self.k_e * self.q ** 2) / (.5 * self.m_Be * self.wz ** 2)) ** (1 / 3)
self.t0 = 1 / self.wz # characteristic time
self.v0 = self.l0 / self.t0 # characteristic velocity
self.E0 = 0.5*self.m_Be*(self.wz**2)*self.l0**2 # characteristic energy
self.wr = self.wrot / self.wz # dimensionless rotation
self.wc = self.wcyc / self.wz # dimensionless cyclotron
self.md = np.ones(self.Nion)#self.m / self.m_Be # dimensionless mass
def expUnits(self):
"""Convert dimensionless outputs to experimental units"""
self.u0E = self.l0 * self.u0 # Seed lattice
self.uE = self.l0 * self.u # Equilibrium positions
self.axialEvalsE_raw = self.wz * self.axialEvals_raw
self.axialEvalsE = self.wz * self.axialEvals
self.planarEvalsE = self.wz * self.planarEvals
# eigenvectors are dimensionless anyway
def run(self):
"""
Generates a crystal from the generate_crystal method (by the find_scalled_lattice_guess method,
adjusts it into an eqilibirium position by find_eq_pos method)
and then computes the eigenvalues and eigenvectors of the axial modes by calc_axial_modes.
Sorts the eigenvalues and eigenvectors and stores them in self.Evals, self.Evects.
Stores the radial separations as well.
"""
# print('this is the local mode_analysis.')
if self.wmag > self.wrot:
print("Warning: Rotation frequency", self.wrot/(2*pi),
" is below magnetron frequency of", float(self.wrot/(2*pi)))
return 0
self.generate_crystal()
print(np.shape(self.u))
self.axialEvals_raw, self.axialEvals, self.axialEvects = self.calc_axial_modes(self.u)
self.planarEvals, self.planarEvects, self.V = self.calc_planar_modes(self.u)
self.expUnits() # make variables of outputs in experimental units
self.axial_hessian = -self.calc_axial_hessian(self.u)
self.planar_hessian= -self.V/2
self.axial_Mmat = np.diag(self.md)
self.planar_Mmat = np.diag(np.tile(self.md,2))
self.hasrun = True
def generate_crystal(self):
"""
The run method already is a "start-to-finish" implementation of crystal generation and
eigenmode determination, so this simply contains the comopnents which generate a crystal.
:return: Returns a crystal's position vector while also saving it to the class.
"""
# This check hasn't been working properly, and so wmag has been set to
# 0 for the time being (July 2015, SBT)
if self.wmag > self.wrot:
print("Warning: Rotation frequency", self.wrot/(2*pi),
" is below magnetron frequency of", float(self.wrot/(2*pi)))
return 0
#Generate a lattice in dimensionless units
self.u0 = self.find_scaled_lattice_guess(mins=1, res=50)
# self.u0 = self.generate_2D_hex_lattice(2)
# if masses are not all beryllium, force heavier ions to be boundary
# ions, and lighter ions to be near center
# ADD self.addDefects()
#Solve for the equilibrium position
self.u = self.find_eq_pos(self.u0,self.method)
# Will attempt to nudge the crystal to a slightly lower energy state via some
# random perturbation.
# Only changes the positions if the perturbed potential energy was reduced.
#Will perturb less for bigger crystals, as it takes longer depending on how many ions
#there are.
if self.precision_solving is True:
if self.quiet is False:
print("Perturbing crystal...")
if self.Nion <= 62:
for attempt in np.linspace(.05, .5, 50):
self.u = self.perturb_position(self.u, attempt)
if 62 < self.Nion <= 126:
for attempt in np.linspace(.05, .5, 25):
self.u = self.perturb_position(self.u, attempt)
if 127 <= self.Nion <= 200:
for attempt in np.linspace(.05, .5, 10):
self.u = self.perturb_position(self.u, attempt)
if 201 <= self.Nion:
for attempt in np.linspace(.05, .3, 5):
self.u = self.perturb_position(self.u, attempt)
if self.quiet is False:
pass
#print("Perturbing complete")
self.r, self.dx, self.dy, self.rsep = self.find_radial_separation(self.u)
self.p0 = self.pot_energy(self.u)
return self.u
def generate_lattice(self):
"""Generate lattice for an arbitrary number of ions (self.Nion)
:return: a flattened xy position vector defining the 2d hexagonal
lattice
"""
# number of closed shells
S = int((np.sqrt(9 - 12 * (1 - self.Nion)) - 3) / 6)
u0 = self.generate_2D_hex_lattice(S)
N0 = int(u0.size / 2)
x0 = u0[0:N0]
y0 = u0[N0:]
Nadd = self.Nion - N0 # Number of ions left to add
self.Nion = N0
pair = self.add_hex_shell(S + 1) # generate next complete shell
xadd = pair[0::2]
yadd = pair[1::2]
for i in range(Nadd):
# reset number of ions to do this calculation
self.Nion += 1
# make masses all one (add defects later)
self.md = np.ones(self.Nion)
V = [] # list to store potential energies from calculation
# for each ion left to add, calculate potential energy if that
# ion is added
for j in range(len(xadd)):
V.append(self.pot_energy(np.hstack((x0, xadd[j], y0,
yadd[j]))))
ind = np.argmin(V) # ion added with lowest increase in potential
# permanently add to existing crystal
x0 = np.append(x0, xadd[ind])
y0 = np.append(y0, yadd[ind])
# remove ion from list to add
xadd = np.delete(xadd, ind)
yadd = np.delete(yadd, ind)
# Restore mass array
self.md = self.m / self.m_Be # dimensionless mass
return np.hstack((x0, y0))
def pot_energy(self, pos_array):
"""
Computes the potential energy of the ion crystal,
taking into consideration:
Coulomb repulsion
qv x B forces
Trapping potential
and some other things (#todo to be fully analyzed; june 10 2015)
:param pos_array: The position vector of the crystal to be analyzed.
:return: The scalar potential energy of the crystal configuration.
"""
# Frequency of rotation, mass and the number of ions in the array
# the x positions are the first N elements of the position array
x = pos_array[0:self.Nion]
# The y positions are the last N elements of the position array
y = pos_array[self.Nion:]
# dx flattens the array into a row vector
dx = x.reshape((x.size, 1)) - x
dy = y.reshape((y.size, 1)) - y
# rsep is the distances between
rsep = np.sqrt(dx ** 2 + dy ** 2)
with np.errstate(divide='ignore'):
Vc = np.where(rsep != 0., 1 / rsep, 0)
"""
#Deprecated version below which takes into account anharmonic effects, to be used later
V = 0.5 * (-m * wr ** 2 - q * self.Coeff[2] + q * B * wr) * np.sum((x ** 2 + y ** 2)) \
- q * self.Coeff[3] * np.sum((x ** 2 + y ** 2) ** 2) \
+ np.sum(self.Cw2 * (x ** 2 - y ** 2)) \
+ np.sum(self.Cw3 * (x ** 3 - 3 * x * y ** 2)) \
+ 0.5 * k_e * q ** 2 * np.sum(Vc)
"""
V = -np.sum((self.md * self.wr ** 2 + 0.5 * self.md - self.wr * self.wc) * (x ** 2 + y ** 2)) \
+ np.sum(self.md * self.Cw * (x ** 2 - y ** 2)) + 0.5 * np.sum(Vc)
return V
def force_penning(self, pos_array):
"""
Computes the net forces acting on each ion in the crystal;
used as the jacobian by find_eq_pos to minimize the potential energy
of a crystal configuration.
:param pos_array: crystal to find forces of.
:return: a vector of size 2N describing the x forces and y forces.
"""
x = pos_array[0:self.Nion]
y = pos_array[self.Nion:]
dx = x.reshape((x.size, 1)) - x
dy = y.reshape((y.size, 1)) - y
rsep = np.sqrt(dx ** 2 + dy ** 2)
# Calculate coulomb force on each ion
with np.errstate(divide='ignore'):
Fc = np.where(rsep != 0., rsep ** (-2), 0)
with np.errstate(divide='ignore', invalid='ignore'):
fx = np.where(rsep != 0., np.float64((dx / rsep) * Fc), 0)
fy = np.where(rsep != 0., np.float64((dy / rsep) * Fc), 0)
# total force on each ion
""" Deprecated version below which uses anharmonic trap potentials
Ftrapx = (-m * wr ** 2 - q * self.Coeff[2] + q * B * wr + 2 * self.Cw2) * x \
- 4 * q * self.Coeff[3] * (x ** 3 + x * y ** 2) + 3 * self.Cw3 * (x ** 2 - y ** 2)
Ftrapy = (-m * wr ** 2 - q * self.Coeff[2] + q * B * wr - 2 * self.Cw2) * y \
- 4 * q * self.Coeff[3] * (y ** 3 + y * x ** 2) - 6 * self.Cw3 * x * y
# Ftrap = (m*w**2 + q*self.V0 - 2*q*self.Vw - q*self.B* w) * pos_array
"""
Ftrapx = -2 * self.md * (self.wr ** 2 - self.wr * self.wc + 0.5 -
self.Cw) * x
Ftrapy = -2 * self.md * (self.wr ** 2 - self.wr * self.wc + 0.5 +
self.Cw) * y
Fx = -np.sum(fx, axis=1) + Ftrapx
Fy = -np.sum(fy, axis=1) + Ftrapy
return np.array([Fx, Fy]).flatten()
def hessian_penning(self, pos_array):
"""Calculate Hessian of potential"""
x = pos_array[0:self.Nion]
y = pos_array[self.Nion:]
dx = x.reshape((x.size, 1)) - x
dy = y.reshape((y.size, 1)) - y
rsep = np.sqrt(dx ** 2 + dy ** 2)
with np.errstate(divide='ignore'):
rsep5 = np.where(rsep != 0., rsep ** (-5), 0)
dxsq = dx ** 2
dysq = dy ** 2
# X derivatives, Y derivatives for alpha != beta
Hxx = np.mat((rsep ** 2 - 3 * dxsq) * rsep5)
Hyy = np.mat((rsep ** 2 - 3 * dysq) * rsep5)
# Above, for alpha == beta
# np.diag usa diagnoal value to form a matrix
Hxx += np.mat(np.diag(-2 * self.md * (self.wr ** 2 - self.wr * self.wc + .5 -
self.Cw) -
np.sum((rsep ** 2 - 3 * dxsq) * rsep5, axis=0)))
Hyy += np.mat(np.diag(-2 * self.md * (self.wr ** 2 - self.wr * self.wc + .5 +
self.Cw) -
np.sum((rsep ** 2 - 3 * dysq) * rsep5, axis=0)))
# print(self.V0)
# print('Cw=',self.Cw)
# print('wr=',self.wr)
# print('wc=',self.wc)
# print('wz=',self.wz)
# Mixed derivatives
Hxy = np.mat(-3 * dx * dy * rsep5)
Hxy += np.mat(np.diag(3 * np.sum(dx * dy * rsep5, axis=0)))
H = np.bmat([[Hxx, Hxy], [Hxy, Hyy]])
H = np.asarray(H)
return H
def find_scaled_lattice_guess(self, mins, res):
"""
Will generate a 2d hexagonal lattice based on the shells intialiization parameter.
Guesses initial minimum separation of mins and then increases spacing until a local minimum of
potential energy is found.
This doesn't seem to do anything. Needs a fixin' - AK
:param mins: the minimum separation to begin with.
:param res: the resizing parameter added onto the minimum spacing.
:return: the lattice with roughly minimized potential energy (via spacing alone).
"""
# Make a 2d lattice; u represents the position
uthen = self.generate_lattice()
uthen = uthen * mins
# Figure out the lattice's initial potential energy
pthen = self.pot_energy(uthen)
# Iterate through the range of minimum spacing in steps of res/resolution
for scale in np.linspace(mins, 10, res):
# Quickly make a 2d hex lattice; perhaps with some stochastic procedure?
uguess = uthen * scale
# Figure out the potential energy of that newly generated lattice
# print(uguess)
pnow = self.pot_energy(uguess)
# And if the program got a lattice that was less favorably distributed, conclude
# that we had a pretty good guess and return the lattice.
if pnow >= pthen:
# print("find_scaled_lattice: Minimum found")
# print "initial scale guess: " + str(scale)
# self.scale = scale
# print(scale)
return uthen
# If not, then we got a better guess, so store the energy score and current arrangement
# and try again for as long as we have mins and resolution to iterate through.
uthen = uguess
pthen = pnow
# If you're this far it means we've given up
# self.scale = scale
# print "find_scaled_lattice: no minimum found, returning last guess"
return uthen
def find_eq_pos(self, u0, method="bfgs"):
"""
Runs optimization code to tweak the position vector defining the crystal to a minimum potential energy
configuration.
:param u0: The position vector which defines the crystal.
:return: The equilibrium position vector.
"""
newton_tolerance = 1e-34
bfgs_tolerance = 1e-34
if method == "newton":
out = optimize.minimize(self.pot_energy, u0, method='Newton-CG', jac=self.force_penning,
hess=self.hessian_penning,
options={'xtol': newton_tolerance, 'disp': not self.quiet})
if method == 'bfgs':
out = optimize.minimize(self.pot_energy, u0, method='BFGS', jac=self.force_penning,
options={'gtol': bfgs_tolerance, 'disp': False}) # not self.quiet})
if (method != 'bfgs') & (method != 'newton'):
print('method, '+method+', not recognized')
exit()
return out.x
def calc_axial_hessian(self, pos_array):
"""
Calculate the axial hessian matrix for a crystal defined
by pos_array.
THIS MAY NEED TO BE EDITED FOR NONHOMOGENOUS MASSES
:param pos_array: Position vector which defines the crystal
to be analyzed.
:return: Array of eigenvalues, Array of eigenvectors
"""
x = pos_array[0:self.Nion]
y = pos_array[self.Nion:]
dx = x.reshape((x.size, 1)) - x
dy = y.reshape((y.size, 1)) - y
rsep = np.sqrt(dx ** 2 + dy ** 2)
with np.errstate(divide='ignore'):
rsep3 = np.where(rsep != 0., rsep ** (-3), 0)
K = np.diag((-1 + 0.5 * np.sum(rsep3, axis=0)))
K -= 0.5 * rsep3
return K
def calc_axial_modes(self, pos_array):
"""
Calculate the modes of axial vibration for a crystal defined
by pos_array.
THIS MAY NEED TO BE EDITED FOR NONHOMOGENOUS MASSES
:param pos_array: Position vector which defines the crystal
to be analyzed.
:return: Array of eigenvalues, Array of eigenvectors
"""
x = pos_array[0:self.Nion]
y = pos_array[self.Nion:]
dx = x.reshape((x.size, 1)) - x
dy = y.reshape((y.size, 1)) - y
rsep = np.sqrt(dx ** 2 + dy ** 2)
with np.errstate(divide='ignore'):
rsep3 = np.where(rsep != 0., rsep ** (-3), 0)
K = np.diag((-1 + 0.5 * np.sum(rsep3, axis=0)))
K -= 0.5 * rsep3
# Make first order system by making space twice as large
Zn = np.zeros((self.Nion, self.Nion))
eyeN = np.identity(self.Nion)
Mmat = np.diag(self.md)
Minv = np.linalg.inv(Mmat)
firstOrder = np.bmat([[Zn, eyeN], [np.dot(Minv,K), Zn]])
Eval, Evect = np.linalg.eig(firstOrder)
Eval_raw = Eval
# Convert 2N imaginary eigenvalues to N real eigenfrequencies
ind = np.argsort(np.absolute(np.imag(Eval)))
# print('ind=',ind)
Eval = np.imag(Eval[ind])
Eval = Eval[Eval >= 0] # toss the negative eigenvalues
Evect = Evect[:, ind] # sort eigenvectors accordingly
# Normalize by energy of mode
for i in range(2*self.Nion):
pos_part = Evect[:self.Nion, i]
vel_part = Evect[self.Nion:, i]
norm = vel_part.H*Mmat*vel_part - pos_part.H*K*pos_part
with np.errstate(divide='ignore',invalid='ignore'):
Evect[:, i] = np.where(np.sqrt(norm) != 0., Evect[:, i]/np.sqrt(norm), 0)
#Evect[:, i] = Evect[:, i]/np.sqrt(norm)
Evect = np.asarray(Evect)
return Eval_raw, Eval, Evect
def calc_planar_modes(self, pos_array):
"""Calculate Planar Mode Eigenvalues and Eigenvectors
THIS MAY NEED TO BE EDITED FOR NONHOMOGENOUS MASSES
:param pos_array: Position vector which defines the crystal
to be analyzed.
:return: Array of eigenvalues, Array of eigenvectors
"""
V = -self.hessian_penning(pos_array) # -Hessian
Zn = np.zeros((self.Nion, self.Nion)) #Nion, number of ions
Z2n = np.zeros((2 * self.Nion, 2 * self.Nion))
offdiag = (2 * self.wr - self.wc) * np.identity(self.Nion) # np.identity: unitary matrix
A = np.bmat([[Zn, offdiag], [-offdiag, Zn]])
Mmat = np.diag(np.concatenate((self.md,self.md))) #md =1
Minv = np.linalg.inv(Mmat)
firstOrder = np.bmat([[Z2n, np.identity(2 * self.Nion)], [np.dot(Minv,V/2), A]])
#mp.dps = 25
#firstOrder = mp.matrix(firstOrder)
#Eval, Evect = mp.eig(firstOrder)
Eval, Evect = np.linalg.eig(firstOrder)
# currently giving too many zero modes (increase numerical precision?)
# make eigenvalues real.
ind = np.argsort(np.absolute(np.imag(Eval)))
Eval = np.imag(Eval[ind])
Eval = Eval[Eval >= 0] # toss the negative eigenvalues
Evect = Evect[:, ind] # sort eigenvectors accordingly
# Normalize by energy of mode
for i in range(4*self.Nion):
pos_part = Evect[:2*self.Nion, i]
vel_part = Evect[2*self.Nion:, i]
norm = vel_part.H*Mmat*vel_part - pos_part.H*(V/2)*pos_part
with np.errstate(divide='ignore'):
Evect[:, i] = np.where(np.sqrt(norm) != 0., Evect[:, i]/np.sqrt(norm), 0)
#Evect[:, i] = Evect[:, i]/np.sqrt(norm)
# if there are extra zeros, chop them
Eval = Eval[(Eval.size - 2 * self.Nion):]
return Eval, Evect, V
def show_crystal(self, pos_vect):
"""
Makes a pretty plot of the crystal with a given position vector.
:param pos_vect: The crystal position vector to be seen.
"""
plt.plot(pos_vect[0:self.Nion], pos_vect[self.Nion:], '.')
plt.xlabel('x position [um]')
plt.ylabel('y position [um]')
# plt.axes().set_aspect('equal')
plt.show()
def show_crystal_modes(self, pos_vect, Evects, modes):
"""
For a given crystal, plots the crystal with colors based on the eigenvectors.
:param pos_vect: the position vector of the current crystal
:param Evects: the eigenvectors to be shown
:param modes: the number of modes you wish to see
"""
plt.figure(1)
# print(np.shape(pos_vect[0:self.Nion]))
# print(np.shape(Evects[:, 0]))
for i in range(modes):
plt.subplot(modes, 1, i + 1, aspect='equal')
plt.scatter(1e6 * pos_vect[0:self.Nion], 1e6 * pos_vect[self.Nion:],
c=Evects[:self.Nion, -i-1], vmin=-.01, vmax=0.01,
cmap='viridis')
plt.xlabel('x position [um]')
plt.ylabel('y position [um]')
#plt.axis([-200, 200, -200, 200])
plt.tight_layout()
def show_low_freq_mode(self):
"""
Gets the lowest frequency modes and eigenvectors,
then plots them, printing the lowest frequency mode.
"""
num_modes = np.size(self.Evals)
low_mode_freq = self.Evals[-1]
low_mode_vect = self.Evects[-1]
plt.scatter(1e6 * self.u[0:self.Nion], 1e6 * self.u[self.Nion:],
c=low_mode_vect, vmin=-.25, vmax=0.25, cmap='RdGy')
plt.axes().set_aspect('equal')
plt.xlabel('x position [um]', fontsize=12)
plt.ylabel('y position [um]', fontsize=12)
plt.axis([-300, 300, -300, 300])
print(num_modes)
print("Lowest frequency mode at {0:0.1f} kHz".format(float(np.real(low_mode_freq))))
return 0
def perturb_position(self, pos_vect, strength=.1):
"""
Slightly displaces each ion by a random proportion (determined by 'strength' parameter)
and then solves for a new equilibrium position.
If the new configuration has a lower global potential energy, it is returned.
If the new configuration has a higher potential energy, it is discarded and
the previous configuration is returned.
:param u: The input coordinate vector of each x,y position of each ion.
:return: Either the previous position vector, or a new position vector.
"""
# print("U before:", self.pot_energy(u))
unudge = self.find_eq_pos([coord * abs(np.random.normal(1, strength)) for coord in pos_vect])
if self.pot_energy(unudge) < self.pot_energy(pos_vect):
# print("Nudge successful")
# print("U After:", self.pot_energy(unudge))
return unudge
else:
# print("Nudge failed!")
return pos_vect
def show_axial_Evals(self, experimentalunits=False, flatlines=False):
"""
Plots the axial eigenvalues vs mode number.
:param experimentalunits:
:return:
"""
if self.axialEvals is []:
print("Warning-- no axial eigenvalues found. Cannot show axial eigenvalues")
return False
if flatlines is True:
fig = plt.figure(figsize=(8, 5))
fig = plt.axes(frameon=True)
# fig= plt.axes.get_yaxis().set_visible(False)
fig.set_yticklabels([])
if experimentalunits is False:
fig = plt.xlabel("Eigenfrequency (Units of $\omega_z$)")
fig = plt.xlim(min(self.axialEvals) * .99, max(self.axialEvals * 1.01))
for x in self.axialEvals:
fig = plt.plot([x, x], [0, 1], color='black', )
if experimentalunits is True:
fig = plt.xlabel("Eigenfrequency (2 \pi* Hz)")
fig = plt.xlim(min(self.axialEvalsE) * .99, max(self.axialEvalsE) * 1.01)
for x in self.axialEvalsE:
fig = plt.plot([x, x], [0, 1], color='black')
fig = plt.ylim([0, 1])
# fig= plt.axes.yaxis.set_visible(False)
fig = plt.title("Axial Eigenvalues for %d Ions, $f_{rot}=$%.1f kHz, and $V_{wall}$= %.1f V " %
(self.Nion, self.wrot / (2 * pi * 1e3), self.Cw * self.V0 / 1612))
plt.show()
return True
fig = plt.figure()
xvals = np.array(range(self.Nion))
xvals += 1
if experimentalunits is False:
fig = plt.plot(xvals, sorted(self.axialEvals), "o")
fig = plt.ylim((.97 * min(self.axialEvals), 1.01 * max(self.axialEvals)))
fig = plt.ylabel("Eigenfrequency (Units of $\omega_z$)")
fig = plt.plot([-1, self.Nion + 1], [1, 1], color="black", linestyle="--")
else:
fig = plt.plot(xvals, sorted(self.axialEvalsE), "o")
fig = plt.ylim(.95 * min(self.axialEvalsE), 1.05 * max(self.axialEvalsE))
fig = plt.ylabel("Eigenfrequency (Hz)")
fig = plt.plot([-1, self.Nion + 1], [max(self.axialEvalsE), max(self.axialEvalsE)], color="black",
linestyle="--")
fig = plt.xlabel("Mode Number")
fig = plt.title("Axial Eigenvalues for %d Ions, $f_{rot}=$%.1f kHz, and $V_{wall}$= %.1f V " %
(self.Nion, self.wrot / (2 * pi * 1e3), self.Cw * self.V0 / 1612))
fig = plt.xlim((0, self.Nion + 1))
fig = plt.grid(True)
fig = plt.show()
return True
def get_x_and_y(self, pos_vect):
"""
Hand it a position vector and it will return the x and y vectors
:param pos_vect:
:return: [x,y] arrays
"""
return [pos_vect[:self.Nion], pos_vect[self.Nion:]]
def is_plane_stable(self):
"""
Checks to see if any of the axial eigenvalues in the current configuration of the crystal
are equal to zero. If so, this indicates that the one-plane configuration is unstable
and a 1-2 plane transistion is possible.
:return: Boolean: True if no 1-2 plane transistion mode exists, false if it does
(Answers: "is the plane stable?")
"""
if self.hasrun is False:
self.run()
for x in self.axialEvals:
if x == 0.0:
return False
return True
def rotate_crystal(self, pos_vect, theta, Nion=None):
"""
Given a position vector defining a crystal, rotates it by the angle theta
counter-clockwise.
:param pos_vect: Array of length 2*Nion defining the crystal to be rotated.
:param theta: Theta defining the angle to rotate the crystal around.
:param Nion: Number of ions in the crystal (can be optionally defined,
but will default to the number of ions in the class)
:return: The returned position vector of the new crystal
"""
if Nion is None:
Nion = self.Nion
x = pos_vect[:Nion]
y = pos_vect[Nion:]
xmod = x * | np.cos(theta) | numpy.cos |
# 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]) | numpy.array |
from collections import defaultdict
import pytest
import numpy as np
from numpy.testing import assert_equal, assert_almost_equal
from skimage.draw import line
from skan import csr
from skan._testdata import (
tinycycle, tinyline, skeleton0, skeleton1, skeleton2, skeleton3d,
topograph1d, skeleton4
)
def _old_branch_statistics(
skeleton_image, *, spacing=1, value_is_height=False
):
skel = csr.Skeleton(
skeleton_image, spacing=spacing, value_is_height=value_is_height
)
summary = csr.summarize(skel, value_is_height=value_is_height)
columns = ['node-id-src', 'node-id-dst', 'branch-distance', 'branch-type']
return summary[columns].to_numpy()
def test_tiny_cycle():
g, idxs = csr.skeleton_to_csgraph(tinycycle)
expected_indptr = [0, 2, 4, 6, 8]
expected_indices = [1, 2, 0, 3, 0, 3, 1, 2]
expected_data = | np.sqrt(2) | numpy.sqrt |
# *****************************************************************************
# Copyright (c) 2020, Intel Corporation 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.
#
# 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 HOLDER 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.
# *****************************************************************************
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import sdc
import unittest
from itertools import product
from sdc.str_arr_ext import StringArray
from sdc.str_ext import std_str_to_unicode, unicode_to_std_str
from sdc.tests.test_base import TestCase
from sdc.tests.test_utils import skip_numba_jit
from sdc.functions import numpy_like
from sdc.functions import sort
class TestArrays(TestCase):
def test_astype_to_num(self):
def ref_impl(a, t):
return a.astype(t)
def sdc_impl(a, t):
return numpy_like.astype(a, t)
sdc_func = self.jit(sdc_impl)
cases = [[5, 2, 0, 333, -4], [3.3, 5.4, np.nan]]
cases_type = [np.float64, np.int64, 'float64', 'int64']
for case in cases:
a = np.array(case)
for type_ in cases_type:
with self.subTest(data=case, type=type_):
np.testing.assert_array_equal(sdc_func(a, type_), ref_impl(a, type_))
def test_astype_to_float(self):
def ref_impl(a):
return a.astype('float64')
def sdc_impl(a):
return numpy_like.astype(a, 'float64')
sdc_func = self.jit(sdc_impl)
cases = [[2, 3, 0], [4., 5.6, np.nan]]
for case in cases:
a = np.array(case)
with self.subTest(data=case):
np.testing.assert_array_equal(sdc_func(a), ref_impl(a))
def test_astype_to_int(self):
def ref_impl(a):
return a.astype(np.int64)
def sdc_impl(a):
return numpy_like.astype(a, np.int64)
sdc_func = self.jit(sdc_impl)
cases = [[2, 3, 0], [4., 5.6, np.nan]]
for case in cases:
a = np.array(case)
with self.subTest(data=case):
np.testing.assert_array_equal(sdc_func(a), ref_impl(a))
def test_astype_int_to_str(self):
def ref_impl(a):
return a.astype(str)
def sdc_impl(a):
return numpy_like.astype(a, str)
sdc_func = self.jit(sdc_impl)
a = np.array([2, 3, 0])
np.testing.assert_array_equal(sdc_func(a), ref_impl(a))
@unittest.skip('Numba converts float to string with incorrect precision')
def test_astype_float_to_str(self):
def ref_impl(a):
return a.astype(str)
def sdc_impl(a):
return numpy_like.astype(a, str)
sdc_func = self.jit(sdc_impl)
a = np.array([4., 5.6, np.nan])
np.testing.assert_array_equal(sdc_func(a), ref_impl(a))
def test_astype_num_to_str(self):
def ref_impl(a):
return a.astype('str')
def sdc_impl(a):
return numpy_like.astype(a, 'str')
sdc_func = self.jit(sdc_impl)
a = np.array([5, 2, 0, 333, -4])
np.testing.assert_array_equal(sdc_func(a), ref_impl(a))
@unittest.skip('Needs Numba astype impl support converting unicode_type to other type')
def test_astype_str_to_num(self):
def ref_impl(a, t):
return a.astype(t)
def sdc_impl(a, t):
return numpy_like.astype(a, t)
sdc_func = self.jit(sdc_impl)
cases = [['a', 'cc', 'd'], ['3.3', '5', '.4'], ['¡Y', 'tú quién ', 'te crees']]
cases_type = [np.float64, np.int64]
for case in cases:
a = np.array(case)
for type_ in cases_type:
with self.subTest(data=case, type=type_):
np.testing.assert_array_equal(sdc_func(a, type_), ref_impl(a, type_))
def test_isnan(self):
def ref_impl(a):
return np.isnan(a)
def sdc_impl(a):
return numpy_like.isnan(a)
sdc_func = self.jit(sdc_impl)
cases = [[5, 2, 0, 333, -4], [3.3, 5.4, np.nan, 7.9, np.nan]]
for case in cases:
a = np.array(case)
with self.subTest(data=case):
np.testing.assert_array_equal(sdc_func(a), ref_impl(a))
@unittest.skip('Needs provide String Array boxing')
def test_isnan_str(self):
def ref_impl(a):
return np.isnan(a)
def sdc_impl(a):
return numpy_like.isnan(a)
sdc_func = self.jit(sdc_impl)
cases = [['a', 'cc', np.nan], ['se', None, 'vvv']]
for case in cases:
a = np.array(case)
with self.subTest(data=case):
np.testing.assert_array_equal(sdc_func(a), ref_impl(a))
def test_notnan(self):
def ref_impl(a):
return np.invert(np.isnan(a))
def sdc_impl(a):
return numpy_like.notnan(a)
sdc_func = self.jit(sdc_impl)
cases = [[5, 2, 0, 333, -4], [3.3, 5.4, np.nan, 7.9, np.nan]]
for case in cases:
a = np.array(case)
with self.subTest(data=case):
np.testing.assert_array_equal(sdc_func(a), ref_impl(a))
def test_copy(self):
from sdc.str_arr_ext import StringArray
def ref_impl(a):
return np.copy(a)
@self.jit
def sdc_func(a):
_a = StringArray(a) if as_str_arr == True else a # noqa
return numpy_like.copy(_a)
cases = {
'int': [5, 2, 0, 333, -4],
'float': [3.3, 5.4, np.nan, 7.9, np.nan],
'bool': [True, False, True],
'str': ['a', 'vv', 'o12oo']
}
for dtype, data in cases.items():
a = data if dtype == 'str' else np.asarray(data)
as_str_arr = True if dtype == 'str' else False
with self.subTest(case=data):
np.testing.assert_array_equal(sdc_func(a), ref_impl(a))
def test_copy_int(self):
def ref_impl():
a = np.array([5, 2, 0, 333, -4])
return np.copy(a)
def sdc_impl():
a = np.array([5, 2, 0, 333, -4])
return numpy_like.copy(a)
sdc_func = self.jit(sdc_impl)
np.testing.assert_array_equal(sdc_func(), ref_impl())
def test_copy_bool(self):
def ref_impl():
a = np.array([True, False, True])
return np.copy(a)
def sdc_impl():
a = np.array([True, False, True])
return numpy_like.copy(a)
sdc_func = self.jit(sdc_impl)
np.testing.assert_array_equal(sdc_func(), ref_impl())
@unittest.skip("Numba doesn't have string array")
def test_copy_str(self):
def ref_impl():
a = np.array(['a', 'vv', 'o12oo'])
return np.copy(a)
def sdc_impl():
a = np.array(['a', 'vv', 'o12oo'])
return numpy_like.copy(a)
sdc_func = self.jit(sdc_impl)
np.testing.assert_array_equal(sdc_func(), ref_impl())
def test_argmin(self):
def ref_impl(a):
return np.argmin(a)
def sdc_impl(a):
return numpy_like.argmin(a)
sdc_func = self.jit(sdc_impl)
cases = [[5, 2, 0, 333, -4], [3.3, 5.4, np.nan, 7.9, np.nan]]
for case in cases:
a = np.array(case)
with self.subTest(data=case):
np.testing.assert_array_equal(sdc_func(a), ref_impl(a))
def test_argmax(self):
def ref_impl(a):
return np.argmax(a)
def sdc_impl(a):
return numpy_like.argmax(a)
sdc_func = self.jit(sdc_impl)
cases = [[np.nan, np.nan, np.inf, np.nan], [5, 2, 0, 333, -4], [3.3, 5.4, np.nan, 7.9, np.nan]]
for case in cases:
a = np.array(case)
with self.subTest(data=case):
np.testing.assert_array_equal(sdc_func(a), ref_impl(a))
def test_nanargmin(self):
def ref_impl(a):
return np.nanargmin(a)
def sdc_impl(a):
return numpy_like.nanargmin(a)
sdc_func = self.jit(sdc_impl)
cases = [[5, 2, 0, 333, -4], [3.3, 5.4, np.nan, 7.9, np.nan]]
for case in cases:
a = np.array(case)
with self.subTest(data=case):
np.testing.assert_array_equal(sdc_func(a), ref_impl(a))
def test_nanargmax(self):
def ref_impl(a):
return np.nanargmax(a)
def sdc_impl(a):
return numpy_like.nanargmax(a)
sdc_func = self.jit(sdc_impl)
cases = [[np.nan, np.nan, np.inf, np.nan], [5, 2, -9, 333, -4], [3.3, 5.4, np.nan, 7.9]]
for case in cases:
a = np.array(case)
with self.subTest(data=case):
np.testing.assert_array_equal(sdc_func(a), ref_impl(a))
def test_sort(self):
np.random.seed(0)
def ref_impl(a):
return np.sort(a)
def sdc_impl(a):
sort.parallel_sort(a)
return a
sdc_func = self.jit(sdc_impl)
float_array = np.random.ranf(10**2)
int_arryay = np.random.randint(0, 127, 10**2)
float_cases = ['float32', 'float64']
for case in float_cases:
array0 = float_array.astype(case)
array1 = np.copy(array0)
with self.subTest(data=case):
np.testing.assert_array_equal(ref_impl(array0), sdc_func(array1))
int_cases = ['int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', 'uint64']
for case in int_cases:
array0 = int_arryay.astype(case)
array1 = np.copy(array0)
with self.subTest(data=case):
np.testing.assert_array_equal(ref_impl(array0), sdc_func(array1))
def test_stable_sort(self):
np.random.seed(0)
def ref_impl(a):
return np.sort(a)
def sdc_impl(a):
sort.parallel_stable_sort(a)
return a
sdc_func = self.jit(sdc_impl)
float_array = np.random.ranf(10**2)
int_arryay = np.random.randint(0, 127, 10**2)
float_cases = ['float32', 'float64']
for case in float_cases:
array0 = float_array.astype(case)
array1 = np.copy(array0)
with self.subTest(data=case):
np.testing.assert_array_equal(ref_impl(array0), sdc_func(array1))
int_cases = ['int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', 'uint64']
for case in int_cases:
array0 = int_arryay.astype(case)
array1 = np.copy(array0)
with self.subTest(data=case):
np.testing.assert_array_equal(ref_impl(array0), sdc_func(array1))
def _test_fillna_numeric(self, pyfunc, cfunc, inplace):
data_to_test = [
[True, False, False, True, True],
[5, 2, 0, 333, -4],
[3.3, 5.4, 7.9],
[3.3, 5.4, np.nan, 7.9, np.nan],
]
values_to_test = [
None,
np.nan,
2.1,
2
]
for data, value in product(data_to_test, values_to_test):
a1 = np.asarray(data)
a2 = pd.Series(np.copy(a1)) if inplace else pd.Series(a1)
with self.subTest(data=data, value=value):
result = cfunc(a1, value)
result_ref = pyfunc(a2, value)
if inplace:
result, result_ref = a1, a2
np.testing.assert_array_equal(result, result_ref)
def test_fillna_numeric_inplace_false(self):
def ref_impl(S, value):
if value is None:
return S.values.copy()
else:
return S.fillna(value=value, inplace=False).values
def sdc_impl(a, value):
return numpy_like.fillna(a, inplace=False, value=value)
sdc_func = self.jit(sdc_impl)
self._test_fillna_numeric(ref_impl, sdc_func, inplace=False)
def test_fillna_numeric_inplace_true(self):
def ref_impl(S, value):
if value is None:
return None
else:
S.fillna(value=value, inplace=True)
return None
def sdc_impl(a, value):
return numpy_like.fillna(a, inplace=True, value=value)
sdc_func = self.jit(sdc_impl)
self._test_fillna_numeric(ref_impl, sdc_func, inplace=True)
def test_fillna_str_inplace_false(self):
def ref_impl(S, value):
if value is None:
return S.values.copy()
else:
return S.fillna(value=value, inplace=False).values
def sdc_impl(S, value):
str_arr = S.values
return numpy_like.fillna(str_arr, inplace=False, value=value)
sdc_func = self.jit(sdc_impl)
data_to_test = [
['a', 'b', 'c', 'd'],
['a', 'b', None, 'c', None, 'd'],
]
values_to_test = [
None,
'',
'asd'
]
for data, value in product(data_to_test, values_to_test):
S = pd.Series(data)
with self.subTest(data=data, value=value):
result = sdc_func(S, value)
result_ref = ref_impl(S, value)
# FIXME: str_arr unifies None with np.nan and StringArray boxing always return np.nan
# to avoid mismatch in results for fill value == None use custom comparing func
def is_same_unify_nones(a, b):
return a == b or ((a is None or np.isnan(a)) and (b is None or np.isnan(b)))
cmp_result = np.asarray(
list(map(is_same_unify_nones, result, result_ref))
)
self.assertEqual(np.all(cmp_result), True)
class TestArrayReductions(TestCase):
def check_reduction_basic(self, pyfunc, alt_pyfunc, all_nans=True, comparator=None):
if not comparator:
comparator = np.testing.assert_array_equal
alt_cfunc = self.jit(alt_pyfunc)
def cases():
yield np.array([5, 2, 0, 333, -4])
yield np.array([3.3, 5.4, np.nan, 7.9, np.nan])
yield np.float64([1.0, 2.0, 0.0, -0.0, 1.0, -1.5])
yield np.float64([-0.0, -1.5])
yield np.float64([-1.5, 2.5, 'inf'])
yield np.float64([-1.5, 2.5, '-inf'])
yield np.float64([-1.5, 2.5, 'inf', '-inf'])
yield np.float64(['nan', -1.5, 2.5, 'nan', 3.0])
yield np.float64(['nan', -1.5, 2.5, 'nan', 'inf', '-inf', 3.0])
if all_nans:
# Only NaNs
yield np.float64(['nan', 'nan'])
for case in cases():
with self.subTest(data=case):
comparator(alt_cfunc(case), pyfunc(case))
def test_nanmean(self):
def ref_impl(a):
return np.nanmean(a)
def sdc_impl(a):
return numpy_like.nanmean(a)
self.check_reduction_basic(ref_impl, sdc_impl)
def test_nanmin(self):
def ref_impl(a):
return np.nanmin(a)
def sdc_impl(a):
return numpy_like.nanmin(a)
self.check_reduction_basic(ref_impl, sdc_impl)
def test_nanmax(self):
def ref_impl(a):
return np.nanmax(a)
def sdc_impl(a):
return numpy_like.nanmax(a)
self.check_reduction_basic(ref_impl, sdc_impl)
def test_nanprod(self):
def ref_impl(a):
return np.nanprod(a)
def sdc_impl(a):
return numpy_like.nanprod(a)
self.check_reduction_basic(ref_impl, sdc_impl)
def test_nansum(self):
def ref_impl(a):
return np.nansum(a)
def sdc_impl(a):
return numpy_like.nansum(a)
self.check_reduction_basic(ref_impl, sdc_impl)
def test_nanvar(self):
def ref_impl(a):
return | np.nanvar(a) | numpy.nanvar |
import numpy as np
from .base import IndependenceTest
from ._utils import _CheckInputs
class RV(IndependenceTest):
r"""
Class for calculating the RV test statistic and p-value.
RV is the multivariate generalization of the squared Pearson correlation
coefficient [#1RV]_. The RV coefficient can be thought to be closely
related to principal component analysis (PCA), canonical correlation
analysis (CCA), multivariate regression, and statistical classification
[#1RV]_.
See Also
--------
CCA : CCA test statistic and p-value.
Notes
-----
The statistic can be derived as follows [#1RV]_ [#2RV]_:
Let :math:`x` and :math:`y` be :math:`(n, p)` samples of random variables
:math:`X` and :math:`Y`. We can center :math:`x` and :math:`y` and then
calculate the sample covariance matrix :math:`\hat{\Sigma}_{xy} = x^T y`
and the variance matrices for :math:`x` and :math:`y` are defined
similarly. Then, the RV test statistic is found by calculating
.. math::
\mathrm{RV}_n (x, y) =
\frac{\mathrm{tr} \left( \hat{\Sigma}_{xy}
\hat{\Sigma}_{yx} \right)}
{\mathrm{tr} \left( \hat{\Sigma}_{xx}^2 \right)
\mathrm{tr} \left( \hat{\Sigma}_{yy}^2 \right)}
where :math:`\mathrm{tr} (\cdot)` is the trace operator.
References
----------
.. [#1RV] <NAME>., & <NAME>. (1976). A unifying tool for linear
multivariate statistical methods: the RV‐coefficient. *Journal
of the Royal Statistical Society: Series C (Applied
Statistics)*, 25(3), 257-265.
.. [#2RV] <NAME>. (1973). Le traitement des variables vectorielles.
*Biometrics*, 751-760.
"""
def __init__(self):
IndependenceTest.__init__(self)
def _statistic(self, x, y):
r"""
Helper function that calculates the RV test statistic.
Parameters
----------
x, y : ndarray
Input data matrices. `x` and `y` must have the same number of
samples and dimensions. That is, the shapes must be `(n, p)` where
`n` is the number of samples and `p` is the number of dimensions.
Returns
-------
stat : float
The computed RV statistic.
"""
centx = x - np.mean(x, axis=0)
centy = y - np.mean(y, axis=0)
# calculate covariance and variances for inputs
covar = centx.T @ centy
varx = centx.T @ centx
vary = centy.T @ centy
covar = np.trace(covar @ covar.T)
stat = np.divide(
covar, np.sqrt( | np.trace(varx @ varx) | numpy.trace |
# 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]) | numpy.array |
# Copyright (c) 2017-present, Facebook, Inc.
#
# 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.
##############################################################################
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from core.config import cfg
from datasets import json_dataset
import modeling.FPN as fpn
import roi_data.fast_rcnn
import utils.blob as blob_utils
from ops.collect_and_distribute_fpn_rpn_proposals \
import CollectAndDistributeFpnRpnProposalsOp
class CollectAndDistributeFpnRpnProposalsIntoPANOp(CollectAndDistributeFpnRpnProposalsOp):
def __init__(self, train):
assert cfg.PAN.PAN_ON, "CollectAndDistributeFpnRpnProposalsIntoPANOp was called when PAN_ON = False"
self._train = train
def distribute(self, rois, label_blobs, outputs, train):
"""To understand the output blob order see return value of
roi_data.fast_rcnn.get_fast_rcnn_blob_names(is_training=False)
"""
# Put all rois into rois without distribute
outputs[0].reshape(rois.shape)
outputs[0].data[...] = rois
# Distribute rois into different level according to map method
if not cfg.PAN.AdaptivePooling_ON:
lvl_min = cfg.FPN.ROI_MIN_LEVEL
lvl_max = cfg.FPN.ROI_MAX_LEVEL
lvls = fpn.map_rois_to_fpn_levels(rois[:, 1:5], lvl_min, lvl_max)
# Create new roi blobs for each FPN level
# (See: modeling.FPN.add_multilevel_roi_blobs which is similar but annoying
# to generalize to support this particular case.)
rois_idx_order = np.empty((0, ))
for output_idx, lvl in enumerate(range(lvl_min, lvl_max + 1)):
idx_lvl = np.where(lvls == lvl)[0]
blob_roi_level = rois[idx_lvl, :]
outputs[output_idx + 1].reshape(blob_roi_level.shape)
outputs[output_idx + 1].data[...] = blob_roi_level
rois_idx_order = | np.concatenate((rois_idx_order, idx_lvl)) | numpy.concatenate |
import numpy as np
import os,sys
# import torch
import glob
from cv2 import imread
from tqdm import tqdm
TAG_FLOAT = 202021.25
def EPE(input_flow, target_flow):
# return torch.norm(target_flow-input_flow,p=2,dim=1).mean()
return np.linalg.norm(target_flow-input_flow, ord=2, axis=1).mean()
def flow_read(file):
f = open(file,'rb')
flo_number = np.fromfile(f, np.float32, count=1)
assert flo_number[0] == TAG_FLOAT, 'Flow number %r incorrect. Invalid .flo file' % flo_number
w = np.fromfile(f, np.int32, count=1)
h = np.fromfile(f, np.int32, count=1)
data = np.fromfile(f, np.float32, count=2*w[0]*h[0])
# Reshape data into 3D array (columns, rows, bands)
flow = np.resize(data, (int(h), int(w), 2))
f.close()
return flow
def im2patch(im, pch_size, stride=1):
import numpy as np
import sys
'''
Transform image to patches.
Input:
im: 3 x H x W or 1 X H x W image, numpy format
pch_size: (int, int) tuple or integer
stride: (int, int) tuple or integer
'''
if isinstance(pch_size, tuple):
pch_H, pch_W = pch_size
elif isinstance(pch_size, int):
pch_H = pch_W = pch_size
else:
sys.exit('The input of pch_size must be a integer or a int tuple!')
if isinstance(stride, tuple):
stride_H, stride_W = stride
elif isinstance(stride, int):
stride_H = stride_W = stride
else:
sys.exit('The input of stride must be a integer or a int tuple!')
C, H, W = im.shape
num_H = len(range(0, H-pch_H+1, stride_H))
num_W = len(range(0, W-pch_W+1, stride_W))
num_pch = num_H * num_W
pch = np.zeros((C, pch_H*pch_W, num_pch), dtype=im.dtype)
kk = 0
for ii in range(pch_H):
for jj in range(pch_W):
temp = im[:, ii:H-pch_H+ii+1:stride_H, jj:W-pch_W+jj+1:stride_W]
pch[:, kk, :] = temp.reshape((C, num_pch))
kk += 1
return pch.reshape((C, pch_H, pch_W, num_pch))
def noise_estimate(im, pch_size=8):
'''
Implement of noise level estimation of the following paper:
<NAME> , <NAME> , <NAME> . An Efficient Statistical Method for Image Noise Level Estimation[C]// 2015 IEEE International Conference
on Computer Vision (ICCV). IEEE Computer Society, 2015.
Input:
im: the noise image, H x W x 3 or H x W numpy tensor, range [0,1]
pch_size: patch_size
Output:
noise_level: the estimated noise level
'''
import numpy as np
if im.ndim == 3:
# print(im.shape)
im = im.transpose((2, 0, 1))
# print(im.shape)
else:
print("see dim=1")
im = np.expand_dims(im, axis=0)
# image to patch
pch = im2patch(im, pch_size, 3) # C x pch_size x pch_size x num_pch tensor
num_pch = pch.shape[3]
pch = pch.reshape((-1, num_pch)) # d x num_pch matrix
d = pch.shape[0]
mu = pch.mean(axis=1, keepdims=True) # d x 1
X = pch - mu
sigma_X = np.matmul(X, X.transpose()) / num_pch
sig_value, _ = np.linalg.eigh(sigma_X)
sig_value.sort()
for ii in range(-1, -d-1, -1):
tau = np.mean(sig_value[:ii])
if np.sum(sig_value[:ii]>tau) == np.sum(sig_value[:ii] < tau):
return np.sqrt(tau)
all_tt_flo = glob.glob('./pwc-net/intensity/99/*.flo')
all_gt_flo = glob.glob('../data_all_nikon_half/*.flo')
all_tt_flo.sort()
all_gt_flo.sort()
# all_tt_flo = all_tt_flo[:400]
# all_gt_flo = all_gt_flo[:400]
assert(len(all_gt_flo)==len(all_tt_flo))
epelist = []
noiselist = []
for i in tqdm(range(len(all_gt_flo))):
assert(os.path.basename(all_gt_flo[i]) == os.path.basename(all_tt_flo[i]))
flow_tt = flow_read(all_tt_flo[i])
flow_gt = flow_read(all_gt_flo[i])
flow_tt = flow_tt / (np.abs(flow_tt).max())
flow_gt = flow_gt / (np.abs(flow_gt).max())
epe = EPE(flow_tt,flow_gt)
epelist.append(epe)
noisy_image_str = '../data_all_nikon_half/%s_img1.jpg'%os.path.basename(all_gt_flo[i])[0:10]
noisy_image = imread(noisy_image_str)
noise_level = noise_estimate(noisy_image)
noiselist.append(noise_level)
combinelist = []
for i in range(len(epelist)):
combinelist.append((noiselist[i],epelist[i]))
combinelist.sort()
list1 = []
for i in range(int(len(combinelist)/6*1)):
list1.append(combinelist[i][1])
print(np.mean(list1))
list2 = []
for i in range(int(len(combinelist)/6*2)):
list2.append(combinelist[i][1])
print( | np.mean(list2) | numpy.mean |
"""A set of useful functions for use in optimisation problems."""
import numpy as np
import scipy.io
def progress_bar(value, max_value, width=15):
"""Print progress bar.
Print a progress bar (utilising the carriage return function).
Parameters
----------
value : :obj:`float` or :obj:`int`
Number representing the current progress of process.
max_value : :obj:`float` or :obj:`int`
Maximum possible value in process.
width : :obj:`int`, optional
Number of characters in the progress bar. Default is 15.
"""
progress = round(value/max_value*width)
remaining = width - progress
print('\rOptimisation Progress: ' + "+"*progress + "-"*remaining, end="")
def evaluate(algorithm, runs=5, filepath=None, description=None):
"""Evaluate optimiser performance.
Evaluate the performance of an optimiser class. Because of the random
search nature of optimiser classes, sevveral evaulation runs are
performed and results are averaged.
Parameters
----------
algorithms : :class:`pracopt.optimiser.Optimiser`
The optimiser algorithm class to run.
runs : :obj:`int`, optional.
The number of runs to use when evaluating optimiser.
filepath : :obj:`str`, Optional
File path to save results to (as .mat file). If None, file is not
saved.
description : :obj:`str`, optional.
Description string to save with results.
Returns
-------
results : :class:`numpy.array`
Result array. Each row consists of [optimiser step, average time,
average value].
I.e. the results are averaged across "runs" by objective function
step.
"""
max_evals = algorithm._max_evaluations
f_data = | np.zeros((max_evals, runs)) | numpy.zeros |
'''
File contains functions used when training the NNs
'''
import numpy as np
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, InputLayer, Dropout
from tensorflow.keras.optimizers import Adam
import os
import pathlib
class UniformScaler:
'''
Class for a simple uniform scaler. Linearly transforms X such that all
samples in X are in the range [0,1].
'''
min_val = 0
diff = 1
def fit(self, X):
'''
Fit the parameters of the transformer based on the training data.
Args:
X (array) : The training data. Must have shape (nsamps, nfeatures).
'''
# Check shape of X.
if len(X.shape) != 2:
raise ValueError("X does not have the correct shape. Must have shape (nsamps, nfeatures)")
# Calculate min. value and largest diff. of all samples of X along the
# 0th axis. Both min_val and diff can be vectors if required.
self.min_val = np.min(X, axis=0)
self.diff = np.max(X, axis=0) - np.min(X, axis=0)
def transform(self, X):
'''
Transform the data.
Args:
X (array) : The data to be transformed.
Returns:
Array containing the transformed data.
'''
x = np.subtract(X, self.min_val)
return np.true_divide(x, self.diff)
def inverse_transform(self, X):
'''
Inverse transform the data.
Args:
X (array) : The data to be transformed.
Returns:
Array containing the inverse transformed data.
'''
x = np.multiply(X, self.diff)
return np.add(x, self.min_val)
class LogScaler:
'''
Class for a log scaler. Linearly transforms logX such that all samples in
logX are in the range [0,1].
'''
min_val = 0
diff = 1
def fit(self, X):
'''
Fit the parameters of the transformer based on the training data.
Args:
X (array) : The training data. Must have shape (nsamps, nfeatures).
'''
# Check shape of X.
if len(X.shape) != 2:
raise ValueError("X does not have the correct shape. Must have shape (nsamps, nfeatures)")
# Make sure there are no negative values or zeros.
if np.any(X<=0.):
raise ValueError("X contains negative values or zeros.")
X = np.log(X)
# Calculate min. value and largest diff. of all samples of X along the
# 0th axis. Both min_val and diff can be vectors if required.
self.min_val = np.min(X, axis=0)
self.diff = np.max(X, axis=0) - np.min(X, axis=0)
def transform(self, X):
'''
Transform the data.
Args:
X (array) : The data to be transformed.
Returns:
Array containing the transformed data.
'''
X = np.log(X)
x = np.subtract(X, self.min_val)
return np.true_divide(x, self.diff)
def inverse_transform(self, X):
'''
Inverse transform the data.
Args:
X (array) : The data to be transformed.
Returns:
Array containing the inverse transformed data.
'''
x = np.multiply(X, self.diff)
return np.exp(np.add(x, self.min_val))
class StandardScaler:
'''
Replacement for sklearn StandardScaler(). Rescales X such that it has zero
mean and unit variance.
'''
mean = 0
scale = 1
def fit(self, X):
'''
Fit the parameters of the transformer based on the training data.
Args:
X (array) : The training data. Must have shape (nsamps, nfeatures).
'''
# Check shape of X.
if len(X.shape) != 2:
raise ValueError("X does not have the correct shape. Must have shape (nsamps, nfeatures).")
# Calculate the mean and strandard deviation of X along the 0th axis.
# Can be vectors if needed.
self.mean = np.mean(X, axis=0)
self.scale = np.std(X, axis=0)
def transform(self, X):
'''
Transform the data.
Args:
X (array) : The data to be transformed.
Returns:
Array containing the transformed data.
'''
x = np.subtract(X, self.mean)
return np.true_divide(x, self.scale)
def inverse_transform(self, X):
'''
Inverse transform the data.
Args:
X (array) : The data to be transformed.
Returns:
Array containing the inverse transformed data.
'''
x = np.multiply(X, self.scale)
return np.add(x, self.mean)
class Resampler:
'''
Class for re-sampling the parameter space covered by a suite of simulations.
The new samples can then be used to generate training data for the base model
componenet emulators.
.. note::
See the `Generating training samples for the base model componenets
<../example_notebooks/resample_example.ipynb>`_ example.
Args:
simulation_samples (array) : The samples in the parameter space from the
simulation suite. Default is None.
parameter_ranges (array) : Ranges that define the extent of the parameter
space. Should have shape (n, 2), where the first column is the minimum
value for the n parameters, and the second column is the maximum.
Default is None.
use_latent_space (bool): If True the origonal simulation samples will be
transfromed into an uncorrelated latent space for re-sampling. Default
is False.
'''
def __init__(self, simulation_samples=None, parameter_ranges=None,
use_latent_space=False):
# Make sure the user has passed either simulation_samples or parameter_ranges.
if (simulation_samples is None) and (parameter_ranges is None):
raise ValueError("Please provide either simulation samples or parameter ranges.")
elif (parameter_ranges is None) and (use_latent_space is False):
self.min = np.min(simulation_samples, axis=0)
self.max = np.max(simulation_samples, axis=0)
self.diff = self.max - self.min
self.use_latent_space = use_latent_space
elif (parameter_ranges is None) and (use_latent_space is True):
self.L = np.linalg.cholesky(np.cov(simulation_samples, rowvar=False))
self.use_latent_space = use_latent_space
self.mean = np.mean(simulation_samples, axis=0)
latent_samples = np.matmul(np.linalg.inv(self.L), (simulation_samples-self.mean).T).T
self.min = latent_samples.min(axis=0)
self.max = latent_samples.max(axis=0)
self.diff = self.max - self.min
elif parameter_ranges is not None:
self.min = parameter_ranges[:,0]
self.max = parameter_ranges[:,1]
self.diff = self.max - self.min
self.use_latent_space = use_latent_space
def new_samples(self, nsamps, LH=True, buffer=None):
'''
Generate new samples from the region covered by the simulations.
Args:
nsamps (int) : The number of new samples to generate.
LH (bool) : If True will use latin-hypercube sampling. Default
is True.
Returns:
Array containing the new samples. Has shape (nsamps, d).
'''
if buffer is not None:
self.min = self.min*(1-buffer)
self.max = self.max*(1+buffer)
self.diff = self.max - self.min
if (LH is False) and (self.use_latent_space is False):
return np.random.uniform(self.min, self.max, size=(nsamps,self.min.shape[0]))
# How many dimensions in the sample space.
d = self.min.shape[0]
# Define the bin edges.
low_edge = np.arange(0, nsamps)/nsamps
high_edge = np.arange(1, nsamps+1)/nsamps
# Generate the samples.
latent_samples = | np.random.uniform(low_edge, high_edge, (d, nsamps)) | numpy.random.uniform |
import numpy as np
import batch_norm as bn
import relu as relu
import loss_functions.functions as fn
import sigmoid as sigmoid
import categorical_converter2 as cc
import mnist
def convert_y(s):
if s==b'Iris-setosa':
return int(1)
elif s==b'Iris-versicolor':
return int(2)
else:
return int(3)
def y_to_classification_form(y,n_classes):
"""
THIS WILL WORK, but the best solurtion is is implemented
y_count=len(y)
return_y=np.zeros(y_count*n_classes).reshape(y_count,n_classes)
for ix,item in enumerate(y):
return_y[ix,int(item)-1]=1.
return return_y
"""
return np.eye(n_classes)[y]
def fit(x_train,x_test,y_train,y_test):
"""temp for testing, load data from locafolder
"""
#data=np.loadtxt("/home/manjunath/iris/iris.csv", comments=None, delimiter=',', usecols=(0,1,2,3,4), converters={4: convert_y })
h=(10,10,10)
step_size=0.001
tolerence=0.001
iteration_max=1000
iteration=0
#Regularisation param, added to gradients
reg=0.01
K=np.unique(y_train).shape[0]
#x=np.loadtxt("/home/manjunath/iris/iris.csv", comments=None, delimiter=',', converters=None, usecols=(0,1,2,3))
"""
train_mean=np.mean(x_train,axis=0)
x_train=x_train-train_mean
#std_x = np.sqrt(np.sum(np.square(x_train - train_mean),axis=0)/x_train.shape[1])
std_x=np.std(x_train,axis=0)
x_train=x_train/std_x
x_test=x_test - train_mean
x_test=x_test/std_x
"""
y_train=y_to_classification_form(y_train,K)
y_test=y_to_classification_form(y_test,K)
n_samples,n_features=x_train.shape
gamma2=np.random.randn(h[0]).reshape(1,h[0])
beta2=np.random.randn(h[0]).reshape(1,h[0])
gamma3=np.random.randn(h[1]).reshape(1,h[1])
beta3=np.random.randn(h[1]).reshape(1,h[1])
eps=0.001
w1=(np.random.randn(n_features*h[0]).reshape(n_features,h[0]))/np.sqrt(2/(n_features+h[0]))
w2=(np.random.randn(h[0]*h[1]).reshape(h[0],h[1]))/np.sqrt(2/(h[0]+h[1]))
w3=(np.random.randn(h[1]*h[2]).reshape(h[1],h[2]))/np.sqrt(2/(h[1]+h[2]))
dw1_priv=np.zeros(w1.shape)
dw2_priv=np.zeros(w2.shape)
dw3_priv=np.zeros(w3.shape)
#w3=(np.random.randn(h[1]*K).reshape(h[1],K)*0.5)/np.sqrt(2/h[1]+K)
#Basically no significance, added bias for completion
b1 = np.zeros((1,h[0]))
b2 = np.zeros((1,h[1]))
b3 = np.zeros((1,K))
while iteration<iteration_max :
#Calculate scores
scores_layer1=np.dot(x_train,w1)+b1 # 125x4,4x10 = 125x10
#print("iteration",iteration, "first layer",np.any(np.isnan(scores_layer1)))
#Do not use sigmoid, you will be stuck in long mess of nans and inf and overflows and div by zeros
#x2=1/1+np.exp(-scores_layer1) # 150 x 4
#Use reLU
#x2=np.maximum(0,scores_layer1)
bn_x2,bn_cache2=bn.batch_norm_forword(scores_layer1,gamma2,beta2) #125x10
#print("iteration",iteration, "first layer BN",np.any(np.isnan(bn_x2)))
#x2=relu.relu_forword(bn_x2.T)
x2=relu.relu_forword(bn_x2) #125x10
#print("iteration",iteration, "first layer relu",np.any(np.isnan(x2)))
score_layer2=np.dot(x2,w2)+b2 #125x10,10x10=125x10
#print("iteration",iteration, "second layer",np.any(np.isnan(score_layer2)))
bn_x3,bn_cache3=bn.batch_norm_forword(score_layer2,gamma3,beta3) #125x10
x3=relu.relu_forword(bn_x3) #125x10
final_scores=np.dot(x3,w3)+b3 # 125x10,10x3=125x3
#Again, use softmax or sigmoid loss for classification, MSE or distance is for regression only
probs=fn.softmax(final_scores) #125x3
dscores=fn.cross_enropy_grad_singleclass(probs,y_train) # 125x3
#There is possibility of only 1 class for data, so use below, else the implementation will be bit complex
#print(x3.shape)
dw3=np.dot(x3.T,dscores) # 10x125,125x3=10x3
dx3=np.dot(w3,dscores.T) # 10x3,3x125=10x125
#dhid2=dx3.T
#dhid2[x3<=0]=0
dhid2=relu.relu_backword(dx3.T,x3) #125x10
#print("dhid2",dhid2.shape)
bn_dhid2,dgamma3,dbeta3=bn.batch_norm_backword(dhid2,bn_cache3) #125x10
#dprod = (x2 * (1- x2)) * dx2.T # this is wrong, find out why, we mostly need to multiply with upstream gradient
dw2=np.dot(x2.T,bn_dhid2) # 10x125,125x10=10x10
dx2=np.dot(w2,dhid2.T) #10x10,10x125=10x125
#dhid1=dx2.T
#dhid1[x2<=0]=0
dhid1=relu.relu_backword(dx2.T,x2) #125x10
bn_dx2,dgamma2,dbeta2=bn.batch_norm_backword(dhid1,bn_cache2) #125x10
#print(dprod.shape)
dw1 = np.dot( x_train.T,bn_dx2) # 125x4,12510=4x10
db1=np.sum(b1,axis=0,keepdims=True)
db2= | np.sum(b2,axis=0,keepdims=True) | numpy.sum |
import numpy as np
from gtsam import SfmTrack
from gtsfm.common.image import Image
import gtsfm.utils.images as image_utils
def test_get_average_point_color():
""" Ensure 3d point color is computed as mean of RGB per 2d measurement."""
# random point; 2d measurements below are dummy locations (not actual projection)
triangulated_pt = np.array([1, 2, 1])
track_3d = SfmTrack(triangulated_pt)
# in camera 0
track_3d.add_measurement(idx=0, m=np.array([130, 80]))
# in camera 1
track_3d.add_measurement(idx=1, m=np.array([10, 60]))
img0 = np.zeros((100, 200, 3), dtype=np.uint8)
img0[80, 130] = | np.array([40, 50, 60]) | numpy.array |
"""
Unit tests for Group.
"""
from __future__ import print_function
import itertools
import unittest
from six import assertRaisesRegex, iteritems
from six.moves import range
import numpy as np
try:
from parameterized import parameterized
except ImportError:
from openmdao.utils.assert_utils import SkipParameterized as parameterized
import openmdao.api as om
from openmdao.test_suite.components.sellar import SellarDis2
from openmdao.utils.assert_utils import assert_rel_error, assert_warning
from openmdao.utils.logger_utils import TestLogger
from openmdao.error_checking.check_config import _check_hanging_inputs
class SimpleGroup(om.Group):
def __init__(self):
super(SimpleGroup, self).__init__()
self.add_subsystem('comp1', om.IndepVarComp('x', 5.0))
self.add_subsystem('comp2', om.ExecComp('b=2*a'))
self.connect('comp1.x', 'comp2.a')
class BranchGroup(om.Group):
def __init__(self):
super(BranchGroup, self).__init__()
b1 = self.add_subsystem('Branch1', om.Group())
g1 = b1.add_subsystem('G1', om.Group())
g2 = g1.add_subsystem('G2', om.Group())
g2.add_subsystem('comp1', om.ExecComp('b=2.0*a', a=3.0, b=6.0))
b2 = self.add_subsystem('Branch2', om.Group())
g3 = b2.add_subsystem('G3', om.Group())
g3.add_subsystem('comp2', om.ExecComp('b=3.0*a', a=4.0, b=12.0))
class SetOrderGroup(om.Group):
def setup(self):
self.add_subsystem('C1', om.ExecComp('y=2.0*x'))
self.add_subsystem('C2', om.ExecComp('y=2.0*x'))
self.add_subsystem('C3', om.ExecComp('y=2.0*x'))
self.set_order(['C1', 'C3', 'C2'])
self.connect('C1.y', 'C3.x')
self.connect('C3.y', 'C2.x')
class ReportOrderComp(om.ExplicitComponent):
def __init__(self, order_list):
super(ReportOrderComp, self).__init__()
self._order_list = order_list
def setup(self):
self.add_input('x', 0.0)
self.add_output('y', 0.0)
def compute(self, inputs, outputs):
self._order_list.append(self.pathname)
class TestGroup(unittest.TestCase):
def test_add_subsystem_class(self):
p = om.Problem()
try:
p.model.add_subsystem('comp', om.IndepVarComp)
except TypeError as err:
self.assertEqual(str(err), "Group: Subsystem 'comp' should be an instance, "
"but a IndepVarComp class object was found.")
else:
self.fail('Exception expected.')
def test_same_sys_name(self):
"""Test error checking for the case where we add two subsystems with the same name."""
p = om.Problem()
p.model.add_subsystem('comp1', om.IndepVarComp('x', 5.0))
p.model.add_subsystem('comp2', om.ExecComp('b=2*a'))
try:
p.model.add_subsystem('comp2', om.ExecComp('b=2*a'))
except Exception as err:
self.assertEqual(str(err), "Group: Subsystem name 'comp2' is already used.")
else:
self.fail('Exception expected.')
def test_deprecated_runonce(self):
p = om.Problem()
p.model.add_subsystem('indep', om.IndepVarComp('x', 5.0))
p.model.add_subsystem('comp', om.ExecComp('b=2*a'))
msg = "NonLinearRunOnce is deprecated. Use NonlinearRunOnce instead."
with assert_warning(DeprecationWarning, msg):
p.model.nonlinear_solver = om.NonLinearRunOnce()
def test_group_simple(self):
import openmdao.api as om
p = om.Problem()
p.model.add_subsystem('comp1', om.ExecComp('b=2.0*a', a=3.0, b=6.0))
p.setup()
self.assertEqual(p['comp1.a'], 3.0)
self.assertEqual(p['comp1.b'], 6.0)
def test_group_add(self):
model = om.Group()
ecomp = om.ExecComp('b=2.0*a', a=3.0, b=6.0)
msg = "The 'add' method provides backwards compatibility with OpenMDAO <= 1.x ; " \
"use 'add_subsystem' instead."
with assert_warning(DeprecationWarning, msg):
comp1 = model.add('comp1', ecomp)
self.assertTrue(ecomp is comp1)
def test_group_simple_promoted(self):
import openmdao.api as om
p = om.Problem()
p.model.add_subsystem('indep', om.IndepVarComp('a', 3.0),
promotes_outputs=['a'])
p.model.add_subsystem('comp1', om.ExecComp('b=2.0*a'),
promotes_inputs=['a'])
p.setup()
p.run_model()
self.assertEqual(p['a'], 3.0)
self.assertEqual(p['comp1.b'], 6.0)
def test_inner_connect_w_extern_promote(self):
p = om.Problem()
g = p.model.add_subsystem('g', om.Group(), promotes_inputs=['c0.x'])
g.add_subsystem('ivc', om.IndepVarComp('x', 2.))
g.add_subsystem('c0', om.ExecComp('y = 2*x'))
g.connect('ivc.x', 'c0.x')
p.setup()
p.final_setup()
from openmdao.error_checking.check_config import _get_promoted_connected_ins
ins = _get_promoted_connected_ins(p.model)
self.assertEqual(len(ins), 1)
inp, tup = list(ins.items())[0]
in_proms, mans = tup
self.assertEqual(inp, 'g.c0.x')
self.assertEqual(in_proms, ['g'])
self.assertEqual(mans, [('c0.x', 'g')])
def test_inner_connect_w_2extern_promotes(self):
p = om.Problem()
g0 = p.model.add_subsystem('g0', om.Group(), promotes_inputs=['c0.x'])
g = g0.add_subsystem('g', om.Group(), promotes_inputs=['c0.x'])
g.add_subsystem('ivc', om.IndepVarComp('x', 2.))
g.add_subsystem('c0', om.ExecComp('y = 2*x'))
g.connect('ivc.x', 'c0.x')
p.setup()
p.final_setup()
from openmdao.error_checking.check_config import _get_promoted_connected_ins
ins = _get_promoted_connected_ins(p.model)
self.assertEqual(len(ins), 1)
inp, tup = list(ins.items())[0]
in_proms, mans = tup
self.assertEqual(inp, 'g0.g.c0.x')
self.assertEqual(list(sorted(in_proms)), ['g0', 'g0.g'])
self.assertEqual(mans, [('c0.x', 'g0.g')])
def test_group_rename_connect(self):
import openmdao.api as om
p = om.Problem()
p.model.add_subsystem('indep', om.IndepVarComp('aa', 3.0),
promotes=['aa'])
p.model.add_subsystem('comp1', om.ExecComp('b=2.0*aa'),
promotes_inputs=['aa'])
# here we alias 'a' to 'aa' so that it will be automatically
# connected to the independent variable 'aa'.
p.model.add_subsystem('comp2', om.ExecComp('b=3.0*a'),
promotes_inputs=[('a', 'aa')])
p.setup()
p.run_model()
self.assertEqual(p['comp1.b'], 6.0)
self.assertEqual(p['comp2.b'], 9.0)
def test_double_promote_conns(self):
p = om.Problem()
gouter = p.model.add_subsystem('gouter', om.Group())
gouter.add_subsystem('couter', om.ExecComp('xx = a * 3.'), promotes_outputs=['xx'])
g = gouter.add_subsystem('g', om.Group(), promotes_inputs=[('x', 'xx')])
g.add_subsystem('ivc', om.IndepVarComp('x', 2.), promotes_outputs=['x'])
g.add_subsystem('c0', om.ExecComp('y = 2*x'), promotes_inputs=['x'])
with self.assertRaises(RuntimeError) as cm:
p.setup()
self.assertEqual(str(cm.exception),
"Group (gouter): The following inputs have multiple connections: gouter.g.c0.x from ['gouter.couter.xx', 'gouter.g.ivc.x']")
def test_double_promote_one_conn(self):
p = om.Problem()
gouter = p.model.add_subsystem('gouter', om.Group())
gouter.add_subsystem('couter', om.ExecComp('xx = a * 3.'))
g = gouter.add_subsystem('g', om.Group(), promotes_inputs=[('x', 'xx')])
g.add_subsystem('ivc', om.IndepVarComp('x', 2.), promotes_outputs=['x'])
g.add_subsystem('c0', om.ExecComp('y = 2*x'), promotes_inputs=['x'])
p.setup()
self.assertEqual(p.model._conn_global_abs_in2out['gouter.g.c0.x'], 'gouter.g.ivc.x')
def test_check_unconn_inputs_w_promote_rename(self):
p = om.Problem()
gouter = p.model.add_subsystem('gouter', om.Group())
gouter.add_subsystem('couter', om.ExecComp('xx = a * 3.'))
g = gouter.add_subsystem('g', om.Group(), promotes_inputs=['xx'])
g.add_subsystem('ivc', om.IndepVarComp('x', 2.), promotes_outputs=['x'])
g.add_subsystem('c0', om.ExecComp('y = 2*x'), promotes_inputs=[('x', 'xx')])
p.setup()
logger = TestLogger()
_check_hanging_inputs(p, logger)
for w in logger.get('warning'):
if 'The following inputs are not connected:' in w:
if "gouter.couter.a" in w and "gouter.xx: ['gouter.g.c0.x']" in w:
break
else:
self.fail("Expected warning not found.")
self.assertEqual(p.model._conn_global_abs_in2out, {})
def test_subsys_attributes(self):
p = om.Problem()
class MyGroup(om.Group):
def setup(self):
# two subsystems added during setup
self.add_subsystem('comp1', om.ExecComp('b=2.0*a', a=3.0, b=6.0))
self.add_subsystem('comp2', om.ExecComp('b=3.0*a', a=4.0, b=12.0))
# subsystems become attributes
my_group = p.model.add_subsystem('gg', MyGroup())
self.assertTrue(p.model.gg is my_group)
# after calling setup(), MyGroup's subsystems are also attributes
p.setup()
self.assertTrue(hasattr(p.model.gg, 'comp1'))
self.assertTrue(hasattr(p.model.gg, 'comp2'))
# calling setup() again doesn't break anything
p.setup()
self.assertTrue(p.model.gg is my_group)
self.assertTrue(hasattr(p.model.gg, 'comp1'))
self.assertTrue(hasattr(p.model.gg, 'comp2'))
# name cannot start with an underscore
with self.assertRaises(Exception) as err:
p.model.add_subsystem('_bad_name', om.Group())
self.assertEqual(str(err.exception),
"Group (<model>): '_bad_name' is not a valid sub-system name.")
# 'name', 'pathname', 'comm' and 'options' are reserved names
for reserved in ['name', 'pathname', 'comm', 'options']:
with self.assertRaises(Exception) as err:
p.model.add_subsystem(reserved, om.Group())
self.assertEqual(str(err.exception),
"Group (<model>): Can't add subsystem '%s' because an attribute with that name already exits." %
reserved)
def test_group_nested(self):
import openmdao.api as om
p = om.Problem()
p.model.add_subsystem('G1', om.Group())
p.model.G1.add_subsystem('comp1', om.ExecComp('b=2.0*a', a=3.0, b=6.0))
p.model.G1.add_subsystem('comp2', om.ExecComp('b=3.0*a', a=4.0, b=12.0))
p.setup()
self.assertEqual(p['G1.comp1.a'], 3.0)
self.assertEqual(p['G1.comp1.b'], 6.0)
self.assertEqual(p['G1.comp2.a'], 4.0)
self.assertEqual(p['G1.comp2.b'], 12.0)
def test_group_getsystem_top(self):
import openmdao.api as om
from openmdao.core.tests.test_group import BranchGroup
p = om.Problem(model=BranchGroup())
p.setup()
c1 = p.model.Branch1.G1.G2.comp1
self.assertEqual(c1.pathname, 'Branch1.G1.G2.comp1')
c2 = p.model.Branch2.G3.comp2
self.assertEqual(c2.pathname, 'Branch2.G3.comp2')
def test_group_nested_promoted1(self):
import openmdao.api as om
# promotes from bottom level up 1
p = om.Problem()
g1 = p.model.add_subsystem('G1', om.Group())
g1.add_subsystem('comp1', om.ExecComp('b=2.0*a', a=3.0, b=6.0),
promotes_inputs=['a'], promotes_outputs=['b'])
g1.add_subsystem('comp2', om.ExecComp('b=3.0*a', a=4.0, b=12.0),
promotes_inputs=['a'])
p.setup()
# output G1.comp1.b is promoted
self.assertEqual(p['G1.b'], 6.0)
# output G1.comp2.b is not promoted
self.assertEqual(p['G1.comp2.b'], 12.0)
# use unpromoted names for the following 2 promoted inputs
self.assertEqual(p['G1.comp1.a'], 3.0)
self.assertEqual(p['G1.comp2.a'], 4.0)
def test_group_nested_promoted2(self):
import openmdao.api as om
# promotes up from G1 level
p = om.Problem()
g1 = om.Group()
g1.add_subsystem('comp1', om.ExecComp('b=2.0*a', a=3.0, b=6.0))
g1.add_subsystem('comp2', om.ExecComp('b=3.0*a', a=4.0, b=12.0))
# use glob pattern 'comp?.a' to promote both comp1.a and comp2.a
# use glob pattern 'comp?.b' to promote both comp1.b and comp2.b
p.model.add_subsystem('G1', g1,
promotes_inputs=['comp?.a'],
promotes_outputs=['comp?.b'])
p.setup()
# output G1.comp1.b is promoted
self.assertEqual(p['comp1.b'], 6.0)
# output G1.comp2.b is promoted
self.assertEqual(p['comp2.b'], 12.0)
# access both promoted inputs using unpromoted names.
self.assertEqual(p['G1.comp1.a'], 3.0)
self.assertEqual(p['G1.comp2.a'], 4.0)
def test_group_promotes(self):
"""Promoting a single variable."""
p = om.Problem()
p.model.add_subsystem('comp1', om.IndepVarComp([('a', 2.0), ('x', 5.0)]),
promotes_outputs=['x'])
p.model.add_subsystem('comp2', om.ExecComp('y=2*x'), promotes_inputs=['x'])
p.setup()
p.set_solver_print(level=0)
p.run_model()
self.assertEqual(p['comp1.a'], 2)
self.assertEqual(p['x'], 5)
self.assertEqual(p['comp2.y'], 10)
def test_group_renames(self):
p = om.Problem()
p.model.add_subsystem('comp1', om.IndepVarComp('x', 5.0),
promotes_outputs=[('x', 'foo')])
p.model.add_subsystem('comp2', om.ExecComp('y=2*foo'), promotes_inputs=['foo'])
p.setup()
p.set_solver_print(level=0)
p.run_model()
self.assertEqual(p['foo'], 5)
self.assertEqual(p['comp2.y'], 10)
def test_group_renames_errors_single_string(self):
p = om.Problem()
with self.assertRaises(Exception) as err:
p.model.add_subsystem('comp1', om.IndepVarComp('x', 5.0),
promotes_outputs='x')
self.assertEqual(str(err.exception),
"Group: promotes must be an iterator of strings and/or tuples.")
def test_group_renames_errors_not_found(self):
p = om.Problem()
p.model.add_subsystem('comp1', om.IndepVarComp('x', 5.0),
promotes_outputs=[('xx', 'foo')])
p.model.add_subsystem('comp2', om.ExecComp('y=2*foo'), promotes_inputs=['foo'])
with self.assertRaises(Exception) as err:
p.setup()
self.assertEqual(str(err.exception),
"IndepVarComp (comp1): 'promotes_outputs' failed to find any matches for "
"the following names or patterns: ['xx'].")
def test_group_renames_errors_bad_tuple(self):
p = om.Problem()
p.model.add_subsystem('comp1', om.IndepVarComp('x', 5.0),
promotes_outputs=[('x', 'foo', 'bar')])
p.model.add_subsystem('comp2', om.ExecComp('y=2*foo'), promotes_inputs=['foo'])
with self.assertRaises(Exception) as err:
p.setup()
self.assertEqual(str(err.exception),
"when adding subsystem 'comp1', entry '('x', 'foo', 'bar')' "
"is not a string or tuple of size 2")
def test_group_promotes_multiple(self):
"""Promoting multiple variables."""
p = om.Problem()
p.model.add_subsystem('comp1', om.IndepVarComp([('a', 2.0), ('x', 5.0)]),
promotes_outputs=['a', 'x'])
p.model.add_subsystem('comp2', om.ExecComp('y=2*x'),
promotes_inputs=['x'])
p.setup()
p.set_solver_print(level=0)
p.run_model()
self.assertEqual(p['a'], 2)
self.assertEqual(p['x'], 5)
self.assertEqual(p['comp2.y'], 10)
def test_group_promotes_all(self):
"""Promoting all variables with asterisk."""
p = om.Problem()
p.model.add_subsystem('comp1', om.IndepVarComp([('a', 2.0), ('x', 5.0)]),
promotes_outputs=['*'])
p.model.add_subsystem('comp2', om.ExecComp('y=2*x'),
promotes_inputs=['x'])
p.setup()
p.set_solver_print(level=0)
p.run_model()
self.assertEqual(p['a'], 2)
self.assertEqual(p['x'], 5)
self.assertEqual(p['comp2.y'], 10)
def test_group_promotes2(self):
class Sellar(om.Group):
def setup(self):
dv = self.add_subsystem('des_vars', om.IndepVarComp(), promotes=['*'])
dv.add_output('x', 1.0)
dv.add_output('z', np.array([5.0, 2.0]))
self.add_subsystem('d1', SellarDis2(),
promotes_inputs=['y1'], promotes_outputs=['foo'])
self.add_subsystem('d2', SellarDis2())
p = om.Problem()
p.model = Sellar()
with self.assertRaises(Exception) as err:
p.setup()
self.assertEqual(str(err.exception),
"SellarDis2 (d1): 'promotes_outputs' failed to find any matches for "
"the following names or patterns: ['foo'].")
def test_group_nested_conn(self):
"""Example of adding subsystems and issuing connections with nested groups."""
g1 = om.Group()
c1_1 = g1.add_subsystem('comp1', om.IndepVarComp('x', 5.0))
c1_2 = g1.add_subsystem('comp2', om.ExecComp('b=2*a'))
g1.connect('comp1.x', 'comp2.a')
g2 = om.Group()
c2_1 = g2.add_subsystem('comp1', om.ExecComp('b=2*a'))
c2_2 = g2.add_subsystem('comp2', om.ExecComp('b=2*a'))
g2.connect('comp1.b', 'comp2.a')
model = om.Group()
model.add_subsystem('group1', g1)
model.add_subsystem('group2', g2)
model.connect('group1.comp2.b', 'group2.comp1.a')
p = om.Problem(model=model)
p.setup()
c1_1 = p.model.group1.comp1
c1_2 = p.model.group1.comp2
c2_1 = p.model.group2.comp1
c2_2 = p.model.group2.comp2
self.assertEqual(c1_1.name, 'comp1')
self.assertEqual(c1_2.name, 'comp2')
self.assertEqual(c2_1.name, 'comp1')
self.assertEqual(c2_2.name, 'comp2')
c1_1 = p.model.group1.comp1
c1_2 = p.model.group1.comp2
c2_1 = p.model.group2.comp1
c2_2 = p.model.group2.comp2
self.assertEqual(c1_1.name, 'comp1')
self.assertEqual(c1_2.name, 'comp2')
self.assertEqual(c2_1.name, 'comp1')
self.assertEqual(c2_2.name, 'comp2')
s = p.model._get_subsystem('')
self.assertEqual(s, None)
p.set_solver_print(level=0)
p.run_model()
self.assertEqual(p['group1.comp1.x'], 5.0)
self.assertEqual(p['group1.comp2.b'], 10.0)
self.assertEqual(p['group2.comp1.b'], 20.0)
self.assertEqual(p['group2.comp2.b'], 40.0)
def test_reused_output_promoted_names(self):
prob = om.Problem()
prob.model.add_subsystem('px1', om.IndepVarComp('x1', 100.0))
G1 = prob.model.add_subsystem('G1', om.Group())
G1.add_subsystem("C1", om.ExecComp("y=2.0*x"), promotes=['y'])
G1.add_subsystem("C2", om.ExecComp("y=2.0*x"), promotes=['y'])
msg = r"Output name 'y' refers to multiple outputs: \['G1.C1.y', 'G1.C2.y'\]."
with assertRaisesRegex(self, Exception, msg):
prob.setup()
def test_basic_connect_units(self):
import numpy as np
import openmdao.api as om
p = om.Problem()
indep_comp = om.IndepVarComp()
indep_comp.add_output('x', np.ones(5), units='ft')
exec_comp = om.ExecComp('y=sum(x)',
x={'value': np.zeros(5), 'units': 'inch'},
y={'units': 'inch'})
p.model.add_subsystem('indep', indep_comp)
p.model.add_subsystem('comp1', exec_comp)
p.model.connect('indep.x', 'comp1.x')
p.setup()
p.run_model()
assert_rel_error(self, p['indep.x'], np.ones(5))
assert_rel_error(self, p['comp1.x'], np.ones(5)*12.)
assert_rel_error(self, p['comp1.y'], 60.)
def test_connect_1_to_many(self):
import numpy as np
import openmdao.api as om
p = om.Problem()
p.model.add_subsystem('indep', om.IndepVarComp('x', np.ones(5)))
p.model.add_subsystem('C1', om.ExecComp('y=sum(x)*2.0', x=np.zeros(5)))
p.model.add_subsystem('C2', om.ExecComp('y=sum(x)*4.0', x=np.zeros(5)))
p.model.add_subsystem('C3', om.ExecComp('y=sum(x)*6.0', x=np.zeros(5)))
p.model.connect('indep.x', ['C1.x', 'C2.x', 'C3.x'])
p.setup()
p.run_model()
assert_rel_error(self, p['C1.y'], 10.)
assert_rel_error(self, p['C2.y'], 20.)
assert_rel_error(self, p['C3.y'], 30.)
def test_double_src_indices(self):
class MyComp1(om.ExplicitComponent):
def setup(self):
self.add_input('x', np.ones(3), src_indices=[0, 1, 2])
self.add_output('y', 1.0)
def compute(self, inputs, outputs):
outputs['y'] = np.sum(inputs['x'])*2.0
p = om.Problem()
p.model.add_subsystem('indep', om.IndepVarComp('x', np.ones(5)))
p.model.add_subsystem('C1', MyComp1())
p.model.connect('indep.x', 'C1.x', src_indices=[1, 0, 2])
with self.assertRaises(Exception) as context:
p.setup()
self.assertEqual(str(context.exception),
"Group (<model>): src_indices has been defined in both "
"connect('indep.x', 'C1.x') and add_input('C1.x', ...).")
def test_connect_src_indices(self):
import numpy as np
import openmdao.api as om
p = om.Problem()
p.model.add_subsystem('indep', om.IndepVarComp('x', np.ones(5)))
p.model.add_subsystem('C1', om.ExecComp('y=sum(x)*2.0', x=np.zeros(3)))
p.model.add_subsystem('C2', om.ExecComp('y=sum(x)*4.0', x=np.zeros(2)))
# connect C1.x to the first 3 entries of indep.x
p.model.connect('indep.x', 'C1.x', src_indices=[0, 1, 2])
# connect C2.x to the last 2 entries of indep.x
# use -2 (same as 3 in this case) to show that negative indices work.
p.model.connect('indep.x', 'C2.x', src_indices=[-2, 4])
p.setup()
p.run_model()
assert_rel_error(self, p['C1.x'], np.ones(3))
assert_rel_error(self, p['C1.y'], 6.)
assert_rel_error(self, p['C2.x'], np.ones(2))
assert_rel_error(self, p['C2.y'], 8.)
def test_connect_src_indices_noflat(self):
import numpy as np
import openmdao.api as om
p = om.Problem()
p.model.add_subsystem('indep', om.IndepVarComp('x', np.arange(12).reshape((4, 3))))
p.model.add_subsystem('C1', om.ExecComp('y=sum(x)*2.0', x=np.zeros((2, 2))))
# connect C1.x to entries (0,0), (-1,1), (2,1), (1,1) of indep.x
p.model.connect('indep.x', 'C1.x',
src_indices=[[(0, 0), (-1, 1)],
[(2, 1), (1, 1)]], flat_src_indices=False)
p.setup()
p.run_model()
assert_rel_error(self, p['C1.x'], np.array([[0., 10.],
[7., 4.]]))
assert_rel_error(self, p['C1.y'], 42.)
def test_promote_not_found1(self):
p = om.Problem()
p.model.add_subsystem('indep', om.IndepVarComp('x', np.ones(5)),
promotes_outputs=['x'])
p.model.add_subsystem('C1', om.ExecComp('y=x'), promotes_inputs=['x'])
p.model.add_subsystem('C2', om.ExecComp('y=x'), promotes_outputs=['x*'])
with self.assertRaises(Exception) as context:
p.setup()
self.assertEqual(str(context.exception),
"ExecComp (C2): 'promotes_outputs' failed to find any matches for "
"the following names or patterns: ['x*'].")
def test_promote_not_found2(self):
p = om.Problem()
p.model.add_subsystem('indep', om.IndepVarComp('x', np.ones(5)),
promotes_outputs=['x'])
p.model.add_subsystem('C1', om.ExecComp('y=x'), promotes_inputs=['x'])
p.model.add_subsystem('C2', om.ExecComp('y=x'), promotes_inputs=['xx'])
with self.assertRaises(Exception) as context:
p.setup()
self.assertEqual(str(context.exception),
"ExecComp (C2): 'promotes_inputs' failed to find any matches for "
"the following names or patterns: ['xx'].")
def test_promote_not_found3(self):
p = om.Problem()
p.model.add_subsystem('indep', om.IndepVarComp('x', np.ones(5)),
promotes_outputs=['x'])
p.model.add_subsystem('C1', om.ExecComp('y=x'), promotes=['x'])
p.model.add_subsystem('C2', om.ExecComp('y=x'), promotes=['xx'])
with self.assertRaises(Exception) as context:
p.setup()
self.assertEqual(str(context.exception),
"ExecComp (C2): 'promotes' failed to find any matches for "
"the following names or patterns: ['xx'].")
def test_missing_promote_var(self):
p = om.Problem()
indep_var_comp = om.IndepVarComp('z', val=2.)
p.model.add_subsystem('indep_vars', indep_var_comp, promotes=['*'])
p.model.add_subsystem('d1', om.ExecComp("y1=z+bar"),
promotes_inputs=['z', 'foo'])
with self.assertRaises(Exception) as context:
p.setup()
self.assertEqual(str(context.exception),
"ExecComp (d1): 'promotes_inputs' failed to find any matches for "
"the following names or patterns: ['foo'].")
def test_missing_promote_var2(self):
p = om.Problem()
indep_var_comp = om.IndepVarComp('z', val=2.)
p.model.add_subsystem('indep_vars', indep_var_comp, promotes=['*'])
p.model.add_subsystem('d1', om.ExecComp("y1=z+bar"),
promotes_outputs=['y1', 'blammo', ('bar', 'blah')])
with self.assertRaises(Exception) as context:
p.setup()
self.assertEqual(str(context.exception),
"ExecComp (d1): 'promotes_outputs' failed to find any matches for "
"the following names or patterns: ['bar', 'blammo'].")
def test_promote_src_indices(self):
import numpy as np
import openmdao.api as om
class MyComp1(om.ExplicitComponent):
def setup(self):
# this input will connect to entries 0, 1, and 2 of its source
self.add_input('x', np.ones(3), src_indices=[0, 1, 2])
self.add_output('y', 1.0)
def compute(self, inputs, outputs):
outputs['y'] = np.sum(inputs['x'])*2.0
class MyComp2(om.ExplicitComponent):
def setup(self):
# this input will connect to entries 3 and 4 of its source
self.add_input('x', np.ones(2), src_indices=[3, 4])
self.add_output('y', 1.0)
def compute(self, inputs, outputs):
outputs['y'] = np.sum(inputs['x'])*4.0
p = om.Problem()
# by promoting the following output and inputs to 'x', they will
# be automatically connected
p.model.add_subsystem('indep', om.IndepVarComp('x', np.ones(5)),
promotes_outputs=['x'])
p.model.add_subsystem('C1', MyComp1(), promotes_inputs=['x'])
p.model.add_subsystem('C2', MyComp2(), promotes_inputs=['x'])
p.setup()
p.run_model()
assert_rel_error(self, p['C1.x'], np.ones(3))
assert_rel_error(self, p['C1.y'], 6.)
assert_rel_error(self, p['C2.x'], np.ones(2))
assert_rel_error(self, p['C2.y'], 8.)
def test_promote_src_indices_nonflat(self):
import numpy as np
import openmdao.api as om
class MyComp(om.ExplicitComponent):
def setup(self):
# We want to pull the following 4 values out of the source:
# [(0,0), (3,1), (2,1), (1,1)].
# Because our input is also non-flat we arrange the
# source index tuples into an array having the same shape
# as our input. If we didn't set flat_src_indices to False,
# we could specify src_indices as a 1D array of indices into
# the flattened source.
self.add_input('x', np.ones((2, 2)),
src_indices=[[(0, 0), (3, 1)],
[(2, 1), (1, 1)]],
flat_src_indices=False)
self.add_output('y', 1.0)
def compute(self, inputs, outputs):
outputs['y'] = np.sum(inputs['x'])
p = om.Problem()
# by promoting the following output and inputs to 'x', they will
# be automatically connected
p.model.add_subsystem('indep',
om.IndepVarComp('x', np.arange(12).reshape((4, 3))),
promotes_outputs=['x'])
p.model.add_subsystem('C1', MyComp(),
promotes_inputs=['x'])
p.setup()
p.run_model()
assert_rel_error(self, p['C1.x'],
np.array([[0., 10.],
[7., 4.]]))
assert_rel_error(self, p['C1.y'], 21.)
def test_promote_src_indices_nonflat_to_scalars(self):
class MyComp(om.ExplicitComponent):
def setup(self):
self.add_input('x', 1.0, src_indices=[(3, 1)], shape=(1,))
self.add_output('y', 1.0)
def compute(self, inputs, outputs):
outputs['y'] = inputs['x']*2.0
p = om.Problem()
p.model.add_subsystem('indep',
om.IndepVarComp('x', | np.arange(12) | numpy.arange |
# -*- coding: utf-8 -*-
"""GEModelClass
Solves an Aiygari model
"""
##############
# 1. imports #
##############
import time
import numpy as np
from numba import njit, prange
# consav
from consav import ModelClass, jit # baseline model class and jit
from consav import linear_interp # linear interpolation
from consav.grids import equilogspace # grids
from consav.markov import log_rouwenhorst # markov processes
from consav.misc import elapsed
############
# 2. model #
############
class GEModelClass(ModelClass):
#########
# setup #
#########
def settings(self):
""" fundamental settings """
# for safe type inference
self.not_floats = ['Ne','Na','max_iter_solve','max_iter_simulate','path_T']
def setup(self):
""" set baseline parameters """
par = self.par
# a. steady state values
par.r_ss = np.nan
par.w_ss = np.nan
par.K_ss = np.nan
par.Y_ss = np.nan
par.C_ss = np.nan
par.kd_ss = np.nan
par.ks_ss = np.nan
# b. preferences
par.sigma = 1.0 # CRRA coefficient
par.beta = 0.982 # discount factor
# c. production
par.Z = 1.0 # technology level in steady state
par.Z_sigma = 0.01 # shock
par.Z_rho = 0.90 # persistence
par.alpha = 0.11 # Cobb-Douglas coefficient
par.delta = 0.025 # depreciation rate
# d. income parameters
par.rho = 0.966 # AR(1) parameter
par.sigma_e = 0.10 # std. of persistent shock
par.Ne = 7 # number of states
# e. grids
par.a_max = 200.0 # maximum point in grid for a
par.Na = 500 # number of grid points
# f. misc.
par.path_T = 500 # length of path
par.max_iter_solve = 5000 # maximum number of iterations when solving
par.max_iter_simulate = 5000 # maximum number of iterations when simulating
par.solve_tol = 1e-10 # tolerance when solving
par.simulate_tol = 1e-10 # tolerance when simulating
def allocate(self):
""" allocate model, i.e. create grids and allocate solution and simluation arrays """
par = self.par
sol = self.sol
sim = self.sim
# a. grids
par.a_grid = np.zeros(par.Na)
par.e_grid = np.zeros(par.Ne)
par.e_trans = np.zeros((par.Ne,par.Ne))
par.e_ergodic = np.zeros(par.Ne)
par.e_trans_cumsum = np.zeros((par.Ne,par.Ne))
par.e_ergodic_cumsum = np.zeros(par.Ne)
self.create_grids()
# b. solution
sol_shape = (par.Ne,par.Na)
sol.a = np.zeros(sol_shape)
sol.m = np.zeros(sol_shape)
sol.c = np.zeros(sol_shape)
sol.Va = np.zeros(sol_shape)
sol.i = np.zeros(sol_shape,dtype=np.int_)
sol.w = np.zeros(sol_shape)
# path
path_sol_shape = (par.path_T,par.Ne,par.Na)
sol.path_a = np.zeros(path_sol_shape)
sol.path_m = np.zeros(path_sol_shape)
sol.path_c = np.zeros(path_sol_shape)
sol.path_Va = np.zeros(path_sol_shape)
sol.path_i = np.zeros(path_sol_shape,dtype=np.int_)
sol.path_w = np.zeros(path_sol_shape)
# c. simulation
sim_shape = sol_shape
sim.D = np.zeros(sim_shape)
# path
path_sim_shape = path_sol_shape
sim.path_D = np.zeros(path_sim_shape)
sim.path_K = np.zeros(par.path_T)
sim.path_C = np.zeros(par.path_T)
sim.path_Klag = np.zeros(par.path_T)
# jacobians
jac_shape = (par.path_T,par.path_T)
sol.jac_K = np.zeros(jac_shape)
sol.jac_C = np.zeros(jac_shape)
sol.jac_curlyK_r = np.zeros(jac_shape)
sol.jac_curlyK_w = np.zeros(jac_shape)
sol.jac_C_r = np.zeros(jac_shape)
sol.jac_C_w = np.zeros(jac_shape)
sol.jac_r_K = np.zeros(jac_shape)
sol.jac_w_K = np.zeros(jac_shape)
sol.jac_r_Z = np.zeros(jac_shape)
sol.jac_w_Z = np.zeros(jac_shape)
sol.H_K = np.zeros(jac_shape)
sol.H_Z = | np.zeros(jac_shape) | numpy.zeros |
# -*- coding: utf-8 -*-
"""Functions to work with ASTER L1B satellite data.
"""
import datetime
import logging
import os
from collections import namedtuple
import gdal
import numpy as np
from scipy import interpolate
from skimage.measure import block_reduce
from typhon.math import multiple_logical
__all__ = [
"ASTERimage",
"lapserate_modis",
"lapserate_moist_adiabate",
"cloudtopheight_IR",
]
logger = logging.getLogger(__name__)
CONFIDENTLY_CLOUDY = 5
PROBABLY_CLOUDY = 4
PROBABLY_CLEAR = 3
CONFIDENTLY_CLEAR = 2
class ASTERimage:
"""ASTER L1B image object."""
subsensors = {
"VNIR": ("1", "2", "3N", "3B"),
"SWIR": ("4", "5", "6", "7", "8", "9"),
"TIR": ("10", "11", "12", "13", "14"),
}
# list of ASTER channels
channels = [c for sc in subsensors.values() for c in sc]
# dictionary with keys=channels and values=subsensors
channel2sensor = {c: s for s, sc in subsensors.items() for c in sc}
wavelength_range = {
# VNIR
"1": (0.52, 0.60),
"2": (0.63, 0.69),
"3N": (0.78, 0.86),
"3B": (0.78, 0.86),
# SWIR
"4": (1.600, 1.700),
"5": (2.145, 2.185),
"6": (2.185, 2.225),
"7": (2.235, 2.285),
"8": (2.295, 2.365),
"9": (2.360, 2.430),
# TIR
"10": (8.125, 8.475),
"11": (8.475, 8.825),
"12": (8.925, 9.275),
"13": (10.25, 10.95),
"14": (10.95, 11.65)
}
def __init__(self, filename):
"""Initialize ASTER image object.
Parameters:
filename (str): Path to ASTER L1B HDF file.
"""
self.filename = filename
self.meta = self.get_metadata()
SolarDirection = namedtuple(
"SolarDirection", ["azimuth", "elevation"]
) # SolarDirection = (0< az <360, -90< el <90)
self.solardirection = SolarDirection(
*self._convert_metastr(self.meta["SOLARDIRECTION"], dtype=tuple)
)
self.sunzenith = 90 - self.solardirection.elevation
self.datetime = datetime.datetime.strptime(
self.meta["CALENDARDATE"] + self.meta["TIMEOFDAY"][:13],
"%Y-%m-%d%H:%M:%S.%f0",
)
SceneCenter = namedtuple("SceneCenter", ["latitude", "longitude"])
self.scenecenter = SceneCenter(
*self._convert_metastr(self.meta["SCENECENTER"], dtype=tuple)
)
CornerCoordinates = namedtuple(
"CornerCoordinates", ["LOWERLEFT", "LOWERRIGHT", "UPPERRIGHT", "UPPERLEFT"]
)
self.cornercoordinates = CornerCoordinates(
self._convert_metastr(self.meta["LOWERLEFT"], dtype=tuple),
self._convert_metastr(self.meta["LOWERRIGHT"], dtype=tuple),
self._convert_metastr(self.meta["UPPERRIGHT"], dtype=tuple),
self._convert_metastr(self.meta["UPPERLEFT"], dtype=tuple),
)
@property
def basename(self):
"""Filename without path."""
return os.path.basename(self.filename)
@staticmethod
def _convert_metastr(metastr, dtype=None):
"""Convert metadata data type."""
if dtype is None:
dtype = str
if issubclass(dtype, tuple):
return tuple(float(f.strip()) for f in metastr.split(","))
else:
return dtype(metastr)
def get_metadata(self):
"""Read full ASTER metadata information."""
return gdal.Open(self.filename).GetMetadata()
def read_digitalnumbers(self, channel):
"""Read ASTER L1B raw digital numbers.
Parameters:
channel (str): ASTER channel number. '1', '2', '3N', '3B', '4',
'5', '6', '7', '8', '9', '10', '11', '12', '13', '14'.
Returns:
ndarray: Digital numbers. Shape according to data resolution of
the respective channel.
"""
if channel in ("1", "2", "3N"):
if self.meta["ASTEROBSERVATIONMODE.1"] == "VNIR1, ON":
subsensor = "VNIR"
else:
raise ValueError("VNIR nadir observation mode OFF")
elif channel == "3B":
if self.meta["ASTEROBSERVATIONMODE.2"] == "VNIR2, ON":
subsensor = "VNIR"
else:
raise ValueError("VNIR back observation mode OFF")
elif channel in ("4", "5", "6", "7", "8", "9"):
if self.meta["ASTEROBSERVATIONMODE.3"] == "SWIR, ON":
subsensor = "SWIR"
else:
raise ValueError("SWIR observation mode OFF")
elif channel in ("10", "11", "12", "13", "14"):
if self.meta["ASTEROBSERVATIONMODE.4"] == "TIR, ON":
subsensor = "TIR"
else:
raise ValueError("TIR observation mode OFF")
else:
raise ValueError("The chosen channel is not supported.")
data_path = (
f"HDF4_EOS:EOS_SWATH:{self.filename}:{subsensor}_Swath:"
f"ImageData{channel}"
)
swath = gdal.Open(data_path)
data = swath.ReadAsArray().astype("float")
data[data == 0] = np.nan # Set edge pixels to NaN.
return data
def get_radiance(self, channel):
"""Get ASTER radiance values.
Read digital numbers from ASTER L1B file and convert them to spectral
radiance values in [W m-2 sr-1 um-1] at TOA by means of unit conversion
coefficients ucc [W m-2 sr-1 um-1] and the gain settings at the sensor.
See also:
:func:`read_digitalnumbers`: Reads the raw digital numbers from
ASTER L1B HDF4 files.
Parameters:
channel (str): ASTER channel number. '1', '2', '3N', '3B', '4',
'5', '6', '7', '8', '9', '10', '11', '12', '13', '14'.
Returns:
ndarray: Radiance values at TOA. Shape according to data
resolution of the respective channel.
References:
<NAME>, <NAME>., & <NAME>. (2002). Aster user handbook
version 2, p.25 [Computer software manual]. Retrieved 2017-05-25,
from https://asterweb.jpl.nasa.gov/content/03 data/04 Documents/
aster user guide v2.pdf.
"""
dn = self.read_digitalnumbers(channel)
# Unit conversion coefficients ucc [W m-2 sr-1 um-1] for different gain
# settings, high, normal, low1, and low2.
ucc = {
"1": (0.676, 1.688, 2.25, np.nan),
"2": (0.708, 1.415, 1.89, np.nan),
"3N": (0.423, 0.862, 1.15, np.nan),
"3B": (0.423, 0.862, 1.15, np.nan),
"4": (0.1087, 0.2174, 0.290, 0.290),
"5": (0.0348, 0.0696, 0.0925, 0.409),
"6": (0.0313, 0.0625, 0.0830, 0.390),
"7": (0.0299, 0.0597, 0.0795, 0.332),
"8": (0.0209, 0.0417, 0.0556, 0.245),
"9": (0.0159, 0.0318, 0.0424, 0.265),
"10": 6.882e-3,
"11": 6.780e-3,
"12": 6.590e-3,
"13": 5.693e-3,
"14": 5.225e-3,
}
if channel in ["1", "2", "3N", "3B", "4", "5", "6", "7", "8", "8", "9"]:
meta = self.get_metadata()
gain = meta[f"GAIN.{channel[0]}"].split(",")[1].strip()
if gain == "LO1":
gain = "LOW" # both refer to column 3 in ucc table.
radiance = (dn - 1) * ucc[channel][["HGH", "NOR", "LOW", "LO2"].index(gain)]
elif channel in ["10", "11", "12", "13", "14"]:
radiance = (dn - 1) * ucc[channel]
else:
raise ValueError('Invalid channel "{channel}".')
return radiance
def get_reflectance(self, channel):
"""Get ASTER L1B reflectance values at TOA.
Spectral radiance values are converted to reflectance values for
ASTER's near-infrared and short-wave channels (1-9).
See also:
:func:`get_radiance`: Reads the raw digital numbers from
ASTER L1B HDF4 files and converts them to radiance values at
TOA.
Parameters:
channel (str): ASTER channel number. '1', '2', '3N', '3B', '4',
'5', '6', '7', '8', '9'.
Returns:
ndarray: Reflectance values at TOA. Shape according to data
resolution of the respective channel.
References:
<NAME>.; <NAME>.; <NAME> (2001). Effects of assumed solar
spectral irradiance on intercomparisons of earth-observing sensors.
In Sensors, Systems, and Next-Generation Satellites; Proceedings of
SPIE; December 2001; <NAME>., <NAME>., <NAME>.;
Vol. 4540, pp. 260–269.
http://www.pancroma.com/downloads/ASTER%20Temperature%20and%20Reflectance.pdf
http://landsathandbook.gsfc.nasa.gov/data_prod/prog_sect11_3.html
"""
# Mean solar exo-atmospheric irradiances [W m-2 um-1] at TOA according
# to Thome et al. 2001.
E_sun = (
1848,
1549,
1114,
1114,
225.4,
86.63,
81.85,
74.85,
66.49,
59.85,
np.nan,
np.nan,
np.nan,
np.nan,
np.nan,
)
doy = self.datetime.timetuple().tm_yday # day of the year (doy)
distance = (
0.016790956760352183
* np.sin(-0.017024566555637135 * doy + 4.735251041365579)
+ 0.9999651354429786
) # acc. to Landsat Handbook
return (
np.pi
* self.get_radiance(channel)
* distance ** 2
/ E_sun[self.channels.index(channel)]
/ np.cos(np.deg2rad(self.sunzenith))
)
def get_brightnesstemperature(self, channel):
"""Get ASTER L1B reflectances values at TOA.
Spectral radiance values are converted to brightness temperature values
in [K] for ASTER's thermal channels (10-14).
See also:
:func:`get_radiance`: Reads the raw digital numbers from
ASTER L1B HDF4 files and converts them to radiance values at
TOA.
Parameters:
channel (str): ASTER channel number. '10', '11', '12', '13', '14'.
Returns:
ndarray: Brightness temperature values in [K] at TOA. Shape
according to data resolution of the respective channel.
References:
http://www.pancroma.com/downloads/ASTER%20Temperature%20and%20Reflectan
ce.pdf
http://landsathandbook.gsfc.nasa.gov/data_prod/prog_sect11_3.html
"""
K1 = {
"10": 3040.136402, # Constant K1 [W m-2 um-1].
"11": 2482.375199,
"12": 1935.060183,
"13": 866.468575,
"14": 641.326517,
}
K2 = {
"10": 1735.337945, # Constant K2 [K].
"11": 1666.398761,
"12": 1585.420044,
"13": 1350.069147,
"14": 1271.221673,
}
return K2[channel] / np.log((K1[channel] / self.get_radiance(channel)) + 1)
def retrieve_cloudmask(
self, output_binary=True, include_thermal_test=True, include_channel_r5=True
):
"""ASTER cloud mask.
Four thresholding test based on visual bands distringuish between the
dark ocean surface and bright clouds. An additional test corrects
uncertain labeled pixels during broken cloud conditions and pixels with
sun glint. A detailed description can be found in Werner et al., 2016.
See also:
:func:`get_reflectance`: Get reflectance values from ASTER's
near-infrared and short-wave channels.
:func:`get_brightnesstemperature`: Get brightness temperature
values from ASTER's thermal channels.
:func:multiple_logical`: Apply logical function to multiple
arguments.
Parameters:
output_binary (bool): Switch between binary and full cloud mask
flags.
binary: 0 - clear (flag 2 & flag 3)
1 - cloudy (flag 4 & flag 5)
full: 2 - confidently clear
3 - probably clear
4 - probably cloudy
5 - confidently cloudy
include_thermal_test (bool): Switch for including test 5, which
uses the thermal channel 14 at 11mu with 90m pixel resolution.
The reduced resolution can introduce artificial straight cloud
boundaries.
include_channel_r5 (bool): Switch for including channel 5 in the
thresholding tests. The SWIR sensor, including channel 5,
suffered from temperature problems after May 2007. Per default,
later recorded images are set to a value that has no influence
on the thresholding tests.
Returns:
ndarray[float]: Cloud mask.
References:
<NAME>., <NAME>., <NAME>., <NAME>., <NAME>.,
<NAME>., <NAME>., and <NAME>.: Marine boundary layer
cloud property retrievals from high-resolution ASTER observations:
case studies and comparison with Terra MODIS, Atmos. Meas.
Techannel., 9, 5869-5894, https://doi.org/10.5194/amt-9-5869-2016,
2016.
"""
# Read visual near infrared (VNIR) channels at 15m resolution.
r1 = self.get_reflectance(channel="1")
r2 = self.get_reflectance(channel="2")
r3N = self.get_reflectance(channel="3N")
# Read short-wave infrared (SWIR) channels at 30m resolution and match
# VNIR resolution.
r5 = self.get_reflectance(channel="5")
if self.datetime > datetime.datetime(2007, 5, 1) or not include_channel_r5:
# The SWIR sensor suffered from temperature problems after May
# 2007. Images later on are set to a dummy value "1", which won't
# influence the following thresholding tests. Swath edge NaN pixels
# stay NaN.
r5[~np.isnan(r5)] = 1
r5 = np.repeat(np.repeat(r5, 2, axis=0), 2, axis=1)
# Read thermal (TIR) channel at 90m resolution and match VNIR
# resolution.
bt14 = self.get_brightnesstemperature(channel="14")
bt14 = np.repeat(np.repeat(bt14, 6, axis=0), 6, axis=1)
# Ratios for clear-cloudy-tests.
r3N2 = r3N / r2
r12 = r1 / r2
### TEST 1-4 ###
# Set cloud mask to default "confidently clear".
clmask = np.ones(r1.shape, dtype=np.float) * 2
with np.warnings.catch_warnings():
np.warnings.filterwarnings("ignore", r"invalid value encountered")
# Set "probably clear" pixels.
clmask[
multiple_logical(
r3N > 0.03,
r5 > 0.01,
0.7 < r3N2,
r3N2 < 1.75,
r12 < 1.45,
func=np.logical_and,
)
] = PROBABLY_CLEAR
# Set "probably cloudy" pixels.
clmask[
multiple_logical(
r3N > 0.03,
r5 > 0.015,
0.75 < r3N2,
r3N2 < 1.75,
r12 < 1.35,
func=np.logical_and,
)
] = PROBABLY_CLOUDY
# Set "confidently cloudy" pixels
clmask[
multiple_logical(
r3N > 0.065,
r5 > 0.02,
0.8 < r3N2,
r3N2 < 1.75,
r12 < 1.2,
func=np.logical_and,
)
] = CONFIDENTLY_CLOUDY
# Combine swath edge pixels.
clmask[
multiple_logical(
np.isnan(r1),
np.isnan(r2),
np.isnan(r3N),
np.isnan(r5),
func=np.logical_or,
)
] = np.nan
if include_thermal_test:
### TEST 5 ###
# Uncertain warm ocean pixels, higher than the 5th percentile of
# brightness temperature values from all "confidently clear"
# labeled pixels, are overwritten with "confidently clear".
# Check for available "confidently clear" pixels.
nc = np.sum(clmask == 2) / np.sum(~np.isnan(clmask))
if nc > 0.03:
bt14_p05 = np.nanpercentile(bt14[clmask == 2], 5)
else:
# If less than 3% of pixels are "confidently clear", test 5
# cannot be applied according to Werner et al., 2016. However,
# a sensitivity study showed that combining "probably clear"
# and "confidently clear" pixels in such cases leads to
# plausible results and we derive a threshold correspondingly.
bt14_p05 = np.nanpercentile(
bt14[np.logical_or(clmask == 2, clmask == 3)], 5
)
with np.warnings.catch_warnings():
np.warnings.filterwarnings("ignore", r"invalid value encountered")
# Pixels with brightness temperature values above the 5th
# percentile of clear ocean pixels are overwritten with
# "confidently clear".
clmask[np.logical_and(bt14 > bt14_p05, ~np.isnan(clmask))] = 2
# Combine swath edge pixels.
clmask[np.logical_or(np.isnan(clmask), np.isnan(bt14))] = np.nan
if output_binary:
clmask[np.logical_or(clmask == 2, clmask == 3)] = 0 # clear
clmask[np.logical_or(clmask == 4, clmask == 5)] = 1 # cloudy
return clmask
def read_coordinates(self, channel="1"):
"""Read reduced latitude and longitude grid.
Extract geolocation table containing latitude and longitude values at
11 x 11 lattice points. Latitudes are provided in geocentric coordinates
and are maped to geodetic values.
Parameters:
channel (str): ASTER channel number. '1', '2', '3N', '3B', '4',
'5', '6', '7', '8', '9', '10', '11', '12', '13', '14'.
Returns:
ndarray, ndarray: latitude, longitude
"""
sdsidx = {"VNIR": (0, 1), "SWIR": (6, 7), "TIR": (14, 15)}
latstr = ":".join(
(
"HDF4_SDS",
"UNKNOWN",
f"{self.filename}",
f"{sdsidx[self.channel2sensor[channel]][0]}",
)
)
lat = gdal.Open(latstr)
lat = geocentric2geodetic(lat.ReadAsArray().astype("float"))
lonstr = ":".join(
(
"HDF4_SDS",
"UNKNOWN",
f"{self.filename}",
f"{sdsidx[self.channel2sensor[channel]][1]}",
)
)
lon = gdal.Open(lonstr)
lon = lon.ReadAsArray().astype("float")
return lat, lon
def get_latlon_grid(self, channel="1"):
"""Create latitude-longitude-grid for specified channel data.
A latitude-logitude grid is created from geolocation information from
11 x 11 boxes corresponding to the image data. The resolution and dimension
of the image and latitude-logitude grid depend on the specified channel.
Parameters:
channel (str): ASTER channel number. '1', '2', '3N', '3B', '4',
'5', '6', '7', '8', '9', '10', '11', '12', '13', '14'.
Returns:
ndarray[tuple]: Latitude longitude grid.
References:
<NAME>, <NAME>., & <NAME>. (2002). Aster user handbook
version 2, p.25 [Computer software manual]. Retrieved 2017-05-25,
from https://asterweb.jpl.nasa.gov/content/03 data/04 Documents/
aster user guide v2.pdf.
"""
ImageDimension = namedtuple("ImageDimension", ["lon", "lat"])
imagedimension = ImageDimension(
*self._convert_metastr(self.meta[f"IMAGEDATAINFORMATION{channel}"], tuple)[
:2
]
)
lat, lon = self.read_coordinates(channel=channel)
latidx = np.arange(11) * imagedimension.lat / 10
lonidx = np.arange(11) * imagedimension.lon / 10
# Function for interpolation to full domain grid.
flat = interpolate.interp2d(lonidx, latidx, lat, kind="linear")
flon = interpolate.interp2d(lonidx, latidx, lon, kind="linear")
# Grid matching shifted corner coordinates (see above).
latgrid = np.arange(0, int(imagedimension.lat) + 1, 1)
longrid = np.arange(0, int(imagedimension.lon) + 1, 1)
# Apply lat-lon-function to grid and cut off last row and column to get
# the non-shifted grid.
lats = flat(longrid, latgrid)[:-1, :-1]
lons = flon(longrid, latgrid)[:-1, :-1]
return lats, lons
def get_lapserate(self):
"""Estimate lapse rate from MODIS climatology using :func:`lapserate`."""
return lapserate_modis(self.datetime.month, self.scenecenter[0])
def get_cloudtopheight(self):
"""Estimate the cloud top height according to Baum et al., 2012
using :func: `cloudtopheight_IR`."""
bt = self.get_brightnesstemperature("14")
cloudmask = self.retrieve_cloudmask()
latitude = self.scenecenter.latitude
month = self.datetime.month
return cloudtopheight_IR(bt, cloudmask, latitude, month, method="modis")
def dt_estimate_scanlines(self, sensor="vnir"):
"""Estimate the date time per scanline.
Based on the approximate recording time for one ASTER image a date time
array is constructed along the flight direction and depending on the
sensor resolution.
Parameters:
sensor (str): ASTER sensor ("vnir", "swir", or "tir").
Returns:
(ndarray[datetime]): date time information per scanline.
"""
dtdelta = datetime.timedelta(seconds=8, milliseconds=849)
scanlines = {"vnir": 4200, "swir": 2100, "tir": 700}
return np.linspace(-0.5, 0.5, scanlines[sensor]) * dtdelta + self.datetime
def sensor_angles(self, channel="1"):
"""Calculate sensor zenith and azimuth angles.
Angles are derived for each pixel depending on the channel and the
corresponding ASTER subsensor ("VNIR", "SWIR", "TIR"), as well as on the
subsensor geometry and settings.
Note:
All angular values are given in degree.
Parameters:
channel (str): ASTER channel number. '1', '2', '3N', '3B', '4',
'5', '6', '7', '8', '9', '10', '11', '12', '13', '14'.
Returns:
ndarray, ndarray: sensor zenith, sensor azimuth angles in degree.
References:
<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
& <NAME> (2015) Observation of submarine sand waves using ASTER
stereo sun glitter imagery, International Journal of Remote Sensing,
36:22, 5576-5592, DOI: 10.1080/01431161.2015.1101652
Algorithm Theoretical Basis Document for ASTER Level-1 Data
Processing (Ver. 3.0).1996.
"""
if channel != "3B":
sensor = self.channel2sensor[channel]
else:
sensor = "VNIRB"
# Angular data from ASTER metadata data.
S = float(self.meta["MAPORIENTATIONANGLE"])
FOV = {"VNIR": 6.09, "VNIRB": 5.19, "SWIR": 4.9, "TIR": 4.9}
P = {
"VNIR": float(self.meta["POINTINGANGLE.1"]),
"VNIRB": float(self.meta["POINTINGANGLE.1"]),
"SWIR": float(self.meta["POINTINGANGLE.2"]),
"TIR": float(self.meta["POINTINGANGLE.3"]),
}
# cut overlap area of backward pointing telescope
if channel != "3B":
field = self.read_digitalnumbers(channel)
elif channel == "3B" and self.meta["FLYINGDIRECTION"] == "DE":
field = self.read_digitalnumbers(channel)[400:]
elif channel == "3B" and self.meta["FLYINGDIRECTION"] == "AE":
field = self.read_digitalnumbers(channel)[:400]
# design n field
sidx = np.arange(np.shape(field)[1])
mid0 = sidx[np.isfinite(field[5, :])][[0, -1]].mean()
mid1 = sidx[np.isfinite(field[-5, :])][[0, -1]].mean()
f = interpolate.interp1d(
np.array([5, np.shape(field)[0] - 5]),
np.array([mid0, mid1]),
kind="linear",
fill_value="extrapolate",
)
mids = f(np.arange(np.shape(field)[0]))
# costructing an n-array indexing the pixels symmetric to the center of the
# swath. If pointing angle is zero, the sensor zenith angle is zero in the
# swath center.
n = sidx - mids[:, np.newaxis]
# left and right side of nadir are defined such that the sign follows the
# roll angle sign, which is negative on the right and positive on the left
# side of the sensor in flying direction (!), NOT in projected image. The
# sides therefore depend on the ascending / decending mode defined in the
# meta data.
flyingdir = self.meta["FLYINGDIRECTION"]
if flyingdir is "DE":
n *= -1
swath_widths = np.sum(np.isfinite(field), axis=1)
# average swath width, but exluding possible NaN-scanlines at beginning and
# end of the image.
swath_width = np.mean(swath_widths[swath_widths > 4200])
n_angles = n * FOV[sensor] / swath_width + P[sensor]
azimuth = np.full_like(field, np.nan)
if channel != "3B":
zenith = abs(n_angles)
if flyingdir is "DE":
azimuth[n_angles > 0] = 90 + S
azimuth[n_angles <= 0] = 270 + S
else:
azimuth[n_angles < 0] = 90 + S
azimuth[n_angles >= 0] = 270 + S
else:
h = 705000 # in km above the equator
zenith = np.rad2deg(
np.arctan(
np.sqrt(
(h * np.tan(np.deg2rad(P[sensor])) + 15 * n) ** 2
+ (h * np.tan(np.deg2rad(27.6)) / np.cos(np.deg2rad(P[sensor])))
** 2
)
/ h
)
)
x = np.rad2deg(np.arctan(0.6 / np.tan(np.deg2rad(n_angles))))
if flyingdir is "DE":
azimuth[n_angles > 0] = np.array(90 - x + S)[n_angles > 0]
azimuth[n_angles <= 0] = np.array(270 - x + S)[n_angles <= 0]
else:
azimuth[n_angles < 0] = np.array(90 - x + S)[n_angles < 0]
azimuth[n_angles >= 0] = np.array(270 - x + S)[n_angles >= 0]
zenith[np.isnan(field)] = np.nan
azimuth[np.isnan(field)] = np.nan
return zenith, azimuth
def reflection_angles(self):
"""Calculate the reflected sun angle, theta_r, of specular reflection
of sunlight into an instrument sensor.
Returns:
(ndarray): 2d field of size `cloudmask` of reflection
angles in [°] for eachannel pixel.
References:
<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
& <NAME> (2015) Observation of submarine sand waves using ASTER
stereo sun glitter imagery, International Journal of Remote Sensing,
36:22, 5576-5592, DOI: 10.1080/01431161.2015.1101652
"""
sun_azimuth = (
self.solardirection.azimuth + 180
) # +180° corresponds to "anti-/reflected" sun
sun_zenith = (
90 - self.solardirection.elevation
) # sun zenith = 90 - sun elevation
sensor_zenith, sensor_azimuth = self.sensor_angles()
return np.degrees(
np.arccos(
np.cos(np.deg2rad(sensor_zenith)) * np.cos(np.deg2rad(sun_zenith))
+ np.sin(np.deg2rad(sensor_zenith))
* np.sin(np.deg2rad(sun_zenith))
* np.cos(np.deg2rad(sensor_azimuth) - np.deg2rad(sun_azimuth))
)
)
def lapserate_modis(month, latitude):
"""Estimate of the apparent lapse rate in [K/km].
Typical lapse rates are assumed for each month and depending on the
location on Earth, i.e. southern hemisphere, tropics, or northern
hemisphere. For a specific case the lapse rate is estimated by a 4th order
polynomial and polynomial coefficients given in the look-up table.
This approach is based on the MODIS cloud top height retrieval and applies
to data recorded at 11 microns. According to Baum et al., 2012, the
predicted lapse rates are restricted to a maximum and minimum of
10 and 2 K/km, respectively.
Parameters:
month (int): Month of the year.
latitude (float): Latitude of center coordinate.
Returns:
float: Lapse rate estimate.
References:
Baum, B.A., <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>, 2012: MODIS Cloud-Top Property
Refinements for Collection 6. J. Appl. Meteor. Climatol., 51,
1145–1163, https://doi.org/10.1175/JAMC-D-11-0203.1
"""
lapserate_lut = {
"month": np.arange(1, 13),
"SH_transition": np.array(
[-3.8, -21.5, -2.8, -23.4, -12.3, -7.0, -10.5, -7.8, -8.6, -7.0, -9.2, -3.7]
),
"NH_transition": np.array(
[22.1, 12.8, 10.7, 29.4, 14.9, 16.8, 15.0, 19.5, 17.4, 27.0, 22.0, 19.0]
),
"a0": np.array(
[
(2.9769801, 2.9426577, 1.9009563), # Jan
(3.3483239, 2.6499606, 2.4878736), # Feb
(2.4060296, 2.3652047, 3.1251275), # Mar
(2.6522387, 2.5433158, 13.3931707), # Apr
(1.9578263, 2.4994028, 1.6432070), # May
(2.7659754, 2.7641496, -5.2366360), # Jun
(2.1106812, 3.1202043, -4.7396481), # Jul
(3.0982174, 3.4331195, -1.4424843), # Aug
(3.0760552, 3.4539390, -3.7140186), # Sep
(3.6377215, 3.6013337, 8.2237401), # Oct
(3.3206165, 3.1947419, -0.4502047), # Nov
(3.0526633, 3.1276377, 9.3930897),
]
), # Dec
"a1": np.array(
[
(-0.0515871, -0.0510674, 0.0236905),
(0.1372575, -0.0105152, -0.0076514),
(0.0372002, 0.0141129, -0.1214572),
(0.0325729, -0.0046876, -1.2206948),
(-0.2112029, -0.0364706, 0.1151207),
(-0.1186501, -0.0728625, 1.0105575),
(-0.3073666, -0.1002375, 0.9625734),
(-0.1629588, -0.1021766, 0.4769307),
(-0.2043463, -0.1158262, 0.6720954),
(-0.0857784, -0.0775800, -0.5127533),
(-0.1411094, -0.1045316, 0.2629680),
(-0.1121522, -0.0707628, -0.8836682),
]
),
"a2": np.array(
[
(0.0027409, 0.0052420, 0.0086504),
(0.0133259, 0.0042896, 0.0079444),
(0.0096473, 0.0059242, 0.0146488),
(0.0100893, 0.0059325, 0.0560381),
(-0.0057944, 0.0082002, 0.0033131),
(0.0011627, 0.0088878, -0.0355440),
(-0.0090862, 0.0064054, -0.0355847),
(-0.0020384, 0.0010499, -0.0139027),
(-0.0053970, 0.0015450, -0.0210550),
(0.0024313, 0.0041940, 0.0205285),
(-0.0026068, 0.0049986, -0.0018419),
(-0.0009913, 0.0055533, 0.0460453),
]
),
"a3": np.array(
[
(0.0001136, 0.0001097, -0.0002167),
(0.0003043, 0.0000720, -0.0001774),
(0.0002334, -0.0000159, -0.0003188),
(0.0002601, 0.0000144, -0.0009874),
(-0.0001050, 0.0000844, -0.0001458),
(0.0000937, 0.0001768, 0.0005188),
(-0.0000890, 0.0002620, 0.0005522),
(0.0000286, 0.0001616, 0.0001759),
(-0.0000541, 0.00017117, 0.0002974),
(0.0001495, 0.0000941, -0.0003016),
(0.0000058, 0.0001911, -0.0000369),
(0.0000180, 0.0001550, -0.0008450),
]
),
"a4": np.array(
[
(0.00000113, -0.00000372, 0.00000151),
(0.00000219, -0.0000067, 0.00000115),
(0.00000165, -0.00000266, 0.00000210),
(0.00000199, -0.00000346, 0.00000598),
(-0.00000074, -0.00000769, 0.00000129),
(0.00000101, -0.00001168, -0.00000262),
(0.00000004, -0.00001079, -0.00000300),
(0.00000060, 0.00000510, -0.00000080),
(-0.00000002, 0.00000248, -0.00000150),
(0.00000171, -0.0000041, 0.00000158),
(0.00000042, -0.00000506, 0.00000048),
(0.00000027, -0.00000571, 0.00000518),
]
),
}
ind_month = month - 1
if latitude < lapserate_lut["SH_transition"][ind_month]:
region_flag = 0 # Southern hemisphere
elif (
latitude >= lapserate_lut["SH_transition"][ind_month]
and latitude <= lapserate_lut["NH_transition"][ind_month]
):
region_flag = 1 # Tropics
elif latitude > lapserate_lut["NH_transition"][ind_month]:
region_flag = 2 # Northern hemisphere
else:
raise ValueError("Latitude of center coordinate cannot be read.")
lapserate = (
lapserate_lut["a0"][ind_month][region_flag]
+ lapserate_lut["a1"][ind_month][region_flag] * latitude
+ lapserate_lut["a2"][ind_month][region_flag] * latitude ** 2
+ lapserate_lut["a3"][ind_month][region_flag] * latitude ** 3
+ lapserate_lut["a4"][ind_month][region_flag] * latitude ** 4
)
return lapserate
def lapserate_moist_adiabate():
"""Moist adiabatic lapse rate in [K/km].
"""
return 6.5
def cloudtopheight_IR(bt, cloudmask, latitude, month, method="modis"):
"""Cloud Top Height (CTH) from 11 micron channel.
Brightness temperatures (bt) are converted to CTHs using the IR window approach:
(bt_clear - bt_cloudy) / lapse_rate.
See also:
:func:`skimage.measure.block_reduce`
Down-sample image by applying function to local blocks.
:func:`lapserate_moist_adiabate`
Constant value 6.5 [K/km]
:func:`lapserate_modis`
Estimate of the apparent lapse rate in [K/km]
depending on month and latitude acc. to Baum et al., 2012.
Parameters:
bt (ndarray): brightness temperatures form 11 micron channel.
cloudmask (ndarray): binary cloud mask.
month (int): month of the year.
latitude (ndarray): latitudes in [°], positive North, negative South.
method (str): approach used to derive CTH: 'modis' see Baum et al., 2012,
'simple' uses the moist adiabatic lapse rate.
Returns:
ndarray: cloud top height.
References:
<NAME>., <NAME>, <NAME>, <NAME>, <NAME>, S.A.
Ackerman, <NAME>, and <NAME>, 2012: MODIS Cloud-Top Property
Refinements for Collection 6. J. Appl. Meteor. Climatol., 51,
1145–1163, https://doi.org/10.1175/JAMC-D-11-0203.1
"""
# Lapse rate
if method == "simple":
lapserate = lapserate_moist_adiabate()
elif method == "modis":
lapserate = lapserate_modis(month, latitude)
else:
raise ValueError("Method is not supported.")
resolution_ratio = np.shape(cloudmask)[0] // | np.shape(bt) | numpy.shape |
# Copyright 2022 Xanadu Quantum Technologies Inc.
# 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.
"""Entanglement tests"""
import pytest
import numpy as np
from thewalrus.quantum import entanglement_entropy, log_negativity
from thewalrus.random import random_interferometer
from thewalrus.symplectic import (
interferometer,
passive_transformation,
two_mode_squeezing,
xxpp_to_xpxp,
)
def random_cov(num_modes=200, pure=False, nonclassical=True):
r"""Creates a random covariance matrix for testing.
Args:
num_modes (int): number of modes
pure (bool): Gaussian state is pure
nonclassical (bool): Gaussian state is nonclassical
Returns:
(array): a covariance matrix
"""
M = num_modes
O = interferometer(random_interferometer(M))
eta = 1 if pure else 0.123
r = 1.234
if nonclassical:
# squeezed inputs
cov_in = np.diag(np.concatenate([np.exp(2 * r) * np.ones(M), np.exp(-2 * r) * np.ones(M)]))
elif not nonclassical and pure:
# vacuum inputs
cov_in = np.eye(2 * M)
elif not nonclassical and not pure:
# squashed inputs
cov_in = np.diag(np.concatenate([np.exp(2 * r) * np.ones(M), np.ones(M)]))
cov_out = O @ cov_in @ O.T
_, cov = passive_transformation(
np.zeros([len(cov_out)]), cov_out, np.sqrt(eta) * np.identity(len(cov_out) // 2)
)
return cov
def test_entanglement_entropy_bipartition():
"""Tests if both substates of a bipartition will yield the same
entanglement entropy"""
M = 200
cov = random_cov(num_modes=M, pure=True, nonclassical=True)
modes_A = 111
# make a list that contains all modes but 111:
modes_B = list(range(M))
modes_B.pop(111)
E_A = entanglement_entropy(cov, modes_A=modes_A)
E_B = entanglement_entropy(cov, modes_A=modes_B)
assert np.isclose(E_A, E_B)
def test_log_negativity_bipartition():
"""Tests if both substates of a bipartition will yield the same log
negativity"""
M = 200
cov = random_cov(num_modes=M, pure=False, nonclassical=True)
modes_A = 111
# make a list that contains all modes but 111:
modes_B = list(range(M))
modes_B.pop(111)
E_A = log_negativity(cov, modes_A=modes_A)
E_B = log_negativity(cov, modes_A=modes_B)
assert np.isclose(E_A, E_B)
def test_entanglement_entropy_classical():
"""Tests if a classical state will return entanglement entropy zero"""
cov = random_cov(pure=True, nonclassical=False)
E = entanglement_entropy(cov, modes_A=[10, 20, 30, 40])
assert np.isclose(E, 0)
def test_log_negativity_classical():
"""Tests if a classical state will return log negativity zero"""
cov = random_cov(pure=False, nonclassical=False)
E = log_negativity(cov, modes_A=[10, 20, 30, 40])
assert np.isclose(E, 0)
def test_entanglement_entropy_split():
"""Tests the equivalence of the two alternative inputs ``modes_A`` and
``split``"""
cov = random_cov(pure=True, nonclassical=True)
split = 123
E_0 = entanglement_entropy(cov, split=split)
E_1 = entanglement_entropy(cov, modes_A=range(split))
assert np.isclose(E_0, E_1)
def test_log_negativity_split():
"""Tests the equivalence of the two alternative inputs ``modes_A`` and
``split``"""
cov = random_cov(pure=False, nonclassical=True)
split = 123
E_0 = log_negativity(cov, split=split)
E_1 = log_negativity(cov, modes_A=range(split))
assert np.isclose(E_0, E_1)
@pytest.mark.parametrize("hbar", [0.5, 1.0, 2.0, 1.7])
@pytest.mark.parametrize("r", [0.1, 0.5, 1.0, 1.3])
@pytest.mark.parametrize("etaA", [0.1, 0.5, 1.0])
@pytest.mark.parametrize("etaB", [0.1, 0.5, 1.0])
def test_log_negativity_two_modes(r, etaA, etaB, hbar):
"""Tests the log_negativity for two modes states following Eq. 13 of https://arxiv.org/pdf/quant-ph/0506124.pdf"""
cov = (hbar / 2) * two_mode_squeezing(2 * r, 0)
_, cov_lossy = passive_transformation(np.zeros([4]), cov, np.diag([etaA, etaB]), hbar=hbar)
cov_xpxp = xxpp_to_xpxp(cov_lossy) / (hbar / 2)
alpha = cov_xpxp[:2, :2]
gamma = cov_xpxp[2:, :2]
beta = cov_xpxp[2:, 2:]
invariant = np.linalg.det(alpha) + np.linalg.det(beta) - 2 * np.linalg.det(gamma)
detcov = np.linalg.det(cov_xpxp)
expected = -np.log(np.sqrt((invariant - np.sqrt(invariant**2 - 4 * detcov)) / 2))
obtained = log_negativity(cov_lossy, modes_A=[0], hbar=hbar)
assert np.allclose(expected, obtained)
@pytest.mark.parametrize("hbar", [0.5, 1.0, 2.0, 1.7])
@pytest.mark.parametrize("r", [0.1, 0.5, 1.0, 1.3])
def test_entanglement_entropy_two_modes(r, hbar):
"""Tests the log_negativity for two modes states following Eq. 1 of https://journals.aps.org/pra/pdf/10.1103/PhysRevA.63.022305"""
cov = (hbar / 2) * two_mode_squeezing(2 * r, 0)
expected = (np.cosh(r) ** 2) * np.log( | np.cosh(r) | numpy.cosh |
import matplotlib.pyplot as plt
import numpy as np
from MLG import imagepath, paperpath, path
from imageio import imread
import matplotlib.cbook as cbook
from MLG.utils import color_own
from matplotlib import rc
__all__ = ['dark','Image_Window','Image_precision','Image_Illustration','Image_Illustration_Multi','Image_compare_micro','Image_astroshift', 'create_all_Image']
def dark(onof = 0):
if onof is 'on': plt.style.use('dark_background')
elif onof is 'off': plt.style.use('default')
elif onof == True: plt.style.use('dark_background')
else: plt.style.use('default')
def Image_Window(string = 'resolve_Window', pres = False):
'''------------------------------------------------------------
Description:
---------------------------------------------------------------
Input:
---------------------------------------------------------------
Output:
------------------------------------------------------------'''
dark= 'black' in plt.rcParams['savefig.facecolor']
if dark:
string = 'dark_'+string
black = color_own([0.7,0.7,0.7,1])
else: black = color_own([0.,0.,0.,1])
c1 = color_own([0,1,1,1])
c2 = color_own([1,0,0,1])
c3 = color_own([1,1,0.2,1])
c4 = color_own([0.4,0.4,0.4,1])
c_star = [c1,c2,c3,c4]
c_grid1 = color_own([0,int(dark),1,1])
c_grid2 = color_own([0.5,1,0,1])
star= np.array([[0, 0],[0.1,0.9],[-1,-1.1],[-0.5,0.1]])
fig = plt.figure(figsize = [12,12])
x_width = 0.059
y_width = 0.177
#------------------------------------------------------------
# axis
plt.xticks( fontsize = 25)
plt.yticks( fontsize = 25)
plt.grid(True)
plt.axis('equal')
plt.axis([-1.5,1.5,-1.4,1.6])
plt.ylabel('Across-scan direction (AC) [arcsec]', fontsize = 30)
plt.xlabel('Along-scan direction (AL) [arcsec]', fontsize = 30)
#------------------------------------------------------------
#------------------------------------------------------------
#Grid Major Star
for i in range(-6,7):
plt.plot([-6*x_width,6*x_width], [i*y_width,i*y_width], c = c_grid1,linewidth = 3)
plt.plot([i*x_width,i*x_width], [-6*y_width,6*y_width], c = c_grid1, linewidth = 3)
plt.text(0,1.4,"Along-scan direction\n $12\,\mathrm{pix} \\times 0.059 \mathrm{''/pix} = 0.708\mathrm{''}$",fontsize = 25, verticalalignment = 'center', horizontalalignment = 'center', rotation = 0)
plt.text(0.7,0,"Across-scan direction\n $12\,\mathrm{pix} \\times 0.177 \mathrm{''/pix} = 2.124\mathrm{''}$",fontsize = 25, verticalalignment = 'center', horizontalalignment = 'center', rotation = 90)
plt.arrow(0,6*y_width+2*x_width, -6*x_width+0.02,0,color= black, head_width=0.1,\
overhang = 0.5, length_includes_head=True ,zorder = 10, linewidth = 3)
plt.arrow(0,6*y_width+2*x_width, 6*x_width-0.02,0,color= black, head_width=0.1,\
overhang = 0.5, length_includes_head=True ,zorder = 10, linewidth = 3)
plt.arrow(8*x_width,0,0, -6*y_width+0.02,color= black, head_width=0.1,\
overhang = 0.5, length_includes_head=True ,zorder = 10, linewidth = 3)
plt.arrow(8*x_width,0,0, 6*y_width-0.02,color= black, head_width=0.1,\
overhang = 0.5, length_includes_head=True ,zorder = 10, linewidth = 3)
plt.scatter(star[:1,0], star[:1,1], marker=(5, 1),c = c_star[:1], s = [3000], zorder = 1000)
if pres: fig.savefig(imagepath + string + '_1.png', format = 'png')
#------------------------------------------------------------
#------------------------------------------------------------
#Grid Minor Star
plt.scatter(star[1:3,0], star[1:3,1], marker=(5, 1),c = c_star[1:3], s = [2000,2000], zorder = 1000)
if pres: fig.savefig(imagepath + string + '_2.png', format = 'png')
for i in range(-5,8):
plt.plot([-15*x_width,-6*x_width], [i*y_width,i*y_width], c = c_grid2,linewidth = 3, zorder = -1)
for i in range(-15,-5):
plt.plot([i*x_width,i*x_width], [-5*y_width,7*y_width], c = c_grid2, linewidth = 3, zorder = -1)
plt.scatter(star[3:,0], star[3:,1], marker=(5, 1),c = c_star[3:], s = [2000], zorder = 1000)
if pres: fig.savefig(imagepath + string + '_3.png', format = 'png')
#------------------------------------------------------------
fig.savefig(imagepath + string + '.png', format = 'png')
print('Create Image: '+ imagepath+ string + '.png')
if paperpath is not None: fig.savefig(paperpath + string + '.png', format = 'png')
plt.close(fig)
def Image_precision(string = 'Sig_vs_Gmag', Gaia_precision = path+'InputTable/resolution_Gaia.png', pres = False):
'''------------------------------------------------------------
Description:
---------------------------------------------------------------
Input:
---------------------------------------------------------------
Output:
------------------------------------------------------------'''
dark= 'black' in plt.rcParams['savefig.facecolor']
if dark:
string = 'dark_'+string
black = color_own([0.7,0.7,0.7,1])
color1 = color_own([0.85,0,0,1])
color2 = color_own([0,0,1,1])
color3 = color_own([0,1,1,1])
color4 = color_own([0.5,1,0,1])
color5 = color_own([1,1,0,1])
else:
black = color_own([0.,0.,0.,1])
color1 = color_own([0.85,0,0,1])
color2 = color_own([0,0,1,1])
color3 = color_own([0,1,1,1])
color4 = color_own([0,1,0,1])
color5 = color_own([1,1,0,1])
fig = plt.figure(figsize = [12,10])
Gmag = np.arange(4,22,0.01)
datafile = cbook.get_sample_data(Gaia_precision)
img = imread(datafile)
z = 10 ** (0.4 * (np.maximum(Gmag, 14) - 15)) #(14-np.minimum(Gmag, 14))
z2 = 10 ** (0.4 * (np.maximum(Gmag, 12) - 15))
sig_pi = (-1.631 + 680.766 * z2 + 32.732 * z2**2)**0.5/1000
sig_fov2 =(-1.631 + 680.766 * z + 32.732 * z**2)**0.5/1000 *7.75 +0.1
sig_fov3 = sig_fov2 / np.sqrt(9)
plt.plot([0,1],[-5,-5], c = color1, linewidth = 3, label = 'formal precision from Gaia DR2 (per CCD)' )
plt.plot([0,1],[-5,-5], c = color2, linewidth = 3, label = 'actual precision from Gaia DR2 (per CCD)' )
plt.yticks([np.log10(i) for i in [20,10, 5,2,1, 0.5,0.2,0.1, 0.05,0.02, 0.01]],[20,10, 5,2,1, 0.5,0.2,0.1, 0.05,0.02,0.01], fontsize = 25)
plt.xticks( fontsize = 25)
plt.ylabel('Standard deviation of AL field angle [mas]', fontsize = 30)
plt.xlabel('G magnitude', fontsize = 30)
plt.imshow(img, zorder=0, extent=[5, 21.04, np.log10(0.0195),np.log10(10)])
plt.axis('auto')
plt.xlim([4,22])
plt.ylim([np.log10(0.005),np.log10(40)])
if pres:
plt.legend(loc = 'upper left',fontsize = 20)
fig.savefig(imagepath + string + '_1.png', format = 'png')
plt.plot(Gmag,np.log10(sig_pi), '--',c = color3, dashes =(5,5), linewidth = 3, label= 'predicted end-of-mission parallax error')
if pres:
plt.legend(loc = 'upper left',fontsize = 20)
fig.savefig(imagepath + string + '_2.png', format = 'png')
plt.plot(Gmag,np.log10(sig_fov2), ':' , c = color4, linewidth = 5, label= 'used Standard deviation (per CCD)' )
if pres:
plt.legend(loc = 'upper left',fontsize = 20)
fig.savefig(imagepath + string + '_3.png', format = 'png')
plt.plot(Gmag,np.log10(sig_fov3) ,c = color5,linewidth = 7, label= 'used Standard deviation for 9 CCD observations' )
plt.plot([5, 21.04, 21.04,5,5], [np.log10(0.0195),np.log10(0.0195),np.log10(10),np.log10(10),np.log10(0.0195)], linewidth = 2, color = [0.5,0.5,0.5,1], zorder = 0.1)
plt.axis('auto')
plt.xlim([4,22])
plt.ylim([np.log10(0.005),np.log10(40)])
plt.legend(loc = 'upper left',fontsize = 20)
fig.savefig(imagepath + string + '.png', format = 'png')
print('Create Image: '+ imagepath+ string + '.png')
if paperpath is not None: fig.savefig(paperpath + string + '.png', format = 'png')
plt.close(fig)
def Image_Illustration(string = 'Illustration'):
'''------------------------------------------------------------
Description:
---------------------------------------------------------------
Input:
---------------------------------------------------------------
Output:
------------------------------------------------------------'''
dark= 'black' in plt.rcParams['savefig.facecolor']
if dark:
string = 'dark_'+string
black = color_own([0.7,0.7,0.7,1])
color1 = color_own([0,1,1,1])
color2 = color_own([1,0.5,0,1])
color3 = color_own([0.5,1,0,1])
color4 = color_own([1,0,1,1])
color5 = color_own([0,1,1,1])
color6 = color_own([0,1,1,1])
else:
black = color_own([0.,0.,0.,1])
color1 = color_own([0,0,1,1])
color2 = color_own([1,0.5,0,1])
color3 = color_own([0,1,0,1])
color4 = color_own([1,0,1,1])
color5 = color_own([0,1,1,1])
color6 = color_own([0,1,1,1])
t = np.array([12, 35, 41, 61, 73, 89])
scandir = np.array([0.1, 0.7, 0.4, 0.8 , 0.2, 0.1])*np.pi
x1 = np.linspace(1,13,100) + 0.3 * np.sin(np.linspace(np.pi/4,12*np.pi/4,100))
y1 = np.linspace(1,3,100) + 0.3* np.cos(np.linspace(np.pi/4,12*np.pi/4,100))
x2 = np.linspace(3,7,100)# + 0.03 * np.sin(np.linspace(np.pi/4,12*np.pi/4,100))
y2 = np.linspace(7,4.5,100)# + 0.03* np.cos(np.linspace(np.pi/4,12*np.pi/4,100))
d = np.sqrt((x1-x2)**2 + (y1-y2)**2)
TE = 1.5
X2 = x2 + (x2-x1) * TE/(d**2 +2*TE)
Y2 = y2 + (y2-y1) * TE/(d**2 +2*TE)
dX2 = x1-X2
dY2 = y1-Y2
dx2 = x1-x2
dy2 = y1-y2
fig = plt.figure(figsize= (12,8))
ax = plt.subplot(111)
ax.axis('equal')
ax.axis('off')
for i in range(len(t)):
xm1 =np.array([-1,1]) * np.cos(scandir[i]) + x1[t[i]]
ym1 =np.array([-1,1]) * np.sin(scandir[i]) + y1[t[i]]
xm2 =np.array([-1,1]) * np.cos(scandir[i]) + X2[t[i]]
ym2 =np.array([-1,1]) * np.sin(scandir[i]) + Y2[t[i]]
dsc = ((dx2[t[i]]).reshape(-1,1)*[np.sin(scandir[i]),np.cos(scandir[i])] \
+ (dy2[t[i]]).reshape(-1,1) *[-np.cos(scandir[i]),np.sin(scandir[i])])[0]
dSC = ((dX2[t[i]]).reshape(-1,1)*[np.sin(scandir[i]),np.cos(scandir[i])] \
+ (dY2[t[i]]).reshape(-1,1) *[-np.cos(scandir[i]),np.sin(scandir[i])])[0]
ttX2 = np.array([0,-dSC[1]/2,dSC[1]/2,0]) * np.cos(scandir[i]) + ([x1[t[i]],x1[t[i]],X2[t[i]],X2[t[i]]])
ttY2 = np.array([0,-dSC[1]/2,dSC[1]/2,0]) * np.sin(scandir[i]) +([y1[t[i]],y1[t[i]],Y2[t[i]],Y2[t[i]]])
ttx2 = np.array([0,-dsc[1]/2-0.2,dsc[1]/2-0.2,0]) * np.cos(scandir[i]) + ([x1[t[i]],x1[t[i]],x2[t[i]],x2[t[i]]])
tty2 = np.array([0,-dsc[1]/2-0.2,dsc[1]/2-0.2,0]) * np.sin(scandir[i]) +([y1[t[i]],y1[t[i]],y2[t[i]],y2[t[i]]])
if i % 2 == 0:
plt.arrow(ttx2[2],tty2[2], 0.0001*(ttx2[2]-ttx2[1]),0.0001*(tty2[2]-tty2[1]),color= color1, head_width=0.2,\
overhang = 0.5, length_includes_head=True ,zorder = 10)
plt.arrow(ttx2[1],tty2[1], 0.0001*(ttx2[1]-ttx2[2]),0.0001*(tty2[1]-tty2[2]),color= color1, head_width=0.2,\
overhang = 0.5, length_includes_head=True ,zorder = 10)
plt.arrow(ttX2[2],ttY2[2], 0.0001*(ttX2[2]-ttX2[1]),0.0001*(ttY2[2]-ttY2[1]),color= color2, head_width=0.2,\
overhang = 0.5, length_includes_head=True ,zorder = 10)
plt.arrow(ttX2[1],ttY2[1], 0.0001*(ttX2[1]-ttX2[2]),0.0001*(ttY2[1]-ttY2[2]),color= color2, head_width=0.2,\
overhang = 0.5, length_includes_head=True, zorder = 10)
plt.plot(ttx2[0:2],tty2[0:2],color = black, linestyle= ':')
plt.plot(ttX2[0:2],ttY2[0:2],color = black, linestyle= ':')
plt.plot(ttx2[1:3],tty2[1:3],color = color1,linewidth = 3 , linestyle= '--',dashes=(10, 10))
plt.plot(ttX2[1:3],ttY2[1:3],color = color2, linewidth = 3,linestyle= '-')
plt.plot(ttx2[2:],tty2[2:],color = black, linestyle= ':')
plt.plot(ttX2[2:],ttY2[2:],color = black, linestyle= ':')
if i% 2 == 0:
plt.plot(xm2,ym2, color = black, linewidth = 3,zorder = 1)
plt.plot(xm1,ym1, color = black, linewidth = 3,zorder = 1)
else:
plt.plot(xm2,ym2, color = 'grey', linewidth = 2, zorder = -1)
plt.plot(xm1,ym1, color = 'grey', linewidth = 2, zorder = -1)
#if i ==0 :
plt.plot(x1,y1, color = color3, linewidth = 3)
plt.plot(x2,y2, color = color1, linestyle= '--',dashes=(10, 5), linewidth = 3, zorder = -1)
plt.plot(X2,Y2, color = color2, linewidth = 3)
plt.xlim([-0.5,14])
xr = 12
yr = 7
plt.text(xr-0.8,0,'RA $\cdot$ cos(Dec)',verticalalignment = 'center',fontsize = 25)
plt.text(0,yr + 0.25,'Dec',fontsize = 25, horizontalalignment = 'center', rotation = 90)
plt.arrow(-0.025,0,xr-1,0,width = 0.05,overhang = 0.5,head_width = 0.5, head_length = 0.5,color= black, zorder = 100,length_includes_head=True)
plt.arrow(0,-0.025,0,yr-0.5,width = 0.05,overhang = 0.5,head_width = 0.5,head_length = 0.5,color= black, zorder = 100,length_includes_head=True)
plt.text(2,1.5,'Lens',color = color3, fontsize = 25, horizontalalignment = 'center', rotation = 0, weight = 'bold')
plt.text(4,7.5,'Star 1',color = color2,fontsize = 25, horizontalalignment = 'center', rotation = 0,weight = 'bold')
fig.savefig(imagepath + string + '.png', format = 'png')
print('Create Image: '+ imagepath+ string + '.png')
if paperpath is not None: fig.savefig(paperpath + string + '.png', format = 'png')
plt.close(fig)
def Image_Illustration2 (string = 'Illustration'):
'''------------------------------------------------------------
Description:
---------------------------------------------------------------
Input:
---------------------------------------------------------------
Output:
------------------------------------------------------------'''
dark= 'black' in plt.rcParams['savefig.facecolor']
if dark:
string = 'dark_'+string
black = color_own([0.,0.,0.,1])
grey = color_own([.5,.5,0.5,1])
cyan = color_own([0,1,1,1])
blue = color_own([0,0,1,1])
lime = color_own([0.6,1.2,0,1])
green = color_own([0,1,0,1])
red = color_own([1,0,0,1])
orange = color_own([1,1,0,1])
else:
black = color_own([0.,0.,0.,1])
grey = color_own([.5,.5,0.5,1])
cyan = color_own([0,1,1,1])
blue = color_own([0,0,1,1])
lime = color_own([0.6,1.2,0,1])
green = color_own([0,1,0,1])
red = color_own([1,0,0,1])
orange = color_own([1,1,0,1])
t = np.array([12, 35, 41, 61, 73, 89])
scandir = np.array([0.1, 0.7, 0.4, 0.8 , 0.2, 0.1])*np.pi
#Position_lens
x1 = np.linspace(1,13,100) + 0.3 * np.sin(np.linspace(np.pi/4,12*np.pi/4,100))
y1 = np.linspace(1,3,100) + 0.3* np.cos(np.linspace(np.pi/4,12*np.pi/4,100))
#unlensed Position_source
x2 = np.linspace(5,9,100)# + 0.03 * np.sin(np.linspace(np.pi/4,12*np.pi/4,100))
y2 = np.linspace(7,4.5,100)# + 0.03* np.cos(np.linspace(np.pi/4,12*np.pi/4,100))
d = np.sqrt((x1-x2)**2 + (y1-y2)**2)
TE = 2
X2 = x2 + (x2-x1) * TE/(d**2 +2*TE)
Y2 = y2 + (y2-y1) * TE/(d**2 +2*TE)
dX2 = x1-X2
dY2 = y1-Y2
dx2 = x1-x2
dy2 = y1-y2
fig = plt.figure(figsize= (12,8))
ax = plt.subplot(111)
ax.axis('equal')
ax.axis('off')
#---------------------------------------------------------------
#axis
plt.xlim([-0.5,14])
xr = 12
yr = 7
plt.text(xr-0.8,0,'RA $\cdot$ cos(Dec)',verticalalignment = 'center',fontsize = 25)
plt.text(0,yr + 0.25,'Dec',fontsize = 25, horizontalalignment = 'center', rotation = 90)
plt.arrow(-0.025,0,xr-1,0,width = 0.05,overhang = 0.5,head_width = 0.5, head_length = 0.5,color= black, zorder = 100,length_includes_head=True)
plt.arrow(0,-0.025,0,yr-0.5,width = 0.05,overhang = 0.5,head_width = 0.5,head_length = 0.5,color= black, zorder = 100,length_includes_head=True)
plt.text(2,1.5,'Lens',color = grey, fontsize = 25, horizontalalignment = 'center', rotation = 0, weight = 'bold')
#---------------------------------------------------------------
# Motion source
plt.plot(x1,y1, color = grey, linewidth = 7)
fig.savefig(imagepath + string + '_1.png', format = 'png')
plt.text(4,7.5,'Source',color = blue,fontsize = 25, horizontalalignment = 'center', rotation = 0,weight = 'bold')
plt.plot(x2,y2, color = cyan, linestyle= '--',dashes=(10, 5), linewidth = 3, zorder = -1)
fig.savefig(imagepath + string + '_2.png', format = 'png')
plt.plot(X2,Y2, color = blue, linewidth = 3)
for i in range(len(t)):
plt.plot([x2[t[i]],X2[t[i]]],[y2[t[i]],Y2[t[i]]],':',color = black)
fig.savefig(imagepath + string + '_3.png', format = 'png')
delta = 0.05
for i in range(len(t)):
xm1 =np.array([-1,1,1,-1,-1]) * np.cos(scandir[i]) + delta * np.array([-1,-1,1,1,-1]) * | np.sin(scandir[i]) | numpy.sin |
# Copyright: (c) 2021, <NAME>
from __global__ import *
import numpy as np
import pycuda.driver as cuda
from pycuda.compiler import SourceModule
import lib
from lib import cufft
import time
import logging
import os
import scipy
from enum import Enum
log = logging.getLogger(LOG_NAME+'.'+__name__)
# log.setLevel(logging.INFO)
# Defaults for symbol overlap test
SYMBOL_CHECK_OVERLAP_OFFSET = 20
SYMBOL_CHECK_ERROR_THRESHOLD = 1000
SYMBOL_CHECK_MATCH_NUM_ERRORS_ALLOWED = 10
# only used for the nrz-s decoder. Used for BPSK at the moment, since we there use nrz-s to resolve the ambiguity. Ideally we should look at the phase and demodulate directly
SYMBOL_MISMATCHVAL = 0 # 0 or -1. 0 is better for softCombiner
# STORE_BITS_IN_FILE defined in __global__.py
BITS_FNAME = '../data/bits_file'
class Operations(Enum):
CENTRES_ABS = 0;
CENTRES_REAL = 1;
CENTRES_IMAG = 2;
class Demodulator:
## GPU performance specific
numThreads = 64 # for fft and other elementwise ops
numThreadsS = 1024 # has to be 32**2 for the scan sum kernel
batchSize = 1 # Not implemented yet, but usefull for batch fft processing at some stage
# other GPU based parameters
num_streams = 3 # For big IFFT kernel 3 is the magic number
managed_memory_available = False # At the moment not used, but nice to check
kernelFilePath = 'cuda_kernels.cu'
num_SMs = None
def __initInstanceVariables(self):
"""
initialize instance variables
"""
## list of buffers and fft plans (used in __del__ to free all)
self.GPU_buffers = []
self.GPU_fftPlans = []
## Demodulation
self.sigOverlap = 2**8
self.sigOverlapWin = int(self.sigOverlap/2)
# Window over which to find centres
self.windowWidth = 3 # must be odd.
self.windowWidthOffset = int(self.windowWidth/2) # floor(windowWidth/2) on each side
self.clippedPeakIPure = [] # Indices of the clipped peaks
self.clippedPeakI = [] # Indices of clipped peaks with window around
# constant stuff
self.bitLUT = None # Provided by protocol
self.symbolLUT = None # Provided by protocol
self.poswinP = [] # stores bits across calls -- filled in the demodulator
def __init__(self,conf,protocol,radioName):
# log.setLevel(logging.DEBUG)
self.__initInstanceVariables() # initialize instance variables and arrays
global BITS_FNAME
BITS_FNAME = f'{BITS_FNAME}_{radioName}'
self.protocol = protocol
self.confRadio = conf['Radios']['Rx'][radioName]
self.confGPU = conf['GPU'][self.confRadio['CUDA_settings']]
self.radioName = radioName
# find signal size,
self.sigLen = 2**self.confGPU['blockSize']
self.sigOverlap = 2**self.confGPU['overlap']
self.sigOverlapWin = int(self.sigOverlap/2)
self.clippedPeakSpan = self.confGPU['clippedPeakSpan'] # number of symbols to disqualify around a peak
self.peakThresholdScale = self.confGPU['peakThresholdScale'] # thresholding factor for peak clipping
self.disablePeakThresholding = self.confRadio.get('disablePeakThresholding',False)
# for symbol overlap check
self.overlapOffset = self.confGPU.get('symbol_check_overlap_offset',SYMBOL_CHECK_OVERLAP_OFFSET)
self.symbol_check_error_threshold = self.confGPU.get('symbol_check_error_threshold',SYMBOL_CHECK_ERROR_THRESHOLD)
self.symbol_check_match_threshold = self.overlapOffset - self.confGPU.get('symbol_check_match_num_errors_allowed',SYMBOL_CHECK_MATCH_NUM_ERRORS_ALLOWED)
log.info(f'[{self.radioName}]: symbol_check_overlap_offset {self.overlapOffset}, symbol_check_error_threshold {self.symbol_check_error_threshold}, symbol_check_match_threshold {self.symbol_check_match_threshold}')
self.spsym = spsym = self.confRadio['samplesPerSym'] # samples per symbol
self.spsymMin = int(spsym/2) # minimum allowed samples pr. symbol
self.baudRate = self.confRadio['baud']
self.sampleRate = self.baudRate * self.spsym
try:
self.voteWeight = self.confRadio['voteWeight'] # weight of voting for this channel
except KeyError:
self.voteWeight = 1
log.info('[{}]: vote weight set to {}'.format(self.radioName,self.voteWeight))
self.Nfft = int(self.sigLen) # this is the convolution block length
# Window over which to find centres
self.windowWidth = self.confGPU['bitWindowWidth'] # must be odd.
self.windowWidthOffset = int(self.windowWidth/2) # floor(windowWidth/2) on each side
# code search offset. 0 includes all masks 1 excludes the only 0 and only 1 masks (tends to give better results)
self.CODE_SEARCH_MASK_OFFSET = 0
# If exists and true, then sum all masks prior to Doppler search. Better when not looking for a specific signature
try:
self.SUM_ALL_MASKS_PYTHON = protocol.SUM_ALL_MASKS_PYTHON
except:
self.SUM_ALL_MASKS_PYTHON = False
log.info(f'[{self.radioName}]: Sum masks prior to Doppler search {self.SUM_ALL_MASKS_PYTHON}')
# compute the indexes where to search the carrier based on rangerate and sample rate
self.num_dopplers = self.confRadio['doppCarrierSteps']
self.centreFreqOffset = self.confRadio['frequencyOffset_Hz'] # when the IF is offtuned
Fc = self.confRadio['frequency_Hz'] - self.centreFreqOffset
log.warning(f"Fc {self.confRadio['frequency_Hz']}, IF {Fc}")
self.doppOffset = self.centreFreqOffset/self.baudRate/self.spsym
self.doppOffsetIdx = np.int32(self.doppOffset * self.Nfft) # offset for STX mode
if self.doppOffsetIdx < 0:
self.doppOffsetIdx += self.Nfft
rangeRateMax = conf['Radios']['rangeRateMax']
doppMax = rangeRateMax * Fc/scipy.constants.speed_of_light
doppMaxNorm = doppMax/self.sampleRate
doppIdxMin = self.doppOffset - doppMaxNorm
doppIdxMax = self.doppOffset + doppMaxNorm
# channel to measure noise
# noiseOfftuneHz = self.confRadio.get('noise_measure_offset_Hz',-self.centreFreqOffset)
noiseOfftuneHz = self.confRadio.get('noise_measure_offset_Hz',False)
if noiseOfftuneHz:
noiseOfftuneIdx = noiseOfftuneHz/self.baudRate/self.spsym
self.doppIdxNorm = np.concatenate((np.array([noiseOfftuneIdx]),np.linspace(doppIdxMin,doppIdxMax,self.num_dopplers)))
else:
self.doppIdxNorm = np.linspace(doppIdxMin,doppIdxMax,self.num_dopplers)
# the fraction of the bw that contains the carrier
self.doppIdxArrayLen = len(self.doppIdxNorm) # so we have the correct array length
self.doppIdxArrayOffset = self.doppIdxArrayLen - self.num_dopplers
# self.doppIdxNorm = np.linspace(0,0.5,self.num_dopplers)
self.doppHzLUT = self.doppIdxNorm * self.spsym * self.baudRate # scaled by spsym (for compatibility)
# Normalize the proposed doppler offsets
self.doppCyperSymNorm = np.round(self.doppIdxNorm*self.Nfft).astype(np.int32)
self.doppCyperSymNorm[self.doppCyperSymNorm < 0] += self.Nfft # negative frequencies are at the right half of the spectrum
log.info('[{}]: Fc {:.0f} Doppler scanning range {:.0f} to {:.0f} Hz of Fc, resolution {:.2f} Hz'.format(self.radioName,Fc,self.doppHzLUT[0],self.doppHzLUT[-1],(doppIdxMax-doppIdxMin)/self.num_dopplers*spsym*self.baudRate))
# GPU parameters
self.numThreads = self.confGPU['CUDA']['numThreads'] # for fft and other elementwise ops
self.numThreadsS = self.confGPU['CUDA']['numThreadsS'] # has to be 32**2 for the scan sum kernel
self.batchSize = self.confGPU['CUDA']['batchSize'] # Batch size for fft processing of inverse FFT's of cross correlations
self.num_streams = self.confGPU['CUDA']['streams'] # For big IFFT kernel 3 is the magic number
cuda.init()
device = cuda.Device(self.confGPU['CUDA']['device'])
self.getDeviceAttributes(device) # get relevant device attributes
self.ctx = device.make_context()
log.info('[{}]: Initializing Cuda on {}'.format(self.radioName,device.name()))
self.warp_size = device.get_attribute(cuda.device_attribute.WARP_SIZE)
# Not yet used, but maybe for future
self.managed_memory_available = device.get_attribute(cuda.device_attribute.MANAGED_MEMORY)
# GPU grid Shapes
if self.Nfft/self.numThreadsS != np.round(self.Nfft/self.numThreadsS):
raise ValueError('[{}]: the size of the input signal has to be divisible by {}'.format(
self.radioName,self.numThreadsS))
# generate masks TODO: masks need to be integrated based on protocol and radio
try:
self.num_masks, masks = protocol.get_filter(self.Nfft,self.spsym,self.confGPU['xcorrMaskSize'])
self.__uploadMaskToGPU(masks)
if self.num_masks > 32: # warning for too many masks
log.warning('[{}]: more than 32 masks is not supported at this time'.format(self.radioName))
log.info('[{}]: mask len {} totalling {} masks'.format(self.radioName,self.confGPU['xcorrMaskSize'],self.num_masks))
except Exception:
log.error('[{}]: Exception occured in protocol {} while preparing filters'.format(
self.radioName,protocol.name))
raise
try:
self.bitLUT, self.symbolLUT = protocol.get_symbolLUT2(self.confGPU['xcorrMaskSize'])
except Exception:
log.error('[{}]: Exception occured in protocol {} while preparing symbol lookup table'.format(
self.radioName,protocol.name))
raise
# load kernels from file
self.CudaKernels = SourceModule(self.__loadKernelsFromFile())
# allocate GPU buffers
self.__initializeSharedBuffers()
# load and prepare CUDA kernels
self.__initializeKernels()
# upload doppler shift indices to GPU
cuda.memcpy_htod(self.GPU_bufDoppIdx,self.doppCyperSymNorm)
# if we want to do local storing of bits for debugging
if STORE_BITS_IN_FILE is True:
log.warning('----- Storing demodulated bits in file. Can lead to performance issues for long passes! -----')
import tables
self.all_bits = np.empty(0,dtype=DATATYPE)
self.frames = np.empty(0,np.int32)
self.all_trust = np.empty(0,TRUSTTYPE)
self.sum_match = np.empty((0,self.num_dopplers),np.float32)
self.code_rate = np.empty(0,np.float32)
self.code_phase = np.empty(0,np.float32)
self.masks = masks
# Xcorr output is stored in HDF5
self.xcorrFile = tables.open_file(BITS_FNAME+'.h5',mode='w')
self.xcorrResS = np.zeros((self.num_masks,self.Nfft),dtype=np.complex64)
self.xcorrResS = np.expand_dims(self.xcorrResS,0)
self.xcorrOut = self.xcorrFile.create_earray(self.xcorrFile.root,'xcorrOut',obj=self.xcorrResS)
log.info('[{}]: Initialization done'.format(self.radioName))
def __uploadMaskToGPU(self,masks):
"""
This method uploads the set of filters that the protocol provides to the GPU
"""
# do some type and shape checking
if masks.shape != (self.num_masks,self.Nfft):
raise ValueError("Masks provided by protocol {} expected to be of dimensions {}, got dimensions {}".format(self.protocol.name,
(self.num_masks,self.Nfft),
masks.shape))
if not isinstance(masks[0,0],np.complex64):
raise TypeError("Datatype of masks {}, expected {}".format(type(masks[0,0]),np.complex64))
# allocate buffers
self.GPU_bufBitsMask = cuda.mem_alloc(masks.nbytes)
self.GPU_buffers.append(self.GPU_bufBitsMask) # ensure it gets freed at the end
cuda.memcpy_htod(self.GPU_bufBitsMask,masks)
def getDeviceAttributes(self,dev):
self.CUDA_WARP_SIZE = dev.get_attribute(cuda.device_attribute.WARP_SIZE)
self.CUDA_NUM_THREADS_PER_SMX = lib.ConvertSMVer2Cores(*dev.compute_capability())
self.CUDA_NUM_SMX = dev.get_attribute(cuda.device_attribute.MULTIPROCESSOR_COUNT)
self.CUDA_NUM_THREADS = self.CUDA_NUM_SMX * self.CUDA_NUM_THREADS_PER_SMX
self.CUDA_NUM_WARPS = int(self.CUDA_NUM_THREADS/self.CUDA_WARP_SIZE)
def __initializeDemodIfftPlan(self):
"""
This is one batch of FFT's for the demodulation. Just needs to be as large as the number of masks
"""
fftBatch = self.num_masks
self.fftPlanDemod = cufft.cufftPlan1d(self.Nfft,cufft.CUFFT_C2C,fftBatch)
self.GPU_fftPlans.append(self.fftPlanDemod)
def __initializeSNRFftPlan(self):
"""
This plan is used for computing the SNR
"""
self.fftPlan = cufft.cufftPlan1d(self.Nfft,cufft.CUFFT_C2C,1)
self.GPU_fftPlans.append(self.fftPlan)
def __initializeDopplerIfftPlan(self):
"""
Initialize the FFT plan(s) for the inverse fft(s) after convolution. These consume a lot of time
Can run batched or non-batched. Depending on the GPU and CUDA/driver version one may be faster than the other
"""
fftBatch = self.doppIdxArrayLen*self.num_masks
if self.confGPU['CUDA']['batchSize'] == 0:
self.FFTNoBatches = 1
else:
noBatches = self.confGPU['CUDA']['batchSize']
self.FFTNoBatches = int(fftBatch/noBatches)
if self.FFTNoBatches != fftBatch/noBatches:
log.error("FFT batch size has to be an integer divider of xcorrNumMasks * doppCarrierSteps")
raise Exception("FFT batch size has to be an integer divider of xcorrNumMasks * doppCarrierSteps")
FFTBatchSize = fftBatch/self.FFTNoBatches
assert FFTBatchSize % 1 == 0, 'Invalid FFT batch size of %f FFT batch size has to be integer. Select a different number of batches' %(FFTBatchSize)
self.FFTBatchSize = int(FFTBatchSize)
log.debug('FFT batch size %d\t %d batches'%(self.FFTBatchSize,self.FFTNoBatches))
if self.FFTNoBatches == 1:
# We only need one transform
self.fftPlanDopplers = cufft.cufftPlan1d(self.Nfft,cufft.CUFFT_C2C,fftBatch)
self.GPU_fftPlans.append(self.fftPlanDopplers)
self.buffAddr = [int(self.GPU_bufXcorr)]
else:
# more than one batch needed
self.fftLoops = int(np.ceil(self.num_masks*self.doppIdxArrayLen/self.num_streams/self.FFTBatchSize))
# We have to set up streams, input addresses and such
self.streams, self.fftPlanDopplers = [], []
for i in range(self.num_streams):
self.streams.append(cuda.Stream())
self.fftPlanDopplers.append(cufft.cufftPlan1d(self.Nfft,cufft.CUFFT_C2C,self.FFTBatchSize))
cufft.cufftSetStream(self.fftPlanDopplers[i],int(self.streams[i].handle))
self.GPU_fftPlans.extend(self.fftPlanDopplers)
# input addresses to the batch
batchOffset = np.complex64().nbytes*self.Nfft*self.FFTBatchSize
self.buffAddr = []
for i in range(self.FFTNoBatches):
self.buffAddr.append(int(int(self.GPU_bufXcorr) + i*batchOffset))
def __initializeKernels(self):
"""
Initialize the cuda kernels and the block and grid dimensions
"""
# FFT plans:
self.__initializeDopplerIfftPlan() # for Doppler Ifft
self.__initializeDemodIfftPlan() # for demod
self.__initializeSNRFftPlan() # for findSNR
# GPU kernels
kernel = self.CudaKernels
## kernels for initialization
self.GPU_multInputVectorWithMasks = kernel.get_function('multInputVectorWithMasks').prepare('PPP')
self.GPU_complexConj = kernel.get_function('complexConj').prepare('P')
self.GPU_scaleComplexByScalar = kernel.get_function('scaleComplexByScalar').prepare('Pf')
self.GPU_setComplexArrayToZeros = kernel.get_function('setComplexArrayToZeros').prepare('P')
## kernels for doppler search
self.GPU_filterMasks = kernel.get_function('multInputVectorWithShiftedMasksDopp').prepare('PPPPii')
# for multInputVectorWithShiftedMasks
self.numBlocks = self.Nfft/self.numThreads
self.bShapeVecMasks = (int(self.numThreads),1,1)
self.gShapeVecMasks = (int(self.numBlocks),1)
assert self.bShapeVecMasks[0]*self.gShapeVecMasks[0]==self.Nfft,'Dimension mismatch'
self.GPU_absSumDoppler = kernel.get_function('blockAbsSumAtomic').prepare('PPi')
# for the absSumKernel to sum the rows together
self.bShapeAbsSum = (128,1,1) # 128 and 2 in next line is just picked TODO: should be config val
self.gShapeAbsSum = (2,int(self.doppIdxArrayLen)) # tweak these
assert self.Nfft % self.bShapeAbsSum[0]*self.gShapeAbsSum[0] == 0,'Nfft has to be dividable by block and grid dimensions'
self.GPU_estDoppler = kernel.get_function('findDopplerEst').prepare('PPPii')
# for the small kernel that finds the doppler
self.bShapeDopp = (self.num_masks,1,1)
self.gShapeDopp = (1,1)
self.GPU_setArrayToZeros = kernel.get_function('setArrayToZeros').prepare('P')
# for the set to zero kernel for the sum
self.bShapeZero = (int(self.num_masks),1,1)
self.gShapeZero = (int(self.doppIdxArrayLen),1)
## for demodulation
self.bShapeVecMasks2 = (int(256),1,1) ## 256 is just picked, TODO: should be config val
self.gShapeVecMasks2 = (int(self.Nfft/self.bShapeVecMasks2[0]),1)
self.complexShiftMulMasks = kernel.get_function('multInputVectorWithShiftedMask').prepare('PPPi')
self.complexHeterodyne = kernel.get_function('complexHeterodyne').prepare('PPfffi')
self.findcentres = kernel.get_function('findCentres').prepare('PPPPffii')
self.bShapeCentres = (256,1,1) ## 256 is just picked, TODO: should be config val
def __loadKernelsFromFile(self):
currentPath = os.path.realpath(__file__).strip(os.path.basename(__file__))
log.debug('loading CUDA kernels from file ' + currentPath)
kernel_header_str = """
#define WARP_SIZE {WARP_SIZE}// %(warp_size)i
#define LOG_WARP_SIZE {LOG_WARP_SIZE} // saves us a log2 computation here
#define NUM_WARPS {NUM_WARPS}
#define FULL_MASK 0xffffffff // For shfl instructions
#define SUM_ALL_MASKS {SUM_ALL_MASKS}
#define NUM_MASKS {NUM_MASKS}
#define WINDOW_WIDTH {WINDOW_WIDTH} // Number of samples around the centre to take into account
#define WINDOW_LEFT_OFFSET WINDOW_WIDTH/2
#define CODE_SEARCH_MASK_OFFSET {CODE_SEARCH_MASK_OFFSET} // used in sumXCorrBuffMasks 0: all masks are used, 1: exclude the 0 and 1 masks (first and last (old CPU setting))
""".format(
NUM_MASKS = self.num_masks,
WINDOW_WIDTH=self.windowWidth,
WARP_SIZE = self.CUDA_WARP_SIZE,
LOG_WARP_SIZE = int(np.log2(self.CUDA_WARP_SIZE)),
NUM_WARPS = np.min((self.CUDA_NUM_WARPS,32)),
SUM_ALL_MASKS = int(self.SUM_ALL_MASKS_PYTHON), # bool has to be casted to int. Else C does not process it properly
CODE_SEARCH_MASK_OFFSET = self.CODE_SEARCH_MASK_OFFSET,
)
# print(kernel_header_str)
if len(currentPath) > 0 :
self.kernelFilePath = '/' + currentPath + '/' + self.kernelFilePath
with open(self.kernelFilePath,'r') as f:
kernelCode = f.read()
kernelCode = kernel_header_str + kernelCode
log.info(f'code search offset: {self.CODE_SEARCH_MASK_OFFSET}')
return kernelCode
def __initializeSharedBuffers(self):
## The last dimension is the flat one in memory
# 3D array: len(doppCyperSym) x num_masks x Nfft
self.GPU_bufXcorr = cuda.mem_alloc(np.complex64().nbytes*self.Nfft*self.doppIdxArrayLen*self.num_masks)
self.GPU_buffers.append(self.GPU_bufXcorr)
# 2D array: len(doppCyperSym) x num_masks
self.GPU_bufDoppSum = cuda.mem_alloc(np.float32().nbytes*self.doppIdxArrayLen*self.num_masks)
self.GPU_buffers.append(self.GPU_bufDoppSum)
# stores the result [mean, sdev]
self.GPU_bufDoppResult = cuda.mem_alloc(np.float32().nbytes*2)
self.GPU_buffers.append(self.GPU_bufDoppResult)
# buffer for the doppler shift indices. This can be omitted once the GPU computes them
self.GPU_bufDoppIdx = cuda.mem_alloc(np.int32().nbytes*self.doppIdxArrayLen)
self.GPU_buffers.append(self.GPU_bufDoppIdx)
# for testing the find dopp
self.GPU_bufFindDoppTmp = cuda.mem_alloc(np.float32().nbytes*self.num_masks)
self.GPU_buffers.append(self.GPU_bufFindDoppTmp)
# to keep the signal
self.GPU_bufSignalTime_cpu_handle = cuda.pagelocked_empty((self.Nfft,), np.complex64, mem_flags=cuda.host_alloc_flags.DEVICEMAP)
self.GPU_bufSignalTime = np.intp(self.GPU_bufSignalTime_cpu_handle.base.get_device_pointer())
self.GPU_bufSignalFreq_cpu_handle = cuda.pagelocked_empty((self.Nfft,), np.complex64, mem_flags=cuda.host_alloc_flags.DEVICEMAP)
self.GPU_bufSignalFreq = np.intp(self.GPU_bufSignalFreq_cpu_handle.base.get_device_pointer())
# self.SNRDataSpecBuf = np.empty(self.Nfft,dtype=np.complex64) # to store the spectrum for computing the SNR
# self.GPU_bufSignalFreq = cuda.mem_alloc(np.complex64().nbytes*self.Nfft)
# self.GPU_buffers.append(self.GPU_bufSignalFreq)
# demodulation buffers to find the centres and locations
self.GPU_symbols = cuda.mem_alloc(np.int32().nbytes*int(self.Nfft/self.spsymMin))
self.GPU_buffers.append(self.GPU_symbols)
self.GPU_centres = cuda.mem_alloc(np.int32().nbytes*int(self.Nfft/self.spsymMin))
self.GPU_buffers.append(self.GPU_centres)
self.GPU_magnitude = cuda.mem_alloc(TRUSTTYPE().nbytes*int(self.Nfft/self.spsymMin))
self.GPU_buffers.append(self.GPU_magnitude)
# arrays local for each stream
self._init_CodeRateAndPhaseBuffers()
def _init_CodeRateAndPhaseBuffers(self):
"""
This method initializes all CodeRateAndPhaseBuffers that are needed for the findCodeRateAndPhaseGPU routine
"""
# Grid and blocks
MAX_BLOCK_X = 1024 # current limit (32 warps of 32 threads = 1024 which is max block size x)
numThreads = int(np.min((self.CUDA_WARP_SIZE * self.CUDA_NUM_WARPS, MAX_BLOCK_X))) # TODO: check with atomic operation to allow more than 32 warps
self.block_codeMax = (numThreads,1,1)
self.grid_codeMax = (1,1) # we only want one grid at the moment. Maybe 2 later, but need to implement atomic operation in the algorithm first!
self.block_codeXCorrSum = (int(self.CUDA_NUM_THREADS/self.CUDA_NUM_SMX),1,1) # 1 block pr
self.grid_codeXCorrSum = (int(self.CUDA_NUM_SMX*4),1) # Make some more grids than SMX's, so there is plenty to do for the GPU while it is waiting for data
## buffers
self.GPU_bufCodeAndPhase = cuda.mem_alloc(int(self.Nfft*np.float32().nbytes)) # output of sum is real, In place R2C fft uses Nfft/2*complex64 bytes which is same length as Nfft*float32
self.GPU_bufCodeAndPhaseOut = cuda.mem_alloc(int(self.Nfft*np.complex64().nbytes)) # for arrays of len >= 2**20, the in-place R2C transform does not seem to work
self.GPU_buffers.append(self.GPU_bufCodeAndPhase)
self.GPU_bufCodeAndPhaseResult = cuda.mem_alloc(np.float32().nbytes*3) # holds [index of max (offset complensated), argument of max (normalized), value of max]
self.GPU_buffers.append(self.GPU_bufCodeAndPhaseResult)
## fft Plan
self.fftPlan_codeRate_R2C = cufft.cufftPlan1d(self.Nfft,cufft.CUFFT_R2C,1) # R2C, 1 batch
self.GPU_fftPlans.append(self.fftPlan_codeRate_R2C)
## CUDA kernels
self.GPU_sumXCorrBuffMasks = self.CudaKernels.get_function('sumXCorrBuffMasks').prepare('PPi')
self.GPU_findCodeRateAndPhase = self.CudaKernels.get_function('findCodeRateAndPhase').prepare('PPii')
## constants
self.symsTolLow = 0.9*self.spsym # Ignore low symbol rates. avoids locking onto harmonics
self.symsTolHigh = 1.1*self.spsym # Ignore high symbol rates (avoids false results due to slow noise and DC)
self.codeRateAndPhaseOffsetLow = int(self.Nfft/self.symsTolLow)
self.codeRateAndPhaseOffsetHigh = int(self.Nfft/self.symsTolHigh)
## numpy buffers
self.__CodeRateAndPhaseResult = np.empty(3,dtype=np.float32) # holds [index of max (offset complensated), argument of max (normalized), value of max]
def __del__(self):
# free all buffers
for buf in self.GPU_buffers:
buf.free()
# destroy all fft plans
for plan in self.GPU_fftPlans:
cufft.cufftDestroy(plan)
try:
self.ctx.pop()
except AttributeError:
pass
if STORE_BITS_IN_FILE is True:
self.xcorrFile.close()
def uploadAndFindUHF(self,samples):
"""
Performs:
thresholding -- remove large spikes of interference
uploadToGPU -- store data on GPU and perform FFT
findUHF -- find the UHF modulated carrier
"""
self.__thresholdInput(samples)
self.uploadToGPU(samples)
return self.__findUHF(samples)
def uploadToGPU(self,samples):
"""
Upload samples to GPU and perform FFT
Data is in pinned memory and transfered directly
"""
# load samples on to GPU and FFT
# cuda.memcpy_htod(self.GPU_bufSignalTime,samples.astype(np.complex64))
# self.GPU_bufSignalTime_cpu_handle[:self.Nfft] = samples.astype(np.complex64)
cufft.cufftExecC2C(self.fftPlan, int(self.GPU_bufSignalTime),
int(self.GPU_bufSignalFreq), cufft.CUFFT_FORWARD)
def thresholdInput(self,samples):
"""
calls thresholding function to reduce large spikes
"""
self.__thresholdInput(samples)
def __findUHF(self,samples):
"""
Search for modulated carrier within a frequency range in the samples. Returns doppler estimate
"""
self.GPU_setArrayToZeros.prepared_call(self.gShapeZero,self.bShapeZero,
self.GPU_bufDoppSum)
self.GPU_filterMasks.prepared_call(self.gShapeVecMasks,self.bShapeVecMasks,
self.GPU_bufXcorr,self.GPU_bufSignalFreq,self.GPU_bufBitsMask,self.GPU_bufDoppIdx,
np.int32(self.Nfft),np.int32(self.doppIdxArrayLen))
if self.FFTNoBatches == 1:
cufft.cufftExecC2C(self.fftPlanDopplers,int(self.GPU_bufXcorr),int(self.GPU_bufXcorr),cufft.CUFFT_INVERSE)
else:
# It is at the moment faster to call single fft loops than batched fft loops (don't ask me why). This can however be changed in the config filte. Therefore all these loops
for j in range(self.fftLoops):
for i in range(self.num_streams):
if j*self.num_streams + i < self.FFTNoBatches:
buffAddr = self.buffAddr[j*self.num_streams+i] # compute the address in the large buffer
cufft.cufftExecC2C(self.fftPlanDopplers[i],buffAddr,buffAddr,cufft.CUFFT_INVERSE)
self.GPU_absSumDoppler.prepared_call(self.gShapeAbsSum,self.bShapeAbsSum,
self.GPU_bufDoppSum,self.GPU_bufXcorr,np.int32(self.Nfft))
if STORE_BITS_IN_FILE:
tstore = time.time()
tmpArr = np.empty((self.doppIdxArrayLen,self.num_masks),dtype=np.float32)
cuda.memcpy_dtoh(tmpArr,self.GPU_bufDoppSum)
self.sum_match = np.vstack([self.sum_match,np.sum(tmpArr,axis=1)])
sumBest = np.argmax(np.sum(tmpArr,axis=1))
log.debug(f'demodulator store in file 1 (save array) time {time.time()-tstore} s')
self.GPU_estDoppler.prepared_call(self.gShapeDopp,self.bShapeDopp,
self.GPU_bufDoppResult,self.GPU_bufFindDoppTmp,self.GPU_bufDoppSum,np.int32(self.num_dopplers), | np.int32(self.doppIdxArrayOffset) | numpy.int32 |
r"""
=====
Swirl
=====
Image swirling is a non-linear image deformation that creates a whirlpool
effect.
Image warping
`````````````
When applying a geometric transformation on an image, we typically make use of
a reverse mapping, i.e., for each pixel in the output image, we compute its
corresponding position in the input. The reason is that, if we were to do it
the other way around (map each input pixel to its new output position), some
pixels in the output may be left empty. On the other hand, each output
coordinate has exactly one corresponding location in (or outside) the input
image, and even if that position is non-integer, we may use interpolation to
compute the corresponding image value.
Performing a reverse mapping
````````````````````````````
To perform a geometric warp in ``skimage``, you simply need to provide the
reverse mapping to the ``skimage.transform.warp`` function. E.g., consider the
case where we would like to shift an image 50 pixels to the left. The reverse
mapping for such a shift would be::
def shift_left(xy):
xy[:, 0] += 50
return xy
The corresponding call to warp is::
from skimage.transform import warp
warp(image, shift_left)
The swirl transformation
````````````````````````
Consider the coordinate :math:`(x, y)` in the output image. The reverse
mapping for the swirl transformation first computes, relative to a center
:math:`(x_0, y_0)`, its polar coordinates,
.. math::
\theta = \arctan(y/x)
\rho = \sqrt{(x - x_0)^2 + (y - y_0)^2},
and then transforms them according to
.. math::
r = \ln(2) \, \mathtt{radius} / 5
\phi = \mathtt{rotation}
s = \mathtt{strength}
\theta' = \phi + s \, e^{-\rho / r + \theta}
where ``strength`` is a parameter for the amount of swirl, ``radius`` indicates
the swirl extent in pixels, and ``rotation`` adds a rotation angle. The
transformation of ``radius`` into :math:`r` is to ensure that the
transformation decays to :math:`\approx 1/1000^{\mathsf{th}}` within the
specified radius.
"""
from __future__ import division
from matplotlib.widgets import Slider
import matplotlib.pyplot as plt
import numpy as np
from scipy import ndimage
from skimage import io, transform
def _swirl_mapping(xy, center, rotation, strength, radius):
"""Compute the coordinate mapping for a swirl transformation.
"""
x, y = xy.T
x0, y0 = center
rho = np.sqrt((x - x0)**2 + (y - y0)**2)
# Ensure that the transformation decays to approximately 1/1000-th
# within the specified radius.
radius = radius / 5 * np.log(2)
theta = rotation + strength * \
np.exp(-rho / radius) + \
np.arctan2(y - y0, x - x0)
xy[..., 0] = x0 + rho * | np.cos(theta) | numpy.cos |
# -*- coding: utf-8 -*-
import os
import sys
import time
import h5py
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import distance
from tqdm import tqdm
from anomalyModelBase import AnomalyModelBase
from common import utils, logger
class AnomalyModelBalancedDistribution(AnomalyModelBase):
"""Anomaly model formed by a Balanced Distribution of feature vectors
Reference: https://www.mdpi.com/2076-3417/9/4/757
"""
def __init__(self, initial_normal_features=1000, threshold_learning=300, threshold_classification=5, pruning_parameter=0.3):
AnomalyModelBase.__init__(self)
self.NAME += "/%i/%i/%.2f" % (initial_normal_features, threshold_learning, pruning_parameter)
assert 0 < pruning_parameter < 1, "Pruning parameter out of range (0 < η < 1)"
self.initial_normal_features = initial_normal_features # See reference algorithm variable N
self.threshold_learning = threshold_learning # See reference algorithm variable α
self.threshold_classification = threshold_classification # See reference algorithm variable β
self.pruning_parameter = pruning_parameter # See reference algorithm variable η
self.balanced_distribution = None # Array containing all the "normal" samples
self._mean = None # Mean
self._covI = None # Inverse of covariance matrix
def classify(self, patch, threshold_classification=None):
"""The anomaly measure is defined as the Mahalanobis distance between a feature sample
and the Balanced Distribution.
"""
if threshold_classification is None:
threshold_classification = self.threshold_classification
if self._mean is None or self._covI is None:
self._calculate_mean_and_covariance()
return self.__mahalanobis_distance__(patch) > threshold_classification
def _calculate_mean_and_covariance(self):
"""Calculate mean and inverse of covariance of the "normal" distribution"""
assert not self.balanced_distribution is None and len(self.balanced_distribution) > 0, \
"Can't calculate mean or covariance of nothing!"
self._mean = np.mean(self.balanced_distribution["features"], axis=0, dtype=np.float64) # Mean
cov = np.cov(self.balanced_distribution["features"], rowvar=False) # Covariance matrix
try:
self._covI = | np.linalg.pinv(cov) | numpy.linalg.pinv |
# Loading libraries
import os
import numpy as np
import cv2
from PIL import Image
import logging
import tensorflow as tf
# Function to greyscale, blur and change the receptive threshold of image
def preprocess(image):
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blur = cv2.GaussianBlur(gray, (3, 3), 6)
threshold_img = cv2.adaptiveThreshold(blur, 255, 1, 1, 11, 2)
return threshold_img
def main_outline(contour):
biggest = np.array([])
max_area = 0
for i in contour:
area = cv2.contourArea(i)
if area > 50:
peri = cv2.arcLength(i, True)
approx = cv2.approxPolyDP(i, 0.02 * peri, True)
if area > max_area and len(approx) == 4:
biggest = approx
max_area = area
return biggest, max_area
def reframe(points):
points = points.reshape((4, 2))
points_new = np.zeros((4, 1, 2), dtype=np.int32)
add = points.sum(1)
points_new[0] = points[np.argmin(add)]
points_new[3] = points[np.argmax(add)]
diff = np.diff(points, axis=1)
points_new[1] = points[np.argmin(diff)]
points_new[2] = points[np.argmax(diff)]
return points_new
def splitcells(img):
rows = np.vsplit(img, 9)
boxes = []
for r in rows:
cols = np.hsplit(r, 9)
for box in cols:
boxes.append(box)
return boxes
def CropCell(cells):
Cells_croped = []
for image in cells:
img = | np.array(image) | numpy.array |
# coding=utf-8
"""
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from warnings import warn
from copy import deepcopy
import numpy as np
from pypint.solvers.states.i_solver_state import IStepState, ISolverState, IStaticStateIterator
from pypint.solutions.iterative_solution import IterativeSolution
from pypint.solutions.data_storage.trajectory_solution_data import TrajectorySolutionData
from pypint.utilities import assert_condition, class_name
from pypint.utilities.logging import LOG
class MlSdcStepState(IStepState):
def __init__(self, **kwargs):
super(MlSdcStepState, self).__init__(**kwargs)
self._fas_correction = None
self._coarse_correction = 0.0
self._intermediate = IStepState()
def has_fas_correction(self):
return self._fas_correction is not None
@property
def intermediate(self):
return self._intermediate
@property
def coarse_correction(self):
return self._coarse_correction
@coarse_correction.setter
def coarse_correction(self, coarse_correction):
self._coarse_correction = coarse_correction
@property
def fas_correction(self):
return self._fas_correction
@fas_correction.setter
def fas_correction(self, fas_correction):
if not isinstance(fas_correction, np.ndarray):
# LOG.debug("FAS Correction not given as Array. Converting it to one.")
fas_correction = np.array([fas_correction])
self._fas_correction = fas_correction
class MlSdcLevelState(IStaticStateIterator):
def __init__(self, **kwargs):
kwargs['solution_class'] = TrajectorySolutionData
kwargs['element_type'] = MlSdcStepState
super(MlSdcLevelState, self).__init__(**kwargs)
self._initial = MlSdcStepState()
self._integral = 0.0
@property
def initial(self):
"""Accessor for the initial value of this time step
"""
return self._initial
@initial.setter
def initial(self, initial):
self._initial = initial
@property
def integral(self):
return self._integral
@integral.setter
def integral(self, integral):
self._integral = integral
@property
def time_points(self):
"""Read-only accessor for the list of time points of this time step
"""
return np.array([step.time_point for step in self], dtype=float)
@property
def values(self):
return np.append([self.initial.value.copy()], [step.value.copy() for step in self], axis=0)
@property
def rhs(self):
if self.initial.rhs_evaluated and np.all([step.rhs_evaluated for step in self]):
return np.append([self.initial.rhs], [step.rhs for step in self], axis=0)
else:
return None
@values.setter
def values(self, values):
assert_condition(values.shape[0] == (len(self) + 1), ValueError,
"Number of values does not match number of nodes: %d != %d"
% (values.shape[0], (len(self) + 1)),
checking_obj=self)
for _step in range(0, len(self)):
self[_step].value = values[_step + 1].copy()
@property
def fas_correction(self):
_fas = np.empty(len(self) + 1, dtype=np.object)
_fas_shape = ()
for step_i in range(0, len(self)):
if self[step_i].has_fas_correction():
_fas_shape = self[step_i].fas_correction.shape
_fas[step_i + 1] = self[step_i].fas_correction.copy()
if len(_fas_shape) > 0:
_fas[0] = np.zeros(_fas_shape)
return _fas
else:
return None
@fas_correction.setter
def fas_correction(self, fas_correction):
assert_condition(fas_correction.shape[0] == (len(self) + 1), ValueError,
"Number of FAS Corrections does not match number of nodes: %d != %d"
% (fas_correction.shape[0], (len(self) + 1)),
checking_obj=self)
for _step in range(0, len(self)):
self[_step].fas_correction = fas_correction[_step + 1] - fas_correction[_step]
@property
def coarse_corrections(self):
return np.append([np.zeros(self[0].coarse_correction.shape)], [step.coarse_correction for step in self], axis=0)
@coarse_corrections.setter
def coarse_corrections(self, coarse_correction):
assert_condition(coarse_correction.shape[0] == (len(self) + 1), ValueError,
"Number of Coarse Corrections does not match number of nodes: %d != %d"
% (coarse_correction.shape[0], (len(self) + 1)),
checking_obj=self)
for _step in range(0, len(self)):
self[_step].coarse_correction = coarse_correction[_step + 1]
@property
def current_time_point(self):
"""Accessor for the current step's time point
Returns
-------
current_time_point : :py:class:`float` or :py:class:`None`
:py:class:`None` is returned if :py:attr:`.current_step` is :py:class:`None`
"""
return self.current_step.time_point if self.current_step is not None else None
@property
def previous_time_point(self):
"""Accessor for the previous step's time point
Returns
-------
previous_time_point : :py:class:`float` or :py:class:`None`
:py:class:`None` is returned if :py:attr:`.previous_step` is :py:class:`None`
"""
return self.previous_step.time_point if self.previous is not None else None
@property
def next_time_point(self):
"""Accessor for the next step's time point
Returns
-------
next_time_point : :py:class:`float` or :py:class:`None`
:py:class:`None` is returned if :py:attr:`.next_step` is :py:class:`None`
"""
return self.next.time_point if self.next_step is not None else None
@property
def current_step(self):
"""Proxy for :py:attr:`.current`
"""
return self.current
@property
def current_step_index(self):
"""Proxy for :py:attr:`.current_index`
"""
return self.current_index
@property
def previous_step(self):
"""Accessor for the previous step
Returns
-------
previous step : :py:class:`.IStepState` or :py:class:`None`
:py:class:`None` is returned if :py:attr:`.previous_index` is :py:class:`None`
"""
return self.previous if self.previous_index is not None else self.initial
@property
def previous_step_index(self):
"""Proxy for :py:attr:`.previous_index`
"""
return self.previous_index
@property
def next_step(self):
"""Proxy for :py:attr:`.next`
"""
return self.next
@property
def next_step_index(self):
"""Proxy for :py:attr:`.next_index`
"""
return self.next_index
@property
def final_step(self):
"""Proxy for :py:attr:`.last`
"""
return self.last
@property
def final_step_index(self):
"""Proxy for :py:attr:`.last_index`
"""
return self.last_index
class MlSdcIterationState(IStaticStateIterator):
def __init__(self, **kwargs):
kwargs['solution_class'] = TrajectorySolutionData
kwargs['element_type'] = MlSdcLevelState
if 'num_states' in kwargs:
warn("Levels must be initialized separately.")
del kwargs['num_states']
super(MlSdcIterationState, self).__init__(**kwargs)
self._initial = None
def add_finer_level(self, num_nodes):
self._states.append(self._element_type(num_states=num_nodes))
self._current_index = len(self) - 1
def add_coarser_level(self, num_nodes):
self._states.insert(0, self._element_type(num_states=num_nodes))
self._current_index = len(self) - 1
def proceed(self):
raise RuntimeError("'proceed' is not defined in the context of different levels.")
def finalize(self):
assert_condition(not self.finalized, RuntimeError,
message="This {} is already done.".format(class_name(self)),
checking_obj=self)
self._solution = self.finest_level.solution
self._current_index = 0
self._finalized = True
def step_up(self):
"""Get to next finer level
"""
if self.next_index:
# LOG.debug("Stepping up to level %d" % (self._current_index + 1))
self._current_index += 1
else:
raise StopIteration("There is no finer level available.")
def step_down(self):
if not self.on_base_level:
# LOG.debug("Stepping down to level %d" % (self._current_index - 1))
self._current_index -= 1
for _step in self.current_level:
_step.intermediate.value = _step.value.copy()
if _step.rhs_evaluated:
_step.intermediate.rhs = _step.rhs.copy()
else:
raise StopIteration("There is no finer level available.")
@property
def time_points(self):
"""Read-only accessor for the list of time points of this time step
"""
return | np.array([step.time_point for step in self], dtype=float) | numpy.array |
#This script takes daily.csv (daily Covid Tracking Project testing data) and turns it
# into StateTestingTimeSeries.csv a statewise populated series
#run it again with an updated daily.csv to update to latest information
#<NAME>
import sys
import time
import numpy as np
import pandas as pd
import datetime
sys.path.append('..')
import lib
CCHTS = lib.loadCCHTimeSeries()#used to get state population data
CC = lib.loadUSCountiesCov()#only used to get date information
DST = lib.loadDailyStateTesting()
#get date data
DAYBEFORE = '2020-01-20'
DAYBEFORE = np.datetime64(DAYBEFORE)
CCdates = CC['date']
CCdates = np.array(CCdates, dtype=np.datetime64)
CCdateRange = np.arange(DAYBEFORE, CCdates[-1]+np.timedelta64(1,'D'), dtype='datetime64[D]')
CCHTS_startDate = np.datetime64(((CCHTS.columns).to_numpy()[10])[-10:])
CCHTS_endDate = np.datetime64(((CCHTS.columns).to_numpy()[-1])[-10:])
CCHTSdateRange = np.arange(CCHTS_startDate, CCHTS_endDate+np.timedelta64(1,'D'), dtype='datetime64[D]')
dst_dates = DST['date'].to_numpy()
dst_dates = np.array([ pd.to_datetime(str(date), format='%Y%m%d') for date in dst_dates], dtype='datetime64[D]')
DST_startDate = np.datetime64(dst_dates[-1])
DST_endDate = np.datetime64(dst_dates[0])
DSTdateRange = np.arange(DST_startDate, DST_endDate, dtype='datetime64[D]')
DSTstates = DST['state'].to_numpy()
DSTstatesExp = []
for stateCode in DSTstates:
DSTstatesExp.append(lib.stateDict[stateCode])
DSTstatesExp = np.array(DSTstatesExp)
#create date range thats the same as our cases/deaths data
tDateRange = np.arange(DAYBEFORE, CCdates[-1]+np.timedelta64(1,'D'), dtype='datetime64[D]')
#check dates totals CC and CCHTS should be == if CCHTS is as up to date as CC
print('CC date range: ',len(CCdateRange),'\tCCHTS date range: ',len(CCHTSdateRange),'\tDST date range: ',len(DSTdateRange))
#retrieve neccessary itterables from DST dst_dates was created above
dst_states = DST['state'].to_numpy()
dst_tests = DST['totalTestResults'].to_numpy()
dst_pos = DST['positive'].to_numpy()
dst_neg = DST['negative'].to_numpy()
#retrieve neccessary itterables from CCHTS
countyPop = CCHTS['population'].to_numpy()
countyState = CCHTS['state']
#create list of 51 states+dc postal codes
states = np.array(list(lib.stateDict.keys()))
removeStatesMask = ~np.isin(states,np.array(['AS','GU','MP','PR','VI','UM','FM','MH','PW','AA','AE','AP','CM','PZ','NB','PH','PC']))
states = states[removeStatesMask]
#get full state names
statesExp = np.array([lib.stateDict[stateCode] for stateCode in states])
#create zero filled holder matrix for daily state testing
tStateDay = np.zeros((len(states), len(tDateRange)), dtype=np.intc)
pStateDay = np.zeros((len(states), len(tDateRange)), dtype=np.intc)
nStateDay = np.zeros((len(states), len(tDateRange)), dtype=np.intc)
#create zero filled holder for cummulative state population
statePop = np.zeros((len(states)), dtype=np.intc)
#create indeces for traversing xStateDays
statesIndex = np.arange(len(states), dtype=np.intc)
datesIndex = np.arange(len(tDateRange), dtype=np.intc)
start = time.time()
for (s, state) in zip(statesIndex, states):
stateMask = dst_states==state
state_tests = dst_tests[stateMask]
state_pos = dst_pos[stateMask]
state_neg = dst_neg[stateMask]
state_dates = dst_dates[stateMask]
stateMask = countyState==statesExp[s]
statePop[s] += np.sum(countyPop[stateMask])
for (d, date) in zip(datesIndex, tDateRange):
dateMap = state_dates==date
sTestsTemp = state_tests[dateMap]
sPosTemp = state_pos[dateMap]
sNegTemp = state_neg[dateMap]
numT = np.sum(sTestsTemp) if sTestsTemp.size != 0 else np.intc(0)
numP = np.sum(sPosTemp) if sPosTemp.size != 0 else np.intc(0)
numN = np.sum(sNegTemp) if sNegTemp.size != 0 else np.intc(0)
prevT = tStateDay[s, d-np.intc(1)] if d != np.intc(0) else np.intc(0)
prevP = pStateDay[s, d-np.intc(1)] if d != np.intc(0) else np.intc(0)
prevN = nStateDay[s, d-np.intc(1)] if d != np.intc(0) else | np.intc(0) | numpy.intc |
import numpy as np
import matplotlib.pyplot as plt
import scipy.fftpack
from scipy.io import wavfile
import sys
import wave
from pydub import AudioSegment
numberofharmonics=8
midivalue=48
fundamental=220
amplitude=30000 #Too high will cause clipping!
fundamental_playback=fundamental #Changing this will alter the frequency of the sample wave. Set to 'fundamental' as default
amplitude_cutoff=.02 #any amplitude that is lower than cutoff*max_amplitude is filtered out
harmonic_cutoff=10 #any harmonic within cutoff hertz of another is skipped
frequencies_below_harmonic=0 #0 is no, 1 is yes
sound = AudioSegment.from_wav("audio.wav")
sound = sound.set_channels(1)
sound.export("audio_mono.wav", format="wav")
spf = wave.open("audio_mono.wav", "r")
#Extract Raw Audio from Wav File
#signal = spf.readframes(-1)
#signal = np.fromstring(signal, "Int16")
#plt.figure(1)
#plt.title("Signal Wave...")
#plt.plot(signal)
#plt.show()
fs, data = scipy.io.wavfile.read('audio_mono.wav')
# Number of samplepoints
N = len(data)
if (N % 2) == 0:
N=N
else:
N=N-1
# sample spacing
T = 1.0 / fs
x = np.linspace(0.0, T*N, N)
y = data
yf = scipy.fftpack.fft(y)
xf = np.linspace(0.0, 1.0/(2.0*T), N/2)
#fig, ax = plt.subplots()
#ax.plot(xf, 2.0/N * np.abs(yf[:N//2]))
#plt.show()
dat =2.0/N * np.abs(yf[:N//2])
datsort=2.0/N * np.abs(yf[:N//2])
datsort.sort()
harm = np.empty(datsort.shape, dtype=np.longdouble)
harmonics = np.empty(numberofharmonics, dtype=np.longdouble)
n=0
while(n<N/2):
itemindex = np.where(dat==datsort[-(1+n)])
harm[n]=xf[itemindex]
n=n+1
n=0
co=0
TrueFundamental1=min(harm, key=lambda x:abs(x-fundamental))
while(n<numberofharmonics):
io=co
while((io!=-1 and co<N/2-1)):
if(harmonic_cutoff<abs(harm[co]-harm[io-1])):
io=io-1
else:
co=co+1
io=co
if(harm[co]==0):
co=co+1
io=co
if(harm[co]<TrueFundamental1 and frequencies_below_harmonic==0):
co=co+1
io=co
harmonics[n]=harm[co]
n=n+1
co=co+1
harmonics.sort()
amplitudes = | np.empty(numberofharmonics, dtype=np.longdouble) | numpy.empty |
# Copyright 2019 Xanadu Quantum Technologies Inc.
# 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.
r"""Unit tests for the Strawberry Fields decompositions module"""
import pytest
pytestmark = pytest.mark.frontend
import networkx as nx
import numpy as np
import scipy as sp
from scipy.linalg import qr, block_diag
from strawberryfields import decompositions as dec
from strawberryfields.utils import random_interferometer as haar_measure
N_SAMPLES = 10
# fix the seed to make the test deterministic
np.random.seed(42)
def omega(n):
"""Returns the symplectic matrix for n modes"""
idm = np.identity(n)
O = np.concatenate(
(
np.concatenate((0 * idm, idm), axis=1),
np.concatenate((-idm, 0 * idm), axis=1),
),
axis=0,
)
return O
class TestTakagi:
"""Takagi decomposition tests"""
def test_square_validation(self):
"""Test that the takagi decomposition raises exception if not square"""
A = np.random.random([4, 5]) + 1j * np.random.random([4, 5])
with pytest.raises(ValueError, match="matrix must be square"):
dec.takagi(A)
def test_symmetric_validation(self):
"""Test that the takagi decomposition raises exception if not symmetric"""
A = np.random.random([5, 5]) + 1j * np.random.random([5, 5])
with pytest.raises(ValueError, match="matrix is not symmetric"):
dec.takagi(A)
def test_random_symm(self, tol):
"""Verify that the Takagi decomposition, applied to a random symmetric
matrix, produced a decomposition that can be used to reconstruct the matrix."""
A = np.random.random([6, 6]) + 1j * np.random.random([6, 6])
A += A.T
rl, U = dec.takagi(A)
res = U @ np.diag(rl) @ U.T
assert np.allclose(res, A, atol=tol, rtol=0)
def test_real_degenerate(self):
"""Verify that the Takagi decomposition returns a matrix that is unitary and results in a
correct decomposition when input a real but highly degenerate matrix. This test uses the
adjacency matrix of a balanced tree graph."""
g = nx.balanced_tree(2, 4)
a = nx.to_numpy_array(g)
rl, U = dec.takagi(a)
assert np.allclose(U @ U.conj().T, np.eye(len(a)))
assert np.allclose(U @ np.diag(rl) @ U.T, a)
def test_zeros(self):
"""Verify that the Takagi decomposition returns a zero vector and identity matrix when
input a matrix of zeros"""
dim = 4
a = np.zeros((dim, dim))
rl, U = dec.takagi(a)
assert np.allclose(rl, np.zeros(dim))
assert np.allclose(U, np.eye(dim))
class TestGraphEmbed:
"""graph_embed tests"""
def test_square_validation(self):
"""Test that the graph_embed decomposition raises exception if not square"""
A = np.random.random([4, 5]) + 1j * np.random.random([4, 5])
with pytest.raises(ValueError, match="matrix is not square"):
dec.graph_embed(A)
def test_symmetric_validation(self):
"""Test that the graph_embed decomposition raises exception if not symmetric"""
A = np.random.random([5, 5]) + 1j * np.random.random([5, 5])
with pytest.raises(ValueError, match="matrix is not symmetric"):
dec.graph_embed(A)
def test_max_mean_photon_deprecated(self, tol):
"""This test verifies that the maximum amount of squeezing used to encode
the graph is indeed capped by the parameter max_mean_photon"""
max_mean_photon = 2
A = np.random.random([6, 6]) + 1j * np.random.random([6, 6])
A += A.T
sc, _ = dec.graph_embed_deprecated(A, max_mean_photon=max_mean_photon)
res_mean_photon = np.sinh(np.max(np.abs(sc))) ** 2
assert np.allclose(res_mean_photon, max_mean_photon, atol=tol, rtol=0)
def test_make_traceless_deprecated(self, monkeypatch, tol):
"""Test that A is properly made traceless"""
A = np.random.random([6, 6]) + 1j * np.random.random([6, 6])
A += A.T
assert not np.allclose(np.trace(A), 0, atol=tol, rtol=0)
with monkeypatch.context() as m:
# monkeypatch the takagi function to simply return A,
# so that we can inspect it and make sure it is now traceless
m.setattr(dec, "takagi", lambda A, tol: (np.ones([6]), A))
_, A_out = dec.graph_embed_deprecated(A, make_traceless=True)
assert np.allclose(np.trace(A_out), 0, atol=tol, rtol=0)
def test_mean_photon(self, tol):
"""Test that the mean photon number is correct in graph_embed"""
num_modes = 6
A = np.random.random([num_modes, num_modes]) + 1j * np.random.random([num_modes, num_modes])
A += A.T
n_mean = 10.0 / num_modes
sc, _ = dec.graph_embed(A, mean_photon_per_mode=n_mean)
n_mean_calc = np.mean(np.sinh(sc) ** 2)
assert np.allclose(n_mean, n_mean_calc, atol=tol, rtol=0)
class TestBipartiteGraphEmbed:
"""graph_embed tests"""
def test_square_validation(self):
"""Test that the graph_embed decomposition raises exception if not square"""
A = np.random.random([4, 5]) + 1j * np.random.random([4, 5])
with pytest.raises(ValueError, match="matrix is not square"):
dec.bipartite_graph_embed(A)
@pytest.mark.parametrize("make_symmetric", [True, False])
def test_mean_photon(self, tol, make_symmetric):
"""Test that the mean photon number is correct in graph_embed"""
num_modes = 6
A = np.random.random([num_modes, num_modes]) + 1j * np.random.random([num_modes, num_modes])
if make_symmetric:
A += A.T
n_mean = 1.0
sc, _, _ = dec.bipartite_graph_embed(A, mean_photon_per_mode=n_mean)
n_mean_calc = np.sum(np.sinh(sc) ** 2) / (num_modes)
assert np.allclose(n_mean, n_mean_calc, atol=tol, rtol=0)
@pytest.mark.parametrize("make_symmetric", [True, False])
def test_correct_graph(self, tol, make_symmetric):
"""Test that the graph is embeded correctly"""
num_modes = 3
A = np.random.random([num_modes, num_modes]) + 1j * np.random.random([num_modes, num_modes])
U, l, V = np.linalg.svd(A)
new_l = np.array([np.tanh(np.arcsinh(np.sqrt(i))) for i in range(1, num_modes + 1)])
n_mean = 0.5 * (num_modes + 1)
if make_symmetric:
At = U @ np.diag(new_l) @ U.T
else:
At = U @ np.diag(new_l) @ V.T
sqf, Uf, Vf = dec.bipartite_graph_embed(At, mean_photon_per_mode=n_mean)
assert np.allclose(np.tanh(-np.flip(sqf)), new_l)
assert np.allclose(Uf @ np.diag(np.tanh(-sqf)) @ Vf.T, At)
class TestRectangularDecomposition:
"""Tests for linear interferometer rectangular decomposition"""
def test_unitary_validation(self):
"""Test that an exception is raised if not unitary"""
A = np.random.random([5, 5]) + 1j * np.random.random([5, 5])
with pytest.raises(ValueError, match="matrix is not unitary"):
dec.rectangular(A)
@pytest.mark.parametrize(
"U",
[
pytest.param(np.identity(20), id="identity20"),
pytest.param(np.identity(20)[::-1], id="antiidentity20"),
pytest.param(haar_measure(20), id="random20"),
],
)
def test_rectangular(self, U, tol):
"""This test checks the function :func:`dec.rectangular` for
various unitary matrices.
A given unitary (identity or random draw from Haar measure) is
decomposed using the function :func:`dec.rectangular`
and the resulting beamsplitters are multiplied together.
Test passes if the product matches the given unitary.
"""
nmax, mmax = U.shape
assert nmax == mmax
tilist, diags, tlist = dec.rectangular(U)
qrec = np.identity(nmax)
for i in tilist:
qrec = dec.T(*i) @ qrec
qrec = np.diag(diags) @ qrec
for i in reversed(tlist):
qrec = dec.Ti(*i) @ qrec
assert np.allclose(U, qrec, atol=tol, rtol=0)
def test_random_unitary_phase_end(self, tol):
"""This test checks the rectangular decomposition with phases at the end.
A random unitary is drawn from the Haar measure, then is decomposed
using Eq. 5 of the rectangular decomposition procedure of Clements et al,
i.e., moving all the phases to the end of the interferometer. The
resulting beamsplitters are multiplied together. Test passes if the
product matches the drawn unitary.
"""
n = 20
U = haar_measure(n)
tlist, diags, _ = dec.rectangular_phase_end(U)
qrec = np.identity(n)
for i in tlist:
qrec = dec.T(*i) @ qrec
qrec = np.diag(diags) @ qrec
assert np.allclose(U, qrec, atol=tol, rtol=0)
@pytest.mark.parametrize(
"U",
[
pytest.param(np.identity(20), id="identity20"),
pytest.param(np.identity(20)[::-1], id="antiidentity20"),
pytest.param(haar_measure(20), id="random20"),
],
)
def test_rectangular_MZ(self, U, tol):
"""This test checks the function :func:`dec.rectangular_MZ` for
various unitary matrices.
A given unitary (identity or random draw from Haar measure) is
decomposed using the function :func:`dec.rectangular_MZ`
and the resulting beamsplitters are multiplied together.
Test passes if the product matches the given unitary.
"""
nmax, mmax = U.shape
assert nmax == mmax
tilist, diags, tlist = dec.rectangular_MZ(U)
qrec = np.identity(nmax)
for i in tilist:
qrec = dec.mach_zehnder(*i) @ qrec
qrec = np.diag(diags) @ qrec
for i in reversed(tlist):
qrec = dec.mach_zehnder_inv(*i) @ qrec
assert np.allclose(U, qrec, atol=tol, rtol=0)
class TestRectangularSymmetricDecomposition:
"""Tests for linear interferometer decomposition into rectangular grid of
phase-shifters and pairs of symmetric beamsplitters"""
def test_unitary_validation(self):
"""Test that an exception is raised if not unitary"""
A = np.random.random([5, 5]) + 1j * np.random.random([5, 5])
with pytest.raises(ValueError, match="matrix is not unitary"):
dec.rectangular_symmetric(A)
@pytest.mark.parametrize(
"U",
[
pytest.param(np.identity(2), id="identity2"),
pytest.param(np.identity(2)[::-1], id="antiidentity2"),
pytest.param(haar_measure(2), id="random2"),
pytest.param(np.identity(4), id="identity4"),
pytest.param(np.identity(3)[::-1], id="antiidentity4"),
pytest.param(haar_measure(4), id="random4"),
pytest.param(np.identity(8), id="identity8"),
pytest.param(np.identity(8)[::-1], id="antiidentity8"),
pytest.param(haar_measure(8), id="random8"),
pytest.param(np.identity(20), id="identity20"),
pytest.param(np.identity(20)[::-1], id="antiidentity20"),
pytest.param(haar_measure(20), id="random20"),
],
)
def test_decomposition(self, U, tol):
"""This test checks the function :func:`dec.rectangular_symmetric` for
various unitary matrices.
A given unitary (identity or random draw from Haar measure) is
decomposed using the function :func:`dec.rectangular_symmetric`
and the resulting beamsplitters are multiplied together.
Test passes if the product matches the given unitary.
"""
nmax, mmax = U.shape
assert nmax == mmax
tlist, diags, _ = dec.rectangular_symmetric(U)
qrec = np.identity(nmax)
for i in tlist:
assert i[2] >= 0 and i[2] < 2 * np.pi # internal phase
assert i[3] >= 0 and i[3] < 2 * np.pi # external phase
qrec = dec.mach_zehnder(*i) @ qrec
qrec = np.diag(diags) @ qrec
assert np.allclose(U, qrec, atol=tol, rtol=0)
class TestTriangularDecomposition:
"""Tests for linear interferometer triangular decomposition"""
def test_unitary_validation(self):
"""Test that an exception is raised if not unitary"""
A = np.random.random([5, 5]) + 1j * np.random.random([5, 5])
with pytest.raises(ValueError, match="matrix is not unitary"):
dec.triangular(A)
def test_identity(self, tol):
"""This test checks the rectangular decomposition for an identity unitary.
An identity unitary is decomposed via the rectangular decomposition of
Clements et al. and the resulting beamsplitters are multiplied together.
Test passes if the product matches identity.
"""
# TODO: this test currently uses the T and Ti functions used to compute
# Clements as the comparison. Probably should be changed.
n = 20
U = np.identity(n)
tlist, diags, _ = dec.triangular(U)
qrec = np.diag(diags)
for i in tlist:
qrec = dec.Ti(*i) @ qrec
assert np.allclose(U, qrec, atol=tol, rtol=0)
def test_random_unitary(self, tol):
"""This test checks the rectangular decomposition for a random unitary.
A random unitary is drawn from the Haar measure, then is decomposed via
the rectangular decomposition of Clements et al., and the resulting
beamsplitters are multiplied together. Test passes if the product
matches the drawn unitary.
"""
# TODO: this test currently uses the T and Ti functions used to compute
# Clements as the comparison. Probably should be changed.
n = 20
U = haar_measure(n)
tlist, diags, _ = dec.triangular(U)
qrec = np.diag(diags)
for i in tlist:
qrec = dec.Ti(*i) @ qrec
assert np.allclose(U, qrec, atol=tol, rtol=0)
def _rectangular_compact_recompose(phases):
r"""Calculates the unitary of a rectangular compact interferometer,
using the phases provided in phases dict.
Args:
phases (dict):
where the keywords:
* ``m``: the length of the matrix
* ``phi_ins``: parameters for the phase-shifters
* ``sigmas``: parameters for the sMZI
* ``deltas``: parameters for the sMZI
* ``phi_edges``: parameters for the edge phase shifters
* ``phi_outs``: parameters for the phase-shifters
Returns:
array : unitary matrix of the interferometer
"""
m = phases["m"]
U = np.eye(m, dtype=np.complex128)
for j in range(0, m - 1, 2):
phi = phases["phi_ins"][j]
U = dec.P(j, phi, m) @ U
for layer in range(m):
if (layer + m + 1) % 2 == 0:
phi_bottom = phases["phi_edges"][m - 1, layer]
U = dec.P(m - 1, phi_bottom, m) @ U
for mode in range(layer % 2, m - 1, 2):
delta = phases["deltas"][mode, layer]
sigma = phases["sigmas"][mode, layer]
U = dec.M(mode, sigma, delta, m) @ U
for j, phi_j in phases["phi_outs"].items():
U = dec.P(j, phi_j, m) @ U
return U
class TestRectangularCompactDecomposition:
"""Tests for linear interferometer decomposition into rectangular grid of
phase-shifters and pairs of symmetric beamsplitters"""
def test_unitary_validation(self):
"""Test that an exception is raised if not unitary"""
A = np.random.random([5, 5]) + 1j * np.random.random([5, 5])
with pytest.raises(ValueError, match="The input matrix is not unitary"):
dec.rectangular_compact(A)
@pytest.mark.parametrize(
"U",
[
pytest.param(np.identity(2), id="identity2"),
pytest.param(np.identity(2)[::-1], id="antiidentity2"),
pytest.param(haar_measure(2), id="random2"),
pytest.param(np.identity(4), id="identity4"),
pytest.param(np.identity(4)[::-1], id="antiidentity4"),
pytest.param(haar_measure(4), id="random4"),
pytest.param(np.identity(8), id="identity8"),
pytest.param(np.identity(8)[::-1], id="antiidentity8"),
pytest.param(haar_measure(8), id="random8"),
pytest.param(np.identity(20), id="identity20"),
pytest.param(np.identity(20)[::-1], id="antiidentity20"),
pytest.param(haar_measure(20), id="random20"),
pytest.param(np.identity(7), id="identity7"),
pytest.param(np.identity(7)[::-1], id="antiidentity7"),
pytest.param(haar_measure(7), id="random7"),
],
)
def test_decomposition(self, U, tol):
"""This test checks the function :func:`dec.rectangular_symmetric` for
various unitary matrices.
A given unitary (identity or random draw from Haar measure) is
decomposed using the function :func:`dec.rectangular_symmetric`
and the resulting beamsplitters are multiplied together.
Test passes if the product matches the given unitary.
"""
nmax, mmax = U.shape
assert nmax == mmax
phases = dec.rectangular_compact(U)
Uout = _rectangular_compact_recompose(phases)
assert np.allclose(U, Uout, atol=tol, rtol=0)
def _triangular_compact_recompose(phases):
r"""Calculates the unitary of a triangular compact interferometer,
using the phases provided in phases dict.
Args:
phases (dict):
where the keywords:
* ``m``: the length of the matrix
* ``phi_ins``: parameter of the phase-shifter at the beginning of the mode
* ``sigmas``: parameter of the sMZI :math:`\frac{(\theta_1+\theta_2)}{2}`, where `\theta_{1,2}` are the values of the two internal phase-shifts of sMZI
* ``deltas``: parameter of the sMZI :math:`\frac{(\theta_1-\theta_2)}{2}`, where `\theta_{1,2}` are the values of the two internal phase-shifts of sMZI
* ``zetas``: parameter of the phase-shifter at the end of the mode
Returns:
U (array) : unitary matrix of the interferometer
"""
m = phases["m"]
U = np.identity(m, dtype=np.complex128)
for j in range(m - 1):
phi_j = phases["phi_ins"][j]
U = dec.P(j + 1, phi_j, m) @ U
for k in range(j + 1):
n = j - k
delta = phases["deltas"][n, k]
sigma = phases["sigmas"][n, k]
U = dec.M(n, sigma, delta, m) @ U
for j in range(m):
zeta = phases["zetas"][j]
U = dec.P(j, zeta, m) @ U
return U
class TestTriangularCompactDecomposition:
"""Tests for linear interferometer decomposition into rectangular grid of
phase-shifters and pairs of symmetric beamsplitters"""
def test_unitary_validation(self):
"""Test that an exception is raised if not unitary"""
A = np.random.random([5, 5]) + 1j * np.random.random([5, 5])
with pytest.raises(ValueError, match="The input matrix is not unitary"):
dec.triangular_compact(A)
@pytest.mark.parametrize(
"U",
[
pytest.param(np.identity(2), id="identity2"),
pytest.param(np.identity(2)[::-1], id="antiidentity2"),
pytest.param(haar_measure(2), id="random2"),
pytest.param(np.identity(4), id="identity4"),
pytest.param( | np.identity(4) | numpy.identity |
'''
Module with a class to create a generator for low-frequency images.
'''
# System imports
import time
# Standard imports
import numpy as np
import matplotlib.pyplot as plt
import itertools
class LowFreqGenerator(object):
'''
A class to create a generator of low-frequency images.
'''
def __init__(self, batch_size=128, N=4, im_size=64, discounting=1, constant_components=False):
'''
Constructor
'''
self.N = N
self.im_size = im_size
self.batch_size = batch_size
# array with discretized Fourier eigenfunctions
self._base = np.zeros(shape=(im_size, im_size, 2 * N + 1, 2 * N + 1), dtype=np.complex64)
# Create Fourier coefficients
if constant_components:
self._fourier_components = get_constant_fourier_components(N)
else:
self._fourier_components = get_normal_fourier_components(N, discounting)
# array with discretized Fourier eigenfunctions premultiplied with Fourier coefficients
self._base_multiplied = np.zeros(shape=(im_size, im_size, 2 * N + 1, 2 * N + 1), dtype=np.complex64)
self._set_base()
def set_fourier_components(self, fourier_components):
assert fourier_components.shape[0] == fourier_components.shape[1], "Not square matrix for Fourier components"
assert fourier_components.shape[0] == 2 * self.N + 1, "Not adequate number of components"
self._fourier_components = fourier_components
self._set_base()
def _set_base(self):
""" Precompute the base arrays, with discretized Fourier eigenfunctions.
"""
im_size = self.im_size
N = self.N
self._base = np.zeros(shape=(2 * N + 1, 2 * N + 1, im_size, im_size), dtype=np.complex64)
_fourier_components_reshaped = np.reshape(self._fourier_components, newshape=(2 * N + 1, 2 * N + 1, 1, 1))
for m in range(-N, N + 1):
for n in range(-N, N + 1):
for k in range(im_size):
for l in range(im_size):
self._base[m, n, k, l] = np.exp(2 * m * 1j * np.pi * (k / im_size) \
+ 2 * n * 1j * np.pi * (l / im_size))
self._base_multiplied = self._base * _fourier_components_reshaped
def get_shift_multipliers(self):
"""Get 3darray with batch of matrices with Fourier coefficients for translation.
"""
N = self.N
# Create random shifts
shifts = np.random.uniform(size=(self.batch_size, 2))
#
shift_multipliers = np.ones(shape=(self.batch_size, 2 * N + 1, 2 * N + 1), dtype=np.complex64)
# This part of the code is probably quite slow
for batch in range(self.batch_size):
for m in range(-N, N + 1):
for n in range(-N, N + 1):
shift_x = shifts[batch, 0]
shift_y = shifts[batch, 1]
shift_multipliers[batch, m, n] = \
np.exp(- 2 * m * np.pi * (1j) * shift_x - 2 * n * np.pi * (1j) * shift_y)
return shift_multipliers, shifts
def get_regular_multipliers(self):
"""Get 3darray with batch of matrices with Fourier coefficients for translation not random.
"""
N = self.N
# Create random shifts
shifts = np.linspace(0,1, self.batch_size)
product_shifts = np.array(list(itertools.product(shifts,shifts)))
# Generate the squared number of shifted images
shift_multipliers = np.ones(shape=(self.batch_size**2, 2 * N + 1, 2 * N + 1), dtype=np.complex64)
# This part of the code is probably quite slow
for combination in range(len(product_shifts)):
for m in range(-N, N + 1):
for n in range(-N, N + 1):
shift_x = product_shifts[combination,0]
shift_y = product_shifts[combination,1]
shift_multipliers[combination, m, n] = \
np.exp(- 2 * m * np.pi * (1j) * shift_x - 2 * n * np.pi * (1j) * shift_y)
return shift_multipliers, product_shifts
def generate(self):
while True:
shift_multipliers, _ = self.get_shift_multipliers()
result = np.tensordot(shift_multipliers, self._base_multiplied, axes=((1, 2), (0, 1)))
reshaped = result.real.reshape([-1, self.im_size ** 2])
normalized = reshaped / np.amax(np.abs(reshaped))
yield (normalized, normalized)
def generate_shifts(self):
while True:
shift_multipliers, shifts = self.get_shift_multipliers()
result = np.tensordot(shift_multipliers, self._base_multiplied, axes=((1, 2), (0, 1)))
reshaped = result.real.reshape([-1, self.im_size ** 2])
normalized = reshaped / np.amax(np.abs(reshaped))
yield (normalized, shifts)
def generate_regular_shifts(self):
while True:
shift_multipliers, shifts = self.get_regular_multipliers()
result = np.tensordot(shift_multipliers, self._base_multiplied, axes=((1, 2), (0, 1)))
reshaped = result.real.reshape([-1, self.im_size ** 2])
normalized = reshaped / np.amax(np.abs(reshaped))
yield (normalized, shifts)
def get_normal_fourier_components(N, discounting=1):
_fourier_components = np.random.normal(size=(2 * N + 1, 2 * N + 1)) \
+ 1j * | np.random.normal(size=(2 * N + 1, 2 * N + 1)) | numpy.random.normal |
import random
import numpy as np
import matplotlib.pyplot as plt
from copy import deepcopy
# gaussian & polynomial kernel SVM
class SVM_Kernel:
def __init__(self, dataset, dataset_target, kernel=None):
# dataet parameters
self.dataset = deepcopy(dataset)
self.dataset_target = self.__process_dataset_target(deepcopy(dataset_target))
self.kernel = kernel
# gaussian kernel parameters
self.weight = None
self.wrt_range = [0, 1]
self.wrt_seed = 2
self.lama = np.array(self.dataset)
self.sigma = None
# polynomial kernal parameters
self.degree = 2
self.bias = 0
# store misclassification dataset
self.misclassification = [[], []]
def __process_dataset_target(self, dataset_target):
for index in range(len(dataset_target)):
if dataset_target[index] == 0:
dataset_target[index] = -1
else:
continue
return dataset_target
## generate random weight w0,w1,w2,w3.....
def generate_weight(self, num_attr, seed=2):
random.seed(seed)
wt_array = []
for i in range(num_attr):
wt_array.append(random.uniform(self.wrt_range[0], self.wrt_range[1]))
return np.array(wt_array)
# generate gaussian features
def __gaussian_feature_make(self, dataset, lama, sigma, round_limit=5):
feature = []
for val in dataset:
feature.append([round(self.__gaussian_kernel(val, sig, sigma), round_limit) for sig in lama])
feature[-1].insert(0, 1)
return feature
# gaussian_kernel func
def __gaussian_kernel(self, x_ipt, lama_single, sigma):
prob = np.exp(-(np.linalg.norm(abs(x_ipt - lama_single))) ** 2 / (2 * sigma ** 2))
return prob
## polynomial_kernel func
def __poly_kernel(self, x_ipt, lama_single, degree=2, bias=0):
poly_val = (np.dot(x_ipt, lama_single) + bias) ** degree
return poly_val
## generate poly features
def __poly_feature_make(self, dt_train, lama, degree=2, bias=0):
feature = []
for val in dt_train:
feature.append([self.__poly_kernel(val, sig, degree, bias) for sig in lama])
feature[-1].insert(0, 1)
return feature
# train SVM model
def train(self, C=1, sigma=0.5, degree=2, bias=0, stp=1, epoch_limit=1000, stp_limit=1e-300, stp_show=True,
plot=False):
epoch = 0
hinge_loss_all = 0
reg_val = 1 / C
self.sigma = sigma
epoch_plt = []
hinge_loss_plt = []
if self.kernel == 'gaussian':
features = self.__gaussian_feature_make(self.dataset, self.lama, self.sigma, round_limit=5)
self.weight = self.generate_weight(len(features[0]), self.wrt_seed)
elif self.kernel == 'polynomial':
features = self.__poly_feature_make(self.dataset, self.lama, self.degree, self.bias)
self.weight = self.generate_weight(len(features[0]), self.wrt_seed)
else:
raise NotImplementedError('Kernel cannot be empty...')
return -1
while epoch <= epoch_limit:
hinge_loss = []
epoch_plt.append(epoch)
hinge_loss_last = hinge_loss_all
for index in range(len(features)):
r = np.dot(features[index], self.weight) * self.dataset_target[index]
if r >= 1:
hinge_loss.append(0)
self.weight = self.weight - stp * reg_val * self.weight
else:
hinge_loss.append(1 - r)
self.weight = self.weight + stp * (
self.dataset_target[index] * np.array(features[index]) - reg_val * self.weight)
hinge_loss_all = sum(hinge_loss)
hinge_loss_plt.append(hinge_loss_all)
if abs(hinge_loss_last - hinge_loss_all) <= 0.1:
stp = stp * 0.1
if stp <= stp_limit:
break
epoch += 1
if stp_show:
print('epoch:', epoch, ',hinge_loss:', round(hinge_loss_all, 5), ',step: ', stp)
if plot:
# plot hinge loss
plt.plot(epoch_plt, hinge_loss_plt)
plt.title('hinge loss vs epochs')
plt.xlabel('epochs')
plt.ylabel('hingle loss')
plt.grid()
plt.show()
# test SVM model
def score(self, dataset, dataset_target):
dataset_target = self.__process_dataset_target(deepcopy(dataset_target))
if self.kernel is 'gaussian':
features = self.__gaussian_feature_make(dataset, self.lama, self.sigma, round_limit=5)
elif self.kernel is 'polynomial':
features = self.__poly_feature_make(dataset, self.lama, self.degree, self.bias)
error = 0
for index in range(len(features)):
r = np.dot(features[index], self.weight) * dataset_target[index]
if r >= 0:
continue
else:
self.misclassification[0].append(dataset[index])
self.misclassification[1].append(dataset_target[index])
error += 1
error_rate = error / len(features)
return (1 - error_rate)
# classify newdataset
def classify_ensemble(self, single_data):
dataset = [deepcopy(single_data)]
if self.kernel is 'gaussian':
features = self.__gaussian_feature_make(dataset, self.lama, self.sigma, round_limit=5)
elif self.kernel is 'polynomial':
features = self.__poly_feature_make(dataset, self.lama, self.degree, self.bias)
r = np.dot(features[0], self.weight)
return 1 if r >= 0 else 0
# linear SVM
class SVM_Linear:
def __init__(self, dataset, dataset_target):
# dataet parameters
self.dataset = self.__process_dataset(deepcopy(dataset))
self.dataset_target = self.__process_dataset_target(deepcopy(dataset_target))
self.kernel = 'linear'
# weight parameters
self.wrt_range = [0, 1]
self.wrt_seed = 2
self.weight = self.__generate_weight(len(self.dataset[0]), self.wrt_seed)
# store misclassification dataset
self.misclassification = [[], []]
def __process_dataset(self, dataset):
for index in range(len(dataset)):
dataset[index].append(1)
return dataset
def __process_dataset_target(self, dataset_target):
for index in range(len(dataset_target)):
if dataset_target[index] == 0:
dataset_target[index] = -1
else:
continue
return dataset_target
# generate random weight w0,w1,w2,w3.....
def __generate_weight(self, num_attr, seed=2):
random.seed(seed)
wt_array = []
for i in range(num_attr):
wt_array.append(random.uniform(self.wrt_range[0], self.wrt_range[1]))
return np.array(wt_array)
# train SVM model
def train(self, C=1, stp=1, epoch_limit=1000, stp_limit=1e-100, stp_show=True, plot=False):
epoch = 0
hinge_loss_all = 0
reg_val = 1 / C
epoch_plt = []
hinge_loss_plt = []
while epoch <= epoch_limit:
hinge_loss = []
epoch_plt.append(epoch)
hinge_loss_last = hinge_loss_all
for index in range(len(self.dataset)):
r = np.dot(self.dataset[index], self.weight) * self.dataset_target[index]
if r >= 1:
hinge_loss.append(0)
self.weight = self.weight - stp * reg_val * self.weight
else:
hinge_loss.append(1 - r)
self.weight = self.weight + stp * (
self.dataset_target[index] * np.array(self.dataset[index]) - reg_val * self.weight)
hinge_loss_all = sum(hinge_loss)
hinge_loss_plt.append(hinge_loss_all)
if abs(hinge_loss_last - hinge_loss_all) <= 0.1:
stp = stp * 0.1
if stp <= stp_limit:
break
epoch += 1
if stp_show:
print('epoch:', epoch, ',hinge_loss:', round(hinge_loss_all, 5), ',step: ', stp)
if plot:
# plot hinge loss
plt.plot(epoch_plt, hinge_loss_plt)
plt.title('hinge loss vs epochs')
plt.xlabel('epochs')
plt.ylabel('hingle loss')
plt.grid()
plt.show()
# test SVM model
def score(self, dataset, dataset_target):
dataset_target = self.__process_dataset_target(deepcopy(dataset_target))
dataset = self.__process_dataset(deepcopy(dataset))
error = 0
for index in range(len(dataset)):
r = np.dot(dataset[index], self.weight) * dataset_target[index]
if r >= 0:
continue
else:
self.misclassification[0].append(dataset[index])
self.misclassification[1].append(dataset_target[index])
error += 1
error_rate = error / len(dataset)
return (1 - error_rate)
# classify newdataset
def classify(self, single_data):
dataset = [deepcopy(single_data)]
processed_dataset = self.__process_dataset(dataset)
r = | np.dot(processed_dataset, self.weight) | numpy.dot |
"""
@author: <NAME> (University of Sydney)
-------------------------------------------------------------------------
AMICAL: Aperture Masking Interferometry Calibration and Analysis Library
-------------------------------------------------------------------------
Matched filter pipeline method.
All AMI related function, the most important are:
- make_mf: compute splodge positions for a given mask,
- tri_pix: compute unique closing triangle for a given splodge.
--------------------------------------------------------------------
"""
import os
from pathlib import Path
import numpy as np
from matplotlib import pyplot as plt
from munch import munchify as dict2class
from termcolor import cprint
from amical.dpfit import leastsqFit
from amical.get_infos_obs import get_mask
from amical.get_infos_obs import get_pixel_size
from amical.get_infos_obs import get_wavelength
from amical.mf_pipeline.idl_function import array_coords
from amical.mf_pipeline.idl_function import dist
from amical.tools import gauss_2d_asym
from amical.tools import linear
from amical.tools import norm_max
from amical.tools import plot_circle
def _plot_mask_coord(xy_coords, maskname, instrument):
if instrument == "NIRISS":
marker = "H"
D = 6.5
else:
D = 8.0
marker = "o"
fig = plt.figure(figsize=(6, 5.5))
plt.title(f"{instrument} - mask {maskname}", fontsize=14)
for i in range(xy_coords.shape[0]):
plt.scatter(
xy_coords[i][0],
xy_coords[i][1],
s=1e2,
c="None",
edgecolors="navy",
marker=marker,
)
plt.text(xy_coords[i][0] + 0.1, xy_coords[i][1] + 0.1, i)
plt.xlabel("Aperture x-coordinate [m]", fontsize=12)
plt.ylabel("Aperture y-coordinate [m]", fontsize=12)
plt.axis([-D / 2.0, D / 2.0, -D / 2.0, D / 2.0])
plt.tight_layout()
return fig
def _compute_uv_coord(
xy_coords, index_mask, filt, pixelSize, npix, round_uv_to_pixel=False
):
"""Compute the expected u-v coordinated on the detector. If `round_uv_to_pixel`
is True, the closest integer position is used."""
n_baselines = index_mask.n_baselines
bl2h_ix = index_mask.bl2h_ix
u_real = | np.zeros(n_baselines) | numpy.zeros |
from numpy.testing import assert_equal
import numpy as np
import skvideo.io
import skvideo.datasets
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
def _vreader(backend):
reader = skvideo.io.vreader(skvideo.datasets.bigbuckbunny(), backend=backend)
T = 0
M = 0
N = 0
C = 0
accumulation = 0
for frame in reader:
M, N, C = frame.shape
accumulation += np.sum(frame)
T += 1
# check the dimensions of the video
assert_equal(T, 132)
assert_equal(M, 720)
assert_equal(N, 1280)
assert_equal(C, 3)
# check the numbers
assert_equal(109.28332841215979, accumulation / (T * M * N * C))
@unittest.skipIf(not skvideo._HAS_FFMPEG, "FFmpeg required for this test.")
def test_vreader_ffmpeg():
_vreader("ffmpeg")
@unittest.skipIf(not skvideo._HAS_AVCONV, "LibAV required for this test.")
def test_vreader_libav_version12():
try:
if | np.int(skvideo._LIBAV_MAJOR_VERSION) | numpy.int |
# Copyright 2017 The TensorFlow Lattice Authors.
#
# 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.
# ==============================================================================
"""Collection of test datasets."""
import math
# Dependency imports
import numpy as np
from tensorflow.python.estimator.inputs import numpy_io
_NUM_EXAMPLES = 10000
_BATCH_SIZE = 100
_NUM_EPOCHS = 1
class TestData(object):
"""A test dataset class."""
def __init__(self,
num_examples=_NUM_EXAMPLES,
batch_size=_BATCH_SIZE,
num_epochs=_NUM_EPOCHS):
self.num_examples = num_examples
self.batch_size = batch_size
self.num_epochs = num_epochs
# Collection of transformations that generates the label, y.
def _f(self, x):
return np.power(x, 3) + 0.1 * np.sin(x * math.pi * 8)
def _g(self, x0, x1):
return self._f(x0) + 0.3 * (1.0 - np.square(x1))
def _h(self, x0, x1):
radius2 = (x0 * x0 + x1 * x1)
max_radius2 = 0.25
return radius2 < max_radius2
def _i(self, x0, x1, x2):
return self._g(x0, x1) + np.choose(x2.astype(int) + 1, [11., 7., 13.])
def oned_input_fn(self):
"""Returns an input function for one dimensional learning task.
column 'x' is a feature column, and column 'y' is a label column.
The transformation is deterministic, where y = _f(x).
Returns:
Function, that has signature of ()->({'x': data}, `target`)
FutureWork: Make this use keypoints_initialization from quantiles.
"""
x = np.random.uniform(-1.0, 1.0, size=self.num_examples)
y = self._f(x)
return numpy_io.numpy_input_fn(
x={'x': x},
y=y,
batch_size=self.batch_size,
num_epochs=self.num_epochs,
shuffle=False)
def oned_zero_weight_input_fn(self):
"""Returns an input function for one dimensional learning task.
column 'x' is a feature column, column 'zero' is a numerical column that
contains zero values and column 'y' is a label column.
The transformation is deterministic, where y = _f(x).
Returns:
Function, that has signature of ()->({'x': data, 'zero': zeros}, `target`)
"""
x = np.random.uniform(-1.0, 1.0, size=self.num_examples)
zeros = np.zeros(shape=(self.num_examples))
y = self._f(x)
return numpy_io.numpy_input_fn(
x={
'x': x,
'zero': zeros
},
y=y,
batch_size=self.batch_size,
num_epochs=self.num_epochs,
shuffle=False)
def twod_input_fn(self):
"""Returns an input function for two dimensional learning task.
column 'x0' and 'x1' are feature columns, and column 'y' is a label column.
The transformation is deterministic, where y = _g(x0, x1).
Returns:
Function, that has signature of ()->({'x0': data, 'x1': data}, `target`)
"""
x0 = np.random.uniform(-1.0, 1.0, size=self.num_examples)
x1 = np.random.uniform(-1.0, 1.0, size=self.num_examples)
y = self._g(x0, x1)
return numpy_io.numpy_input_fn(
x={'x0': x0,
'x1': x1},
y=y,
batch_size=self.batch_size,
num_epochs=self.num_epochs,
shuffle=False)
def twod_classificer_input_fn(self):
"""Returns an input function for two dimensional classification task.
column 'x0' and 'x1' are feature columns, and column 'y' is a label column.
The transformation is deterministic, where y = _h(x0, x1).
Returns:
Function, that has signature of ()->({'x0': data, 'x1': data}, `target`)
"""
x0 = np.random.uniform(-1.0, 1.0, size=self.num_examples)
x1 = np.random.uniform(-1.0, 1.0, size=self.num_examples)
y = np.vectorize(self._h)(x0, x1)
return numpy_io.numpy_input_fn(
x={'x0': x0,
'x1': x1},
y=y,
batch_size=self.batch_size,
num_epochs=self.num_epochs,
shuffle=False)
def threed_input_fn(self, full_data, num_epochs=None):
"""Returns an input function for three-dimensional learning task.
'x0' and 'x1' are numeric, and 'x2' is categorical with values {-1, 0, 1}.
The transformation is deterministic and decomposable on the inputs,
that is y = _i(x0, x1, x2) = _i_0(x0)+_i_1(x1)+_i_2(x2).
Args:
full_data: if set to true the whole data is returned in one batch.
num_epochs: number of epochs to go over the data. Takes default used
in construction if not set.
Returns:
Function, that has signature of
()->({'x0': data, 'x1': data, 'x2': data}, `target`)
"""
x0 = np.random.uniform(-1.0, 1.0, size=self.num_examples)
x1 = | np.random.uniform(-1.0, 1.0, size=self.num_examples) | numpy.random.uniform |
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import cv2 as cv
from PIL import Image
import cityscapes_labels
def get_palette():
# get train id to color mappings from file
trainId2colors = {label.trainId: label.color for label in cityscapes_labels.labels}
# prepare and return palette
palette = [0] * 256 * 3
for trainId in trainId2colors:
colors = trainId2colors[trainId]
if trainId == 255:
colors = (0, 0, 0)
for i in range(3):
palette[trainId * 3 + i] = colors[i]
return palette
def colorize(labels):
# generate colorized image from output labels and color palette
result_img = Image.fromarray(labels).convert('P')
result_img.putpalette(get_palette())
return np.array(result_img.convert('RGB'))
def postprocess(labels,img_shape,result_shape):
'''
Postprocessing function for DUC
input : output labels from the network as numpy array, input image shape, desired output image shape
output : confidence score, segmented image, blended image, raw segmentation labels
'''
ds_rate = 8
label_num = 19
cell_width = 2
img_height,img_width = img_shape
result_height,result_width = result_shape
# re-arrange output
test_width = int((int(img_width) / ds_rate) * ds_rate)
test_height = int((int(img_height) / ds_rate) * ds_rate)
feat_width = int(test_width / ds_rate)
feat_height = int(test_height / ds_rate)
labels = labels.reshape((label_num, 4, 4, feat_height, feat_width))
labels = np.transpose(labels, (0, 3, 1, 4, 2))
labels = labels.reshape((label_num, int(test_height / cell_width), int(test_width / cell_width)))
labels = labels[:, :int(img_height / cell_width),:int(img_width / cell_width)]
labels = np.transpose(labels, [1, 2, 0])
labels = cv.resize(labels, (result_width, result_height), interpolation=cv.INTER_LINEAR)
labels = np.transpose(labels, [2, 0, 1])
# get softmax output
softmax = labels
# get classification labels
results = | np.argmax(labels, axis=0) | numpy.argmax |
from abc import ABCMeta
import awkward
import numpy as np
from nnalgs.base.LMDBCreator import BaseLMDBCreator
from nnalgs.utils.Math import combine_mean_std
class DecayModeLMDBCreator(BaseLMDBCreator, metaclass=ABCMeta):
"""
Class for decay mode classification LMDB database creators
"""
def __init__(self, sel_vars, data, n_steps, dtype, log_vars, atan_vars, **kwargs):
"""
:param sel_vars: a list of the variables for selection (e.g. TauJet variables)
:param data: a dict of all the inputs and outputs variables for each input branch
:param n_steps: a dict of the maximum time steps to be stored for each input branch
:param dtype: a dict of NumPy dtype to be stored for each input branch
:param trans: boolean, do pre-processing or not
:param kwargs: common arguments for base class
"""
self.sel_vars = sel_vars
self.data = data
self.n_steps = n_steps
self.dtype = dtype
self.log_vars = log_vars
self.atan_vars = atan_vars
super().__init__(**kwargs)
def _loop_create_chunk(self, chunk):
entry_start, entry_stop = chunk
# do selection (train, test split based on mc event number, 2020/03/24 -> full set training)
self._logger.debug(f" - Chunk here is: {entry_start} ~ {entry_stop}")
df_sel = self._root_tree.pandas.df(self.sel_vars, entrystart=entry_start, entrystop=entry_stop)
# 2020/03/24 -> nothing
removed_indices = self._get_removed_indices(df=df_sel)
counter_here = self._counter
# loop over each branch: Label, PFOs, Track, ...
for name, vars in self.data.items():
self._logger.debug(f" - Branch here is: {name}")
# Overall counter! Till the end!
self._counter = counter_here
df = self._root_tree.pandas.df(vars, entrystart=entry_start, entrystop=entry_stop, flatten=False)
# apply selection based on indices
df.drop(removed_indices, inplace=True)
df.reset_index(drop=True, inplace=True)
# Label shape is easy to deal with
if name == "Label" or name == "Weight":
assert len(vars) == 1
arr = np.asarray(df, dtype=self.dtype[name])
arr = arr.reshape(len(arr))
# Some variables added for testing purpose
elif name == "Inspector":
arr = np.zeros((len(df), len(self.data[name])), dtype=self.dtype[name])
for i, var in enumerate(self.data[name]):
arr[:, i] = np.asarray(df[var], dtype=self.dtype[name])
# In this case, all others are 3-D sequences
else:
# get array
longest = max([len(a) for a in df[vars[0]]]) # take the first variable as reference
list_here = list()
for rec in df.to_records():
# index = rec[0]
list_vars = [rec[i + 1] for i in range(len(vars))]
vars_data = np.asarray(list_vars, dtype=self.dtype[name]).transpose()
len_seq = vars_data.shape[0]
# zero padding of sequence (to save everything in one NumPy array)
vars_data = np.pad(vars_data, ((0, longest - len_seq), (0, 0)), 'constant')
list_here.append(vars_data)
arr = np.asarray(list_here, dtype=self.dtype[name])
for index, var in enumerate(vars):
arr[:, :, index] = self._preprocessing_decaymode(var, arr[:, :, index])
# NOTE: should we save as much as possible and then having room to tune the seq max_len?
if self.n_steps[name] < longest:
arr = arr[:, :self.n_steps[name], :]
if self.n_steps[name] > longest:
self._logger.warning(
f"required number of objects {self.n_steps[name]} is more than the actual "
f"maximum number of objects {longest}, will NOT fill with zeros!!!"
)
# if still want this feature, uncomment the line below
arr = np.pad(arr, ((0, 0), (0, self.n_steps[name] - longest), (0, 0)))
# do some testing here if you want
self._logger.debug(arr[:3])
self._logger.debug(arr.shape)
# write the cache into database
# like this {"NeutralPFO-019961013": array([1,2,3, ..., batch_size])}
for i in range(arr.shape[0]):
if name != "Label" and name != "Weight" and arr[i].shape != (self.n_steps[name], len(vars)):
self._logger.warning("{}-{:09d} has unexpected shape {}! This might cause crash at training time!".format(name, self._counter, arr[i].shape))
key = "{}-{:09d}".format(name, self._counter)
self._cache[key] = arr[i].copy(order='C') # C
if i % 1000 == 0:
self._write_cache()
self._logger.debug(f" - Cache --> counter={self._counter}, i={i} is written")
self._counter += 1
def _loop_preproc_chunk(self, chunk):
"""
The pre-processing strategy is evaluated on full samples.
No selection is required (yet not implemented)
"""
entry_start, entry_stop = chunk
for name, fts in self.data.items():
# Skip Label ...
if name == "Label" or name == "Weight":
continue
# loop over fts -> features of each branch
for ft in fts:
# in this case, i.e. multi-obj in a tau, uproot will return a JaggedArray via awkward package
array: awkward.JaggedArray = self._root_tree.array(ft, entrystart=entry_start, entrystop=entry_stop)
# now point array to the flatten NumPy array
array: np.ndarray = array.flatten()
# check log and ATan transformation
ft, array = self._atan_tans(ft, array)
# Maybe don't need to use the same dtype (-_-)
array.flatten().dtype = self.dtype[name] # <- np.float32 ...
# approximation of mean and std, for the scale and offset in pre-processing
size_here, mean_here, std_here = entry_stop - entry_start, array.mean(), array.std()
# If it is not the first chunk
if ft in self._preproc and set(self._preproc[ft].keys()) == {"size", "mean", "std"}:
l_n = [self._preproc[ft]["size"], size_here]
l_mean = [self._preproc[ft]["mean"], mean_here]
l_std = [self._preproc[ft]["std"], std_here]
# a useful function which can combine a list of samples
size_here, mean_here, std_here = combine_mean_std(l_n, l_mean, l_std)
self._preproc[ft] = dict(size=size_here, mean=mean_here, std=std_here)
self._logger.debug(self._preproc, "\n")
def _save_to_json(self):
for name, fts in self.data.items():
if name == "Label" or name == "Weight":
continue
d_fts = {'name': name, 'variables': []}
for ft, stat in self._preproc.items():
if name in ft:
# prior knowledge -> self._preproc is consistent with self._variables
if ft.endswith(".phi"):
self._preproc[ft]["mean"], self._preproc[ft]["std"] = 0.0, 0.5 * 3.1415926
elif ft.endswith(".eta"):
self._preproc[ft]["mean"], self._preproc[ft]["std"] = 0.0, 0.5 * 2.5000000
elif ft.endswith(".dphi") or ft.endswith(".deta"):
self._preproc[ft]["mean"] = 0.0
elif ft.endswith(".dphiECal") or ft.endswith(".detaECal"):
self._preproc[ft]["mean"] = 0.0
elif "rnn_" in ft and ft.endswith("Score"):
self._preproc[ft]["mean"], self._preproc[ft]["std"] = 0.0, 0.5
# no prior knowledge
else:
pass
d_fts['variables'].append(
dict(name=ft.split('.')[-1], offset=float(-1 * stat["mean"]), scale=float(0.5 / stat["std"])))
self._variables.append(d_fts)
outputs = [
{
'name': 'classes',
'labels': ['c_1p0n', 'c_1p1n', 'c_1pXn', 'c_3p0n', 'c_3pXn']
}
]
final_dict = {
'input_sequences': self._variables,
'inputs': [],
'outputs': outputs
}
# Saving
self._write_json(final_dict)
def _get_removed_indices(self, df):
"""
The performance is not as bad as i looks like...
:param df: pandas.DataFrame
:return: list of indices
For cross validation, one can change the remainer = 0, 1, 2, 3, 5 (5-fold)
"""
if self.mode == 'Train':
removed_indices = df[(df["TauJets.truthDecayMode"] > 4) | (df["TauJets.mcEventNumber"] % 5 == 0) | (df["TauJets.mcEventNumber"] % 5 == 1)].index # 3/5 of all
elif self.mode == 'Validation':
removed_indices = df[(df["TauJets.truthDecayMode"] > 4) | (df["TauJets.mcEventNumber"] % 5 != 0)].index # 1/5 of all
elif self.mode == 'Test':
removed_indices = df[(df["TauJets.truthDecayMode"] > 4) | (df["TauJets.mcEventNumber"] % 5 != 1)].index # 1/5 of all, for plotting in Loki
else:
raise ValueError(f"Cannot set type as {self.mode}")
return removed_indices
def _preprocessing_decaymode(self, ft, arr):
"""
Pre-process array at creation time
:param ft: feature name
:param arr: numpy.ndarray
:return: pre-processed numpy.ndarray
"""
preproc = self._read_json()
# NOTE: arrays here are padded with zeros (!)
masked = np.ma.masked_equal(arr, 0)
# Naming is consistent with those in self._preproc
ft, masked = self._atan_tans(ft, masked)
offset, scale = preproc[ft]["mean"], 0.5 / preproc[ft]["std"]
masked = np.multiply(np.subtract(masked, offset), scale)
return masked.filled(0)
def _atan_tans(self, ft, arr):
"""check log and atan transformation"""
if ft in self.log_vars.keys():
arr = np.log10( | np.maximum(arr, self.log_vars[ft]) | numpy.maximum |
# -*- coding: utf-8 -*-
u"""SILAS execution template.
:copyright: Copyright (c) 2020 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern import pkio
from pykern import pkjson
from pykern.pkcollections import PKDict
from pykern.pkdebug import pkdp, pkdc, pkdlog
from scipy import constants
from sirepo import simulation_db
from sirepo.template import template_common
import csv
import h5py
import math
import numpy as np
import re
import sirepo.sim_data
_SIM_DATA, SIM_TYPE, _SCHEMA = sirepo.sim_data.template_globals()
_CRYSTAL_CSV_FILE = 'crystal.csv'
_SUMMARY_CSV_FILE = 'wavefront.csv'
_INITIAL_LASER_FILE = 'initial-laser.npy'
_FINAL_LASER_FILE = 'final-laser.npy'
def background_percent_complete(report, run_dir, is_running):
data = simulation_db.read_json(run_dir.join(template_common.INPUT_BASE_NAME))
res = PKDict(
percentComplete=0,
frameCount=0,
)
if report == 'animation':
line = template_common.read_last_csv_line(run_dir.join(_SUMMARY_CSV_FILE))
m = re.search(r'^(\d+)', line)
if m and int(m.group(1)) > 0:
res.frameCount = int((int(m.group(1)) + 1) / 2)
res.wavefrontsFrameCount = _counts_for_beamline(res.frameCount, data.models.beamline)[0]
total_count = _total_frame_count(data)
res.percentComplete = res.frameCount * 100 / total_count
return res
assert report == 'crystalAnimation'
count = 0
path = run_dir.join(_CRYSTAL_CSV_FILE)
if path.exists():
with pkio.open_text(str(path)) as f:
for line in f:
count += 1
# first two lines are axis points
if count > 2:
plot_count = int((count - 2) / 2)
res.frameCount = plot_count
res.percentComplete = plot_count * 100 / (1 + data.models.crystalSettings.steps / data.models.crystalSettings.plotInterval)
return res
def post_execution_processing(success_exit=True, run_dir=None, **kwargs):
if success_exit:
return None
return _parse_silas_log(run_dir)
def get_data_file(run_dir, model, frame, options=None, **kwargs):
if model in ('laserPulseAnimation', 'laserPulse2Animation'):
return _INITIAL_LASER_FILE
if model in ('laserPulse3Animation', 'laserPulse4Animation'):
return _FINAL_LASER_FILE
if model == 'wavefrontSummaryAnimation':
return _SUMMARY_CSV_FILE
if 'wavefrontAnimation' in model:
sim_in = simulation_db.read_json(run_dir.join(template_common.INPUT_BASE_NAME))
return _wavefront_filename_for_index(
sim_in,
sim_in.models[model].id,
frame,
)
if 'plotAnimation' in model:
return _CRYSTAL_CSV_FILE
if model == 'crystal3dAnimation':
return 'intensity.npy'
raise AssertionError('unknown model={}'.format(model))
def python_source_for_model(data, model):
if model in ('crystal3dAnimation', 'plotAnimation', 'plot2Animation'):
data.report = 'crystalAnimation'
else:
data.report = 'animation'
return _generate_parameters_file(data)
def sim_frame(frame_args):
filename = _wavefront_filename_for_index(
frame_args.sim_in,
frame_args.id,
frame_args.frameIndex,
)
with h5py.File(filename, 'r') as f:
wfr = f['wfr']
points = np.array(wfr)
return PKDict(
title='S={}m (E={} eV)'.format(
_format_float(wfr.attrs['pos']),
frame_args.sim_in.models.gaussianBeam.photonEnergy,
),
subtitle='',
x_range=[wfr.attrs['xStart'], wfr.attrs['xFin'], len(points[0])],
x_label='Horizontal Position [m]',
y_range=[wfr.attrs['yStart'], wfr.attrs['yFin'], len(points)],
y_label='Vertical Position [m]',
z_matrix=points.tolist(),
summaryData=_summary_data(frame_args),
)
def sim_frame_crystal3dAnimation(frame_args):
intensity = np.load('intensity.npy')
return PKDict(
title=' ',
indices=np.load('indices.npy').flatten().tolist(),
vertices=np.load('vertices.npy').flatten().tolist(),
intensity=intensity.tolist(),
intensity_range=[ | np.min(intensity) | numpy.min |
import numpy as np
import scipy.interpolate
from netCDF4 import Dataset
import pdb
class Data3d:
"""basic data element that contains a 3D (plevs/lat/lon) data field"""
def __init__(self,array3d=[],lon=[],lat=[],plevs=[],time=[],minv=-9e9):
"""Data3d(array[time,plevs,lat,lon], lon, lat, plevs, time,minv): 3D data field object time is optional.
Values less than minv are masked."""
# if called w/ no parameters
if np.size(array3d) == 0:
self.data=[];self.lon=[]
self.lat=[];self.time=[]
self.plevs=[]
return
if len(np.shape(array3d)) == 2:
array3d=np.reshape(array3d,(1,1,len(lat),len(lon)))
if len(np.shape(array3d)) == 3:
if len(time) > 0 and len(plevs) == 0:
array3d=np.reshape(array3d,(len(time),1,len(lat),len(lon)))
if len(time) == 0 and len(plevs) > 0:
array3d=np.reshape(array3d,(1,len(plevs),len(lat),len(lon)))
if len(time) == 0 and len(plevs) == 0:
array3d=np.reshape(array3d,(1,1,len(lat),len(lon)))
if len(np.shape(array3d)) != 4:
raise TypeError("requires 3D or 4D input data")
s1=np.shape(array3d)
if len(plevs) > 0 and len(plevs) != s1[1]:
raise TypeError("pressure mis-match")
if len(lat) != s1[2]:
raise TypeError("longitude mis-match")
if len(lon) != s1[3]:
raise TypeError("latitude mis-match")
# reverse latitudes if descending
if lat[0] > lat[1]:
s1=np.shape(array3d)
for num in range(s1[0]):
for num2 in range(s1[1]):
x1=np.ma.copy(array3d[num,num2,])
x1=np.flipud(x1)
array3d[num,num2,]=x1
lat=np.flipud(lat)
# convert -180-180 to 0-360 longitudes
if min(lon) < -50:
x1=len(lon)/2
lon=np.concatenate( (lon[x1:],lon[0:x1]+360) )
array3d=np.ma.concatenate( (array3d[:,:,:,x1:],array3d[:,:,:,0:x1]), axis=3 )
array3d=np.ma.array(array3d) # mask bad values
np.ma.masked_where(array3d < minv,array3d,copy=False)
np.ma.masked_where(np.isnan(array3d),array3d,copy=False)
self.data=array3d
self.lat=np.array(lat)
self.lon=np.array(lon)
self.plevs=np.array(plevs)
self.time=np.array(time)
return
def copy(self):
"""produce a copy of the Data3d structure"""
newdata=Data3d(np.ma.copy(self.data),np.copy(self.lon),np.copy(self.lat),np.copy(self.plevs),np.copy(self.time))
return newdata
def append(self,newdata):
"""appends time slice(s) to the 3D time series"""
if np.size(self.data) == 0:
self.data=newdata.data
self.lon=newdata.lon
self.lat=newdata.lat
self.plevs=newdata.plevs
self.time=newdata.time
return
z1=np.append(self.data,newdata.data,axis=0)
self.data=z1
z2=np.append(self.time,newdata.time)
self.time=z2
return
def zonal_average(self):
"""zonal average of data"""
# NOT WORKING
xxx
return np.ma.average(self.data,axis=3)
def global_averageOLD(self,latrange=(-90,90),minv=-9e9):
"""x1.global_average( latrange=(minlat, maxlat), minv=minv )
average over latitude range"""
lat=self.lat
ind=(lat >= min(latrange)) & (lat <= max(latrange))
lat=lat[ind]
d1=self.data[:,:,ind,]
coslat = np.cos(lat*3.14159/180.)
c1=coslat.reshape(len(coslat),1)
wgt=np.zeros( (len(lat),len(self.lon)) )+c1
ga=np.ma.zeros( (max(1,len(self.time)),max(1,len(self.plevs))) )
for num in range(max(1,len(self.time))):
for pnum in range(max(1,len(self.plevs))):
d2=d1[num,pnum,]
ind2=np.ma.where(d2 <= minv)
wgt1=wgt;wgt1[ind2]=0
# ga[num,pnum]=np.ma.average(self.data[num,pnum,ind,:],weights=wgt)
ga[num,pnum]=np.ma.average(d2,weights=wgt1)
if min(np.shape(ga)) == 1:
ga=np.copy(ga.flatten())
return ga
def global_average(self,latrange=(-90,90)):
"""x1.global_average( latrange=(minlat, maxlat) )
average over latitude range"""
coslat = np.cos(self.lat*3.14159/180.)
ind=(self.lat >= min(latrange)) & (self.lat <= max(latrange))
x1=np.ma.average(self.data,axis=3)*coslat.reshape(1,1,len(coslat))
return np.squeeze(np.ma.sum(x1[:,:,ind],axis=2)/np.ma.sum(coslat[ind]))
def anomaly(self,timerange=(-9e9,9e9),minv=-9e9):
"""x1.anomaly(timerange=(mintime,maxtime))
calculate anomaly relative to a particular time span """
d1=np.ma.copy(self.data)
ind=np.where((self.time >= min(timerange)) & (self.time <= max(timerange)))[0]
indx=np.arange(len(self.time)) % 12
for ii in range(12):
xx=np.where(ii == indx)[0] # index into data
yy=np.where(ii == indx[ind])[0] # index into reference period
d1[xx,]=d1[xx,]-np.ma.average(d1[ind[yy],],axis=0)
ga=Data3d(d1,self.lon,self.lat,self.plevs,time=self.time)
return ga
def interpolate(self,newlon,newlat,newplevs=[]):
"""interpolate(newlon, newlat, newplevs)"""
newdata=np.zeros( (max(1,len(self.time)),max(1,len(self.plevs)),len(newlat),len(newlon)) )
if len(newplevs) == 0: newplevs = self.plevs
for num in range(max(1,len(self.time))):
for num2 in range(max(1,len(self.plevs))):
spl = scipy.interpolate.RectBivariateSpline(self.lat,self.lon,
self.data[num,num2,]) #,kx=1,ky=1)
n1 = spl(newlat,newlon)
newdata[num,num2,]=n1
if len(newplevs) + len(self.plevs) == 0:
return Data3d(newdata,newlon,newlat,self.plevs,self.time)
if len(newplevs) == len(self.plevs):
if max(newplevs-self.plevs) == 0:
return Data3d(newdata,newlon,newlat,self.plevs,self.time)
newdata2=np.zeros( (len(self.time),len(newplevs),len(newlat),len(newlon)) )
newp=map(np.log,newplevs)
oldp=map(np.log,self.plevs)
if np.all(np.diff(oldp) > 0): # test if plevs are increasing
for num in range(len(newlon)):
for num2 in range(len(newlat)):
for num3 in range(len(self.time)):
newdata2[num3,:,num2,num]=np.interp(newp,oldp,newdata[num3,:,num2,num])
else:
for num in range(len(newlon)): # loop for decreasing plevs
for num2 in range(len(newlat)):
for num3 in range(len(self.time)):
newdata2[num3,:,num2,num]=np.interp(newp,np.flipud(oldp),np.flipud(newdata[num3,:,num2,num]))
return Data3d(newdata2,newlon,newlat,newplevs,self.time)
def timeclip(self,r):
"""r is a 2-element list; this routine clips the data set so that the new time falls into the range r
(note: r could actualy be a bigger array; in that case, it uses the min and max of r to do the limit)"""
ind=np.where((np.min(r) <= self.time) & (self.time <= np.max(r)))[0]
# if copy == False:
# self.time=self.time[ind]
# self.data=self.data[ind,]
# return
new3d=self.copy()
new3d.time=self.time[ind]
new3d.data=self.data[ind,]
return new3d
class TimeSeries:
"""basic data element that contains a 2D string of data (time, pressure) and a time variable"""
def __init__(self,array3d=[],time=[],plevs=[],minv=-9e9):
"""TimeSeries(array[time], time, plevs, minv): time series object
time is optional, filled in increasing integers if omitted.
Values less than minv are masked."""
# if called w/ no parameters
if np.size(array3d) == 0:
self.data=[];self.time=[];self.plevs=[]
return
if len(np.shape(array3d)) > 2:
raise TypeError("requires 1D or 2D input data")
if len(time) == 0: time=np.arange(np.shape(array3d)[0])
if len(plevs) == 0:
plevs=[0]
if len(np.shape(array3d)) > 1: plevs=np.arange(np.shape(array3d)[1])
if np.shape(array3d)[0] != len(time):
raise TypeError("time array mismatch")
array3d=np.ma.array(array3d) # mask bad values
array3d=np.ma.masked_where(array3d < minv,array3d)
array3d=np.ma.masked_where(np.isnan(array3d),array3d)
self.data=array3d
self.time=np.array(time)
self.plevs=np.array(plevs)
return
def copy(self):
"""produce a copy of the Data3d structure"""
newdata=TimeSeries(np.ma.copy(self.data),np.ma.copy(self.time))
return newdata
def append(self,newdata):
"""appends time slice(s) to the 3D time series"""
if np.size(self.data) == 0:
self.data=newdata.data
self.time=newdata.time
return
if len(np.shape(self.data)) > 1:
if np.shape(self.data)[1] != np.shape(self.data):
raise TypeError("shape error")
z1=np.append(self.data,newdata.data,axis=0)
self.data=z1
z2=np.append(self.time,newdata.time)
self.time=z2
return
def anomaly(self,timerange=(-9e9,9e9),minv=-9e9):
"""x1.anomaly(timerange=(mintime,maxtime))
calculate anomaly relative to a particular time span """
d1=np.ma.copy(self.data)
time=np.copy(self.time)
ind=np.where((time >= min(timerange)) & (time <= max(timerange)))[0]
indx=np.arange(len(time)) % 12
if len(np.shape(self.data)) > 1: # lp2 is the number of plevs
lp2=np.shape(self.data)[1]
else:
lp2=1
for ii in range(12):
for jj in range(lp2):
xx=np.where(ii == indx)[0] # index into data
yy= | np.where(ii == indx[ind]) | numpy.where |
"""
Test Surrogates Overview
========================
"""
# Author: <NAME> <<EMAIL>>
# License: new BSD
from PIL import Image
import numpy as np
import scripts.surrogates_overview as exo
import scripts.image_classifier as imgclf
import sklearn.datasets
import sklearn.linear_model
SAMPLES = 10
BATCH = 50
SAMPLE_IRIS = False
IRIS_SAMPLES = 50000
def test_bilmey_image():
"""Tests surrogate image bLIMEy."""
# Load the image
doggo_img = Image.open('surrogates_overview/img/doggo.jpg')
doggo_array = np.array(doggo_img)
# Load the classifier
clf = imgclf.ImageClassifier()
explain_classes = [('tennis ball', 852),
('golden retriever', 207),
('Labrador retriever', 208)]
# Configure widgets to select occlusion colour, segmentation granularity
# and explained class
colour_selection = {
i: i for i in ['mean', 'black', 'white', 'randomise-patch', 'green']
}
granularity_selection = {'low': 13, 'medium': 30, 'high': 50}
# Generate explanations
blimey_image_collection = {}
for gran_name, gran_number in granularity_selection.items():
blimey_image_collection[gran_name] = {}
for col_name in colour_selection:
blimey_image_collection[gran_name][col_name] = \
exo.build_image_blimey(
doggo_array,
clf.predict_proba,
explain_classes,
explanation_size=5,
segments_number=gran_number,
occlusion_colour=col_name,
samples_number=SAMPLES,
batch_size=BATCH,
random_seed=42)
exp = []
for gran_ in blimey_image_collection:
for col_ in blimey_image_collection[gran_]:
exp.append(blimey_image_collection[gran_][col_]['surrogates'])
assert len(exp) == len(EXP_IMG)
for e, E in zip(exp, EXP_IMG):
assert sorted(list(e.keys())) == sorted(list(E.keys()))
for key in e.keys():
assert e[key]['name'] == E[key]['name']
assert len(e[key]['explanation']) == len(E[key]['explanation'])
for e_, E_ in zip(e[key]['explanation'], E[key]['explanation']):
assert e_[0] == E_[0]
assert np.allclose(e_[1], E_[1], atol=.001, equal_nan=True)
def test_bilmey_tabular():
"""Tests surrogate tabular bLIMEy."""
# Load the iris data set
iris = sklearn.datasets.load_iris()
iris_X = iris.data # [:, :2] # take the first two features only
iris_y = iris.target
iris_labels = iris.target_names
iris_feature_names = iris.feature_names
label2class = {lab: i for i, lab in enumerate(iris_labels)}
# Fit the classifier
logreg = sklearn.linear_model.LogisticRegression(C=1e5)
logreg.fit(iris_X, iris_y)
# explained class
_dtype = iris_X.dtype
explained_instances = {
'setosa': np.array([5, 3.5, 1.5, 0.25]).astype(_dtype),
'versicolor': np.array([5.5, 2.75, 4.5, 1.25]).astype(_dtype),
'virginica': np.array([7, 3, 5.5, 2.25]).astype(_dtype)
}
petal_length_idx = iris_feature_names.index('petal length (cm)')
petal_length_bins = [1, 2, 3, 4, 5, 6, 7]
petal_width_idx = iris_feature_names.index('petal width (cm)')
petal_width_bins = [0, .5, 1, 1.5, 2, 2.5]
discs_ = []
for i, ix in enumerate(petal_length_bins): # X-axis
for iix in petal_length_bins[i + 1:]:
for j, jy in enumerate(petal_width_bins): # Y-axis
for jjy in petal_width_bins[j + 1:]:
discs_.append({
petal_length_idx: [ix, iix],
petal_width_idx: [jy, jjy]
})
for inst_i in explained_instances:
for cls_i in iris_labels:
for disc_i, disc in enumerate(discs_):
inst = explained_instances[inst_i]
cls = label2class[cls_i]
exp = exo.build_tabular_blimey(
inst, cls, iris_X, iris_y, logreg.predict_proba, disc,
IRIS_SAMPLES, SAMPLE_IRIS, 42)
key = '{}&{}&{}'.format(inst_i, cls, disc_i)
exp_ = EXP_TAB[key]
assert exp['explanation'].shape[0] == exp_.shape[0]
assert np.allclose(
exp['explanation'], exp_, atol=.001, equal_nan=True)
EXP_IMG = [
{207: {'explanation': [(13, -0.24406872165780585),
(11, -0.20456180387430317),
(9, -0.1866779131424261),
(4, 0.15001224157793785),
(3, 0.11589480417160983)],
'name': 'golden retriever'},
208: {'explanation': [(13, -0.08395966359346249),
(0, -0.0644986107387837),
(9, 0.05845584633658977),
(1, 0.04369763085720947),
(11, -0.035958188394941866)],
'name': '<NAME>'},
852: {'explanation': [(13, 0.3463529698715463),
(11, 0.2678050131923326),
(4, -0.10639863421417416),
(6, 0.08345792378117327),
(9, 0.07366945242386444)],
'name': '<NAME>'}},
{207: {'explanation': [(13, -0.0624167912596456),
(7, 0.06083359545295548),
(3, 0.0495953943686462),
(11, -0.04819787147412231),
(2, -0.03858823761391199)],
'name': '<NAME>'},
208: {'explanation': [(13, -0.08408428146916162),
(7, 0.07704235920590158),
(3, 0.06646468388122273),
(11, -0.0638326572126609),
(2, -0.052621478002380796)],
'name': '<NAME>'},
852: {'explanation': [(11, 0.35248212611685886),
(13, 0.2516925608037859),
(2, 0.13682853028454384),
(9, 0.12930134856644754),
(6, 0.1257747954095489)],
'name': '<NAME>'}},
{207: {'explanation': [(3, 0.21351937934930917),
(10, 0.16933456312772083),
(11, -0.13447244552856766),
(8, 0.11058919217055371),
(2, -0.06269239798368743)],
'name': '<NAME>'},
208: {'explanation': [(8, 0.05995551486884414),
(9, -0.05375302972380482),
(11, -0.051997353324246445),
(6, 0.04213181405953071),
(2, -0.039169895361928275)],
'name': '<NAME>'},
852: {'explanation': [(7, 0.31382219776986503),
(11, 0.24126214884275987),
(13, 0.21075924370226598),
(2, 0.11937652039885377),
(8, -0.11911265319329697)],
'name': '<NAME>'}},
{207: {'explanation': [(3, 0.39254403293049134),
(9, 0.19357165018747347),
(6, 0.16592079671652987),
(0, 0.14042059731407297),
(1, 0.09793027079765507)],
'name': '<NAME>'},
208: {'explanation': [(9, -0.19351859273276703),
(1, -0.15262967987262344),
(3, 0.12205127112235375),
(2, 0.11352141032313934),
(6, -0.11164209893429898)],
'name': '<NAME>'},
852: {'explanation': [(7, 0.17213007100844877),
(0, -0.1583030948868859),
(3, -0.13748574615069775),
(5, 0.13273283867075436),
(11, 0.12309551170070354)],
'name': '<NAME>'}},
{207: {'explanation': [(3, 0.4073533182995105),
(10, 0.20711667988142463),
(8, 0.15360813290032324),
(6, 0.1405424759832785),
(1, 0.1332920685413575)],
'name': '<NAME>'},
208: {'explanation': [(9, -0.14747910525112617),
(1, -0.13977061235228924),
(2, 0.10526833898161611),
(6, -0.10416022118399552),
(3, 0.09555992655161764)],
'name': '<NAME>'},
852: {'explanation': [(11, 0.2232260929107954),
(7, 0.21638443149433054),
(5, 0.21100464215582274),
(13, 0.145614853795006),
(1, -0.11416523431311262)],
'name': '<NAME>'}},
{207: {'explanation': [(1, 0.14700178977744183),
(0, 0.10346667279328238),
(2, 0.10346667279328238),
(7, 0.10346667279328238),
(8, 0.10162900633690726)],
'name': '<NAME>'},
208: {'explanation': [(10, -0.10845134816658476),
(8, -0.1026920429226184),
(6, -0.10238154733842847),
(18, 0.10094164937411244),
(16, 0.08646888450232793)],
'name': '<NAME>'},
852: {'explanation': [(18, -0.20542297091894474),
(13, 0.2012751176130666),
(8, -0.19194747162742365),
(20, 0.14686930696710473),
(15, 0.11796990086271067)],
'name': '<NAME>'}},
{207: {'explanation': [(13, 0.12446259821701779),
(17, 0.11859084421095789),
(15, 0.09690553833007137),
(12, -0.08869743701731962),
(4, 0.08124900427893789)],
'name': '<NAME>'},
208: {'explanation': [(10, -0.09478194981909983),
(20, -0.09173392507039077),
(9, 0.08768898801254493),
(17, -0.07553994244536394),
(4, 0.07422905503397653)],
'name': '<NAME>'},
852: {'explanation': [(21, 0.1327882942965061),
(1, 0.1238236573086363),
(18, -0.10911712271717902),
(19, 0.09707191051320978),
(6, 0.08593672504338913)],
'name': '<NAME>'}},
{207: {'explanation': [(6, 0.14931728779865114),
(14, 0.14092073957103526),
(1, 0.11071480021464616),
(4, 0.10655287976934531),
(8, 0.08705404649152573)],
'name': '<NAME>'},
208: {'explanation': [(8, -0.12242580400886727),
(9, 0.12142729544158742),
(14, -0.1148252787068248),
(16, -0.09562322208795092),
(4, 0.09350160975513132)],
'name': '<NAME>'},
852: {'explanation': [(6, 0.04227675072263027),
(9, -0.03107924340879173),
(14, 0.028007115650713045),
(13, 0.02771190348545554),
(19, 0.02640441416071482)],
'name': '<NAME>'}},
{207: {'explanation': [(19, 0.14313680656283245),
(18, 0.12866508562342843),
(8, 0.11809779264185447),
(0, 0.11286255403442104),
(2, 0.11286255403442104)],
'name': '<NAME>'},
208: {'explanation': [(9, 0.2397917428082761),
(14, -0.19435572812170654),
(6, -0.1760894833446507),
(18, -0.12243333818399058),
(15, 0.10986343675377105)],
'name': '<NAME>'},
852: {'explanation': [(14, 0.15378038774613365),
(9, -0.14245940635481966),
(6, 0.10213601012183973),
(20, 0.1009180838986786),
(3, 0.09780065767815548)],
'name': '<NAME>'}},
{207: {'explanation': [(15, 0.06525850448807077),
(9, 0.06286791243851698),
(19, 0.055189970374185854),
(8, 0.05499197604401475),
(13, 0.04748220842936177)],
'name': '<NAME>'},
208: {'explanation': [(6, -0.31549091899770765),
(5, 0.1862302670824446),
(8, -0.17381478451341995),
(10, -0.17353516098662508),
(14, -0.13591542421754205)],
'name': '<NAME>'},
852: {'explanation': [(14, 0.2163853942943355),
(6, 0.17565046338282214),
(1, 0.12446193028474549),
(9, -0.11365789839746396),
(10, 0.09239073691962967)],
'name': '<NAME>'}},
{207: {'explanation': [(19, 0.1141207265647932),
(36, -0.08861425922625768),
(30, 0.07219209872026074),
(9, -0.07150939547859836),
(38, -0.06988288637544438)],
'name': '<NAME>'},
208: {'explanation': [(29, 0.10531073909547647),
(13, 0.08279642208039652),
(34, -0.0817952443980797),
(33, -0.08086848205765082),
(12, 0.08086848205765082)],
'name': '<NAME>'},
852: {'explanation': [(13, -0.1330452414595897),
(4, 0.09942366413042845),
(12, -0.09881995683190645),
(33, 0.09881995683190645),
(19, -0.09596925317560831)],
'name': '<NAME>'}},
{207: {'explanation': [(37, 0.08193926967758253),
(35, 0.06804043021426347),
(15, 0.06396269230810163),
(11, 0.062255657227065296),
(8, 0.05529200233091672)],
'name': '<NAME>'},
208: {'explanation': [(19, 0.05711957286614678),
(27, -0.050230108135410824),
(16, -0.04743034616549999),
(5, -0.046717346734255705),
(9, -0.04419100026638039)],
'name': '<NAME>'},
852: {'explanation': [(3, -0.08390967998497496),
(30, -0.07037680222442452),
(22, 0.07029819368543713),
(8, -0.06861396187180349),
(37, -0.06662511956402824)],
'name': '<NAME>'}},
{207: {'explanation': [(19, 0.048418845359024805),
(9, -0.0423869575883795),
(30, 0.04012650790044438),
(36, -0.03787242980067195),
(10, 0.036557999380695635)],
'name': '<NAME>'},
208: {'explanation': [(10, 0.12120686823129677),
(17, 0.10196564232230493),
(7, 0.09495133975425854),
(25, -0.0759657891182803),
(2, -0.07035244568286837)],
'name': '<NAME>'},
852: {'explanation': [(3, -0.0770578003457272),
(28, 0.0769372258280398),
(6, -0.06044725989272927),
(22, 0.05550155775286349),
(31, -0.05399028046597057)],
'name': '<NAME>'}},
{207: {'explanation': [(14, 0.05371383110181226),
(0, -0.04442539316084218),
(18, 0.042589475382826494),
(19, 0.04227647855354252),
(17, 0.041685661662754295)],
'name': '<NAME>'},
208: {'explanation': [(29, 0.14419601354489464),
(17, 0.11785174500536676),
(36, 0.1000501679652906),
(10, 0.09679790134851017),
(35, 0.08710376081189208)],
'name': '<NAME>'},
852: {'explanation': [(8, -0.02486237985832769),
(3, -0.022559886154747102),
(11, -0.021878686669239856),
(36, 0.021847953817988534),
(19, -0.018317598300716522)],
'name': '<NAME>'}},
{207: {'explanation': [(37, 0.08098729255605368),
(35, 0.06639102704982619),
(15, 0.06033721190370432),
(34, 0.05826267856117829),
(28, 0.05549505160798173)],
'name': '<NAME>'},
208: {'explanation': [(17, 0.13839012042250542),
(10, 0.11312187488346881),
(7, 0.10729071207480922),
(25, -0.09529127965797404),
(11, -0.09279834572979286)],
'name': '<NAME>'},
852: {'explanation': [(3, -0.028385651836694076),
(22, 0.023364702783498722),
(8, -0.023097812578270233),
(30, -0.022931236620034406),
(37, -0.022040170736525342)],
'name': '<NAME>'}}
]
EXP_TAB = {
'setosa&0&0': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&1': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&2': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&3': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&4': np.array([0.9706534384443797, 0.007448195602953232]),
'setosa&0&5': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&6': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&7': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&8': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&9': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&10': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&11': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&12': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&13': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&14': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&15': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&16': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&17': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&18': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&19': np.array([0.9706534384443797, 0.007448195602953232]),
'setosa&0&20': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&21': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&22': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&23': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&24': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&25': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&26': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&27': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&28': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&29': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&30': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&31': np.array([0.07476043598366156, 0.9062715528547001]),
'setosa&0&32': np.array([0.7770298852793471, 0.0294434304771479]),
'setosa&0&33': np.array([0.7936433456054741, 0.01258375207649658]),
'setosa&0&34': np.array([0.7974072911132786, 0.006894018772033576]),
'setosa&0&35': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&36': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&37': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&38': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&39': np.array([0.07476043598366156, 0.9062715528547001]),
'setosa&0&40': np.array([0.07476043598366156, 0.9062715528547001]),
'setosa&0&41': np.array([0.07476043598366156, 0.9062715528547001]),
'setosa&0&42': np.array([0.7770298852793471, 0.0294434304771479]),
'setosa&0&43': np.array([0.7770298852793471, 0.0294434304771479]),
'setosa&0&44': np.array([0.7936433456054741, 0.01258375207649658]),
'setosa&0&45': np.array([0.050316962184345455, 0.9292276112117481]),
'setosa&0&46': np.array([0.0171486447659196, 0.9632117581295891]),
'setosa&0&47': np.array([0.06151571389390039, 0.524561199322281]),
'setosa&0&48': np.array([0.4329463382004908, 0.057167210150691136]),
'setosa&0&49': np.array([0.4656481363306145, 0.007982539480288167]),
'setosa&0&50': np.array([0.050316962184345455, 0.9292276112117481]),
'setosa&0&51': np.array([0.050316962184345455, 0.9292276112117481]),
'setosa&0&52': np.array([0.050316962184345455, 0.9292276112117481]),
'setosa&0&53': np.array([0.050316962184345455, 0.9292276112117481]),
'setosa&0&54': np.array([0.0171486447659196, 0.9632117581295891]),
'setosa&0&55': np.array([0.0171486447659196, 0.9632117581295891]),
'setosa&0&56': np.array([0.0171486447659196, 0.9632117581295891]),
'setosa&0&57': np.array([0.06151571389390039, 0.524561199322281]),
'setosa&0&58': np.array([0.06151571389390039, 0.524561199322281]),
'setosa&0&59': np.array([0.4329463382004908, 0.057167210150691136]),
'setosa&0&60': np.array([0.029402442458921055, 0.9481684282717416]),
'setosa&0&61': np.array([0.00988785935411159, 0.9698143912008228]),
'setosa&0&62': np.array([0.009595083643662688, 0.5643652067423869]),
'setosa&0&63': np.array([0.13694026920485936, 0.36331091829858003]),
'setosa&0&64': np.array([0.3094460464703627, 0.11400643817329122]),
'setosa&0&65': np.array([0.029402442458921055, 0.9481684282717416]),
'setosa&0&66': np.array([0.029402442458921055, 0.9481684282717416]),
'setosa&0&67': np.array([0.029402442458921055, 0.9481684282717416]),
'setosa&0&68': np.array([0.029402442458921055, 0.9481684282717416]),
'setosa&0&69': np.array([0.00988785935411159, 0.9698143912008228]),
'setosa&0&70': np.array([0.00988785935411159, 0.9698143912008228]),
'setosa&0&71': np.array([0.00988785935411159, 0.9698143912008228]),
'setosa&0&72': np.array([0.009595083643662688, 0.5643652067423869]),
'setosa&0&73': np.array([0.009595083643662688, 0.5643652067423869]),
'setosa&0&74': np.array([0.13694026920485936, 0.36331091829858003]),
'setosa&0&75': np.array([0.0, 0.95124502153736]),
'setosa&0&76': np.array([0.0, 0.9708703761803881]),
'setosa&0&77': np.array([0.0, 0.5659706098422994]),
'setosa&0&78': np.array([0.0, 0.3962828716108186]),
'setosa&0&79': np.array([0.0, 0.2538069363248767]),
'setosa&0&80': np.array([0.0, 0.95124502153736]),
'setosa&0&81': np.array([0.0, 0.95124502153736]),
'setosa&0&82': np.array([0.0, 0.95124502153736]),
'setosa&0&83': np.array([0.0, 0.95124502153736]),
'setosa&0&84': np.array([0.0, 0.9708703761803881]),
'setosa&0&85': np.array([0.0, 0.9708703761803881]),
'setosa&0&86': np.array([0.0, 0.9708703761803881]),
'setosa&0&87': np.array([0.0, 0.5659706098422994]),
'setosa&0&88': np.array([0.0, 0.5659706098422994]),
'setosa&0&89': np.array([0.0, 0.3962828716108186]),
'setosa&0&90': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&91': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&92': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&93': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&94': np.array([0.9706534384443797, 0.007448195602953232]),
'setosa&0&95': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&96': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&97': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&98': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&99': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&100': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&101': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&102': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&103': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&104': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&105': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&106': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&107': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&108': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&109': np.array([0.9706534384443797, 0.007448195602953232]),
'setosa&0&110': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&111': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&112': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&113': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&114': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&115': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&116': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&117': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&118': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&119': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&120': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&121': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&122': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&123': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&124': np.array([0.9706534384443797, 0.007448195602953232]),
'setosa&0&125': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&126': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&127': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&128': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&129': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&130': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&131': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&132': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&133': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&134': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&135': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&136': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&137': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&138': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&139': np.array([0.9706534384443797, 0.007448195602953232]),
'setosa&0&140': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&141': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&142': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&143': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&144': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&145': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&146': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&147': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&148': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&149': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&150': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&151': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&152': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&153': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&154': np.array([0.9706534384443797, 0.007448195602953232]),
'setosa&0&155': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&156': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&157': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&158': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&159': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&160': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&161': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&162': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&163': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&164': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&165': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&166': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&167': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&168': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&169': np.array([0.9706534384443797, 0.007448195602953232]),
'setosa&0&170': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&171': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&172': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&173': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&174': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&175': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&176': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&177': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&178': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&179': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&180': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&181': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&182': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&183': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&184': np.array([0.9706534384443797, 0.007448195602953232]),
'setosa&0&185': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&186': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&187': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&188': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&189': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&190': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&191': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&192': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&193': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&194': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&195': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&196': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&197': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&198': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&199': np.array([0.9706534384443797, 0.007448195602953232]),
'setosa&0&200': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&201': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&202': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&203': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&204': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&205': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&206': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&207': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&208': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&209': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&210': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&211': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&212': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&213': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&214': np.array([0.9706534384443797, 0.007448195602953232]),
'setosa&0&215': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&216': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&217': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&218': np.array([0.7431524521056113, 0.24432235603856345]),
'setosa&0&219': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&220': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&221': np.array([0.4926091071260067, 0.49260910712601286]),
'setosa&0&222': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&223': np.array([0.9550700362273441, 0.025428672111930138]),
'setosa&0&224': np.array([0.9672121512728677, 0.012993005706020341]),
'setosa&0&225': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&226': np.array([0.07476043598366156, 0.9062715528547001]),
'setosa&0&227': np.array([0.7770298852793471, 0.0294434304771479]),
'setosa&0&228': np.array([0.7936433456054741, 0.01258375207649658]),
'setosa&0&229': np.array([0.7974072911132786, 0.006894018772033576]),
'setosa&0&230': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&231': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&232': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&233': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&234': np.array([0.07476043598366156, 0.9062715528547001]),
'setosa&0&235': np.array([0.07476043598366156, 0.9062715528547001]),
'setosa&0&236': np.array([0.07476043598366156, 0.9062715528547001]),
'setosa&0&237': np.array([0.7770298852793471, 0.0294434304771479]),
'setosa&0&238': np.array([0.7770298852793471, 0.0294434304771479]),
'setosa&0&239': np.array([0.7936433456054741, 0.01258375207649658]),
'setosa&0&240': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&241': np.array([0.07476043598366156, 0.9062715528547001]),
'setosa&0&242': np.array([0.7770298852793471, 0.0294434304771479]),
'setosa&0&243': np.array([0.7936433456054741, 0.01258375207649658]),
'setosa&0&244': np.array([0.7974072911132786, 0.006894018772033576]),
'setosa&0&245': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&246': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&247': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&248': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&249': np.array([0.07476043598366156, 0.9062715528547001]),
'setosa&0&250': np.array([0.07476043598366156, 0.9062715528547001]),
'setosa&0&251': np.array([0.07476043598366156, 0.9062715528547001]),
'setosa&0&252': np.array([0.7770298852793471, 0.0294434304771479]),
'setosa&0&253': np.array([0.7770298852793471, 0.0294434304771479]),
'setosa&0&254': np.array([0.7936433456054741, 0.01258375207649658]),
'setosa&0&255': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&256': np.array([0.07476043598366156, 0.9062715528547001]),
'setosa&0&257': np.array([0.7770298852793471, 0.0294434304771479]),
'setosa&0&258': np.array([0.7936433456054741, 0.01258375207649658]),
'setosa&0&259': np.array([0.7974072911132786, 0.006894018772033576]),
'setosa&0&260': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&261': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&262': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&263': np.array([0.19685199412911678, 0.7845879230594391]),
'setosa&0&264': np.array([0.07476043598366156, 0.9062715528547001]),
'setosa&0&265': np.array([0.07476043598366156, 0.9062715528547001]),
'setosa&0&266': np.array([0.07476043598366156, 0.9062715528547001]),
'setosa&0&267': np.array([0.7770298852793471, 0.0294434304771479]),
'setosa&0&268': np.array([0.7770298852793471, 0.0294434304771479]),
'setosa&0&269': np.array([0.7936433456054741, 0.01258375207649658]),
'setosa&0&270': np.array([0.050316962184345455, 0.9292276112117481]),
'setosa&0&271': np.array([0.0171486447659196, 0.9632117581295891]),
'setosa&0&272': np.array([0.06151571389390039, 0.524561199322281]),
'setosa&0&273': np.array([0.4329463382004908, 0.057167210150691136]),
'setosa&0&274': np.array([0.4656481363306145, 0.007982539480288167]),
'setosa&0&275': np.array([0.050316962184345455, 0.9292276112117481]),
'setosa&0&276': np.array([0.050316962184345455, 0.9292276112117481]),
'setosa&0&277': np.array([0.050316962184345455, 0.9292276112117481]),
'setosa&0&278': np.array([0.050316962184345455, 0.9292276112117481]),
'setosa&0&279': np.array([0.0171486447659196, 0.9632117581295891]),
'setosa&0&280': np.array([0.0171486447659196, 0.9632117581295891]),
'setosa&0&281': np.array([0.0171486447659196, 0.9632117581295891]),
'setosa&0&282': np.array([0.06151571389390039, 0.524561199322281]),
'setosa&0&283': np.array([0.06151571389390039, 0.524561199322281]),
'setosa&0&284': np.array([0.4329463382004908, 0.057167210150691136]),
'setosa&0&285': np.array([0.050316962184345455, 0.9292276112117481]),
'setosa&0&286': np.array([0.0171486447659196, 0.9632117581295891]),
'setosa&0&287': np.array([0.06151571389390039, 0.524561199322281]),
'setosa&0&288': np.array([0.4329463382004908, 0.057167210150691136]),
'setosa&0&289': np.array([0.4656481363306145, 0.007982539480288167]),
'setosa&0&290': np.array([0.050316962184345455, 0.9292276112117481]),
'setosa&0&291': np.array([0.050316962184345455, 0.9292276112117481]),
'setosa&0&292': np.array([0.050316962184345455, 0.9292276112117481]),
'setosa&0&293': np.array([0.050316962184345455, 0.9292276112117481]),
'setosa&0&294': np.array([0.0171486447659196, 0.9632117581295891]),
'setosa&0&295': np.array([0.0171486447659196, 0.9632117581295891]),
'setosa&0&296': np.array([0.0171486447659196, 0.9632117581295891]),
'setosa&0&297': np.array([0.06151571389390039, 0.524561199322281]),
'setosa&0&298': np.array([0.06151571389390039, 0.524561199322281]),
'setosa&0&299': np.array([0.4329463382004908, 0.057167210150691136]),
'setosa&0&300': np.array([0.029402442458921055, 0.9481684282717416]),
'setosa&0&301': np.array([0.00988785935411159, 0.9698143912008228]),
'setosa&0&302': np.array([0.009595083643662688, 0.5643652067423869]),
'setosa&0&303': np.array([0.13694026920485936, 0.36331091829858003]),
'setosa&0&304': np.array([0.3094460464703627, 0.11400643817329122]),
'setosa&0&305': np.array([0.029402442458921055, 0.9481684282717416]),
'setosa&0&306': np.array([0.029402442458921055, 0.9481684282717416]),
'setosa&0&307': np.array([0.029402442458921055, 0.9481684282717416]),
'setosa&0&308': np.array([0.029402442458921055, 0.9481684282717416]),
'setosa&0&309': np.array([0.00988785935411159, 0.9698143912008228]),
'setosa&0&310': np.array([0.00988785935411159, 0.9698143912008228]),
'setosa&0&311': np.array([0.00988785935411159, 0.9698143912008228]),
'setosa&0&312': np.array([0.009595083643662688, 0.5643652067423869]),
'setosa&0&313': np.array([0.009595083643662688, 0.5643652067423869]),
'setosa&0&314': np.array([0.13694026920485936, 0.36331091829858003]),
'setosa&1&0': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&1': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&2': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&3': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&4': np.array([-0.4964962439921071, 0.3798215458387346]),
'setosa&1&5': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&6': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&7': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&8': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&9': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&10': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&11': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&12': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&13': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&14': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&15': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&16': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&17': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&18': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&19': np.array([-0.4964962439921071, 0.3798215458387346]),
'setosa&1&20': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&21': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&22': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&23': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&24': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&25': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&26': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&27': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&28': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&29': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&30': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&31': np.array([0.43843349141088417, -0.8642740701867918]),
'setosa&1&32': np.array([-0.7141739659554724, 0.6619819140152877]),
'setosa&1&33': np.array([-0.4446001433508151, 0.6107546840046902]),
'setosa&1&34': np.array([-0.26192650167775977, 0.33491141590339474]),
'setosa&1&35': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&36': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&37': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&38': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&39': np.array([0.43843349141088417, -0.8642740701867918]),
'setosa&1&40': np.array([0.43843349141088417, -0.8642740701867918]),
'setosa&1&41': np.array([0.43843349141088417, -0.8642740701867918]),
'setosa&1&42': np.array([-0.7141739659554724, 0.6619819140152877]),
'setosa&1&43': np.array([-0.7141739659554724, 0.6619819140152877]),
'setosa&1&44': np.array([-0.4446001433508151, 0.6107546840046902]),
'setosa&1&45': np.array([0.7749499208750121, -0.814718944080443]),
'setosa&1&46': np.array([0.80403091954169, -0.844515250413482]),
'setosa&1&47': np.array([0.5826506963750848, -0.22335655671229107]),
'setosa&1&48': np.array([0.33108168891715983, 0.13647816746351163]),
'setosa&1&49': np.array([0.4079256832347186, 0.038455640985860955]),
'setosa&1&50': np.array([0.7749499208750121, -0.814718944080443]),
'setosa&1&51': np.array([0.7749499208750121, -0.814718944080443]),
'setosa&1&52': np.array([0.7749499208750121, -0.814718944080443]),
'setosa&1&53': np.array([0.7749499208750121, -0.814718944080443]),
'setosa&1&54': np.array([0.80403091954169, -0.844515250413482]),
'setosa&1&55': np.array([0.80403091954169, -0.844515250413482]),
'setosa&1&56': np.array([0.80403091954169, -0.844515250413482]),
'setosa&1&57': np.array([0.5826506963750848, -0.22335655671229107]),
'setosa&1&58': np.array([0.5826506963750848, -0.22335655671229107]),
'setosa&1&59': np.array([0.33108168891715983, 0.13647816746351163]),
'setosa&1&60': np.array([0.4933316375690333, -0.5272416708629277]),
'setosa&1&61': np.array([0.5041830043657418, -0.5392782673950876]),
'setosa&1&62': np.array([0.25657760110071476, 0.12592645350389123]),
'setosa&1&63': np.array([0.13717260713320106, 0.3627779907901665]),
'setosa&1&64': np.array([0.3093950298647913, 0.1140298206733954]),
'setosa&1&65': np.array([0.4933316375690333, -0.5272416708629277]),
'setosa&1&66': np.array([0.4933316375690333, -0.5272416708629277]),
'setosa&1&67': np.array([0.4933316375690333, -0.5272416708629277]),
'setosa&1&68': np.array([0.4933316375690333, -0.5272416708629277]),
'setosa&1&69': np.array([0.5041830043657418, -0.5392782673950876]),
'setosa&1&70': np.array([0.5041830043657418, -0.5392782673950876]),
'setosa&1&71': np.array([0.5041830043657418, -0.5392782673950876]),
'setosa&1&72': np.array([0.25657760110071476, 0.12592645350389123]),
'setosa&1&73': np.array([0.25657760110071476, 0.12592645350389123]),
'setosa&1&74': np.array([0.13717260713320106, 0.3627779907901665]),
'setosa&1&75': np.array([0.0, -0.4756207622944677]),
'setosa&1&76': np.array([0.0, -0.4854334805210761]),
'setosa&1&77': np.array([0.0, 0.16885577975809635]),
'setosa&1&78': np.array([0.0, 0.395805885538554]),
'setosa&1&79': np.array([0.0, 0.2538072707138344]),
'setosa&1&80': np.array([0.0, -0.4756207622944677]),
'setosa&1&81': np.array([0.0, -0.4756207622944677]),
'setosa&1&82': np.array([0.0, -0.4756207622944677]),
'setosa&1&83': np.array([0.0, -0.4756207622944677]),
'setosa&1&84': np.array([0.0, -0.4854334805210761]),
'setosa&1&85': np.array([0.0, -0.4854334805210761]),
'setosa&1&86': np.array([0.0, -0.4854334805210761]),
'setosa&1&87': np.array([0.0, 0.16885577975809635]),
'setosa&1&88': np.array([0.0, 0.16885577975809635]),
'setosa&1&89': np.array([0.0, 0.395805885538554]),
'setosa&1&90': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&91': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&92': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&93': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&94': np.array([-0.4964962439921071, 0.3798215458387346]),
'setosa&1&95': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&96': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&97': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&98': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&99': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&100': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&101': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&102': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&103': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&104': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&105': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&106': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&107': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&108': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&109': np.array([-0.4964962439921071, 0.3798215458387346]),
'setosa&1&110': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&111': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&112': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&113': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&114': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&115': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&116': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&117': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&118': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&119': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&120': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&121': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&122': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&123': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&124': np.array([-0.4964962439921071, 0.3798215458387346]),
'setosa&1&125': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&126': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&127': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&128': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&129': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&130': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&131': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&132': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&133': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&134': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&135': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&136': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&137': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&138': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&139': np.array([-0.4964962439921071, 0.3798215458387346]),
'setosa&1&140': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&141': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&142': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&143': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&144': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&145': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&146': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&147': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&148': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&149': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&150': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&151': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&152': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&153': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&154': np.array([-0.4964962439921071, 0.3798215458387346]),
'setosa&1&155': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&156': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&157': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&158': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&159': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&160': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&161': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&162': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&163': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&164': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&165': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&166': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&167': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&168': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&169': np.array([-0.4964962439921071, 0.3798215458387346]),
'setosa&1&170': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&171': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&172': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&173': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&174': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&175': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&176': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&177': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&178': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&179': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&180': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&181': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&182': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&183': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&184': np.array([-0.4964962439921071, 0.3798215458387346]),
'setosa&1&185': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&186': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&187': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&188': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&189': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&190': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&191': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&192': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&193': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&194': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&195': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&196': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&197': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&198': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&199': np.array([-0.4964962439921071, 0.3798215458387346]),
'setosa&1&200': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&201': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&202': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&203': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&204': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&205': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&206': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&207': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&208': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&209': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&210': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&211': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&212': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&213': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&214': np.array([-0.4964962439921071, 0.3798215458387346]),
'setosa&1&215': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&216': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&217': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&218': np.array([-0.37157553889555184, -0.1221600832023858]),
'setosa&1&219': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&220': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&221': np.array([-0.2463036871609408, -0.24630368716093934]),
'setosa&1&222': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&223': np.array([-0.9105775730167809, 0.6842162738602727]),
'setosa&1&224': np.array([-0.6718337295341267, 0.6620422637360075]),
'setosa&1&225': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&226': np.array([0.43843349141088417, -0.8642740701867918]),
'setosa&1&227': np.array([-0.7141739659554724, 0.6619819140152877]),
'setosa&1&228': np.array([-0.4446001433508151, 0.6107546840046902]),
'setosa&1&229': np.array([-0.26192650167775977, 0.33491141590339474]),
'setosa&1&230': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&231': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&232': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&233': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&234': np.array([0.43843349141088417, -0.8642740701867918]),
'setosa&1&235': np.array([0.43843349141088417, -0.8642740701867918]),
'setosa&1&236': np.array([0.43843349141088417, -0.8642740701867918]),
'setosa&1&237': np.array([-0.7141739659554724, 0.6619819140152877]),
'setosa&1&238': np.array([-0.7141739659554724, 0.6619819140152877]),
'setosa&1&239': np.array([-0.4446001433508151, 0.6107546840046902]),
'setosa&1&240': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&241': np.array([0.43843349141088417, -0.8642740701867918]),
'setosa&1&242': np.array([-0.7141739659554724, 0.6619819140152877]),
'setosa&1&243': np.array([-0.4446001433508151, 0.6107546840046902]),
'setosa&1&244': np.array([-0.26192650167775977, 0.33491141590339474]),
'setosa&1&245': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&246': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&247': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&248': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&249': np.array([0.43843349141088417, -0.8642740701867918]),
'setosa&1&250': np.array([0.43843349141088417, -0.8642740701867918]),
'setosa&1&251': np.array([0.43843349141088417, -0.8642740701867918]),
'setosa&1&252': np.array([-0.7141739659554724, 0.6619819140152877]),
'setosa&1&253': np.array([-0.7141739659554724, 0.6619819140152877]),
'setosa&1&254': np.array([-0.4446001433508151, 0.6107546840046902]),
'setosa&1&255': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&256': np.array([0.43843349141088417, -0.8642740701867918]),
'setosa&1&257': np.array([-0.7141739659554724, 0.6619819140152877]),
'setosa&1&258': np.array([-0.4446001433508151, 0.6107546840046902]),
'setosa&1&259': np.array([-0.26192650167775977, 0.33491141590339474]),
'setosa&1&260': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&261': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&262': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&263': np.array([0.32199975656257585, -0.748229355246375]),
'setosa&1&264': np.array([0.43843349141088417, -0.8642740701867918]),
'setosa&1&265': np.array([0.43843349141088417, -0.8642740701867918]),
'setosa&1&266': np.array([0.43843349141088417, -0.8642740701867918]),
'setosa&1&267': np.array([-0.7141739659554724, 0.6619819140152877]),
'setosa&1&268': np.array([-0.7141739659554724, 0.6619819140152877]),
'setosa&1&269': np.array([-0.4446001433508151, 0.6107546840046902]),
'setosa&1&270': np.array([0.7749499208750121, -0.814718944080443]),
'setosa&1&271': np.array([0.80403091954169, -0.844515250413482]),
'setosa&1&272': np.array([0.5826506963750848, -0.22335655671229107]),
'setosa&1&273': np.array([0.33108168891715983, 0.13647816746351163]),
'setosa&1&274': np.array([0.4079256832347186, 0.038455640985860955]),
'setosa&1&275': np.array([0.7749499208750121, -0.814718944080443]),
'setosa&1&276': np.array([0.7749499208750121, -0.814718944080443]),
'setosa&1&277': np.array([0.7749499208750121, -0.814718944080443]),
'setosa&1&278': np.array([0.7749499208750121, -0.814718944080443]),
'setosa&1&279': np.array([0.80403091954169, -0.844515250413482]),
'setosa&1&280': np.array([0.80403091954169, -0.844515250413482]),
'setosa&1&281': np.array([0.80403091954169, -0.844515250413482]),
'setosa&1&282': np.array([0.5826506963750848, -0.22335655671229107]),
'setosa&1&283': np.array([0.5826506963750848, -0.22335655671229107]),
'setosa&1&284': np.array([0.33108168891715983, 0.13647816746351163]),
'setosa&1&285': np.array([0.7749499208750121, -0.814718944080443]),
'setosa&1&286': np.array([0.80403091954169, -0.844515250413482]),
'setosa&1&287': np.array([0.5826506963750848, -0.22335655671229107]),
'setosa&1&288': np.array([0.33108168891715983, 0.13647816746351163]),
'setosa&1&289': np.array([0.4079256832347186, 0.038455640985860955]),
'setosa&1&290': np.array([0.7749499208750121, -0.814718944080443]),
'setosa&1&291': np.array([0.7749499208750121, -0.814718944080443]),
'setosa&1&292': np.array([0.7749499208750121, -0.814718944080443]),
'setosa&1&293': np.array([0.7749499208750121, -0.814718944080443]),
'setosa&1&294': np.array([0.80403091954169, -0.844515250413482]),
'setosa&1&295': np.array([0.80403091954169, -0.844515250413482]),
'setosa&1&296': np.array([0.80403091954169, -0.844515250413482]),
'setosa&1&297': np.array([0.5826506963750848, -0.22335655671229107]),
'setosa&1&298': np.array([0.5826506963750848, -0.22335655671229107]),
'setosa&1&299': np.array([0.33108168891715983, 0.13647816746351163]),
'setosa&1&300': np.array([0.4933316375690333, -0.5272416708629277]),
'setosa&1&301': np.array([0.5041830043657418, -0.5392782673950876]),
'setosa&1&302': np.array([0.25657760110071476, 0.12592645350389123]),
'setosa&1&303': np.array([0.13717260713320106, 0.3627779907901665]),
'setosa&1&304': np.array([0.3093950298647913, 0.1140298206733954]),
'setosa&1&305': np.array([0.4933316375690333, -0.5272416708629277]),
'setosa&1&306': np.array([0.4933316375690333, -0.5272416708629277]),
'setosa&1&307': np.array([0.4933316375690333, -0.5272416708629277]),
'setosa&1&308': np.array([0.4933316375690333, -0.5272416708629277]),
'setosa&1&309': np.array([0.5041830043657418, -0.5392782673950876]),
'setosa&1&310': np.array([0.5041830043657418, -0.5392782673950876]),
'setosa&1&311': np.array([0.5041830043657418, -0.5392782673950876]),
'setosa&1&312': np.array([0.25657760110071476, 0.12592645350389123]),
'setosa&1&313': np.array([0.25657760110071476, 0.12592645350389123]),
'setosa&1&314': np.array([0.13717260713320106, 0.3627779907901665]),
'setosa&2&0': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&1': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&2': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&3': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&4': np.array([-0.47415719445227245, -0.38726974144168774]),
'setosa&2&5': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&6': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&7': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&8': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&9': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&10': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&11': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&12': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&13': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&14': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&15': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&16': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&17': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&18': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&19': np.array([-0.47415719445227245, -0.38726974144168774]),
'setosa&2&20': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&21': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&22': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&23': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&24': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&25': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&26': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&27': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&28': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&29': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&30': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&31': np.array([-0.513193927394545, -0.041997482667908786]),
'setosa&2&32': np.array([-0.06285591932387405, -0.6914253444924359]),
'setosa&2&33': np.array([-0.34904320225465857, -0.6233384360811872]),
'setosa&2&34': np.array([-0.5354807894355184, -0.3418054346754283]),
'setosa&2&35': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&36': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&37': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&38': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&39': np.array([-0.513193927394545, -0.041997482667908786]),
'setosa&2&40': np.array([-0.513193927394545, -0.041997482667908786]),
'setosa&2&41': np.array([-0.513193927394545, -0.041997482667908786]),
'setosa&2&42': np.array([-0.06285591932387405, -0.6914253444924359]),
'setosa&2&43': np.array([-0.06285591932387405, -0.6914253444924359]),
'setosa&2&44': np.array([-0.34904320225465857, -0.6233384360811872]),
'setosa&2&45': np.array([-0.8252668830593567, -0.11450866713130638]),
'setosa&2&46': np.array([-0.8211795643076093, -0.1186965077161071]),
'setosa&2&47': np.array([-0.6441664102689847, -0.3012046426099901]),
'setosa&2&48': np.array([-0.7640280271176497, -0.19364537761420375]),
'setosa&2&49': np.array([-0.8735738195653328, -0.046438180466149094]),
'setosa&2&50': np.array([-0.8252668830593567, -0.11450866713130638]),
'setosa&2&51': np.array([-0.8252668830593567, -0.11450866713130638]),
'setosa&2&52': np.array([-0.8252668830593567, -0.11450866713130638]),
'setosa&2&53': np.array([-0.8252668830593567, -0.11450866713130638]),
'setosa&2&54': np.array([-0.8211795643076093, -0.1186965077161071]),
'setosa&2&55': np.array([-0.8211795643076093, -0.1186965077161071]),
'setosa&2&56': np.array([-0.8211795643076093, -0.1186965077161071]),
'setosa&2&57': np.array([-0.6441664102689847, -0.3012046426099901]),
'setosa&2&58': np.array([-0.6441664102689847, -0.3012046426099901]),
'setosa&2&59': np.array([-0.7640280271176497, -0.19364537761420375]),
'setosa&2&60': np.array([-0.5227340800279542, -0.42092675740881474]),
'setosa&2&61': np.array([-0.5140708637198534, -0.43053612380573514]),
'setosa&2&62': np.array([-0.2661726847443776, -0.6902916602462779]),
'setosa&2&63': np.array([-0.2741128763380603, -0.7260889090887469]),
'setosa&2&64': np.array([-0.6188410763351541, -0.22803625884668638]),
'setosa&2&65': np.array([-0.5227340800279542, -0.42092675740881474]),
'setosa&2&66': np.array([-0.5227340800279542, -0.42092675740881474]),
'setosa&2&67': np.array([-0.5227340800279542, -0.42092675740881474]),
'setosa&2&68': np.array([-0.5227340800279542, -0.42092675740881474]),
'setosa&2&69': np.array([-0.5140708637198534, -0.43053612380573514]),
'setosa&2&70': np.array([-0.5140708637198534, -0.43053612380573514]),
'setosa&2&71': np.array([-0.5140708637198534, -0.43053612380573514]),
'setosa&2&72': np.array([-0.2661726847443776, -0.6902916602462779]),
'setosa&2&73': np.array([-0.2661726847443776, -0.6902916602462779]),
'setosa&2&74': np.array([-0.2741128763380603, -0.7260889090887469]),
'setosa&2&75': np.array([0.0, -0.47562425924289314]),
'setosa&2&76': np.array([0.0, -0.48543689565931186]),
'setosa&2&77': np.array([0.0, -0.7348263896003956]),
'setosa&2&78': np.array([0.0, -0.7920887571493729]),
'setosa&2&79': np.array([0.0, -0.507614207038711]),
'setosa&2&80': np.array([0.0, -0.47562425924289314]),
'setosa&2&81': np.array([0.0, -0.47562425924289314]),
'setosa&2&82': np.array([0.0, -0.47562425924289314]),
'setosa&2&83': np.array([0.0, -0.47562425924289314]),
'setosa&2&84': np.array([0.0, -0.48543689565931186]),
'setosa&2&85': np.array([0.0, -0.48543689565931186]),
'setosa&2&86': np.array([0.0, -0.48543689565931186]),
'setosa&2&87': np.array([0.0, -0.7348263896003956]),
'setosa&2&88': np.array([0.0, -0.7348263896003956]),
'setosa&2&89': np.array([0.0, -0.7920887571493729]),
'setosa&2&90': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&91': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&92': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&93': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&94': np.array([-0.47415719445227245, -0.38726974144168774]),
'setosa&2&95': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&96': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&97': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&98': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&99': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&100': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&101': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&102': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&103': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&104': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&105': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&106': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&107': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&108': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&109': np.array([-0.47415719445227245, -0.38726974144168774]),
'setosa&2&110': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&111': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&112': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&113': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&114': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&115': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&116': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&117': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&118': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&119': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&120': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&121': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&122': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&123': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&124': np.array([-0.47415719445227245, -0.38726974144168774]),
'setosa&2&125': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&126': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&127': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&128': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&129': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&130': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&131': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&132': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&133': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&134': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&135': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&136': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&137': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&138': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&139': np.array([-0.47415719445227245, -0.38726974144168774]),
'setosa&2&140': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&141': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&142': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&143': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&144': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&145': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&146': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&147': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&148': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&149': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&150': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&151': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&152': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&153': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&154': np.array([-0.47415719445227245, -0.38726974144168774]),
'setosa&2&155': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&156': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&157': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&158': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&159': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&160': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&161': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&162': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&163': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&164': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&165': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&166': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&167': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&168': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&169': np.array([-0.47415719445227245, -0.38726974144168774]),
'setosa&2&170': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&171': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&172': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&173': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&174': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&175': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&176': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&177': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&178': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&179': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&180': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&181': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&182': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&183': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&184': np.array([-0.47415719445227245, -0.38726974144168774]),
'setosa&2&185': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&186': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&187': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&188': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&189': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&190': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&191': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&192': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&193': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&194': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&195': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&196': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&197': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&198': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&199': np.array([-0.47415719445227245, -0.38726974144168774]),
'setosa&2&200': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&201': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&202': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&203': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&204': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&205': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&206': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&207': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&208': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&209': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&210': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&211': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&212': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&213': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&214': np.array([-0.47415719445227245, -0.38726974144168774]),
'setosa&2&215': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&216': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&217': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&218': np.array([-0.3715769132100501, -0.12216227283618744]),
'setosa&2&219': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&220': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&221': np.array([-0.24630541996506924, -0.24630541996506994]),
'setosa&2&222': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&223': np.array([-0.044492463210563125, -0.7096449459722027]),
'setosa&2&224': np.array([-0.29537842173874096, -0.6750352694420283]),
'setosa&2&225': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&226': np.array([-0.513193927394545, -0.041997482667908786]),
'setosa&2&227': np.array([-0.06285591932387405, -0.6914253444924359]),
'setosa&2&228': np.array([-0.34904320225465857, -0.6233384360811872]),
'setosa&2&229': np.array([-0.5354807894355184, -0.3418054346754283]),
'setosa&2&230': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&231': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&232': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&233': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&234': np.array([-0.513193927394545, -0.041997482667908786]),
'setosa&2&235': np.array([-0.513193927394545, -0.041997482667908786]),
'setosa&2&236': np.array([-0.513193927394545, -0.041997482667908786]),
'setosa&2&237': np.array([-0.06285591932387405, -0.6914253444924359]),
'setosa&2&238': np.array([-0.06285591932387405, -0.6914253444924359]),
'setosa&2&239': np.array([-0.34904320225465857, -0.6233384360811872]),
'setosa&2&240': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&241': np.array([-0.513193927394545, -0.041997482667908786]),
'setosa&2&242': np.array([-0.06285591932387405, -0.6914253444924359]),
'setosa&2&243': np.array([-0.34904320225465857, -0.6233384360811872]),
'setosa&2&244': np.array([-0.5354807894355184, -0.3418054346754283]),
'setosa&2&245': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&246': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&247': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&248': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&249': np.array([-0.513193927394545, -0.041997482667908786]),
'setosa&2&250': np.array([-0.513193927394545, -0.041997482667908786]),
'setosa&2&251': np.array([-0.513193927394545, -0.041997482667908786]),
'setosa&2&252': np.array([-0.06285591932387405, -0.6914253444924359]),
'setosa&2&253': np.array([-0.06285591932387405, -0.6914253444924359]),
'setosa&2&254': np.array([-0.34904320225465857, -0.6233384360811872]),
'setosa&2&255': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&256': np.array([-0.513193927394545, -0.041997482667908786]),
'setosa&2&257': np.array([-0.06285591932387405, -0.6914253444924359]),
'setosa&2&258': np.array([-0.34904320225465857, -0.6233384360811872]),
'setosa&2&259': np.array([-0.5354807894355184, -0.3418054346754283]),
'setosa&2&260': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&261': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&262': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&263': np.array([-0.5188517506916893, -0.036358567813067795]),
'setosa&2&264': np.array([-0.513193927394545, -0.041997482667908786]),
'setosa&2&265': np.array([-0.513193927394545, -0.041997482667908786]),
'setosa&2&266': np.array([-0.513193927394545, -0.041997482667908786]),
'setosa&2&267': np.array([-0.06285591932387405, -0.6914253444924359]),
'setosa&2&268': np.array([-0.06285591932387405, -0.6914253444924359]),
'setosa&2&269': np.array([-0.34904320225465857, -0.6233384360811872]),
'setosa&2&270': np.array([-0.8252668830593567, -0.11450866713130638]),
'setosa&2&271': np.array([-0.8211795643076093, -0.1186965077161071]),
'setosa&2&272': np.array([-0.6441664102689847, -0.3012046426099901]),
'setosa&2&273': np.array([-0.7640280271176497, -0.19364537761420375]),
'setosa&2&274': np.array([-0.8735738195653328, -0.046438180466149094]),
'setosa&2&275': np.array([-0.8252668830593567, -0.11450866713130638]),
'setosa&2&276': np.array([-0.8252668830593567, -0.11450866713130638]),
'setosa&2&277': np.array([-0.8252668830593567, -0.11450866713130638]),
'setosa&2&278': np.array([-0.8252668830593567, -0.11450866713130638]),
'setosa&2&279': np.array([-0.8211795643076093, -0.1186965077161071]),
'setosa&2&280': np.array([-0.8211795643076093, -0.1186965077161071]),
'setosa&2&281': np.array([-0.8211795643076093, -0.1186965077161071]),
'setosa&2&282': np.array([-0.6441664102689847, -0.3012046426099901]),
'setosa&2&283': np.array([-0.6441664102689847, -0.3012046426099901]),
'setosa&2&284': np.array([-0.7640280271176497, -0.19364537761420375]),
'setosa&2&285': np.array([-0.8252668830593567, -0.11450866713130638]),
'setosa&2&286': np.array([-0.8211795643076093, -0.1186965077161071]),
'setosa&2&287': np.array([-0.6441664102689847, -0.3012046426099901]),
'setosa&2&288': np.array([-0.7640280271176497, -0.19364537761420375]),
'setosa&2&289': np.array([-0.8735738195653328, -0.046438180466149094]),
'setosa&2&290': np.array([-0.8252668830593567, -0.11450866713130638]),
'setosa&2&291': np.array([-0.8252668830593567, -0.11450866713130638]),
'setosa&2&292': np.array([-0.8252668830593567, -0.11450866713130638]),
'setosa&2&293': np.array([-0.8252668830593567, -0.11450866713130638]),
'setosa&2&294': np.array([-0.8211795643076093, -0.1186965077161071]),
'setosa&2&295': np.array([-0.8211795643076093, -0.1186965077161071]),
'setosa&2&296': np.array([-0.8211795643076093, -0.1186965077161071]),
'setosa&2&297': np.array([-0.6441664102689847, -0.3012046426099901]),
'setosa&2&298': np.array([-0.6441664102689847, -0.3012046426099901]),
'setosa&2&299': np.array([-0.7640280271176497, -0.19364537761420375]),
'setosa&2&300': np.array([-0.5227340800279542, -0.42092675740881474]),
'setosa&2&301': np.array([-0.5140708637198534, -0.43053612380573514]),
'setosa&2&302': np.array([-0.2661726847443776, -0.6902916602462779]),
'setosa&2&303': np.array([-0.2741128763380603, -0.7260889090887469]),
'setosa&2&304': np.array([-0.6188410763351541, -0.22803625884668638]),
'setosa&2&305': np.array([-0.5227340800279542, -0.42092675740881474]),
'setosa&2&306': np.array([-0.5227340800279542, -0.42092675740881474]),
'setosa&2&307': np.array([-0.5227340800279542, -0.42092675740881474]),
'setosa&2&308': np.array([-0.5227340800279542, -0.42092675740881474]),
'setosa&2&309': np.array([-0.5140708637198534, -0.43053612380573514]),
'setosa&2&310': np.array([-0.5140708637198534, -0.43053612380573514]),
'setosa&2&311': np.array([-0.5140708637198534, -0.43053612380573514]),
'setosa&2&312': np.array([-0.2661726847443776, -0.6902916602462779]),
'setosa&2&313': np.array([-0.2661726847443776, -0.6902916602462779]),
'setosa&2&314': np.array([-0.2741128763380603, -0.7260889090887469]),
'versicolor&0&0': np.array([-0.7431524521056113, -0.24432235603856345]),
'versicolor&0&1': np.array([-0.4926091071260067, -0.49260910712601286]),
'versicolor&0&2': np.array([-0.9550700362273441, 0.025428672111930138]),
'versicolor&0&3': np.array([-0.9672121512728677, 0.012993005706020341]),
'versicolor&0&4': np.array([-0.9706534384443797, 0.007448195602953232]),
'versicolor&0&5': np.array([-0.4926091071260067, -0.49260910712601286]),
'versicolor&0&6': np.array([-0.967167257194905, -0.011919414234523772]),
'versicolor&0&7': np.array([-0.953200964337313, -0.027163424176667752]),
'versicolor&0&8': np.array([-0.8486399726113752, -0.13537345771621853]),
'versicolor&0&9': np.array([-0.9658161779555727, -0.01446062269877741]),
'versicolor&0&10': np.array([-0.9493506964095418, -0.0312186903717912]),
'versicolor&0&11': np.array([-0.7870031444780577, -0.1952404625292782]),
'versicolor&0&12': np.array([-0.9550700362273441, 0.025428672111930138]),
'versicolor&0&13': np.array([-0.9550700362273441, 0.025428672111930138]),
'versicolor&0&14': np.array([-0.9672121512728677, 0.012993005706020341]),
'versicolor&0&15': np.array([-0.7431524521056113, -0.24432235603856345]),
'versicolor&0&16': np.array([-0.4926091071260067, -0.49260910712601286]),
'versicolor&0&17': np.array([-0.9550700362273441, 0.025428672111930138]),
'versicolor&0&18': np.array([-0.9672121512728677, 0.012993005706020341]),
'versicolor&0&19': np.array([-0.9706534384443797, 0.007448195602953232]),
'versicolor&0&20': np.array([-0.4926091071260067, -0.49260910712601286]),
'versicolor&0&21': np.array([-0.967167257194905, -0.011919414234523772]),
'versicolor&0&22': np.array([-0.953200964337313, -0.027163424176667752]),
'versicolor&0&23': np.array([-0.8486399726113752, -0.13537345771621853]),
'versicolor&0&24': np.array([-0.9658161779555727, -0.01446062269877741]),
'versicolor&0&25': np.array([-0.9493506964095418, -0.0312186903717912]),
'versicolor&0&26': np.array([-0.7870031444780577, -0.1952404625292782]),
'versicolor&0&27': np.array([-0.9550700362273441, 0.025428672111930138]),
'versicolor&0&28': np.array([-0.9550700362273441, 0.025428672111930138]),
'versicolor&0&29': np.array([-0.9672121512728677, 0.012993005706020341]),
'versicolor&0&30': np.array([-0.19685199412911655, -0.7845879230594393]),
'versicolor&0&31': np.array([-0.07476043598366228, -0.9062715528546994]),
'versicolor&0&32': np.array([-0.7770298852793476, 0.029443430477147536]),
'versicolor&0&33': np.array([-0.7936433456054744, 0.012583752076496493]),
'versicolor&0&34': np.array([-0.7974072911132788, 0.006894018772033604]),
'versicolor&0&35': np.array([-0.07476043598366228, -0.9062715528546994]),
'versicolor&0&36': np.array([-0.7779663027946229, -0.2981599980028888]),
'versicolor&0&37': np.array([-0.6669876551417979, -0.2911996622134135]),
'versicolor&0&38': np.array([-0.3355030348883163, -0.6305271339971502]),
'versicolor&0&39': np.array([-0.7658431164447598, -0.3248317507526541]),
'versicolor&0&40': np.array([-0.6459073168288453, -0.31573292128613833]),
'versicolor&0&41': np.array([-0.2519677855687844, -0.7134447168661863]),
'versicolor&0&42': np.array([-0.7770298852793476, 0.029443430477147536]),
'versicolor&0&43': np.array([-0.7770298852793476, 0.029443430477147536]),
'versicolor&0&44': np.array([-0.7936433456054744, 0.012583752076496493]),
'versicolor&0&45': np.array([0.05031696218434577, -0.929227611211748]),
'versicolor&0&46': np.array([0.017148644765919676, -0.9632117581295891]),
'versicolor&0&47': np.array([0.06151571389390039, 0.524561199322281]),
'versicolor&0&48': np.array([0.4329463382004908, 0.057167210150691136]),
'versicolor&0&49': np.array([0.4656481363306145, 0.007982539480288167]),
'versicolor&0&50': np.array([0.017148644765919676, -0.9632117581295891]),
'versicolor&0&51': np.array([0.6614632074748169, -0.6030419328583525]),
'versicolor&0&52': np.array([0.5519595359123358, -0.6434192906054143]),
'versicolor&0&53': np.array([0.14241819268815753, -0.8424615476000691]),
'versicolor&0&54': np.array([0.667423576348749, -0.6594086777766442]),
'versicolor&0&55': np.array([0.5429872243487625, -0.6697888833280774]),
'versicolor&0&56': np.array([0.1140907502997574, -0.8737800276630269]),
'versicolor&0&57': np.array([0.06151571389390039, 0.524561199322281]),
'versicolor&0&58': np.array([0.06151571389390039, 0.524561199322281]),
'versicolor&0&59': np.array([0.4329463382004908, 0.057167210150691136]),
'versicolor&0&60': np.array([0.029402442458921384, -0.9481684282717414]),
'versicolor&0&61': np.array([0.009887859354111524, -0.9698143912008228]),
'versicolor&0&62': np.array([0.009595083643662688, 0.5643652067423869]),
'versicolor&0&63': np.array([0.13694026920485936, 0.36331091829858003]),
'versicolor&0&64': np.array([0.3094460464703627, 0.11400643817329122]),
'versicolor&0&65': np.array([0.009887859354111524, -0.9698143912008228]),
'versicolor&0&66': np.array([0.42809266524335826, -0.40375108595117376]),
'versicolor&0&67': np.array([0.45547700380103057, -0.6083463409799501]),
'versicolor&0&68': np.array([0.19002455311770447, -0.8848597943731074]),
'versicolor&0&69': np.array([0.436966114193701, -0.4638042290788281]),
'versicolor&0&70': np.array([0.45424510803217066, -0.6425314361631614]),
'versicolor&0&71': np.array([0.1746467870122951, -0.9073062742839755]),
'versicolor&0&72': np.array([0.009595083643662688, 0.5643652067423869]),
'versicolor&0&73': np.array([0.009595083643662688, 0.5643652067423869]),
'versicolor&0&74': np.array([0.13694026920485936, 0.36331091829858003]),
'versicolor&0&75': np.array([0.0, -0.95124502153736]),
'versicolor&0&76': np.array([0.0, -0.9708703761803881]),
'versicolor&0&77': np.array([0.0, 0.5659706098422994]),
'versicolor&0&78': np.array([0.0, 0.3962828716108186]),
'versicolor&0&79': np.array([0.0, 0.2538069363248767]),
'versicolor&0&80': np.array([0.0, -0.9708703761803881]),
'versicolor&0&81': np.array([0.0, -0.3631376646911367]),
'versicolor&0&82': np.array([0.0, -0.5804857652839247]),
'versicolor&0&83': np.array([0.0, -0.8943993997517804]),
'versicolor&0&84': np.array([0.0, -0.4231275527222919]),
'versicolor&0&85': np.array([0.0, -0.6164235822373675]),
'versicolor&0&86': np.array([0.0, -0.9166476163222441]),
'versicolor&0&87': np.array([0.0, 0.5659706098422994]),
'versicolor&0&88': np.array([0.0, 0.5659706098422994]),
'versicolor&0&89': np.array([0.0, 0.3962828716108186]),
'versicolor&0&90': np.array([-0.7431524521056113, -0.24432235603856345]),
'versicolor&0&91': np.array([-0.4926091071260067, -0.49260910712601286]),
'versicolor&0&92': np.array([-0.9550700362273441, 0.025428672111930138]),
'versicolor&0&93': np.array([-0.9672121512728677, 0.012993005706020341]),
'versicolor&0&94': np.array([-0.9706534384443797, 0.007448195602953232]),
'versicolor&0&95': np.array([-0.4926091071260067, -0.49260910712601286]),
'versicolor&0&96': np.array([-0.967167257194905, -0.011919414234523772]),
'versicolor&0&97': np.array([-0.953200964337313, -0.027163424176667752]),
'versicolor&0&98': np.array([-0.8486399726113752, -0.13537345771621853]),
'versicolor&0&99': np.array([-0.9658161779555727, -0.01446062269877741]),
'versicolor&0&100': np.array([-0.9493506964095418, -0.0312186903717912]),
'versicolor&0&101': np.array([-0.7870031444780577, -0.1952404625292782]),
'versicolor&0&102': np.array([-0.9550700362273441, 0.025428672111930138]),
'versicolor&0&103': np.array([-0.9550700362273441, 0.025428672111930138]),
'versicolor&0&104': np.array([-0.9672121512728677, 0.012993005706020341]),
'versicolor&0&105': np.array([-0.19685199412911655, -0.7845879230594393]),
'versicolor&0&106': np.array([-0.07476043598366228, -0.9062715528546994]),
'versicolor&0&107': np.array([-0.7770298852793476, 0.029443430477147536]),
'versicolor&0&108': np.array([-0.7936433456054744, 0.012583752076496493]),
'versicolor&0&109': np.array([-0.7974072911132788, 0.006894018772033604]),
'versicolor&0&110': np.array([-0.07476043598366228, -0.9062715528546994]),
'versicolor&0&111': np.array([-0.7779663027946229, -0.2981599980028888]),
'versicolor&0&112': np.array([-0.6669876551417979, -0.2911996622134135]),
'versicolor&0&113': np.array([-0.3355030348883163, -0.6305271339971502]),
'versicolor&0&114': np.array([-0.7658431164447598, -0.3248317507526541]),
'versicolor&0&115': np.array([-0.6459073168288453, -0.31573292128613833]),
'versicolor&0&116': np.array([-0.2519677855687844, -0.7134447168661863]),
'versicolor&0&117': np.array([-0.7770298852793476, 0.029443430477147536]),
'versicolor&0&118': np.array([-0.7770298852793476, 0.029443430477147536]),
'versicolor&0&119': np.array([-0.7936433456054744, 0.012583752076496493]),
'versicolor&0&120': np.array([-0.05855179950109871, -0.9211684729232403]),
'versicolor&0&121': np.array([-0.020067537725011863, -0.960349531159508]),
'versicolor&0&122': np.array([-0.5775164514598086, 0.6278692602817483]),
'versicolor&0&123': np.array([-0.6813845327458135, 0.6599725404733693]),
'versicolor&0&124': np.array([-0.5182062652425321, 0.3958533237517639]),
'versicolor&0&125': np.array([-0.020067537725011863, -0.960349531159508]),
'versicolor&0&126': np.array([-0.5107107533700952, 0.0075507123577884866]),
'versicolor&0&127': np.array([-0.1464063320531759, -0.4788055402156298]),
'versicolor&0&128': np.array([-0.061109248092233844, -0.8620287767000373]),
'versicolor&0&129': np.array([-0.4706137753079746, -0.057389625790424635]),
'versicolor&0&130': np.array([-0.06804620923037683, -0.5677904519730453]),
'versicolor&0&131': np.array([-0.020216773196675246, -0.9057119888626176]),
'versicolor&0&132': np.array([-0.5775164514598086, 0.6278692602817483]),
'versicolor&0&133': np.array([-0.5775164514598086, 0.6278692602817483]),
'versicolor&0&134': np.array([-0.6813845327458135, 0.6599725404733693]),
'versicolor&0&135': np.array([-0.19684482070614498, -0.7845939961595055]),
'versicolor&0&136': np.array([-0.07475231751447156, -0.9062785678426409]),
'versicolor&0&137': np.array([-0.6782037543706109, 0.2956007367698983]),
'versicolor&0&138': np.array([-0.7694171988675237, 0.276633135028249]),
'versicolor&0&139': np.array([-0.8063011502229427, 0.4134300066735808]),
'versicolor&0&140': np.array([-0.07475231751447156, -0.9062785678426409]),
'versicolor&0&141': np.array([-0.7985789197998611, 0.0026209054759345337]),
'versicolor&0&142': np.array([-0.7182275903095532, -0.11963032135457498]),
'versicolor&0&143': np.array([-0.2798927835773098, -0.6581136857450849]),
'versicolor&0&144': np.array([-0.7920119433269182, -0.0142751249964083]),
'versicolor&0&145': np.array([-0.6943081428778407, -0.14852813120265815]),
'versicolor&0&146': np.array([-0.16106555563262584, -0.777621649099753]),
'versicolor&0&147': np.array([-0.6782037543706109, 0.2956007367698983]),
'versicolor&0&148': np.array([-0.6782037543706109, 0.2956007367698983]),
'versicolor&0&149': np.array([-0.7694171988675237, 0.276633135028249]),
'versicolor&0&150': np.array([-0.7431524521056113, -0.24432235603856345]),
'versicolor&0&151': np.array([-0.4926091071260067, -0.49260910712601286]),
'versicolor&0&152': np.array([-0.9550700362273441, 0.025428672111930138]),
'versicolor&0&153': np.array([-0.9672121512728677, 0.012993005706020341]),
'versicolor&0&154': np.array([-0.9706534384443797, 0.007448195602953232]),
'versicolor&0&155': np.array([-0.4926091071260067, -0.49260910712601286]),
'versicolor&0&156': np.array([-0.967167257194905, -0.011919414234523772]),
'versicolor&0&157': np.array([-0.953200964337313, -0.027163424176667752]),
'versicolor&0&158': np.array([-0.8486399726113752, -0.13537345771621853]),
'versicolor&0&159': np.array([-0.9658161779555727, -0.01446062269877741]),
'versicolor&0&160': np.array([-0.9493506964095418, -0.0312186903717912]),
'versicolor&0&161': np.array([-0.7870031444780577, -0.1952404625292782]),
'versicolor&0&162': np.array([-0.9550700362273441, 0.025428672111930138]),
'versicolor&0&163': np.array([-0.9550700362273441, 0.025428672111930138]),
'versicolor&0&164': np.array([-0.9672121512728677, 0.012993005706020341]),
'versicolor&0&165': np.array([-0.19685199412911655, -0.7845879230594393]),
'versicolor&0&166': np.array([-0.07476043598366228, -0.9062715528546994]),
'versicolor&0&167': np.array([-0.7770298852793476, 0.029443430477147536]),
'versicolor&0&168': np.array([-0.7936433456054744, 0.012583752076496493]),
'versicolor&0&169': np.array([-0.7974072911132788, 0.006894018772033604]),
'versicolor&0&170': np.array([-0.07476043598366228, -0.9062715528546994]),
'versicolor&0&171': np.array([-0.7779663027946229, -0.2981599980028888]),
'versicolor&0&172': np.array([-0.6669876551417979, -0.2911996622134135]),
'versicolor&0&173': np.array([-0.3355030348883163, -0.6305271339971502]),
'versicolor&0&174': np.array([-0.7658431164447598, -0.3248317507526541]),
'versicolor&0&175': np.array([-0.6459073168288453, -0.31573292128613833]),
'versicolor&0&176': np.array([-0.2519677855687844, -0.7134447168661863]),
'versicolor&0&177': np.array([-0.7770298852793476, 0.029443430477147536]),
'versicolor&0&178': np.array([-0.7770298852793476, 0.029443430477147536]),
'versicolor&0&179': np.array([-0.7936433456054744, 0.012583752076496493]),
'versicolor&0&180': np.array([-0.05855179950109871, -0.9211684729232403]),
'versicolor&0&181': np.array([-0.020067537725011863, -0.960349531159508]),
'versicolor&0&182': np.array([-0.5775164514598086, 0.6278692602817483]),
'versicolor&0&183': np.array([-0.6813845327458135, 0.6599725404733693]),
'versicolor&0&184': np.array([-0.5182062652425321, 0.3958533237517639]),
'versicolor&0&185': np.array([-0.020067537725011863, -0.960349531159508]),
'versicolor&0&186': np.array([-0.5107107533700952, 0.0075507123577884866]),
'versicolor&0&187': np.array([-0.1464063320531759, -0.4788055402156298]),
'versicolor&0&188': np.array([-0.061109248092233844, -0.8620287767000373]),
'versicolor&0&189': np.array([-0.4706137753079746, -0.057389625790424635]),
'versicolor&0&190': np.array([-0.06804620923037683, -0.5677904519730453]),
'versicolor&0&191': np.array([-0.020216773196675246, -0.9057119888626176]),
'versicolor&0&192': np.array([-0.5775164514598086, 0.6278692602817483]),
'versicolor&0&193': np.array([-0.5775164514598086, 0.6278692602817483]),
'versicolor&0&194': np.array([-0.6813845327458135, 0.6599725404733693]),
'versicolor&0&195': np.array([-0.19684482070614498, -0.7845939961595055]),
'versicolor&0&196': np.array([-0.07475231751447156, -0.9062785678426409]),
'versicolor&0&197': np.array([-0.6782037543706109, 0.2956007367698983]),
'versicolor&0&198': np.array([-0.7694171988675237, 0.276633135028249]),
'versicolor&0&199': np.array([-0.8063011502229427, 0.4134300066735808]),
'versicolor&0&200': np.array([-0.07475231751447156, -0.9062785678426409]),
'versicolor&0&201': np.array([-0.7985789197998611, 0.0026209054759345337]),
'versicolor&0&202': np.array([-0.7182275903095532, -0.11963032135457498]),
'versicolor&0&203': np.array([-0.2798927835773098, -0.6581136857450849]),
'versicolor&0&204': np.array([-0.7920119433269182, -0.0142751249964083]),
'versicolor&0&205': np.array([-0.6943081428778407, -0.14852813120265815]),
'versicolor&0&206': np.array([-0.16106555563262584, -0.777621649099753]),
'versicolor&0&207': np.array([-0.6782037543706109, 0.2956007367698983]),
'versicolor&0&208': np.array([-0.6782037543706109, 0.2956007367698983]),
'versicolor&0&209': np.array([-0.7694171988675237, 0.276633135028249]),
'versicolor&0&210': np.array([-0.7431524521056113, -0.24432235603856345]),
'versicolor&0&211': np.array([-0.4926091071260067, -0.49260910712601286]),
'versicolor&0&212': np.array([-0.9550700362273441, 0.025428672111930138]),
'versicolor&0&213': np.array([-0.9672121512728677, 0.012993005706020341]),
'versicolor&0&214': np.array([-0.9706534384443797, 0.007448195602953232]),
'versicolor&0&215': np.array([-0.4926091071260067, -0.49260910712601286]),
'versicolor&0&216': np.array([-0.967167257194905, -0.011919414234523772]),
'versicolor&0&217': np.array([-0.953200964337313, -0.027163424176667752]),
'versicolor&0&218': np.array([-0.8486399726113752, -0.13537345771621853]),
'versicolor&0&219': np.array([-0.9658161779555727, -0.01446062269877741]),
'versicolor&0&220': np.array([-0.9493506964095418, -0.0312186903717912]),
'versicolor&0&221': np.array([-0.7870031444780577, -0.1952404625292782]),
'versicolor&0&222': np.array([-0.9550700362273441, 0.025428672111930138]),
'versicolor&0&223': np.array([-0.9550700362273441, 0.025428672111930138]),
'versicolor&0&224': np.array([-0.9672121512728677, 0.012993005706020341]),
'versicolor&0&225': np.array([-0.04777085826693217, -0.931704979630315]),
'versicolor&0&226': np.array([-0.016252316132452975, -0.9640854286687816]),
'versicolor&0&227': np.array([-0.44101924439572626, 0.5583264842761904]),
'versicolor&0&228': np.array([-0.5844994389588399, 0.5715208832363579]),
'versicolor&0&229': np.array([-0.46216647196120714, 0.35468591243823655]),
'versicolor&0&230': np.array([-0.016252316132452975, -0.9640854286687816]),
'versicolor&0&231': np.array([-0.3707180757031537, -0.1977196581472426]),
'versicolor&0&232': np.array([-0.1043459833293615, -0.5233314327065356]),
'versicolor&0&233': np.array([-0.049289647556763364, -0.8736084405111605]),
'versicolor&0&234': np.array([-0.34078174031874375, -0.25874482325965437]),
'versicolor&0&235': np.array([-0.050841051273783675, -0.5877587283589205]),
'versicolor&0&236': np.array([-0.0161720977425142, -0.9096817855236822]),
'versicolor&0&237': np.array([-0.44101924439572626, 0.5583264842761904]),
'versicolor&0&238': np.array([-0.44101924439572626, 0.5583264842761904]),
'versicolor&0&239': np.array([-0.5844994389588399, 0.5715208832363579]),
'versicolor&0&240': np.array([-0.11329659732608087, -0.8671819100849522]),
'versicolor&0&241': np.array([-0.040390637135858574, -0.9402832917474078]),
'versicolor&0&242': np.array([-0.5276460255602035, 0.28992233541586077]),
'versicolor&0&243': np.array([-0.6392402874163683, 0.24114611970435948]),
'versicolor&0&244': np.array([-0.6814868825686854, 0.35066801608083215]),
'versicolor&0&245': np.array([-0.040390637135858574, -0.9402832917474078]),
'versicolor&0&246': np.array([-0.6425009695928476, -0.24851992476830956]),
'versicolor&0&247': np.array([-0.5151243662384031, -0.3255567772442641]),
'versicolor&0&248': np.array([-0.16157511199607094, -0.7754323813403634]),
'versicolor&0&249': np.array([-0.6300442788906601, -0.28361140069713875]),
'versicolor&0&250': np.array([-0.4875864856121089, -0.3614122096616301]),
'versicolor&0&251': np.array([-0.08968204532514226, -0.8491191210330045]),
'versicolor&0&252': np.array([-0.5276460255602035, 0.28992233541586077]),
'versicolor&0&253': np.array([-0.5276460255602035, 0.28992233541586077]),
'versicolor&0&254': np.array([-0.6392402874163683, 0.24114611970435948]),
'versicolor&0&255': np.array([-0.19685199412911655, -0.7845879230594393]),
'versicolor&0&256': np.array([-0.07476043598366228, -0.9062715528546994]),
'versicolor&0&257': np.array([-0.7770298852793476, 0.029443430477147536]),
'versicolor&0&258': np.array([-0.7936433456054744, 0.012583752076496493]),
'versicolor&0&259': np.array([-0.7974072911132788, 0.006894018772033604]),
'versicolor&0&260': np.array([-0.07476043598366228, -0.9062715528546994]),
'versicolor&0&261': np.array([-0.7779663027946229, -0.2981599980028888]),
'versicolor&0&262': np.array([-0.6669876551417979, -0.2911996622134135]),
'versicolor&0&263': np.array([-0.3355030348883163, -0.6305271339971502]),
'versicolor&0&264': np.array([-0.7658431164447598, -0.3248317507526541]),
'versicolor&0&265': np.array([-0.6459073168288453, -0.31573292128613833]),
'versicolor&0&266': np.array([-0.2519677855687844, -0.7134447168661863]),
'versicolor&0&267': np.array([-0.7770298852793476, 0.029443430477147536]),
'versicolor&0&268': np.array([-0.7770298852793476, 0.029443430477147536]),
'versicolor&0&269': np.array([-0.7936433456054744, 0.012583752076496493]),
'versicolor&0&270': np.array([0.05031696218434577, -0.929227611211748]),
'versicolor&0&271': np.array([0.017148644765919676, -0.9632117581295891]),
'versicolor&0&272': np.array([0.06151571389390039, 0.524561199322281]),
'versicolor&0&273': np.array([0.4329463382004908, 0.057167210150691136]),
'versicolor&0&274': np.array([0.4656481363306145, 0.007982539480288167]),
'versicolor&0&275': np.array([0.017148644765919676, -0.9632117581295891]),
'versicolor&0&276': np.array([0.6614632074748169, -0.6030419328583525]),
'versicolor&0&277': np.array([0.5519595359123358, -0.6434192906054143]),
'versicolor&0&278': np.array([0.14241819268815753, -0.8424615476000691]),
'versicolor&0&279': np.array([0.667423576348749, -0.6594086777766442]),
'versicolor&0&280': np.array([0.5429872243487625, -0.6697888833280774]),
'versicolor&0&281': np.array([0.1140907502997574, -0.8737800276630269]),
'versicolor&0&282': np.array([0.06151571389390039, 0.524561199322281]),
'versicolor&0&283': np.array([0.06151571389390039, 0.524561199322281]),
'versicolor&0&284': np.array([0.4329463382004908, 0.057167210150691136]),
'versicolor&0&285': np.array([0.05031696218434577, -0.929227611211748]),
'versicolor&0&286': np.array([0.017148644765919676, -0.9632117581295891]),
'versicolor&0&287': np.array([0.06151571389390039, 0.524561199322281]),
'versicolor&0&288': np.array([0.4329463382004908, 0.057167210150691136]),
'versicolor&0&289': np.array([0.4656481363306145, 0.007982539480288167]),
'versicolor&0&290': np.array([0.017148644765919676, -0.9632117581295891]),
'versicolor&0&291': np.array([0.6614632074748169, -0.6030419328583525]),
'versicolor&0&292': np.array([0.5519595359123358, -0.6434192906054143]),
'versicolor&0&293': np.array([0.14241819268815753, -0.8424615476000691]),
'versicolor&0&294': np.array([0.667423576348749, -0.6594086777766442]),
'versicolor&0&295': np.array([0.5429872243487625, -0.6697888833280774]),
'versicolor&0&296': np.array([0.1140907502997574, -0.8737800276630269]),
'versicolor&0&297': np.array([0.06151571389390039, 0.524561199322281]),
'versicolor&0&298': np.array([0.06151571389390039, 0.524561199322281]),
'versicolor&0&299': np.array([0.4329463382004908, 0.057167210150691136]),
'versicolor&0&300': np.array([0.029402442458921384, -0.9481684282717414]),
'versicolor&0&301': np.array([0.009887859354111524, -0.9698143912008228]),
'versicolor&0&302': np.array([0.009595083643662688, 0.5643652067423869]),
'versicolor&0&303': np.array([0.13694026920485936, 0.36331091829858003]),
'versicolor&0&304': np.array([0.3094460464703627, 0.11400643817329122]),
'versicolor&0&305': np.array([0.009887859354111524, -0.9698143912008228]),
'versicolor&0&306': np.array([0.42809266524335826, -0.40375108595117376]),
'versicolor&0&307': np.array([0.45547700380103057, -0.6083463409799501]),
'versicolor&0&308': np.array([0.19002455311770447, -0.8848597943731074]),
'versicolor&0&309': np.array([0.436966114193701, -0.4638042290788281]),
'versicolor&0&310': np.array([0.45424510803217066, -0.6425314361631614]),
'versicolor&0&311': np.array([0.1746467870122951, -0.9073062742839755]),
'versicolor&0&312': np.array([0.009595083643662688, 0.5643652067423869]),
'versicolor&0&313': np.array([0.009595083643662688, 0.5643652067423869]),
'versicolor&0&314': np.array([0.13694026920485936, 0.36331091829858003]),
'versicolor&1&0': np.array([0.37157553889555184, 0.1221600832023858]),
'versicolor&1&1': np.array([0.2463036871609408, 0.24630368716093934]),
'versicolor&1&2': np.array([0.9105775730167809, 0.6842162738602727]),
'versicolor&1&3': np.array([0.6718337295341267, 0.6620422637360075]),
'versicolor&1&4': np.array([0.4964962439921071, 0.3798215458387346]),
'versicolor&1&5': np.array([0.2463036871609408, 0.24630368716093934]),
'versicolor&1&6': np.array([0.2805345936193346, 0.6595182922149835]),
'versicolor&1&7': np.array([0.08302493125394889, 0.6186280682763334]),
'versicolor&1&8': np.array([0.22125635302655813, 0.2925832702358638]),
'versicolor&1&9': np.array([0.2365788606456636, 0.7120007179768731]),
'versicolor&1&10': np.array([0.022347126801293967, 0.6718013300441928]),
'versicolor&1&11': np.array([0.10063786451829529, 0.4085974066833644]),
'versicolor&1&12': np.array([0.9105775730167809, 0.6842162738602727]),
'versicolor&1&13': np.array([0.9105775730167809, 0.6842162738602727]),
'versicolor&1&14': np.array([0.6718337295341267, 0.6620422637360075]),
'versicolor&1&15': np.array([0.37157553889555184, 0.1221600832023858]),
'versicolor&1&16': np.array([0.2463036871609408, 0.24630368716093934]),
'versicolor&1&17': np.array([0.9105775730167809, 0.6842162738602727]),
'versicolor&1&18': np.array([0.6718337295341267, 0.6620422637360075]),
'versicolor&1&19': np.array([0.4964962439921071, 0.3798215458387346]),
'versicolor&1&20': np.array([0.2463036871609408, 0.24630368716093934]),
'versicolor&1&21': np.array([0.2805345936193346, 0.6595182922149835]),
'versicolor&1&22': np.array([0.08302493125394889, 0.6186280682763334]),
'versicolor&1&23': np.array([0.22125635302655813, 0.2925832702358638]),
'versicolor&1&24': np.array([0.2365788606456636, 0.7120007179768731]),
'versicolor&1&25': np.array([0.022347126801293967, 0.6718013300441928]),
'versicolor&1&26': np.array([0.10063786451829529, 0.4085974066833644]),
'versicolor&1&27': np.array([0.9105775730167809, 0.6842162738602727]),
'versicolor&1&28': np.array([0.9105775730167809, 0.6842162738602727]),
'versicolor&1&29': np.array([0.6718337295341267, 0.6620422637360075]),
'versicolor&1&30': np.array([-0.32199975656257646, 0.7482293552463756]),
'versicolor&1&31': np.array([-0.43843349141088417, 0.8642740701867917]),
'versicolor&1&32': np.array([0.7141739659554727, 0.6619819140152878]),
'versicolor&1&33': np.array([0.44460014335081516, 0.6107546840046902]),
'versicolor&1&34': np.array([0.2619265016777598, 0.33491141590339474]),
'versicolor&1&35': np.array([-0.43843349141088417, 0.8642740701867917]),
'versicolor&1&36': np.array([0.20183015430619713, 0.7445346002055082]),
'versicolor&1&37': np.array([-0.05987874887638573, 0.6927937290176818]),
'versicolor&1&38': np.array([-0.2562642052727569, 0.6920266972283227]),
'versicolor&1&39': np.array([0.1736438124560164, 0.7898174616442941]),
'versicolor&1&40': np.array([-0.10114089899940126, 0.7326610366533243]),
'versicolor&1&41': np.array([-0.34479806250338163, 0.7789143553916729]),
'versicolor&1&42': np.array([0.7141739659554727, 0.6619819140152878]),
'versicolor&1&43': np.array([0.7141739659554727, 0.6619819140152878]),
'versicolor&1&44': np.array([0.44460014335081516, 0.6107546840046902]),
'versicolor&1&45': np.array([0.7749499208750119, 0.8147189440804429]),
'versicolor&1&46': np.array([0.8040309195416899, 0.8445152504134819]),
'versicolor&1&47': np.array([0.5826506963750848, -0.22335655671229107]),
'versicolor&1&48': np.array([0.33108168891715983, 0.13647816746351163]),
'versicolor&1&49': np.array([0.4079256832347186, 0.038455640985860955]),
'versicolor&1&50': np.array([0.8040309195416899, 0.8445152504134819]),
'versicolor&1&51': np.array([0.18555813792691386, 0.6940923833143309]),
'versicolor&1&52': np.array([0.32639262064172164, 0.6296083447134281]),
'versicolor&1&53': np.array([0.6964303997553315, 0.7444536452136676]),
'versicolor&1&54': np.array([0.18216358701833335, 0.747615101407194]),
'versicolor&1&55': np.array([0.33549445287370383, 0.6526039763053625]),
'versicolor&1&56': np.array([0.7213651642695392, 0.7718874443854203]),
'versicolor&1&57': np.array([0.5826506963750848, -0.22335655671229107]),
'versicolor&1&58': np.array([0.5826506963750848, -0.22335655671229107]),
'versicolor&1&59': np.array([0.33108168891715983, 0.13647816746351163]),
'versicolor&1&60': np.array([0.4933316375690332, 0.5272416708629276]),
'versicolor&1&61': np.array([0.5041830043657418, 0.5392782673950876]),
'versicolor&1&62': np.array([0.25657760110071476, 0.12592645350389123]),
'versicolor&1&63': np.array([0.13717260713320106, 0.3627779907901665]),
'versicolor&1&64': np.array([0.3093950298647913, 0.1140298206733954]),
'versicolor&1&65': np.array([0.5041830043657418, 0.5392782673950876]),
'versicolor&1&66': np.array([0.1413116283690917, 0.7479856297394165]),
'versicolor&1&67': np.array([0.189773257421942, 0.6552150653012478]),
'versicolor&1&68': np.array([0.40694846236352233, 0.5109051764198169]),
'versicolor&1&69': np.array([0.1390424906594644, 0.7991613016301518]),
'versicolor&1&70': np.array([0.1945777487290197, 0.6743932844312892]),
'versicolor&1&71': np.array([0.415695226122737, 0.5230815102377903]),
'versicolor&1&72': np.array([0.25657760110071476, 0.12592645350389123]),
'versicolor&1&73': np.array([0.25657760110071476, 0.12592645350389123]),
'versicolor&1&74': np.array([0.13717260713320106, 0.3627779907901665]),
'versicolor&1&75': np.array([0.0, 0.4756207622944677]),
'versicolor&1&76': np.array([0.0, 0.4854334805210761]),
'versicolor&1&77': np.array([0.0, 0.16885577975809635]),
'versicolor&1&78': np.array([0.0, 0.395805885538554]),
'versicolor&1&79': np.array([0.0, 0.2538072707138344]),
'versicolor&1&80': np.array([0.0, 0.4854334805210761]),
'versicolor&1&81': np.array([0.0, 0.7613919530844643]),
'versicolor&1&82': np.array([0.0, 0.6668230985485095]),
'versicolor&1&83': np.array([0.0, 0.4904755652105692]),
'versicolor&1&84': np.array([0.0, 0.8121046082359693]),
'versicolor&1&85': np.array([0.0, 0.6855766903749089]),
'versicolor&1&86': np.array([0.0, 0.5008471974438506]),
'versicolor&1&87': np.array([0.0, 0.16885577975809635]),
'versicolor&1&88': np.array([0.0, 0.16885577975809635]),
'versicolor&1&89': np.array([0.0, 0.395805885538554]),
'versicolor&1&90': np.array([0.37157553889555184, 0.1221600832023858]),
'versicolor&1&91': np.array([0.2463036871609408, 0.24630368716093934]),
'versicolor&1&92': np.array([0.9105775730167809, 0.6842162738602727]),
'versicolor&1&93': np.array([0.6718337295341267, 0.6620422637360075]),
'versicolor&1&94': np.array([0.4964962439921071, 0.3798215458387346]),
'versicolor&1&95': np.array([0.2463036871609408, 0.24630368716093934]),
'versicolor&1&96': np.array([0.2805345936193346, 0.6595182922149835]),
'versicolor&1&97': np.array([0.08302493125394889, 0.6186280682763334]),
'versicolor&1&98': np.array([0.22125635302655813, 0.2925832702358638]),
'versicolor&1&99': np.array([0.2365788606456636, 0.7120007179768731]),
'versicolor&1&100': np.array([0.022347126801293967, 0.6718013300441928]),
'versicolor&1&101': np.array([0.10063786451829529, 0.4085974066833644]),
'versicolor&1&102': np.array([0.9105775730167809, 0.6842162738602727]),
'versicolor&1&103': np.array([0.9105775730167809, 0.6842162738602727]),
'versicolor&1&104': np.array([0.6718337295341267, 0.6620422637360075]),
'versicolor&1&105': np.array([-0.32199975656257646, 0.7482293552463756]),
'versicolor&1&106': np.array([-0.43843349141088417, 0.8642740701867917]),
'versicolor&1&107': np.array([0.7141739659554727, 0.6619819140152878]),
'versicolor&1&108': np.array([0.44460014335081516, 0.6107546840046902]),
'versicolor&1&109': np.array([0.2619265016777598, 0.33491141590339474]),
'versicolor&1&110': np.array([-0.43843349141088417, 0.8642740701867917]),
'versicolor&1&111': np.array([0.20183015430619713, 0.7445346002055082]),
'versicolor&1&112': np.array([-0.05987874887638573, 0.6927937290176818]),
'versicolor&1&113': np.array([-0.2562642052727569, 0.6920266972283227]),
'versicolor&1&114': np.array([0.1736438124560164, 0.7898174616442941]),
'versicolor&1&115': np.array([-0.10114089899940126, 0.7326610366533243]),
'versicolor&1&116': np.array([-0.34479806250338163, 0.7789143553916729]),
'versicolor&1&117': np.array([0.7141739659554727, 0.6619819140152878]),
'versicolor&1&118': np.array([0.7141739659554727, 0.6619819140152878]),
'versicolor&1&119': np.array([0.44460014335081516, 0.6107546840046902]),
'versicolor&1&120': np.array([0.8224435822504677, 0.05315271528828394]),
'versicolor&1&121': np.array([0.820222886307464, 0.055413714884152906]),
'versicolor&1&122': np.array([0.8393089066702096, 0.0788980157959197]),
'versicolor&1&123': np.array([0.8282924295054531, 0.0752641855714259]),
'versicolor&1&124': np.array([0.8476206690613984, 0.02146454924522743]),
'versicolor&1&125': np.array([0.820222886307464, 0.055413714884152906]),
'versicolor&1&126': np.array([0.69362517791403, 0.2579390890424607]),
'versicolor&1&127': np.array([0.7261791877801502, 0.16248655642013624]),
'versicolor&1&128': np.array([0.8190416077589757, 0.05661509439536992]),
'versicolor&1&129': np.array([0.6654762076749751, 0.2949291633432878]),
'versicolor&1&130': np.array([0.7118161070185614, 0.17683644094125878]),
'versicolor&1&131': np.array([0.8165214253946836, 0.059175619390630096]),
'versicolor&1&132': np.array([0.8393089066702096, 0.0788980157959197]),
'versicolor&1&133': np.array([0.8393089066702096, 0.0788980157959197]),
'versicolor&1&134': np.array([0.8282924295054531, 0.0752641855714259]),
'versicolor&1&135': np.array([0.5188109114552927, 0.03638964581864269]),
'versicolor&1&136': np.array([0.5131478569192371, 0.04203387599862816]),
'versicolor&1&137': np.array([0.73294627367007, 0.4610490766898855]),
'versicolor&1&138': np.array([0.5965042032375719, 0.48856644624972617]),
'versicolor&1&139': np.array([0.5436097000280874, 0.1461891067488832]),
'versicolor&1&140': np.array([0.5131478569192371, 0.04203387599862816]),
'versicolor&1&141': np.array([0.32513442685780247, 0.6124765483184536]),
'versicolor&1&142': np.array([0.1812883360919208, 0.5504982486874137]),
'versicolor&1&143': np.array([0.4788153032824012, 0.08625929936974323]),
'versicolor&1&144': np.array([0.28490718210609345, 0.6650298146522879]),
'versicolor&1&145': np.array([0.1313204067730033, 0.597079642504441]),
'versicolor&1&146': np.array([0.46583127837967303, 0.09875847161509169]),
'versicolor&1&147': np.array([0.73294627367007, 0.4610490766898855]),
'versicolor&1&148': np.array([0.73294627367007, 0.4610490766898855]),
'versicolor&1&149': np.array([0.5965042032375719, 0.48856644624972617]),
'versicolor&1&150': np.array([0.37157553889555184, 0.1221600832023858]),
'versicolor&1&151': np.array([0.2463036871609408, 0.24630368716093934]),
'versicolor&1&152': np.array([0.9105775730167809, 0.6842162738602727]),
'versicolor&1&153': np.array([0.6718337295341267, 0.6620422637360075]),
'versicolor&1&154': np.array([0.4964962439921071, 0.3798215458387346]),
'versicolor&1&155': np.array([0.2463036871609408, 0.24630368716093934]),
'versicolor&1&156': np.array([0.2805345936193346, 0.6595182922149835]),
'versicolor&1&157': np.array([0.08302493125394889, 0.6186280682763334]),
'versicolor&1&158': np.array([0.22125635302655813, 0.2925832702358638]),
'versicolor&1&159': np.array([0.2365788606456636, 0.7120007179768731]),
'versicolor&1&160': np.array([0.022347126801293967, 0.6718013300441928]),
'versicolor&1&161': np.array([0.10063786451829529, 0.4085974066833644]),
'versicolor&1&162': np.array([0.9105775730167809, 0.6842162738602727]),
'versicolor&1&163': np.array([0.9105775730167809, 0.6842162738602727]),
'versicolor&1&164': np.array([0.6718337295341267, 0.6620422637360075]),
'versicolor&1&165': np.array([-0.32199975656257646, 0.7482293552463756]),
'versicolor&1&166': np.array([-0.43843349141088417, 0.8642740701867917]),
'versicolor&1&167': np.array([0.7141739659554727, 0.6619819140152878]),
'versicolor&1&168': np.array([0.44460014335081516, 0.6107546840046902]),
'versicolor&1&169': np.array([0.2619265016777598, 0.33491141590339474]),
'versicolor&1&170': np.array([-0.43843349141088417, 0.8642740701867917]),
'versicolor&1&171': np.array([0.20183015430619713, 0.7445346002055082]),
'versicolor&1&172': np.array([-0.05987874887638573, 0.6927937290176818]),
'versicolor&1&173': np.array([-0.2562642052727569, 0.6920266972283227]),
'versicolor&1&174': np.array([0.1736438124560164, 0.7898174616442941]),
'versicolor&1&175': np.array([-0.10114089899940126, 0.7326610366533243]),
'versicolor&1&176': np.array([-0.34479806250338163, 0.7789143553916729]),
'versicolor&1&177': np.array([0.7141739659554727, 0.6619819140152878]),
'versicolor&1&178': np.array([0.7141739659554727, 0.6619819140152878]),
'versicolor&1&179': np.array([0.44460014335081516, 0.6107546840046902]),
'versicolor&1&180': np.array([0.8224435822504677, 0.05315271528828394]),
'versicolor&1&181': np.array([0.820222886307464, 0.055413714884152906]),
'versicolor&1&182': np.array([0.8393089066702096, 0.0788980157959197]),
'versicolor&1&183': np.array([0.8282924295054531, 0.0752641855714259]),
'versicolor&1&184': np.array([0.8476206690613984, 0.02146454924522743]),
'versicolor&1&185': np.array([0.820222886307464, 0.055413714884152906]),
'versicolor&1&186': np.array([0.69362517791403, 0.2579390890424607]),
'versicolor&1&187': np.array([0.7261791877801502, 0.16248655642013624]),
'versicolor&1&188': np.array([0.8190416077589757, 0.05661509439536992]),
'versicolor&1&189': np.array([0.6654762076749751, 0.2949291633432878]),
'versicolor&1&190': np.array([0.7118161070185614, 0.17683644094125878]),
'versicolor&1&191': np.array([0.8165214253946836, 0.059175619390630096]),
'versicolor&1&192': np.array([0.8393089066702096, 0.0788980157959197]),
'versicolor&1&193': np.array([0.8393089066702096, 0.0788980157959197]),
'versicolor&1&194': np.array([0.8282924295054531, 0.0752641855714259]),
'versicolor&1&195': np.array([0.5188109114552927, 0.03638964581864269]),
'versicolor&1&196': np.array([0.5131478569192371, 0.04203387599862816]),
'versicolor&1&197': np.array([0.73294627367007, 0.4610490766898855]),
'versicolor&1&198': np.array([0.5965042032375719, 0.48856644624972617]),
'versicolor&1&199': np.array([0.5436097000280874, 0.1461891067488832]),
'versicolor&1&200': np.array([0.5131478569192371, 0.04203387599862816]),
'versicolor&1&201': np.array([0.32513442685780247, 0.6124765483184536]),
'versicolor&1&202': np.array([0.1812883360919208, 0.5504982486874137]),
'versicolor&1&203': np.array([0.4788153032824012, 0.08625929936974323]),
'versicolor&1&204': np.array([0.28490718210609345, 0.6650298146522879]),
'versicolor&1&205': np.array([0.1313204067730033, 0.597079642504441]),
'versicolor&1&206': np.array([0.46583127837967303, 0.09875847161509169]),
'versicolor&1&207': np.array([0.73294627367007, 0.4610490766898855]),
'versicolor&1&208': np.array([0.73294627367007, 0.4610490766898855]),
'versicolor&1&209': np.array([0.5965042032375719, 0.48856644624972617]),
'versicolor&1&210': np.array([0.37157553889555184, 0.1221600832023858]),
'versicolor&1&211': np.array([0.2463036871609408, 0.24630368716093934]),
'versicolor&1&212': np.array([0.9105775730167809, 0.6842162738602727]),
'versicolor&1&213': np.array([0.6718337295341267, 0.6620422637360075]),
'versicolor&1&214': np.array([0.4964962439921071, 0.3798215458387346]),
'versicolor&1&215': np.array([0.2463036871609408, 0.24630368716093934]),
'versicolor&1&216': np.array([0.2805345936193346, 0.6595182922149835]),
'versicolor&1&217': np.array([0.08302493125394889, 0.6186280682763334]),
'versicolor&1&218': np.array([0.22125635302655813, 0.2925832702358638]),
'versicolor&1&219': np.array([0.2365788606456636, 0.7120007179768731]),
'versicolor&1&220': np.array([0.022347126801293967, 0.6718013300441928]),
'versicolor&1&221': np.array([0.10063786451829529, 0.4085974066833644]),
'versicolor&1&222': np.array([0.9105775730167809, 0.6842162738602727]),
'versicolor&1&223': np.array([0.9105775730167809, 0.6842162738602727]),
'versicolor&1&224': np.array([0.6718337295341267, 0.6620422637360075]),
'versicolor&1&225': np.array([0.6253337666017573, 0.21983620140147825]),
'versicolor&1&226': np.array([0.6178968870349187, 0.22747652768125623]),
'versicolor&1&227': np.array([0.7245803616608639, 0.18141483095066183]),
'versicolor&1&228': np.array([0.6762617119303499, 0.19305674697949574]),
'versicolor&1&229': np.array([0.7182033715159247, 0.0970420677941148]),
'versicolor&1&230': np.array([0.6178968870349187, 0.22747652768125623]),
'versicolor&1&231': np.array([0.4976586558055923, 0.5393318265947251]),
'versicolor&1&232': np.array([0.4361093214026388, 0.4279491486345008]),
'versicolor&1&233': np.array([0.613985959011319, 0.23148898930908424]),
'versicolor&1&234': np.array([0.46747697713468217, 0.586607956360002]),
'versicolor&1&235': np.array([0.41044950174869577, 0.45415985894965977]),
'versicolor&1&236': np.array([0.6057447478066579, 0.23993389556303918]),
'versicolor&1&237': np.array([0.7245803616608639, 0.18141483095066183]),
'versicolor&1&238': np.array([0.7245803616608639, 0.18141483095066183]),
'versicolor&1&239': np.array([0.6762617119303499, 0.19305674697949574]),
'versicolor&1&240': np.array([0.056623968925773045, 0.43360725859686644]),
'versicolor&1&241': np.array([0.020169511418752378, 0.47015948158260334]),
'versicolor&1&242': np.array([0.5806365328450954, 0.47262706807712623]),
'versicolor&1&243': np.array([0.4146290154471569, 0.4964318942067898]),
'versicolor&1&244': np.array([0.3351719071445682, 0.20616862401308342]),
'versicolor&1&245': np.array([0.020169511418752378, 0.47015948158260334]),
'versicolor&1&246': np.array([0.24022705822940116, 0.7185371033867092]),
'versicolor&1&247': np.array([0.010447231513465048, 0.6616528865917504]),
'versicolor&1&248': np.array([0.024556360933646205, 0.4723948285969902]),
'versicolor&1&249': np.array([0.21321406009810842, 0.7648907754638917]),
'versicolor&1&250': np.array([-0.027450681014480036, 0.6999336015080245]),
'versicolor&1&251': np.array([-0.0164329511444131, 0.5132208276383963]),
'versicolor&1&252': np.array([0.5806365328450954, 0.47262706807712623]),
'versicolor&1&253': np.array([0.5806365328450954, 0.47262706807712623]),
'versicolor&1&254': np.array([0.4146290154471569, 0.4964318942067898]),
'versicolor&1&255': np.array([-0.32199975656257646, 0.7482293552463756]),
'versicolor&1&256': np.array([-0.43843349141088417, 0.8642740701867917]),
'versicolor&1&257': np.array([0.7141739659554727, 0.6619819140152878]),
'versicolor&1&258': np.array([0.44460014335081516, 0.6107546840046902]),
'versicolor&1&259': np.array([0.2619265016777598, 0.33491141590339474]),
'versicolor&1&260': np.array([-0.43843349141088417, 0.8642740701867917]),
'versicolor&1&261': np.array([0.20183015430619713, 0.7445346002055082]),
'versicolor&1&262': np.array([-0.05987874887638573, 0.6927937290176818]),
'versicolor&1&263': np.array([-0.2562642052727569, 0.6920266972283227]),
'versicolor&1&264': np.array([0.1736438124560164, 0.7898174616442941]),
'versicolor&1&265': np.array([-0.10114089899940126, 0.7326610366533243]),
'versicolor&1&266': np.array([-0.34479806250338163, 0.7789143553916729]),
'versicolor&1&267': np.array([0.7141739659554727, 0.6619819140152878]),
'versicolor&1&268': np.array([0.7141739659554727, 0.6619819140152878]),
'versicolor&1&269': np.array([0.44460014335081516, 0.6107546840046902]),
'versicolor&1&270': np.array([0.7749499208750119, 0.8147189440804429]),
'versicolor&1&271': np.array([0.8040309195416899, 0.8445152504134819]),
'versicolor&1&272': np.array([0.5826506963750848, -0.22335655671229107]),
'versicolor&1&273': np.array([0.33108168891715983, 0.13647816746351163]),
'versicolor&1&274': np.array([0.4079256832347186, 0.038455640985860955]),
'versicolor&1&275': np.array([0.8040309195416899, 0.8445152504134819]),
'versicolor&1&276': np.array([0.18555813792691386, 0.6940923833143309]),
'versicolor&1&277': np.array([0.32639262064172164, 0.6296083447134281]),
'versicolor&1&278': np.array([0.6964303997553315, 0.7444536452136676]),
'versicolor&1&279': np.array([0.18216358701833335, 0.747615101407194]),
'versicolor&1&280': np.array([0.33549445287370383, 0.6526039763053625]),
'versicolor&1&281': np.array([0.7213651642695392, 0.7718874443854203]),
'versicolor&1&282': np.array([0.5826506963750848, -0.22335655671229107]),
'versicolor&1&283': np.array([0.5826506963750848, -0.22335655671229107]),
'versicolor&1&284': np.array([0.33108168891715983, 0.13647816746351163]),
'versicolor&1&285': np.array([0.7749499208750119, 0.8147189440804429]),
'versicolor&1&286': np.array([0.8040309195416899, 0.8445152504134819]),
'versicolor&1&287': np.array([0.5826506963750848, -0.22335655671229107]),
'versicolor&1&288': np.array([0.33108168891715983, 0.13647816746351163]),
'versicolor&1&289': np.array([0.4079256832347186, 0.038455640985860955]),
'versicolor&1&290': np.array([0.8040309195416899, 0.8445152504134819]),
'versicolor&1&291': np.array([0.18555813792691386, 0.6940923833143309]),
'versicolor&1&292': np.array([0.32639262064172164, 0.6296083447134281]),
'versicolor&1&293': np.array([0.6964303997553315, 0.7444536452136676]),
'versicolor&1&294': np.array([0.18216358701833335, 0.747615101407194]),
'versicolor&1&295': np.array([0.33549445287370383, 0.6526039763053625]),
'versicolor&1&296': np.array([0.7213651642695392, 0.7718874443854203]),
'versicolor&1&297': np.array([0.5826506963750848, -0.22335655671229107]),
'versicolor&1&298': np.array([0.5826506963750848, -0.22335655671229107]),
'versicolor&1&299': np.array([0.33108168891715983, 0.13647816746351163]),
'versicolor&1&300': np.array([0.4933316375690332, 0.5272416708629276]),
'versicolor&1&301': np.array([0.5041830043657418, 0.5392782673950876]),
'versicolor&1&302': np.array([0.25657760110071476, 0.12592645350389123]),
'versicolor&1&303': np.array([0.13717260713320106, 0.3627779907901665]),
'versicolor&1&304': np.array([0.3093950298647913, 0.1140298206733954]),
'versicolor&1&305': np.array([0.5041830043657418, 0.5392782673950876]),
'versicolor&1&306': np.array([0.1413116283690917, 0.7479856297394165]),
'versicolor&1&307': np.array([0.189773257421942, 0.6552150653012478]),
'versicolor&1&308': np.array([0.40694846236352233, 0.5109051764198169]),
'versicolor&1&309': np.array([0.1390424906594644, 0.7991613016301518]),
'versicolor&1&310': np.array([0.1945777487290197, 0.6743932844312892]),
'versicolor&1&311': np.array([0.415695226122737, 0.5230815102377903]),
'versicolor&1&312': np.array([0.25657760110071476, 0.12592645350389123]),
'versicolor&1&313': np.array([0.25657760110071476, 0.12592645350389123]),
'versicolor&1&314': np.array([0.13717260713320106, 0.3627779907901665]),
'versicolor&2&0': np.array([0.37157691321004915, 0.12216227283618836]),
'versicolor&2&1': np.array([0.24630541996506908, 0.24630541996506994]),
'versicolor&2&2': np.array([0.04449246321056282, -0.709644945972203]),
'versicolor&2&3': np.array([0.2953784217387408, -0.6750352694420283]),
'versicolor&2&4': np.array([0.4741571944522723, -0.3872697414416878]),
'versicolor&2&5': np.array([0.24630541996506908, 0.24630541996506994]),
'versicolor&2&6': np.array([0.68663266357557, -0.6475988779804592]),
'versicolor&2&7': np.array([0.8701760330833639, -0.5914646440996656]),
'versicolor&2&8': np.array([0.6273836195848199, -0.15720981251964872]),
'versicolor&2&9': np.array([0.7292373173099087, -0.6975400952780954]),
'versicolor&2&10': np.array([0.9270035696082471, -0.640582639672401]),
'versicolor&2&11': np.array([0.6863652799597699, -0.21335694415409426]),
'versicolor&2&12': np.array([0.04449246321056282, -0.709644945972203]),
'versicolor&2&13': np.array([0.04449246321056282, -0.709644945972203]),
'versicolor&2&14': np.array([0.2953784217387408, -0.6750352694420283]),
'versicolor&2&15': np.array([0.37157691321004915, 0.12216227283618836]),
'versicolor&2&16': np.array([0.24630541996506908, 0.24630541996506994]),
'versicolor&2&17': np.array([0.04449246321056282, -0.709644945972203]),
'versicolor&2&18': np.array([0.2953784217387408, -0.6750352694420283]),
'versicolor&2&19': np.array([0.4741571944522723, -0.3872697414416878]),
'versicolor&2&20': np.array([0.24630541996506908, 0.24630541996506994]),
'versicolor&2&21': np.array([0.68663266357557, -0.6475988779804592]),
'versicolor&2&22': np.array([0.8701760330833639, -0.5914646440996656]),
'versicolor&2&23': np.array([0.6273836195848199, -0.15720981251964872]),
'versicolor&2&24': np.array([0.7292373173099087, -0.6975400952780954]),
'versicolor&2&25': np.array([0.9270035696082471, -0.640582639672401]),
'versicolor&2&26': np.array([0.6863652799597699, -0.21335694415409426]),
'versicolor&2&27': np.array([0.04449246321056282, -0.709644945972203]),
'versicolor&2&28': np.array([0.04449246321056282, -0.709644945972203]),
'versicolor&2&29': np.array([0.2953784217387408, -0.6750352694420283]),
'versicolor&2&30': np.array([0.5188517506916897, 0.036358567813067386]),
'versicolor&2&31': np.array([0.5131939273945454, 0.04199748266790813]),
'versicolor&2&32': np.array([0.06285591932387405, -0.6914253444924359]),
'versicolor&2&33': np.array([0.34904320225465857, -0.6233384360811872]),
'versicolor&2&34': np.array([0.5354807894355184, -0.3418054346754283]),
'versicolor&2&35': np.array([0.5131939273945454, 0.04199748266790813]),
'versicolor&2&36': np.array([0.5761361484884252, -0.44637460220261904]),
'versicolor&2&37': np.array([0.7268664040181829, -0.40159406680426807]),
'versicolor&2&38': np.array([0.5917672401610737, -0.061499563231173816]),
'versicolor&2&39': np.array([0.5921993039887428, -0.46498571089163954]),
'versicolor&2&40': np.array([0.7470482158282458, -0.4169281153671854]),
'versicolor&2&41': np.array([0.5967658480721675, -0.06546963852548916]),
'versicolor&2&42': np.array([0.06285591932387405, -0.6914253444924359]),
'versicolor&2&43': np.array([0.06285591932387405, -0.6914253444924359]),
'versicolor&2&44': np.array([0.34904320225465857, -0.6233384360811872]),
'versicolor&2&45': np.array([-0.8252668830593566, 0.11450866713130668]),
'versicolor&2&46': np.array([-0.8211795643076095, 0.11869650771610692]),
'versicolor&2&47': np.array([-0.6441664102689847, -0.3012046426099901]),
'versicolor&2&48': np.array([-0.7640280271176497, -0.19364537761420375]),
'versicolor&2&49': np.array([-0.8735738195653328, -0.046438180466149094]),
'versicolor&2&50': np.array([-0.8211795643076095, 0.11869650771610692]),
'versicolor&2&51': np.array([-0.8470213454017305, -0.0910504504559782]),
'versicolor&2&52': np.array([-0.8783521565540571, 0.01381094589198601]),
'versicolor&2&53': np.array([-0.8388485924434891, 0.09800790238640067]),
'versicolor&2&54': np.array([-0.8495871633670822, -0.08820642363054954]),
'versicolor&2&55': np.array([-0.8784816772224661, 0.017184907022714958]),
'versicolor&2&56': np.array([-0.835455914569297, 0.10189258327760495]),
'versicolor&2&57': np.array([-0.6441664102689847, -0.3012046426099901]),
'versicolor&2&58': np.array([-0.6441664102689847, -0.3012046426099901]),
'versicolor&2&59': np.array([-0.7640280271176497, -0.19364537761420375]),
'versicolor&2&60': np.array([-0.5227340800279543, 0.4209267574088147]),
'versicolor&2&61': np.array([-0.5140708637198534, 0.4305361238057349]),
'versicolor&2&62': np.array([-0.2661726847443776, -0.6902916602462779]),
'versicolor&2&63': np.array([-0.2741128763380603, -0.7260889090887469]),
'versicolor&2&64': np.array([-0.6188410763351541, -0.22803625884668638]),
'versicolor&2&65': np.array([-0.5140708637198534, 0.4305361238057349]),
'versicolor&2&66': np.array([-0.56940429361245, -0.3442345437882425]),
'versicolor&2&67': np.array([-0.6452502612229726, -0.04686872432129788]),
'versicolor&2&68': np.array([-0.596973015481227, 0.37395461795328944]),
'versicolor&2&69': np.array([-0.5760086048531655, -0.3353570725513232]),
'versicolor&2&70': np.array([-0.6488228567611906, -0.03186184826812757]),
'versicolor&2&71': np.array([-0.5903420131350324, 0.384224764046184]),
'versicolor&2&72': np.array([-0.2661726847443776, -0.6902916602462779]),
'versicolor&2&73': np.array([-0.2661726847443776, -0.6902916602462779]),
'versicolor&2&74': np.array([-0.2741128763380603, -0.7260889090887469]),
'versicolor&2&75': np.array([0.0, 0.47562425924289314]),
'versicolor&2&76': np.array([0.0, 0.4854368956593117]),
'versicolor&2&77': np.array([0.0, -0.7348263896003956]),
'versicolor&2&78': np.array([0.0, -0.7920887571493729]),
'versicolor&2&79': np.array([0.0, -0.507614207038711]),
'versicolor&2&80': np.array([0.0, 0.4854368956593117]),
'versicolor&2&81': np.array([0.0, -0.3982542883933272]),
'versicolor&2&82': np.array([0.0, -0.08633733326458487]),
'versicolor&2&83': np.array([0.0, 0.4039238345412103]),
'versicolor&2&84': np.array([0.0, -0.38897705551367706]),
'versicolor&2&85': np.array([0.0, -0.06915310813754129]),
'versicolor&2&86': np.array([0.0, 0.41580041887839214]),
'versicolor&2&87': np.array([0.0, -0.7348263896003956]),
'versicolor&2&88': np.array([0.0, -0.7348263896003956]),
'versicolor&2&89': np.array([0.0, -0.7920887571493729]),
'versicolor&2&90': np.array([0.37157691321004915, 0.12216227283618836]),
'versicolor&2&91': np.array([0.24630541996506908, 0.24630541996506994]),
'versicolor&2&92': np.array([0.04449246321056282, -0.709644945972203]),
'versicolor&2&93': np.array([0.2953784217387408, -0.6750352694420283]),
'versicolor&2&94': np.array([0.4741571944522723, -0.3872697414416878]),
'versicolor&2&95': np.array([0.24630541996506908, 0.24630541996506994]),
'versicolor&2&96': np.array([0.68663266357557, -0.6475988779804592]),
'versicolor&2&97': np.array([0.8701760330833639, -0.5914646440996656]),
'versicolor&2&98': np.array([0.6273836195848199, -0.15720981251964872]),
'versicolor&2&99': np.array([0.7292373173099087, -0.6975400952780954]),
'versicolor&2&100': np.array([0.9270035696082471, -0.640582639672401]),
'versicolor&2&101': np.array([0.6863652799597699, -0.21335694415409426]),
'versicolor&2&102': np.array([0.04449246321056282, -0.709644945972203]),
'versicolor&2&103': np.array([0.04449246321056282, -0.709644945972203]),
'versicolor&2&104': np.array([0.2953784217387408, -0.6750352694420283]),
'versicolor&2&105': np.array([0.5188517506916897, 0.036358567813067386]),
'versicolor&2&106': np.array([0.5131939273945454, 0.04199748266790813]),
'versicolor&2&107': np.array([0.06285591932387405, -0.6914253444924359]),
'versicolor&2&108': np.array([0.34904320225465857, -0.6233384360811872]),
'versicolor&2&109': np.array([0.5354807894355184, -0.3418054346754283]),
'versicolor&2&110': np.array([0.5131939273945454, 0.04199748266790813]),
'versicolor&2&111': np.array([0.5761361484884252, -0.44637460220261904]),
'versicolor&2&112': np.array([0.7268664040181829, -0.40159406680426807]),
'versicolor&2&113': np.array([0.5917672401610737, -0.061499563231173816]),
'versicolor&2&114': np.array([0.5921993039887428, -0.46498571089163954]),
'versicolor&2&115': np.array([0.7470482158282458, -0.4169281153671854]),
'versicolor&2&116': np.array([0.5967658480721675, -0.06546963852548916]),
'versicolor&2&117': np.array([0.06285591932387405, -0.6914253444924359]),
'versicolor&2&118': np.array([0.06285591932387405, -0.6914253444924359]),
'versicolor&2&119': np.array([0.34904320225465857, -0.6233384360811872]),
'versicolor&2&120': np.array([-0.7638917827493686, 0.868015757634957]),
'versicolor&2&121': np.array([-0.8001553485824509, 0.9049358162753539]),
'versicolor&2&122': np.array([-0.26179245521040034, -0.7067672760776678]),
'versicolor&2&123': np.array([-0.14690789675963867, -0.7352367260447958]),
'versicolor&2&124': np.array([-0.32941440381886555, -0.4173178729969913]),
'versicolor&2&125': np.array([-0.8001553485824509, 0.9049358162753539]),
'versicolor&2&126': np.array([-0.18291442454393395, -0.2654898014002494]),
'versicolor&2&127': np.array([-0.5797728557269727, 0.3163189837954924]),
'versicolor&2&128': np.array([-0.7579323596667402, 0.8054136823046655]),
'versicolor&2&129': np.array([-0.1948624323669993, -0.23753953755286383]),
'versicolor&2&130': np.array([-0.6437698977881832, 0.3909540110317858]),
'versicolor&2&131': np.array([-0.7963046521980063, 0.846536369471985]),
'versicolor&2&132': np.array([-0.26179245521040034, -0.7067672760776678]),
'versicolor&2&133': np.array([-0.26179245521040034, -0.7067672760776678]),
'versicolor&2&134': np.array([-0.14690789675963867, -0.7352367260447958]),
'versicolor&2&135': np.array([-0.3219660907491514, 0.7482043503408669]),
'versicolor&2&136': np.array([-0.43839553940476644, 0.8642446918440131]),
'versicolor&2&137': np.array([-0.05474251929945989, -0.7566498134597841]),
'versicolor&2&138': np.array([0.17291299562995102, -0.7651995812779756]),
'versicolor&2&139': np.array([0.2626914501948546, -0.5596191134224637]),
'versicolor&2&140': np.array([-0.43839553940476644, 0.8642446918440131]),
'versicolor&2&141': np.array([0.4734444929420575, -0.6150974537943872]),
'versicolor&2&142': np.array([0.5369392542176313, -0.430867927332838]),
'versicolor&2&143': np.array([-0.19892251970509112, 0.5718543863753405]),
'versicolor&2&144': np.array([0.5071047612208237, -0.6507546896558788]),
'versicolor&2&145': np.array([0.5629877361048359, -0.4485515113017818]),
'versicolor&2&146': np.array([-0.3047657227470458, 0.6788631774846587]),
'versicolor&2&147': np.array([-0.05474251929945989, -0.7566498134597841]),
'versicolor&2&148': np.array([-0.05474251929945989, -0.7566498134597841]),
'versicolor&2&149': np.array([0.17291299562995102, -0.7651995812779756]),
'versicolor&2&150': np.array([0.37157691321004915, 0.12216227283618836]),
'versicolor&2&151': np.array([0.24630541996506908, 0.24630541996506994]),
'versicolor&2&152': np.array([0.04449246321056282, -0.709644945972203]),
'versicolor&2&153': np.array([0.2953784217387408, -0.6750352694420283]),
'versicolor&2&154': np.array([0.4741571944522723, -0.3872697414416878]),
'versicolor&2&155': np.array([0.24630541996506908, 0.24630541996506994]),
'versicolor&2&156': np.array([0.68663266357557, -0.6475988779804592]),
'versicolor&2&157': np.array([0.8701760330833639, -0.5914646440996656]),
'versicolor&2&158': np.array([0.6273836195848199, -0.15720981251964872]),
'versicolor&2&159': np.array([0.7292373173099087, -0.6975400952780954]),
'versicolor&2&160': np.array([0.9270035696082471, -0.640582639672401]),
'versicolor&2&161': np.array([0.6863652799597699, -0.21335694415409426]),
'versicolor&2&162': np.array([0.04449246321056282, -0.709644945972203]),
'versicolor&2&163': np.array([0.04449246321056282, -0.709644945972203]),
'versicolor&2&164': np.array([0.2953784217387408, -0.6750352694420283]),
'versicolor&2&165': np.array([0.5188517506916897, 0.036358567813067386]),
'versicolor&2&166': np.array([0.5131939273945454, 0.04199748266790813]),
'versicolor&2&167': np.array([0.06285591932387405, -0.6914253444924359]),
'versicolor&2&168': np.array([0.34904320225465857, -0.6233384360811872]),
'versicolor&2&169': np.array([0.5354807894355184, -0.3418054346754283]),
'versicolor&2&170': np.array([0.5131939273945454, 0.04199748266790813]),
'versicolor&2&171': np.array([0.5761361484884252, -0.44637460220261904]),
'versicolor&2&172': np.array([0.7268664040181829, -0.40159406680426807]),
'versicolor&2&173': np.array([0.5917672401610737, -0.061499563231173816]),
'versicolor&2&174': np.array([0.5921993039887428, -0.46498571089163954]),
'versicolor&2&175': np.array([0.7470482158282458, -0.4169281153671854]),
'versicolor&2&176': np.array([0.5967658480721675, -0.06546963852548916]),
'versicolor&2&177': np.array([0.06285591932387405, -0.6914253444924359]),
'versicolor&2&178': np.array([0.06285591932387405, -0.6914253444924359]),
'versicolor&2&179': np.array([0.34904320225465857, -0.6233384360811872]),
'versicolor&2&180': np.array([-0.7638917827493686, 0.868015757634957]),
'versicolor&2&181': np.array([-0.8001553485824509, 0.9049358162753539]),
'versicolor&2&182': np.array([-0.26179245521040034, -0.7067672760776678]),
'versicolor&2&183': np.array([-0.14690789675963867, -0.7352367260447958]),
'versicolor&2&184': np.array([-0.32941440381886555, -0.4173178729969913]),
'versicolor&2&185': np.array([-0.8001553485824509, 0.9049358162753539]),
'versicolor&2&186': np.array([-0.18291442454393395, -0.2654898014002494]),
'versicolor&2&187': np.array([-0.5797728557269727, 0.3163189837954924]),
'versicolor&2&188': np.array([-0.7579323596667402, 0.8054136823046655]),
'versicolor&2&189': np.array([-0.1948624323669993, -0.23753953755286383]),
'versicolor&2&190': np.array([-0.6437698977881832, 0.3909540110317858]),
'versicolor&2&191': np.array([-0.7963046521980063, 0.846536369471985]),
'versicolor&2&192': np.array([-0.26179245521040034, -0.7067672760776678]),
'versicolor&2&193': np.array([-0.26179245521040034, -0.7067672760776678]),
'versicolor&2&194': np.array([-0.14690789675963867, -0.7352367260447958]),
'versicolor&2&195': np.array([-0.3219660907491514, 0.7482043503408669]),
'versicolor&2&196': np.array([-0.43839553940476644, 0.8642446918440131]),
'versicolor&2&197': np.array([-0.05474251929945989, -0.7566498134597841]),
'versicolor&2&198': np.array([0.17291299562995102, -0.7651995812779756]),
'versicolor&2&199': np.array([0.2626914501948546, -0.5596191134224637]),
'versicolor&2&200': np.array([-0.43839553940476644, 0.8642446918440131]),
'versicolor&2&201': np.array([0.4734444929420575, -0.6150974537943872]),
'versicolor&2&202': np.array([0.5369392542176313, -0.430867927332838]),
'versicolor&2&203': np.array([-0.19892251970509112, 0.5718543863753405]),
'versicolor&2&204': np.array([0.5071047612208237, -0.6507546896558788]),
'versicolor&2&205': np.array([0.5629877361048359, -0.4485515113017818]),
'versicolor&2&206': np.array([-0.3047657227470458, 0.6788631774846587]),
'versicolor&2&207': np.array([-0.05474251929945989, -0.7566498134597841]),
'versicolor&2&208': np.array([-0.05474251929945989, -0.7566498134597841]),
'versicolor&2&209': np.array([0.17291299562995102, -0.7651995812779756]),
'versicolor&2&210': np.array([0.37157691321004915, 0.12216227283618836]),
'versicolor&2&211': np.array([0.24630541996506908, 0.24630541996506994]),
'versicolor&2&212': np.array([0.04449246321056282, -0.709644945972203]),
'versicolor&2&213': np.array([0.2953784217387408, -0.6750352694420283]),
'versicolor&2&214': np.array([0.4741571944522723, -0.3872697414416878]),
'versicolor&2&215': np.array([0.24630541996506908, 0.24630541996506994]),
'versicolor&2&216': np.array([0.68663266357557, -0.6475988779804592]),
'versicolor&2&217': np.array([0.8701760330833639, -0.5914646440996656]),
'versicolor&2&218': np.array([0.6273836195848199, -0.15720981251964872]),
'versicolor&2&219': np.array([0.7292373173099087, -0.6975400952780954]),
'versicolor&2&220': np.array([0.9270035696082471, -0.640582639672401]),
'versicolor&2&221': np.array([0.6863652799597699, -0.21335694415409426]),
'versicolor&2&222': np.array([0.04449246321056282, -0.709644945972203]),
'versicolor&2&223': np.array([0.04449246321056282, -0.709644945972203]),
'versicolor&2&224': np.array([0.2953784217387408, -0.6750352694420283]),
'versicolor&2&225': np.array([-0.5775629083348267, 0.7118687782288384]),
'versicolor&2&226': np.array([-0.6016445709024666, 0.7366089009875252]),
'versicolor&2&227': np.array([-0.28356111726513855, -0.739741315226852]),
'versicolor&2&228': np.array([-0.0917622729715107, -0.7645776302158537]),
'versicolor&2&229': np.array([-0.25603689955471853, -0.451727980232351]),
'versicolor&2&230': np.array([-0.6016445709024666, 0.7366089009875252]),
'versicolor&2&231': np.array([-0.1269405801024398, -0.34161216844748166]),
'versicolor&2&232': np.array([-0.33176333807327857, 0.09538228407203546]),
'versicolor&2&233': np.array([-0.564696311454556, 0.6421194512020755]),
'versicolor&2&234': np.array([-0.12669523681593967, -0.32786313310034665]),
'versicolor&2&235': np.array([-0.35960845047491363, 0.1335988694092619]),
'versicolor&2&236': np.array([-0.589572650064144, 0.6697478899606418]),
'versicolor&2&237': np.array([-0.28356111726513855, -0.739741315226852]),
'versicolor&2&238': np.array([-0.28356111726513855, -0.739741315226852]),
'versicolor&2&239': np.array([-0.0917622729715107, -0.7645776302158537]),
'versicolor&2&240': np.array([0.05667262840030629, 0.4335746514880877]),
'versicolor&2&241': np.array([0.0202211257171063, 0.470123810164804]),
'versicolor&2&242': np.array([-0.052990507284891984, -0.7625494034929868]),
'versicolor&2&243': np.array([0.22461127196921116, -0.7375780139111495]),
'versicolor&2&244': np.array([0.3463149754241171, -0.5568366400939154]),
'versicolor&2&245': np.array([0.0202211257171063, 0.470123810164804]),
'versicolor&2&246': np.array([0.4022739113634462, -0.4700171786183992]),
'versicolor&2&247': np.array([0.5046771347249378, -0.33609610934748635]),
'versicolor&2&248': np.array([0.1370187510624256, 0.30303755274337163]),
'versicolor&2&249': np.array([0.41683021879255133, -0.4812793747667524]),
'versicolor&2&250': np.array([0.5150371666265885, -0.33852139184639396]),
'versicolor&2&251': np.array([0.10611499646955676, 0.33589829339460586]),
'versicolor&2&252': np.array([-0.052990507284891984, -0.7625494034929868]),
'versicolor&2&253': np.array([-0.052990507284891984, -0.7625494034929868]),
'versicolor&2&254': np.array([0.22461127196921116, -0.7375780139111495]),
'versicolor&2&255': np.array([0.5188517506916897, 0.036358567813067386]),
'versicolor&2&256': np.array([0.5131939273945454, 0.04199748266790813]),
'versicolor&2&257': np.array([0.06285591932387405, -0.6914253444924359]),
'versicolor&2&258': np.array([0.34904320225465857, -0.6233384360811872]),
'versicolor&2&259': np.array([0.5354807894355184, -0.3418054346754283]),
'versicolor&2&260': np.array([0.5131939273945454, 0.04199748266790813]),
'versicolor&2&261': np.array([0.5761361484884252, -0.44637460220261904]),
'versicolor&2&262': np.array([0.7268664040181829, -0.40159406680426807]),
'versicolor&2&263': np.array([0.5917672401610737, -0.061499563231173816]),
'versicolor&2&264': np.array([0.5921993039887428, -0.46498571089163954]),
'versicolor&2&265': np.array([0.7470482158282458, -0.4169281153671854]),
'versicolor&2&266': np.array([0.5967658480721675, -0.06546963852548916]),
'versicolor&2&267': np.array([0.06285591932387405, -0.6914253444924359]),
'versicolor&2&268': np.array([0.06285591932387405, -0.6914253444924359]),
'versicolor&2&269': np.array([0.34904320225465857, -0.6233384360811872]),
'versicolor&2&270': np.array([-0.8252668830593566, 0.11450866713130668]),
'versicolor&2&271': np.array([-0.8211795643076095, 0.11869650771610692]),
'versicolor&2&272': np.array([-0.6441664102689847, -0.3012046426099901]),
'versicolor&2&273': np.array([-0.7640280271176497, -0.19364537761420375]),
'versicolor&2&274': np.array([-0.8735738195653328, -0.046438180466149094]),
'versicolor&2&275': np.array([-0.8211795643076095, 0.11869650771610692]),
'versicolor&2&276': np.array([-0.8470213454017305, -0.0910504504559782]),
'versicolor&2&277': np.array([-0.8783521565540571, 0.01381094589198601]),
'versicolor&2&278': np.array([-0.8388485924434891, 0.09800790238640067]),
'versicolor&2&279': np.array([-0.8495871633670822, -0.08820642363054954]),
'versicolor&2&280': np.array([-0.8784816772224661, 0.017184907022714958]),
'versicolor&2&281': np.array([-0.835455914569297, 0.10189258327760495]),
'versicolor&2&282': np.array([-0.6441664102689847, -0.3012046426099901]),
'versicolor&2&283': np.array([-0.6441664102689847, -0.3012046426099901]),
'versicolor&2&284': np.array([-0.7640280271176497, -0.19364537761420375]),
'versicolor&2&285': np.array([-0.8252668830593566, 0.11450866713130668]),
'versicolor&2&286': np.array([-0.8211795643076095, 0.11869650771610692]),
'versicolor&2&287': np.array([-0.6441664102689847, -0.3012046426099901]),
'versicolor&2&288': np.array([-0.7640280271176497, -0.19364537761420375]),
'versicolor&2&289': np.array([-0.8735738195653328, -0.046438180466149094]),
'versicolor&2&290': np.array([-0.8211795643076095, 0.11869650771610692]),
'versicolor&2&291': np.array([-0.8470213454017305, -0.0910504504559782]),
'versicolor&2&292': np.array([-0.8783521565540571, 0.01381094589198601]),
'versicolor&2&293': np.array([-0.8388485924434891, 0.09800790238640067]),
'versicolor&2&294': np.array([-0.8495871633670822, -0.08820642363054954]),
'versicolor&2&295': np.array([-0.8784816772224661, 0.017184907022714958]),
'versicolor&2&296': np.array([-0.835455914569297, 0.10189258327760495]),
'versicolor&2&297': np.array([-0.6441664102689847, -0.3012046426099901]),
'versicolor&2&298': np.array([-0.6441664102689847, -0.3012046426099901]),
'versicolor&2&299': np.array([-0.7640280271176497, -0.19364537761420375]),
'versicolor&2&300': np.array([-0.5227340800279543, 0.4209267574088147]),
'versicolor&2&301': np.array([-0.5140708637198534, 0.4305361238057349]),
'versicolor&2&302': np.array([-0.2661726847443776, -0.6902916602462779]),
'versicolor&2&303': np.array([-0.2741128763380603, -0.7260889090887469]),
'versicolor&2&304': np.array([-0.6188410763351541, -0.22803625884668638]),
'versicolor&2&305': np.array([-0.5140708637198534, 0.4305361238057349]),
'versicolor&2&306': np.array([-0.56940429361245, -0.3442345437882425]),
'versicolor&2&307': np.array([-0.6452502612229726, -0.04686872432129788]),
'versicolor&2&308': np.array([-0.596973015481227, 0.37395461795328944]),
'versicolor&2&309': np.array([-0.5760086048531655, -0.3353570725513232]),
'versicolor&2&310': np.array([-0.6488228567611906, -0.03186184826812757]),
'versicolor&2&311': np.array([-0.5903420131350324, 0.384224764046184]),
'versicolor&2&312': np.array([-0.2661726847443776, -0.6902916602462779]),
'versicolor&2&313': np.array([-0.2661726847443776, -0.6902916602462779]),
'versicolor&2&314': np.array([-0.2741128763380603, -0.7260889090887469]),
'virginica&0&0': np.array([-0.7431524521056113, -0.24432235603856345]),
'virginica&0&1': np.array([-0.4926091071260067, -0.49260910712601286]),
'virginica&0&2': np.array([-0.9550700362273441, -0.025428672111930138]),
'virginica&0&3': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&4': np.array([-0.9706534384443797, 0.007448195602953232]),
'virginica&0&5': np.array([-0.4926091071260067, -0.49260910712601286]),
'virginica&0&6': np.array([-0.9550700362273441, -0.025428672111930138]),
'virginica&0&7': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&8': np.array([-0.8486399726113752, -0.13537345771621853]),
'virginica&0&9': np.array([-0.9550700362273441, -0.025428672111930138]),
'virginica&0&10': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&11': np.array([-0.7870031444780577, -0.1952404625292782]),
'virginica&0&12': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&13': np.array([-0.9569238464170641, -0.02354905845282574]),
'virginica&0&14': np.array([-0.9677320606992984, -0.012432557482778654]),
'virginica&0&15': np.array([-0.7431524521056113, -0.24432235603856345]),
'virginica&0&16': np.array([-0.4926091071260067, -0.49260910712601286]),
'virginica&0&17': np.array([-0.9550700362273441, -0.025428672111930138]),
'virginica&0&18': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&19': np.array([-0.9706534384443797, 0.007448195602953232]),
'virginica&0&20': np.array([-0.4926091071260067, -0.49260910712601286]),
'virginica&0&21': np.array([-0.9550700362273441, -0.025428672111930138]),
'virginica&0&22': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&23': np.array([-0.8486399726113752, -0.13537345771621853]),
'virginica&0&24': np.array([-0.9550700362273441, -0.025428672111930138]),
'virginica&0&25': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&26': np.array([-0.7870031444780577, -0.1952404625292782]),
'virginica&0&27': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&28': np.array([-0.9569238464170641, -0.02354905845282574]),
'virginica&0&29': np.array([-0.9677320606992984, -0.012432557482778654]),
'virginica&0&30': np.array([-0.19685199412911655, -0.7845879230594393]),
'virginica&0&31': np.array([-0.07476043598366228, -0.9062715528546994]),
'virginica&0&32': np.array([-0.7770298852793477, -0.029443430477147373]),
'virginica&0&33': np.array([-0.7936433456054744, -0.012583752076496493]),
'virginica&0&34': np.array([-0.7974072911132788, 0.006894018772033604]),
'virginica&0&35': np.array([-0.07476043598366228, -0.9062715528546994]),
'virginica&0&36': np.array([-0.7770298852793477, -0.029443430477147373]),
'virginica&0&37': np.array([-0.7936433456054744, -0.012583752076496493]),
'virginica&0&38': np.array([-0.3355030348883163, -0.6305271339971502]),
'virginica&0&39': np.array([-0.7770298852793477, -0.029443430477147373]),
'virginica&0&40': np.array([-0.7936433456054744, -0.012583752076496493]),
'virginica&0&41': np.array([-0.2519677855687844, -0.7134447168661863]),
'virginica&0&42': np.array([-0.7936433456054744, -0.012583752076496493]),
'virginica&0&43': np.array([-0.7799744386472778, -0.026476616324402506]),
'virginica&0&44': np.array([-0.7942342242967624, -0.0119572163963601]),
'virginica&0&45': np.array([-0.05031696218434577, -0.929227611211748]),
'virginica&0&46': np.array([-0.017148644765919676, -0.9632117581295891]),
'virginica&0&47': np.array([-0.061515713893900315, -0.524561199322281]),
'virginica&0&48': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&49': np.array([-0.4656481363306145, 0.007982539480288167]),
'virginica&0&50': np.array([-0.017148644765919676, -0.9632117581295891]),
'virginica&0&51': np.array([-0.061515713893900315, -0.524561199322281]),
'virginica&0&52': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&53': np.array([-0.14241819268815753, -0.8424615476000691]),
'virginica&0&54': np.array([-0.061515713893900315, -0.524561199322281]),
'virginica&0&55': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&56': np.array([-0.1140907502997574, -0.8737800276630269]),
'virginica&0&57': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&58': np.array([-0.14198277461566922, -0.4577720226157396]),
'virginica&0&59': np.array([-0.4385442121294165, -0.05333645823279597]),
'virginica&0&60': np.array([0.029402442458921384, -0.9481684282717414]),
'virginica&0&61': np.array([0.009887859354111524, -0.9698143912008228]),
'virginica&0&62': np.array([0.009595083643662688, -0.5643652067423869]),
'virginica&0&63': np.array([0.13694026920485936, -0.36331091829858003]),
'virginica&0&64': np.array([0.3094460464703627, 0.11400643817329122]),
'virginica&0&65': np.array([0.009887859354111524, -0.9698143912008228]),
'virginica&0&66': np.array([0.009595083643662688, -0.5643652067423869]),
'virginica&0&67': np.array([0.13694026920485936, -0.36331091829858003]),
'virginica&0&68': np.array([0.19002455311770447, -0.8848597943731074]),
'virginica&0&69': np.array([0.009595083643662688, -0.5643652067423869]),
'virginica&0&70': np.array([0.13694026920485936, -0.36331091829858003]),
'virginica&0&71': np.array([0.1746467870122951, -0.9073062742839755]),
'virginica&0&72': np.array([0.13694026920485936, -0.36331091829858003]),
'virginica&0&73': np.array([0.11200181312407695, -0.5330612470996793]),
'virginica&0&74': np.array([0.19998284600732558, -0.3489062419702088]),
'virginica&0&75': np.array([0.0, -0.95124502153736]),
'virginica&0&76': np.array([0.0, -0.9708703761803881]),
'virginica&0&77': np.array([0.0, -0.5659706098422994]),
'virginica&0&78': np.array([0.0, -0.3962828716108186]),
'virginica&0&79': np.array([0.0, 0.2538069363248767]),
'virginica&0&80': np.array([0.0, -0.9708703761803881]),
'virginica&0&81': np.array([0.0, -0.5659706098422994]),
'virginica&0&82': np.array([0.0, -0.3962828716108186]),
'virginica&0&83': np.array([0.0, -0.8943993997517804]),
'virginica&0&84': np.array([0.0, -0.5659706098422994]),
'virginica&0&85': np.array([0.0, -0.3962828716108186]),
'virginica&0&86': np.array([0.0, -0.9166476163222441]),
'virginica&0&87': np.array([0.0, -0.3962828716108186]),
'virginica&0&88': np.array([0.0, -0.5466925844560601]),
'virginica&0&89': np.array([0.0, -0.38529908946531777]),
'virginica&0&90': np.array([-0.7431524521056113, -0.24432235603856345]),
'virginica&0&91': np.array([-0.4926091071260067, -0.49260910712601286]),
'virginica&0&92': np.array([-0.9550700362273441, -0.025428672111930138]),
'virginica&0&93': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&94': np.array([-0.9706534384443797, 0.007448195602953232]),
'virginica&0&95': np.array([-0.4926091071260067, -0.49260910712601286]),
'virginica&0&96': np.array([-0.9550700362273441, -0.025428672111930138]),
'virginica&0&97': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&98': np.array([-0.8486399726113752, -0.13537345771621853]),
'virginica&0&99': np.array([-0.9550700362273441, -0.025428672111930138]),
'virginica&0&100': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&101': np.array([-0.7870031444780577, -0.1952404625292782]),
'virginica&0&102': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&103': np.array([-0.9569238464170641, -0.02354905845282574]),
'virginica&0&104': np.array([-0.9677320606992984, -0.012432557482778654]),
'virginica&0&105': np.array([-0.19685199412911655, -0.7845879230594393]),
'virginica&0&106': np.array([-0.07476043598366228, -0.9062715528546994]),
'virginica&0&107': np.array([-0.7770298852793477, -0.029443430477147373]),
'virginica&0&108': np.array([-0.7936433456054744, -0.012583752076496493]),
'virginica&0&109': np.array([-0.7974072911132788, 0.006894018772033604]),
'virginica&0&110': np.array([-0.07476043598366228, -0.9062715528546994]),
'virginica&0&111': np.array([-0.7770298852793477, -0.029443430477147373]),
'virginica&0&112': np.array([-0.7936433456054744, -0.012583752076496493]),
'virginica&0&113': np.array([-0.3355030348883163, -0.6305271339971502]),
'virginica&0&114': np.array([-0.7770298852793477, -0.029443430477147373]),
'virginica&0&115': np.array([-0.7936433456054744, -0.012583752076496493]),
'virginica&0&116': np.array([-0.2519677855687844, -0.7134447168661863]),
'virginica&0&117': np.array([-0.7936433456054744, -0.012583752076496493]),
'virginica&0&118': np.array([-0.7799744386472778, -0.026476616324402506]),
'virginica&0&119': np.array([-0.7942342242967624, -0.0119572163963601]),
'virginica&0&120': np.array([-0.05031696218434577, -0.929227611211748]),
'virginica&0&121': np.array([-0.017148644765919676, -0.9632117581295891]),
'virginica&0&122': np.array([-0.061515713893900315, -0.524561199322281]),
'virginica&0&123': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&124': np.array([-0.4656481363306145, 0.007982539480288167]),
'virginica&0&125': np.array([-0.017148644765919676, -0.9632117581295891]),
'virginica&0&126': np.array([-0.061515713893900315, -0.524561199322281]),
'virginica&0&127': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&128': np.array([-0.14241819268815753, -0.8424615476000691]),
'virginica&0&129': np.array([-0.061515713893900315, -0.524561199322281]),
'virginica&0&130': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&131': np.array([-0.1140907502997574, -0.8737800276630269]),
'virginica&0&132': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&133': np.array([-0.14198277461566922, -0.4577720226157396]),
'virginica&0&134': np.array([-0.4385442121294165, -0.05333645823279597]),
'virginica&0&135': np.array([-0.19684482070614498, -0.7845939961595055]),
'virginica&0&136': np.array([-0.07475231751447156, -0.9062785678426409]),
'virginica&0&137': np.array([-0.6782037543706109, -0.29560073676989834]),
'virginica&0&138': np.array([-0.7694171988675237, -0.276633135028249]),
'virginica&0&139': np.array([-0.8063011502229427, 0.4134300066735808]),
'virginica&0&140': np.array([-0.07475231751447156, -0.9062785678426409]),
'virginica&0&141': np.array([-0.6782037543706109, -0.29560073676989834]),
'virginica&0&142': np.array([-0.7694171988675237, -0.276633135028249]),
'virginica&0&143': np.array([-0.2798927835773098, -0.6581136857450849]),
'virginica&0&144': np.array([-0.6782037543706109, -0.29560073676989834]),
'virginica&0&145': np.array([-0.7694171988675237, -0.276633135028249]),
'virginica&0&146': np.array([-0.16106555563262584, -0.777621649099753]),
'virginica&0&147': np.array([-0.7694171988675237, -0.276633135028249]),
'virginica&0&148': np.array([-0.6898990333725056, -0.2534947697713122]),
'virginica&0&149': np.array([-0.769491694075929, -0.22884642137519118]),
'virginica&0&150': np.array([-0.7431524521056113, -0.24432235603856345]),
'virginica&0&151': np.array([-0.4926091071260067, -0.49260910712601286]),
'virginica&0&152': np.array([-0.9550700362273441, -0.025428672111930138]),
'virginica&0&153': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&154': np.array([-0.9706534384443797, 0.007448195602953232]),
'virginica&0&155': np.array([-0.4926091071260067, -0.49260910712601286]),
'virginica&0&156': np.array([-0.9550700362273441, -0.025428672111930138]),
'virginica&0&157': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&158': np.array([-0.8486399726113752, -0.13537345771621853]),
'virginica&0&159': np.array([-0.9550700362273441, -0.025428672111930138]),
'virginica&0&160': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&161': np.array([-0.7870031444780577, -0.1952404625292782]),
'virginica&0&162': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&163': np.array([-0.9569238464170641, -0.02354905845282574]),
'virginica&0&164': np.array([-0.9677320606992984, -0.012432557482778654]),
'virginica&0&165': np.array([-0.19685199412911655, -0.7845879230594393]),
'virginica&0&166': np.array([-0.07476043598366228, -0.9062715528546994]),
'virginica&0&167': np.array([-0.7770298852793477, -0.029443430477147373]),
'virginica&0&168': np.array([-0.7936433456054744, -0.012583752076496493]),
'virginica&0&169': np.array([-0.7974072911132788, 0.006894018772033604]),
'virginica&0&170': np.array([-0.07476043598366228, -0.9062715528546994]),
'virginica&0&171': np.array([-0.7770298852793477, -0.029443430477147373]),
'virginica&0&172': np.array([-0.7936433456054744, -0.012583752076496493]),
'virginica&0&173': np.array([-0.3355030348883163, -0.6305271339971502]),
'virginica&0&174': np.array([-0.7770298852793477, -0.029443430477147373]),
'virginica&0&175': np.array([-0.7936433456054744, -0.012583752076496493]),
'virginica&0&176': np.array([-0.2519677855687844, -0.7134447168661863]),
'virginica&0&177': np.array([-0.7936433456054744, -0.012583752076496493]),
'virginica&0&178': np.array([-0.7799744386472778, -0.026476616324402506]),
'virginica&0&179': np.array([-0.7942342242967624, -0.0119572163963601]),
'virginica&0&180': np.array([-0.05031696218434577, -0.929227611211748]),
'virginica&0&181': np.array([-0.017148644765919676, -0.9632117581295891]),
'virginica&0&182': np.array([-0.061515713893900315, -0.524561199322281]),
'virginica&0&183': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&184': np.array([-0.4656481363306145, 0.007982539480288167]),
'virginica&0&185': np.array([-0.017148644765919676, -0.9632117581295891]),
'virginica&0&186': np.array([-0.061515713893900315, -0.524561199322281]),
'virginica&0&187': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&188': np.array([-0.14241819268815753, -0.8424615476000691]),
'virginica&0&189': np.array([-0.061515713893900315, -0.524561199322281]),
'virginica&0&190': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&191': np.array([-0.1140907502997574, -0.8737800276630269]),
'virginica&0&192': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&193': np.array([-0.14198277461566922, -0.4577720226157396]),
'virginica&0&194': np.array([-0.4385442121294165, -0.05333645823279597]),
'virginica&0&195': np.array([-0.19684482070614498, -0.7845939961595055]),
'virginica&0&196': np.array([-0.07475231751447156, -0.9062785678426409]),
'virginica&0&197': np.array([-0.6782037543706109, -0.29560073676989834]),
'virginica&0&198': np.array([-0.7694171988675237, -0.276633135028249]),
'virginica&0&199': np.array([-0.8063011502229427, 0.4134300066735808]),
'virginica&0&200': np.array([-0.07475231751447156, -0.9062785678426409]),
'virginica&0&201': np.array([-0.6782037543706109, -0.29560073676989834]),
'virginica&0&202': np.array([-0.7694171988675237, -0.276633135028249]),
'virginica&0&203': np.array([-0.2798927835773098, -0.6581136857450849]),
'virginica&0&204': np.array([-0.6782037543706109, -0.29560073676989834]),
'virginica&0&205': np.array([-0.7694171988675237, -0.276633135028249]),
'virginica&0&206': np.array([-0.16106555563262584, -0.777621649099753]),
'virginica&0&207': np.array([-0.7694171988675237, -0.276633135028249]),
'virginica&0&208': np.array([-0.6898990333725056, -0.2534947697713122]),
'virginica&0&209': np.array([-0.769491694075929, -0.22884642137519118]),
'virginica&0&210': np.array([-0.7431524521056113, -0.24432235603856345]),
'virginica&0&211': np.array([-0.4926091071260067, -0.49260910712601286]),
'virginica&0&212': np.array([-0.9550700362273441, -0.025428672111930138]),
'virginica&0&213': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&214': np.array([-0.9706534384443797, 0.007448195602953232]),
'virginica&0&215': np.array([-0.4926091071260067, -0.49260910712601286]),
'virginica&0&216': np.array([-0.9550700362273441, -0.025428672111930138]),
'virginica&0&217': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&218': np.array([-0.8486399726113752, -0.13537345771621853]),
'virginica&0&219': np.array([-0.9550700362273441, -0.025428672111930138]),
'virginica&0&220': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&221': np.array([-0.7870031444780577, -0.1952404625292782]),
'virginica&0&222': np.array([-0.9672121512728677, -0.012993005706020504]),
'virginica&0&223': np.array([-0.9569238464170641, -0.02354905845282574]),
'virginica&0&224': np.array([-0.9677320606992984, -0.012432557482778654]),
'virginica&0&225': np.array([-0.05031696218434577, -0.929227611211748]),
'virginica&0&226': np.array([-0.017148644765919676, -0.9632117581295891]),
'virginica&0&227': np.array([-0.061515713893900315, -0.524561199322281]),
'virginica&0&228': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&229': np.array([-0.4656481363306145, 0.007982539480288167]),
'virginica&0&230': np.array([-0.017148644765919676, -0.9632117581295891]),
'virginica&0&231': np.array([-0.061515713893900315, -0.524561199322281]),
'virginica&0&232': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&233': np.array([-0.14241819268815753, -0.8424615476000691]),
'virginica&0&234': np.array([-0.061515713893900315, -0.524561199322281]),
'virginica&0&235': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&236': np.array([-0.1140907502997574, -0.8737800276630269]),
'virginica&0&237': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&238': np.array([-0.14198277461566922, -0.4577720226157396]),
'virginica&0&239': np.array([-0.4385442121294165, -0.05333645823279597]),
'virginica&0&240': np.array([-0.11329659732608087, -0.8671819100849522]),
'virginica&0&241': np.array([-0.040390637135858574, -0.9402832917474078]),
'virginica&0&242': np.array([-0.5276460255602035, -0.28992233541586077]),
'virginica&0&243': np.array([-0.6392402874163683, -0.24114611970435948]),
'virginica&0&244': np.array([-0.6814868825686854, 0.35066801608083215]),
'virginica&0&245': np.array([-0.040390637135858574, -0.9402832917474078]),
'virginica&0&246': np.array([-0.5276460255602035, -0.28992233541586077]),
'virginica&0&247': np.array([-0.6392402874163683, -0.24114611970435948]),
'virginica&0&248': np.array([-0.16157511199607094, -0.7754323813403634]),
'virginica&0&249': np.array([-0.5276460255602035, -0.28992233541586077]),
'virginica&0&250': np.array([-0.6392402874163683, -0.24114611970435948]),
'virginica&0&251': np.array([-0.08968204532514226, -0.8491191210330045]),
'virginica&0&252': np.array([-0.6392402874163683, -0.24114611970435948]),
'virginica&0&253': np.array([-0.544626974647221, -0.24972982107967573]),
'virginica&0&254': np.array([-0.6426355680762406, -0.20016519137103667]),
'virginica&0&255': np.array([-0.19685199412911655, -0.7845879230594393]),
'virginica&0&256': np.array([-0.07476043598366228, -0.9062715528546994]),
'virginica&0&257': np.array([-0.7770298852793477, -0.029443430477147373]),
'virginica&0&258': np.array([-0.7936433456054744, -0.012583752076496493]),
'virginica&0&259': np.array([-0.7974072911132788, 0.006894018772033604]),
'virginica&0&260': np.array([-0.07476043598366228, -0.9062715528546994]),
'virginica&0&261': np.array([-0.7770298852793477, -0.029443430477147373]),
'virginica&0&262': np.array([-0.7936433456054744, -0.012583752076496493]),
'virginica&0&263': np.array([-0.3355030348883163, -0.6305271339971502]),
'virginica&0&264': np.array([-0.7770298852793477, -0.029443430477147373]),
'virginica&0&265': np.array([-0.7936433456054744, -0.012583752076496493]),
'virginica&0&266': np.array([-0.2519677855687844, -0.7134447168661863]),
'virginica&0&267': np.array([-0.7936433456054744, -0.012583752076496493]),
'virginica&0&268': np.array([-0.7799744386472778, -0.026476616324402506]),
'virginica&0&269': np.array([-0.7942342242967624, -0.0119572163963601]),
'virginica&0&270': np.array([-0.04201361383207032, -0.9372571358382161]),
'virginica&0&271': np.array([-0.014237661899709955, -0.9660323357290304]),
'virginica&0&272': np.array([-0.04813346258022244, -0.5416229439456887]),
'virginica&0&273': np.array([-0.3109532939139045, -0.22759134703604383]),
'virginica&0&274': np.array([-0.4167677904879879, 0.22207334821665425]),
'virginica&0&275': np.array([-0.014237661899709955, -0.9660323357290304]),
'virginica&0&276': np.array([-0.04813346258022244, -0.5416229439456887]),
'virginica&0&277': np.array([-0.3109532939139045, -0.22759134703604383]),
'virginica&0&278': np.array([-0.07857689135903215, -0.8696882596532965]),
'virginica&0&279': np.array([-0.04813346258022244, -0.5416229439456887]),
'virginica&0&280': np.array([-0.3109532939139045, -0.22759134703604383]),
'virginica&0&281': np.array([-0.05160969201296555, -0.9000166344885441]),
'virginica&0&282': np.array([-0.3109532939139045, -0.22759134703604383]),
'virginica&0&283': np.array([-0.0766197045034485, -0.5080325256323984]),
'virginica&0&284': np.array([-0.32767091750230254, -0.19689316772421933]),
'virginica&0&285': np.array([-0.05031696218434577, -0.929227611211748]),
'virginica&0&286': np.array([-0.017148644765919676, -0.9632117581295891]),
'virginica&0&287': np.array([-0.061515713893900315, -0.524561199322281]),
'virginica&0&288': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&289': np.array([-0.4656481363306145, 0.007982539480288167]),
'virginica&0&290': np.array([-0.017148644765919676, -0.9632117581295891]),
'virginica&0&291': np.array([-0.061515713893900315, -0.524561199322281]),
'virginica&0&292': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&293': np.array([-0.14241819268815753, -0.8424615476000691]),
'virginica&0&294': np.array([-0.061515713893900315, -0.524561199322281]),
'virginica&0&295': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&296': np.array([-0.1140907502997574, -0.8737800276630269]),
'virginica&0&297': np.array([-0.4329463382004908, -0.057167210150691136]),
'virginica&0&298': np.array([-0.14198277461566922, -0.4577720226157396]),
'virginica&0&299': np.array([-0.4385442121294165, -0.05333645823279597]),
'virginica&0&300': np.array([0.029402442458921384, -0.9481684282717414]),
'virginica&0&301': np.array([0.009887859354111524, -0.9698143912008228]),
'virginica&0&302': np.array([0.009595083643662688, -0.5643652067423869]),
'virginica&0&303': np.array([0.13694026920485936, -0.36331091829858003]),
'virginica&0&304': np.array([0.3094460464703627, 0.11400643817329122]),
'virginica&0&305': np.array([0.009887859354111524, -0.9698143912008228]),
'virginica&0&306': np.array([0.009595083643662688, -0.5643652067423869]),
'virginica&0&307': np.array([0.13694026920485936, -0.36331091829858003]),
'virginica&0&308': np.array([0.19002455311770447, -0.8848597943731074]),
'virginica&0&309': np.array([0.009595083643662688, -0.5643652067423869]),
'virginica&0&310': np.array([0.13694026920485936, -0.36331091829858003]),
'virginica&0&311': np.array([0.1746467870122951, -0.9073062742839755]),
'virginica&0&312': np.array([0.13694026920485936, -0.36331091829858003]),
'virginica&0&313': np.array([0.11200181312407695, -0.5330612470996793]),
'virginica&0&314': np.array([0.19998284600732558, -0.3489062419702088]),
'virginica&1&0': np.array([0.37157553889555184, 0.1221600832023858]),
'virginica&1&1': np.array([0.2463036871609408, 0.24630368716093934]),
'virginica&1&2': np.array([0.9105775730167809, -0.6842162738602727]),
'virginica&1&3': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&4': np.array([0.4964962439921071, 0.3798215458387346]),
'virginica&1&5': np.array([0.2463036871609408, 0.24630368716093934]),
'virginica&1&6': np.array([0.9105775730167809, -0.6842162738602727]),
'virginica&1&7': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&8': np.array([0.22125635302655813, 0.2925832702358638]),
'virginica&1&9': np.array([0.9105775730167809, -0.6842162738602727]),
'virginica&1&10': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&11': np.array([0.10063786451829529, 0.4085974066833644]),
'virginica&1&12': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&13': np.array([0.8441748651745272, -0.6057436494968107]),
'virginica&1&14': np.array([0.6453274192140858, -0.6334259878992301]),
'virginica&1&15': np.array([0.37157553889555184, 0.1221600832023858]),
'virginica&1&16': np.array([0.2463036871609408, 0.24630368716093934]),
'virginica&1&17': np.array([0.9105775730167809, -0.6842162738602727]),
'virginica&1&18': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&19': np.array([0.4964962439921071, 0.3798215458387346]),
'virginica&1&20': np.array([0.2463036871609408, 0.24630368716093934]),
'virginica&1&21': np.array([0.9105775730167809, -0.6842162738602727]),
'virginica&1&22': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&23': np.array([0.22125635302655813, 0.2925832702358638]),
'virginica&1&24': np.array([0.9105775730167809, -0.6842162738602727]),
'virginica&1&25': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&26': np.array([0.10063786451829529, 0.4085974066833644]),
'virginica&1&27': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&28': np.array([0.8441748651745272, -0.6057436494968107]),
'virginica&1&29': np.array([0.6453274192140858, -0.6334259878992301]),
'virginica&1&30': np.array([-0.32199975656257646, 0.7482293552463756]),
'virginica&1&31': np.array([-0.43843349141088417, 0.8642740701867917]),
'virginica&1&32': np.array([0.7141739659554729, -0.661981914015288]),
'virginica&1&33': np.array([0.4446001433508151, -0.6107546840046901]),
'virginica&1&34': np.array([0.2619265016777598, 0.33491141590339474]),
'virginica&1&35': np.array([-0.43843349141088417, 0.8642740701867917]),
'virginica&1&36': np.array([0.7141739659554729, -0.661981914015288]),
'virginica&1&37': np.array([0.4446001433508151, -0.6107546840046901]),
'virginica&1&38': np.array([-0.2562642052727569, 0.6920266972283227]),
'virginica&1&39': np.array([0.7141739659554729, -0.661981914015288]),
'virginica&1&40': np.array([0.4446001433508151, -0.6107546840046901]),
'virginica&1&41': np.array([-0.34479806250338163, 0.7789143553916729]),
'virginica&1&42': np.array([0.4446001433508151, -0.6107546840046901]),
'virginica&1&43': np.array([0.6253066100206679, -0.5612970743228719]),
'virginica&1&44': np.array([0.4159041613345079, -0.5802838287107943]),
'virginica&1&45': np.array([-0.7749499208750119, 0.8147189440804429]),
'virginica&1&46': np.array([-0.8040309195416899, 0.8445152504134819]),
'virginica&1&47': np.array([-0.582650696375085, 0.22335655671229132]),
'virginica&1&48': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&49': np.array([-0.4079256832347186, 0.038455640985860955]),
'virginica&1&50': np.array([-0.8040309195416899, 0.8445152504134819]),
'virginica&1&51': np.array([-0.582650696375085, 0.22335655671229132]),
'virginica&1&52': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&53': np.array([-0.6964303997553315, 0.7444536452136676]),
'virginica&1&54': np.array([-0.582650696375085, 0.22335655671229132]),
'virginica&1&55': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&56': np.array([-0.7213651642695392, 0.7718874443854203]),
'virginica&1&57': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&58': np.array([-0.5538416840542331, 0.2026191723113616]),
'virginica&1&59': np.array([-0.3472412936248763, -0.1219322389673262]),
'virginica&1&60': np.array([0.4933316375690332, 0.5272416708629276]),
'virginica&1&61': np.array([0.5041830043657418, 0.5392782673950876]),
'virginica&1&62': np.array([0.25657760110071476, -0.12592645350389117]),
'virginica&1&63': np.array([0.13717260713320115, -0.36277799079016637]),
'virginica&1&64': np.array([0.3093950298647913, 0.1140298206733954]),
'virginica&1&65': np.array([0.5041830043657418, 0.5392782673950876]),
'virginica&1&66': np.array([0.25657760110071476, -0.12592645350389117]),
'virginica&1&67': np.array([0.13717260713320115, -0.36277799079016637]),
'virginica&1&68': np.array([0.40694846236352233, 0.5109051764198169]),
'virginica&1&69': np.array([0.25657760110071476, -0.12592645350389117]),
'virginica&1&70': np.array([0.13717260713320115, -0.36277799079016637]),
'virginica&1&71': np.array([0.415695226122737, 0.5230815102377903]),
'virginica&1&72': np.array([0.13717260713320115, -0.36277799079016637]),
'virginica&1&73': np.array([0.28313251310829024, -0.10978015869508362]),
'virginica&1&74': np.array([0.20013484983664692, -0.3483612449300506]),
'virginica&1&75': np.array([0.0, 0.4756207622944677]),
'virginica&1&76': np.array([0.0, 0.4854334805210761]),
'virginica&1&77': np.array([0.0, -0.16885577975809632]),
'virginica&1&78': np.array([0.0, -0.39580588553855395]),
'virginica&1&79': np.array([0.0, 0.2538072707138344]),
'virginica&1&80': np.array([0.0, 0.4854334805210761]),
'virginica&1&81': np.array([0.0, -0.16885577975809632]),
'virginica&1&82': np.array([0.0, -0.39580588553855395]),
'virginica&1&83': np.array([0.0, 0.4904755652105692]),
'virginica&1&84': np.array([0.0, -0.16885577975809632]),
'virginica&1&85': np.array([0.0, -0.39580588553855395]),
'virginica&1&86': np.array([0.0, 0.5008471974438506]),
'virginica&1&87': np.array([0.0, -0.39580588553855395]),
'virginica&1&88': np.array([0.0, -0.14423919730424817]),
'virginica&1&89': np.array([0.0, -0.3847817540585927]),
'virginica&1&90': np.array([0.37157553889555184, 0.1221600832023858]),
'virginica&1&91': np.array([0.2463036871609408, 0.24630368716093934]),
'virginica&1&92': np.array([0.9105775730167809, -0.6842162738602727]),
'virginica&1&93': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&94': np.array([0.4964962439921071, 0.3798215458387346]),
'virginica&1&95': np.array([0.2463036871609408, 0.24630368716093934]),
'virginica&1&96': np.array([0.9105775730167809, -0.6842162738602727]),
'virginica&1&97': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&98': np.array([0.22125635302655813, 0.2925832702358638]),
'virginica&1&99': np.array([0.9105775730167809, -0.6842162738602727]),
'virginica&1&100': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&101': np.array([0.10063786451829529, 0.4085974066833644]),
'virginica&1&102': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&103': np.array([0.8441748651745272, -0.6057436494968107]),
'virginica&1&104': np.array([0.6453274192140858, -0.6334259878992301]),
'virginica&1&105': np.array([-0.32199975656257646, 0.7482293552463756]),
'virginica&1&106': np.array([-0.43843349141088417, 0.8642740701867917]),
'virginica&1&107': np.array([0.7141739659554729, -0.661981914015288]),
'virginica&1&108': np.array([0.4446001433508151, -0.6107546840046901]),
'virginica&1&109': np.array([0.2619265016777598, 0.33491141590339474]),
'virginica&1&110': np.array([-0.43843349141088417, 0.8642740701867917]),
'virginica&1&111': np.array([0.7141739659554729, -0.661981914015288]),
'virginica&1&112': np.array([0.4446001433508151, -0.6107546840046901]),
'virginica&1&113': np.array([-0.2562642052727569, 0.6920266972283227]),
'virginica&1&114': np.array([0.7141739659554729, -0.661981914015288]),
'virginica&1&115': np.array([0.4446001433508151, -0.6107546840046901]),
'virginica&1&116': np.array([-0.34479806250338163, 0.7789143553916729]),
'virginica&1&117': np.array([0.4446001433508151, -0.6107546840046901]),
'virginica&1&118': np.array([0.6253066100206679, -0.5612970743228719]),
'virginica&1&119': np.array([0.4159041613345079, -0.5802838287107943]),
'virginica&1&120': np.array([-0.7749499208750119, 0.8147189440804429]),
'virginica&1&121': np.array([-0.8040309195416899, 0.8445152504134819]),
'virginica&1&122': np.array([-0.582650696375085, 0.22335655671229132]),
'virginica&1&123': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&124': np.array([-0.4079256832347186, 0.038455640985860955]),
'virginica&1&125': np.array([-0.8040309195416899, 0.8445152504134819]),
'virginica&1&126': np.array([-0.582650696375085, 0.22335655671229132]),
'virginica&1&127': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&128': np.array([-0.6964303997553315, 0.7444536452136676]),
'virginica&1&129': np.array([-0.582650696375085, 0.22335655671229132]),
'virginica&1&130': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&131': np.array([-0.7213651642695392, 0.7718874443854203]),
'virginica&1&132': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&133': np.array([-0.5538416840542331, 0.2026191723113616]),
'virginica&1&134': np.array([-0.3472412936248763, -0.1219322389673262]),
'virginica&1&135': np.array([0.5188109114552927, 0.03638964581864269]),
'virginica&1&136': np.array([0.5131478569192371, 0.04203387599862816]),
'virginica&1&137': np.array([0.7329462736700701, -0.4610490766898857]),
'virginica&1&138': np.array([0.5965042032375719, -0.48856644624972617]),
'virginica&1&139': np.array([0.5436097000280874, 0.1461891067488832]),
'virginica&1&140': np.array([0.5131478569192371, 0.04203387599862816]),
'virginica&1&141': np.array([0.7329462736700701, -0.4610490766898857]),
'virginica&1&142': np.array([0.5965042032375719, -0.48856644624972617]),
'virginica&1&143': np.array([0.4788153032824012, 0.08625929936974323]),
'virginica&1&144': np.array([0.7329462736700701, -0.4610490766898857]),
'virginica&1&145': np.array([0.5965042032375719, -0.48856644624972617]),
'virginica&1&146': np.array([0.46583127837967303, 0.09875847161509169]),
'virginica&1&147': np.array([0.5965042032375719, -0.48856644624972617]),
'virginica&1&148': np.array([0.7419884013108898, -0.4595742931114029]),
'virginica&1&149': np.array([0.6092194175719845, -0.5086479426935605]),
'virginica&1&150': np.array([0.37157553889555184, 0.1221600832023858]),
'virginica&1&151': np.array([0.2463036871609408, 0.24630368716093934]),
'virginica&1&152': np.array([0.9105775730167809, -0.6842162738602727]),
'virginica&1&153': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&154': np.array([0.4964962439921071, 0.3798215458387346]),
'virginica&1&155': np.array([0.2463036871609408, 0.24630368716093934]),
'virginica&1&156': np.array([0.9105775730167809, -0.6842162738602727]),
'virginica&1&157': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&158': np.array([0.22125635302655813, 0.2925832702358638]),
'virginica&1&159': np.array([0.9105775730167809, -0.6842162738602727]),
'virginica&1&160': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&161': np.array([0.10063786451829529, 0.4085974066833644]),
'virginica&1&162': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&163': np.array([0.8441748651745272, -0.6057436494968107]),
'virginica&1&164': np.array([0.6453274192140858, -0.6334259878992301]),
'virginica&1&165': np.array([-0.32199975656257646, 0.7482293552463756]),
'virginica&1&166': np.array([-0.43843349141088417, 0.8642740701867917]),
'virginica&1&167': np.array([0.7141739659554729, -0.661981914015288]),
'virginica&1&168': np.array([0.4446001433508151, -0.6107546840046901]),
'virginica&1&169': np.array([0.2619265016777598, 0.33491141590339474]),
'virginica&1&170': np.array([-0.43843349141088417, 0.8642740701867917]),
'virginica&1&171': np.array([0.7141739659554729, -0.661981914015288]),
'virginica&1&172': np.array([0.4446001433508151, -0.6107546840046901]),
'virginica&1&173': np.array([-0.2562642052727569, 0.6920266972283227]),
'virginica&1&174': np.array([0.7141739659554729, -0.661981914015288]),
'virginica&1&175': np.array([0.4446001433508151, -0.6107546840046901]),
'virginica&1&176': np.array([-0.34479806250338163, 0.7789143553916729]),
'virginica&1&177': np.array([0.4446001433508151, -0.6107546840046901]),
'virginica&1&178': np.array([0.6253066100206679, -0.5612970743228719]),
'virginica&1&179': np.array([0.4159041613345079, -0.5802838287107943]),
'virginica&1&180': np.array([-0.7749499208750119, 0.8147189440804429]),
'virginica&1&181': np.array([-0.8040309195416899, 0.8445152504134819]),
'virginica&1&182': np.array([-0.582650696375085, 0.22335655671229132]),
'virginica&1&183': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&184': np.array([-0.4079256832347186, 0.038455640985860955]),
'virginica&1&185': np.array([-0.8040309195416899, 0.8445152504134819]),
'virginica&1&186': np.array([-0.582650696375085, 0.22335655671229132]),
'virginica&1&187': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&188': np.array([-0.6964303997553315, 0.7444536452136676]),
'virginica&1&189': np.array([-0.582650696375085, 0.22335655671229132]),
'virginica&1&190': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&191': np.array([-0.7213651642695392, 0.7718874443854203]),
'virginica&1&192': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&193': np.array([-0.5538416840542331, 0.2026191723113616]),
'virginica&1&194': np.array([-0.3472412936248763, -0.1219322389673262]),
'virginica&1&195': np.array([0.5188109114552927, 0.03638964581864269]),
'virginica&1&196': np.array([0.5131478569192371, 0.04203387599862816]),
'virginica&1&197': np.array([0.7329462736700701, -0.4610490766898857]),
'virginica&1&198': np.array([0.5965042032375719, -0.48856644624972617]),
'virginica&1&199': np.array([0.5436097000280874, 0.1461891067488832]),
'virginica&1&200': np.array([0.5131478569192371, 0.04203387599862816]),
'virginica&1&201': np.array([0.7329462736700701, -0.4610490766898857]),
'virginica&1&202': np.array([0.5965042032375719, -0.48856644624972617]),
'virginica&1&203': np.array([0.4788153032824012, 0.08625929936974323]),
'virginica&1&204': np.array([0.7329462736700701, -0.4610490766898857]),
'virginica&1&205': np.array([0.5965042032375719, -0.48856644624972617]),
'virginica&1&206': np.array([0.46583127837967303, 0.09875847161509169]),
'virginica&1&207': np.array([0.5965042032375719, -0.48856644624972617]),
'virginica&1&208': np.array([0.7419884013108898, -0.4595742931114029]),
'virginica&1&209': np.array([0.6092194175719845, -0.5086479426935605]),
'virginica&1&210': np.array([0.37157553889555184, 0.1221600832023858]),
'virginica&1&211': np.array([0.2463036871609408, 0.24630368716093934]),
'virginica&1&212': np.array([0.9105775730167809, -0.6842162738602727]),
'virginica&1&213': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&214': np.array([0.4964962439921071, 0.3798215458387346]),
'virginica&1&215': np.array([0.2463036871609408, 0.24630368716093934]),
'virginica&1&216': np.array([0.9105775730167809, -0.6842162738602727]),
'virginica&1&217': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&218': np.array([0.22125635302655813, 0.2925832702358638]),
'virginica&1&219': np.array([0.9105775730167809, -0.6842162738602727]),
'virginica&1&220': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&221': np.array([0.10063786451829529, 0.4085974066833644]),
'virginica&1&222': np.array([0.6718337295341265, -0.6620422637360074]),
'virginica&1&223': np.array([0.8441748651745272, -0.6057436494968107]),
'virginica&1&224': np.array([0.6453274192140858, -0.6334259878992301]),
'virginica&1&225': np.array([-0.7749499208750119, 0.8147189440804429]),
'virginica&1&226': np.array([-0.8040309195416899, 0.8445152504134819]),
'virginica&1&227': np.array([-0.582650696375085, 0.22335655671229132]),
'virginica&1&228': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&229': np.array([-0.4079256832347186, 0.038455640985860955]),
'virginica&1&230': np.array([-0.8040309195416899, 0.8445152504134819]),
'virginica&1&231': np.array([-0.582650696375085, 0.22335655671229132]),
'virginica&1&232': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&233': np.array([-0.6964303997553315, 0.7444536452136676]),
'virginica&1&234': np.array([-0.582650696375085, 0.22335655671229132]),
'virginica&1&235': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&236': np.array([-0.7213651642695392, 0.7718874443854203]),
'virginica&1&237': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&238': np.array([-0.5538416840542331, 0.2026191723113616]),
'virginica&1&239': np.array([-0.3472412936248763, -0.1219322389673262]),
'virginica&1&240': np.array([0.056623968925773045, 0.43360725859686644]),
'virginica&1&241': np.array([0.020169511418752378, 0.47015948158260334]),
'virginica&1&242': np.array([0.5806365328450952, -0.4726270680771261]),
'virginica&1&243': np.array([0.41462901544715686, -0.4964318942067897]),
'virginica&1&244': np.array([0.3351719071445682, 0.20616862401308342]),
'virginica&1&245': np.array([0.020169511418752378, 0.47015948158260334]),
'virginica&1&246': np.array([0.5806365328450952, -0.4726270680771261]),
'virginica&1&247': np.array([0.41462901544715686, -0.4964318942067897]),
'virginica&1&248': np.array([0.024556360933646205, 0.4723948285969902]),
'virginica&1&249': np.array([0.5806365328450952, -0.4726270680771261]),
'virginica&1&250': np.array([0.41462901544715686, -0.4964318942067897]),
'virginica&1&251': np.array([-0.0164329511444131, 0.5132208276383963]),
'virginica&1&252': np.array([0.41462901544715686, -0.4964318942067897]),
'virginica&1&253': np.array([0.581569928198426, -0.46134543884925855]),
'virginica&1&254': np.array([0.42361197252581306, -0.5068181610814407]),
'virginica&1&255': np.array([-0.32199975656257646, 0.7482293552463756]),
'virginica&1&256': np.array([-0.43843349141088417, 0.8642740701867917]),
'virginica&1&257': np.array([0.7141739659554729, -0.661981914015288]),
'virginica&1&258': np.array([0.4446001433508151, -0.6107546840046901]),
'virginica&1&259': np.array([0.2619265016777598, 0.33491141590339474]),
'virginica&1&260': np.array([-0.43843349141088417, 0.8642740701867917]),
'virginica&1&261': np.array([0.7141739659554729, -0.661981914015288]),
'virginica&1&262': np.array([0.4446001433508151, -0.6107546840046901]),
'virginica&1&263': np.array([-0.2562642052727569, 0.6920266972283227]),
'virginica&1&264': np.array([0.7141739659554729, -0.661981914015288]),
'virginica&1&265': np.array([0.4446001433508151, -0.6107546840046901]),
'virginica&1&266': np.array([-0.34479806250338163, 0.7789143553916729]),
'virginica&1&267': np.array([0.4446001433508151, -0.6107546840046901]),
'virginica&1&268': np.array([0.6253066100206679, -0.5612970743228719]),
'virginica&1&269': np.array([0.4159041613345079, -0.5802838287107943]),
'virginica&1&270': np.array([-0.6288817118959938, 0.6849987400957501]),
'virginica&1&271': np.array([-0.6491819158994796, 0.7060292771859485]),
'virginica&1&272': np.array([-0.36354251586275393, 0.01503732165107865]),
'virginica&1&273': np.array([-0.2224264339516076, -0.2751400010362469]),
'virginica&1&274': np.array([-0.3507937472799825, 0.22709708691079003]),
'virginica&1&275': np.array([-0.6491819158994796, 0.7060292771859485]),
'virginica&1&276': np.array([-0.36354251586275393, 0.01503732165107865]),
'virginica&1&277': np.array([-0.2224264339516076, -0.2751400010362469]),
'virginica&1&278': np.array([-0.6219129029345898, 0.6860569455333333]),
'virginica&1&279': np.array([-0.36354251586275393, 0.01503732165107865]),
'virginica&1&280': np.array([-0.2224264339516076, -0.2751400010362469]),
'virginica&1&281': np.array([-0.6423063482710314, 0.7078274136226649]),
'virginica&1&282': np.array([-0.2224264339516076, -0.2751400010362469]),
'virginica&1&283': np.array([-0.38798262782075055, 0.05152547330256509]),
'virginica&1&284': np.array([-0.23804537254556749, -0.24790919248823104]),
'virginica&1&285': np.array([-0.7749499208750119, 0.8147189440804429]),
'virginica&1&286': np.array([-0.8040309195416899, 0.8445152504134819]),
'virginica&1&287': np.array([-0.582650696375085, 0.22335655671229132]),
'virginica&1&288': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&289': np.array([-0.4079256832347186, 0.038455640985860955]),
'virginica&1&290': np.array([-0.8040309195416899, 0.8445152504134819]),
'virginica&1&291': np.array([-0.582650696375085, 0.22335655671229132]),
'virginica&1&292': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&293': np.array([-0.6964303997553315, 0.7444536452136676]),
'virginica&1&294': np.array([-0.582650696375085, 0.22335655671229132]),
'virginica&1&295': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&296': np.array([-0.7213651642695392, 0.7718874443854203]),
'virginica&1&297': np.array([-0.33108168891715994, -0.1364781674635115]),
'virginica&1&298': np.array([-0.5538416840542331, 0.2026191723113616]),
'virginica&1&299': np.array([-0.3472412936248763, -0.1219322389673262]),
'virginica&1&300': np.array([0.4933316375690332, 0.5272416708629276]),
'virginica&1&301': np.array([0.5041830043657418, 0.5392782673950876]),
'virginica&1&302': np.array([0.25657760110071476, -0.12592645350389117]),
'virginica&1&303': np.array([0.13717260713320115, -0.36277799079016637]),
'virginica&1&304': np.array([0.3093950298647913, 0.1140298206733954]),
'virginica&1&305': np.array([0.5041830043657418, 0.5392782673950876]),
'virginica&1&306': np.array([0.25657760110071476, -0.12592645350389117]),
'virginica&1&307': np.array([0.13717260713320115, -0.36277799079016637]),
'virginica&1&308': np.array([0.40694846236352233, 0.5109051764198169]),
'virginica&1&309': np.array([0.25657760110071476, -0.12592645350389117]),
'virginica&1&310': np.array([0.13717260713320115, -0.36277799079016637]),
'virginica&1&311': np.array([0.415695226122737, 0.5230815102377903]),
'virginica&1&312': np.array([0.13717260713320115, -0.36277799079016637]),
'virginica&1&313': np.array([0.28313251310829024, -0.10978015869508362]),
'virginica&1&314': np.array([0.20013484983664692, -0.3483612449300506]),
'virginica&2&0': np.array([0.37157691321004915, 0.12216227283618836]),
'virginica&2&1': np.array([0.24630541996506908, 0.24630541996506994]),
'virginica&2&2': np.array([0.04449246321056297, 0.7096449459722027]),
'virginica&2&3': np.array([0.2953784217387408, 0.6750352694420284]),
'virginica&2&4': np.array([0.4741571944522723, -0.3872697414416878]),
'virginica&2&5': np.array([0.24630541996506908, 0.24630541996506994]),
'virginica&2&6': np.array([0.04449246321056297, 0.7096449459722027]),
'virginica&2&7': np.array([0.2953784217387408, 0.6750352694420284]),
'virginica&2&8': np.array([0.6273836195848199, -0.15720981251964872]),
'virginica&2&9': np.array([0.04449246321056297, 0.7096449459722027]),
'virginica&2&10': np.array([0.2953784217387408, 0.6750352694420284]),
'virginica&2&11': np.array([0.6863652799597699, -0.21335694415409426]),
'virginica&2&12': | np.array([0.2953784217387408, 0.6750352694420284]) | numpy.array |
#! /usr/bin/python3 -u
# Copyright © 2017 <NAME> <<EMAIL>>
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See the COPYING file for more details.
""" ...
Usage:
slam.py [-v|-vv] [-f|] <PICKEL_FILE>
slam.py [-v|-vv] [-f|] <PICKEL_FILE> -p <FIGURE_DIR>
Arguments:
<PICKEL_FILE> Pickle file containing processed data.
<FIGURE_DIR> Directory for saved figures.
Options:
-p <FIGURE_DIR> Directory where to save figures.
-f Force overwrite.
-v Verbose mode.
-vv Very Verbose mode.
-h, --help
"""
from docopt import docopt
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import math
import copy
import os
import shutil
import warnings
import pickle
# RanSaC parameters
D_RANSAC = 20 # Degree range
S_RANSAC = 8 # Nb of samples
X_RANSAC = 0.4 # Distance to wall in m
N_RANSAC = 40 # Max trials
C_RANSAC = 0.6 # Consensus = C *len(data)
C_RANSAC_MIN = 50 # 50 # Minimum consensus
# Landmark validation parameters
D_VALIDATION = 4 # Distance max between 2 observations of a landmarks in m
N_VALIDATION = 2 # Nb of observation of a landmark need before data adjustment
# EKF parameters
TIME_WINDOW = 3 # Time window size in s
TIME_STEP = 3 # Sliding window step in s
ODOMETRY_NOISE = 5 # noise on the odometry process
RANGE_LIDAR_NOISE = 0.1 # distances noise on the LiDAR
BEARING_LIDAR_NOISE = 1 * math.pi/180 # angle noise on the LiDAR
# Figure parameters
PLOT_RED = 'tomato'
PLOT_BLUE = 'cornflowerblue'
PLOT_GREEN = 'forestgreen'
PLOT_ORANGE = 'darkorange'
PLOT_YELLOW = 'gold'
PLOT_LIGHT_GREY = 'gainsboro'
PLOT_COLORS = [PLOT_RED, PLOT_ORANGE, PLOT_YELLOW, 'navy'] * 10
PLOT_AXIS = [-12, 12, -12, 12]
PLOT_DRONE_HISTORY = 10 # seconds
IS_VERBOSE_MODE = docopt(__doc__)['-v'] >= 1
IS_HARD_VERBOSE_MODE = docopt(__doc__)['-v'] >= 2
IS_PLOTTING_MODE = docopt(__doc__)['-p'] is not None
FILE = docopt(__doc__)['<PICKEL_FILE>']
IS_OVERWRITE_MODE = docopt(__doc__)['-f'] >= 1
if IS_PLOTTING_MODE:
FIGURE_DIR = docopt(__doc__)['-p']
# Ignore the warnings related to polyfit
warnings.filterwarnings('ignore')
def main():
# If in plotting mode, assure that the directory to save figure exist
if IS_PLOTTING_MODE:
if os.path.isdir(FIGURE_DIR):
if not IS_OVERWRITE_MODE:
i = input("Figure directory already exist. Erase ?[y/n] ")
if IS_OVERWRITE_MODE or i == "y":
shutil.rmtree(FIGURE_DIR)
else:
print("Exit")
exit()
os.mkdir(FIGURE_DIR)
os.mkdir(os.path.join(FIGURE_DIR, "pdf"))
os.mkdir(os.path.join(FIGURE_DIR, "png"))
os.mkdir(os.path.join(FIGURE_DIR, "data"))
data = pd.read_pickle(FILE)
correctedData, X = SLAM(data)
if IS_PLOTTING_MODE:
s = FIGURE_DIR + "/data/{}"
dataFile = open(s.format("origData.pickle"), "wb")
correctedDataFile = open(s.format("correctedData.pickle"), "wb")
pickle.dump(data, dataFile)
pickle.dump(correctedData, correctedDataFile)
def SLAM(origData):
""" Apply a SLAM algorithm on LiDAR data.
It recognize walls as landmarks using the RANSAC algorithm. Then landmarks
are associated with a nearest-neighbor approach. The SLAM problem is solved
by an EKF procedure.
origData is a DataFrame object from the pandas module corresponding to
post-precessed data acquired by the drone.
"""
correctedData = pd.DataFrame(columns=origData.columns)
timeIdx = 0
offset = np.array([0.0, 0.0, 0.0])
# Initialization of SLAM relevant matrix
X, P, R, Jxr, Jz = initSlamMatrix()
while timeIdx < origData.iloc[-1].time - TIME_WINDOW:
# Reducing the data to the current time window
curData = origData.copy()
curData = curData[(curData.time > timeIdx) &
(curData.time < timeIdx + TIME_WINDOW)]
timeIdx += TIME_STEP
# Correction
curData = dataCorrection(curData, offset)
# Saving data for figures
if IS_PLOTTING_MODE:
previousCurData = curData.copy() # Saving for plot
previousX = copy.deepcopy(X)
# Consensus law
if C_RANSAC*len(curData) >= C_RANSAC_MIN:
Consensus = len(curData) * C_RANSAC
else:
Consensus = C_RANSAC_MIN
# Detecting landmarks using the RanSaC algorithm
localLandmarks, trial = RanSaC(curData.copy(), D_RANSAC, S_RANSAC,
X_RANSAC, Consensus, N_RANSAC)
# Distinguishing which landmarks are observed for the first time
localLandmarks = [makeLandmark(m) for m in localLandmarks]
newLandmarkds, reobservedLandmark = \
lmAssociation(X, localLandmarks)
# Updating drone position using EKF methodology
# STEP 1: update state using odometry data
if len(curData) > 0:
P, X, Jxr, Jz = updateFromOdometry(curData, X, P, Jxr, Jz)
# STEP 2: update state using re-observed landmarks
if len(reobservedLandmark) > 0:
X, P, offset = updateFromReobservedLandmarks(reobservedLandmark,
P, X, R)
curData = dataCorrection(curData, offset)
# STEP 3: add new landmarks to the state
if len(newLandmarkds) > 0:
P, X = addNewLandmarks(newLandmarkds, X, P, Jxr, Jz, R)
for i in curData.index:
correctedData.loc[i] = curData.loc[i]
if IS_VERBOSE_MODE:
s = "\nTime window {:2.1f}s-{:2.1f}s: {} Data."
section = s.format(timeIdx, timeIdx+TIME_WINDOW, len(curData))
if len(newLandmarkds) + len(reobservedLandmark) > 0:
print(section)
for m in newLandmarkds:
s = "\tNew wall index {:d}."
print(s.format(m['index']))
for m in reobservedLandmark:
s = "\tWall {:d} re-observed {:d} times."
print(s.format(m['index'], X.lmOccurrence[m['index']]))
if len(reobservedLandmark) > 0:
s = "\tSLAM offset:\n"
s += "\t\tx: {:.3f} m\n"
s += "\t\ty: {:.3f} m\n"
s += "\t\tyaw: {:.3f} rad\n"
print(s.format(*offset))
elif IS_HARD_VERBOSE_MODE and trial == 0:
print(section, "\nNot enough data.")
elif IS_HARD_VERBOSE_MODE and trial == N_RANSAC:
print(section, "\nNo consensus.")
if IS_PLOTTING_MODE:
if len(curData) > 0:
plotStep1(correctedData, previousCurData, previousX,
timeIdx, localLandmarks)
# Re-observation
if len(reobservedLandmark) > 0:
plotStep2(correctedData, curData, previousCurData, X,
previousX, timeIdx)
# New landmarks
#if len(newLandmarkds) > 0:
if len(curData) > 0:
plotStep3(correctedData, previousCurData, curData, X, timeIdx)
if IS_VERBOSE_MODE:
print("-"*40, "\nSummary:\nFound {} walls".format(X.lmLength))
for m in range(X.lmLength):
s = "\tWall {:d} observed {:d} times"
print(s.format(m, X.lmOccurrence[m]))
print("Distances:")
for m in range(X.lmLength):
for i in range(m+1, X.lmLength):
s = "\tFrom wall {:d} to {:d}: {:5.2f} m."
print(s.format(m, i, distPointToPoint(X.getLm(m), X.getLm(i))))
if IS_PLOTTING_MODE:
plt.clf()
plt.scatter(origData.lidarX, origData.lidarY, color=PLOT_LIGHT_GREY,
marker='.', s=3, label='Raw data')
plt.scatter(correctedData.lidarX, correctedData.lidarY, marker='.',
color=PLOT_BLUE, label='Corrected data', s=3)
for idx in range(X.lmLength):
plotLandmark(X, idx)
if X.lmLength == 2:
plotDistance(X.getLm(0), X.getLm(1))
elif X.lmLength == 4:
plotDistance(X.getLm(0), X.getLm(2), textRatio=0.15)
plotDistance(X.getLm(1), X.getLm(3), textRatio=0.8)
plt.xlabel('x [m]')
plt.ylabel('y [m]')
plt.legend()
plt.axis(PLOT_AXIS)
plt.savefig("{}/png/Final.png".format(FIGURE_DIR), bbox_inches='tight')
plt.savefig("{}/pdf/Final.pdf".format(FIGURE_DIR), bbox_inches='tight')
return correctedData, X
def plotDroneMarker(row, color='black'):
angleOffset = row.yaw * 180/math.pi - 45
plt.scatter(row.droneX, row.droneY, color=color, facecolor=color, s=100,
marker=(3, 0, angleOffset), zorder=3)
def plotStep1(correctedData, previousCurData, previousX, time, localLandmarks):
plt.clf()
# Drone trajectory
correctedData = \
correctedData[time - correctedData.time < PLOT_DRONE_HISTORY]
correctedData = correctedData.loc[:previousCurData.iloc[0].name][:-1]
correctedData = pd.concat([correctedData, previousCurData])
plt.plot(correctedData.droneX, correctedData.droneY,
color=PLOT_LIGHT_GREY, zorder=1)
plt.plot(previousCurData.droneX, previousCurData.droneY,
color='gray', zorder=2)
plotDroneMarker(previousCurData.iloc[-1])
# Corrected points
plt.scatter(previousCurData.lidarX, previousCurData.lidarY,
color=PLOT_BLUE, s=1)
# Landmarks
for idx in range(previousX.lmLength):
plotLandmark(previousX, idx)
# Ransac landmarks
for m in localLandmarks:
plotLandmark(*m['param'], mkr='--', color='darkmagenta')
# Figure properties
plt.xlabel('x [m]')
plt.ylabel('y [m]')
plt.axis(PLOT_AXIS)
s = "{}/png/{}-01.png"
plt.savefig(s.format(FIGURE_DIR, time), bbox_inches='tight')
s = "{}/pdf/{}-01.pdf"
plt.savefig(s.format(FIGURE_DIR, time), bbox_inches='tight')
def plotStep2(correctedData, curData, previousCurData, X, previousX, time):
plt.clf()
# Drone trajectory
history = \
correctedData[time - correctedData.time < PLOT_DRONE_HISTORY]
plt.plot(history.droneX, history.droneY, color=PLOT_LIGHT_GREY, zorder=1)
plt.plot(previousCurData.droneX, previousCurData.droneY,
color=PLOT_RED, zorder=2)
plotDroneMarker(previousCurData.iloc[-1], color=PLOT_RED)
plt.plot(curData.droneX, curData.droneY,
color=PLOT_GREEN, zorder=2)
plotDroneMarker(curData.iloc[-1], color=PLOT_GREEN)
# Before and after point correction
plt.scatter(previousCurData.lidarX, previousCurData.lidarY,
color=PLOT_RED, s=2)
plt.scatter(curData.lidarX, curData.lidarY, color=PLOT_GREEN, s=2)
# Landmarks
# Old
for idx in range(previousX.lmLength):
plotLandmark(previousX, idx, color=PLOT_RED)
# Updated
for idx in range(X.lmLength):
plotLandmark(X, idx, color=PLOT_GREEN)
# Figure properties
plt.xlabel('x [m]')
plt.ylabel('y [m]')
plt.axis(PLOT_AXIS)
s = "{}/png/{}-02.png"
plt.savefig(s.format(FIGURE_DIR, time), bbox_inches='tight')
s = "{}/pdf/{}-02.pdf"
plt.savefig(s.format(FIGURE_DIR, time), bbox_inches='tight')
def plotStep3(correctedData, previousCurData, curData, X, time):
plt.clf()
# Drone trajectory
correctedData = \
correctedData[time - correctedData.time < PLOT_DRONE_HISTORY]
correctedData = correctedData.loc[:previousCurData.iloc[0].name][:-1]
correctedData = pd.concat([correctedData, previousCurData])
plt.plot(correctedData.droneX, correctedData.droneY,
color=PLOT_LIGHT_GREY, zorder=1)
plt.plot(previousCurData.droneX, previousCurData.droneY,
color='gray', zorder=2)
plotDroneMarker(previousCurData.iloc[-1])
# Corrected points
plt.scatter(curData.lidarX, curData.lidarY, color=PLOT_BLUE, s=1)
# Landmarks
for idx in range(X.lmLength):
plotLandmark(X, idx)
# Figure properties
plt.xlabel('x [m]')
plt.ylabel('y [m]')
plt.axis(PLOT_AXIS)
s = "{}/png/{}-03.png"
plt.savefig(s.format(FIGURE_DIR, time), bbox_inches='tight')
s = "{}/pdf/{}-03.pdf"
plt.savefig(s.format(FIGURE_DIR, time), bbox_inches='tight')
def plotLandmark(p1, p2, color=False, mkr='-', label=''):
""" param = [p1, p2] or [X, idx]. """
if type(p1).__name__ == StateMatrix.__name__:
label = "Wall {:d}: {:d} times".format(p2, p1.lmOccurrence[p2])
if not color:
color = PLOT_COLORS[p2]
coordLm = p1.getLm(p2)
p1, p2 = lmPointToParam(*coordLm)
else:
if not color:
color = 'purple'
coordLm = lmParamToPoint(p1, p2)
l1, l2 = getLineCircleIntersection([p1, p2], coordLm, 2)
plt.plot(l1, l2, mkr, color=color, label=label)
plt.scatter(l1, l2, color=color, marker='x', s=50)
plt.scatter(*coordLm, color=color, marker='o', s=100)
def plotDistance(p1, p2, textRatio=0.5):
d = distPointToPoint(p1, p2)
text = "{:.2f} m".format(d)
textPos = [(p1[0] - p2[0])*textRatio, (p1[1] - p2[1])*textRatio]
textPos = [p1[0] - (p1[0] - p2[0])*textRatio - (p1[1] - p2[1])*0.08,
p1[1] - (p1[1] - p2[1])*textRatio + (p1[0] - p2[0])*0.08]
plt.annotate('', xy=p1, xytext=p2, arrowprops={'arrowstyle': '<->'})
plt.annotate(text, xy=p1, xytext=textPos)
def getLineCircleIntersection(line, center, R):
""" Return the intersection of a line and circle.
line is a vector (a, c) such as the line equation is y = ax + c.
center is the coordinate of the center of the circle.
R is the radius of the circle.
"""
a, c = line
xl, yl = center
A = a**2 + 1
B = 2*a*(c - yl) - 2*xl
C = xl**2 + (c - yl)**2 - R**2
Delta = B**2 - 4*A*C
x1 = (-B + math.sqrt(Delta)) / (2*A)
x2 = (-B - math.sqrt(Delta)) / (2*A)
y1 = a*x1 + c
y2 = a*x2 + c
return [x1, x2], [y1, y2]
def dataCorrection(data, offset):
""" Add a position offset to relevant column of data.
data is a DataFrame object from the pandas module.
offset is list of offset such as [x_offset, y_offset, yaw_offset].
"""
data['droneX'] = data['droneX'].map(lambda x: x-offset[0])
data['droneY'] = data['droneY'].map(lambda x: x-offset[1])
data['yaw'] = data['yaw'].map(lambda x: x-offset[2])
data['lidarX'] = data['lidarX'].map(lambda x: x-offset[0])
data['lidarY'] = data['lidarY'].map(lambda x: x-offset[1])
return data
def initSlamMatrix():
""" Return intial value of all SLAM relevant matrices.
Return:
X as a StateMatrix object.
P as a CovarianceMatrix object.
Jxr as the prediction model jacobian with respect to position.
Jz as the prediction model jacobian with respect to landmarks observations.
"""
# State Matrix
X = StateMatrix()
# Covariance matrix
P = CovarianceMatrix()
# Modified prediction model jacobian
Jxr = np.array([[1.0, 0.0, 0.0],
[0.0, 1.0, 0.0]])
# Modified prediction model jacobian
Jz = np.zeros([2, 2])
# LiDAR Noise
V = np.identity(2)
R = V @ np.identity(2) * [RANGE_LIDAR_NOISE, BEARING_LIDAR_NOISE] @ V.T
return X, P, R, Jxr, Jz
def updateFromOdometry(data, X, P, Jxr, Jz):
""" 1st step: update state from odometry data.
Return the modified X, P and prediction model jacobian matrices.
data is a DataFrame object from the pandas module.
X is a StateMatrix object.
P is a CovarianceMatrix object.
Jxr is the prediction model jacobian with respect to position.
Jz is the prediction model jacobian with respect to landmarks observations.
"""
dx = data.iloc[0].droneX - data.iloc[-1].droneX
dy = data.iloc[0].droneY - data.iloc[-1].droneY
dt = data.iloc[0].yaw - data.iloc[-1].yaw
# State matrix
X.X[0] += dx
X.X[1] += dy
X.X[2] += dt
# Prediction model jacobian
A = np.identity(3)
A[0, 2] = -dy
A[1, 2] = dx
# Process noise matrix
W = np.identity(3) * [dx, dy, dt]
Q = np.ones([3, 3]) * ODOMETRY_NOISE**2
# Covariance on the robot position
P.Prr = A @ P.Prr @ A.T + W @ Q @ W.T
# Cross-correlations covariance
for i in range(int((len(P.P)-3)/2)):
Pri = P.getE(i)
E = A @ Pri
D = E.T
P.setD(i, D)
P.setE(i, E)
# Modified prediction model jacobian with respect to position
Jxr[0, 2] = -dy
Jxr[1, 2] = dx
# Modified prediction model jacobian with respect to landmarks observations
Jz[0, 0] = math.cos(X.X[2] + dt)
Jz[1, 0] = math.sin(X.X[2] + dt)
Jz[0, 1] = -math.sin(X.X[2] + dt) * dt
Jz[1, 1] = math.cos(X.X[2] + dt) * dt
return P, X, Jxr, Jz
def updateFromReobservedLandmarks(reobservedLandmark, P, X, R):
""" 2nd step: update state from re-observed landmarks.
Return the modified X matrix and the offset to apply on measurments.
reobservedLandmark is a list of re-observe landmarks define by the landmark
association process.
X is a StateMatrix object.
P is a CovarianceMatrix object.
R is the LiDAR noise.
"""
for landmark in reobservedLandmark:
# Landmark index
idx = 3+landmark['index']*2
# Compute the Jacobian of the measurement model
r = distPointToLine(X.X[:2], landmark['point'])
H11 = (X.X[0] - landmark['point'][0]) / r
H12 = (X.X[1] - landmark['point'][1]) / r
H21 = (landmark['point'][1] - X.X[1]) / (r**2)
H22 = (landmark['point'][0] - X.X[0]) / (r**2)
H = np.zeros([2, len(X.X)])
H[:2, :3] = [[H11, H12, 0],
[H21, H22, -1]]
H[:, idx:idx+2] = [[-H11, -H12],
[-H21, -H22]]
# Compute innovation covariance
d = distPointToPoint(X.X[0:2], landmark['point'])
V = np.identity(2)
R = np.identity(2) * [RANGE_LIDAR_NOISE*d, BEARING_LIDAR_NOISE]
S = H @ P.P @ H.T + V @ R @ V.T
# Compute Kalman gain
K = P.P @ H.T @ np.linalg.inv(S)
# Compute range and bearing of the observed landmark and its previous
z = np.array(getRelativePos(X.X[:3], X.getLm(landmark['index'])))
h = np.array(getRelativePos(X.X[:3], landmark['point']))
# Update X state
corr = K @ (z-h)
X.X += corr
# TODO make sure we don't need this
# This instruction is not in 'SLAM for dummies' but according to EKF
# algorithm it should be. Anyway it doesn't work.
# I = np.identity(3)
# P.Prr = (I - K[:3, :3] @ H[:3, :3]) @ P.Prr
# TODO the offset is overwritten by last landmark
offset = corr[:3]
return X, P, offset
def addNewLandmarks(newLandmarkds, X, P, Jxr, Jz, R):
""" 3rd step: Adding new landmarks to state and covariance matrices.
Return the modified X and P matrices.
newLandmarks is a list of new landmarks define by the landmark association
process.
X is a StateMatrix object.
P is a CovarianceMatrix object.
Jxr is the prediction model jacobian with respect to position.
Jz is the prediction model jacobian with respect to landmarks observations.
R is the LiDAR noise.
"""
for m in newLandmarkds:
# State matrix
X.addLandmark(m['point'])
P.addLandmark()
# Landmark covariance
C = Jxr @ P.Prr @ Jxr.T
d = distPointToPoint(X.X[0:2], m['point'])
R = np.identity(2) * [RANGE_LIDAR_NOISE*d, BEARING_LIDAR_NOISE]
C += Jz @ R @ Jz.T
P.setC(m['index'], C)
# Robot-Landmark covariance
E = P.Prr @ Jxr.T
D = E.T
P.setD(m['index'], D)
P.setE(m['index'], E)
# Landmark-Landmark covariance
for i in range(m['index']):
Pri = P.getD(i)
F = Jxr @ Pri.T
G = F.T
P.setF(m['index'], i, F)
P.setG(m['index'], i, G)
return P, X
def getRelativePos(dr, lm):
""" Return polar coordinate of a landmark relative to the drone.
dr is a the pose of the drone such as dr = [x, y, yaw].
lm is the cartesian coordinate of the landmark.
"""
r = np.linalg.norm([lm[0]-dr[0], lm[1]-dr[1]])
theta = math.atan2((lm[1]-dr[1]), (lm[0]-dr[0]))-dr[2]
return [r, theta]
class StateMatrix(object):
""" Represent a matrix containing the drone pose and landmarks position.
Getter and setter functions are set up for easier access.
"""
def __init__(self):
self.X = np.array([0.0, 0.0, 0.0])
self.lmOccurrence = []
def addLandmark(self, point):
""" Add new landmark."""
self.X = np.concatenate((self.X, point), axis=0)
self.lmOccurrence += [1]
def getLm(self, i):
"""" Getter: landmark point (2x1). """
index = 3+i*2
return self.X[index:index+2]
def setLm(self, i, value):
"""" Setter: landmark point (2x1). """
index = 3+i*2
self.X[index:index+2] = value
@property
def lmLength(self):
""" Number of landmarks. """
return len(self.lmOccurrence)
class CovarianceMatrix(object):
""" Represent a matrix containing all relevant covariance matrix:
- Covariance on the robot position
- Landmark covariance
- Robot - landmark covariance
- Landmark - robot covariance
- Landmark - landmark covariance
Getter and setter functions are set up for easier access.
"""
def __init__(self):
self.P = np.identity(3)
@property
def Prr(self):
""" Covariance on the robot position. """
return self.P[:3, :3]
@Prr.setter
def Prr(self, value):
"""Setter: Covariance on the robot position. """
self.P[:3, :3] = value
def addLandmark(self):
""" Add rows and columns for new landmarks."""
z = np.zeros((2, len(self.P)+2), dtype=self.P.dtype)
# add two rows
self.P = | np.concatenate((self.P, z[:, :-2]), axis=0) | numpy.concatenate |
#
# The MIT License (MIT)
#
# This file is part of pairwiseMKL
#
# Copyright (c) 2018 <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.
import numpy as np
import math
from scipy import stats
from pairwisemkl.learner.kron_decomp import kron_decomp_centralization_operator
def response_kernel_features(Y):
"""
Task: to compute feature vector for each label value
Input: Y Matrix with the original labels
Output: Psi_y Matrix storing features as row vectors
References:
[1] <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
<NAME>, <NAME>, <NAME>.
Learning with multiple pairwise kernels for drug bioactivity prediction.
Bioinformatics, 34, pages i509–i518. 2018.
"""
# Labels in the vector form
y = Y.ravel(order = 'C')
# Generate probability density function of the labels
min_y = min(y)
max_y = max(y)
n_interv = 50
step = float(max_y-min_y)/n_interv
x_interv = np.arange(math.floor((min_y)*10)/10-(n_interv+1)*step, math.ceil((max_y)*10)/10+(n_interv+1)*step, step)
# Intervals: [x_interv[0],x_interv[1]), [x_interv[1],x_interv[2]), ...
x = [(a+b)/2 for a,b in zip(x_interv[::1], x_interv[1::1])]
kde = stats.gaussian_kde(y)
x_kde = kde(x)
# plt.plot(x,x_kde)
# plt.xlim([min(x),max(x)])
# plt.show()
# Matrix storing features as row vectors (one feature vector per label)
Psi_y = np.empty([len(y), n_interv*2]); Psi_y[:] = np.NAN
for i in range(len(y)):
id_i = np.where(x >= y[i])[0][0]
Psi_y[i,] = x_kde[id_i-n_interv:id_i+n_interv]
Psi_y[i,] = Psi_y[i,]/np.linalg.norm(Psi_y[i,])
# Ky = Sum_q(Psi_y[:,q] Psi_y[:,q]^T)
return Psi_y
def compute_a_regression(Ka_list, Kb_list, Y):
"""
Task: to compute vector 'a' needed for optimizing pairwise kernel weights
(equation 16 of the paper describing pairwiseMKL method)
Input: Ka_list List of drug (view A in general) kernel matrices
Kb_list List of cell line (view B in general) kernel matrices
Y Matrix with the original labels
Output: a Vector storing Frobenius inner products between each
centered input pairwise kernel and the response
kernel
"""
# To compute the factors of the pairwise kernel centering operator
Q = kron_decomp_centralization_operator(Ka_list[0].shape[0], Kb_list[0].shape[0])
# Total number of pairwise kernels
p = len(Ka_list)*len(Kb_list)
ids_kernels = np.arange(p)
Ka_ids, Kb_ids = np.unravel_index(ids_kernels, (len(Ka_list),len(Kb_list)), order = 'C')
# Replace missing values in the label matrix with row means
if np.isnan(Y).any() == True:
nan_ids = np.where(np.isnan(Y))
row_mean = np.nanmean(Y, axis=1)
Y[nan_ids] = np.take(row_mean,nan_ids[0])
# If all the values in a row are missing, use global mean
if np.isnan(Y).any() == True:
nan_ids_remaining = np.where(np.isnan(Y))
global_mean = np.nanmean(Y.ravel(order = 'C'))
Y[nan_ids_remaining] = global_mean
# Compute feature vectors for each label value
Psi_y = response_kernel_features(Y)
a = np.zeros([1,p])
n_y = Psi_y.shape[0]
# Response kernel Ky
# K = np.zeros([n_y,n_y])
# q = 0
# while q < Psi_y.shape[1]:
# v_q = Psi_y[:,q].reshape(n_y,1)
# K = K + np.dot(v_q , v_q.T)
# q = q + 1
# Calculate elements of the vector 'a'
for i_pairwise_k in range(p):
i = Ka_ids[i_pairwise_k]
j = Kb_ids[i_pairwise_k]
Ka_1 = np.dot( | np.dot(Q[0][0],Ka_list[i]) | numpy.dot |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from rich.progress import track
import time
import os
PI = np.pi
class TestFunctions2D:
def __init__(self, function_name, x_min, x_max, y_min, y_max, global_minimum):
self.name = function_name
self.search_domain = {'x_min': x_min, 'x_max': x_max, 'y_min': y_min, 'y_max': y_max}
self.search_range = {'x_range': x_max - x_min, 'y_range': y_max - y_min}
self.global_minimum = global_minimum
def __call__(self, *args):
return 0
@staticmethod
def derivative(*args):
return 0
@staticmethod
def Hessian_Matrix(*args):
return 0
def save(self, trajectory):
folder_name = time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime())
figure_save_path = os.path.join('./data/exp/', 'frame_' + folder_name)
os.mkdir(figure_save_path)
x = np.arange(self.search_domain['x_min'], self.search_domain['x_max'], self.search_range['x_range'] / 1000.)
y = np.arange(self.search_domain['y_min'], self.search_domain['y_max'], self.search_range['y_range'] / 1000.)
X, Y = np.meshgrid(x, y)
Z = self.__call__([X, Y])
plt.figure(figsize=(10, 10))
CS = plt.contour(X, Y, Z, 40, alpha=0.7, cmap=mpl.cm.jet)
for global_min_i in self.global_minimum:
plt.scatter(global_min_i[0], global_min_i[1], c='r', marker='o')
plt.clabel(CS, inline=True, fontsize=10)
# plt.show()
for i in track(range(len(trajectory)), description="Generating Frame and saving in " + figure_save_path):
if trajectory is not None:
point_i = trajectory[i]
if i > 0:
plt.plot([point_i[0], point_i[0]],
[point_i[1], point_i[1]],
c='r', alpha=0.8, linestyle='-.')
plt.scatter(point_i[0], point_i[1], s=100,
c='b', alpha=0.8, marker='x')
plt.xticks(())
plt.yticks(())
plt.savefig(os.path.join(figure_save_path, str(i) + '.jpg'))
class AckleyFunction(TestFunctions2D):
def __init__(self):
super().__init__('Ackley Function', -5, 5, -5, 5, [[0, 0]])
def __call__(self, x_k):
x, y = x_k
return -20 * np.exp(-0.2 * np.sqrt(0.5 * (x ** 2 + y ** 2))) - np.exp(
0.5 * (np.cos(2 * np.pi * x) + np.cos(2 * np.pi * y))) + np.e + 20
@staticmethod
def derivative(x_k):
x, y = x_k
part_1 = (2 * np.sqrt(2) * np.exp(-(np.sqrt(2 * (x ** 2 + y ** 2))) / 10)) / (np.sqrt(x ** 2 + y ** 2))
part_2 = PI * np.exp(np.cos(2 * PI * x) / 2 + np.cos(2 * PI * y) / 2)
partial_x = part_1 * x + part_2 * np.sin(2 * PI * x)
partial_y = part_1 * y + part_2 * np.sin(2 * PI * y)
return np.array([partial_x, partial_y])
@staticmethod
def Hessian_Matrix(x_k):
pass
class SphereFunction(TestFunctions2D):
def __init__(self):
super().__init__('Sphere Function', -2, 2, -2, 2, [[0, 0]])
def __call__(self, x_k):
x, y = x_k
return x ** 2 + y ** 2
@staticmethod
def derivative(x_k):
x, y = x_k
partial_x = 2 * x
partial_y = 2 * y
return np.array([partial_x, partial_y])
@staticmethod
def Hessian_Matrix(x_k):
x, y = x_k
partial_xx = 2
partial_xy = 0
partial_yx = 0
partial_yy = 2
return np.array([[partial_xx, partial_xy], [partial_yx, partial_yy]])
class RosenbrockFunction(TestFunctions2D):
def __init__(self):
super().__init__('Sphere Function', -2, 2, -1, 3, [[1, 1]])
def __call__(self, x_k):
x, y = x_k
return 100 * (y - x ** 2) ** 2 + (1 - x) ** 2
@staticmethod
def derivative(x_k):
x, y = x_k
partial_x = -400 * x * y + 400 * x ** 3 + 2 * x - 2
partial_y = -200 * x ** 2 + 200 * y
return np.array([partial_x, partial_y])
@staticmethod
def Hessian_Matrix(x_k):
x, y = x_k
partial_xx = -400 * y + 1200 * x ** 2 + 2
partial_xy = -400 * x
partial_yx = -400 * x
partial_yy = 200
return np.array([[partial_xx, partial_xy], [partial_yx, partial_yy]])
class BealeFunction(TestFunctions2D):
def __init__(self):
super().__init__('Beale Function', -4.5, 4.5, -4.5, 4.5, [[3, 0.5]])
def __call__(self, x_k):
x, y = x_k
return (1.5 - x + x * y) ** 2 + (2.25 - x + x * y ** 2) ** 2 + (2.625 - x + x * y ** 3) ** 2
@staticmethod
def derivative(x_k):
x, y = x_k
partial_x = 0.25 * (y - 1) * (
8 * x * y ** 5 + 8 * x * y ** 4 + 16 * x * y ** 3 - 8 * x * y - 24 * x + 21 * y ** 2 + 39 * y + 51)
partial_y = 0.25 * x * (
24 * x * y ** 5 + 16 * x * y ** 3 - 24 * x * y ** 2 - 8 * x * y - 8 * x + 63 * y ** 2 + 36 * y + 12)
return np.array([partial_x, partial_y])
@staticmethod
def Hessian_Matrix(x_k):
x, y = x_k
partial_xx = 0.25 * (y - 1) * (8 * y ** 5 + 8 * y ** 4 + 16 * y ** 3 - 8 * y - 24)
partial_xy = 12 * x * y ** 5 + 8 * x * y ** 2 - 12 * x * y ** 2 - 4 * x + 63 * y ** 2 / 4 + 9 * y + 3
partial_yx = 12 * x * y ** 5 + 8 * x * y ** 3 - 12 * x * y ** 2 - 4 * x + 63 * y ** 2 / 4 + 9 * y + 3
partial_yy = x * (60 * x * y ** 4 + 24 * x * y ** 2 - 24 * x * y - 4 * x + 63 * y + 18) / 2.
return np.array([[partial_xx, partial_xy], [partial_yx, partial_yy]])
class GoldsteinPriceFunction(TestFunctions2D):
def __init__(self):
super().__init__('Goldstein Price Function', -2, 2, -2, 2, [[0, -1]])
def __call__(self, x_k):
x, y = x_k
return (1 + (x + y + 1) ** 2 * (19 - 14 * x + 3 * x ** 2 - 14 * y + 6 * x * y + 3 * y ** 2)) * (
30 + (2 * x - 3 * y) ** 2 * (18 - 32 * x + 12 * x ** 2 + 48 * y - 36 * x * y + 27 * y ** 2))
def derivative(self, x_k):
x, y = x_k
partial_x = 1152 * x ** 7 - 2016 * x ** 6 * y - 5376 * x ** 6 - 3888 * x ** 5 * y ** 2 + 8064 * x ** 5 * y + 5712 * x ** 5 + 6120 * x ** 4 * y ** 3 + \
12960 * x ** 4 * y ** 2 - 840 * x ** 4 * y + 6720 * x ** 4 + 5220 * x ** 3 * y ** 4 - 16320 * x ** 3 * y ** 3 - 21480 * x ** 3 * y ** 2 - \
30720 * x ** 3 * y - 9816 * x ** 3 - 5508 * x ** 2 * y ** 5 - 10440 * x ** 2 * y ** 4 + 3720 * x ** 2 * y ** 3 + 29520 * x ** 2 * y ** 2 + \
17352 * x ** 2 * y - 3216 * x ** 2 - 2916 * x * y ** 6 + 7344 * x * y ** 5 + 17460 * x * y ** 4 + 10080 * x * y ** 3 + 15552 * x * y ** 2 + \
14688 * x * y + 2520 * x + 972 * y ** 7 + 1944 * y ** 6 - 1188 * y ** 5 - 11880 * y ** 4 - 23616 * y ** 3 - 19296 * y ** 2 - 4680 * y + 720
partial_y = - 288 * x ** 7 - 1296 * x ** 6 * y + 1344 * x ** 6 + 3672 * x ** 5 * y ** 2 + 5184 * x ** 5 * y - 168 * x ** 5 + 5220 * x ** 4 * y ** 3 - \
12240 * x ** 4 * y ** 2 - 10740 * x ** 4 * y - 7680 * x ** 4 - 9180 * x ** 3 * y ** 4 - 13920 * x ** 3 * y ** 3 + 3720 * x ** 3 * y ** 2 + 19680 * x ** 3 * y + \
5784 * x ** 3 - 8748 * x ** 2 * y ** 5 + 18360 * x ** 2 * y ** 4 + 34920 * x ** 2 * y ** 3 + 15120 * x ** 2 * y ** 2 + 15552 * x ** 2 * y + 7344 * x ** 2 + \
6804 * x * y ** 6 + 11664 * x * y ** 5 - 5940 * x * y ** 4 - 47520 * x * y ** 3 - 70848 * x * y ** 2 - 38592 * x * y - 4680 * x + 5832 * y ** 7 - \
45368 * y ** 6 - 26568 * y ** 5 + 9720 * y ** 4 + 57384 * y ** 3 + 36864 * y ** 2 + 6120 * y + 720
return np.array([partial_x, partial_y])
@staticmethod
def Hessian_Matrix(x_k):
x, y = x_k
partial_xx = 8064 * x ** 6 - 12096 * x ** 5 * y - 32256 * x ** 5 - 19440 * x ** 4 * y ** 2 + 40320 * x ** 4 * y + 28560 * x ** 4 + 24480 * x ** 3 * y ** 3 + \
51840 * x ** 3 * y ** 2 - 3360 * x ** 3 * y + 26880 * x ** 3 + 15660 * x ** 2 * y ** 4 - 48960 * x ** 2 * y ** 3 - 64440 * x ** 2 * y ** 2 - \
92160 * x ** 2 * y - 29448 * x ** 2 - 11016 * x * y ** 5 - 20880 * x * y ** 4 + 7440 * x * y ** 3 + 59040 * x * y ** 2 + 34704 * x * y - \
6432 * x - 2916 * y ** 6 + 7344 * y ** 5 + 17460 * y ** 4 + 10080 * y ** 3 + 15552 * y ** 2 + 14688 * y + 2520
partial_xy = - 2016 * x ** 6 - 7776 * x ** 5 * y + 8064 * x ** 5 + 18360 * x ** 4 * y ** 2 + 25920 * x ** 4 * y - \
840 * x ** 4 + 20880 * x ** 3 * y ** 3 - 48960 * x ** 3 * y ** 2 - 42960 * x ** 3 * y - \
30720 * x ** 3 - 27540 * x ** 2 * y ** 4 - 41760 * x ** 2 * y ** 3 + 11160 * x ** 2 * y ** 2 + \
59040 * x ** 2 * y + 17352 * x ** 2 - 17496 * x * y ** 5 + 36720 * x * y ** 4 + 69840 * x * y ** 3 + \
30240 * x * y ** 2 + 31104 * x * y + 14688 * x + 6804 * y ** 6 + 11664 * y ** 5 - 5940 * y ** 4 - \
47520 * y ** 3 - 70848 * y ** 2 - 38592 * y - 4680
partial_yx = - 2016 * x ** 6 - 7776 * x ** 5 * y + 8064 * x ** 5 + 18360 * x ** 4 * y ** 2 + 25920 * x ** 4 * y - \
840 * x ** 4 + 20880 * x ** 3 * y ** 3 - 48960 * x ** 3 * y ** 2 - 42960 * x ** 3 * y - 30720 * x ** 3 - \
27540 * x ** 2 * y ** 4 - 41760 * x ** 2 * y ** 3 + 11160 * x ** 2 * y ** 2 + 59040 * x ** 2 * y + \
17352 * x ** 2 - 17496 * x * y ** 5 + 36720 * x * y ** 4 + 69840 * x * y ** 3 + 30240 * x * y ** 2 + \
31104 * x * y + 14688 * x + 6804 * y ** 6 + 11664 * y ** 5 - 5940 * y ** 4 - 47520 * y ** 3 - 70848 * y ** 2 - 38592 * y - 4680
partial_yy = - 1296 * x ** 6 + 7344 * x ** 5 * y + 5184 * x ** 5 + 15660 * x ** 4 * y ** 2 - 24480 * x ** 4 * y - \
10740 * x ** 4 - 36720 * x ** 3 * y ** 3 - 41760 * x ** 3 * y ** 2 + 7440 * x ** 3 * y + 19680 * x ** 3 - \
43740 * x ** 2 * y ** 4 + 73440 * x ** 2 * y ** 3 + 104760 * x ** 2 * y ** 2 + 30240 * x ** 2 * y + \
15552 * x ** 2 + 40824 * x * y ** 5 + 58320 * x * y ** 4 - 23760 * x * y ** 3 - 142560 * x * y ** 2 - \
141696 * x * y - 38592 * x + 40824 * y ** 6 - 272208 * y ** 5 - 132840 * y ** 4 + 38880 * y ** 3 + 172152 * y ** 2 + 73728 * y + 6120
return np.array([[partial_xx, partial_xy], [partial_yx, partial_yy]])
class BoothFunction(TestFunctions2D):
def __init__(self):
super().__init__('Booth Function', -10, 10, -10, 10, [[1, 3]])
def __call__(self, x_k):
x, y = x_k
return (x + 2 * y - 7) ** 2 + (2 * x + y - 5) ** 2
def derivative(self, x_k):
x, y = x_k
partial_x = 10 * x + 8 * y - 34
partial_y = 8 * x + 10 * y - 38
return np.array([partial_x, partial_y])
@staticmethod
def Hessian_Matrix(x_k):
x, y = x_k
partial_xx = 10
partial_xy = 8
partial_yx = 8
partial_yy = 10
return np.array([[partial_xx, partial_xy], [partial_yx, partial_yy]])
class MatyasFunction(TestFunctions2D):
def __init__(self):
super(MatyasFunction, self).__init__('Matyas Function', -10, 10, -10, 10, [[0, 0]])
def __call__(self, x_k):
x, y = x_k
return 0.26 * (x ** 2 + y ** 2) - 0.48 * x * y
def derivative(self, x_k):
x, y = x_k
partial_x = (13 * x - 12 * y) / 25
partial_y = -12 * x / 25 + 13 * y / 25
return | np.array([partial_x, partial_y]) | numpy.array |
import gmplot
from location import Satellite, River, BGate
from matplotlib.cm import ScalarMappable
import matplotlib.pyplot as plt
import numpy as np
SW_LAT, SW_LON = 52.464011, 13.274099
NE_LAT, NE_LON = 52.586925, 13.521837
class Mapper(object):
def __init__(self, objs, n=256):
self.objects = objs
self.latitudes, self.longitudes = self.generate_mesh_grid(n)
def generate_mesh_grid(self, n):
"""
Returns X and Y 1-D arrays of latitudes and longitudes
gridding Berlin's map.
"""
x = np.linspace(SW_LAT, NE_LAT, n)
y = np.linspace(SW_LON, NE_LON, n)
X, Y = np.meshgrid(x, y)
return X.flatten(), Y.flatten()
def pull_heatmap_idx(self, distribution, size=10000):
"""
Sample points on map from a distribution to generate heatmap.
"""
return np.random.choice(np.arange(distribution.size), size=size, p=distribution)
def get_distribution(self, objs):
"""
Get the distribution on the map from different objects.
Distributions get combined through bayesian update:
Starting from a uniform distribution, the new distributions from
independent sources come as new likelihoods multiplying our prior
to obtain the posterior. Normalization is done once, as a final step.
"""
distribution = np.ones(self.latitudes.shape)
distribution /= np.sum(distribution)
for obj in objs:
probs = obj.get_pdf(self.latitudes, self.longitudes)
distribution *= probs
distribution /= np.sum(distribution)
return distribution
def find_maximum(self, distribution):
"""
Returns the coordinates of the maximum of a given distribution.
"""
max_idx = | np.argmax(distribution) | numpy.argmax |
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 27 19:09:30 2019
@author: <NAME> (Git:JueMol)
"""
import math as math
import numpy as np
import matplotlib.pyplot as plt
class Trajectory():
''' Convenient class to help with remembering trajectories '''
def __init__(self):
self.posx = []
self.posy = []
self.velx = []
self.vely = []
self.accx = []
self.accy = []
self.angl = []
self.t = 0.
self.episode = None
def remember_step(self, pos, vel, acc, ang, t):
self.posx.append(pos[0])
self.posy.append(pos[1])
self.velx.append(vel[0])
self.vely.append(vel[1])
self.accx.append(acc[0])
self.accy.append(acc[1])
self.angl.append(ang)
self.t = t
def gettrajectory(self):
return self.posx,\
self.posy,\
self.velx,\
self.vely,\
self.accx,\
self.accy,\
self.angl,\
self.t
X = 0 # ... used to make the code below more readable
Y = 1
class SpaceShuttlePhysics():
'''
Simulates the physics of a space shuttle that has a constant thrust in a 100x100 world
Initial position is (x=10, y=0)
Initial heading of the shuttle is vertical
Initial velocity is zero
The goal is, to reach the right world boundary within in the y range between 60 and 100
There exist an obstacle as rectangle of height 60 positioned at x=60 to 70
'''
def __init__(self, runtime=100.):
self.init_pose = np.array([10.0, 1.0]) # X=10, Y=1
self.init_velo = np.array([0.0, 0.0]) # stand still
self.init_angle = 90.0 # start with vertical orientation
self.pos = self.init_pose
self.vel = self.init_velo
self.ang = self.init_angle
self.dt_ref = 0.2
self.dt = 1.
self.thrust_max = 0.2
self.runtime = runtime
self.demo = False
self.obst_height = 55. # ... made the height of the obstacle variable
# create action space
tmp = []
tmp.append(np.array([-1, self.thrust_max]))
tmp.append(np.array([ 0, self.thrust_max]))
tmp.append(np.array([ 1, self.thrust_max]))
self.real_action_space = np.array(tmp)
# Worlds boundaries (used for drawing)
self.x_bound = [100, 0., 0., 60., 60., 70., 70., 100., 100.]
self.y_bound = [100., 100, 0., 0., self.obst_height, self.obst_height, 0., 0., 60.]
self.bestpath = Trajectory()
self.bestpath.t = np.inf
self.bestpath_dist = np.inf
self.dt_steps = [0.4, 0.5, 0.6, 0.8, 1.0]
self.reset()
################################
# Algorithmic helper functions #
################################
def get_trust_vector(self, ang):
return np.array([math.cos(ang*math.pi/180.0), math.sin(ang*math.pi/180.0)]) # ... think in 360 dregee angles
def get_real_action(self, action):
return(self.real_action_space[action])
def norm_vector(self, vec):
return vec/self.len(vec)
def len(self, vec1):
return np.sqrt(np.sum(np.square(vec1)))
def distance(self, vec1, vec2):
return self.len(vec2-vec1)
def scalar_product(self, vec1, vec2):
return np.dot(vec1, vec2)
def state_size(self):
return 5
def action_size(self):
return len(self.real_action_space)
def get_angle(self, vec):
tmp_ang = math.atan2(vec[Y], vec[X]) * 180.0 / math.pi
if tmp_ang < 0.0:
tmp_ang += 360.0
return tmp_ang
def get_segment_fraction_in_area(self, pos_old, pos):
segment_frac_in_area = 1.0
segment_frac_Y = 1.0
segment_frac_X = 1.0
if pos_old[Y] < 100. and pos[Y] >= 100.:
segment_frac_Y = (100.-pos_old[Y])/(pos[Y]-pos_old[Y])+0.01
if pos_old[X] < 100. and pos[X] >= 100.:
segment_frac_X = (100.-pos_old[X])/(pos[X]-pos_old[X])+0.01
segment_frac_in_area = min(segment_frac_Y, segment_frac_X)
if pos_old[X] < 60. and pos[X] >= 60. and pos[Y] <= self.obst_height:
segment_frac_in_area = (60.-pos_old[X])/(pos[X]-pos_old[X])+0.01
return segment_frac_in_area
#####################################################
# Event funtions with respect to the world boundary #
#####################################################
def obstacle(self, pos):
''' Checks if the obstacle is hit
(thereby the size of shuttle is not taken to account) '''
return pos[X] >= 60. and pos[X] <= 70.0 and pos[Y] <= self.obst_height
def crashes(self, pos):
''' Checks for collisions.
(thereby the size of shuttle is not taken to account) '''
if pos[X] < 0.0: # leaves world to the left
return True
elif pos[Y] > 100.0 or pos[Y] < 0.0: # leaves world to top or bottom
return True
elif pos[X] > 100.0 and pos[Y] < 60.0: # Hits right wall
return True
def reached_goal(self, pos) :
''' Checks whether the goal ('docking bay') is reached.
(thereby the size of shuttle is not taken to account) '''
return pos[X] > 100.0 and pos[Y] > 60.0 and pos[Y] < 100.0 # leaves world to the right, but through docking bay entry
def naive_policy_action(self):
''' Get Action from naive linear policy.
(It works mainly such, that the steering tends to point toward the (tempory) goal) '''
top_of_goal = np.array([100.0, 100.0]) - self.pos # ... top of goal (docking bay)
target_vector = np.array([100.0, 60.0]) - self.pos # ... bottom of goal (docking bay)
# Dont steer too early - just if just about to see the docking bay otherwise steer to corner of obstacle
if (self.pos[1] + (top_of_goal[Y]-self.pos[1])/top_of_goal[X] * (60.-self.pos[X])) < 60. and self.pos[Y] < 30.:
target_vector = np.array([60., self.obst_height+5.]) - self.pos
self_ang = int(self.ang)
heading_ang = int(self.get_angle(target_vector))
diff_ang = heading_ang-self_ang
if diff_ang > 180.:
diff_ang -= 360.
return int(np.sign(diff_ang)) + 1 # steer always in the direction of the targets
####################################
# Functions used for Deep Learning #
####################################
def reset(self, eps=None):
''' Resets the shuttles physics.
The shuttle is (again) placed in the lower left corner, heading up wit zero velocity
'''
self.time = 0.0
self.pos = np.copy(self.init_pose)
self.vel = | np.copy(self.init_velo) | numpy.copy |
from math import ceil
from sklearn.pipeline import Pipeline
from matplotlib.pyplot import plot
from sklearn.preprocessing import MinMaxScaler, FunctionTransformer
import numpy as np
import pandas as pd
from IPython.core.display import display
import matplotlib.pyplot as plt
from tensorflow.keras.utils import to_categorical
from .highlight import TimeseriesHighlightTransformer
def load_ucr_dataset(name, path='data/UCR_TS_Archive_2015/', is_fft=False, combine=False, highlight_augmentation=False, reshape=True, feature_range=(-1, 1)):
train = pd.read_csv('%s/%s/%s_TRAIN' % (path, name, name), header=None, sep=',')
test = pd.read_csv('%s/%s/%s_TEST' % (path, name, name), header=None, sep=',')
if combine:
train = test = pd.concat([train, test])
if is_fft:
X_train = np.fft.fft(train.loc[:, 1:].values)
X_test = np.fft.fft(test.loc[:, 1:].values)
else:
X_train = train.loc[:, 1:].values
X_test = test.loc[:, 1:].values
y_train = train.loc[:, 0].values
y_test = test.loc[:, 0].values
display(X_train.shape)
scaler = MinMaxScaler(feature_range=feature_range)
# scaler = RobustScaler()
plt.title('Before scaling')
plot(X_train[0])
plt.show()
X_train, X_test, _ = np.split(
scaler.fit_transform(np.concatenate((X_train, X_test), axis=0).transpose()).transpose(),
[X_train.shape[0], X_train.shape[0] + X_test.shape[0]]
)
plt.title('After scaling')
plot(X_train[0])
plt.show()
display(X_train.shape)
display(X_test.shape)
if highlight_augmentation:
pipeline = Pipeline([
('timeseries_segmentation', TimeseriesHighlightTransformer()),
('transpose', FunctionTransformer(np.transpose)),
('scaler', MinMaxScaler(feature_range=(-1, 1))),
('transpose_back', FunctionTransformer(np.transpose)),
])
X_train, X_test, _ = np.split(
pipeline.fit_transform(np.concatenate((X_train, X_test), axis=0)),
[X_train.shape[0], X_train.shape[0] + X_test.shape[0]]
)
plt.title('After highlight_augmentation')
plot(X_train[0])
plt.show()
display(X_train.shape)
display(X_test.shape)
if reshape:
train_measurment_count, train_series_len = X_train.shape
test_measurment_count, test_series_len = X_test.shape
# TODO: test new shape
# X_train = np.apply_along_axis(lambda x: [x], 1, X_train)
# X_test = np.apply_along_axis(lambda x: [x], 1, X_test)
X_train = np.reshape(X_train, X_train.shape + (1,))
X_test = np.reshape(X_test, X_test.shape + (1,))
display(y_train)
y_train = np.reshape(np.apply_along_axis(lambda x: np.repeat(x, train_series_len), 0,
np.reshape(y_train, (1, y_train.shape[0]))).transpose(),
(train_measurment_count, 1, train_series_len))
display(y_test)
y_test = np.reshape(np.apply_along_axis(lambda x: np.repeat(x, test_series_len), 0,
np.reshape(y_test, (1, y_test.shape[0]))).transpose(),
(test_measurment_count, 1, test_series_len))
# for series_num in range(0, X_train.shape[0]):
# plt.plot(train.loc[series_num].values[1:])
# plt.show()
f, plots = plt.subplots(len(np.unique(y_train)), 1)
for series_num in range(0, X_train.shape[0]):
color_num = y_train[series_num][0][0] % 10
plots[color_num].plot(np.transpose(X_train[series_num])[0], color='C%s' % (color_num), alpha=.5)
plt.show()
f, plots = plt.subplots(len(np.unique(y_test)), 1)
for series_num in range(0, X_test.shape[0]):
color_num = y_test[series_num][0][0] % 10
plots[color_num].plot(np.transpose(X_test[series_num])[0], color='C%s' % (color_num), alpha=.5)
plt.show()
return X_train, X_test, y_train, y_test
# Taken from https://github.com/musyoku/adversarial-autoencoder/blob/6a2334fb010845f2d4e98cdb11920d73f3bb245a/aae/dataset/semi_supervised.py#L42
class Dataset():
def __init__(self, train, test, num_classes, num_labeled_data=5, num_extra_classes=0, use_test_as_unlabeled=False, batch_size=None):
self.images_train, self.original_labels_train = train
self.images_test, self.original_labels_test = test
self.original_labels_train_map = np.unique(self.original_labels_train)
self.original_labels_test_map = np.unique(self.original_labels_test)
if self.original_labels_train_map.shape[0] != self.original_labels_test_map.shape[0]:
raise AssertionError('train and test datasets contains different amount of classes')
if self.original_labels_train_map.shape[0] != num_classes:
raise AssertionError('train dataset amount of classes (%s) is not equal to num_classes (%s)' % (self.original_labels_train_map.shape[0], num_classes,))
self.labels_train_map = np.arange(self.original_labels_train_map.shape[0])
self.labels_test_map = np.arange(self.original_labels_test_map.shape[0])
self.labels_train = self.normalize_labels(self.original_labels_train, self.original_labels_train_map, self.labels_train_map)
self.labels_test = self.normalize_labels(self.original_labels_test, self.original_labels_test_map, self.labels_test_map)
self.num_classes = num_classes
self.num_extra_classes = num_extra_classes
indices_count = len(self.images_train)
indices = | np.arange(0, indices_count) | numpy.arange |
# -*- coding: utf-8 -*-
"""
These the test the public routines exposed in types/common.py
related to inference and not otherwise tested in types/test_common.py
"""
from warnings import catch_warnings, simplefilter
import collections
import re
from datetime import datetime, date, timedelta, time
from decimal import Decimal
from numbers import Number
from fractions import Fraction
import numpy as np
import pytz
import pytest
import pandas as pd
from pandas._libs import lib, iNaT, missing as libmissing
from pandas import (Series, Index, DataFrame, Timedelta,
DatetimeIndex, TimedeltaIndex, Timestamp,
Panel, Period, Categorical, isna, Interval,
DateOffset)
from pandas import compat
from pandas.compat import u, PY2, StringIO, lrange
from pandas.core.dtypes import inference
from pandas.core.dtypes.common import (
is_timedelta64_dtype,
is_timedelta64_ns_dtype,
is_datetime64_dtype,
is_datetime64_ns_dtype,
is_datetime64_any_dtype,
is_datetime64tz_dtype,
is_number,
is_integer,
is_float,
is_bool,
is_scalar,
is_scipy_sparse,
ensure_int32,
ensure_categorical)
from pandas.util import testing as tm
import pandas.util._test_decorators as td
@pytest.fixture(params=[True, False], ids=str)
def coerce(request):
return request.param
# collect all objects to be tested for list-like-ness; use tuples of objects,
# whether they are list-like or not (special casing for sets), and their ID
ll_params = [
([1], True, 'list'), # noqa: E241
([], True, 'list-empty'), # noqa: E241
((1, ), True, 'tuple'), # noqa: E241
(tuple(), True, 'tuple-empty'), # noqa: E241
({'a': 1}, True, 'dict'), # noqa: E241
(dict(), True, 'dict-empty'), # noqa: E241
({'a', 1}, 'set', 'set'), # noqa: E241
(set(), 'set', 'set-empty'), # noqa: E241
(frozenset({'a', 1}), 'set', 'frozenset'), # noqa: E241
(frozenset(), 'set', 'frozenset-empty'), # noqa: E241
(iter([1, 2]), True, 'iterator'), # noqa: E241
(iter([]), True, 'iterator-empty'), # noqa: E241
((x for x in [1, 2]), True, 'generator'), # noqa: E241
((x for x in []), True, 'generator-empty'), # noqa: E241
(Series([1]), True, 'Series'), # noqa: E241
(Series([]), True, 'Series-empty'), # noqa: E241
(Series(['a']).str, True, 'StringMethods'), # noqa: E241
(Series([], dtype='O').str, True, 'StringMethods-empty'), # noqa: E241
(Index([1]), True, 'Index'), # noqa: E241
(Index([]), True, 'Index-empty'), # noqa: E241
(DataFrame([[1]]), True, 'DataFrame'), # noqa: E241
(DataFrame(), True, 'DataFrame-empty'), # noqa: E241
(np.ndarray((2,) * 1), True, 'ndarray-1d'), # noqa: E241
(np.array([]), True, 'ndarray-1d-empty'), # noqa: E241
(np.ndarray((2,) * 2), True, 'ndarray-2d'), # noqa: E241
(np.array([[]]), True, 'ndarray-2d-empty'), # noqa: E241
(np.ndarray((2,) * 3), True, 'ndarray-3d'), # noqa: E241
(np.array([[[]]]), True, 'ndarray-3d-empty'), # noqa: E241
(np.ndarray((2,) * 4), True, 'ndarray-4d'), # noqa: E241
(np.array([[[[]]]]), True, 'ndarray-4d-empty'), # noqa: E241
(np.array(2), False, 'ndarray-0d'), # noqa: E241
(1, False, 'int'), # noqa: E241
(b'123', False, 'bytes'), # noqa: E241
(b'', False, 'bytes-empty'), # noqa: E241
('123', False, 'string'), # noqa: E241
('', False, 'string-empty'), # noqa: E241
(str, False, 'string-type'), # noqa: E241
(object(), False, 'object'), # noqa: E241
(np.nan, False, 'NaN'), # noqa: E241
(None, False, 'None') # noqa: E241
]
objs, expected, ids = zip(*ll_params)
@pytest.fixture(params=zip(objs, expected), ids=ids)
def maybe_list_like(request):
return request.param
def test_is_list_like(maybe_list_like):
obj, expected = maybe_list_like
expected = True if expected == 'set' else expected
assert inference.is_list_like(obj) == expected
def test_is_list_like_disallow_sets(maybe_list_like):
obj, expected = maybe_list_like
expected = False if expected == 'set' else expected
assert inference.is_list_like(obj, allow_sets=False) == expected
def test_is_sequence():
is_seq = inference.is_sequence
assert (is_seq((1, 2)))
assert (is_seq([1, 2]))
assert (not is_seq("abcd"))
assert (not is_seq(u("abcd")))
assert (not is_seq(np.int64))
class A(object):
def __getitem__(self):
return 1
assert (not is_seq(A()))
def test_is_array_like():
assert inference.is_array_like(Series([]))
assert inference.is_array_like(Series([1, 2]))
assert inference.is_array_like(np.array(["a", "b"]))
assert inference.is_array_like(Index(["2016-01-01"]))
class DtypeList(list):
dtype = "special"
assert inference.is_array_like(DtypeList())
assert not inference.is_array_like([1, 2, 3])
assert not inference.is_array_like(tuple())
assert not inference.is_array_like("foo")
assert not inference.is_array_like(123)
@pytest.mark.parametrize('inner', [
[], [1], (1, ), (1, 2), {'a': 1}, {1, 'a'}, Series([1]),
Series([]), Series(['a']).str, (x for x in range(5))
])
@pytest.mark.parametrize('outer', [
list, Series, np.array, tuple
])
def test_is_nested_list_like_passes(inner, outer):
result = outer([inner for _ in range(5)])
assert inference.is_list_like(result)
@pytest.mark.parametrize('obj', [
'abc', [], [1], (1,), ['a'], 'a', {'a'},
[1, 2, 3], Series([1]), DataFrame({"A": [1]}),
([1, 2] for _ in range(5)),
])
def test_is_nested_list_like_fails(obj):
assert not inference.is_nested_list_like(obj)
@pytest.mark.parametrize(
"ll", [{}, {'A': 1}, Series([1])])
def test_is_dict_like_passes(ll):
assert inference.is_dict_like(ll)
@pytest.mark.parametrize(
"ll", ['1', 1, [1, 2], (1, 2), range(2), Index([1])])
def test_is_dict_like_fails(ll):
assert not inference.is_dict_like(ll)
@pytest.mark.parametrize("has_keys", [True, False])
@pytest.mark.parametrize("has_getitem", [True, False])
@pytest.mark.parametrize("has_contains", [True, False])
def test_is_dict_like_duck_type(has_keys, has_getitem, has_contains):
class DictLike(object):
def __init__(self, d):
self.d = d
if has_keys:
def keys(self):
return self.d.keys()
if has_getitem:
def __getitem__(self, key):
return self.d.__getitem__(key)
if has_contains:
def __contains__(self, key):
return self.d.__contains__(key)
d = DictLike({1: 2})
result = inference.is_dict_like(d)
expected = has_keys and has_getitem and has_contains
assert result is expected
def test_is_file_like(mock):
class MockFile(object):
pass
is_file = inference.is_file_like
data = StringIO("data")
assert is_file(data)
# No read / write attributes
# No iterator attributes
m = MockFile()
assert not is_file(m)
MockFile.write = lambda self: 0
# Write attribute but not an iterator
m = MockFile()
assert not is_file(m)
# gh-16530: Valid iterator just means we have the
# __iter__ attribute for our purposes.
MockFile.__iter__ = lambda self: self
# Valid write-only file
m = MockFile()
assert is_file(m)
del MockFile.write
MockFile.read = lambda self: 0
# Valid read-only file
m = MockFile()
assert is_file(m)
# Iterator but no read / write attributes
data = [1, 2, 3]
assert not is_file(data)
assert not is_file(mock.Mock())
@pytest.mark.parametrize(
"ll", [collections.namedtuple('Test', list('abc'))(1, 2, 3)])
def test_is_names_tuple_passes(ll):
assert inference.is_named_tuple(ll)
@pytest.mark.parametrize(
"ll", [(1, 2, 3), 'a', Series({'pi': 3.14})])
def test_is_names_tuple_fails(ll):
assert not inference.is_named_tuple(ll)
def test_is_hashable():
# all new-style classes are hashable by default
class HashableClass(object):
pass
class UnhashableClass1(object):
__hash__ = None
class UnhashableClass2(object):
def __hash__(self):
raise TypeError("Not hashable")
hashable = (1,
3.14,
np.float64(3.14),
'a',
tuple(),
(1, ),
HashableClass(), )
not_hashable = ([], UnhashableClass1(), )
abc_hashable_not_really_hashable = (([], ), UnhashableClass2(), )
for i in hashable:
assert inference.is_hashable(i)
for i in not_hashable:
assert not inference.is_hashable(i)
for i in abc_hashable_not_really_hashable:
assert not inference.is_hashable(i)
# numpy.array is no longer collections.Hashable as of
# https://github.com/numpy/numpy/pull/5326, just test
# is_hashable()
assert not inference.is_hashable(np.array([]))
# old-style classes in Python 2 don't appear hashable to
# collections.Hashable but also seem to support hash() by default
if PY2:
class OldStyleClass():
pass
c = OldStyleClass()
assert not isinstance(c, compat.Hashable)
assert inference.is_hashable(c)
hash(c) # this will not raise
@pytest.mark.parametrize(
"ll", [re.compile('ad')])
def test_is_re_passes(ll):
assert inference.is_re(ll)
@pytest.mark.parametrize(
"ll", ['x', 2, 3, object()])
def test_is_re_fails(ll):
assert not inference.is_re(ll)
@pytest.mark.parametrize(
"ll", [r'a', u('x'),
r'asdf',
re.compile('adsf'),
u(r'\u2233\s*'),
re.compile(r'')])
def test_is_recompilable_passes(ll):
assert inference.is_re_compilable(ll)
@pytest.mark.parametrize(
"ll", [1, [], object()])
def test_is_recompilable_fails(ll):
assert not inference.is_re_compilable(ll)
class TestInference(object):
def test_infer_dtype_bytes(self):
compare = 'string' if PY2 else 'bytes'
# string array of bytes
arr = np.array(list('abc'), dtype='S1')
assert lib.infer_dtype(arr) == compare
# object array of bytes
arr = arr.astype(object)
assert lib.infer_dtype(arr) == compare
# object array of bytes with missing values
assert lib.infer_dtype([b'a', np.nan, b'c'], skipna=True) == compare
def test_isinf_scalar(self):
# GH 11352
assert libmissing.isposinf_scalar(float('inf'))
assert libmissing.isposinf_scalar(np.inf)
assert not libmissing.isposinf_scalar(-np.inf)
assert not libmissing.isposinf_scalar(1)
assert not libmissing.isposinf_scalar('a')
assert libmissing.isneginf_scalar(float('-inf'))
assert libmissing.isneginf_scalar(-np.inf)
assert not libmissing.isneginf_scalar(np.inf)
assert not libmissing.isneginf_scalar(1)
assert not libmissing.isneginf_scalar('a')
def test_maybe_convert_numeric_infinities(self):
# see gh-13274
infinities = ['inf', 'inF', 'iNf', 'Inf',
'iNF', 'InF', 'INf', 'INF']
na_values = {'', 'NULL', 'nan'}
pos = np.array(['inf'], dtype=np.float64)
neg = np.array(['-inf'], dtype=np.float64)
msg = "Unable to parse string"
for infinity in infinities:
for maybe_int in (True, False):
out = lib.maybe_convert_numeric(
np.array([infinity], dtype=object),
na_values, maybe_int)
tm.assert_numpy_array_equal(out, pos)
out = lib.maybe_convert_numeric(
np.array(['-' + infinity], dtype=object),
na_values, maybe_int)
tm.assert_numpy_array_equal(out, neg)
out = lib.maybe_convert_numeric(
np.array([u(infinity)], dtype=object),
na_values, maybe_int)
tm.assert_numpy_array_equal(out, pos)
out = lib.maybe_convert_numeric(
np.array(['+' + infinity], dtype=object),
na_values, maybe_int)
tm.assert_numpy_array_equal(out, pos)
# too many characters
with pytest.raises(ValueError, match=msg):
lib.maybe_convert_numeric(
np.array(['foo_' + infinity], dtype=object),
na_values, maybe_int)
def test_maybe_convert_numeric_post_floatify_nan(self, coerce):
# see gh-13314
data = np.array(['1.200', '-999.000', '4.500'], dtype=object)
expected = np.array([1.2, np.nan, 4.5], dtype=np.float64)
nan_values = {-999, -999.0}
out = lib.maybe_convert_numeric(data, nan_values, coerce)
tm.assert_numpy_array_equal(out, expected)
def test_convert_infs(self):
arr = np.array(['inf', 'inf', 'inf'], dtype='O')
result = lib.maybe_convert_numeric(arr, set(), False)
assert result.dtype == np.float64
arr = np.array(['-inf', '-inf', '-inf'], dtype='O')
result = lib.maybe_convert_numeric(arr, set(), False)
assert result.dtype == np.float64
def test_scientific_no_exponent(self):
# See PR 12215
arr = np.array(['42E', '2E', '99e', '6e'], dtype='O')
result = lib.maybe_convert_numeric(arr, set(), False, True)
assert np.all( | np.isnan(result) | numpy.isnan |
"""Plotting methods for model evaluation.
This module can be used to evaluate any kind of weather model (machine learning,
NWP, heuristics, human forecasting, etc.). This module is completely agnostic
of where the forecasts come from.
--- REFERENCES ---
<NAME>., and <NAME>, 1986: "The attributes diagram: A geometrical framework
for assessing the quality of probability forecasts". International Journal
of Forecasting, 2 (3), 285-293.
"""
import numpy
from descartes import PolygonPatch
from matplotlib import pyplot
import matplotlib.colors
from gewittergefahr.gg_utils import model_evaluation as model_eval
from gewittergefahr.gg_utils import polygons
from gewittergefahr.gg_utils import number_rounding as rounder
from gewittergefahr.gg_utils import error_checking
from gewittergefahr.plotting import plotting_utils
# TODO(thunderhoser): Variable and method names are way too verbose.
ROC_CURVE_COLOUR = numpy.array([228, 26, 28], dtype=float) / 255
ROC_CURVE_WIDTH = 3.
RANDOM_ROC_COLOUR = numpy.full(3, 152. / 255)
RANDOM_ROC_WIDTH = 2.
PERF_DIAGRAM_COLOUR = numpy.array([228, 26, 28], dtype=float) / 255
PERF_DIAGRAM_WIDTH = 3.
FREQ_BIAS_COLOUR = numpy.full(3, 152. / 255)
FREQ_BIAS_WIDTH = 2.
FREQ_BIAS_STRING_FORMAT = '%.2f'
FREQ_BIAS_PADDING = 10
FREQ_BIAS_LEVELS = numpy.array([0.25, 0.5, 0.75, 1, 1.5, 2, 3, 5])
CSI_LEVELS = | numpy.linspace(0, 1, num=11, dtype=float) | numpy.linspace |
import argparse
from glob import glob
import os
import sys
import joblib
import numpy as np
from skimage.io import imread
from sklearn.decomposition import PCA
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.neighbors import KNeighborsClassifier
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
from sklearn.svm import SVC
from tqdm import tqdm
from utils import ImageTransformer
models = [
GridSearchCV(SVC(), {
'kernel': ('linear', 'rbf', 'sigmoid'),
'C': [0.1, 1, 10]
}),
GridSearchCV(KNeighborsClassifier(), {
'n_neighbors': [3,5,7,9],
'weights': ('uniform', 'distance')
}),
GridSearchCV(RandomForestClassifier(), {
'n_estimators': [50, 100, 200, 300, 500],
}),
]
def read_dataset(data_path):
categories = ['good', 'flare']
X = []
Y = []
for i, category in enumerate(categories):
for img in glob(data_path+'/training/'+category+'/*'):
raw_image = imread(img)
X.append(raw_image)
Y.append(i)
return | np.array(X) | numpy.array |
#!CRYOLO_INSTALL_PATH/bin/python
'''
This script is designed to wrap cryolo and janni into a Relion Scheduler processing list.
Original Version written by <NAME> (6/17/2021).
'''
import os,sys,argparse,itertools,datetime
import subprocess
import numpy as np
from cryolo_wrapper_library import *
#Some libraries for crYOLO and relion disagree, so have the cryolo ones prepended only when running from the wrapper.
cryolo_path = "CRYOLO_INSTALL_PATH"
old_PATH = os.environ["PATH"]
os.environ["PATH"] = os.path.join(cryolo_path,"bin") + os.pathsep + old_PATH
old_LD_LIB = os.environ["LD_LIBRARY_PATH"]
os.environ["LD_LIBRARY_PATH"] = os.path.join(cryolo_path,"lib") + os.pathsep + old_LD_LIB
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--train",action='store_true',help="Do cryolo_train (prepare the picking model), not cryolo_predict (full set particle picking).")
parser.add_argument("--manual",action='store_true',help="Manually pick particles (typically for training model)")
parser.add_argument("--predict",action='store_true',help="Pick particles from micrographs using model from \"--model\"")
parser.add_argument("--p_model",default="/pl/active/BioKEM/cryolo_gen_models/gmodel_phosnet_202005_nn_N63_c17.h5",help="Model to use for particle picking")
parser.add_argument("--denoise",action='store_true',help="Denoise micrographs from \"--in_mics\", rather than pick or train on them")
parser.add_argument("--nmic",default=15,type=int,help="Number of micrographs to denoise (and use for manual picking pre-training)")
parser.add_argument("--extension",default=".mrc",help="Extension by which to recognize micrographs for denoising and picking")
parser.add_argument("--n_model",default="/pl/active/BioKEM/cryolo_gen_models/gmodel_janni_20190703.h5",help="Model for micrograph denoising.")
parser.add_argument("--config_setup",action='store_true',help="Set up the config_cryolo.json file instead of running any denoising/picking.")
parser.add_argument("--threshold",default=0.1,type=float,help="Threshold for picking algorithm (higher = more selective/fewer particles).")
parser.add_argument("--train_path",help="Path to micrographs for neural net training (i.e., path to manually picked micrographs")
parser.add_argument("--distance",help="crYOLO-enforced distance constraint to omit boxes. (i.e., particles must be spaces \"--distance\" apart to be considered).")
#Define default paths for picking and noise models since an input of "" doesn't trip the "default", but just a blank string
#These calls won't be run by relion (i.e., the default paths won't change unless you hard-code them here)
parser.add_argument("--n_model_default",default="/pl/active/BioKEM/cryolo_gen_models/gmodel_janni_20190703.h5",help="Path to default model to use if none is explicitly defined")
parser.add_argument("--p_model_default",default="/pl/active/BioKEM/cryolo_gen_models/gmodel_phosnet_202005_nn_N63_c17.h5",help="Path to default model to use if none is explicitly defined")
#The following arguments are specific to different "relion external program" calls
parser.add_argument("--in_mics",help="Input paths for micrographs star, fed to program by relion")
parser.add_argument("--in_parts",help="Input paths for particles star, fed to program by relion")
parser.add_argument("--o",help="Output folder (relion pipeline formatted)")
parser.add_argument("--j",help="Number of CPU threads given to task")
parser.add_argument("--pipeline_control",help="Haven't defined this yet...")
#Load inputs
args = parser.parse_args()
#Check and see if different .h5 models were defined
if args.n_model == "":
args.n_model = args.n_model_default
if args.p_model == "":
args.p_model = args.p_model_default
#set up log file
logfile = open(os.path.join(args.o,"cryolo_wrapper_logfile.log"),'w')
modelist = | np.array([args.denoise,args.config_setup,args.train,args.predict,args.manual],dtype=bool) | numpy.array |
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([]) | numpy.array |
import tensorflow as tf
from losses.face_losses import arcface_loss
import tensorlayer as tl
import os
from os.path import join
import numpy as np
import cv2
import matplotlib.pyplot as plt
# %matplotlib inline
import datetime
import os
from os.path import join as pjoin
import sys
import copy
from sklearn.model_selection import KFold
from sklearn.decomposition import PCA
import sklearn
import facenet
import data.eval_data_reader as eval_data_reader
import verification
import lfw
import time
from sklearn import metrics
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
log_path = os.path.join(PROJECT_PATH, 'output')
models_path = os.path.join(PROJECT_PATH, 'models')
from importlib.machinery import SourceFileLoader
# facenet = SourceFileLoader('facenet', os.path.join(PROJECT_PATH, 'facenet.py')).load_module()
mx2tfrecords = SourceFileLoader('mx2tfrecords', os.path.join(PROJECT_PATH, 'data/mx2tfrecords.py')).load_module()
L_Resnet_E_IR_fix_issue9 = SourceFileLoader('L_Resnet_E_IR_fix_issue9',
os.path.join(PROJECT_PATH, 'nets/L_Resnet_E_IR_fix_issue9.py')).load_module()
face_losses = SourceFileLoader('face_losses', os.path.join(PROJECT_PATH, 'losses/face_losses.py')).load_module()
# eval_data_reader = SourceFileLoader('eval_data_reader', os.path.join(PROJECT_PATH, 'data/eval_data_reader.py')).load_module()
# verification = SourceFileLoader('verification', os.path.join(PROJECT_PATH, 'verification.py')).load_module()
class Args:
net_depth = 50
epoch = 1000
lr_steps = [40000, 60000, 80000]
momentum = 0.9
weight_decay = 5e-4
num_output = 85164
# train_dataset_dir = train_dataset_path
train_dataset_dir = None
summary_path = join(log_path, 'summary')
ckpt_path = join(log_path, 'ckpt')
log_file_path = join(log_path, 'logs')
saver_maxkeep = 10
buffer_size = 10000
log_device_mapping = False
summary_interval = 100
ckpt_interval = 100
validate_interval = 100
show_info_interval = 100
seed = 313
nrof_preprocess_threads = 4
ckpt_file = r'F:\Documents\JetBrains\PyCharm\OFR\InsightFace_TF\output\ckpt\model_d\InsightFace_iter_best_'
ckpt_index_list = ['710000.ckpt']
# insightface_dataset_dir = eval_dir_path
insightface_pair = os.path.join(PROJECT_PATH, 'data/First_100_ALL VIS_112_1.txt')
insightface_dataset_dir = r"E:\Projects & Courses\CpAE\NIR-VIS-2.0 Dataset -cbsr.ia.ac.cn\First_100_ALL VIS_112"
insightface_image_size = 112
batch_size = 32
facenet_image_size = 160
facenet_dataset_dir = r"E:\Projects & Courses\CpAE\NIR-VIS-2.0 Dataset -cbsr.ia.ac.cn\First_100_ALL VIS_160"
facenet_batch_size = batch_size
facenet_model = os.path.join(PROJECT_PATH, 'models/facenet/20180402-114759')
facenet_pairs = insightface_pair
validation_set_split_ratio = 0.0
def data_iter(datasets, batch_size):
data_num = datasets.shape[0]
for i in range(0, data_num, batch_size):
yield datasets[i:min(i + batch_size, data_num), ...]
def get_facenet_embeddings(args):
# Read the directory containing images
dataset = facenet.get_dataset(args.facenet_dataset_dir)
nrof_classes = len(dataset)
# Evaluate custom dataset with facenet pre-trained model
print("Getting embeddings with facenet pre-trained model")
with tf.Graph().as_default():
# Get a list of image paths and their labels
image_list, label_list = facenet.get_image_paths_and_labels(dataset)
assert len(image_list) > 0, 'The dataset should not be empty'
print('Number of classes in dataset: %d' % nrof_classes)
print('Number of examples in dataset: %d' % len(image_list))
# Getting batched images by TF dataset
tf_dataset = facenet.tf_gen_dataset(image_list=image_list, label_list=None, nrof_preprocess_threads=args.nrof_preprocess_threads,
image_size=args.facenet_image_size, method='cache_slices',
BATCH_SIZE=args.batch_size, repeat_count=1, to_float32=True, shuffle=False)
tf_dataset_iterator = tf_dataset.make_initializable_iterator()
tf_dataset_next_element = tf_dataset_iterator.get_next()
# Getting flip to left_right batched images by TF dataset
# tf_dataset_flip = facenet.tf_gen_dataset(image_list, label_list, args.nrof_preprocess_threads, args.facenet_image_size,
# method='cache_slices',
# BATCH_SIZE=args.batch_size, repeat_count=1, flip_left_right=True, shuffle=False)
#
# tf_dataset_iterator_flip = tf_dataset_flip.make_initializable_iterator()
# tf_dataset_next_element_flip = tf_dataset_iterator_flip.get_next()
with tf.Session() as sess:
sess.run(tf_dataset_iterator.initializer)
phase_train_placeholder = tf.placeholder(tf.bool, name='phase_train')
image_batch = tf.placeholder(name='img_inputs', shape=[None, args.facenet_image_size, args.facenet_image_size, 3], dtype=tf.float32)
label_batch = tf.placeholder(name='img_labels', shape=[None, ], dtype=tf.int32)
# Load the model
input_map = {'image_batch': image_batch, 'label_batch': label_batch, 'phase_train': phase_train_placeholder}
facenet.load_model(args.facenet_model, input_map=input_map)
# Get output tensor
embeddings = tf.get_default_graph().get_tensor_by_name("embeddings:0")
batch_size = args.batch_size
input_placeholder = image_batch
print('getting embeddings..')
total_time = 0
batch_number = 0
embeddings_array = None
embeddings_array_flip = None
while True:
try:
images = sess.run(tf_dataset_next_element)
data_tmp = images.copy() # fix issues #4
for i in range(data_tmp.shape[0]):
data_tmp[i, ...] -= 127.5
data_tmp[i, ...] *= 0.0078125
data_tmp[i, ...] = cv2.cvtColor(data_tmp[i, ...], cv2.COLOR_RGB2BGR)
# Getting flip to left_right batched images by TF dataset
data_tmp_flip = images.copy() # fix issues #4
for i in range(data_tmp_flip.shape[0]):
data_tmp_flip[i, ...] = np.fliplr(data_tmp_flip[i, ...])
data_tmp_flip[i, ...] -= 127.5
data_tmp_flip[i, ...] *= 0.0078125
data_tmp_flip[i, ...] = cv2.cvtColor(data_tmp_flip[i, ...], cv2.COLOR_RGB2BGR)
start_time = time.time()
mr_feed_dict = {input_placeholder: data_tmp, phase_train_placeholder: False}
mr_feed_dict_flip = {input_placeholder: data_tmp_flip, phase_train_placeholder: False}
_embeddings = sess.run(embeddings, mr_feed_dict)
_embeddings_flip = sess.run(embeddings, mr_feed_dict_flip)
if embeddings_array is None:
embeddings_array = np.zeros((len(image_list), _embeddings.shape[1]))
embeddings_array_flip = np.zeros((len(image_list), _embeddings_flip.shape[1]))
try:
embeddings_array[batch_number * batch_size:min((batch_number + 1) * batch_size, len(image_list)), ...] = _embeddings
embeddings_array_flip[batch_number * batch_size:min((batch_number + 1) * batch_size, len(image_list)),
...] = _embeddings_flip
# print('try: ', batch_number * batch_size, min((batch_number + 1) * batch_size, len(image_list)), ...)
except ValueError:
print('batch_number*batch_size value is %d min((batch_number+1)*batch_size, len(image_list)) %d,'
' batch_size %d, data.shape[0] %d' %
(batch_number * batch_size, min((batch_number + 1) * batch_size, len(image_list)), batch_size, images.shape[0]))
print('except: ', batch_number * batch_size, min((batch_number + 1) * batch_size, images.shape[0]), ...)
duration = time.time() - start_time
batch_number += 1
total_time += duration
except tf.errors.OutOfRangeError:
print('tf.errors.OutOfRangeError, Reinitialize tf_dataset_iterator')
sess.run(tf_dataset_iterator.initializer)
# sess.run(tf_dataset_iterator_flip.initializer)
break
print(f"total_time: {total_time}")
_xnorm = 0.0
_xnorm_cnt = 0
for embed in [embeddings_array, embeddings_array_flip]:
for i in range(embed.shape[0]):
_em = embed[i]
_norm = np.linalg.norm(_em)
# print(_em.shape, _norm)
_xnorm += _norm
_xnorm_cnt += 1
_xnorm /= _xnorm_cnt
final_embeddings_output = embeddings_array + embeddings_array_flip
final_embeddings_output = sklearn.preprocessing.normalize(final_embeddings_output)
print(final_embeddings_output.shape)
return embeddings_array, embeddings_array_flip, final_embeddings_output, _xnorm
def custom_facenet_evaluation(args):
tf.reset_default_graph()
# Read the directory containing images
pairs = read_pairs(args.insightface_pair)
image_list, issame_list = get_paths_with_pairs(args.facenet_dataset_dir, pairs)
# Evaluate custom dataset with facenet pre-trained model
print("Getting embeddings with facenet pre-trained model")
with tf.Graph().as_default():
# Getting batched images by TF dataset
# image_list = path_list
tf_dataset = facenet.tf_gen_dataset(image_list=image_list, label_list=None, nrof_preprocess_threads=args.nrof_preprocess_threads,
image_size=args.facenet_image_size, method='cache_slices',
BATCH_SIZE=args.batch_size, repeat_count=1, to_float32=True, shuffle=False)
tf_dataset_iterator = tf_dataset.make_initializable_iterator()
tf_dataset_next_element = tf_dataset_iterator.get_next()
with tf.Session() as sess:
sess.run(tf_dataset_iterator.initializer)
phase_train_placeholder = tf.placeholder(tf.bool, name='phase_train')
image_batch = tf.placeholder(name='img_inputs', shape=[None, args.facenet_image_size, args.facenet_image_size, 3], dtype=tf.float32)
label_batch = tf.placeholder(name='img_labels', shape=[None, ], dtype=tf.int32)
# Load the model
input_map = {'image_batch': image_batch, 'label_batch': label_batch, 'phase_train': phase_train_placeholder}
facenet.load_model(args.facenet_model, input_map=input_map)
# Get output tensor
embeddings = tf.get_default_graph().get_tensor_by_name("embeddings:0")
batch_size = args.batch_size
input_placeholder = image_batch
print('getting embeddings..')
total_time = 0
batch_number = 0
embeddings_array = None
embeddings_array_flip = None
while True:
try:
images = sess.run(tf_dataset_next_element)
data_tmp = images.copy() # fix issues #4
for i in range(data_tmp.shape[0]):
data_tmp[i, ...] -= 127.5
data_tmp[i, ...] *= 0.0078125
data_tmp[i, ...] = cv2.cvtColor(data_tmp[i, ...], cv2.COLOR_RGB2BGR)
# Getting flip to left_right batched images by TF dataset
data_tmp_flip = images.copy() # fix issues #4
for i in range(data_tmp_flip.shape[0]):
data_tmp_flip[i, ...] = np.fliplr(data_tmp_flip[i, ...])
data_tmp_flip[i, ...] -= 127.5
data_tmp_flip[i, ...] *= 0.0078125
data_tmp_flip[i, ...] = cv2.cvtColor(data_tmp_flip[i, ...], cv2.COLOR_RGB2BGR)
start_time = time.time()
mr_feed_dict = {input_placeholder: data_tmp, phase_train_placeholder: False}
mr_feed_dict_flip = {input_placeholder: data_tmp_flip, phase_train_placeholder: False}
_embeddings = sess.run(embeddings, mr_feed_dict)
_embeddings_flip = sess.run(embeddings, mr_feed_dict_flip)
if embeddings_array is None:
embeddings_array = np.zeros((len(image_list), _embeddings.shape[1]))
embeddings_array_flip = np.zeros((len(image_list), _embeddings_flip.shape[1]))
try:
embeddings_array[batch_number * batch_size:min((batch_number + 1) * batch_size, len(image_list)), ...] = _embeddings
embeddings_array_flip[batch_number * batch_size:min((batch_number + 1) * batch_size, len(image_list)),
...] = _embeddings_flip
# print('try: ', batch_number * batch_size, min((batch_number + 1) * batch_size, len(image_list)), ...)
except ValueError:
print('batch_number*batch_size value is %d min((batch_number+1)*batch_size, len(image_list)) %d,'
' batch_size %d, data.shape[0] %d' %
(batch_number * batch_size, min((batch_number + 1) * batch_size, len(image_list)), batch_size, images.shape[0]))
print('except: ', batch_number * batch_size, min((batch_number + 1) * batch_size, images.shape[0]), ...)
duration = time.time() - start_time
batch_number += 1
total_time += duration
except tf.errors.OutOfRangeError:
print('tf.errors.OutOfRangeError, Reinitialize tf_dataset_iterator')
sess.run(tf_dataset_iterator.initializer)
break
print(f"total_time: {total_time}")
_xnorm = 0.0
_xnorm_cnt = 0
for embed in [embeddings_array, embeddings_array_flip]:
for i in range(embed.shape[0]):
_em = embed[i]
_norm = np.linalg.norm(_em)
# print(_em.shape, _norm)
_xnorm += _norm
_xnorm_cnt += 1
_xnorm /= _xnorm_cnt
final_embeddings_output = embeddings_array + embeddings_array_flip
final_embeddings_output = sklearn.preprocessing.normalize(final_embeddings_output)
print(final_embeddings_output.shape)
tpr, fpr, accuracy, val, val_std, far = verification.evaluate(final_embeddings_output, issame_list, nrof_folds=10)
acc2, std2 = np.mean(accuracy), np.std(accuracy)
auc = metrics.auc(fpr, tpr)
print('XNorm: %f' % (_xnorm))
print('Accuracy-Flip: %1.5f+-%1.5f' % (acc2, std2))
print('TPR: ', np.mean(tpr), 'FPR: ', np.mean(fpr))
print('Area Under Curve (AUC): %1.3f' % auc)
tpr_lfw, fpr_lfw, accuracy_lfw, val_lfw, val_std_lfw, far_lfw = lfw.evaluate(final_embeddings_output, issame_list, nrof_folds=10,
distance_metric=0,
subtract_mean=False)
print('accuracy_lfw: %2.5f+-%2.5f' % (np.mean(accuracy_lfw), np.std(accuracy_lfw)))
print(f"val_lfw: {val_lfw}, val_std_lfw: {val_std_lfw}, far_lfw: {far_lfw}")
print('val_lfw rate: %2.5f+-%2.5f @ FAR=%2.5f' % (val_lfw, val_std_lfw, far_lfw))
auc_lfw = metrics.auc(fpr_lfw, tpr_lfw)
print('TPR_LFW:', np.mean(tpr_lfw), 'FPR_LFW: ', np.mean(fpr_lfw))
print('Area Under Curve LFW (AUC): %1.3f' % auc_lfw)
return acc2, std2, _xnorm, [embeddings_array, embeddings_array_flip]
def read_pairs(pairs_filename):
pairs = []
with open(pairs_filename, 'r') as f:
for line in f.readlines()[1:]:
pair = line.strip().split('\t')
if pair not in pairs:
pairs.append(pair)
return np.array(pairs)
def get_paths_with_pairs(dir, pairs):
nrof_skipped_pairs = 0
path_list = []
issame_list = []
for pair in pairs:
if len(pair) == 3:
path0 = (os.path.join(dir, pair[0], pair[1]))
path1 = (os.path.join(dir, pair[0], pair[2]))
issame = True
elif len(pair) == 4:
path0 = os.path.join(dir, pair[0], pair[1])
path1 = os.path.join(dir, pair[2], pair[3])
issame = False
if os.path.exists(path0) and os.path.exists(path1): # Only add the pair if both paths exist
path_list += (path0, path1)
issame_list.append(issame)
else:
print(path0, path1)
nrof_skipped_pairs += 1
if nrof_skipped_pairs > 0:
print('Skipped %d image pairs' % nrof_skipped_pairs)
return path_list, issame_list
def get_insightface_embeddings(args):
tf.reset_default_graph()
# Read the directory containing images
dataset = facenet.get_dataset(args.insightface_dataset_dir)
nrof_classes = len(dataset)
# Evaluate custom dataset with facenet pre-trained model
print("Getting embeddings with facenet pre-trained model")
# Get a list of image paths and their labels
image_list, label_list = facenet.get_image_paths_and_labels(dataset)
assert len(image_list) > 0, 'The dataset should not be empty'
print('Number of classes in dataset: %d' % nrof_classes)
print('Number of examples in dataset: %d' % len(image_list))
# Getting batched images by TF dataset
tf_dataset = facenet.tf_gen_dataset(image_list=image_list, label_list=None, nrof_preprocess_threads=args.nrof_preprocess_threads,
image_size=args.insightface_dataset_dir, method='cache_slices',
BATCH_SIZE=args.batch_size, repeat_count=1, to_float32=True, shuffle=False)
tf_dataset_iterator = tf_dataset.make_initializable_iterator()
tf_dataset_next_element = tf_dataset_iterator.get_next()
images = tf.placeholder(name='img_inputs', shape=[None, args.insightface_image_size, args.insightface_image_size, 3], dtype=tf.float32)
labels = tf.placeholder(name='img_labels', shape=[None, ], dtype=tf.int64)
dropout_rate = tf.placeholder(name='dropout_rate', dtype=tf.float32)
w_init_method = tf.contrib.layers.xavier_initializer(uniform=False)
net = L_Resnet_E_IR_fix_issue9.get_resnet(images, args.net_depth, type='ir', w_init=w_init_method, trainable=False,
keep_rate=dropout_rate)
embeddings = net.outputs
# mv_mean = tl.layers.get_variables_with_name('resnet_v1_50/bn0/moving_mean', False, True)[0]
# 3.2 get arcface loss
logit = arcface_loss(embedding=net.outputs, labels=labels, w_init=w_init_method, out_num=args.num_output)
sess = tf.Session()
saver = tf.train.Saver()
feed_dict = {}
feed_dict_flip = {}
path = args.ckpt_file + args.ckpt_index_list[0]
saver.restore(sess, path)
print('ckpt file %s restored!' % args.ckpt_index_list[0])
feed_dict.update(tl.utils.dict_to_one(net.all_drop))
feed_dict_flip.update(tl.utils.dict_to_one(net.all_drop))
feed_dict[dropout_rate] = 1.0
feed_dict_flip[dropout_rate] = 1.0
batch_size = args.batch_size
input_placeholder = images
sess.run(tf_dataset_iterator.initializer)
# sess.run(tf_dataset_iterator_flip.initializer)
print('getting embeddings..')
total_time = 0
batch_number = 0
embeddings_array = None
embeddings_array_flip = None
while True:
try:
images = sess.run(tf_dataset_next_element)
data_tmp = images.copy() # fix issues #4
for i in range(data_tmp.shape[0]):
data_tmp[i, ...] -= 127.5
data_tmp[i, ...] *= 0.0078125
data_tmp[i, ...] = cv2.cvtColor(data_tmp[i, ...], cv2.COLOR_RGB2BGR)
# Getting flip to left_right batched images by TF dataset
data_tmp_flip = images.copy() # fix issues #4
for i in range(data_tmp_flip.shape[0]):
data_tmp_flip[i, ...] = np.fliplr(data_tmp_flip[i, ...])
data_tmp_flip[i, ...] -= 127.5
data_tmp_flip[i, ...] *= 0.0078125
data_tmp_flip[i, ...] = cv2.cvtColor(data_tmp_flip[i, ...], cv2.COLOR_RGB2BGR)
start_time = time.time()
feed_dict[input_placeholder] = data_tmp
_embeddings = sess.run(embeddings, feed_dict)
feed_dict_flip[input_placeholder] = data_tmp_flip
_embeddings_flip = sess.run(embeddings, feed_dict_flip)
if embeddings_array is None:
embeddings_array = np.zeros((len(image_list), _embeddings.shape[1]))
embeddings_array_flip = np.zeros((len(image_list), _embeddings_flip.shape[1]))
try:
embeddings_array[batch_number * batch_size:min((batch_number + 1) * batch_size, len(image_list)), ...] = _embeddings
embeddings_array_flip[batch_number * batch_size:min((batch_number + 1) * batch_size, len(image_list)),
...] = _embeddings_flip
# print('try: ', batch_number * batch_size, min((batch_number + 1) * batch_size, len(image_list)), ...)
except ValueError:
print('batch_number*batch_size value is %d min((batch_number+1)*batch_size, len(image_list)) %d,'
' batch_size %d, data.shape[0] %d' %
(batch_number * batch_size, min((batch_number + 1) * batch_size, len(image_list)), batch_size,
images.shape[0]))
print('except: ', batch_number * batch_size, min((batch_number + 1) * batch_size, images.shape[0]), ...)
duration = time.time() - start_time
batch_number += 1
total_time += duration
except tf.errors.OutOfRangeError:
print('tf.errors.OutOfRangeError, Reinitialize tf_dataset_iterator')
sess.run(tf_dataset_iterator.initializer)
break
print(f"total_time: {total_time}")
_xnorm = 0.0
_xnorm_cnt = 0
for embed in [embeddings_array, embeddings_array_flip]:
for i in range(embed.shape[0]):
_em = embed[i]
_norm = np.linalg.norm(_em)
# print(_em.shape, _norm)
_xnorm += _norm
_xnorm_cnt += 1
_xnorm /= _xnorm_cnt
final_embeddings_output = embeddings_array + embeddings_array_flip
final_embeddings_output = sklearn.preprocessing.normalize(final_embeddings_output)
print(final_embeddings_output.shape)
sess.close()
return embeddings_array, embeddings_array_flip, final_embeddings_output, _xnorm
def custom_insightface_evaluation(args):
tf.reset_default_graph()
# Read the directory containing images
pairs = read_pairs(args.insightface_pair)
image_list, issame_list = get_paths_with_pairs(args.insightface_dataset_dir, pairs)
# Evaluate custom dataset with facenet pre-trained model
print("Getting embeddings with facenet pre-trained model")
# Getting batched images by TF dataset
tf_dataset = facenet.tf_gen_dataset(image_list=image_list, label_list=None, nrof_preprocess_threads=args.nrof_preprocess_threads,
image_size=args.insightface_dataset_dir, method='cache_slices',
BATCH_SIZE=args.batch_size, repeat_count=1, to_float32=True, shuffle=False)
# tf_dataset = facenet.tf_gen_dataset(image_list, label_list, args.nrof_preprocess_threads, args.facenet_image_size, method='cache_slices',
# BATCH_SIZE=args.batch_size, repeat_count=1, shuffle=False)
tf_dataset_iterator = tf_dataset.make_initializable_iterator()
tf_dataset_next_element = tf_dataset_iterator.get_next()
images = tf.placeholder(name='img_inputs', shape=[None, args.insightface_image_size, args.insightface_image_size, 3], dtype=tf.float32)
labels = tf.placeholder(name='img_labels', shape=[None, ], dtype=tf.int64)
dropout_rate = tf.placeholder(name='dropout_rate', dtype=tf.float32)
w_init_method = tf.contrib.layers.xavier_initializer(uniform=False)
net = L_Resnet_E_IR_fix_issue9.get_resnet(images, args.net_depth, type='ir', w_init=w_init_method, trainable=False,
keep_rate=dropout_rate)
embeddings = net.outputs
# mv_mean = tl.layers.get_variables_with_name('resnet_v1_50/bn0/moving_mean', False, True)[0]
# 3.2 get arcface loss
logit = arcface_loss(embedding=net.outputs, labels=labels, w_init=w_init_method, out_num=args.num_output)
sess = tf.Session()
saver = tf.train.Saver()
feed_dict = {}
feed_dict_flip = {}
path = args.ckpt_file + args.ckpt_index_list[0]
saver.restore(sess, path)
print('ckpt file %s restored!' % args.ckpt_index_list[0])
feed_dict.update(tl.utils.dict_to_one(net.all_drop))
feed_dict_flip.update(tl.utils.dict_to_one(net.all_drop))
feed_dict[dropout_rate] = 1.0
feed_dict_flip[dropout_rate] = 1.0
batch_size = args.batch_size
input_placeholder = images
sess.run(tf_dataset_iterator.initializer)
print('getting embeddings..')
total_time = 0
batch_number = 0
embeddings_array = None
embeddings_array_flip = None
while True:
try:
images = sess.run(tf_dataset_next_element)
data_tmp = images.copy() # fix issues #4
for i in range(data_tmp.shape[0]):
data_tmp[i, ...] -= 127.5
data_tmp[i, ...] *= 0.0078125
data_tmp[i, ...] = cv2.cvtColor(data_tmp[i, ...], cv2.COLOR_RGB2BGR)
# Getting flip to left_right batched images by TF dataset
data_tmp_flip = images.copy() # fix issues #4
for i in range(data_tmp_flip.shape[0]):
data_tmp_flip[i, ...] = np.fliplr(data_tmp_flip[i, ...])
data_tmp_flip[i, ...] -= 127.5
data_tmp_flip[i, ...] *= 0.0078125
data_tmp_flip[i, ...] = cv2.cvtColor(data_tmp_flip[i, ...], cv2.COLOR_RGB2BGR)
start_time = time.time()
feed_dict[input_placeholder] = data_tmp
_embeddings = sess.run(embeddings, feed_dict)
feed_dict_flip[input_placeholder] = data_tmp_flip
_embeddings_flip = sess.run(embeddings, feed_dict_flip)
if embeddings_array is None:
embeddings_array = np.zeros((len(image_list), _embeddings.shape[1]))
embeddings_array_flip = np.zeros((len(image_list), _embeddings_flip.shape[1]))
try:
embeddings_array[batch_number * batch_size:min((batch_number + 1) * batch_size, len(image_list)), ...] = _embeddings
embeddings_array_flip[batch_number * batch_size:min((batch_number + 1) * batch_size, len(image_list)),
...] = _embeddings_flip
# print('try: ', batch_number * batch_size, min((batch_number + 1) * batch_size, len(image_list)), ...)
except ValueError:
print('batch_number*batch_size value is %d min((batch_number+1)*batch_size, len(image_list)) %d,'
' batch_size %d, data.shape[0] %d' %
(batch_number * batch_size, min((batch_number + 1) * batch_size, len(image_list)), batch_size,
images.shape[0]))
print('except: ', batch_number * batch_size, min((batch_number + 1) * batch_size, images.shape[0]), ...)
duration = time.time() - start_time
batch_number += 1
total_time += duration
except tf.errors.OutOfRangeError:
print('tf.errors.OutOfRangeError, Reinitialize tf_dataset_iterator')
sess.run(tf_dataset_iterator.initializer)
break
print(f"total_time: {total_time}")
_xnorm = 0.0
_xnorm_cnt = 0
for embed in [embeddings_array, embeddings_array_flip]:
for i in range(embed.shape[0]):
_em = embed[i]
_norm = np.linalg.norm(_em)
# print(_em.shape, _norm)
_xnorm += _norm
_xnorm_cnt += 1
_xnorm /= _xnorm_cnt
final_embeddings_output = embeddings_array + embeddings_array_flip
final_embeddings_output = sklearn.preprocessing.normalize(final_embeddings_output)
print(final_embeddings_output.shape)
tpr, fpr, accuracy, val, val_std, far = verification.evaluate(final_embeddings_output, issame_list, nrof_folds=10)
acc2, std2 = np.mean(accuracy), np.std(accuracy)
auc = metrics.auc(fpr, tpr)
print('XNorm: %f' % (_xnorm))
print('Accuracy-Flip: %1.5f+-%1.5f' % (acc2, std2))
print('TPR: ', np.mean(tpr), 'FPR: ', | np.mean(fpr) | numpy.mean |
'''
#TODO refactor this module
'''
import numpy as np
from pathlib import Path
import pandas as pd
import sys
from file_py_helper.ExtraInfo import EC_Properties
if __name__ == "__main__":
pass
import logging
logger = logging.getLogger(__name__)
def RHE_potential_assignment(ovv_row):
"""
This function tries to determine a valid value for the RHE potential
from the filename in several ways
Parameters
----------
ovv_row : pd.DataFramw row, namedtuple
this is a row of the overall index dataframe which contains the
information to determine the potential in mV
keys:
RHE_fn, RHE_mean, PAR_date, PAR_file
Returns
-------
RHE_potential : float
RHE value /1000 for unit V
"""
CVrow = ovv_row
RHE_potential = 0
if np.abs(CVrow.RHE_fn) > 3:
RHE_fn = np.abs(CVrow.RHE_fn) / 1000
else:
RHE_fn = np.abs(CVrow.RHE_fn)
if np.abs(CVrow.RHE_mean) > 3:
RHE_mean = np.abs(CVrow.RHE_mean) / 1000
else:
RHE_mean = np.abs(CVrow.RHE_mean)
if RHE_fn == 0 and RHE_mean == 0:
# Clean up Ovv again for 0 values
try:
OVV_prox = CVrow.loc[
((CVrow.PAR_date - CVrow.PAR_date) != pd.Timedelta(seconds=0))
]
OVVproxRHE_fn = [i for i in OVV_prox.RHE_fn.unique() if i != 0]
except:
OVVproxRHE_fn = []
if OVVproxRHE_fn:
RHE_potential = OVVproxRHE_fn[0]
logger.warning(
"CRITICAL Create CV, RHE problem both are 0, guessed from other Files {0} mV".format(
RHE_potential, Path(CVrow.PAR_file).name
)
)
else:
RHE_potential = EC_Properties.guess_RHE_from_Electrolyte(CVrow.Electrolyte)
logger.warning(
"CRITICAL Create CV, RHE problem both are 0, guessed from Electrolyte {0} mV".format(
RHE_potential, Path(CVrow.PAR_file).name
)
)
elif RHE_fn != 0 and RHE_mean == 0:
RHE_potential = RHE_fn
elif RHE_fn == 0 and RHE_mean != 0:
RHE_potential = RHE_mean
elif RHE_fn != 0 and RHE_mean != 0:
# RHE_fn == RHE_mean:
if any([np.isclose(RHE_fn, RHE_mean, atol=0.004)]):
RHE_potential = RHE_mean
else:
try:
RHE_fromfn_opts = [
b
for b in [
float(i)
for i in Path(CVrow.PAR_file).stem.split("_")
if i.isdigit()
]
if b < 1100 and b > 150 and not b == 300 and not b == 10
]
if RHE_fromfn_opts:
RHE_fromfn = RHE_fromfn_opts[0] / 1000
if any([ | np.isclose(RHE_fn, RHE_fromfn, atol=0.001) | numpy.isclose |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
"""
Parámetros
"""
c = 333 # m/s
rho_ambient = 1.2 # kg/m^3
A = 10 # Pa
L = 15 # m
v_x_in = rho_prime_in = 0
def p_in(x):
array = np.logical_and(-L/2 <= x, x <= L/2)
return np.where(array, A, 0)
def f(x, t):
if t==0:
return p_in(x)/2
else:
array = np.logical_and(-L/2 + c*t <= x, x <= c*t + L/2)
return np.where(array, A, 0)
def g(x, t):
if t==0:
return p_in(x)/2
else:
array = np.logical_and(-L/2 - c*t <= x, x <= -c*t + L/2)
return np.where(array, A, 0)
def p(x, t):
return f(x, t) + g(x, t)
def rho_prime(x, t):
return p(x, t)/2 + rho_prime_in - p_in(x)/(c**2)
def rho(x, t):
return rho_prime(x, t) + rho_prime_in
def v_x(x, t):
return 1/(rho_ambient*c)*(f(x, t) - g(x, t))*10
x_list = | np.linspace(-50 - L/2, 50 + L/2, 1000) | numpy.linspace |
# -*- coding: utf-8 -*-
#from __future__ import print_function
#import pixy
#from ctypes import *
#from pixy import *
import math as ma
import numpy as np
test_data = 120,100 #test input
#hight = 495-114 #mm
#ball parameter
r_ball = 114.8 #mm
'PIXY Parameter'
#pixy-cam image size in pixy-coordination
delta_X_pixy = 207
delta_Y_pixy = 315
#angles
ang_cam_tilt = ma.radians(33)
ang_rev_cam_tilt = ma.radians(90)-ang_cam_tilt
ang_cam_flare_X = ma.radians(47) #Öffnungswinkel pixy cam
ang_cam_flare_Y = ma.radians(75)
delta_ang_X = ma.radians(47) #deg
ang_ball_ratio = delta_X_pixy / delta_ang_X
'''PIXY Parameter'''
#pixy-cam position parameter
'vorläufige Parameter!!!'
ang_offset = ma.radians(30) #1.0472 # 60 degree
h_cam_offset = 463 #floor to camera-mountings rotation axle
s_cam_offset = 77 #midpoint robot to camera mounting on x axle
r_cam_rot = 55 #radius of camera rotation circle on xy-level
#absolute position of camera on robot
X_cam_pos = 0
Z_cam_pos = 0
#pixy-cam image parameter
Xmin_image_cam = 0
Xmax_image_cam = 0
X_offset_image_cam = 0
Ymin_image_cam = 0
Ymax_image_cam = 0
delta_X_image_cam = 0
delta_Y_image_cam = 0
X_factor_cam = 1
Y_factor_cam = 1
X_ball_ego = 0 #mm
Y_ball_ego = 0 #mm
X_ball_filtered = 0
Y_ball_filtered = 0
'Kalman Parameter'
dt = 1.0/60.0 #pixys freq = 60 Hz
F = np.array([[1, dt, 0], [0, 1, dt],[0, 0, 1]]) #state transition model, A
H = np.array([1, 0, 0]).reshape(1, 3) #transponieren #observation model C
"""
das ist meine C matrix für den Ausgang, also müsste das mittlere die geschwindigkeit sein
"""
q = 0.05
Q = np.array([[q, q, 0], [q, q, 0], [0, 0, 0]])
R = np.array([0.05]).reshape(1, 1) #observation noise
# Pixy2 Python SWIG get blocks example
'''
blocks = BlockArray(100)
frame = 0
class Blocks (Structure):
_fields_ = [ ("m_signature", c_uint),
("m_x", c_uint),
("m_y", c_uint),
("m_width", c_uint),
("m_height", c_uint),
("m_angle", c_uint),
("m_index", c_uint),
("m_age", c_uint) ]
'''
class KalmanFilter(object):
def __init__(self, F = None, B = None, H = None, Q = None, R = None, P = None, x0 = None):
if(F is None or H is None):
raise ValueError("Set proper system dynamics.")
self.n = F.shape[1]
self.m = H.shape[1]
self.F = F
self.H = H
self.B = 0 if B is None else B
self.Q = np.eye(self.n) if Q is None else Q
self.R = | np.eye(self.n) | numpy.eye |
#!/usr/bin/env python
# Scale mesh in stl file.
import numpy as np
import os, sys
import stl
from stl import mesh
# parse command line arguments
outfile = "out.stl"
infile = "in.stl"
if len(sys.argv) < 2:
print("usage: {} <fileNameIn> <fileNameOut> [<x> <y> <z>]\n Scale vertices with factors [x,y,z].".format(sys.argv[0]))
sys.exit(0)
if len(sys.argv) >= 2:
if os.path.isfile(sys.argv[1]):
infile = sys.argv[1]
else:
print("File \"{}\" does not exist.".format(sys.argv[1]))
sys.exit(0)
if len(sys.argv) >= 3:
outfile = sys.argv[2]
else:
outfile = os.path.splitext(infile)[0]+"_out.stl"
# parse scaling factors
factor_x = 0.0
factor_y = 0.0
factor_z = 0.0
if len(sys.argv) == 6:
factor_x = float(sys.argv[3])
factor_y = float(sys.argv[4])
factor_z = float(sys.argv[5])
print("Input file: \"{}\"".format(infile))
print("Output file: \"{}\"".format(outfile))
print("Scaling factors: {} {} {}".format(factor_x, factor_y, factor_z))
stl_mesh = mesh.Mesh.from_file(infile)
out_triangles = []
# loop over triangles in mesh
for p in stl_mesh.points:
# p contains the 9 entries [p1x p1y p1z p2x p2y p2z p3x p3y p3z] of the triangle with corner points (p1,p2,p3)
p1 = | np.array(p[0:3]) | numpy.array |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# '@webio':
# lastCommId: a8ab2762cccf499696a7ef0a86be4d18
# lastKernelId: 261999dd-7ee7-4ad4-9a26-99a84a77979b
# cite2c:
# citations:
# 6202365/8AH9AXN2:
# URL: http://econ.jhu.edu/people/ccarroll/papers/BufferStockTheory.pdf
# author:
# - family: Carroll
# given: Christopher
# container-title: Manuscript, Department of Economics, Johns Hopkins University
# id: 6202365/8AH9AXN2
# issued:
# month: 2
# year: 2019
# note: "Available at http://econ.jhu.edu/people/ccarroll/papers/BufferStockTheory\
# \ \nCitation Key: carrollBufferStockTheory \nbibtex*[extra=bibtex:carrollBufferStockTheory]"
# title: Theoretical Foundations of Buffer Stock Saving
# type: article-journal
# 6202365/TGG4U7J4:
# author:
# - family: Clarida
# given: <NAME>.
# container-title: International Economic Review
# issued:
# date-parts:
# - - 1987
# page: "339\u2013351"
# title: Consumption, Liquidity Constraints, and Asset Accumulation in the Face
# of Random Fluctuations in Income
# type: article-journal
# volume: XXVIII
# undefined:
# URL: http://econ.jhu.edu/people/ccarroll/papers/BufferStockTheory.pdf
# author:
# - family: Carroll
# given: Christopher
# container-title: Manuscript, Department of Economics, Johns Hopkins University
# issued:
# date-parts:
# - - '2019'
# - 2
# note: "Available at http://econ.jhu.edu/people/ccarroll/papers/BufferStockTheory\
# \ \nCitation Key: carrollBufferStockTheory \nbibtex*[extra=bibtex:carrollBufferStockTheory]"
# title: Theoretical Foundations of Buffer Stock Saving
# type: article-journal
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.1'
# jupytext_version: 0.8.3
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# language_info:
# codemirror_mode:
# name: ipython
# version: 3
# file_extension: .py
# mimetype: text/x-python
# name: python
# nbconvert_exporter: python
# pygments_lexer: ipython3
# version: 3.6.6
# varInspector:
# cols:
# lenName: 16
# lenType: 16
# lenVar: 40
# kernels_config:
# python:
# delete_cmd_postfix: ''
# delete_cmd_prefix: 'del '
# library: var_list.py
# varRefreshCmd: print(var_dic_list())
# r:
# delete_cmd_postfix: ') '
# delete_cmd_prefix: rm(
# library: var_list.r
# varRefreshCmd: 'cat(var_dic_list()) '
# types_to_exclude:
# - module
# - function
# - builtin_function_or_method
# - instance
# - _Feature
# window_display: false
# ---
# %% [markdown]
# # Theoretical Foundations of Buffer Stock Saving
# <p style="text-align: center;"><small><small>Generator: BufferStockTheory-make/notebooks_byname</small></small></p>
# %% [markdown]
# [](https://mybinder.org/v2/gh/econ-ark/REMARK/master?filepath=REMARKs%2FBufferStockTheory%2FBufferStockTheory.ipynb)
#
# [This notebook](https://github.com/econ-ark/REMARK/blob/master/REMARKs/BufferStockTheory/BufferStockTheory.ipynb) uses the [Econ-ARK/HARK](https://github.com/econ-ark/hark) toolkit to describe the main results and reproduce the figures in the paper [Theoretical Foundations of Buffer Stock Saving](http://econ.jhu.edu/people/ccarroll/papers/BufferStockTheory): <cite data-cite="6202365/8AH9AXN2"></cite>
#
#
# If you are not familiar with the HARK toolkit, you may wish to browse the ["Gentle Introduction to HARK"](https://mybinder.org/v2/gh/econ-ark/DemARK/master?filepath=Gentle-Intro-To-HARK.ipynb) before continuing (since you are viewing this document, you presumably know a bit about [Jupyter Notebooks](https://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/)).
#
# For instructions on how to install the [Econ-ARK/HARK](https://github.com/econ-ark/hark) toolkit on your computer, please refer to the [QUICK START GUIDE](https://github.com/econ-ark/HARK/blob/master/README.md).
#
# The main HARK tool used here is $\texttt{ConsIndShockModel.py}$, in which agents have CRRA utility and face idiosyncratic shocks to permanent and transitory income. For an introduction to this module, see the [ConsIndShockModel.ipynb](https://econ-ark.org/notebooks) notebook at the [Econ-ARK](https://econ-ark.org) website.
#
#
# %% {"code_folding": [0]}
# This cell does some setup and imports generic tools used to produce the figures
Generator=False # Is this notebook the master or is it generated?
# Import related generic python packages
import numpy as np
from time import clock
mystr = lambda number : "{:.4f}".format(number)
# This is a jupytext paired notebook that autogenerates BufferStockTheory.py
# which can be executed from a terminal command line via "ipython BufferStockTheory.py"
# But a terminal does not permit inline figures, so we need to test jupyter vs terminal
# Google "how can I check if code is executed in the ipython notebook"
from IPython import get_ipython # In case it was run from python instead of ipython
def in_ipynb():
try:
if str(type(get_ipython())) == "<class 'ipykernel.zmqshell.ZMQInteractiveShell'>":
return True
else:
return False
except NameError:
return False
# Determine whether to make the figures inline (for spyder or jupyter)
# vs whatever is the automatic setting that will apply if run from the terminal
if in_ipynb():
# %matplotlib inline generates a syntax error when run from the shell
# so do this instead
get_ipython().run_line_magic('matplotlib', 'inline')
else:
get_ipython().run_line_magic('matplotlib', 'auto')
print('You appear to be running from a terminal')
print('By default, figures will appear one by one')
print('Close the visible figure in order to see the next one')
# Import the plot-figure library matplotlib
import matplotlib.pyplot as plt
# In order to use LaTeX to manage all text layout in our figures, we import rc settings from matplotlib.
from matplotlib import rc
plt.rc('font', family='serif')
# LaTeX is huge and takes forever to install on mybinder
# so if it is not installed then do not use it
from distutils.spawn import find_executable
iflatexExists=False
if find_executable('latex'):
iflatexExists=True
plt.rc('font', family='serif')
plt.rc('text', usetex=iflatexExists)
# The warnings package allows us to ignore some harmless but alarming warning messages
import warnings
warnings.filterwarnings("ignore")
# The tools for navigating the filesystem
import sys
import os
sys.path.insert(0, os.path.abspath('../../lib')) # REMARKs directory is two down from root
from HARK.utilities import plotFuncsDer, plotFuncs
from copy import copy, deepcopy
# Define (and create, if necessary) the figures directory "Figures"
if Generator:
my_file_path = os.path.dirname(os.path.abspath("BufferStockTheory.ipynb")) # Find pathname to this file:
Figures_HARK_dir = os.path.join(my_file_path,"Figures/") # LaTeX document assumes figures will be here
Figures_HARK_dir = os.path.join(my_file_path,"/tmp/Figures/") # Uncomment to make figures outside of git path
if not os.path.exists(Figures_HARK_dir):
os.makedirs(Figures_HARK_dir)
# %% [markdown]
# ## [The Problem](http://econ.jhu.edu/people/ccarroll/papers/BufferStockTheory/#The-Problem)
#
# The paper defines and calibrates a small set of parameters:
#
# | Parameter | Description | Code | Value |
# | :---: | --- | --- | :---: |
# | $\newcommand{\PermGroFac}{\Gamma}\PermGroFac$ | Permanent Income Growth Factor | $\texttt{PermGroFac}$ | 1.03 |
# | $\newcommand{\Rfree}{\mathrm{\mathsf{R}}}\Rfree$ | Interest Factor | $\texttt{Rfree}$ | 1.04 |
# | $\newcommand{\DiscFac}{\beta}\DiscFac$ | Time Preference Factor | $\texttt{DiscFac}$ | 0.96 |
# | $\newcommand{\CRRA}{\rho}\CRRA$ | Coefficient of Relative Risk Aversion| $\texttt{CRRA}$ | 2 |
# | $\newcommand{\UnempPrb}{\wp}\UnempPrb$ | Probability of Unemployment | $\texttt{UnempPrb}$ | 0.005 |
# | $\newcommand{\IncUnemp}{\mu}\IncUnemp$ | Income when Unemployed | $\texttt{IncUnemp}$ | 0. |
# | $\newcommand{\PermShkStd}{\sigma_\psi}\PermShkStd$ | Std Dev of Log Permanent Shock| $\texttt{PermShkStd}$ | 0.1 |
# | $\newcommand{\TranShkStd}{\sigma_\theta}\TranShkStd$ | Std Dev of Log Transitory Shock| $\texttt{TranShkStd}$ | 0.1 |
#
# For a microeconomic consumer with 'Market Resources' (net worth plus current income) $M_{t}$, end-of-period assets $A_{t}$ will be the amount remaining after consumption of $C_{t}$. <!-- Next period's 'Balances' $B_{t+1}$ reflect this period's $A_{t}$ augmented by return factor $R$:-->
# \begin{eqnarray}
# A_{t} &=&M_{t}-C_{t} \label{eq:DBCparts} \\
# %B_{t+1} & = & A_{t} R \notag \\
# \end{eqnarray}
#
# The consumer's permanent noncapital income $P$ grows by a predictable factor $\PermGroFac$ and is subject to an unpredictable lognormally distributed multiplicative shock $\mathbb{E}_{t}[\psi_{t+1}]=1$,
# \begin{eqnarray}
# P_{t+1} & = & P_{t} \PermGroFac \psi_{t+1}
# \end{eqnarray}
#
# and actual income is permanent income multiplied by a logormal multiplicative transitory shock, $\mathbb{E}_{t}[\theta_{t+1}]=1$, so that next period's market resources are
# \begin{eqnarray}
# %M_{t+1} &=& B_{t+1} +P_{t+1}\theta_{t+1}, \notag
# M_{t+1} &=& A_{t}R +P_{t+1}\theta_{t+1}. \notag
# \end{eqnarray}
#
# When the consumer has a CRRA utility function $u(c)=\frac{c^{1-\rho}}{1-\rho}$, the paper shows that the problem can be written in terms of ratios of money variables to permanent income, e.g. $m_{t} \equiv M_{t}/P_{t}$, and the Bellman form of [the problem reduces to](http://econ.jhu.edu/people/ccarroll/papers/BufferStockTheory/#The-Related-Problem):
#
# \begin{eqnarray*}
# v_t(m_t) &=& \max_{c_t}~~ u(c_t) + \beta~\mathbb{E}_{t} [(\Gamma\psi_{t+1})^{1-\rho} v_{t+1}(m_{t+1}) ] \\
# & s.t. & \\
# a_t &=& m_t - c_t \\
# m_{t+1} &=& R/(\Gamma \psi_{t+1}) a_t + \theta_{t+1} \\
# \end{eqnarray*}
#
# %% {"code_folding": [0]}
# Define a parameter dictionary with baseline parameter values
# Set the baseline parameter values
PermGroFac = 1.03
Rfree = 1.04
DiscFac = 0.96
CRRA = 2.00
UnempPrb = 0.005
IncUnemp = 0.0
PermShkStd = 0.1
TranShkStd = 0.1
# Import default parameter values
import HARK.ConsumptionSaving.ConsumerParameters as Params
# Make a dictionary containing all parameters needed to solve the model
base_params = Params.init_idiosyncratic_shocks
# Set the parameters for the baseline results in the paper
# using the variable values defined in the cell above
base_params['PermGroFac'] = [PermGroFac] # Permanent income growth factor
base_params['Rfree'] = Rfree # Interest factor on assets
base_params['DiscFac'] = DiscFac # Time Preference Factor
base_params['CRRA'] = CRRA # Coefficient of relative risk aversion
base_params['UnempPrb'] = UnempPrb # Probability of unemployment (e.g. Probability of Zero Income in the paper)
base_params['IncUnemp'] = IncUnemp # Induces natural borrowing constraint
base_params['PermShkStd'] = [PermShkStd] # Standard deviation of log permanent income shocks
base_params['TranShkStd'] = [TranShkStd] # Standard deviation of log transitory income shocks
# Some technical settings that are not interesting for our purposes
base_params['LivPrb'] = [1.0] # 100 percent probability of living to next period
base_params['CubicBool'] = True # Use cubic spline interpolation
base_params['T_cycle'] = 1 # No 'seasonal' cycles
base_params['BoroCnstArt'] = None # No artificial borrowing constraint
# %% {"code_folding": [0]}
# from HARK.ConsumptionSaving.ConsIndShockModel import IndShockConsumerType
# The code below is what you get if you exeute the command on the prior line
# from a location where HARK is accessible. It is included here because the
# latest pip-installable version of HARK does not include the impatience conditions
# (though the online one does)
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from builtins import str
from builtins import range
from builtins import object
from copy import copy, deepcopy
import numpy as np
from scipy.optimize import newton
from HARK import AgentType, Solution, NullFunc, HARKobject
from HARK.utilities import warnings # Because of "patch" to warnings modules
from HARK.interpolation import CubicInterp, LowerEnvelope, LinearInterp
from HARK.simulation import drawDiscrete, drawBernoulli, drawLognormal, drawUniform
from HARK.utilities import approxMeanOneLognormal, addDiscreteOutcomeConstantMean,\
combineIndepDstns, makeGridExpMult, CRRAutility, CRRAutilityP, \
CRRAutilityPP, CRRAutilityP_inv, CRRAutility_invP, CRRAutility_inv, \
CRRAutilityP_invP
utility = CRRAutility
utilityP = CRRAutilityP
utilityPP = CRRAutilityPP
utilityP_inv = CRRAutilityP_inv
utility_invP = CRRAutility_invP
utility_inv = CRRAutility_inv
utilityP_invP = CRRAutilityP_invP
# =====================================================================
# === Classes that help solve consumption-saving models ===
# =====================================================================
class ConsumerSolution(Solution):
'''
A class representing the solution of a single period of a consumption-saving
problem. The solution must include a consumption function and marginal
value function.
Here and elsewhere in the code, Nrm indicates that variables are normalized
by permanent income.
'''
distance_criteria = ['vPfunc']
def __init__(self, cFunc=None, vFunc=None,
vPfunc=None, vPPfunc=None,
mNrmMin=None, hNrm=None, MPCmin=None, MPCmax=None):
'''
The constructor for a new ConsumerSolution object.
Parameters
----------
cFunc : function
The consumption function for this period, defined over market
resources: c = cFunc(m).
vFunc : function
The beginning-of-period value function for this period, defined over
market resources: v = vFunc(m).
vPfunc : function
The beginning-of-period marginal value function for this period,
defined over market resources: vP = vPfunc(m).
vPPfunc : function
The beginning-of-period marginal marginal value function for this
period, defined over market resources: vPP = vPPfunc(m).
mNrmMin : float
The minimum allowable market resources for this period; the consump-
tion function (etc) are undefined for m < mNrmMin.
hNrm : float
Human wealth after receiving income this period: PDV of all future
income, ignoring mortality.
MPCmin : float
Infimum of the marginal propensity to consume this period.
MPC --> MPCmin as m --> infinity.
MPCmax : float
Supremum of the marginal propensity to consume this period.
MPC --> MPCmax as m --> mNrmMin.
Returns
-------
None
'''
# Change any missing function inputs to NullFunc
if cFunc is None:
cFunc = NullFunc()
if vFunc is None:
vFunc = NullFunc()
if vPfunc is None:
vPfunc = NullFunc()
if vPPfunc is None:
vPPfunc = NullFunc()
self.cFunc = cFunc
self.vFunc = vFunc
self.vPfunc = vPfunc
self.vPPfunc = vPPfunc
self.mNrmMin = mNrmMin
self.hNrm = hNrm
self.MPCmin = MPCmin
self.MPCmax = MPCmax
def appendSolution(self,new_solution):
'''
Appends one solution to another to create a ConsumerSolution whose
attributes are lists. Used in ConsMarkovModel, where we append solutions
*conditional* on a particular value of a Markov state to each other in
order to get the entire solution.
Parameters
----------
new_solution : ConsumerSolution
The solution to a consumption-saving problem; each attribute is a
list representing state-conditional values or functions.
Returns
-------
None
'''
if type(self.cFunc)!=list:
# Then we assume that self is an empty initialized solution instance.
# Begin by checking this is so.
assert NullFunc().distance(self.cFunc) == 0, 'appendSolution called incorrectly!'
# We will need the attributes of the solution instance to be lists. Do that here.
self.cFunc = [new_solution.cFunc]
self.vFunc = [new_solution.vFunc]
self.vPfunc = [new_solution.vPfunc]
self.vPPfunc = [new_solution.vPPfunc]
self.mNrmMin = [new_solution.mNrmMin]
else:
self.cFunc.append(new_solution.cFunc)
self.vFunc.append(new_solution.vFunc)
self.vPfunc.append(new_solution.vPfunc)
self.vPPfunc.append(new_solution.vPPfunc)
self.mNrmMin.append(new_solution.mNrmMin)
class ValueFunc(HARKobject):
'''
A class for representing a value function. The underlying interpolation is
in the space of (m,u_inv(v)); this class "re-curves" to the value function.
'''
distance_criteria = ['func','CRRA']
def __init__(self,vFuncNvrs,CRRA):
'''
Constructor for a new value function object.
Parameters
----------
vFuncNvrs : function
A real function representing the value function composed with the
inverse utility function, defined on market resources: u_inv(vFunc(m))
CRRA : float
Coefficient of relative risk aversion.
Returns
-------
None
'''
self.func = deepcopy(vFuncNvrs)
self.CRRA = CRRA
def __call__(self,m):
'''
Evaluate the value function at given levels of market resources m.
Parameters
----------
m : float or np.array
Market resources (normalized by permanent income) whose value is to
be found.
Returns
-------
v : float or np.array
Lifetime value of beginning this period with market resources m; has
same size as input m.
'''
return utility(self.func(m),gam=self.CRRA)
class MargValueFunc(HARKobject):
'''
A class for representing a marginal value function in models where the
standard envelope condition of v'(m) = u'(c(m)) holds (with CRRA utility).
'''
distance_criteria = ['cFunc','CRRA']
def __init__(self,cFunc,CRRA):
'''
Constructor for a new marginal value function object.
Parameters
----------
cFunc : function
A real function representing the marginal value function composed
with the inverse marginal utility function, defined on market
resources: uP_inv(vPfunc(m)). Called cFunc because when standard
envelope condition applies, uP_inv(vPfunc(m)) = cFunc(m).
CRRA : float
Coefficient of relative risk aversion.
Returns
-------
None
'''
self.cFunc = deepcopy(cFunc)
self.CRRA = CRRA
def __call__(self,m):
'''
Evaluate the marginal value function at given levels of market resources m.
Parameters
----------
m : float or np.array
Market resources (normalized by permanent income) whose marginal
value is to be found.
Returns
-------
vP : float or np.array
Marginal lifetime value of beginning this period with market
resources m; has same size as input m.
'''
return utilityP(self.cFunc(m),gam=self.CRRA)
def derivative(self,m):
'''
Evaluate the derivative of the marginal value function at given levels
of market resources m; this is the marginal marginal value function.
Parameters
----------
m : float or np.array
Market resources (normalized by permanent income) whose marginal
marginal value is to be found.
Returns
-------
vPP : float or np.array
Marginal marginal lifetime value of beginning this period with market
resources m; has same size as input m.
'''
c, MPC = self.cFunc.eval_with_derivative(m)
return MPC*utilityPP(c,gam=self.CRRA)
class MargMargValueFunc(HARKobject):
'''
A class for representing a marginal marginal value function in models where
the standard envelope condition of v'(m) = u'(c(m)) holds (with CRRA utility).
'''
distance_criteria = ['cFunc','CRRA']
def __init__(self,cFunc,CRRA):
'''
Constructor for a new marginal marginal value function object.
Parameters
----------
cFunc : function
A real function representing the marginal value function composed
with the inverse marginal utility function, defined on market
resources: uP_inv(vPfunc(m)). Called cFunc because when standard
envelope condition applies, uP_inv(vPfunc(m)) = cFunc(m).
CRRA : float
Coefficient of relative risk aversion.
Returns
-------
None
'''
self.cFunc = deepcopy(cFunc)
self.CRRA = CRRA
def __call__(self,m):
'''
Evaluate the marginal marginal value function at given levels of market
resources m.
Parameters
----------
m : float or np.array
Market resources (normalized by permanent income) whose marginal
marginal value is to be found.
Returns
-------
vPP : float or np.array
Marginal marginal lifetime value of beginning this period with market
resources m; has same size as input m.
'''
c, MPC = self.cFunc.eval_with_derivative(m)
return MPC*utilityPP(c,gam=self.CRRA)
# =====================================================================
# === Classes and functions that solve consumption-saving models ===
# =====================================================================
class ConsPerfForesightSolver(object):
'''
A class for solving a one period perfect foresight consumption-saving problem.
An instance of this class is created by the function solvePerfForesight in each period.
'''
def __init__(self,solution_next,DiscFac,LivPrb,CRRA,Rfree,PermGroFac):
'''
Constructor for a new ConsPerfForesightSolver.
Parameters
----------
solution_next : ConsumerSolution
The solution to next period's one-period problem.
DiscFac : float
Intertemporal discount factor for future utility.
LivPrb : float
Survival probability; likelihood of being alive at the beginning of
the next period.
CRRA : float
Coefficient of relative risk aversion.
Rfree : float
Risk free interest factor on end-of-period assets.
PermGroFac : float
Expected permanent income growth factor at the end of this period.
Returns:
----------
None
'''
# We ask that HARK users define single-letter variables they use in a dictionary
# attribute called notation.
# Do that first.
self.notation = {'a': 'assets after all actions',
'm': 'market resources at decision time',
'c': 'consumption'}
self.assignParameters(solution_next,DiscFac,LivPrb,CRRA,Rfree,PermGroFac)
def assignParameters(self,solution_next,DiscFac,LivPrb,CRRA,Rfree,PermGroFac):
'''
Saves necessary parameters as attributes of self for use by other methods.
Parameters
----------
solution_next : ConsumerSolution
The solution to next period's one period problem.
DiscFac : float
Intertemporal discount factor for future utility.
LivPrb : float
Survival probability; likelihood of being alive at the beginning of
the succeeding period.
CRRA : float
Coefficient of relative risk aversion.
Rfree : float
Risk free interest factor on end-of-period assets.
PermGroFac : float
Expected permanent income growth factor at the end of this period.
Returns
-------
none
'''
self.solution_next = solution_next
self.DiscFac = DiscFac
self.LivPrb = LivPrb
self.CRRA = CRRA
self.Rfree = Rfree
self.PermGroFac = PermGroFac
def defUtilityFuncs(self):
'''
Defines CRRA utility function for this period (and its derivatives),
saving them as attributes of self for other methods to use.
Parameters
----------
none
Returns
-------
none
'''
self.u = lambda c : utility(c,gam=self.CRRA) # utility function
self.uP = lambda c : utilityP(c,gam=self.CRRA) # marginal utility function
self.uPP = lambda c : utilityPP(c,gam=self.CRRA)# marginal marginal utility function
def defValueFuncs(self):
'''
Defines the value and marginal value function for this period.
Parameters
----------
none
Returns
-------
none
'''
MPCnvrs = self.MPC**(-self.CRRA/(1.0-self.CRRA))
vFuncNvrs = LinearInterp(np.array([self.mNrmMin, self.mNrmMin+1.0]),np.array([0.0, MPCnvrs]))
self.vFunc = ValueFunc(vFuncNvrs,self.CRRA)
self.vPfunc = MargValueFunc(self.cFunc,self.CRRA)
def makePFcFunc(self):
'''
Makes the (linear) consumption function for this period.
Parameters
----------
none
Returns
-------
none
'''
# Calculate human wealth this period (and lower bound of m)
self.hNrmNow = (self.PermGroFac/self.Rfree)*(self.solution_next.hNrm + 1.0)
self.mNrmMin = -self.hNrmNow
# Calculate the (constant) marginal propensity to consume
PatFac = ((self.Rfree*self.DiscFacEff)**(1.0/self.CRRA))/self.Rfree
self.MPC = 1.0/(1.0 + PatFac/self.solution_next.MPCmin)
# Construct the consumption function
self.cFunc = LinearInterp([self.mNrmMin, self.mNrmMin+1.0],[0.0, self.MPC])
# Add two attributes to enable calculation of steady state market resources
self.ExIncNext = 1.0 # Perfect foresight income of 1
self.mNrmMinNow = self.mNrmMin # Relabeling for compatibility with addSSmNrm
def addSSmNrm(self,solution):
'''
Finds steady state (normalized) market resources and adds it to the
solution. This is the level of market resources such that the expectation
of market resources in the next period is unchanged. This value doesn't
necessarily exist.
Parameters
----------
solution : ConsumerSolution
Solution to this period's problem, which must have attribute cFunc.
Returns
-------
solution : ConsumerSolution
Same solution that was passed, but now with the attribute mNrmSS.
'''
# Make a linear function of all combinations of c and m that yield mNext = mNow
mZeroChangeFunc = lambda m : (1.0-self.PermGroFac/self.Rfree)*m + (self.PermGroFac/self.Rfree)*self.ExIncNext
# Find the steady state level of market resources
searchSSfunc = lambda m : solution.cFunc(m) - mZeroChangeFunc(m) # A zero of this is SS market resources
m_init_guess = self.mNrmMinNow + self.ExIncNext # Minimum market resources plus next income is okay starting guess
try:
mNrmSS = newton(searchSSfunc,m_init_guess)
except:
mNrmSS = None
# Add mNrmSS to the solution and return it
solution.mNrmSS = mNrmSS
return solution
def solve(self):
'''
Solves the one period perfect foresight consumption-saving problem.
Parameters
----------
none
Returns
-------
solution : ConsumerSolution
The solution to this period's problem.
'''
self.defUtilityFuncs()
self.DiscFacEff = self.DiscFac*self.LivPrb
self.makePFcFunc()
self.defValueFuncs()
solution = ConsumerSolution(cFunc=self.cFunc, vFunc=self.vFunc, vPfunc=self.vPfunc,
mNrmMin=self.mNrmMin, hNrm=self.hNrmNow,
MPCmin=self.MPC, MPCmax=self.MPC)
#solution = self.addSSmNrm(solution)
return solution
def solvePerfForesight(solution_next,DiscFac,LivPrb,CRRA,Rfree,PermGroFac):
'''
Solves a single period consumption-saving problem for a consumer with perfect foresight.
Parameters
----------
solution_next : ConsumerSolution
The solution to next period's one period problem.
DiscFac : float
Intertemporal discount factor for future utility.
LivPrb : float
Survival probability; likelihood of being alive at the beginning of
the succeeding period.
CRRA : float
Coefficient of relative risk aversion.
Rfree : float
Risk free interest factor on end-of-period assets.
PermGroFac : float
Expected permanent income growth factor at the end of this period.
Returns
-------
solution : ConsumerSolution
The solution to this period's problem.
'''
solver = ConsPerfForesightSolver(solution_next,DiscFac,LivPrb,CRRA,Rfree,PermGroFac)
solution = solver.solve()
return solution
###############################################################################
###############################################################################
class ConsIndShockSetup(ConsPerfForesightSolver):
'''
A superclass for solvers of one period consumption-saving problems with
constant relative risk aversion utility and permanent and transitory shocks
to income. Has methods to set up but not solve the one period problem.
'''
def __init__(self,solution_next,IncomeDstn,LivPrb,DiscFac,CRRA,Rfree,
PermGroFac,BoroCnstArt,aXtraGrid,vFuncBool,CubicBool):
'''
Constructor for a new solver-setup for problems with income subject to
permanent and transitory shocks.
Parameters
----------
solution_next : ConsumerSolution
The solution to next period's one period problem.
IncomeDstn : [np.array]
A list containing three arrays of floats, representing a discrete
approximation to the income process between the period being solved
and the one immediately following (in solution_next). Order: event
probabilities, permanent shocks, transitory shocks.
LivPrb : float
Survival probability; likelihood of being alive at the beginning of
the succeeding period.
DiscFac : float
Intertemporal discount factor for future utility.
CRRA : float
Coefficient of relative risk aversion.
Rfree : float
Risk free interest factor on end-of-period assets.
PermGroFac : float
Expected permanent income growth factor at the end of this period.
BoroCnstArt: float or None
Borrowing constraint for the minimum allowable assets to end the
period with. If it is less than the natural borrowing constraint,
then it is irrelevant; BoroCnstArt=None indicates no artificial bor-
rowing constraint.
aXtraGrid: np.array
Array of "extra" end-of-period asset values-- assets above the
absolute minimum acceptable level.
vFuncBool: boolean
An indicator for whether the value function should be computed and
included in the reported solution.
CubicBool: boolean
An indicator for whether the solver should use cubic or linear inter-
polation.
Returns
-------
None
'''
self.assignParameters(solution_next,IncomeDstn,LivPrb,DiscFac,CRRA,Rfree,
PermGroFac,BoroCnstArt,aXtraGrid,vFuncBool,CubicBool)
self.defUtilityFuncs()
def assignParameters(self,solution_next,IncomeDstn,LivPrb,DiscFac,CRRA,Rfree,
PermGroFac,BoroCnstArt,aXtraGrid,vFuncBool,CubicBool):
'''
Assigns period parameters as attributes of self for use by other methods
Parameters
----------
solution_next : ConsumerSolution
The solution to next period's one period problem.
IncomeDstn : [np.array]
A list containing three arrays of floats, representing a discrete
approximation to the income process between the period being solved
and the one immediately following (in solution_next). Order: event
probabilities, permanent shocks, transitory shocks.
LivPrb : float
Survival probability; likelihood of being alive at the beginning of
the succeeding period.
DiscFac : float
Intertemporal discount factor for future utility.
CRRA : float
Coefficient of relative risk aversion.
Rfree : float
Risk free interest factor on end-of-period assets.
PermGroFac : float
Expected permanent income growth factor at the end of this period.
BoroCnstArt: float or None
Borrowing constraint for the minimum allowable assets to end the
period with. If it is less than the natural borrowing constraint,
then it is irrelevant; BoroCnstArt=None indicates no artificial bor-
rowing constraint.
aXtraGrid: np.array
Array of "extra" end-of-period asset values-- assets above the
absolute minimum acceptable level.
vFuncBool: boolean
An indicator for whether the value function should be computed and
included in the reported solution.
CubicBool: boolean
An indicator for whether the solver should use cubic or linear inter-
polation.
Returns
-------
none
'''
ConsPerfForesightSolver.assignParameters(self,solution_next,DiscFac,LivPrb,
CRRA,Rfree,PermGroFac)
self.BoroCnstArt = BoroCnstArt
self.IncomeDstn = IncomeDstn
self.aXtraGrid = aXtraGrid
self.vFuncBool = vFuncBool
self.CubicBool = CubicBool
def defUtilityFuncs(self):
'''
Defines CRRA utility function for this period (and its derivatives,
and their inverses), saving them as attributes of self for other methods
to use.
Parameters
----------
none
Returns
-------
none
'''
ConsPerfForesightSolver.defUtilityFuncs(self)
self.uPinv = lambda u : utilityP_inv(u,gam=self.CRRA)
self.uPinvP = lambda u : utilityP_invP(u,gam=self.CRRA)
self.uinvP = lambda u : utility_invP(u,gam=self.CRRA)
if self.vFuncBool:
self.uinv = lambda u : utility_inv(u,gam=self.CRRA)
def setAndUpdateValues(self,solution_next,IncomeDstn,LivPrb,DiscFac):
'''
Unpacks some of the inputs (and calculates simple objects based on them),
storing the results in self for use by other methods. These include:
income shocks and probabilities, next period's marginal value function
(etc), the probability of getting the worst income shock next period,
the patience factor, human wealth, and the bounding MPCs.
Parameters
----------
solution_next : ConsumerSolution
The solution to next period's one period problem.
IncomeDstn : [np.array]
A list containing three arrays of floats, representing a discrete
approximation to the income process between the period being solved
and the one immediately following (in solution_next). Order: event
probabilities, permanent shocks, transitory shocks.
LivPrb : float
Survival probability; likelihood of being alive at the beginning of
the succeeding period.
DiscFac : float
Intertemporal discount factor for future utility.
Returns
-------
None
'''
self.DiscFacEff = DiscFac*LivPrb # "effective" discount factor
self.ShkPrbsNext = IncomeDstn[0]
self.PermShkValsNext = IncomeDstn[1]
self.TranShkValsNext = IncomeDstn[2]
self.PermShkMinNext = np.min(self.PermShkValsNext)
self.TranShkMinNext = np.min(self.TranShkValsNext)
self.vPfuncNext = solution_next.vPfunc
self.WorstIncPrb = np.sum(self.ShkPrbsNext[
(self.PermShkValsNext*self.TranShkValsNext)==
(self.PermShkMinNext*self.TranShkMinNext)])
if self.CubicBool:
self.vPPfuncNext = solution_next.vPPfunc
if self.vFuncBool:
self.vFuncNext = solution_next.vFunc
# Update the bounding MPCs and PDV of human wealth:
self.PatFac = ((self.Rfree*self.DiscFacEff)**(1.0/self.CRRA))/self.Rfree
self.MPCminNow = 1.0/(1.0 + self.PatFac/solution_next.MPCmin)
self.ExIncNext = np.dot(self.ShkPrbsNext,self.TranShkValsNext*self.PermShkValsNext)
self.hNrmNow = self.PermGroFac/self.Rfree*(self.ExIncNext + solution_next.hNrm)
self.MPCmaxNow = 1.0/(1.0 + (self.WorstIncPrb**(1.0/self.CRRA))*
self.PatFac/solution_next.MPCmax)
def defBoroCnst(self,BoroCnstArt):
'''
Defines the constrained portion of the consumption function as cFuncNowCnst,
an attribute of self. Uses the artificial and natural borrowing constraints.
Parameters
----------
BoroCnstArt : float or None
Borrowing constraint for the minimum allowable assets to end the
period with. If it is less than the natural borrowing constraint,
then it is irrelevant; BoroCnstArt=None indicates no artificial bor-
rowing constraint.
Returns
-------
none
'''
# Calculate the minimum allowable value of money resources in this period
self.BoroCnstNat = (self.solution_next.mNrmMin - self.TranShkMinNext)*\
(self.PermGroFac*self.PermShkMinNext)/self.Rfree
# Note: need to be sure to handle BoroCnstArt==None appropriately.
# In Py2, this would evaluate to 5.0: np.max([None, 5.0]).
# However in Py3, this raises a TypeError. Thus here we need to directly
# address the situation in which BoroCnstArt == None:
if BoroCnstArt is None:
self.mNrmMinNow = self.BoroCnstNat
else:
self.mNrmMinNow = np.max([self.BoroCnstNat,BoroCnstArt])
if self.BoroCnstNat < self.mNrmMinNow:
self.MPCmaxEff = 1.0 # If actually constrained, MPC near limit is 1
else:
self.MPCmaxEff = self.MPCmaxNow
# Define the borrowing constraint (limiting consumption function)
self.cFuncNowCnst = LinearInterp(np.array([self.mNrmMinNow, self.mNrmMinNow+1]),
np.array([0.0, 1.0]))
def prepareToSolve(self):
'''
Perform preparatory work before calculating the unconstrained consumption
function.
Parameters
----------
none
Returns
-------
none
'''
self.setAndUpdateValues(self.solution_next,self.IncomeDstn,self.LivPrb,self.DiscFac)
self.defBoroCnst(self.BoroCnstArt)
####################################################################################################
####################################################################################################
class ConsIndShockSolverBasic(ConsIndShockSetup):
'''
This class solves a single period of a standard consumption-saving problem,
using linear interpolation and without the ability to calculate the value
function. ConsIndShockSolver inherits from this class and adds the ability
to perform cubic interpolation and to calculate the value function.
Note that this class does not have its own initializing method. It initial-
izes the same problem in the same way as ConsIndShockSetup, from which it
inherits.
'''
def prepareToCalcEndOfPrdvP(self):
'''
Prepare to calculate end-of-period marginal value by creating an array
of market resources that the agent could have next period, considering
the grid of end-of-period assets and the distribution of shocks he might
experience next period.
Parameters
----------
none
Returns
-------
aNrmNow : np.array
A 1D array of end-of-period assets; also stored as attribute of self.
'''
aNrmNow = np.asarray(self.aXtraGrid) + self.BoroCnstNat
ShkCount = self.TranShkValsNext.size
aNrm_temp = np.tile(aNrmNow,(ShkCount,1))
# Tile arrays of the income shocks and put them into useful shapes
aNrmCount = aNrmNow.shape[0]
PermShkVals_temp = (np.tile(self.PermShkValsNext,(aNrmCount,1))).transpose()
TranShkVals_temp = (np.tile(self.TranShkValsNext,(aNrmCount,1))).transpose()
ShkPrbs_temp = (np.tile(self.ShkPrbsNext,(aNrmCount,1))).transpose()
# Get cash on hand next period
mNrmNext = self.Rfree/(self.PermGroFac*PermShkVals_temp)*aNrm_temp + TranShkVals_temp
# Store and report the results
self.PermShkVals_temp = PermShkVals_temp
self.ShkPrbs_temp = ShkPrbs_temp
self.mNrmNext = mNrmNext
self.aNrmNow = aNrmNow
return aNrmNow
def calcEndOfPrdvP(self):
'''
Calculate end-of-period marginal value of assets at each point in aNrmNow.
Does so by taking a weighted sum of next period marginal values across
income shocks (in a preconstructed grid self.mNrmNext).
Parameters
----------
none
Returns
-------
EndOfPrdvP : np.array
A 1D array of end-of-period marginal value of assets
'''
EndOfPrdvP = self.DiscFacEff*self.Rfree*self.PermGroFac**(-self.CRRA)*np.sum(
self.PermShkVals_temp**(-self.CRRA)*
self.vPfuncNext(self.mNrmNext)*self.ShkPrbs_temp,axis=0)
return EndOfPrdvP
def getPointsForInterpolation(self,EndOfPrdvP,aNrmNow):
'''
Finds interpolation points (c,m) for the consumption function.
Parameters
----------
EndOfPrdvP : np.array
Array of end-of-period marginal values.
aNrmNow : np.array
Array of end-of-period asset values that yield the marginal values
in EndOfPrdvP.
Returns
-------
c_for_interpolation : np.array
Consumption points for interpolation.
m_for_interpolation : np.array
Corresponding market resource points for interpolation.
'''
cNrmNow = self.uPinv(EndOfPrdvP)
mNrmNow = cNrmNow + aNrmNow
# Limiting consumption is zero as m approaches mNrmMin
c_for_interpolation = np.insert(cNrmNow,0,0.,axis=-1)
m_for_interpolation = np.insert(mNrmNow,0,self.BoroCnstNat,axis=-1)
# Store these for calcvFunc
self.cNrmNow = cNrmNow
self.mNrmNow = mNrmNow
return c_for_interpolation,m_for_interpolation
def usePointsForInterpolation(self,cNrm,mNrm,interpolator):
'''
Constructs a basic solution for this period, including the consumption
function and marginal value function.
Parameters
----------
cNrm : np.array
(Normalized) consumption points for interpolation.
mNrm : np.array
(Normalized) corresponding market resource points for interpolation.
interpolator : function
A function that constructs and returns a consumption function.
Returns
-------
solution_now : ConsumerSolution
The solution to this period's consumption-saving problem, with a
consumption function, marginal value function, and minimum m.
'''
# Construct the unconstrained consumption function
cFuncNowUnc = interpolator(mNrm,cNrm)
# Combine the constrained and unconstrained functions into the true consumption function
cFuncNow = LowerEnvelope(cFuncNowUnc,self.cFuncNowCnst)
# Make the marginal value function and the marginal marginal value function
vPfuncNow = MargValueFunc(cFuncNow,self.CRRA)
# Pack up the solution and return it
solution_now = ConsumerSolution(cFunc=cFuncNow, vPfunc=vPfuncNow, mNrmMin=self.mNrmMinNow)
return solution_now
def makeBasicSolution(self,EndOfPrdvP,aNrm,interpolator):
'''
Given end of period assets and end of period marginal value, construct
the basic solution for this period.
Parameters
----------
EndOfPrdvP : np.array
Array of end-of-period marginal values.
aNrm : np.array
Array of end-of-period asset values that yield the marginal values
in EndOfPrdvP.
interpolator : function
A function that constructs and returns a consumption function.
Returns
-------
solution_now : ConsumerSolution
The solution to this period's consumption-saving problem, with a
consumption function, marginal value function, and minimum m.
'''
cNrm,mNrm = self.getPointsForInterpolation(EndOfPrdvP,aNrm)
solution_now = self.usePointsForInterpolation(cNrm,mNrm,interpolator)
return solution_now
def addMPCandHumanWealth(self,solution):
'''
Take a solution and add human wealth and the bounding MPCs to it.
Parameters
----------
solution : ConsumerSolution
The solution to this period's consumption-saving problem.
Returns:
----------
solution : ConsumerSolution
The solution to this period's consumption-saving problem, but now
with human wealth and the bounding MPCs.
'''
solution.hNrm = self.hNrmNow
solution.MPCmin = self.MPCminNow
solution.MPCmax = self.MPCmaxEff
return solution
def makeLinearcFunc(self,mNrm,cNrm):
'''
Makes a linear interpolation to represent the (unconstrained) consumption function.
Parameters
----------
mNrm : np.array
Corresponding market resource points for interpolation.
cNrm : np.array
Consumption points for interpolation.
Returns
-------
cFuncUnc : LinearInterp
The unconstrained consumption function for this period.
'''
cFuncUnc = LinearInterp(mNrm,cNrm,self.MPCminNow*self.hNrmNow,self.MPCminNow)
return cFuncUnc
def solve(self):
'''
Solves a one period consumption saving problem with risky income.
Parameters
----------
None
Returns
-------
solution : ConsumerSolution
The solution to the one period problem.
'''
aNrm = self.prepareToCalcEndOfPrdvP()
EndOfPrdvP = self.calcEndOfPrdvP()
solution = self.makeBasicSolution(EndOfPrdvP,aNrm,self.makeLinearcFunc)
solution = self.addMPCandHumanWealth(solution)
return solution
###############################################################################
###############################################################################
class ConsIndShockSolver(ConsIndShockSolverBasic):
'''
This class solves a single period of a standard consumption-saving problem.
It inherits from ConsIndShockSolverBasic, adding the ability to perform cubic
interpolation and to calculate the value function.
'''
def makeCubiccFunc(self,mNrm,cNrm):
'''
Makes a cubic spline interpolation of the unconstrained consumption
function for this period.
Parameters
----------
mNrm : np.array
Corresponding market resource points for interpolation.
cNrm : np.array
Consumption points for interpolation.
Returns
-------
cFuncUnc : CubicInterp
The unconstrained consumption function for this period.
'''
EndOfPrdvPP = self.DiscFacEff*self.Rfree*self.Rfree*self.PermGroFac**(-self.CRRA-1.0)* \
np.sum(self.PermShkVals_temp**(-self.CRRA-1.0)*
self.vPPfuncNext(self.mNrmNext)*self.ShkPrbs_temp,axis=0)
dcda = EndOfPrdvPP/self.uPP(np.array(cNrm[1:]))
MPC = dcda/(dcda+1.)
MPC = np.insert(MPC,0,self.MPCmaxNow)
cFuncNowUnc = CubicInterp(mNrm,cNrm,MPC,self.MPCminNow*self.hNrmNow,self.MPCminNow)
return cFuncNowUnc
def makeEndOfPrdvFunc(self,EndOfPrdvP):
'''
Construct the end-of-period value function for this period, storing it
as an attribute of self for use by other methods.
Parameters
----------
EndOfPrdvP : np.array
Array of end-of-period marginal value of assets corresponding to the
asset values in self.aNrmNow.
Returns
-------
none
'''
VLvlNext = (self.PermShkVals_temp**(1.0-self.CRRA)*\
self.PermGroFac**(1.0-self.CRRA))*self.vFuncNext(self.mNrmNext)
EndOfPrdv = self.DiscFacEff*np.sum(VLvlNext*self.ShkPrbs_temp,axis=0)
EndOfPrdvNvrs = self.uinv(EndOfPrdv) # value transformed through inverse utility
EndOfPrdvNvrsP = EndOfPrdvP*self.uinvP(EndOfPrdv)
EndOfPrdvNvrs = np.insert(EndOfPrdvNvrs,0,0.0)
EndOfPrdvNvrsP = np.insert(EndOfPrdvNvrsP,0,EndOfPrdvNvrsP[0]) # This is a very good approximation, vNvrsPP = 0 at the asset minimum
aNrm_temp = np.insert(self.aNrmNow,0,self.BoroCnstNat)
EndOfPrdvNvrsFunc = CubicInterp(aNrm_temp,EndOfPrdvNvrs,EndOfPrdvNvrsP)
self.EndOfPrdvFunc = ValueFunc(EndOfPrdvNvrsFunc,self.CRRA)
def addvFunc(self,solution,EndOfPrdvP):
'''
Creates the value function for this period and adds it to the solution.
Parameters
----------
solution : ConsumerSolution
The solution to this single period problem, likely including the
consumption function, marginal value function, etc.
EndOfPrdvP : np.array
Array of end-of-period marginal value of assets corresponding to the
asset values in self.aNrmNow.
Returns
-------
solution : ConsumerSolution
The single period solution passed as an input, but now with the
value function (defined over market resources m) as an attribute.
'''
self.makeEndOfPrdvFunc(EndOfPrdvP)
solution.vFunc = self.makevFunc(solution)
return solution
def makevFunc(self,solution):
'''
Creates the value function for this period, defined over market resources m.
self must have the attribute EndOfPrdvFunc in order to execute.
Parameters
----------
solution : ConsumerSolution
The solution to this single period problem, which must include the
consumption function.
Returns
-------
vFuncNow : ValueFunc
A representation of the value function for this period, defined over
normalized market resources m: v = vFuncNow(m).
'''
# Compute expected value and marginal value on a grid of market resources
mNrm_temp = self.mNrmMinNow + self.aXtraGrid
cNrmNow = solution.cFunc(mNrm_temp)
aNrmNow = mNrm_temp - cNrmNow
vNrmNow = self.u(cNrmNow) + self.EndOfPrdvFunc(aNrmNow)
vPnow = self.uP(cNrmNow)
# Construct the beginning-of-period value function
vNvrs = self.uinv(vNrmNow) # value transformed through inverse utility
vNvrsP = vPnow*self.uinvP(vNrmNow)
mNrm_temp = | np.insert(mNrm_temp,0,self.mNrmMinNow) | numpy.insert |
from dataclasses import dataclass
from typing import Optional, Tuple
import numpy as np
from numba import njit, jitclass, int32
from . import hex_io
@dataclass
class HexGameState:
color: int # 0=first player (red), 1=second player (blue)
legal_moves: np.ndarray
result: int
board: np.ndarray
class HexGame:
"""Game of Hex
See https://en.wikipedia.org/wiki/Hex_(board_game)
"""
# printing boards etc.
io = hex_io
def __init__(self, board_size: int = 11) -> None:
self.board_size = board_size
self.impl = HexGameImpl(self.board_size)
self._game_snapshot = None
self.reset()
def __getstate__(self):
"""Pickling support"""
return (self.impl.board.copy(),
self.impl.color,
self.impl.winner)
def __setstate__(self, state):
"""Pickling support"""
board, color, winner = state
self.__init__(board.shape[0])
self.impl.board[:] = board
self.impl.color = color
self.impl.winner = winner
def reset(self):
self.impl = HexGameImpl(self.board_size)
self._game_snapshot = None
def seed(self, seed: Optional[int] = None) -> None:
"""Seed random number generator."""
pass
@property
def state(self) -> HexGameState:
return HexGameState(self.impl.color - 1,
self.impl.legal_moves(),
self.impl.result(),
self.impl.board.copy())
def step(self, move: int) -> None:
self.impl.step(move)
def snapshot(self) -> None:
self._game_snapshot = self.__getstate__()
def restore(self) -> None:
assert self._game_snapshot
self.__setstate__(self._game_snapshot)
@staticmethod
def flip_player_board(board: np.ndarray) -> np.ndarray:
"""Flip board to opponent perspective.
Change both color and attack direction.
:param board: One game board (M x M) or batch of boards (B x M x M)
"""
assert isinstance(board, np.ndarray)
if len(board.shape) == 2:
return HexGame.flip_player_board(board[None, :, :])
assert len(board.shape) == 3, 'expecting batch of boards'
assert board.shape[-2] == board.shape[-1], 'board must be square'
# flip color
board = (board > 0) * (3 - board)
# flip attack direction: mirror board along diagonal
board = np.flip(np.rot90(board, axes=(-2, -1)), axis=-1)
return board
@staticmethod
def flip_player_board_moves(board: np.ndarray, moves: np.ndarray) \
-> Tuple[np.ndarray, np.ndarray]:
"""Flip board and legal moves to opponent perspective.
Change both color and attack direction.
:param board: One game board (M x M) or batch of boards (B x M x M)
:param moves: Legal moves (K) or padded batch of moves (B x K)
"""
assert isinstance(board, np.ndarray)
assert isinstance(moves, np.ndarray)
if len(board.shape) == 2:
assert len(moves.shape) == 1, 'expecting 1D moves array'
return HexGame.flip_player_board_moves(board[None, :, :],
moves[None, :])
board = HexGame.flip_player_board(board)
assert isinstance(moves, np.ndarray)
assert len(moves.shape) == 2, 'expecting batch of moves'
assert len(moves) == len(board), 'board and moves batch sizes differ'
board_size = board.shape[-2:]
# remove padding and collapse ragged rows
moves_size = moves.shape
flat_moves = moves.ravel().copy()
mask = (flat_moves > 0)
tiles = flat_moves[mask] - 1
# calculate new move coordinates mirrored along diagonal
tile_ids = | np.unravel_index(tiles, board_size) | numpy.unravel_index |
# Atom Tracing Code for International Workshop and Short Course on the FRONTIERS OF ELECTRON TOMOGRAPHY
# https://www.electron-tomo.com/
import numpy as np
import scipy as sp
import scipy.io as sio
import os
import warnings
def tripleRoll(vol, vec):
return np.roll(np.roll(np.roll(vol, vec[0], axis=0), vec[1], axis=1), vec[2], axis=2)
def peakFind3D(vol, thresh3D):
"""
Find peaks in a 3D volume
vol: an ndarray of values with peaks to find
thresh3D: [0,1] value to set a threshold for size of peak vs. max intensity in image
"""
pLarge = ((vol > tripleRoll(vol, [-1, -1, -1]))
& (vol > tripleRoll(vol, [0, -1, -1]))
& (vol > tripleRoll(vol, [1, -1, -1]))
& (vol > tripleRoll(vol, [-1, 0, -1]))
& (vol > tripleRoll(vol, [1, 0, -1]))
& (vol > tripleRoll(vol, [-1, 1, -1]))
& (vol > tripleRoll(vol, [0, 1, -1]))
& (vol > tripleRoll(vol, [1, 1, -1]))
& (vol > tripleRoll(vol, [0, 0, -1]))
& (vol > tripleRoll(vol, [-1, -1, 0]))
& (vol > tripleRoll(vol, [0, -1, 0]))
& (vol > tripleRoll(vol, [1, -1, 0]))
& (vol > tripleRoll(vol, [-1, 0, 0]))
& (vol > tripleRoll(vol, [1, 0, 0]))
& (vol > tripleRoll(vol, [-1, 1, 0]))
& (vol > tripleRoll(vol, [0, 1, 0]))
& (vol > tripleRoll(vol, [1, 1, 0]))
& (vol > tripleRoll(vol, [-1, -1, 1]))
& (vol > tripleRoll(vol, [0, -1, 1]))
& (vol > tripleRoll(vol, [1, -1, 1]))
& (vol > tripleRoll(vol, [-1, 0, 1]))
& (vol > tripleRoll(vol, [1, 0, 1]))
& (vol > tripleRoll(vol, [-1, 1, 1]))
& (vol > tripleRoll(vol, [0, 1, 1]))
& (vol > tripleRoll(vol, [1, 1, 1]))
& (vol > tripleRoll(vol, [0, 0, 1]))
& (vol > thresh3D * np.max(vol)))
[xp, yp, zp] = np.where(pLarge * vol)
ip = vol[xp, yp, zp]
return {'xp': xp, 'yp': yp, 'zp': zp, 'ip': ip}
def MatrixQuaternionRot(vector, theta):
"""
MatrixQuaternionRot(vector,theta)
Returns a 3x3 rotation matrix [SO(3)] in numpy array (not numpy matrix!)
for rotating "theta" angle around the given "vector" axis.
vector - A non-zero 3-element numpy array representing rotation axis
theta - A real number for rotation angle in "DEGREES"
Author: <NAME>, Dept. of Physics and Astronomy, UCLA
<EMAIL>
"""
theta = theta * np.pi / 180
vector = vector / np.float(np.sqrt(np.dot(vector, vector)))
w = np.cos(theta / 2)
x = -np.sin(theta / 2) * vector[0]
y = -np.sin(theta / 2) * vector[1]
z = -np.sin(theta / 2) * vector[2]
RotM = np.array([[1. - 2 * y ** 2. - 2 * z ** 2, 2. * x * y + 2 * w * z, 2. * x * z - 2. * w * y], \
[2. * x * y - 2. * w * z, 1. - 2. * x ** 2 - 2. * z ** 2, 2. * y * z + 2. * w * x], \
[2 * x * z + 2 * w * y, 2 * y * z - 2. * w * x, 1 - 2. * x ** 2 - 2. * y ** 2]])
return RotM
def gauss3DGEN_FIT(xyz, x0, y0, z0, sigma_x, sigma_y, sigma_z, Angle1, Angle2, Angle3, BG, Height):
"""
gauss3DGEN_FIT((x,y,z),x0,y0,z0,sigma_x,sigma_y,sigma_z,Angle1,Angle2,Angle3,BG,Height)
Returns the value of a gaussian at a 3D set of points for the given
sub-pixel positions with standard deviations, 3D Eular rotation angles,
constant Background value, and Gaussian peak height.
xyz - A tuple containing the 3D arrays of points (possibly from meshgrid)
x0, y0, z0 = the x, y, z centers of the Gaussian
sigma_x,sigma_y,sigma_z = standard deviations along x,y,z direction before
3D angular rotation
Angle1,Angle2,Angle3 = Tiat-Bryan angles in ZYX convention for 3D rotation
BG = constant background
Height = the peak height of Gaussian function
Author: <NAME>, Dept. of Physics and Astronomy, UCLA
<EMAIL>
"""
# 3D vectors for each sampled positions
v = np.array(
[xyz[0].reshape(-1, order='F') - x0, xyz[1].reshape(-1, order='F') - y0, xyz[2].reshape(-1, order='F') - z0])
# rotation axes for Tiat-Bryan angles
vector1 = np.array([0, 0, 1])
rotmat1 = MatrixQuaternionRot(vector1, Angle1)
vector2 = np.array([0, 1, 0])
rotmat2 = MatrixQuaternionRot(vector2, Angle2)
vector3 = np.array([1, 0, 0])
rotmat3 = MatrixQuaternionRot(vector3, Angle3)
# full rotation matrix
rotMAT = np.matrix(rotmat3) * np.matrix(rotmat2) * np.matrix(rotmat1)
# 3x3 matrix for applying sigmas
D = np.matrix(np.array([[1. / (2 * sigma_x ** 2), 0, 0, ], \
[0, 1. / (2 * sigma_y ** 2), 0], \
[0, 0, 1. / (2 * sigma_z ** 2)]]))
# apply 3D rotation to the sigma matrix
WidthMat = np.transpose(rotMAT) * D * rotMAT
# caltulate 3D Gaussian
RHS_calc = WidthMat * np.matrix(v)
Result = Height * np.exp(-1 * np.sum(v * RHS_calc.A, axis=0)) + BG
return Result
def saveXYZ(filename, xyzCoords, AtomTypes, AtomNames, DataDescriptionStr):
"""
saveXYZ(filename,xyzCoords,AtomTypes,AtomNames,DataDescriptionStr)
Writes the 3D atom coordinates and species into a file in xyz format.
filename - filename to save the atomic coordinates
xyzCoords - 3xN numpy array for xyz coordinates
AtomTypes - postive integer describing the atomic species (0,1,2,...)
AtomNames - a list of strings, containing the name of the atomic species
for each atomtype of corresponding AtomTypes
DataDescriptionStr - a string to be written on the header
Author: <NAME>, Dept. of Physics and Astronomy, UCLA
<EMAIL>
"""
f = open(filename, 'w')
f.write('{0:d}\n'.format(xyzCoords.shape[1]))
f.write('{0:s}\n'.format(DataDescriptionStr))
for i in range(xyzCoords.shape[1]):
f.write('{0:s} {1:10.5f} {2:10.5f} {3:10.5f}\n'.format(AtomNames[int(AtomTypes[i] - 1)], xyzCoords[0, i],
xyzCoords[1, i], xyzCoords[2, i]))
f.close()
def compute_average_atom_from_vol(DataMatrix, atom_pos, atom_ind, boxhalfsize):
"""
compute_average_atom_from_vol(DataMatrix,atom_pos,atom_ind,boxhalfsize)
Computes the average atom based on given DataMatrix and atom positions and
indices with the boxhalfsize.
DataMatrix - a 3D array for reconstructed 3D intensity
atom_pos - a 3xN numpy array for xyz coordinates
atom_ind - a 1D numpy array for indices of atoms to be averaged
boxhalfsize - half box size for the cropping, full box size will be
(2*boxhalfsize+1,2*boxhalfsize+1,2*boxhalfsize+1)
Author: <NAME>, Dept. of Physics and Astronomy, UCLA
<EMAIL>
"""
total_vol = np.zeros((boxhalfsize * 2 + 1, boxhalfsize * 2 + 1, boxhalfsize * 2 + 1))
for kkk in atom_ind:
curr_x = int(np.round(atom_pos[0, kkk]))
curr_y = int(np.round(atom_pos[1, kkk]))
curr_z = int(np.round(atom_pos[2, kkk]))
curr_vol = DataMatrix[curr_x - boxhalfsize:curr_x + boxhalfsize + 1, \
curr_y - boxhalfsize:curr_y + boxhalfsize + 1, \
curr_z - boxhalfsize:curr_z + boxhalfsize + 1]
total_vol = total_vol + curr_vol
avatom = total_vol / len(atom_ind)
return avatom
def get_atomtype_vol_twoatom_useInd(DataMatrix, atom_pos, avatomFe, avatomPt, boxhalfsize, useInd):
"""
Author: <NAME>, Dept. of Physics and Astronomy, UCLA
<EMAIL>
"""
atomtype = np.zeros((atom_pos.shape[1]))
numAtom1 = 0
numAtom2 = 0
for kkk in range(atom_pos.shape[1]):
curr_x = int(np.round(atom_pos[0, kkk]))
curr_y = int(np.round(atom_pos[1, kkk]))
curr_z = int(np.round(atom_pos[2, kkk]))
curr_vol = DataMatrix[curr_x - boxhalfsize:curr_x + boxhalfsize + 1, \
curr_y - boxhalfsize:curr_y + boxhalfsize + 1, \
curr_z - boxhalfsize:curr_z + boxhalfsize + 1]
D_Fe = np.sum(np.abs(curr_vol[useInd] - avatomFe[useInd]))
D_Pt = np.sum(np.abs(curr_vol[useInd] - avatomPt[useInd]))
if D_Fe > D_Pt:
atomtype[kkk] = 2
numAtom2 += 1
else:
atomtype[kkk] = 1
numAtom1 += 1
# print('hi')
# print("number of Fe/Pt atoms: {0:d}/{0:d}".format( numAtom1,numAtom2))
# print("number of Pt: {0:d} atoms".format( sum(atomtype==2)))
return atomtype
def trace_atoms(volume, GaussRad=2, ClassificationRad=2, Res=0.35, MinDist=2., intensityThresh=0.08):
"""Define this method for Python operators that
transform the input array
inputs:
dataset - the volume to trace as a 3D numpy array
GaussRad - pixel radius for cropping small volume around each peak for Gaussian fitting
ClassificationRad - radius for cropping small volume around a peak for atom classification
Res - pixel resolution (isotropic)
MinDist - enforce minimum distance between atom positions
intensityThresh - threshold to find peaks in the volume
"""
warnings.filterwarnings('ignore')
print('Start atom tracing.')
# GaussRad = 2 # radius for cropping small volume for fitting Gaussian
# Res = 0.35 # pixel size
MinDist = MinDist / Res # minimum distance in Angstrom
# ClassificationRad = 2 # radius for cropping small volume for species classification
t1_vol1 = volume.copy()
t1_vol1 = np.swapaxes(t1_vol1, 0, 2)
pp3D = peakFind3D(t1_vol1, intensityThresh) # volume and intensity threshold
allPeaksIXYZ = np.array((pp3D['ip'], pp3D['xp'], pp3D['yp'], pp3D['zp'])).T
print("Number of peaks found: {}".format(allPeaksIXYZ.shape[0]))
sortedPeaksIXYZ = allPeaksIXYZ[allPeaksIXYZ[:, 0].argsort()[::-1]]
RecordedPeakPos = np.array([])
fittingValues = np.zeros((sortedPeaksIXYZ.shape[0], 11))
print('Start Gaussian fitting for each peak.')
cutOut3 = GaussRad
Y3D, X3D, Z3D = np.meshgrid(np.arange(-cutOut3, cutOut3 + 1, 1), np.arange(-cutOut3, cutOut3 + 1, 1),
np.arange(-cutOut3, cutOut3 + 1, 1))
for PeakInd in range(sortedPeaksIXYZ.shape[0]):
curX = sortedPeaksIXYZ[PeakInd, 1]
curY = sortedPeaksIXYZ[PeakInd, 2]
curZ = sortedPeaksIXYZ[PeakInd, 3]
# Check if current point + fit region is within the bounds of the volume
if (curX > cutOut3 + 1) & (curY > cutOut3 + 1) & (curZ > cutOut3 + 1) & (curX < t1_vol1.shape[0] - cutOut3) \
& (curY < t1_vol1.shape[1] - cutOut3) & (curZ < t1_vol1.shape[2] - cutOut3):
curVol = np.float32(t1_vol1[int(curX) - cutOut3:int(curX) + cutOut3 + 1, \
int(curY) - cutOut3:int(curY) + cutOut3 + 1, \
int(curZ) - cutOut3:int(curZ) + cutOut3 + 1])
# Fit to a 3D Gaussian to the area around the peak
initP3D = (0.0, 0.0, 0.0, 3.0, 3.0, 3.0, 0., 0., 0., 0.,
max(curVol.flatten())) # x0,y0,z0,sigma_x,sigma_y,sigma_z,angle1, angle2, angle3,BG,Height
bb = (
(-cutOut3, -cutOut3, -cutOut3, 0.0, 0.0, 0.0, -np.pi, -np.pi, -np.pi, -np.inf, max(curVol.flatten()) / 2.), \
(cutOut3, cutOut3, cutOut3, cutOut3 * 3, cutOut3 * 3, cutOut3 * 3, np.pi, np.pi, np.pi, np.inf,
max(curVol.flatten()) * 2.)) # fitting bounds ((lower),(upper))
optP3D, optCov3D = sp.optimize.curve_fit(gauss3DGEN_FIT, (X3D, Y3D, Z3D), curVol.reshape(-1, order='F'),
p0=initP3D, bounds=bb)
# Check minimum distance constraint and add to the array if good
fittingValues[PeakInd, :] = optP3D
if RecordedPeakPos.size == 0: # first peak, no need to check minimum dist
RecordedPeakPos = np.array([[curX + optP3D[0]], [curY + optP3D[1]], [curZ + optP3D[2]]])
# print("recorded atom number 1, peak number 1")
else:
Dist = np.sqrt(np.sum(
(RecordedPeakPos - | np.array([[curX + optP3D[0]], [curY + optP3D[1]], [curZ + optP3D[2]]]) | numpy.array |
#!/usr/bin/env python
# -*- coding: utf-8 -*
'''Helper functions for geometry calculations.
'''
from __future__ import print_function, division
import numpy as np
def ray_triangle_intersection(ray_near, ray_dir, triangle):
"""
Möller–Trumbore intersection algorithm in pure python
Based on http://en.wikipedia.org/wiki/
M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm
The returned t's are the scaling for ray_dir do get the triangle
intersection point. The ray is starting from ray_near and goes to
infinity. Only positive t's are returned.
Parameters
----------
ray_near : array-like shape=(3,)
Starting point of the ray.
ray_dir : array-like shape=(3,)
Directional vector of the ray.
triangle : array-like shape=(3, 3)
Triangle for which the interaction point should be found.
Returns
-------
t : float or np.nan
Intersection is ray_near + t * ray_dir or np.nan for no
intersection
"""
(v1, v2, v3) = triangle
eps = 0.000001
edge1 = v2 - v1
edge2 = v3 - v1
pvec = np.cross(ray_dir, edge2)
det = edge1.dot(pvec)
if abs(det) < eps:
return np.nan
inv_det = 1. / det
tvec = ray_near - v1
u = tvec.dot(pvec) * inv_det
if u < 0. or u > 1.:
return np.nan
qvec = np.cross(tvec, edge1)
v = ray_dir.dot(qvec) * inv_det
if v < 0. or u + v > 1.:
return np.nan
t = edge2.dot(qvec) * inv_det
if t < eps:
return np.nan
return t
def get_intersections(convex_hull, v_pos, v_dir, eps=1e-4):
'''Function to get the intersection points of an infinite line and the
convex hull. The returned t's are the scaling factors for v_dir to
get the intersection points. If t < 0 the intersection is 'behind'
v_pos. This can be used decide whether a track is a starting track.
Parameters
----------
convex_hull : scipy.spatial.ConvexHull
defining the desired convex volume
v_pos : array-like shape=(3,)
A point of the line.
v_dir : array-like shape=(3,)
Directional vector of the line.
eps : float or None
Min distance between intersection points to be treated as
different points.
Returns
-------
t : array-like shape=(n_intersections)
Scaling factors for v_dir to get the intersection points.
Actual intersection points are v_pos + t * v_dir.
'''
if not isinstance(v_pos, np.ndarray):
v_pos = np.array(v_pos)
if not isinstance(v_dir, np.ndarray):
v_dir = np.array(v_dir)
t_s = [ray_triangle_intersection(v_pos,
v_dir,
convex_hull.points[simp])
for simp in convex_hull.simplices]
t_s = np.array(t_s)
t_s = t_s[np.isfinite(t_s)]
if len(t_s) != 2: # A line should have at max 2 intersection points
# with a convex hull
t_s_back = [ray_triangle_intersection(v_pos,
-v_dir,
convex_hull.points[simp])
for simp in convex_hull.simplices]
t_s_back = np.array(t_s_back)
t_s_back = t_s_back[np.isfinite(t_s_back)]
t_s = np.hstack((t_s, t_s_back * (-1.)))
if isinstance(eps, float): # Remove similar intersections
if eps >= 0.:
t_selected = []
intersections = []
for t_i in t_s:
intersection_i = v_pos + t_i * v_dir
distances = [np.linalg.norm(intersection_i - intersection_j)
for intersection_j in intersections]
if not (np.array(distances) < eps).any():
t_selected.append(t_i)
intersections.append(intersection_i)
t_s = np.array(t_selected)
return t_s
def point_is_inside(convex_hull,
v_pos,
default_v_dir=np.array([0., 0., 1.]),
eps=1e-4):
'''Function to determine if a point is inside the convex hull.
A default directional vector is asumend. If this track has an intersection
in front and behind v_pos, then must v_pos be inside the hull.
The rare case of a point inside the hull surface is treated as
being inside the hull.
Parameters
----------
convex_hull : scipy.spatial.ConvexHull
defining the desired convex volume
v_pos : array-like shape=(3,)
Position.
default_v_dir : array-like shape=(3,), optional (default=[0, 0, 1])
See get_intersections()
eps : float or None
See get_intersections()
Returns
-------
is_inside : boolean
True if the point is inside the detector.
False if the point is outside the detector
'''
t_s = get_intersections(convex_hull, v_pos, default_v_dir, eps)
return len(t_s) == 2 and (t_s >= 0).any() and (t_s <= 0).any()
def distance_to_convex_hull(convex_hull, v_pos):
'''Function to determine the closest distance of a point
to the convex hull.
Parameters
----------
convex_hull : scipy.spatial.ConvexHull
defining the desired convex volume
v_pos : array-like shape=(3,)
Position.
Returns
-------
distance: float
absolute value of closest distance from the point
to the convex hull
(maybe easier/better to have distance poositive
or negativ depending on wheter the point is inside
or outside. Alernatively check with point_is_inside)
'''
raise NotImplementedError
def get_closest_point_on_edge(edge_point1, edge_point2, point):
'''Function to determine the closest point
on an edge defined by the two points
edge_point1 and edge_point2
Parameters
----------
edge_point1 : array-like shape=(3,)
First edge point .
edge_point2 : array-like shape=(3,)
Second edge point .
point : array-like shape=(3,)
point of which to find the distance
to the edge
Returns
-------
distance: array-like shape=(3,)
closest point on the edge
'''
if edge_point1 == edge_point2:
return ValueError('Points do not define line.')
A = np.array(edge_point1)
B = np.array(edge_point2)
P = np.array(point)
vec_edge = B - A
vec_point = P - A
norm_edge = np.linalg.norm(vec_edge)
t_projection = np.dot(vec_edge, vec_point) / (norm_edge**2)
t_clipped = min(1, max(t_projection, 0))
closest_point = A + t_clipped*vec_edge
return closest_point
def get_distance_to_edge(edge_point1, edge_point2, point):
'''Function to determine the closest distance of a point
to an edge defined by the two points
edge_point1 and edge_point2
Parameters
----------
edge_point1 : array-like shape=(3,)
First edge point .
edge_point2 : array-like shape=(3,)
Second edge point .
point : array-like shape=(3,)
point of which to find the distance
to the edge
Returns
-------
distance: float
'''
closest_point = get_closest_point_on_edge(edge_point1,
edge_point2, point)
distance = np.linalg.norm(closest_point - point)
return distance
def get_edge_intersection(edge_point1, edge_point2, point):
'''Returns t:
edge_point1 + u*(edge_point2-edge_point1)
=
point + t * (0, 1, 0)
if u is within [0,1].
[Helper Function to find out if point
is inside the icecube 2D Polygon]
Parameters
----------
edge_point1 : array-like shape=(3,)
First edge point .
edge_point2 : array-like shape=(3,)
Second edge point .
point : array-like shape=(3,)
point of which to find the distance
to the edge
Returns
-------
t: float.
If intersection is within edge
othwise returns nan.
'''
if edge_point1 == edge_point2:
return ValueError('Points do not define line.')
A = np.array(edge_point1)
B = | np.array(edge_point2) | numpy.array |
# -*- coding: utf-8 -*-
#
from __future__ import division
import numpy
import sympy
from ..helpers import untangle
class WissmannBecker(object):
"""
<NAME> and <NAME>,
Partially Symmetric Cubature Formulas for Even Degrees of Exactness,
SIAM J. Numer. Anal., 23(3), 676–685, 10 pages,
<https://doi.org/10.1137/0723043>.
"""
def __init__(self, index, symbolic=False):
frac = sympy.Rational if symbolic else lambda x, y: x / y
self.name = "WB({})".format(index)
if index == "4-1":
self.degree = 4
data = [
(frac(8, 7), _z(0)),
(0.439560439560440, _z(0.966091783079296)),
(0.566072207007532, _m(0.851914653304601, 0.455603727836193)),
(0.642719001783677, _m(0.630912788976754, -0.731629951573135)),
]
elif index == "4-2":
self.degree = 4
data = [
(1.286412084888852, _z(-0.356822089773090)),
(0.491365692888926, _z(0.934172358962716)),
(0.761883709085613, _m(0.774596669241483, 0.390885162530071)),
(0.349227402025498, _m(0.774596669241483, -0.852765377881771)),
]
elif index == "6-1":
self.degree = 6
data = [
(0.455343245714174, _z(0.836405633697626)),
(0.827395973202966, _z(-0.357460165391307)),
(0.144000884599645, _m(0.888764014654765, 0.872101531193131)),
(0.668259104262665, _m(0.604857639464685, 0.305985162155427)),
(0.225474004890679, _m(0.955447506641064, -0.410270899466658)),
(0.320896396788441, _m(0.565459993438754, -0.872869311156879)),
]
elif index == "6-2":
self.degree = 6
data = [
(0.392750590964348, _z(0.869833375250059)),
(0.754762881242610, _z(-0.479406351612111)),
(0.206166050588279, _m(0.863742826346154, 0.802837516207657)),
(0.689992138489864, _m(0.518690521392582, 0.262143665508058)),
(0.260517488732317, _m(0.933972544972849, -0.363096583148066)),
(0.269567586086061, _m(0.608977536016356, -0.896608632762453)),
]
elif index == "8-1":
self.degree = 8
data = [
(0.055364705621440, _z(0)),
(0.404389368726076, _z(0.757629177660505)),
(0.533546604952635, _z(-0.236871842255702)),
(0.117054188786739, _z(-0.989717929044527)),
(0.125614417613747, _m(0.639091304900370, 0.950520955645667)),
(0.136544584733588, _m(0.937069076924990, 0.663882736885633)),
(0.483408479211257, _m(0.537083530541494, 0.304210681724104)),
(0.252528506429544, _m(0.887188506449625, -0.236496718536120)),
(0.361262323882172, _m(0.494698820670197, -0.698953476086564)),
(0.085464254086247, _m(0.897495818279768, -0.900390774211580)),
]
else:
assert index == "8-2"
self.degree = 8
data = [
(0.450276776305590, _z(0.659560131960342)),
(0.166570426777813, _z(-0.949142923043125)),
(0.098869459933431, _m(0.952509466071562, 0.765051819557684)),
(0.153696747140812, _m(0.532327454074206, 0.936975981088416)),
(0.396686976072903, _m(0.684736297951735, 0.333656717735747)),
(0.352014367945695, _m(0.233143240801405, -0.079583272377397)),
(0.189589054577798, _m(0.927683319306117, -0.272240080612534)),
(0.375101001147587, _m(0.453120687403749, -0.613735353398028)),
(0.125618791640072, _m(0.837503640422812, -0.888477650535971)),
]
self.points, self.weights = untangle(data)
return
def _z(a):
return | numpy.array([[0, a]]) | numpy.array |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import pandas as pd
from sklearn.decomposition import PCA
from scipy.interpolate import splev, splrep
import logging
log = logging.getLogger(__name__)
__all__ = ["do_pca", "time_interpolate", "back_proj_interp",
"back_proj_pca", "transformations_matrix", "interp_series"]
def do_pca(trajs,
pca=None,
coords=['x', 'y', 'z'],
suffix='_pca',
append=False, return_pca=False):
'''
Performs a principal component analysis on the input coordinates
suffix is only applied when appending
'''
if pca is None:
pca = PCA()
if not np.all(np.isfinite(trajs[coords])):
log.warning('''Droping non finite values before performing PCA''')
rotated_ = pd.DataFrame(pca.fit_transform(trajs[coords].dropna()))
rotated_.set_index(trajs[coords].dropna().index, inplace=True)
rotated = pd.DataFrame(columns=coords,
index=trajs.index)
rotated.loc[rotated_.index] = rotated_
rotated['t'] = trajs.t
if append:
for pca_coord in [c + suffix for c in coords]:
trajs[pca_coord] = rotated[pca_coord]
if return_pca:
return trajs, pca
else:
return trajs
if return_pca:
return rotated, pca
else:
return rotated
def _grouped_pca(trajs, pca, coords, group_kw):
return trajs.groupby(**group_kw).apply(
lambda df: pca.fit_transform(df[coords].dropna()),
coords)
def time_interpolate(trajs, sampling=1,
s=0, k=3,
coords=['x', 'y', 'z']):
"""Interpolates each segment of the trajectories along time using `scipy.interpolate.splrep`
Parameters
----------
sampling : int,
Must be higher or equal than 1, will add `sampling - 1` extra points
between two consecutive original data point. Sub-sampling is not supported.
coords : tuple of column names, default `('x', 'y', 'z')`
the coordinates to interpolate.
s : float
A smoothing condition. The amount of smoothness is determined by satisfying the conditions:
sum((w * (y - g))**2,axis=0) <= s where g(x) is the smoothed interpolation of (x,y). The
user can use s to control the tradeoff between closeness and smoothness of fit. Larger s
means more smoothing while smaller values of s indicate less smoothing. Recommended values
of s depend on the weights, w. If the weights represent the inverse of the standard-
deviation of y, then a good s value should be found in the range (m-sqrt(2*m),m+sqrt(2*m))
where m is the number of datapoints in x, y, and w. default : s=m-sqrt(2*m) if weights are
supplied. s = 0.0 (interpolating) if no weights are supplied.
k : int
The order of the spline fit. It is recommended to use cubic splines.
Even order splines should be avoided especially with small s values.
1 <= k <= 5
Returns
-------
interpolated : a :class:`pandas.Dataframe` instance
The interpolated values, with column names given by `coords` plus the computed speeds (first
order derivative) and accelarations (second order derivative) if `k` > 2
Notes
-----
- The returned DataFrame is NOT indexed like the input (in particular for `t_stamp`).
- It is also NOT casted to a Trajectories instance.
- The `s` and `k` arguments are passed to `scipy.interpolate.splrep`, see this function
documentation for more details
- If a segment is too short to be interpolated with the passed order `k`, the order will be
automatically diminished.
- Segments with only one point will be returned as is
"""
interpolated = trajs.groupby(level='label').apply(_segment_interpolate_,
sampling=sampling, s=s, k=k,
coords=coords)
interpolated = interpolated.swaplevel(
't_stamp', 'label').sortlevel(['t_stamp', 'label'])
return interpolated
def _segment_interpolate_(segment, sampling, s=0, k=3,
coords=['x', 'y', 'z']):
"""
"""
corrected_k = k
while segment.shape[0] <= corrected_k:
corrected_k -= 2
t_stamps_in = segment.index.get_level_values('t_stamp').values
t_stamp0, t_stamp1 = t_stamps_in[0], t_stamps_in[-1]
t0, t1 = segment.t.iloc[0], segment.t.iloc[-1]
t_stamps = np.arange(t_stamp0*sampling,
t_stamp1*sampling+1, dtype=np.int)
times = np.linspace(t0, t1, t_stamps.size)
t_stamps = pd.Index(t_stamps, dtype=np.int, name='t_stamp')
tmp_df = pd.DataFrame(index=t_stamps)
tmp_df['t'] = times
if segment.shape[0] < 2:
for coord in coords:
tmp_df[coord] = segment[coord].values
tmp_df['v_'+coord] = np.nan
tmp_df['a_'+coord] = np.nan
return tmp_df
#pass
tck = _spline_rep(segment, coords, s=s, k=corrected_k)
for coord in coords:
tmp_df[coord] = splev(times, tck[coord], der=0)
tmp_df['v_'+coord] = splev(times, tck[coord], der=1)
if k > 2:
if corrected_k > 2:
tmp_df['a_'+coord] = splev(times, tck[coord], der=2)
else:
tmp_df['a_'+coord] = times * np.nan
return tmp_df
def _spline_rep(df, coords=('x', 'y', 'z'), s=0, k=3):
time = df.t
tcks = {}
for coord in coords:
tcks[coord] = splrep(time, df[coord].values, s=s, k=k)
return pd.DataFrame.from_dict(tcks)
def back_proj_interp(interpolated, orig, sampling):
''' back_proj_interp(interpolated, trajs, 3).iloc[0].x - trajs.iloc[0].x = 0
'''
back_t_stamps = orig.index.get_level_values('t_stamp')
back_labels = orig.index.get_level_values('label')
back_index = pd.MultiIndex.from_arrays([back_t_stamps,
back_labels], names=['t_stamp', 'label'])
interp_index = pd.MultiIndex.from_arrays([back_t_stamps*sampling,
back_labels], names=['t_stamp', 'label'])
back_projected_ = interpolated.loc[interp_index]
back_index = pd.MultiIndex.from_arrays([back_t_stamps, back_labels],
names=['t_stamp', 'label'])
back_projected = back_projected_.set_index(back_index)
return back_projected
def back_proj_pca(rotated, pca, coords):
back_projected_ = pca.inverse_transform(rotated[coords])
back_t_stamps = rotated.index.get_level_values('t_stamp')
back_labels = rotated.index.get_level_values('label')
back_index = pd.MultiIndex.from_arrays([back_t_stamps, back_labels],
names=['t_stamp', 'label'])
back_projected = pd.DataFrame(back_projected_, index=back_index, columns=coords)
for col in set(rotated.columns) - set(back_projected.columns):
back_projected[col] = rotated[col]
return back_projected
def transformations_matrix(center, vec):
"""Build transformation matrix:
- translation : from (0, 0) to a point (center)
- rotation : following angle between (1, 0) and vec
Parameters
----------
center : list or np.ndarray
vec : list or np.ndarray
Returns
-------
The transformation matrix, np.ndarray.
"""
# Setup vectors
origin_vec = np.array([1, 0])
current_vec = vec / np.linalg.norm(vec)
# Find the rotation angle
a = origin_vec
b = current_vec
theta = np.arctan2(a[1], a[0]) + np.arctan2(b[1], b[0])
# Build rotation matrix
R = np.array([[np.cos(theta), -np.sin(theta), 0],
[np.sin(theta), np.cos(theta), 0],
[0, 0, 1]], dtype="float")
# Build translation matrix
T = np.array([[1, 0, -center[0]],
[0, 1, -center[1]],
[0, 0, 1]], dtype="float")
# Make transformations from R and T in one
A = | np.dot(T.T, R) | numpy.dot |
import os
import sys
TRASH = [
'bottle',
'cup',
'fork',
'knife',
'spoon'
'banana',
'apple',
'sandwich',
'orange',
'broccoli',
'carrot',
'hot dog',
'pizza',
'donut',
'cake'
]
YOLO_PATH = os.path.join(sys.path[0], 'yc')
IMAGE_PATH = os.path.join(sys.path[0], 'input.jpg')
DEFAULT_CONFIDENCE = 0.5
DEFAULT_THRESHOLD = 0.3
import numpy as np
import argparse
import time
import cv2
from model_def import load_model
from keras import backend as K
import tensorflow as tf
import numpy as np
from keras.preprocessing.image import ImageDataGenerator, img_to_array, array_to_img, load_img
from slidingBox import boxCoordinates
from PIL import Image,ImageDraw
img_width, img_height = 256, 256
if K.image_data_format() == 'channels_first':
input_shape = (3, img_width, img_height)
else:
input_shape = (img_width, img_height, 3)
model = load_model(input_shape, "4.h5")
graph = tf.get_default_graph()
labelsPath = os.path.join(YOLO_PATH, 'coco.names')
LABELS = open(labelsPath).read().strip().splitlines()
# random list of colors for class labels
np.random.seed(42)
COLORS = np.random.randint(0, 255, size=(len(LABELS), 3), dtype='uint8')
weightsPath = os.path.join(YOLO_PATH, 'yolov3.weights')
configPath = os.path.join(YOLO_PATH, 'yolov3.cfg')
# load YOLO data
net = cv2.dnn.readNetFromDarknet(configPath, weightsPath)
def process_image(image):
(H, W) = image.shape[:2]
# determine only the *output* layer names that we need from YOLO
ln = net.getLayerNames()
ln = [ln[i[0] - 1] for i in net.getUnconnectedOutLayers()]
# construct blob from image
blob = cv2.dnn.blobFromImage(image, 1 / 255.0, (416, 416), swapRB=True, crop=False)
net.setInput(blob)
start = time.time()
layerOutputs = net.forward(ln)
end = time.time()
# show timing information on YOLO
print('took {:.6f} seconds'.format(end - start))
boxes = []
confidences = []
classIDs = []
for output in layerOutputs:
for detection in output:
# extract the class ID and confidence (i.e., probability) of
# the current object detection
scores = detection[5:]
classID = | np.argmax(scores) | numpy.argmax |
import numpy as np
from scipy.integrate import odeint
from ..csc.utils_velocity import sol_u, sol_s
from ...dynamo_logger import main_debug, main_info
class LinearODE:
def __init__(self, n_species, x0=None):
"""A general class for linear odes"""
self.n_species = n_species
# solution
self.t = None
self.x = None
self.x0 = np.zeros(self.n_species) if x0 is None else x0
self.K = None
self.p = None
# methods
self.methods = ["numerical", "matrix"]
self.default_method = "matrix"
def ode_func(self, x, t):
"""Implement your own ODE functions here such that dx=f(x, t)"""
dx = np.zeros(len(x))
return dx
def integrate(self, t, x0=None, method=None):
method = self.default_method if method is None else method
if method == "matrix":
sol = self.integrate_matrix(t, x0)
elif method == "numerical":
sol = self.integrate_numerical(t, x0)
else:
raise NotImplementedError("The LinearODE integrate operation currently not supports method: %s." % (method))
self.x = sol
self.t = t
return sol
def integrate_numerical(self, t, x0=None):
if x0 is None:
x0 = self.x0
else:
self.x0 = x0
sol = odeint(self.ode_func, x0, t)
return sol
def reset(self):
# reset solutions
self.t = None
self.x = None
self.K = None
self.p = None
def computeKnp(self):
"""Implement your own vectorized ODE functions here such that dx = Kx + p"""
K = np.zeros((self.n_species, self.n_species))
p = np.zeros(self.n_species)
return K, p
def integrate_matrix(self, t, x0=None):
# t0 = t[0]
t0 = 0
if x0 is None:
x0 = self.x0
else:
self.x0 = x0
if self.K is None or self.p is None:
K, p = self.computeKnp()
self.K = K
self.p = p
else:
K = self.K
p = self.p
x_ss = np.linalg.solve(K, p)
# x_ss = linalg.inv(K).dot(p)
y0 = x0 + x_ss
D, U = np.linalg.eig(K)
V = np.linalg.inv(U)
D, U, V = map(np.real, (D, U, V))
expD = np.exp(D)
x = np.zeros((len(t), self.n_species))
# x[0] = x0
for i in range(len(t)):
x[i] = U.dot(np.diag(expD ** (t[i] - t0))).dot(V).dot(y0) - x_ss
return x
class MixtureModels:
def __init__(self, models, param_distributor):
"""A general class for linear odes"""
self.n_models = len(models)
self.models = models
self.n_species = np.array([mdl.n_species for mdl in self.models])
self.distributor = param_distributor
# solution
self.t = None
self.x = None
# methods
self.methods = ["numerical", "matrix"]
self.default_method = "matrix"
def integrate(self, t, x0=None, method=None):
self.x = np.zeros((len(t), np.sum(self.n_species)))
for i, mdl in enumerate(self.models):
x0_ = None if x0 is None else x0[self.get_model_species(i)]
method_ = method if method is None or type(method) is str else method[i]
mdl.integrate(t, x0_, method_)
self.x[:, self.get_model_species(i)] = mdl.x
self.t = np.array(self.models[0].t, copy=True)
def get_model_species(self, model_index):
id = np.hstack((0, np.cumsum(self.n_species)))
idx = np.arange(id[-1] + 1)
return idx[id[model_index] : id[model_index + 1]]
def reset(self):
# reset solutions
self.t = None
self.x = None
for mdl in self.models:
mdl.reset()
def param_mixer(self, *params):
return params
def set_params(self, *params):
params = self.param_mixer(*params)
for i, mdl in enumerate(self.models):
idx = self.distributor[i]
p = np.zeros(len(idx))
for j in range(len(idx)):
p[j] = params[idx[j]]
mdl.set_params(*p)
self.reset()
class LambdaModels_NoSwitching(MixtureModels):
def __init__(self, model1, model2):
"""
parameter order: alpha, lambda, (beta), gamma
distributor order: alpha_1, alpha_2, (beta), gamma
"""
models = [model1, model2]
if type(model1) in nosplicing_models and type(model2) in nosplicing_models:
param_distributor = [[0, 2], [1, 2]]
else:
dist1 = [0, 3] if model1 in nosplicing_models else [0, 2, 3]
dist2 = [1, 3] if model2 in nosplicing_models else [1, 2, 3]
param_distributor = [dist1, dist2]
super().__init__(models, param_distributor)
def param_mixer(self, *params):
lam = params[1]
alp_1 = params[0] * lam
alp_2 = params[0] * (1 - lam)
p = np.hstack((alp_1, alp_2, params[2:]))
return p
class Moments(LinearODE):
def __init__(
self,
a=None,
b=None,
alpha_a=None,
alpha_i=None,
beta=None,
gamma=None,
x0=None,
):
"""This class simulates the dynamics of first and second moments of
a transcription-splicing system with promoter switching."""
# species
self.ua = 0
self.ui = 1
self.xa = 2
self.xi = 3
self.uu = 4
self.xx = 5
self.ux = 6
n_species = 7
# solution
super().__init__(n_species, x0=x0)
# parameters
if not (a is None or b is None or alpha_a is None or alpha_i is None or beta is None or gamma is None):
self.set_params(a, b, alpha_a, alpha_i, beta, gamma)
def ode_func(self, x, t):
dx = np.zeros(len(x))
# parameters
a = self.a
b = self.b
aa = self.aa
ai = self.ai
be = self.be
ga = self.ga
# first moments
dx[self.ua] = aa - be * x[self.ua] + a * (x[self.ui] - x[self.ua])
dx[self.ui] = ai - be * x[self.ui] - b * (x[self.ui] - x[self.ua])
dx[self.xa] = be * x[self.ua] - ga * x[self.xa] + a * (x[self.xi] - x[self.xa])
dx[self.xi] = be * x[self.ui] - ga * x[self.xi] - b * (x[self.xi] - x[self.xa])
# second moments
dx[self.uu] = 2 * self.fbar(aa * x[self.ua], ai * x[self.ui]) - 2 * be * x[self.uu]
dx[self.xx] = 2 * be * x[self.ux] - 2 * ga * x[self.xx]
dx[self.ux] = self.fbar(aa * x[self.xa], ai * x[self.xi]) + be * x[self.uu] - (be + ga) * x[self.ux]
return dx
def fbar(self, x_a, x_i):
return self.b / (self.a + self.b) * x_a + self.a / (self.a + self.b) * x_i
def set_params(self, a, b, alpha_a, alpha_i, beta, gamma):
self.a = a
self.b = b
self.aa = alpha_a
self.ai = alpha_i
self.be = beta
self.ga = gamma
# reset solutions
super().reset()
def get_all_central_moments(self):
ret = np.zeros((4, len(self.t)))
ret[0] = self.get_nu()
ret[1] = self.get_nx()
ret[2] = self.get_var_nu()
ret[3] = self.get_var_nx()
return ret
def get_nosplice_central_moments(self):
ret = np.zeros((2, len(self.t)))
ret[0] = self.get_n_labeled()
ret[1] = self.get_var_labeled()
return ret
def get_nu(self):
return self.fbar(self.x[:, self.ua], self.x[:, self.ui])
def get_nx(self):
return self.fbar(self.x[:, self.xa], self.x[:, self.xi])
def get_n_labeled(self):
return self.get_nu() + self.get_nx()
def get_var_nu(self):
c = self.get_nu()
return self.x[:, self.uu] + c - c ** 2
def get_var_nx(self):
c = self.get_nx()
return self.x[:, self.xx] + c - c ** 2
def get_cov_ux(self):
cu = self.get_nu()
cx = self.get_nx()
return self.x[:, self.ux] - cu * cx
def get_var_labeled(self):
return self.get_var_nu() + self.get_var_nx() + 2 * self.get_cov_ux()
def computeKnp(self):
# parameters
a = self.a
b = self.b
aa = self.aa
ai = self.ai
be = self.be
ga = self.ga
K = np.zeros((self.n_species, self.n_species))
# E1
K[self.ua, self.ua] = -be - a
K[self.ua, self.ui] = a
K[self.ui, self.ua] = b
K[self.ui, self.ui] = -be - b
# E2
K[self.xa, self.xa] = -ga - a
K[self.xa, self.xi] = a
K[self.xi, self.xa] = b
K[self.xi, self.xi] = -ga - b
# E3
K[self.uu, self.uu] = -2 * be
K[self.xx, self.xx] = -2 * ga
# E4
K[self.ux, self.ux] = -be - ga
# F21
K[self.xa, self.ua] = be
K[self.xi, self.ui] = be
# F31
K[self.uu, self.ua] = 2 * aa * b / (a + b)
K[self.uu, self.ui] = 2 * ai * a / (a + b)
# F34
K[self.xx, self.ux] = 2 * be
# F42
K[self.ux, self.xa] = aa * b / (a + b)
K[self.ux, self.xi] = ai * a / (a + b)
# F43
K[self.ux, self.uu] = be
p = | np.zeros(self.n_species) | numpy.zeros |
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import numpy as np
from common_layers import *
from training_param_add import * # import numpy as np가 되어있음.
from gradient import numerical_gradient
from collections import OrderedDict
class TwoLayerNet:
def __init__(self):
self.check = None
def twolayernet(self, wi, weight_init_std = 0.9):
# 重みの初期化
voc_length = wi.inform['voc_length']
voc_length_diff = wi.inform['voc_length_diff']
input_size = voc_length
output_size = voc_length
hidden_size = 7
if self.check is None:
self.params = {}
self.params['W1'] = weight_init_std * np.random.randn(input_size, hidden_size)
self.params['b1'] = np.zeros(hidden_size)
self.params['W2'] = weight_init_std * np.random.randn(hidden_size, output_size)
self.params['b2'] = np.zeros(output_size)
# レイヤの生成
self.layers = OrderedDict()
self.layers['Affine1'] = Affine(self.params['W1'], self.params['b1'])
self.layers['Relu1'] = Relu()
self.layers['Affine2'] = Affine(self.params['W2'], self.params['b2'])
self.check = 1
else:
print("checking new words ~~ing~~ ")
print("추가된 단어 수 " , voc_length_diff) #단어가 몇개가 추가되엇는지 내가 확인하기 위함.
if voc_length_diff == 0:
print("network is ready to use")
else:
print("adding words in vocabulary ~~ing~~ ")
add_param = new_word_in_voc(self.params['W1'], self.params['W2'],self.params['b2'],voc_length_diff)
add_param.make_new_params()
for key in('W1','W2','b2'):
self.params[key] = add_param.params[key]
print("ready to use")
self.layers = OrderedDict()
self.layers['Affine1'] = Affine(self.params['W1'], self.params['b1'])
self.layers['Relu1'] = Relu()
self.layers['Affine2'] = Affine(self.params['W2'], self.params['b2'])
self.lastLayer = SoftmaxWithLoss()
def predict(self, x):
for layer in self.layers.values():
x = layer.forward(x)
return x
# x:入力データ, t:教師データ
def loss(self, x, t):
y = self.predict(x)
return self.lastLayer.forward(y, t)
def accuracy(self, x, t):
y = self.predict(x)
y = np.argmax(y, axis=1)
if t.ndim != 1 : t = | np.argmax(t, axis=1) | numpy.argmax |
"""
Copyright 2020 The OneFlow 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.
"""
import unittest
from collections import OrderedDict
import numpy as np
import math
import oneflow.experimental as flow
from test_util import GenArgList
def _nd_tuple_to_dhw(nd_tuple, dim, prefix=1, dhw_offset=0):
assert dim <= 3
assert dim == len(nd_tuple) - dhw_offset
nd_tuple = list(nd_tuple)
dhw_tuple = nd_tuple[:dhw_offset]
dhw_tuple.extend([prefix for _ in range(3 - dim)])
dhw_tuple.extend(nd_tuple[dhw_offset:])
return tuple(dhw_tuple)
def _dhw_tuple_to_nd(dhw_tuple, dim, prefix=1, dhw_offset=0):
assert dim <= 3
assert 3 == len(dhw_tuple) - dhw_offset
dhw_tuple = list(dhw_tuple)
nd_tuple = dhw_tuple[:dhw_offset]
nd_offset = dhw_offset + 3 - dim
for i in dhw_tuple[dhw_offset:nd_offset]:
assert prefix == i
nd_tuple.extend(dhw_tuple[nd_offset:])
return tuple(nd_tuple)
class MaxPoolNumpy:
def __init__(self, dim=2, kernel_size=(2, 2), stride=(2, 2), padding=(0, 0)):
self.dim = dim
self.stride = _nd_tuple_to_dhw(stride, dim)
self.padding = _nd_tuple_to_dhw(padding, dim, prefix=0)
self.kernel_size = _nd_tuple_to_dhw(kernel_size, dim)
self.w_depth = self.kernel_size[0]
self.w_height = self.kernel_size[1]
self.w_width = self.kernel_size[2]
self.min_val = np.finfo(np.float64).min
def __call__(self, x):
self.x_shape = x.shape
x_shape_5d = _nd_tuple_to_dhw(self.x_shape, self.dim, prefix=1, dhw_offset=2)
x = x.reshape(x_shape_5d)
self.in_batch = np.shape(x)[0]
self.in_channel = np.shape(x)[1]
self.in_depth = np.shape(x)[2]
self.in_height = np.shape(x)[3]
self.in_width = np.shape(x)[4]
pad_x = np.pad(
x,
(
(0, 0),
(0, 0),
(self.padding[0], self.padding[0]),
(self.padding[1], self.padding[1]),
(self.padding[2], self.padding[2]),
),
"constant",
constant_values=(self.min_val, self.min_val),
)
self.pad_x = pad_x
self.pad_shape = pad_x.shape
self.out_depth = int((self.in_depth - self.w_depth) / self.stride[0]) + 1
self.out_height = int((self.in_height - self.w_height) / self.stride[1]) + 1
self.out_width = int((self.in_width - self.w_width) / self.stride[2]) + 1
self.pad_out_depth = np.uint16(
math.ceil((self.pad_shape[2] - self.w_depth + 1) / self.stride[0])
)
self.pad_out_height = np.uint16(
math.ceil((self.pad_shape[3] - self.w_height + 1) / self.stride[1])
)
self.pad_out_width = np.uint16(
math.ceil((self.pad_shape[4] - self.w_width + 1) / self.stride[2])
)
out = np.zeros(
(
self.in_batch,
self.in_channel,
self.pad_out_depth,
self.pad_out_height,
self.pad_out_width,
)
)
self.arg_max = np.zeros_like(out, dtype=np.int32)
for n in range(self.in_batch):
for c in range(self.in_channel):
for i in range(self.pad_out_depth):
for j in range(self.pad_out_height):
for k in range(self.pad_out_width):
start_i = i * self.stride[0]
start_j = j * self.stride[1]
start_k = k * self.stride[2]
end_i = start_i + self.w_depth
end_j = start_j + self.w_height
end_k = start_k + self.w_width
out[n, c, i, j, k] = np.max(
pad_x[n, c, start_i:end_i, start_j:end_j, start_k:end_k]
)
self.arg_max[n, c, i, j, k] = np.argmax(
pad_x[n, c, start_i:end_i, start_j:end_j, start_k:end_k]
)
self.out_shape_5d = out.shape
out_shape = _dhw_tuple_to_nd(out.shape, self.dim, dhw_offset=2)
out = out.reshape(out_shape)
return out
def backward(self, d_loss):
d_loss = d_loss.reshape(self.out_shape_5d)
dx = np.zeros_like(self.pad_x)
for n in range(self.in_batch):
for c in range(self.in_channel):
for i in range(self.pad_out_depth):
for j in range(self.pad_out_height):
for k in range(self.pad_out_width):
start_i = i * self.stride[0]
start_j = j * self.stride[1]
start_k = k * self.stride[2]
end_i = start_i + self.w_depth
end_j = start_j + self.w_height
end_k = start_k + self.w_width
index = np.unravel_index(
self.arg_max[n, c, i, j, k], self.kernel_size
)
dx[n, c, start_i:end_i, start_j:end_j, start_k:end_k][
index
] += d_loss[n, c, i, j, k]
dx = dx[
:,
:,
self.padding[0] : self.pad_shape[2] - self.padding[0],
self.padding[1] : self.pad_shape[3] - self.padding[1],
self.padding[2] : self.pad_shape[4] - self.padding[2],
]
dx = dx.reshape(self.x_shape)
return dx
def _test_maxpool1d_impl(test_case, device):
input_arr = np.array(
[
[
[-0.89042996, 2.33971243, -0.86660827, 0.80398747],
[-1.46769364, -0.78125064, 1.50086563, -0.76278226],
[1.31984534, 0.20741192, -0.86507054, -0.40776015],
[-0.89910823, 0.44932938, 1.49148118, -0.22036761],
],
[
[-0.5452334, -0.10255169, -1.42035108, 0.73922913],
[-0.03192764, 0.69341935, 0.96263152, -1.52070843],
[0.02058239, 1.504032, 1.84423001, -0.0130596],
[2.20517719, 0.38449598, 0.85677771, 0.60425179],
],
[
[-1.64366213, 0.51370298, -0.21754866, -0.05085382],
[1.17065374, 1.13857674, -1.13070507, 0.44353707],
[-1.30783846, -0.48031445, 0.41807536, -2.13778887],
[0.08259005, 0.5798125, 0.03024696, 1.96100924],
],
]
)
kernel_size, stride, padding = (3,), (1,), (1,)
output = np.array(
[
[
[2.33971243, 2.33971243, 2.33971243, 0.80398747],
[-0.78125064, 1.50086563, 1.50086563, 1.50086563],
[1.31984534, 1.31984534, 0.20741192, -0.40776015],
[0.44932938, 1.49148118, 1.49148118, 1.49148118],
],
[
[-0.10255169, -0.10255169, 0.73922913, 0.73922913],
[0.69341935, 0.96263152, 0.96263152, 0.96263152],
[1.504032, 1.84423001, 1.84423001, 1.84423001],
[2.20517719, 2.20517719, 0.85677771, 0.85677771],
],
[
[0.51370298, 0.51370298, 0.51370298, -0.05085382],
[1.17065374, 1.17065374, 1.13857674, 0.44353707],
[-0.48031445, 0.41807536, 0.41807536, 0.41807536],
[0.5798125, 0.5798125, 1.96100924, 1.96100924],
],
]
)
output_indice = np.array(
[
[[1, 1, 1, 3], [1, 2, 2, 2], [0, 0, 1, 3], [1, 2, 2, 2]],
[[1, 1, 3, 3], [1, 2, 2, 2], [1, 2, 2, 2], [0, 0, 2, 2]],
[[1, 1, 1, 3], [0, 0, 1, 3], [1, 2, 2, 2], [1, 1, 3, 3]],
]
)
grad = np.array(
[
[
[0.0, 3.0, 0.0, 1.0],
[0.0, 1.0, 3.0, 0.0],
[2.0, 1.0, 0.0, 1.0],
[0.0, 1.0, 3.0, 0.0],
],
[
[0.0, 2.0, 0.0, 2.0],
[0.0, 1.0, 3.0, 0.0],
[0.0, 1.0, 3.0, 0.0],
[2.0, 0.0, 2.0, 0.0],
],
[
[0.0, 3.0, 0.0, 1.0],
[2.0, 1.0, 0.0, 1.0],
[0.0, 1.0, 3.0, 0.0],
[0.0, 2.0, 0.0, 2.0],
],
]
)
m = flow.nn.MaxPool1d(
kernel_size=kernel_size, stride=stride, padding=padding, return_indices=True
)
m.to(flow.device(device))
x = flow.Tensor(input_arr, device=flow.device(device), requires_grad=True)
of_output, of_indice = m(x)
y = of_output.sum()
y.backward()
test_case.assertTrue(np.allclose(x.grad.numpy(), grad, 1e-4, 1e-4))
test_case.assertTrue(np.allclose(of_indice.numpy(), output_indice, 1e-4, 1e-4))
test_case.assertTrue(np.allclose(of_output.numpy(), output, 1e-4, 1e-4))
def _test_maxpool1d_zero_padding(test_case, device):
arr = np.arange(1000).reshape(4, 5, 50).astype(np.float)
input = flow.tensor(arr, dtype=flow.float32, device=flow.device(device))
m1 = flow.nn.MaxPool1d(kernel_size=3, stride=3, padding=0)
of_out = m1(input)
m2 = MaxPoolNumpy(2, kernel_size=(3, 1), stride=(3, 1), padding=(0, 0))
np_out = m2(arr.reshape(4, 5, 50, 1))
np_out = np.squeeze(np_out, axis=3)
test_case.assertTrue(np.allclose(np_out, of_out.numpy(), 1e-4, 1e-4))
def _test_maxpool2d(test_case, device):
dim = 2
input_arr = np.random.randn(2, 3, 4, 5)
kernel_size, stride, padding = (3, 3), (1, 1), (1, 1)
m_numpy = MaxPoolNumpy(dim, kernel_size, stride, padding)
numpy_output = m_numpy(input_arr)
m = flow.nn.MaxPool2d(
kernel_size=kernel_size, stride=stride, padding=padding, return_indices=True
)
m.to(flow.device(device))
x = flow.Tensor(input_arr, device=flow.device(device))
output, indice = m(x)
test_case.assertTrue(indice.shape == x.shape)
test_case.assertTrue(np.allclose(numpy_output, output.numpy(), 1e-4, 1e-4))
def _test_maxpool2d_ceil_mode(test_case, device):
dim = 2
input_arr = np.array(
[
[
[
[-0.89042996, 2.33971243, -0.86660827, 0.80398747],
[-1.46769364, -0.78125064, 1.50086563, -0.76278226],
[1.31984534, 0.20741192, -0.86507054, -0.40776015],
[-0.89910823, 0.44932938, 1.49148118, -0.22036761],
],
[
[-0.5452334, -0.10255169, -1.42035108, 0.73922913],
[-0.03192764, 0.69341935, 0.96263152, -1.52070843],
[0.02058239, 1.504032, 1.84423001, -0.0130596],
[2.20517719, 0.38449598, 0.85677771, 0.60425179],
],
[
[-1.64366213, 0.51370298, -0.21754866, -0.05085382],
[1.17065374, 1.13857674, -1.13070507, 0.44353707],
[-1.30783846, -0.48031445, 0.41807536, -2.13778887],
[0.08259005, 0.5798125, 0.03024696, 1.96100924],
],
],
[
[
[0.45173843, -0.34680027, -0.99754943, 0.18539502],
[-0.68451047, -0.03217399, 0.44705642, -0.39016231],
[-0.18062337, 1.82099303, -0.19113869, 0.85298683],
[0.14080452, 0.15306701, -1.02466827, -0.34480665],
],
[
[-0.21048489, 0.20933038, -0.09206508, -1.80402519],
[-0.52028985, 0.01140166, -1.13452858, 0.96648332],
[0.26454393, 0.48343972, -1.84055509, -0.01256443],
[0.31024029, 0.11983007, 0.98806488, 0.93557438],
],
[
[0.39152445, 0.672159, 0.71289289, -0.68072016],
[0.33711062, -1.78106242, 0.34545201, -1.62029359],
[0.47343899, -2.3433269, -0.44517497, 0.09004267],
[0.26310742, -1.53121271, 0.65028836, 1.3669488],
],
],
]
)
ceil_mode_out = np.array(
[
[
[
[2.33971243, 2.33971243, 0.80398747],
[1.31984534, 1.50086563, -0.22036761],
[0.44932938, 1.49148118, -0.22036761],
],
[
[0.69341935, 0.96263152, 0.73922913],
[2.20517719, 1.84423001, 0.60425179],
[2.20517719, 0.85677771, 0.60425179],
],
[
[1.17065374, 1.13857674, 0.44353707],
[1.17065374, 1.96100924, 1.96100924],
[0.5798125, 1.96100924, 1.96100924],
],
],
[
[
[0.45173843, 0.44705642, 0.18539502],
[1.82099303, 1.82099303, 0.85298683],
[0.15306701, 0.15306701, -0.34480665],
],
[
[0.20933038, 0.96648332, 0.96648332],
[0.48343972, 0.98806488, 0.96648332],
[0.31024029, 0.98806488, 0.93557438],
],
[
[0.672159, 0.71289289, -0.68072016],
[0.47343899, 1.3669488, 1.3669488],
[0.26310742, 1.3669488, 1.3669488],
],
],
]
)
kernel_size, stride, padding = (3, 3), (2, 2), (1, 1)
m_numpy = MaxPoolNumpy(dim, kernel_size, stride, padding)
numpy_output = m_numpy(input_arr)
m1 = flow.nn.MaxPool2d(
kernel_size=kernel_size, stride=stride, padding=padding, ceil_mode=False
)
m2 = flow.nn.MaxPool2d(
kernel_size=kernel_size, stride=stride, padding=padding, ceil_mode=True
)
m1.to(flow.device(device))
m2.to(flow.device(device))
x = flow.Tensor(input_arr, device=flow.device(device))
output1 = m1(x)
output2 = m2(x)
test_case.assertTrue(np.allclose(numpy_output, output1.numpy(), 1e-4, 1e-4))
test_case.assertTrue(np.allclose(ceil_mode_out, output2.numpy(), 1e-4, 1e-4))
def _test_maxpool2d_special_kernel_size(test_case, device):
dim = 2
input_arr = np.random.randn(1, 1, 6, 6)
kernel_size, stride, padding = (1, 1), (5, 5), (0, 0)
m_numpy = MaxPoolNumpy(dim, kernel_size, stride, padding)
numpy_output = m_numpy(input_arr)
m = flow.nn.MaxPool2d(kernel_size=kernel_size, stride=stride, padding=padding)
m.to(flow.device(device))
x = flow.Tensor(input_arr, device=flow.device(device))
output = m(x)
test_case.assertTrue(np.allclose(numpy_output, output.numpy(), 1e-4, 1e-4))
def _test_maxpool2d_diff_kernel_stride(test_case, device):
dim = 2
input_arr = np.random.randn(9, 7, 32, 20)
kernel_size, stride, padding = (2, 4), (4, 5), (1, 2)
m_numpy = MaxPoolNumpy(dim, kernel_size, stride, padding)
numpy_output = m_numpy(input_arr)
m = flow.nn.MaxPool2d(kernel_size=kernel_size, stride=stride, padding=padding)
m.to(flow.device(device))
x = flow.Tensor(input_arr, device=flow.device(device))
output = m(x)
test_case.assertTrue(np.allclose(numpy_output, output.numpy(), 1e-4, 1e-4))
def _test_maxpool2d_negative_input(test_case, device):
dim = 2
input_arr = -1.23456 * np.ones((1, 1, 1, 1), dtype=np.float32)
kernel_size, stride, padding = (5, 5), (5, 5), (2, 2)
m_numpy = MaxPoolNumpy(dim, kernel_size, stride, padding)
numpy_output = m_numpy(input_arr)
m = flow.nn.MaxPool2d(kernel_size=kernel_size, stride=stride, padding=padding)
m.to(flow.device(device))
x = flow.Tensor(input_arr, device=flow.device(device))
output = m(x)
test_case.assertTrue(np.allclose(numpy_output, output.numpy(), 1e-4, 1e-4))
def _test_maxpool2d_backward(test_case, device):
dim = 2
input_arr = np.random.randn(6, 4, 7, 9)
kernel_size, stride, padding = (4, 4), (1, 1), (1, 2)
m_numpy = MaxPoolNumpy(dim, kernel_size, stride, padding)
numpy_output = m_numpy(input_arr)
m = flow.nn.MaxPool2d(kernel_size=kernel_size, stride=stride, padding=padding)
m.to(flow.device(device))
x = flow.Tensor(input_arr, requires_grad=True, device=flow.device(device))
output = m(x)
output = output.sum()
output.backward()
doutput = | np.ones_like(numpy_output, dtype=np.float64) | numpy.ones_like |
import itertools
from collections import defaultdict
import numpy as np
from .get_atom_properties import getAtomProperties
class Atom:
def __init__(self, element, label, aindex, mass, x, y, z, intensity):
"""
原子类
:param element: 元素符号
:param label: 晶体文件里的原子标签,如C001
:param aindex: 原子序数,用于电子加权计算
:param mass: 原子质量,用于质量加权计算
:param x: 分数坐标
:param y: 分数坐标
:param z: 分数坐标
:param intensity: RES中的强度
"""
self.element = element
self.label = label
self.aindex = aindex
self.mass = mass
self.x = x
self.y = y
self.z = z
self.intensity = intensity
class AtomGroup:
class CellParameter:
def __init__(self):
"""
rotation_matrix: 用于换算分数坐标和绝对坐标的旋转矩阵
"""
self.a = 1
self.b = 1
self.c = 1
self.alpha = 90
self.beta = 90
self.gamma = 90
self.rotation_matrix = None
def coordinate_transform(self, x, y, z):
"""计算坐标转换结果"""
if self.rotation_matrix is None:
return x, y, z
new_xyz = np.matmul(self.rotation_matrix, np.array([x, y, z]).T)
new_xyz = new_xyz.T
return np.round(new_xyz[0], 2), np.round(new_xyz[1], 2), np.round(new_xyz[2], 2)
def set_parameter(self, a, b, c, alpha, beta, gamma):
"""设置晶胞参数"""
self.a = a
self.b = b
self.c = c
self.alpha = np.deg2rad(alpha)
self.beta = np.deg2rad(beta)
self.gamma = | np.deg2rad(gamma) | numpy.deg2rad |
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: lab3_Shadings
Description :
Author : zdf's desktop
date: 2019/2/24
-------------------------------------------------
Change Activity:
2019/2/24:23:27
-------------------------------------------------
"""
import numpy as np
import random
from pyglet.gl import *
class Edge:
def __init__(self):
self.ymax = 0
self.ymin = 0
self.xmin = 0
self.slope = 0
class ScreenVertex:
def __init__(self, x, y):
self.x = x
self.y = y
class Pixel:
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
class Vertex:
def __init__(self, cord, normal=None):
if normal is None:
normal = []
self.cord = cord
self.normal = normal
class Polygon:
def __init__(self):
self.vertex_num = 0
self.vertex_list = []
self.main_color = (255, 255, 255)
self.edge_table = []
self.pixel_list = [] # all pixels inside this polygon(including vertex)
self.normal = np.zeros(3, dtype=np.float64) # the normal vector of polygon
def print(self):
"""
Print attributes of polygon
:return: None
"""
print("Vertex Number:", self.vertex_num)
for i, v in enumerate(self.vertex_list):
print("Vertex", i, ":", v)
print(self.main_color)
print(self.edge_table)
print(self.pixel_list)
print(self.normal)
class Model:
"""
Model contains data of vertices and polygons
"""
def __init__(self):
self.raw_vertex = []
self.raw_polygon = []
self.final_vertex = [] # ScreenVertex
self.final_polygon = [] # viewing polygon under current observer after backface-culling
# self.visible_vertex = [] # viewing vertices under current observer after backface-culling
def load_model(self, path):
"""
load raw data from file to a model
:param path: the data path
:return: None
"""
with open(path) as f:
read_data = f.read()
data = read_data.replace("\t", " ").replace("data", "").split("\n")
try:
data.remove("")
except Exception:
pass
temp = data[0].split(" ")
temp = [x for x in temp if x] # filter the duplicated empty element.
point_number = temp[0]
data = data[1:] # trim the first data
for i, val in enumerate(data):
if i < int(point_number):
self.raw_vertex.append(val.split(" "))
else:
self.raw_polygon.append(val.split(" "))
for i, v in enumerate(self.raw_vertex):
temp = [float(x) for x in v if x]
temp.append(1)
v = Vertex(temp, [])
self.raw_vertex[i] = v
for i, p in enumerate(self.raw_polygon):
temp = [int(x) for x in p if x]
self.raw_polygon[i] = temp
def find_pologon_normal(self):
for p in self.final_polygon:
p.normal = np.zeros(3, dtype=np.float64)
v1 = self.raw_vertex[p.vertex_list[0] - 1].cord
v2 = self.raw_vertex[p.vertex_list[1] - 1].cord
v3 = self.raw_vertex[p.vertex_list[2] - 1].cord
print(v1, v2, v3)
v1 = v1[:-1]
v2 = v2[:-1]
v3 = v3[:-1]
e1 = np.subtract(v2, v1)
e2 = np.subtract(v3, v2)
p.normal = np.cross(e1, e2)
p.normal /= np.linalg.norm(p.normal)
print("p.normal = ", p.normal)
def zoom_model(self, amplifier, shift):
for v in self.final_vertex:
v.x = v.x * amplifier + shift
v.y = v.y * amplifier + shift
def create_edge_table(self):
"""
Creating an edge_table for a certain model
:return: None
"""
for p in self.final_polygon:
num = p.vertex_num # vertices number of this polygon
for i in range(0, num):
'''
Warning:
to Visit proper vertex, you need to
add -1 on index since the vertex are labeled start by 1, not 0.
'''
v1 = self.final_vertex[p.vertex_list[i]]
if i == num - 1:
v2 = self.final_vertex[p.vertex_list[0]]
else:
v2 = self.final_vertex[p.vertex_list[i + 1]]
if int(v1.y) == int(v2.y):
# skip the horizontal edge
continue
e = Edge()
e.ymax = int(max(v1.y, v2.y)) # compare Y value of V1 and V2
e.ymin = int(min(v1.y, v2.y))
e.xmin = v1.x if v1.y < v2.y else v2.x # store the x value of the bottom vertex
e.slope = (v1.x - v2.x) / (v1.y - v2.y) # store the edge slope for coherence
e.ymax -= 1 # dealing with vertex-scanline intersection(shorten edges)
p.edge_table.append(e)
def ymin_cmp(edge):
return edge.ymin
p.edge_table.sort(key=ymin_cmp) # sort edge_table by Y value
print("Finished edge_table creation")
def scan_conversion(self):
"""
making a scan conversion on a certain model
:return: None
"""
print("Start Scan conversion...")
for p in self.final_polygon:
AET = [] # Active edge table
if not p.edge_table: # ignoring empty edge_table
continue
ymin = int(p.edge_table[0].ymin) # ymin value among all edges
ymax = int(max(node.ymax for node in p.edge_table)) # ymax value among all edges
for scanY in range(ymin, ymax + 1): # scanline Y value
for e in p.edge_table:
if e.ymin == scanY: # put edge into AET which intersect with current scanline
AET.append(e)
elif e.ymin > scanY: # already finished since ET are pre-sorted
break
def x_cmp(edge):
return edge.xmin
AET.sort(key=x_cmp) # re-sort AET by X value
for i in range(len(AET) // 2):
for j in range(int(AET[i].xmin), int(AET[i + 1].xmin)):
# for each intersections between scanline and edge
# store all pixels coordinate between them into a pixel list
pixel = Pixel(j, scanY, 0)
p.pixel_list.append(pixel)
for e in AET:
if e.ymax == scanY: # remove edges that no longer intersect with the next scanline
AET.remove(e)
for e in AET:
e.xmin += e.slope # adjust X value by coherence
AET.sort(key=x_cmp) # re-sort AET by X value
print("Finished Scanline conversion")
def illumination_model(self):
diffuse, specular, ambient = [0, 0, 0], [0, 0, 0], [0, 0, 0]
light_intensity = [0.0, 0.0, 0.0]
light_source = [0.5, 1.0, 0.8] # color of light
# light_source[0] = 0.5
h_vector = np.zeros(3, dtype=np.float64)
light_direction = np.zeros(3, dtype=np.float64)
light_direction[0] = 1.5
print("LightDir = ", light_direction)
view_direction = np.zeros(3, dtype=np.float64)
h_vector = light_direction + view_direction
h_vector /= np.linalg.norm(h_vector)
print("h_vector = ", h_vector)
kd = 0.3 # diffuse term
ks = 0.6 # specular term
ka = 0.2 # ambient term
for p in self.final_polygon:
for i in range(0, 3):
diffuse[i] = kd * light_source[i] * np.dot(p.normal, light_direction)
specular[i] = ks * light_source[i] * np.dot(p.normal, h_vector)
ambient[i] = ka * light_source[i]
light_intensity[i] = diffuse[i] + specular[i] + ambient[i]
print(tuple(light_intensity))
p.main_color = tuple(light_intensity)
class Observer:
"""
Observer provide certain parameters to observe specific model.
"""
def __init__(self):
self.local = []
self.camera = []
self.up_vector = []
self.p_ref = []
self.near = 0
self.far = 0
self.width = 0
self.u = []
self.v = []
self.n = []
self.model_matrix = np.identity(4, dtype=np.float64)
self.view_matrix = np.zeros(4, dtype=np.float64)
self.pers_matrix = np.zeros(4, dtype=np.float64)
self.final_matrix = np.zeros(4, dtype=np.float64)
def set_modeling_matrix(self, l):
self.local = l
def set_viewing_matrix(self, c, up):
self.camera = c
self.up_vector = up
def set_perspective_matrix(self, n, f, h):
self.near = n
self.far = f
self.width = h
def set_project_ref(self, p):
self.p_ref = p
def calculate_uvn(self):
self.n = np.zeros(3, dtype=np.float64)
self.n = np.subtract(self.n, self.camera) # Warning! this is n - camera(Pref - c), not the backwards!
self.n /= np.linalg.norm(self.n) # calculate the magnitude of vector N
self.u = np.zeros(3, dtype=np.float64)
temp = np.cross(self.n, self.up_vector) # calculate the N x V'
temp /= np.linalg.norm(temp) # divided by |N x V'|
self.u = temp
self.v = np.cross(self.n, self.u)
def calculate_matrix(self):
temp = np.identity(4, dtype=np.float64)
temp[0][3] = self.local[0]
temp[1][3] = self.local[1]
temp[2][3] = self.local[2]
self.model_matrix = temp
temp = np.identity(4, dtype=np.float64) # calculate T matrix, save as temp
for i in range(0, 3):
temp[i][3] = -self.camera[i]
T = temp
temp = np.identity(4, dtype=np.float64) # calculate R matrix, save as temp
# print(type(n))
temp[0][0] = self.u[0]
temp[0][1] = self.u[1]
temp[0][2] = self.u[2]
temp[1][0] = self.v[0]
temp[1][1] = self.v[1]
temp[1][2] = self.v[2]
temp[2][0] = self.n[0]
temp[2][1] = self.n[1]
temp[2][2] = self.n[2]
R = temp
self.view_matrix = R @ T
temp = np.zeros((4, 4), dtype=np.float64)
temp[0][0] = self.near / self.width
temp[1][1] = self.near / self.width
temp[2][2] = self.far / (self.far - self.near)
temp[2][3] = - (self.far * self.near / (self.far - self.near))
temp[3][2] = 1
self.pers_matrix = temp
self.final_matrix = self.pers_matrix @ self.view_matrix
def calculate_vertex(model, observer):
"""
calculate final vertex of a model under a certain observe parameter
:param model:
:param observer:
:return:
"""
model.final_vertex.append(ScreenVertex(0, 0)) # add a void vertex to make sure vertex index start from 1
for i, v in enumerate(model.raw_vertex):
v = observer.pers_matrix @ observer.view_matrix @ v.cord
v[0] = v[0] / v[3]
v[1] = v[1] / v[3]
vertex = ScreenVertex(v[0], v[1])
model.final_vertex.append(vertex)
def backface_culling(model, observer):
"""
Applying back-face culling on certain model under a certain observe parameter
:param model:
:param observer:
:return:
"""
view_vertex = [] # vertex temp-list in view space
for i, v in enumerate(model.raw_vertex):
v = observer.pers_matrix @ observer.view_matrix @ v.cord # vertex in view space
view_vertex.append(v)
for p in model.raw_polygon:
v1 = np.subtract(view_vertex[p[2] - 1], view_vertex[p[1] - 1])
v2 = np.subtract(view_vertex[p[3] - 1], view_vertex[p[2] - 1])
v1 = v1[:-1]
v2 = v2[:-1]
Pn = | np.cross(v1, v2) | numpy.cross |
# -*- coding: utf-8 -*-
"""
Survey_Estimate3dCoord.py
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = '<NAME>'
__date__ = '2020-02-07'
__copyright__ = '(C) 2020, <NAME>'
from PyQt5.QtCore import QCoreApplication, QVariant
from qgis.core import *
import qgis.utils
from numpy import radians, array, sin, cos, sqrt, matrix, zeros, floor, identity, diag
from numpy.linalg import pinv, norm
from lftools.geocapt.imgs import Imgs
from lftools.geocapt.topogeo import str2HTML, String2CoordList, String2StringList, dms2dd
import os
from qgis.PyQt.QtGui import QIcon
class Estimate3dCoord(QgsProcessingAlgorithm):
COC = 'COC'
AZIMUTH = 'AZIMUTH'
ZENITH = 'ZENITH'
OUTPUT = 'OUTPUT'
WEIGHT = 'WEIGHT'
OPENOUTPUT = 'OPENOUTPUT'
HTML = 'HTML'
OPEN = 'OPEN'
LOC = QgsApplication.locale()[:2]
def translate(self, string):
return QCoreApplication.translate('Processing', string)
def tr(self, *string):
# Traduzir para o portugês: arg[0] - english (translate), arg[1] - português
if self.LOC == 'pt':
if len(string) == 2:
return string[1]
else:
return self.translate(string[0])
else:
return self.translate(string[0])
def createInstance(self):
return Estimate3dCoord()
def name(self):
return 'estimate3dcoord'
def displayName(self):
return self.tr('Estimate 3D coordinates', 'Estimar coordenadas 3D')
def group(self):
return self.tr('Survey', 'Agrimensura')
def groupId(self):
return 'survey'
def tags(self):
return self.tr('survey,agrimensura,3D,coordinate,azimuth,zenith,angle,least square,minimum distantce,adjustment,slant').split(',')
def icon(self):
return QIcon(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'images/total_station.png'))
txt_en = 'This tool calculates the coordinates (X, Y, Z) of a point from azimuth and zenith angle measurements observed from two or more stations with known coordinates using the Foward Intersection Method adjusted by the Minimum Distances.'
txt_pt = 'Esta ferramenta calcula as coordenadas (X,Y,Z) de um ponto a partir de medições de azimute e ângulo zenital observados de duas ou mais estações de coordenadas conhecidas utilizando o Método de Interseção à Vante ajustado pelas Distâncias Mínimas.'
figure = 'images/tutorial/survey_3D_coord.jpg'
def shortHelpString(self):
social_BW = Imgs().social_BW
nota_en = '''Notes: Data collected in the discipline of <i>Geodetic Surveys</i> in the Graduate Program at UFPE, in field work coordinated by <b>Prof. Dr. <NAME></b>.
For more information on the methodology used, please read the article at the link below:'''
nota_pt = '''Notas: Dados coletados na disciplina de <i>Levantamentos Geodésicos</i> no programa de Pós-Graduação da UFPE, em trabalho de campo coordenado pela <b>Profa. Dra. Andrea de Seixas</b>.
Para mais informações sobre a metodologia utilizada, por favor leia o artigo no link abaixo:'''
footer = '''<div align="center">
<img src="'''+ os.path.join(os.path.dirname(os.path.dirname(__file__)), self.figure) +'''">
</div>
<div align="right">
<div>''' + self.tr(nota_en, nota_pt) + '''
</div>
<p align="right">
<b><a href="https://www.researchgate.net/publication/352817150_OPTIMIZED_DETERMINATION_OF_3D_COORDINATES_IN_THE_SURVEY_OF_INACCESSIBLE_POINTS_OF_BUILDINGS_-_EXAMPLE_OF_APPLICATION_IMPLEMENTED_IN_FREE_SOFTWARE_Determinacao_otimizada_de_coordenadas_3D_no_levantamen" target="_blank">'''+self.tr('<NAME>.; <NAME>.; <NAME>.; <NAME>. Optimized determination of 3D coordinates in the survey of inaccessible points of buildings - example of application implemented in free software. Bulletin of Geodetic Sciences. 27(2): e2021017, 2021. ') + '''</b>
''' +'</a><br><b>'+ self.tr('Author: <NAME>', 'Autor: <NAME>')+'''</b>
</p>'''+ social_BW + '''</div>
</div>'''
return self.tr(self.txt_en, self.txt_pt) + footer
def initAlgorithm(self, config=None):
# 'INPUTS'
self.addParameter(
QgsProcessingParameterString(
self.COC,
self.tr('Coordinates of Optical Centers', 'Coordenadas dos Centros Ópticos'),
defaultValue = '149867.058, 249817.768, 1.825; 149988.309, 249782.867, 1.962; 150055.018, 249757.128, 1.346; 150085.600, 249877.691, 1.559',
multiLine = True
)
)
self.addParameter(
QgsProcessingParameterString(
self.AZIMUTH,
self.tr('Azimuths', 'Azimutes'),
defaultValue = '''46°10'06.37”, 359°12'12.21”, 338°32'59.40”, 298°46'22.93”''',
multiLine = True
)
)
self.addParameter(
QgsProcessingParameterString(
self.ZENITH,
self.tr('Zenith Angles', 'Ângulos Zenitais'),
defaultValue = '''72°24'22.25”, 70°43'01.75", 74°17'54.17", 65°04'27.25"''',
multiLine = True
)
)
self.addParameter(
QgsProcessingParameterBoolean(
self.WEIGHT,
self.tr('Use Weight Matrix (W)', 'Usar Matrix Peso (P)'),
defaultValue = False
)
)
# 'OUTPUT'
self.addParameter(
QgsProcessingParameterFileDestination(
self.OUTPUT,
self.tr('Adjusted 3D Coordinates', 'Coordenadas 3D Ajustadas'),
fileFilter = 'CSV (*.csv)'
)
)
self.addParameter(
QgsProcessingParameterFileDestination(
'HTML',
self.tr('Adjustment Report', 'Relatório de Ajustamento'),
self.tr('HTML files (*.html)')
)
)
self.addParameter(
QgsProcessingParameterBoolean(
self.OPEN,
self.tr('Open output file after executing the algorithm', 'Abrir arquivo de saída com coordenadas 3D'),
defaultValue= True
)
)
def CosDir(self, Az, Z):
k = sin(Z)*sin(Az)
m = sin(Z)*cos(Az)
n = cos(Z)
return array([[k],[m],[n]])
def processAlgorithm(self, parameters, context, feedback):
COs = self.parameterAsString(
parameters,
self.COC,
context
)
Azimutes = self.parameterAsString(
parameters,
self.AZIMUTH,
context
)
ÂngulosZenitais = self.parameterAsString(
parameters,
self.ZENITH,
context
)
usar_peso = self.parameterAsBool(
parameters,
self.WEIGHT,
context
)
abrir_arquivo = self.parameterAsBool(
parameters,
self.OPENOUTPUT,
context
)
output = self.parameterAsFileOutput(
parameters,
self.OUTPUT,
context
)
if output[-3:] != 'csv':
output += '.csv'
html_output = self.parameterAsFileOutput(
parameters,
self.HTML,
context
)
# Pontos
Coords = String2CoordList(COs)
# Azimutes (radianos)
Az = []
for item in String2StringList(Azimutes):
Az += [dms2dd(item)]
Az = radians(array(Az))
# Ângulos Zenitais (radianos)
Z = []
for item in String2StringList(ÂngulosZenitais):
Z += [dms2dd(item)]
Z = radians(array(Z))
# Validação dos dados de entrada
if not (len(Coords) == len(Az) and len(Az) == len(Z)):
raise QgsProcessingException(self.tr('Wrong number of parameters!', 'Número de parâmetros errado!'))
else:
n = len(Coords)
# não deve haver valores nulos
# ângulos entre 0 e 360 graus
# Montagem do Vetor L
L = []
for k in range(len(Coords)):
L+= [[Coords[k][0]], [Coords[k][1]], [Coords[k][2]]]
L = array(L)
# Montagem da Matriz A
e = 3*n
p = 3 + n
A = matrix( | zeros([e, p]) | numpy.zeros |
from dataclasses import dataclass
import typing
import numpy as np
from scipy.integrate import quad
from scipy.special import erf
import numpy.testing as npt
import pytest
import cara.monte_carlo as mc
from cara import models,data
from cara.utils import method_cache
from cara.models import _VectorisedFloat,Interval,SpecificInterval
from cara.monte_carlo.sampleable import LogNormal
from cara.monte_carlo.data import (expiration_distributions,
expiration_BLO_factors,short_range_expiration_distributions,
short_range_distances,virus_distributions,activity_distributions)
# TODO: seed better the random number generators
np.random.seed(2000)
SAMPLE_SIZE = 1_000_000
TOLERANCE = 0.04
sqrt2pi = np.sqrt(2.*np.pi)
sqrt2 = np.sqrt(2.)
ln2 = np.log(2)
@dataclass(frozen=True)
class SimpleConcentrationModel:
"""
Simple model for the background (long-range) concentration, without
all the flexibility of cara.models.ConcentrationModel.
For independent, end-to-end testing purposes.
This assumes no mask wearing, and the same ventilation rate at all
times.
"""
#: infected people presence interval
infected_presence: Interval
#: viral load (RNA copies / mL)
viral_load: _VectorisedFloat
#: breathing rate (m^3/h)
breathing_rate: _VectorisedFloat
#: room volume (m^3)
room_volume: _VectorisedFloat
#: ventilation rate (air changes per hour) - including HEPA
lambda_ventilation: _VectorisedFloat
#: BLO factors
BLO_factors: typing.Tuple[float, float, float]
#: number of infected people
num_infected: int = 1
#: relative humidity RH
humidity: float = 0.3
#: minimum particle diameter considered (microns)
diameter_min: float = 0.1
#: maximum particle diameter considered (microns)
diameter_max: float = 30.
#: evaporation factor
evaporation: float = 0.3
#: cn (cm^-3) for resp. the B, L and O modes. Corresponds to the
# total concentration of aerosols for each mode.
cn: typing.Tuple[float, float, float] = (0.06, 0.2, 0.0010008)
# mean of the underlying normal distributions (represents the log of a
# diameter in microns), for resp. the B, L and O modes.
mu: typing.Tuple[float, float, float] = (0.989541, 1.38629, 4.97673)
# std deviation of the underlying normal distribution, for resp.
# the B, L and O modes.
sigma: typing.Tuple[float, float, float] = (0.262364, 0.506818, 0.585005)
def removal_rate(self) -> _VectorisedFloat:
"""
removal rate lambda in h^-1, excluding the deposition rate.
"""
hl_calc = ((ln2/((0.16030 + 0.04018*(((293-273.15)-20.615)/10.585)
+0.02176*(((self.humidity*100)-45.235)/28.665)
-0.14369
-0.02636*((293-273.15)-20.615)/10.585)))/60)
return (self.lambda_ventilation
+ ln2/(np.where(hl_calc <= 0, 6.43, np.minimum(6.43, hl_calc))))
@method_cache
def deposition_removal_coefficient(self) -> float:
"""
coefficient in front of gravitational deposition rate, in h^-1.microns^-2
Note: 0.4512 = 1.88e-4 * 3600 / 1.5
"""
return 0.4512*(self.evaporation/2.5)**2
@method_cache
def aerosol_volume(self,diameter: float) -> float:
"""
particle volume in microns^3
"""
return 4*np.pi/3. * (diameter/2.)**3
@method_cache
def Np(self,diameter: float,
BLO_factors: typing.Tuple[float, float, float]) -> float:
"""
number of emitted particles per unit volume (BLO model)
in cm^-3.ln(micron)^-1
"""
result = 0.
for cn,mu,sigma,famp in zip(self.cn,self.mu,self.sigma,
BLO_factors):
result += ( (cn * famp)/sigma *
np.exp(-( | np.log(diameter) | numpy.log |
# -*- coding: utf-8 -*-
import random as rn
rn.seed(2)
from numpy.random import seed
seed(2)
from tensorflow import set_random_seed
set_random_seed(2)
import tensorflow as tf
session_conf = tf.ConfigProto(intra_op_parallelism_threads=1, inter_op_parallelism_threads=1)
from keras import backend as K
sess = tf.Session(graph=tf.get_default_graph(), config=session_conf)
K.set_session(sess)
import os
import numpy as np
def load_data(name='freq', get_all_special_data=True):
if name == 'freq':
path = 'D:/Python/TAR/dataset/metadata/bags of words'
elif name == 'chi2':
path = 'D:/Python/TAR/chi2_scores/metadata/bags_of_words'
elif name == 'tfidf':
path = 'D:/Python/TAR/tf-idf_scores/metadata/bags_of_words'
else:
raise ValueError
train_negative = path + '/negative'
train_positive = path + '/positive'
test_negative = path + '/negative_test'
test_positive = path + '/positive_test'
special_path = 'D:/Python/TAR/special-data/bags of words'
special_train_negative = special_path + '/negative/'
special_train_positive = special_path + '/positive/'
special_test_negative = special_path + '/negative_test/'
special_test_positive = special_path + '/positive_test/'
#
# load train data
#
train = []
train_X = []
train_S = []
train_y = []
os.chdir(train_negative)
negative_files = os.listdir()
#print('negative train files:', len(negative_files))
for txtfile in negative_files:
with open(txtfile, 'r', encoding='utf8') as file:
vector = file.readlines()
vector = [int(token[:-1]) for token in vector] # remove '\n', convert values to int
special_vector = []
with open(special_train_negative + txtfile, 'r', encoding='utf-8') as sf:
special_vector = sf.readlines()
special_vector = [float(token[:-1]) for token in special_vector]
if get_all_special_data == False:
special_vector = [special_vector[1], special_vector[4], special_vector[5], special_vector[8]]
train.append([np.array(vector), np.array(special_vector), np.array([1, 0])])
os.chdir(train_positive)
positive_files = os.listdir()
#print('positive train files:', len(positive_files))
for txtfile in positive_files:
with open(txtfile, 'r', encoding='utf8') as file:
vector = file.readlines()
vector = [int(token[:-1]) for token in vector] # remove '\n', convert values to int
special_vector = []
with open(special_train_positive + txtfile, 'r', encoding='utf-8') as sf:
special_vector = sf.readlines()
special_vector = [float(token[:-1]) for token in special_vector]
if get_all_special_data == False:
special_vector = [special_vector[1], special_vector[4], special_vector[5], special_vector[8]]
train.append([np.array(vector), np.array(special_vector), np.array([0, 1])])
train.append([np.array(vector), np.array(special_vector), np.array([0, 1])])
train.append([ | np.array(vector) | numpy.array |
import wave
import numpy as np
import matplotlib.pyplot as plt
from scipy.fftpack import fft, ifft, fftshift, ifftshift, rfft, irfft
from scipy.stats import truncnorm, uniform
from scipy.sparse import csr_matrix, coo_matrix
from scipy.signal import detrend
class SignalFrame:
""" SignalFrame class provides tools to read wave signal, generate periodic signal with or without noise
and perform a random sampling
Attributes
----------
temporal : bytearray, shape = [len]
Signal in temporal basis.
temporal_sampled : bytearray, shape = [len]
Sampled signal in temporal basis.
freq : bytearray
Signal in frequency basis.
freq_sampled : bytearray
Sampled signal in frequency basis.
len : int
Signal length.
phi : scipy.sparse.csr_matrix object with rate*len elements
Sampling matrix in compressed sparse row matrix format.
"""
def __init__(self):
self.temporal = np.array(0)
self.temporal_sampled = np.array(0)
self.freq = | np.array(0) | numpy.array |
# # FAPS PLMAgents
import logging
import os
import random
from collections import deque
import keras.backend as k
import numpy as np
from keras.layers import Dense
from keras.models import Sequential
from keras.optimizers import Adam
from FAPSPLMAgents.exception import FAPSPLMEnvironmentException
logger = logging.getLogger("FAPSPLMAgents")
class FAPSTrainerException(FAPSPLMEnvironmentException):
"""
Related to errors with the Trainer.
"""
pass
class A2C(object):
"""This class is the abstract class for the unitytrainers"""
def __init__(self, env, brain_name, trainer_parameters, training, seed):
"""
Responsible for collecting experiences and training a neural network model.
:param env: The FAPSPLMEnvironment.
:param brain_name: The brain to train.
:param trainer_parameters: The parameters for the trainer (dictionary).
:param training: Whether the trainer is set for training.
:param seed: Random seed.
"""
self.brain_name = brain_name
self.brain = env
self.trainer_parameters = trainer_parameters
self.is_training = training
self.seed = seed
self.steps = 0
self.last_reward = 0
self.initialized = False
# initialize specific PPO parameters
self.env_brain = env
self.state_size = env.stateSize
self.action_size = env.actionSize
self.action_space_type = env.actionSpaceType
self.num_layers = self.trainer_parameters['num_layers']
self.batch_size = self.trainer_parameters['batch_size']
self.hidden_units = self.trainer_parameters['hidden_units']
self.replay_memory = deque(maxlen=self.trainer_parameters['memory_size'])
self.gamma = self.trainer_parameters['gamma'] # discount rate
self.epsilon = self.trainer_parameters['epsilon'] # exploration rate
self.epsilon_min = self.trainer_parameters['epsilon_min']
self.epsilon_decay = self.trainer_parameters['epsilon_decay']
self.learning_rate = self.trainer_parameters['learning_rate']
self.actor_model = None
self.critic_model = None
def __str__(self):
return '''A2C(Advantage Actor-Critic) Trainer'''
@property
def parameters(self):
"""
Returns the trainer parameters of the trainer.
"""
return self.trainer_parameters
@property
def get_max_steps(self):
"""
Returns the maximum number of steps. Is used to know when the trainer should be stopped.
:return: The maximum number of steps of the trainer
"""
return self.trainer_parameters['max_steps']
@property
def get_step(self):
"""
Returns the number of steps the trainer has performed
:return: the step count of the trainer
"""
return self.steps
@property
def get_last_reward(self):
"""
Returns the last reward the trainer has had
:return: the new last reward
"""
return self.last_reward
def is_initialized(self):
"""
check if the trainer is initialized
"""
return self.initialized
def _create_actor_model(self):
model = Sequential()
model.add(Dense(self.hidden_units, input_dim=self.state_size, activation='relu',
kernel_initializer='he_uniform'))
for x in range(1, self.num_layers):
model.add(Dense(self.hidden_units, activation='relu', kernel_initializer='he_uniform'))
model.add(Dense(self.action_size, activation='softmax', kernel_initializer='he_uniform'))
return model
def _create_critic_model(self):
model = Sequential()
model.add(Dense(self.hidden_units, input_dim=self.state_size, activation='relu',
kernel_initializer='he_uniform'))
for x in range(1, self.num_layers):
model.add(Dense(self.hidden_units, activation='relu', kernel_initializer='he_uniform'))
model.add(Dense(1, activation='linear', kernel_initializer='he_uniform'))
return model
def initialize(self):
"""
Initialize the trainer
"""
self.actor_model = self._create_actor_model()
self.actor_model.compile(loss='categorical_crossentropy', optimizer=Adam(lr=self.learning_rate))
print('\n##### Actor Model ')
print(self.actor_model.summary())
self.critic_model = self._create_critic_model()
self.critic_model.compile(loss="mse", optimizer=Adam(lr=self.learning_rate))
print('\n##### Critic Model ')
print(self.critic_model.summary())
self.initialized = True
def clear(self):
"""
Clear the trainer
"""
k.clear_session()
self.replay_memory.clear()
self.actor_model = None
self.critic_model = None
def load_model_and_restore(self, model_path):
"""
Load and restore the model from a defined path.
:param model_path: Random seed.
"""
self.actor_model = self._create_actor_model()
if os.path.exists(model_path + '/A2C_actor_model.h5'):
self.actor_model.load_weights(model_path + '/A2C_actor_model.h5')
self.actor_model.compile(loss='categorical_crossentropy', optimizer=Adam(lr=self.learning_rate))
else:
self.actor_model.compile(loss='categorical_crossentropy', optimizer=Adam(lr=self.learning_rate))
self.critic_model = self._create_critic_model()
if os.path.exists(model_path + '/A2C_critic_model.h5'):
self.critic_model.load_weights(model_path + '/A2C_critic_model.h5')
self.critic_model.compile(loss='mse', optimizer=Adam(lr=self.learning_rate))
else:
self.critic_model.compile(loss='mse', optimizer=Adam(lr=self.learning_rate))
def increment_step(self):
"""
Increment the step count of the trainer
"""
self.steps = self.steps + 1
def update_last_reward(self, reward):
"""
Updates the last reward
"""
self.last_reward = reward
def take_action(self, brain_info):
"""
Decides actions given state/observation information, and takes them in environment.
:param brain_info: The BrainInfo from environment.
:return: the action array and an object to be passed to add experiences
"""
policy = self.actor_model.predict(brain_info.states, batch_size=1).flatten()
index = np.random.choice(self.action_size, 1, p=policy)[0]
rslt = np.zeros(shape=self.action_size, dtype=np.dtype(int))
rslt[index] = 1
#print("Hello !!!!")
return rslt
def add_experiences(self, curr_info, action_vector, next_info):
"""
Adds experiences to each agent's experience history.
:param action_vector: Current executed action
:param curr_info: Current AllBrainInfo.
:param next_info: Next AllBrainInfo.
"""
self.replay_memory.append(
(curr_info.states, action_vector, [next_info.rewards], next_info.states, [next_info.local_done]))
def process_experiences(self, current_info, action_vector, next_info):
"""
Checks agent histories for processing condition, and processes them as necessary.
Processing involves calculating value and advantage targets for model updating step.
:param current_info: Current BrainInfo.
:param action_vector: Current executed action
:param next_info: Next corresponding BrainInfo.
"""
# Nothing to be done.
def end_episode(self):
"""
A signal that the Episode has ended. The buffer must be reset.
Get only called when the academy resets.
"""
self.replay_memory.clear()
def is_ready_update(self):
"""
Returns whether or not the trainer has enough elements to run update model
:return: A boolean corresponding to wether or not update_model() can be run
"""
# The NN is ready to be updated everytime a batch is sampled
return (self.steps > 1) and ((self.steps % self.batch_size) == 0)
def update_model(self):
"""
Uses training_buffer to update model. Run back propagation.
"""
num_samples = min(self.batch_size, len(self.replay_memory))
mini_batch = random.sample(self.replay_memory, num_samples)
states = np.zeros((self.batch_size, self.state_size))
advantagess = np.zeros((self.batch_size, self.action_size))
targets = np.zeros((self.batch_size, 1))
i = 0
for state, action, reward, next_state, done in mini_batch:
target = np.zeros((1, 1))
advantages = | np.zeros((1, self.action_size)) | numpy.zeros |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.