blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 281 | content_id stringlengths 40 40 | detected_licenses listlengths 0 57 | license_type stringclasses 2
values | repo_name stringlengths 6 116 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 313
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 18.2k 668M ⌀ | star_events_count int64 0 102k | fork_events_count int64 0 38.2k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 107
values | src_encoding stringclasses 20
values | language stringclasses 1
value | is_vendor bool 2
classes | is_generated bool 2
classes | length_bytes int64 4 6.02M | extension stringclasses 78
values | content stringlengths 2 6.02M | authors listlengths 1 1 | author stringlengths 0 175 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
25bff43441d7b8e7e8014b4c2460b1f03aba0b80 | d2a030f7a050a641fddd657e895651ee0310ae41 | /givers/migrations/0016_auto_20211001_1156.py | 2a116491398f3098f4070830c1672652bfeb618f | [] | no_license | Shawen17/Giveawaynow | f052a1055a96f2d0a392aaf748adcafbec2a5135 | 92f3bc0b359a712776661348e239b492894b81a1 | refs/heads/master | 2023-09-05T00:28:59.237486 | 2021-10-24T21:12:37 | 2021-10-24T21:12:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 431 | py | # Generated by Django 3.1.7 on 2021-10-01 10:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('givers', '0015_auto_20210927_1438'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='profile_pic',
field=models.ImageField(default='profile_pic.jpg', upload_to='givers/images'),
),
]
| [
"shawen022@yahoo.com"
] | shawen022@yahoo.com |
1679c2dd1798c535df1208262c2e5919a3e0a6cf | 08b182f318fe26b8b2a2fc4022855a76bac5fcf3 | /tweetAnalysysByStrata/example_kde.py | bd0fcaff7a211cb4d0903fec63d84da5598eb236 | [] | no_license | vbabushkin/Sensing-Global-HappinessProject | 68d3449ef74236a8a0e2b62b8176e3dd11bd5a96 | 43074c070b9c3a40b1d27b82ede773001f42559b | refs/heads/master | 2021-01-10T02:07:58.118002 | 2015-12-29T06:28:20 | 2015-12-29T06:28:20 | 48,730,750 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,467 | py | """
================================================
Kernel Density Estimate of Species Distributions
================================================
This shows an example of a neighbors-based query (in particular a kernel
density estimate) on geospatial data, using a Ball Tree built upon the
Haversine distance metric -- i.e. distances over points in latitude/longitude.
The dataset is provided by Phillips et. al. (2006).
If available, the example uses
`basemap <http://matplotlib.sourceforge.net/basemap/doc/html/>`_
to plot the coast lines and national boundaries of South America.
This example does not perform any learning over the data
(see :ref:`example_applications_plot_species_distribution_modeling.py` for
an example of classification based on the attributes in this dataset). It
simply shows the kernel density estimate of observed data points in
geospatial coordinates.
The two species are:
- `"Bradypus variegatus"
<http://www.iucnredlist.org/apps/redlist/details/3038/0>`_ ,
the Brown-throated Sloth.
- `"Microryzomys minutus"
<http://www.iucnredlist.org/apps/redlist/details/13408/0>`_ ,
also known as the Forest Small Rice Rat, a rodent that lives in Peru,
Colombia, Ecuador, Peru, and Venezuela.
References
----------
* `"Maximum entropy modeling of species geographic distributions"
<http://www.cs.princeton.edu/~schapire/papers/ecolmod.pdf>`_
S. J. Phillips, R. P. Anderson, R. E. Schapire - Ecological Modelling,
190:231-259, 2006.
"""
# Author: Jake Vanderplas <jakevdp@cs.washington.edu>
#
# License: BSD 3 clause
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import fetch_species_distributions
from sklearn.datasets.species_distributions import construct_grids
from sklearn.neighbors import KernelDensity
# if basemap is available, we'll use it.
# otherwise, we'll improvise later...
try:
from mpl_toolkits.basemap import Basemap
basemap = True
except ImportError:
basemap = False
# Get matrices/arrays of species IDs and locations
data = fetch_species_distributions()
species_names = ['Bradypus Variegatus', 'Microryzomys Minutus']
Xtrain = np.vstack([data['train']['dd lat'],
data['train']['dd long']]).T
ytrain = np.array([d.decode('ascii').startswith('micro')
for d in data['train']['species']], dtype='int')
Xtrain *= np.pi / 180. # Convert lat/long to radians
# Set up the data grid for the contour plot
xgrid, ygrid = construct_grids(data)
X, Y = np.meshgrid(xgrid[::5], ygrid[::5][::-1])
land_reference = data.coverages[6][::5, ::5]
land_mask = (land_reference > -9999).ravel()
xy = np.vstack([Y.ravel(), X.ravel()]).T
xy = xy[land_mask]
xy *= np.pi / 180.
# Plot map of South America with distributions of each species
fig = plt.figure()
fig.subplots_adjust(left=0.05, right=0.95, wspace=0.05)
for i in range(2):
plt.subplot(1, 2, i + 1)
# construct a kernel density estimate of the distribution
print(" - computing KDE in spherical coordinates")
kde = KernelDensity(bandwidth=0.04, metric='haversine',kernel='gaussian', algorithm='ball_tree')
kde.fit(Xtrain[ytrain == i])
# evaluate only on the land: -9999 indicates ocean
Z = -9999 + np.zeros(land_mask.shape[0])
Z[land_mask] = np.exp(kde.score_samples(xy))
Z = Z.reshape(X.shape)
# plot contours of the density
levels = np.linspace(0, Z.max(), 25)
plt.contourf(X, Y, Z, levels=levels, cmap=plt.cm.Reds)
if basemap:
print(" - plot coastlines using basemap")
m = Basemap(projection='cyl', llcrnrlat=Y.min(),
urcrnrlat=Y.max(), llcrnrlon=X.min(),
urcrnrlon=X.max(), resolution='c')
m.drawcoastlines()
m.drawcountries()
else:
print(" - plot coastlines from coverage")
plt.contour(X, Y, land_reference,
levels=[-9999], colors="k",
linestyles="solid")
plt.xticks([])
plt.yticks([])
plt.title(species_names[i])
plt.show()
####################################################################################
RESOLUTION=64j
BANDWIDTH=0.05 # use 0.05 for ordinary heatmap
PERCENTILE=40
BASE=2
# MINLAT=50#-90 #lowest left corner latitude
# MAXLAT=60 #90 #lowest right corner latitude
# MINLON=-11#-180 #lowest left corner longitude
# MAXLON=2 #180 #lowest right corner longitude
MINLAT=-90 #lowest left corner latitude
MAXLAT=90 #lowest right corner latitude
MINLON=-180 #lowest left corner longitude
MAXLON=180 #lowest right corner longitude
with open('collectedTweetsCoordinates.txt') as f:
w, h = [float(x) for x in f.readline().split()] # read first line
pts = []
for line in f: # read rest of lines
pts.append([float(x) for x in line.split()])
data=np.array(pts)
Xtrain = data#np.vstack([data['train']['dd lat'],data['train']['dd long']]).T
Xtrain *= np.pi / 180. # Convert lat/long to radians
# Plot map of South America with distributions of each species
fig = plt.figure()
fig.subplots_adjust(left=0.05, right=0.95, wspace=0.05)
kde = KernelDensity(bandwidth=0.04, metric='haversine',kernel='gaussian', algorithm='ball_tree')
kde.fit(data)
Z = np.exp(kde.score_samples(data))
rvs=data[1:len(data)]
ax = fig.add_subplot(111)
x_flat = np.r_[MINLON:MAXLON:RESOLUTION]
y_flat = np.r_[MINLAT:MAXLAT:RESOLUTION]
x,y = np.meshgrid(x_flat,y_flat)
grid_coords = np.append(x.reshape(-1,1),y.reshape(-1,1),axis=1)
| [
"vbabushkin@masdar.ac.ae"
] | vbabushkin@masdar.ac.ae |
cbed7f9bb985a2c95984191d95e17568eba91a69 | 62dab16e77c3828b0bddc7df6bb705b14b040f6a | /yahoo_fin/news.py | 3f034a73f89af45276fc5721d1eb4bab0259ed7b | [
"MIT"
] | permissive | atreadw1492/yahoo_fin | d82eb0bc5242d6845f0bcd1a1236ac78884a69ae | 1f7ed2899db5dd6e7195aea66f7f2b642709b756 | refs/heads/master | 2023-06-21T13:42:10.762126 | 2023-06-15T00:06:45 | 2023-06-15T00:06:45 | 93,340,736 | 275 | 132 | MIT | 2023-06-15T00:06:46 | 2017-06-04T20:51:51 | Python | UTF-8 | Python | false | false | 218 | py |
import feedparser
yf_rss_url = 'https://feeds.finance.yahoo.com/rss/2.0/headline?s=%s®ion=US&lang=en-US'
def get_yf_rss(ticker):
feed = feedparser.parse(yf_rss_url % ticker)
return feed.entries
| [
"noreply@github.com"
] | noreply@github.com |
34ce1215a1f0114d758912539f6b8b23e9087aee | 640e42e90a93854e174ce5a3ea14ced34a465844 | /09_real_estate_app/concept_dicts.py | 81bedb257b80d9e258d64ac872c8e6f2a4970c3e | [] | no_license | kajpawl/pythonApps | 49e5521f59014a67ae7ae91551a8c2572f2db726 | 075a56f1ffab89901fa5079b2774b856ca71abec | refs/heads/master | 2022-12-21T20:33:28.199641 | 2020-09-22T14:32:02 | 2020-09-22T14:32:02 | 294,814,222 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 853 | py | lookup = {}
lookup = dict()
lookup = {'age': 42, 'loc': 'Italy'}
lookup = dict(age=42, loc='Italy')
class Wizard:
def __init__(self, name, level):
self.level = level
self.name = name
gandolf = Wizard("Gandolf", 42)
print(gandolf.__dict__)
print(lookup)
print(lookup['loc'])
lookup['cat'] = 'Code demo'
if 'cat' in lookup:
print(lookup['cat'])
# Suppose these came from a data source, e.g. database, web service, etc
# And we want to randomly access them
import collections
User = collections.namedtuple('User', 'id, name, email')
users = [
User(1, 'user1', 'user1@talkpython.fm'),
User(2, 'user2', 'user2@talkpython.fm'),
User(3, 'user3', 'user3@talkpython.fm'),
User(4, 'user4', 'user4@talkpython.fm'),
]
lookup = dict()
for u in users:
lookup[u.email] = u
print(lookup['user4@talkpython.fm'])
| [
"kajetan.pawliszyn@gmail.com"
] | kajetan.pawliszyn@gmail.com |
7b2ee7259aad21d0d58d0d91abc4c64525c3ebb7 | 7d5147bb094968d995a04f612ec0e42875643a14 | /linAlg.py | 2c7dddd47ceb53ab58f27d4d44daf34d2a68d704 | [] | no_license | jake-orielly/Getting_Started_with_Data_Science | 3d6633dbec000bf9a02d8554891d64b6d60b73c5 | 003f5a32aa1a7ef849f15dab98d4c3e8afe90f95 | refs/heads/master | 2020-04-05T16:51:28.612873 | 2018-11-25T02:16:30 | 2018-11-25T02:16:30 | 157,031,467 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,686 | py | from __future__ import division
import math
v1 = [1,2]
v2 = [2,1]
# --- Vectors ---
def vector_add(v, w, addon=1):
"""adds corresponding elements"""
return [v_i + w_i*addon for v_i, w_i in zip(v,w)]
def vector_subtract(v,w):
return vector_add(v, w, addon=-1)
def vector_sum(vectors):
return reduce(vector_add, vectors)
def scalar_multiply(c, v):
"""c is a number, v is a vector"""
return [c * v_i for v_i in v]
def vector_mean(vectors):
"""compute the vector whose ith element is the mean of the ith elements of the input vectors"""
n = len(vectors)
return scalar_multiply(1/n, vector_sum(vectors))
def dot(v, w):
"""v_1 * w_1 + ... + v_n * w_n"""
return sum(v_i * w_i
for v_i, w_i in zip(v,w))
def sum_of_squares(v):
"""v_1 * v_1 + ... + v_n * v_n"""
return dot(v,v)
def magnitude(v):
return math.sqrt(sum_of_squares(v))
def squared_distance(v,w):
"""(v_1 - w_1) ** 2 + ... + (v_n - w_n) ** 2"""
return sum_of_squares(vector_subtract(v, w))
def distance(v, w):
return magnitude(vector_subtract(v,w))
# --- Matrices ---
A = [[1,2,3],
[4,5,6]]
def shape(A):
num_rows = len(A)
num_cols = len(A[0]) if A else 0
return num_rows, num_cols
def getRow(A,i):
return A[i]
def getCol(A,j):
return [A_i[j]
for A_i in A]
def make_matrix(num_rows, num_cols, entry_fn):
"""returns a num_rows x num_cols matrix whose (i,j)th entry is entry_fn(i, j)"""
return [[entry_fn(i , j)
for j in range(num_cols)]
for i in range(num_rows)]
def is_diagonal(i,j):
return 1 if i == j else 0
identity_matrix = make_matrix(5,5,is_diagonal)
| [
"jake.orielly@gmail.com"
] | jake.orielly@gmail.com |
4a7c717c2a9fd7825c1dc5412a40741960d68b5c | 45b51d05e56e9c760e0bc482a82622b6fac72f76 | /Dynamic Programming/Coin_recursive.py | 2e9838cf429e8d1515d3686cc9ef686c8120ff07 | [] | no_license | EricHeGitHub/code-challenge-for-reference | 96c80e10ecab4737dce5bdd0e29f871aeaff3b34 | d39d2b7eac03844b08d1949e9c5b79f94a9e7121 | refs/heads/master | 2020-04-24T01:35:26.772628 | 2019-06-02T10:11:39 | 2019-06-02T10:11:39 | 171,603,934 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,080 | py | #problem:
#You are working at the cash counter at a fun-fair, and you have different types of coins available to you
#in infinite quantities. The value of each coin is already given.
#Can you determine the number of ways of making change for a particular number of units using the given types of coins?
#Coin Problem using recursive solution
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the getWays function below.
def getWays(n, c):
return _getWays(n, c, len(c))
def _getWays(n, c, m):
if n == 0:
return 1
if n < 0:
return 0
if m <= 0 and n >= 1:
return 0
return _getWays(n, c, m - 1) + _getWays(n - c[m - 1], c, m)
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
nm = input().split()
n = int(nm[0])
m = int(nm[1])
c = list(map(int, input().rstrip().split()))
# Print the number of ways of making change for 'n' units using coins having the values given by 'c'
ways = getWays(n, c)
fptr.write(str(ways) + '\n')
fptr.close()
| [
"noreply@github.com"
] | noreply@github.com |
7df80da79e41949652e6d21c772ae56164b3b313 | 4d914868d4eafcb5b24fcd0a810e8f7b64489ec3 | /src/utils.py | ce007dcfaaec98c5559cac024daca0a792de4b44 | [
"MIT"
] | permissive | jsennett/ELISA | 824a9dcad62a6adb65e7cb058b2e347c5e7292be | aea1a77f37181ec7e6e9ba26c0ddcb34119f8075 | refs/heads/master | 2020-04-21T22:25:14.468618 | 2019-10-01T23:15:56 | 2019-10-01T23:15:56 | 169,910,281 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 262 | py | import struct
def b_to_f(binary):
"""Convert binary to floating point"""
return struct.unpack('f', struct.pack('I', binary))[0]
def f_to_b(decimal):
"""Convert binary to floating point"""
return struct.unpack('I', struct.pack('f', decimal))[0]
| [
"joshua.sennett@tufts.edu"
] | joshua.sennett@tufts.edu |
a7a16fdf2c6741c50f2489152c3bfc87446e807e | 506ed91d4041500d2479eb1ec87b221bda9c4b03 | /utils/types.py | d47a35b21ff897bc62243ae482556825ec6d9a5d | [] | no_license | kerengaiger/RecSys_PyTorch | 1476cb4b9d6702b48b9d34e74e816d9e2fdab6fd | 9adb2634b024dda6e2f61a0b0a227c6f167fbf51 | refs/heads/master | 2023-08-20T19:48:11.047338 | 2021-09-17T08:15:46 | 2021-09-17T08:15:46 | 387,476,776 | 0 | 0 | null | 2021-07-19T13:37:33 | 2021-07-19T13:37:33 | null | UTF-8 | Python | false | false | 582 | py | import pandas as pd
import scipy.sparse as sp
from typing import Tuple
def df_to_sparse(df: pd.DataFrame, shape: Tuple[int, int]) -> sp.csr_matrix:
users = df.user
items = df.item
ratings = df.rating
sp_matrix = sp.csr_matrix((ratings, (users, items)), shape=shape)
return sp_matrix
def sparse_to_dict(sparse: sp.csr_matrix) -> dict:
if isinstance(sparse, dict):
return sparse
ret_dict = {}
dim1 = sparse.shape[0]
for i in range(dim1):
ret_dict[i] = sparse.indices[sparse.indptr[i]: sparse.indptr[i+1]]
return ret_dict | [
"yoongi0428@naver.com"
] | yoongi0428@naver.com |
8d35cd2f4d8824fbd7b9a3ecb877ac81cb2fd464 | 4416a23d8a6188d46aaccffadbf1efb80fe72c4e | /touch_Sensor.py | f6d15398fefd56aff2f94e39c18546f8bfe5ff6c | [] | no_license | sg1021/Sensor | c518b0770561f96cf4d6bb5245e02acb2a8b2640 | fa79cd2a96b8d00affa254cfeccac1b91c097d3c | refs/heads/master | 2020-03-29T11:21:11.421594 | 2018-09-22T05:14:59 | 2018-09-22T05:14:59 | 149,847,617 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 452 | py | from time import sleep, time
import RPi.GPIO as GPIO
TOUCH_PORT = 19
GPIO.setmode(GPIO.BCM)
GPIO.setup(TOUCH_PORT, GPIO.IN)
def touch():
value = 0
if GPIO.input(TOUCH_PORT):
value = 1
else:
value = 0
return value
try:
while True:
ans = touch()
if ans == 1:
print('Touch now!')
sleep(1)
else:
sleep(0.1)
except KeyboardInterrupt:
pass
GPIO.cleanup() | [
"b1612932@gmail.com"
] | b1612932@gmail.com |
b5c294455b00620bbfbf2a8a455c919efa4fdc72 | cde10c88340a3462b4aba6a0513aa915902caf6d | /api/helpers.py | b1d6cf247605b6689c8afcf971fd42c4b2bd1164 | [] | no_license | bhavrish/QuizConvert-Backend | 066e47478914c29f0531fff9a5046c1f8e442ee1 | 646680fa8e4018ee2cad376b78e1a1743b0345e3 | refs/heads/master | 2022-12-23T18:57:05.690851 | 2020-09-13T06:17:53 | 2020-09-13T06:17:53 | 295,024,173 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,986 | py | """Transcribe speech from a video stored on GCS."""
"""API key is needed for authentication"""
# Path should be of form "gs://quiz-videos/<video name>"
# Import libraries for text preprocessing
# You only need to download these resources once. After you run this
# the first time--or if you know you already have these installed--
# you can comment these two lines out (with a #)
from google.cloud import videointelligence
from sklearn.feature_extraction.text import CountVectorizer
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.tokenize import RegexpTokenizer
from nltk.stem.porter import PorterStemmer
from nltk.corpus import stopwords
import re
import nltk
from sklearn.feature_extraction.text import CountVectorizer
import re
nltk.download('stopwords')
nltk.download('wordnet')
def transcribe(path):
video_client = videointelligence.VideoIntelligenceServiceClient()
features = [videointelligence.enums.Feature.SPEECH_TRANSCRIPTION]
config = videointelligence.types.SpeechTranscriptionConfig(
language_code="en-US", enable_automatic_punctuation=True
)
video_context = videointelligence.types.VideoContext(
speech_transcription_config=config
)
operation = video_client.annotate_video(
input_uri=path, features=features, video_context=video_context
)
print("\nProcessing video for speech transcription.")
result = operation.result(timeout=600)
content = ""
# There is only one annotation_result since only
# one video is processed.
annotation_results = result.annotation_results[0]
# The number of alternatives for each transcription is limited by
# SpeechTranscriptionConfig.max_alternatives.
# Each alternative is a different possible transcription
# and has its own confidence score.
# for alternative in speech_transcription.alternatives:
# content += alternative.transcript
# Returns whole transcript
return "".join(annotation_results.speech_transcriptions)
"""Returns top num_keywords words and num_keywords bigrams of a given text"""
def top_keywords(content, num_keywords):
# Creates stop words
stop_words = set(stopwords.words("english"))
# Pre-process dataset to get a cleaned and normalised text corpus
# Remove punctuation
text = re.sub('[^a-zA-Z]', ' ', content)
# Convert to lowercase
text = text.lower()
# Remove tags
text = re.sub("</?.*?>", " <> ", text)
# Remove special characters and digits
text = re.sub("(\\d|\\W)+", " ", text)
# Convert to list from string
text = text.split()
# Stemming
ps = PorterStemmer()
# Lemmatisation
lem = WordNetLemmatizer()
text = [lem.lemmatize(word) for word in text if not word in
stop_words]
text = " ".join(text)
# Needed for it to work properly
input = [text]
cv = CountVectorizer(max_df=1, stop_words=stop_words,
max_features=10000, ngram_range=(1, 3))
X = cv.fit_transform(input)
# Get most frequently occuring keywords
vec = CountVectorizer().fit(input)
bag_of_words = vec.transform(input)
sum_words = bag_of_words.sum(axis=0)
words_freq = [(word, sum_words[0, idx]) for word, idx in
vec.vocabulary_.items()]
words_freq = sorted(words_freq, key=lambda x: x[1],
reverse=True)
top_words = words_freq[:num_keywords]
vec1 = CountVectorizer(ngram_range=(2, 2),
max_features=2000).fit(input)
bag_of_words = vec1.transform(input)
sum_words = bag_of_words.sum(axis=0)
words_freq = [(word, sum_words[0, idx]) for word, idx in
vec1.vocabulary_.items()]
words_freq = sorted(words_freq, key=lambda x: x[1],
reverse=True)
top2_words = words_freq[:num_keywords]
return (top_words, top2_words)
| [
"Lcamila.bustos@yahoo.com"
] | Lcamila.bustos@yahoo.com |
d88ea2ba6d7477db9a64f292db0f6c2310f08086 | b20c7a905e18f2e1c3cd82d3f7eecdac909c9681 | /web/migrations/0004_recognitions.py | 2ba88b3900a99522fba7ac1e848b980b4d743f34 | [] | no_license | samyakjain0657/Professor-Web-Portal | ed50fc4fca573e9f0e263837d73465bd39a89680 | f6beec1f5f6d16b6e8d784a3ef9d99a88e192005 | refs/heads/master | 2020-03-23T22:33:40.328800 | 2018-07-24T22:10:39 | 2018-07-24T22:10:39 | 142,182,411 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 685 | py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-11 12:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('web', '0003_compbtstudents_compmtstudents_compphdstudents_contbtstudents_contmtstudents_contphdstudents_publicat'),
]
operations = [
migrations.CreateModel(
name='recognitions',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('recg', models.CharField(max_length=500)),
],
),
]
| [
"jainsamyak554@gmail.com"
] | jainsamyak554@gmail.com |
50d8820972add7db1e12f143f05cf38d7f3ed8a2 | 548a5ed489f88b34f0dd31a2118cb1ce82155c99 | /BOJ/2020_12/2562.py | fce608b3cdaa9bec2c41b134ed6c60e49a90d410 | [] | no_license | rkdtmddnjs97/algorithm | f44606f0f39c39af272ffef5373c801e7388d882 | 7cc3d20d654ea067502c3e60b706b0cb765784c0 | refs/heads/main | 2023-07-13T08:20:38.750770 | 2021-08-21T20:31:54 | 2021-08-21T20:31:54 | 398,647,983 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 128 | py | a = [ int(input()) for i in range(9)]
b = max(a)
print(b)
for key,value in enumerate(a):
if value == b:
print(key+1) | [
"rkdtmddnjs97@gmail.com"
] | rkdtmddnjs97@gmail.com |
cbfc3ff4e380aeada17a0d1c10ff1a8e10ad2e5e | 4158d5990538233e7677919581e13c45519d7176 | /django_react/auto_calendar/auto_calendar/asgi.py | 32d15dde9b55df90a272f21d359c4ea368f362cf | [] | no_license | gwonin-kenji/auto_calendar | ea59cc2b96a0a4393bb1d06e9bc85aad5fafd72d | e9d88d67e41e839211dc94b234bd897a22365174 | refs/heads/master | 2023-08-28T22:29:01.075267 | 2021-10-17T11:36:45 | 2021-10-17T11:36:45 | 418,101,814 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 403 | py | """
ASGI config for auto_calendar project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'auto_calendar.settings')
application = get_asgi_application()
| [
"63086285+gwonin-kenji@users.noreply.github.com"
] | 63086285+gwonin-kenji@users.noreply.github.com |
d630b1dd7a6eb1c30f516c89ef5c64aaeb65c260 | 6a0b5dd52577003eddeb45d1ccc173ff6de7e7ca | /director/users/api_v1_urls.py | 5721468341cbb8e8260894fc59e968198546b117 | [
"Apache-2.0"
] | permissive | paulolimac/hub | 98ab1fd0c60ccc28a5a887dc486119da066ced36 | ce5d86343e340ff0bd734e49a48d0745ae88144d | refs/heads/master | 2020-04-03T13:21:20.046117 | 2018-10-29T23:49:37 | 2018-10-29T23:49:37 | 155,282,253 | 0 | 0 | null | 2018-10-29T21:14:19 | 2018-10-29T21:14:18 | null | UTF-8 | Python | false | false | 129 | py | from django.urls import path
from users.api_views import UserSearch
urlpatterns = [
path('search', UserSearch.as_view())
]
| [
"ben@beneboy.co.nz"
] | ben@beneboy.co.nz |
e100d58583d17c1d8f17b6ac0bd3975d1d7a443f | 8b7a3d4fc60d125f52647d30f21d3fbbe424005b | /IIS_project/Kulecnik/migrations/0007_auto_20191024_1451.py | 6bb7bdb4f9f8d028aa184c5996b815d3f510254c | [] | no_license | Jonnymen/IIS-projekt | c7460e0c94eb5c9f48c121316ee663f4b4ad43a9 | f49ffe5799b90db9b3a49fe30c88ee8cb7f7d1eb | refs/heads/master | 2022-03-08T06:27:39.418518 | 2019-12-02T20:34:54 | 2019-12-02T20:34:54 | 217,028,933 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 415 | py | # Generated by Django 2.2.5 on 2019-10-24 14:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Kulecnik', '0006_auto_20191023_1340'),
]
operations = [
migrations.AlterField(
model_name='tournament_s',
name='place',
field=models.CharField(blank=True, max_length=60, null=True),
),
]
| [
"jonny.mensik@gmail.com"
] | jonny.mensik@gmail.com |
fbe5458cc827a0d5d51e19fb100f09b340786554 | aa00321c07abffc86e3c7486f4caee70dc5f3a25 | /upc_ws/build/upc_mrn/catkin_generated/pkg.develspace.context.pc.py | fdfc72ff9150e242801311c55473ee3f0a694eac | [] | no_license | eduardoruiz4/mapping_project | b4dccf3c8fab2ff8193d4f2fedb12359a4cf488c | 769b423dfa2b4d8ff2b890b1f8875096ca6f90d3 | refs/heads/master | 2021-01-21T06:24:31.183484 | 2017-02-27T05:14:57 | 2017-02-27T05:14:57 | 83,225,830 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 464 | py | # generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "move_base_msgs;roscpp;rospy;action_lib;tf;sensor_msgs;visualization_msgs;nav_msgs;geometry_msgs".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "upc_mrn"
PROJECT_SPACE_DIR = "/home/eduardorz/upc_ws/devel"
PROJECT_VERSION = "1.0.0"
| [
"eduardorz@eduardorz-K43E.(none)"
] | eduardorz@eduardorz-K43E.(none) |
4febf68c978b5008fc4c285756f5d452b0554f81 | 9f4b192e9effee10a1ca45f79ded6e633d5ccdc7 | /Berkeley/cs47a/hw09/tests/parent-height.py | 68e723f940a47634620fb79ff226eb3d113f08ba | [] | no_license | mdugar/Problem-Sets | 57b27b3b818d109148702c31d6e597b9b8731ee6 | 58070105c9d56b5c08de004397c48e4238dc915a | refs/heads/master | 2021-06-09T01:05:18.499050 | 2016-11-24T00:56:24 | 2016-11-24T00:56:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 528 | py | test = {
'name': 'size',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
sqlite> select * from by_height;
herbert
fillmore
abraham
delano
grover
barack
clinton
""",
'hidden': False,
'locked': False
}
],
'ordered': False,
'scored': True,
'setup': r"""
sqlite> .read hw09.sql
""",
'teardown': '',
'type': 'sqlite'
}
]
} | [
"nunni2@illinois.edu"
] | nunni2@illinois.edu |
890c730f3455a002f518e47dd3c75db9f811bf6d | 7b775d38358de50416f81b07ff3ad9945efe3382 | /utils/transform.py | a5e3950a549b5873f447e52bad7de4d89bad9820 | [] | no_license | fred4freedom/knowledge-distillation-demo | 530b5a4966958dff15efb077bd1a1c190e17479e | 3f661d5776949e71c9446a6f80d5b73cfbafbeb8 | refs/heads/master | 2021-03-17T09:44:12.247473 | 2020-03-13T03:37:27 | 2020-03-13T03:37:27 | 246,981,129 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 420 | py |
import torchvision.transforms as transforms
normalization = transforms.Normalize(
mean=(0.4914, 0.4822, 0.4465),
std=(0.2023, 0.1994, 0.2010)
)
training_transform = transforms.Compose([
transforms.RandomCrop(32, padding=4),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
normalization
])
validation_transform = transforms.Compose([
transforms.ToTensor(),
normalization
])
| [
"fred@dsaid.gov.sg"
] | fred@dsaid.gov.sg |
1509d9b68521df12375cdeb84a7ebe5c1ec96e76 | 91d1a6968b90d9d461e9a2ece12b465486e3ccc2 | /elasticache_write_f/tags-to-resource_add.py | 9d6e980bae8076a92de85796496e725ed2d6d06f | [] | no_license | lxtxl/aws_cli | c31fc994c9a4296d6bac851e680d5adbf7e93481 | aaf35df1b7509abf5601d3f09ff1fece482facda | refs/heads/master | 2023-02-06T09:00:33.088379 | 2020-12-27T13:38:45 | 2020-12-27T13:38:45 | 318,686,394 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 399 | py | #!/usr/bin/python
# -*- codding: utf-8 -*-
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
from common.execute_command import write_parameter
# url : https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-instances.html
if __name__ == '__main__':
"""
"""
write_parameter("elasticache", "add-tags-to-resource") | [
"hcseo77@gmail.com"
] | hcseo77@gmail.com |
31d4f20c8b0882358fa754ca769dc5ee20509306 | 852b6017c6a277b2afc4b24a903566e7d9121285 | /Prediction.py | 310f09af36a388fc37bfcacfbcbff1036ee7c0c8 | [
"MIT"
] | permissive | s123600g/asr_edgetpu_demo | 6d4dbdbb7cc9a60ce0d59cf676d54e3d4a67862c | 628f885a4998cf9c0bed5ab5b85effa2a8ea4c68 | refs/heads/master | 2020-06-19T18:56:36.585685 | 2020-05-10T13:27:20 | 2020-05-10T13:27:20 | 196,832,288 | 7 | 0 | null | null | null | null | UTF-8 | Python | false | false | 12,201 | py | # -*- coding:utf-8 -*-
'''
MIT License
Copyright (c) 2019 李俊諭 JYUN-YU LI
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'''
# from keras.models import load_model
from tensorflow.keras.models import load_model
# from keras.applications.imagenet_utils import decode_predictions
from Config import Config
import os
import numpy as np
import sqlite3
import time
import librosa
dbconn = sqlite3.connect(
os.path.join(
os.getcwd(),
Config.SQLite_DB_DirectoryName,
Config.SQLite_name
)
)
curs = dbconn.cursor()
batch_size = 126
correct_count = 0
err_count = 0
is_one_line = True
def gen_wav_mfcc(file_path, sample_rate, max_pad_len):
'''
產生語音Wav檔案之特徵值(MFCC)。\n
所需參數如下:\n
file_path: 語音檔案放置位置\n
sample_rate:語音檔案之頻率\n
max_pad_len: 語音特徵向量補值最大長度\n
'''
wave, sr = librosa.load(file_path, mono=True, sr=sample_rate)
# print("[Prediction]wave type:{}".format(type(wave)))
# print("wave shape:{}".format(wave.shape))
# wave array begins at 0 and ends at array length with step 3
wave = wave[::3]
# print("wave shape:{}".format(wave.shape))
# print("wave:\n{}\n".format(wave))
# 取得語音檔案MFCC特徵值
mfcc = librosa.feature.mfcc(wave, sr=sample_rate)
# print("mfcc:\n{}\n".format(mfcc))
# print("[Prediction]mfcc type:{}".format(type(mfcc)))
# print("[Prediction]mfcc shape:{}\n".format(mfcc.shape))
# 設置資料維度補齊長度
pad_width = max_pad_len - mfcc.shape[1]
# 針對資料維度補齊0
mfcc = np.pad(mfcc, pad_width=(
(0, 0), (0, pad_width)), mode='constant')
# print("[Prediction]new mfcc type:{}".format(type(mfcc)))
# print("[Prediction]new mfcc shape:{}\n".format(mfcc.shape))
# print("[Prediction]\n{}".format(mfcc))
# print()
return mfcc
if __name__ == "__main__":
start_time = time.time()
print("\nWait for configure operation sources......", end="\n\n")
print("[Prediction] Start load Model from [{}]\n".format(
Config.Model_Path
), end="\n\n")
''' 載入模型 '''
get_model = load_model(
Config.Model_Path
)
''' 顯示輸出讀取模型架構資訊 '''
get_model.summary()
''' 判斷放置所有預測資料總目錄是否存在 '''
if os.path.exists(Config.Prediction_Audio_Data_Path):
''' 判斷放置所有預測資料總目錄是否內部有資料存在 '''
if len(os.listdir(Config.Prediction_Audio_Data_Path)) != 0:
# 開啟輸出識別紀錄檔案
filewrite = open(
os.path.join(
os.getcwd(),
Config.Log_DirectoryName,
Config.Log_Recognition_Result_DirectoryName,
str(Config.Log_Recognition_Result_DirectoryName +
"." + Config.log_file_type)
),
'w'
)
''' 讀取放置所有預測資料總目錄內部 '''
for read_item in os.listdir(Config.Prediction_Audio_Data_Path):
''' 判斷目前讀取到的項目是否為目錄 '''
if os.path.isdir(os.path.join(Config.Prediction_Audio_Data_Path, read_item)):
print(
"\n[Prediction] Current read folder [ '{}' ]. Start recognition".format(read_item))
if is_one_line:
filewrite.write(
">>> Folder name [ '{}' ] recognition result:\n".format(
read_item
)
)
is_one_line = False
else:
filewrite.write(
"\n>>> Folder name [ '{}' ] recognition result:\n".format(
read_item
)
)
temp_correct_count = 0
temp_err_count = 0
for read_file in os.listdir(os.path.join(Config.Prediction_Audio_Data_Path, read_item)):
# 擷取語音wav檔案MFCC特徵值
mfcc_data = gen_wav_mfcc(
os.path.join(
Config.Prediction_Audio_Data_Path,
read_item,
read_file
),
Config.sample_rate,
Config.max_pad_len,
)
''' 將音頻MFCC特徵矩陣轉換為numpy array '''
mfcc_data = np.array(mfcc_data)
''' 重新設置音頻MFCC特徵值矩陣維度,格式為[row , column , single channel] '''
mfcc_data = mfcc_data.reshape(
mfcc_data.shape[0], mfcc_data.shape[1], Config.channel)
''' 將音頻MFCC特徵值矩陣維度第一個位置新增補值,補值為代表為單個特徵數值矩陣,格式為[file quantity ,row , column , single channel] '''
mfcc_data = np.expand_dims(mfcc_data, axis=0)
''' 將音頻MFCC特徵值矩陣小數精度轉換為float32 '''
mfcc_data = mfcc_data.astype('float32')
# print("[Prediction]mfcc_data shape:{}".format(
# mfcc_data.shape))
''' 進行語音預測 '''
predict_result = get_model.predict(
mfcc_data,
batch_size=batch_size
)
# print("predict_result:{}".format(predict_result[0]))
get_prediction_index = np.argmax(predict_result[0])
# print("get_prediction_index:{}".format(
# get_prediction_index))
# print("{:.2f}%".format(
# (predict_result[0][get_prediction_index] * 100)))
# print("{}".format(get_prediction_index))
''' 查詢預測出來分類編號對應分類名稱 '''
SQL_select_syntax = '''
SELECT {} FROM {} WHERE {} = '{}'
'''.format(
Config.column_Classname, # 欄位名稱-ClassName
Config.db_TableName, # 查詢資料表
Config.column_ClassNum, # 欄位名稱-ClassNum
get_prediction_index # 預測分類編號結果
)
SQL_run = curs.execute(SQL_select_syntax)
SQL_result = curs.fetchall()
''' 判斷識別分類結果是否正確 '''
if SQL_result[0][0] == read_item:
print("(O) [ {} ] ---> [ '{}' ]({:.2f}%)".format(
read_file,
SQL_result[0][0],
(predict_result[0][get_prediction_index] * 100)
))
filewrite.write("(O) [ {} ] ---> ['{}']({:.2f}%)\n".format(
read_file,
SQL_result[0][0],
(predict_result[0][get_prediction_index] * 100)
))
correct_count += 1
temp_correct_count += 1
else:
print("(X) [ {} ] ---> [ '{}' ]({:.2f}%)".format(
read_file,
SQL_result[0][0],
(predict_result[0][get_prediction_index] * 100)
))
filewrite.write("(X) [ {} ] ---> ['{}']({:.2f}%)\n".format(
read_file,
SQL_result[0][0],
(predict_result[0][get_prediction_index] * 100)
))
err_count += 1
temp_err_count += 1
print('''----------------------------------------------\nThe label ['{}'] recognition result:\ncorrect total: {} count.\nincorrect total: {} count.\n----------------------------------------------
'''.format(
read_item,
temp_correct_count,
temp_err_count
))
filewrite.write(
'''----------------------------------------------\nThe label ['{}'] recognition result:\ncorrect total: {} count.\nincorrect total: {} count.\n----------------------------------------------\n
'''.format(
read_item,
temp_correct_count,
temp_err_count
)
)
end_time = '{:.2f}'.format((time.time() - start_time))
filewrite.write(
'''
\n
--------------------------------------
Audio Prediction Data Quantity:{}
correct total: {} count.
incorrect total: {} count.
--------------------------------------
Full Speed Time: {}s
'''.format(
(correct_count + err_count),
correct_count,
err_count,
end_time
)
)
# 關閉輸出紀錄檔案
filewrite.close()
print(
'''
\n
--------------------------------------
Audio Prediction Data Quantity:{}
correct total: {} count.
incorrect total: {} count.
--------------------------------------
Full Speed Time: {}s
'''.format(
(correct_count + err_count),
correct_count,
err_count,
end_time
)
)
else:
print("[Prediction] The path [{}] is empty.".format(
Config.Prediction_Audio_Data_Path
))
else:
print("[Prediction] The path [{}] can not found.".format(
Config.Prediction_Audio_Data_Path
))
| [
"noreply@github.com"
] | noreply@github.com |
abfe1eb5ad4a1f46bb5c3849ae609f441b1bb094 | 113eda40b426911aa11f61049a69815690ceac00 | /ccg_travel_orders/models/ccg_travel_order.py | 5b06867906a9ad03981750ed3740a4026644baa5 | [] | no_license | vidtsin/cadcam_oe | 2cd30433351c184b83fc0d6b2c3b6549deccbe1d | 84cc40989c2eb55ad7a21b04d0e92054948643df | refs/heads/master | 2020-07-07T14:50:37.014234 | 2019-05-28T12:44:10 | 2019-05-28T12:44:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 7,024 | py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2016 CADCAM Design Centar d.o.o. (<http://www.cadcam-group.eu/>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, fields, api, _
class ccg_travel_order(models.Model):
_inherit = 'hr.travel.order'
_name = 'hr.travel.order'
partner_ids = fields.Many2many('res.partner', 'hr_travel_order_partner_rel','travel_order_id', 'partner_id' )
depart_vehicle_ids = fields.Many2many('travel.order.fleet', 'hr_travel_order_fleet_rel','travel_order_id', 'vehicle_id')
arrive_vehicle_ids = fields.Many2many('travel.order.fleet', 'hr_travel_order_fleet_rel','travel_order_id', 'vehicle_id')
@api.multi
@api.onchange('partner_ids')
def _on_change_partner(self):
countries = []
cities = [self.dest_city] if self.dest_city else []
for partner in self.partner_ids:
if partner.country_id:
countries.append(partner.country_id.id)
if (not self.dest_city and partner.city ) or (partner.city and self.dest_city and not (partner.city in self.dest_city)):
cities.append(partner.city)
if countries:
self.country_ids = countries
if cities:
self.dest_city = ", ".join(cities)
@api.multi
@api.onchange('depart_vehicle_ids')
def _on_change_depart_vehicle_ids(self):
if self.depart_vehicle_ids and not self.arrive_vehicle_ids:
self.arrive_vehicle_ids = [vehicle_id.id for vehicle_id in self.depart_vehicle_ids if vehicle_id]
@api.multi
@api.onchange('depart_transportation')
def _on_change_depart_transportation(self):
if self.depart_transportation and not self.arrive_transportation:
self.arrive_transportation = self.depart_transportation
class ccg_travel_order_itinerary_lines(models.Model):
_inherit = "hr.travel.order.itinerary.lines"
_name = "hr.travel.order.itinerary.lines"
vehicle_id = fields.Many2one('travel.order.fleet', 'Vehicle')
vehicle = fields.Char('Vehicle', compute='_compute_vehicle', store=True,help="")
license_plate = fields.Char('License Plate',compute='_compute_license_plate', store=True,)
odometer_end = fields.Integer('Odometer end',store=True,)
calc_odometer = fields.Boolean("km?")
def get_odometer_previous(self, cr, uid, ids, context=None):
self.cr = cr
dateto = context.get('dateto', 'False')
vehicle_id = context.get('vehicle_id',False)
distance = context.get('distance', 0)
if vehicle_id and dateto:
sql = """
select
l.odometer_end
from
hr_travel_order_itinerary_lines l left join
hr_travel_order t on l.travel_order_id = t.id
where
t.date_to < '{}' and l.vehicle_id = {}
order by
l.odometer_end desc
limit 1
""".format(dateto , vehicle_id)
print sql
self.cr.execute( sql)
data = self.cr.fetchall()
if data :
odometer_last_value = data[0][0]
else:
odometer_last_value = 0
return {'value': {'odometer_start': odometer_last_value,
'odometer_end':odometer_last_value + distance,
'calc_odometer':0}}
@api.one
@api.depends('vehicle_id')
def _compute_vehicle(self):
vehicle = []
if self.vehicle_id.modelname:
vehicle.append(self.vehicle_id.modelname)
if self.vehicle_id.brandname:
vehicle.append(self.vehicle_id.brandname)
self.vehicle = ' '.join(vehicle)
@api.multi
@api.onchange('vehicle_id')
def _on_change_vehicle_id(self):
if self.vehicle_id.type:
self.vehicle_type = self.vehicle_id.type
@api.multi
def action_recompute_itinerary(self):
# print 'CCG action_recompute_itinerary'
total_itinerary = 0.00
for l in self.itinerary_ids:
# print l.vehicle_type
if l.vehicle_type == 'private':
total_itinerary = total_itinerary + l.lcy_amount_total
else:
l.lcy_amount_total = 0.0
return self.write({'lcy_itinerary_amount_total': total_itinerary,
})
@api.one
@api.depends('vehicle_id')
def _compute_license_plate(self):
if self.vehicle_id.license_plate:
self.license_plate = self.vehicle_id.license_plate
@api.one
@api.onchange('odometer_start', 'distance')
def _compute_odometer_end(self):
if self.odometer_start + self.distance != self.odometer_end:
self.odometer_end = self.odometer_start + self.distance
@api.onchange('odometer_start')
def onchange_odometer_start(self):
end = self.odometer_end
start = self.odometer_start
distance = self.distance
if (start and end) and (start > end):
raise Warning(
_('Warning!'),
_('The odometer start value must be lower than end value.'))
if start and not end:
self.odometer_end = (distance and start + distance or start)
if (end and start) and (start <= end):
self.distance = end - start
if self.vehicle_type == 'private':
self.lcy_amount_total = self.distance * 2.0
else:
self.lcy_amount_total = 0.0
@api.onchange('odometer_end')
def onchange_odometer_end(self):
end = self.odometer_end
start = self.odometer_start
if (start and end) and (start > end):
raise Warning(
_('Warning!'),
_('The odometer start value must be lower than end value.'))
if (end and start) and (start <= end):
self.distance = end - start
if self.vehicle_type == 'private':
self.lcy_amount_total = self.distance * 2.0
else:
self.lcy_amount_total = 0.0
| [
"boris.kumpar@cadcam-group.eu"
] | boris.kumpar@cadcam-group.eu |
555718c3e4afae608762a4da52591dcbda894734 | 05e4c9c4358569833d30d9e114fc6a18b48d3164 | /python/presigned/test_presigned_url.py | 13aaf0e73d64491dc69301b68518f17f7b9ad455 | [] | no_license | AruniMishra/aws | 385682575a79cb5ab369b528372f4d4aaa086172 | 4ad94b3f99f0ebee5866704b9055a2197721c725 | refs/heads/master | 2023-09-04T22:33:54.530093 | 2021-09-28T17:10:49 | 2021-09-28T17:10:49 | 290,276,287 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 815 | py | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Unit tests for presigned_url.py functions.
"""
import boto3
import logging
import presigned_url
logger = logging.getLogger(__name__)
def test_generate_presigned_url():
s3_client = boto3.client('s3')
client_method = 'get_object'
method_params = {'Bucket': 'arunipresigned', 'Key': 'prince.jpg'}
expires = 1000
got_url = presigned_url.generate_presigned_url(
s3_client, client_method, method_params, expires)
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s')
print("got_url")
print(got_url)
assert 'arunipresigned' in got_url
assert 'prince.jpg' in got_url
if __name__ == '__main__':
test_generate_presigned_url() | [
"arunimishramsit@gmail.com"
] | arunimishramsit@gmail.com |
3947bd751ee9a880de119c51faed2a596997270f | a9e21231a336bb156912d178cdbd9b06b9dd7494 | /app/core/management/commands/wait_for_db.py | a0d51a8c58872888524430cf04a041528b4828ea | [] | no_license | adam-harmasz/recipe_rest_api | 3e10646957fbd28b1516ed7df22d04fbd92b26cc | 7c087b0885a816ee1587ab0654044e39e4526999 | refs/heads/master | 2020-04-18T03:55:16.358144 | 2019-01-27T20:46:50 | 2019-01-27T20:46:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 656 | py | from django.db import connections
from django.db.utils import OperationalError
from django.core.management.base import BaseCommand
# import time
class Command(BaseCommand):
"""Django command to pause execution until db is available"""
def handle(self, *args, **options):
self.stdout.write('Waiting for db...')
db_conn = None
while not db_conn:
try:
db_conn = connections['default']
except OperationalError:
self.stdout.\
write('Db unavailable at the moment, waiting 1 second...')
self.stdout.write(self.style.SUCCESS('Db available!'))
| [
"adam.harmasz@o2.pl"
] | adam.harmasz@o2.pl |
c1ab259708f78e673c1ea1ed3d255d0513875109 | 59140a964605cbda4eb12607d3b407a3a36b9bae | /pub.py | 9e2d0531e578d16b79c272a1470ab6e29ff02857 | [] | no_license | luist1228/SambilServices | 62f5dabfdb9f590118e126ca8951fc8a50b2eb61 | 08826cfddebde1d67d1803951b9fa4590bdb52e5 | refs/heads/master | 2020-06-16T14:46:45.922633 | 2019-07-10T09:54:11 | 2019-07-10T09:54:11 | 195,613,402 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 22,523 | py | import ssl
import sys
import json
import random
import time
import paho.mqtt.client as mqtt
import paho.mqtt.publish
import numpy as np
import datetime
import psycopg2 as psy
import pandas as pd
import csv
import datetime
centrada = psy.connect(host = 'localhost', user= 'postgres', password ='12t09lma', dbname= 'Servicio Camara')
ctienda = psy.connect(host = 'localhost', user= 'postgres', password ='12t09lma', dbname= 'Servicio Tienda')
cmesa = psy.connect(host = 'localhost', user= 'postgres', password ='12t09lma', dbname= 'Servicio Mesa')
knownPeople = []
peopleInside = []
peopleSitting = []
peopleInStore = []
#Aux lists for car's simulation
parkingCars = []
queueDrivers = []
knownCars = []
def on_connect():
print("Pub connected!")
def main():
client = mqtt.Client("Publisher", False)
client.qos = 0
client.connect(host="localhost")
#Database variables
numAccess = queryNumAccess()
storeBeaconID = queryStoreBeaconID()
tableBeaconID = queryTableBeaconID()
currentTime = datetime.datetime.now().replace(hour=8, minute=0)
days = 31
#The main loop!
while(days > 0):
#This is while the mall is still open
while(currentTime.hour < 22):
if(int(np.random.uniform(0,3)) == 0): #Get some car in
pubCarEntrance(client, currentTime)
if(int(np.random.uniform(0,2)) != 0):
pubEntrance(client,numAccess,currentTime)
currentTime = currentTime + datetime.timedelta(minutes=1)
if(int(np.random.uniform(0,3)) == 0):
pubStores(client,storeBeaconID,currentTime)
print()
if(int(np.random.uniform(0,3)) == 0):
pubTables(client,tableBeaconID,currentTime)
currentTime = currentTime + datetime.timedelta(minutes=1)
currentTime = currentTime + datetime.timedelta(minutes=6)
#time.sleep(0.2)
#At this point, the mall is closing and we start to get people out
while((len(peopleInside) + len(peopleInStore) + len(peopleSitting) + len(parkingCars)) > 0):
ran = np.random.uniform(0, len(peopleInside))
while(ran > 0):
cameraID = int(np.random.uniform(1 , numAccess))
payload = leavingMall(cameraID, currentTime)
if(payload["time"] != "null"):
client.publish("Sambil/Camaras/Salida", json.dumps(payload), qos=0)
print("Saliendo (C.C.) --> ", end='')
print(payload)
ran -= 1
ran = np.random.uniform(0, len(parkingCars))
while(ran > 0):
data = drivingOut(currentTime)
payload = data[0]
payload2 = data[1]
if(payload["time"] != "null"):
print("Saliendo (C.C.) --> ", end='')
print(payload)
client.publish("Sambil/Camaras/Saliendo", json.dumps(payload), qos=0)
print("Saliendo (C.C.) --> ", end='')
print(payload2)
client.publish("Sambil/Estacionamiento/Saliendo", json.dumps(payload2), qos=0)
ran -= 1
ran = np.random.uniform(0, len(peopleSitting))
while(ran > 0):
tableUser = stadingUp()
payload = {
"beaconID": str(tableUser[1]),
"macAddress": str(tableUser[0][0]),
"time": str(currentTime)
}
client.publish("Sambil/Mesa/Parado", json.dumps(payload), qos=0)
print("Parado (Mesa) --> ", end='')
print(payload)
ran -= 1
ran = np.random.uniform(0, len(peopleInStore))
while(ran > 0):
storeUser = leavingStore(client, currentTime)
payload = {
"beaconID": str(storeUser[1]),
"macAddress": str(storeUser[0][0]),
"time": str(currentTime)
}
currentTime += datetime.timedelta(minutes=5)
if(storeUser[0] != "null"): #Beacons only detect users with smartphones
client.publish("Sambil/Tienda/Saliendo", json.dumps(payload), qos=0)
print("Saliendo (Tienda) --> ", end='')
print(payload)
ran -= 1
#time.sleep(0.1)
days -= 1
currentTime = datetime.timedelta(days=1) + currentTime.replace(hour=8, minute=0)
getDataFromDB()
insertData(knownPeople)
#Publisher's Methods
def pubEntrance(client, numAccess, currentTime):
cameraID = int(np.random.uniform(1 , numAccess))
if((int(np.random.uniform(0,3)) != 1) or (len(peopleInside) == 0)):
if(int(np.random.uniform(0,5)) == 1 and len(knownPeople) > 0): #Random to get someone known inside
payload = enteringMallAgain(cameraID, currentTime)
else:
payload = enteringMall(cameraID, currentTime)
topic = "Entrada"
else:
payload = leavingMall(cameraID, currentTime)
topic = "Salida"
if(payload["time"] != "null"):
client.publish("Sambil/Camaras/" + topic, json.dumps(payload), qos=0)
print(topic + " (C.C.) --> ", end='')
print(payload)
def pubCarEntrance(client, currentTime):
if((int(np.random.uniform(0,3)) != 1) or (len(parkingCars) == 0)):
if((int(np.random.uniform(0,5) == 0) and (len(knownPeople) > 0))): #Probably you know the person
data = knownDrivingIn(currentTime)
payload = data[0]
payload2 = data[1]
newCar = data[2]
else:
newCar = True
payload = drivingIn(currentTime)
ran = np.random.uniform(1,5)
currentTime += datetime.timedelta(minutes=ran)
payload2 = enteringMall(4, currentTime)
#Validation to see if there is really someone parking
if(payload["time"] != "null"):
print("Entrando (C.C.) --> ", end='')
print(payload)
client.publish("Sambil/Estacionamiento/Entrada", json.dumps(payload), qos=0)
print("Entrando (C.C.) --> ", end='')
print("-----------------------------------------------------------------------------------------------------")
print(payload2)
print("-----------------------------------------------------------------------------------------------------")
client.publish("Sambil/Camaras/Entrada", json.dumps(payload2), qos=0)
driver = [payload2["macAddress"], payload2["gender"], int(payload2["age"])]
#This is like "parking" the car inside a list
parkingCars[len(parkingCars)-1].append(driver)
if(driver[0] != "null" and newCar):
knownCars.append([payload["numberPlate"], driver[0]])
else:
data = drivingOut(currentTime)
payload = data[0]
payload2 = data[1]
if(payload["time"] != "null"):
print("Saliendo (C.C.) --> ", end='')
print(payload)
client.publish("Sambil/Camaras/Saliendo", json.dumps(payload), qos=0)
print("Saliendo (C.C.) --> ", end='')
print(payload2)
client.publish("Sambil/Estacionamiento/Saliendo", json.dumps(payload2), qos=0)
def pubStores(client, storeBeaconID, currentTime):
if(len(peopleInside) > 0):
if(int(np.random.uniform(0,3)) == 1 and len(peopleInStore) > 0): #Get someone out of store
storeUser = leavingStore(client, currentTime)
topic = "Saliendo"
else: #Get someone in
storeUser = enteringStore(storeBeaconID)
topic = "Entrando"
payload = {
"beaconID": str(storeUser[1]),
"macAddress": str(storeUser[0][0]),
"time": str(currentTime)
}
if(storeUser[0] != "null"): #Beacons only detect users with smartphones
client.publish("Sambil/Tienda/" + topic, json.dumps(payload), qos=0)
print(topic + " (Tienda) --> ", end='')
print(payload)
def pubTables(client, tableBeaconID, currentTime):
if(len(peopleInside) > 0):
if(int(np.random.uniform(0,3)) == 1 and len(peopleSitting) > 0):
tableUser = stadingUp()
topic = "Parado"
else:
tableUser = sitting(tableBeaconID)
topic = "Sentado"
payload = {
"beaconID": str(tableUser[1]),
"macAddress": str(tableUser[0][0]),
"time": str(currentTime)
}
print(topic + " (Mesa) --> ", end='')
print(payload)
client.publish("Sambil/Mesa/" + topic, json.dumps(payload), qos=0)
def pubSales(client, buyer, currentTime):
if(int(np.random.uniform(0,1)) == 0):
avgPrice = 150
stdPrice = 100
price = round(np.random.normal(avgPrice, stdPrice),2)
while(price <= 0):
price = round(np.random.normal(avgPrice, stdPrice),2)
payload = buying(buyer, price, currentTime)
if(buyer[0] != "null" and len(buyer[0]) == 3):
counter = 0
while(counter < len(knownPeople)):
if(buyer[0][0] == knownPeople[counter][0]):
knownPeople[counter].append(payload["personID"])
knownPeople[counter].append(payload["name"])
knownPeople[counter].append(payload["lastname"])
break
counter += 1
print("Compra (Tienda) --> ", end='')
print(payload)
client.publish("Sambil/Tienda/Compra", json.dumps(payload), qos=0)
#People's Actions
def enteringMall(cameraID, currentTime):
gender = int(np.random.uniform(0, 2))
if(gender == 1):
gender = "M"
else:
gender = "F"
minAge = 0
if(cameraID == 4):
macAddress = queueDrivers.pop()
minAge = 18
elif(int(np.random.uniform(0,4)) != 1):
macAddress = str(getMacAddress())
minAge = 9
else:
macAddress = "null"
age = int(np.random.normal(35,15))
while((age < minAge) or (age > 90)):
age = int(np.random.normal(35,15))
correctData = False
while(not correctData):
personData = random.choice(dataPeople)
if(gender == personData["gender"]):
correctData = True
personID = getPersonID(age)
name = personData["first_name"]
lastname = personData["last_name"]
person = [macAddress,gender,age,personID,name,lastname]
payload = {
"cameraID": str(cameraID),
"gender": str(person[1]),
"age": str(person[2]),
"macAddress": str(person[0]),
"time": str(currentTime)
}
peopleInside.append(person)
if(macAddress != "null"):
knownPeople.append(person)
return payload
def leavingMall(cameraID, currentTime):
people = peopleInside[int(np.random.uniform(0, len(peopleInside)))]
counter = 0
hasACar = False
while(counter < len(parkingCars)):
print(parkingCars[counter])
if((people[0] == parkingCars[counter][1][0]) and (people[1] == parkingCars[counter][1][1]) and (people[2] == parkingCars[counter][1][2])):
hasACar = True
break
counter += 1
if(hasACar):
print(people)
currentTime = "null"
else:
peopleInside.remove(people)
payload = {
"cameraID": str(cameraID),
"macAddress": str(people[0]),
"time": str(currentTime)
}
return payload
def enteringMallAgain(cameraID, currentTime):
person = random.choice(knownPeople)
counter = 0
gettingKnownPeople = True
while(counter < len(peopleInside) or counter < len(peopleInStore) or counter < len(peopleSitting)):
if(counter < len(peopleInside)):
if(person[0] == peopleInside[counter][0]):
gettingKnownPeople = False
break
if(counter < len(peopleInStore)):
if(person[0] == peopleInStore[counter][0][0]):
gettingKnownPeople = False
break
if(counter < len(peopleSitting)):
if(person[0] == peopleSitting[counter][0][0]):
gettingKnownPeople = False
break
counter += 1
if(gettingKnownPeople):
peopleInside.append(person)
else:
currentTime = "null"
payload = {
"cameraID": str(cameraID),
"gender": str(person[1]),
"age": str(person[2]),
"macAddress": str(person[0]),
"time": str(currentTime)
}
return payload
def enteringStore(storeBeaconID):
beaconID = random.choice(storeBeaconID)
ran = int(np.random.uniform(0, len(peopleInside)))
storeUser = [peopleInside[ran], beaconID]
peopleInside.remove(storeUser[0])
peopleInStore.append(storeUser)
return storeUser
def leavingStore(client, currentTime):
storeUser = random.choice(peopleInStore)
#Possible sale before getting out
pubSales(client, storeUser, currentTime)
peopleInStore.remove(storeUser)
peopleInside.append(storeUser[0])
return storeUser
def buying(buyer, price, currentTime):
if(len(buyer[0])==3):
correctData = False
while(not correctData):
personData = random.choice(dataPeople)
if(buyer[0][1] == personData["gender"]):
correctData = True
age = buyer[0][2]
personID = getPersonID(age)
name = personData["first_name"]
lastname = personData["last_name"]
else:
personID = buyer[0][3]
name = buyer[0][4]
lastname = buyer[0][5]
#Case for random ID
if(int(np.random.uniform(0,1)) == 0):
randomPerson = random.choice(knownPeople)
counter = 0
inside = False
while(counter < len(peopleInside)):
if(randomPerson[0] == peopleInside[counter][0]):
inside = True
counter += 1
if(len(randomPerson) > 3 and (not inside)):
personID = randomPerson[3]
payload = {
"beaconID": str(buyer[1]),
"macAddress": str(buyer[0][0]),
"name": str(name),
"lastname": str(lastname),
"personID": str(personID),
"time": str(currentTime),
"price": str(price)
}
return payload
def sitting(tableBeaconID):
beaconID = random.choice(tableBeaconID)
ran = int(np.random.uniform(0, len(peopleInside)))
tableUser = [peopleInside[ran], beaconID]
peopleInside.remove(tableUser[0])
peopleSitting.append(tableUser)
return tableUser
def stadingUp():
tableUser = random.choice(peopleSitting)
peopleSitting.remove(tableUser)
peopleInside.append(tableUser[0])
return tableUser
def drivingIn(currentTime):
if(int(np.random.uniform(0,201)) != 0):
numberPlate = getNumberPlate()
else:
numberPlate = "null"
if(int(np.random.uniform(0,4)) != 1):
macAddress = str(getMacAddress())
else:
macAddress = "null"
parkingCars.append([numberPlate])
queueDrivers.append(macAddress)
payload = {
"numberPlate": str(numberPlate),
"macAddress": str(macAddress),
"time": str(currentTime)
}
return payload
def knownDrivingIn(currentTime):
print("Known people in car is coming")
newCar = False
if(np.random.uniform(0,4) != 0): #A person who already has come with a car
data = random.choice(knownCars)
person = []
counter = 0
while(counter < len(knownPeople)):
if(data[1][0] == knownPeople[counter][0]):
person = knownPeople[counter]
break
counter += 1
if(np.random.uniform(0,20)): #They could have another car
numberPlate = getNumberPlate()
newCar = True
else:
numberPlate = data[0]
else: #Probably hasn't come with its car... Yet
person = random.choice(knownPeople)
numberPlate = getNumberPlate()
newCar = True
gettingKnownPeople = True
while(counter < len(peopleInside) or counter < len(peopleInStore) or counter < len(peopleSitting)):
if(counter < len(peopleInside)):
if(person[0] == peopleInside[counter][0]):
gettingKnownPeople = False
break
if(counter < len(peopleInStore)):
if(person[0] == peopleInStore[counter][0][0]):
gettingKnownPeople = False
break
if(counter < len(peopleSitting)):
if(person[0] == peopleSitting[counter][0][0]):
gettingKnownPeople = False
break
counter += 1
payload = {
"numberPlate": str(numberPlate),
"macAddress": str(person[0]),
"time": str(currentTime)
}
ran = np.random.uniform(1,5)
currentTime += datetime.timedelta(minutes=ran)
payload2 = {
"cameraID": "4",
"gender": str(person[1]),
"age": str(person[2]),
"macAddress": str(person[0]),
"time": str(currentTime)
}
if(not gettingKnownPeople):
payload["time"] = "null"
personData = [payload, payload2, newCar]
return personData
def drivingOut(currentTime):
counterPeople = 0
person = []
dataInside = []
while(counterPeople < len(parkingCars)):
available = False
person = random.choice(parkingCars)
counter = 0
while(counter < len(peopleInside)):
if(person[1][0] == peopleInside[counter][0] and person[1][1] == peopleInside[counter][1] and person[1][2] == peopleInside[counter][2]):
dataInside = peopleInside[counter]
available = True
break
counter += 1
if(available):
break
counterPeople += 1
if(not available):
currentTime = "null"
else:
peopleInside.remove(dataInside)
parkingCars.remove(person)
payload = {
"cameraID": "4",
"macAddress": str(person[1][0]),
"time": str(currentTime)
}
if(currentTime != "null"):
ran = np.random.uniform(1,5)
currentTime += datetime.timedelta(minutes=ran)
payload2 = {
"numberPlate": str(person[0]),
"macAddress": str(person[1][0]),
"time": str(currentTime)
}
data = [payload, payload2]
return data
#Logical Methods
def getMacAddress():
macAddress = ""
counter = 0
while(counter < 12):
if(counter%2 != 1 and counter > 0):
macAddress += ":"
macAddress += str(random.choice('0123456789ABCDEF'))
counter += 1
return macAddress
def getPersonID(age):
if(age > 70):
personID = int(np.random.uniform(3000000,600000))
elif(age <= 70 and age >= 61):
personID = int(np.random.uniform(7000000,3000000))
elif(age <= 60 and age >= 51):
personID = int(np.random.uniform(9000000,7000000))
elif(age <= 50 and age >= 41):
personID = int(np.random.uniform(12000000,9000000))
elif(age <= 40 and age >= 31):
personID = int(np.random.uniform(15000000,12000000))
elif(age <= 30 and age >= 21):
personID = int(np.random.uniform(26000000,15000000))
elif(age <= 20 and age >= 16):
personID = int(np.random.uniform(30000000,26000000))
elif(age <= 15 and age >= 8):
personID = int(np.random.uniform(36000000,30000000))
else:
personID = 0
return personID
def getNumberPlate():
numberPlate = ""
counter = 0
while(counter < 7):
if(counter > 1 and counter < 5):
numberPlate += str(random.choice('0123456789'))
else:
numberPlate += str(random.choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ'))
counter += 1
return numberPlate
def getJsonData():
with open('database.json') as json_file:
data = json.load(json_file)
return data['nombres']
dataPeople = getJsonData()
#Query Methods
def queryNumAccess():
sql='''SELECT *
FROM public.camara;'''
df = pd.read_sql_query(sql, centrada)
camaras = df.count()[0]
print("cantidad de camaras "+ str(camaras))
return camaras
def queryStoreBeaconID():
sql='''select b."id" from beacon as b
inner join tienda as t on t."fkbeacon"=b."id"'''
df = pd.read_sql_query(sql, ctienda)
Lista = []
for index, row in df.iterrows():
Lista.insert(index, row["id"])
print(Lista)
return Lista
def queryTableBeaconID():
sql='''select b."id" from beacon as b
inner join mesa as mesa on mesa."fkbeacon"=b."id" '''
df = pd.read_sql_query(sql, cmesa)
Lista = []
for index, row in df.iterrows():
Lista.insert(index, row["id"])
print(Lista)
return Lista
def insertData(data):
with open('csvFiles/poll.csv','a', newline='') as csvfile:
filewriter = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL)
filewriter.writerow(['MacAddress', 'Name', 'Lastname', 'ID', 'Sex', 'Age'])
for person in data:
filewriter.writerow([person[0], person[4], person[5], person[3], person[1], person[2]])
def getDataFromDB():
sql = '''select count(e."id") Sales , DATE(e."fecha") as Date , e."fktienda" as StoreID, SUM(e.monto) as Amount from compra as e
group by Date, StoreID
order by Date desc'''
df = pd.read_sql_query(sql,ctienda)
print(df)
with open('csvFiles/sales.csv','a',newline='') as csvfile:
filewriter = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL)
filewriter.writerow(['Sales','StoreID','Date','Amount'])
dayCounter = 1
target = 1
for index, row in df.iterrows():
filewriter.writerow([row['sales'], row['storeid'], dayCounter, int(row['amount'])])
target += 1
if((index+1)%3 == 0):
dayCounter += 1
target = 1
if __name__ == "__main__":
main() | [
"luis.t1228@gmail.com"
] | luis.t1228@gmail.com |
1d57e49ce81e53f11eb64d0c4ec9979d84b5706d | d48c0d07c51d3bea16288b7450c8051efdcf0a94 | /libraries/rje_tree.py | b6077f2ce48d09cf34f9b08751407db273f38857 | [] | no_license | YasmineO/SLiMSuite | 68981451b142f9e11980ea5514b437a581fbce3a | 02944bd204a801e5d3e4b3a04364a1c72fe80f22 | refs/heads/master | 2020-03-27T18:04:55.534043 | 2018-07-02T05:28:31 | 2018-07-02T05:28:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 258,038 | py | #!/usr/bin/python
# rje_tree.py - Phylogenetic Tree module
# Copyright (C) 2007 Richard J. Edwards <redwards@cabbagesofdoom.co.uk>
#
# 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.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program; if not, write to
# the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Author contact: <redwards@cabbagesofdoom.co.uk> / 99 Wilton Road, Southampton SO15 5JH, UK.
#
# To incorporate this module into your own programs, please see GNU Lesser General Public License disclaimer in rje.py
"""
Module: rje_tree
Description: Phylogenetic Tree Module
Version: 2.16.1
Last Edit: 19/06/18
Copyright (C) 2007 Richard J. Edwards - See source code for GNU License Notice
Function:
Reads in, edits and outputs phylogenetic trees. Executes duplication and subfamily determination. More details available
in documentation for HAQESAC, GASP and BADASP at http://www.bioinformatics.rcsi.ie/~redwards/
General Commands:
nsfin=FILE : load NSF tree from FILE
phbin=FILE : load ClustalW Format *.phb NSF tree from FILE
seqin=FILE : load sequence list from FILE (not compatible with useanc)
disin=FILE : load distance matrix from FILE (Phylip format for use with distance matrix methods) [None]
useanc=FILE : load sequences from ancestral sequence FILE (not compatible with seqin)
deflen=X : Default length for branches when no lengths given [0.1] (or 0.1 x longest branch)
*Note that in the case of conflicts (e.g. seqin=FILE1 useanc=FILE2), the latter will be used.*
autoload=T/F : Whether to automatically load sequences upon initiating object [True]
Rooting Commands:
root=X : Rooting of tree (rje_tree.py):
- mid = midpoint root tree.
- ran = random branch.
- ranwt = random branch, weighted by branch lengths.
- man = always ask for rooting options (unless i<0).
- none = unrooted tree
- FILE = with seqs in FILE as outgroup. (Any option other than above)
rootbuffer=X : Min. distance from node for root placement (percentage of branch length)[0.1]
Grouping/Subfamily Commands:
bootcut=X : cut-off percentage of tree bootstraps for grouping.
mfs=X : minimum family size [3]
fam=X : minimum number of families (If 0, no subfam grouping) [0]
orphan=T/F : Whether orphans sequences (not in subfam) allowed. [True]
allowvar=T/F: Allow variants of same species within a group. [False]
qryvar=T/F : Keep variants of query species within a group (over-rides allowvar=F). [False]
groupspec=X : Species for duplication grouping [None]
specdup=X : Minimum number of different species in clade to be identified as a duplication [1]
9spec=T/F : Whether to treat 9XXXX species codes as actual species (generally higher taxa) [False]
group=X : Grouping of tree
- man = manual grouping (unless i<0).
- dup = duplication (all species unless groupspec specified).
- qry = duplication with species of Query sequence (or Sequence 1) of treeseq
- one = all sequences in one group
- None = no group (case sensitive)
- FILE = load groups from file
Tree Making Commands:
cwtree=FILE : Make a ClustalW NJ Tree from FILE (will save *.ph or *.phb) [None]
kimura=T/F : Whether to use Kimura correction for multiple hits [True]
bootstraps=X : Number of bootstraps [0]
clustalw=CMD : Path to CLUSTALW (and including) program [''] * Use forward slashes (/)
fasttree=PATH : Path to FastTree (and including) program ['']
iqtree=FULLPATH : Path IQTree program including program ['iqtree']
phylip=PATH : Path to PHYLIP programs [''] * Use forward slashes (/)
phyoptions=FILE : File containing extra Phylip tree-making options ('batch running') to use [None]
protdist=FILE : File containing extra Phylip PROTDIST options ('batch running') to use [None]
maketree=X : Program for making tree [None]
- None = Do not make tree from sequences
- clustalw = ClustalW NJ method
- neighbor = PHYLIP NJ method
- upgma = PHYLIP UPGMA (neighbor) method
- fitch = PHYLIP Fitch method
- kitsch = PHYLIP Kitsch (clock) method
- protpars = PHYLIP MP method
- proml = PHYLIP ML method
- fasttree = Use FastTree
- iqtree = Use IQTree
- PATH = Alternatively, a path to a different tree program/script can be given. This should accept ClustalW parameters.
Tree Display/Saving Commands
savetree=FILE : Save a generated tree as FILE [seqin.maketree.nsf]
savetype=X : Format for generated tree file (nsf/nwk/text/r/png/bud/qspec/cairo/te/svg/html) [nwk]
treeformats=LIST: List of output formats for generated trees [nwk]
outnames=X : 'short'/'long' names in output file [short]
truncnames=X : Truncate names to X characters (0 for no truncation) [123]
branchlen=T/F : Whether to use branch lengths in output tree [True]
deflen=X : Default branch length (when none given, also for tree scaling) [0.1]
textscale=X : Default scale for text trees (no. of characters per deflen distance) [4]
seqnum=T/F : Output sequence numbers (if making tree from sequences) [True]
Classes:
Tree(rje.RJE_Object):
- Phylogenetic Tree class.
Node(rje.RJE_Object):
- Individual nodes (internal and leaves) for Tree object.
Branch(rje.RJE_Object):
- Individual branches for Tree object.
Uses general modules: copy, os, random, re, string, sys, time
Uses RJE modules: rje, rje_ancseq, rje_seq, rje_tree_group
Other module needed: rje_blast, rje_dismatrix, rje_pam, rje_sequence, rje_uniprot
"""
#########################################################################################################################
### SECTION I: GENERAL SETUP & PROGRAM DETAILS #
#########################################################################################################################
import copy, glob, os, random, re, string, sys, time
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)),'../libraries/'))
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)),'../tools/'))
### User modules - remember to add *.__doc__ to cmdHelp() below ###
import rje, rje_ancseq, rje_html, rje_seq, rje_svg, rje_tree_group
#########################################################################################################################
def history(): ### Program History - only a method for PythonWin collapsing! ###
'''
# 0.0 - Initial Compilation.
# 0.1 - Changed CladeList to lists inside tuple
# 0.2 - Completely reworked with a much greater OO focus
# 0.3 - No Out Object in Objects
# 1.0 - Better
# 1.1 - Added tree-drawing with ClustalW
# 1.2 - Bug fixing.
# 1.3 - Added separate maketree=PATH command to enable replacement of ClustalW tree drawing
# 1.4 - Added toggling of full sequence description in TextTree/EditTree
# 1.5 - Added ability to read in integer branch lengths
# 1.6 - Added PHYLIP tree making
# 1.7 - Modified text/log output. Added commandline scale option for text trees.
# 1.8 - Updating reporting of redundant duplication finding.
# 1.9 - Modified mapSeq() method to be more robust to different formats
# 1.10- Fixed some bugs and had a minor tidy.
# 2.0 - Updated code to be more inline with newer RJE modules. Fixed some bugs.
# 2.1 - Added tree savetype
# 2.2 - Added treeformats=LIST option to eventually replace savetype. Added te (TreeExplorer) format.
# 2.3 - Added specdup=X : Minimum number of different species in clade to be identified as a duplication [1]
# 2.4 - Added fasttree generation of trees.
# 2.5 - Added qryvar=T/F : Allow variants of query species within a group (over-rides allowvar=F). [False]
# 2.6 - Added PNG R variants.
# 2.7 - Added Improved NSF Tree reading.
# 2.8 - Added SVG and HTML Tree output.
# 2.9 - Added NWK output (=NSF output with different extension for MEGA!)
# 2.10- Added cleanup of *.r.csv file following R-based PNG generation.
# 2.11.0 - Modified for standalone running as part of SeqSuite.
# 2.11.1 - Tweaked QryVar interactivity.
# 2.11.2 - Updated tree paths.
# 2.12.0 - Added treeLen() method.
# 2.13.0 - Updated PNG saving with R to use newer code.
# 2.14.0 - Added cladeSpec().
# 2.14.1 - Fixed clustalw2 makeTree issue.
# 2.15.0 - Added IQTree.
# 2.16.0 - 9spec=T/F : Whether to treat 9XXXX species codes as actual species (generally higher taxa) [False]
# 2.16.1 - Modified NSF reading to cope with extra information beyond the ";".
'''
#########################################################################################################################
def todo(): ### Major Functionality to Add - only a method for PythonWin collapsing! ###
'''
# [y] Interactive menus for module and major activities
# [y] read in from files*
# [y] re-root/unroot as desired* (midpoint/random/outgroup/manual)
# [y] save to files
# [y] output text tree
# [y] prune (remove/compress leaves/clades)
# [ ] Add option for combining sequences (into a consensus?) - manipulates treeseqs object?
# [ ] .. Also replace clade with ancestral sequence (GASP)
# [y] identify duplications
# [y] establish subfamilies/groups
# [y] .. group=X commandline option
# [ ] .. Modify Load Groups to allow both pure and fuzzy mapping (allows for some homoplasy?)
# [Y] make trees from sequences
# [Y] - CW NJ tree (as HAQESAC)
# [ ] - Add different formats of distance matrix for disin=FILE
# [ ] - distance matrix methods in SeqList class
# [ ] .. Add UPGMA generation from aligned sequences?
# [y] Tidy and __doc__ all methods
# [y] Load ancestral sequences
# [Y] Add a scale commandline option for textTrees
# [ ] Add amino acid probabilities to nodes (for anc seq reconstruction)
# [ ] Add better Exception trapping and check use of interactive and verbose settings.
# [ ] Add a treein=X argument - will determine format from extension
# [ ] Improve handling of duplication calculation - store status in self.opt and change only if pruned or rooting changed
# [ ] Upgrade AncMapSeq to match modified MapSeq
# [ ] Give module complete facelift in line with other modules! (Use list and dict attribute dictionaries.)
# [ ] Sort out problem of multiple dup finding
# [ ] Add MrBayes for making trees
# [ ] Phase out savetype in favour of treeformats
'''
#########################################################################################################################
def makeInfo(): ### Makes Info object
'''Makes rje.Info object for program.'''
(program, version, last_edit, cyear) = ('RJE_TREE', '2.16.1', 'June 2018', '2007')
description = 'RJE Phylogenetic Tree Module'
author = 'Dr Richard J. Edwards.'
comments = []
return rje.Info(program,version,last_edit,description,author,time.time(),cyear,comments)
#########################################################################################################################
def cmdHelp(info=None,out=None,cmd_list=[]): ### Prints *.__doc__ and asks for more sys.argv commands
'''Prints *.__doc__ and asks for more sys.argv commands.'''
try:
if not info: info = makeInfo()
if not out: out = rje.Out()
helpx = cmd_list.count('help') + cmd_list.count('-help') + cmd_list.count('-h')
if helpx > 0:
print '\n\nHelp for %s %s: %s\n' % (info.program, info.version, time.asctime(time.localtime(info.start_time)))
out.verbose(-1,4,text=__doc__)
if rje.yesNo('Show general commandline options?'): out.verbose(-1,4,text=rje.__doc__)
if rje.yesNo('Quit?'): sys.exit()
cmd_list += rje.inputCmds(out,cmd_list)
elif out.stat['Interactive'] > 1: cmd_list += rje.inputCmds(out,cmd_list) # Ask for more commands
return cmd_list
except SystemExit: sys.exit()
except KeyboardInterrupt: sys.exit()
except: print 'Major Problem with cmdHelp()'
#########################################################################################################################
def setupProgram(): ### Basic Setup of Program
'''
Basic setup of Program:
- Reads sys.argv and augments if appropriate
- Makes Info, Out and Log objects
- Returns [info,out,log,cmd_list]
'''
try:
### Initial Command Setup & Info ###
info = makeInfo()
cmd_list = rje.getCmdList(sys.argv[1:],info=info) ### Load defaults from program.ini
### Out object ###
out = rje.Out(cmd_list=cmd_list)
out.verbose(2,2,cmd_list,1)
out.printIntro(info)
### Additional commands ###
cmd_list = cmdHelp(info,out,cmd_list)
### Log ###
log = rje.setLog(info=info,out=out,cmd_list=cmd_list)
return [info,out,log,cmd_list]
except SystemExit: sys.exit()
except KeyboardInterrupt: sys.exit()
except:
print 'Problem during initial setup.'
raise
#########################################################################################################################
treeformats = {'nsf':'Newick Standard Format (NSF)','text':'Plain text','r':'table for R PNG maker',
'png':'Portable Network Graphic (PNG)','te':'TreeExplorer-compatible NSF',
'nwk':'Newick Standard Format (MEGA compatible)',
'te.nsf':'TreeExplorer-compatible NSF','qspec':'PNG with query species highlighted',
'bud':'PNG graphic for BUDAPEST runs','Cairo':'PNG using R with Cairo library',
'svg':'Support Vector Graphic (SVG)','html':'Support Vector Graphic (SVG) embedded in HTML'}
formatext = {'nsf':'nsf','text':'tree.txt','r':'r','png':'png','te':'te.nsf','bud':'png','cairo':'png','svg':'svg',
'html':'htm','te.nsf':'te.nsf','qspec':'png','nwk':'nwk'}
#########################################################################################################################
def treeName(name,nospace=False): ### Reformats name to be OK in NSF file
'''Reformats name to be OK in NSF file.'''
rep = name[0:]
rep = re.sub(',',' -',rep)
if nospace: rep = re.sub('\s','_',rep)
rep = re.sub('[\(\[]','{',rep)
rep = re.sub('[\)\]]','}',rep)
rep = re.sub('[:;]','-',rep)
return rep
#########################################################################################################################
### END OF SECTION I #
#########################################################################################################################
### ~ ### ~ ###
#########################################################################################################################
### SECTION II: Tree Class #
#########################################################################################################################
class Tree(rje.RJE_Object): ### Class for handling phylogenetic trees.
'''
Phylogenetic Tree class. Author: Rich Edwards (2005).
Info:str
- Name = Name of tree (usually filename)
- Type = Method of construction (if known)
- Rooting = Rooting strategy [man]
- RootMethod = Method used to determine root
- GroupSpecies = Species to be used for Grouping
- Grouping = Method used to determine groups
- ClustalW = Path to ClustalW
- Phylip = Path to PHYLIP programs ['c:/bioware/phylip3.65/exe/'] * Use forward slashes (/)
- PhyOptions = File containing extra Phylip options ('batch running') to use [None]
- ProtDist = File containing extra Phylip PROTDIST ('batch running') to use [None]
- MakeTree = Tree drawing program (ClustalW options)
- CWTree = Whether to use ClustalW NJ to make tree in self.makeTree()
- FastTree = Path to FastTree (and including) program [./FastTree]
- DisIn = load distance matrix from FILE (for use with distance matrix methods) [None]
- SaveTree = Save a generated tree as FILE [None]
- SaveType = Format for generated tree file (nsf/text/r/png/bud/cairo) [nsf]
- OutNames = 'short'/'long' names in output file [short]
- IQTree = Path IQTree program including program ['iqtree']
Opt:boolean
- Rooted = Whether tree is rooted
- ReRooted = Whether tree has had its root altered
- Branchlengths = Whether tree has branchlengths
- Bootstrapped = Whether tree has bootstraps
- QueryGroup = Group using specified Query Species
- Orphans = Whether 'orphan' sequences allowed
- AllowVar = Allow variants of same species within a group. [False]
- QryVar = Allow variants of query species within a group (over-rides allowvar=F). [False]
- Kimura = Whether to use Kimura multiple hit correction
- OutputBranchLen = Whether to use branch lengths in output tree [True]
- AutoLoad = Whether to automatically load sequences upon initiating object [True]
- SeqNum = Output sequence numbers for general make tree thing [True]
- 9SPEC=T/F : Whether to treat 9XXXX species codes as actual species (generally higher taxa) [False]
Stat:numeric
- DefLen = Default length for branches when no lengths given [0.1]
- TextScale = Default scale for text trees (no. of characters per deflen distance) [4]
- RootBuffer = Min. distance from node for root placement (percentage of branch length)[0.1]
- SeqNum = Number of seqs (termini)
- Bootstraps = Number of bootstraps (if known)
- BootCut = cut-off percentage of tree bootstraps for grouping.
- MinFamSize = minimum family size [2]
- MinFamNum : minfamnum = 0 # minimum number of families (If 0, no subfam grouping)
- SpecDup = Minimum number of different species in clade to be identified as a duplication [1]
- TruncNames = Truncate names to X characters (0 for no truncation) [123]
List:list
- TreeFormats = List of output formats for generated trees [nsf]
Dict:dictionary
Obj:RJE_Objects
- SeqList = rje_seq.SeqList object
- PAM = rje_pam.PamCtrl object
Other:
- node = List of Node Objects
- branch = List of Branch Objects
- subfam = List of Node Objects that specifiy subgroup clades
Additional Commands:
- nsfin=FILE = load NSF tree from FILE
'''
### Additional Attributes
node = [] # List of Node Objects
branch = [] # List of Branch Objects
subfam = [] # List of Node Objects that form subfamily clades
#########################################################################################################################
### <0> ### Basic Attribute methods #
#########################################################################################################################
def groupNum(self): return len(self.subfams())
def nodeNum(self): return len(self.nodes())
def branchNum(self): return len(self.branches())
#########################################################################################################################
def nodes(self): return self.node # At some point, make a self.list['Node']
def branches(self): return self.branch # At some point, make a self.list['Branch']
def subfams(self): return self.subfam # At some point, make a self.list['SubFam']
#########################################################################################################################
def seqNum(self):
if self.obj['SeqList']: return self.obj['SeqList'].seqNum()
elif self.opt['Rooted']: return int((self.nodeNum() + 1.0) / 2)
else: return int((self.nodeNum() + 2.0) / 2)
#########################################################################################################################
### <1> ### Class Initiation etc.: sets attributes #
#########################################################################################################################
def _setAttributes(self): ### Sets Attributes of Object
'''Sets Attributes of Object.'''
### Basics ###
self.infolist = ['Name','Type','Rooting','RootMethod','GroupSpecies','Grouping','ClustalW','Phylip','PhyOptions',
'ProtDist','CWTree','MakeTree','DisIn','SaveTree','OutNames','SaveType','FastTree','IQTree']
self.statlist = ['DefLen','RootBuffer','SeqNum','Bootstraps','BootCut','MinFamSize','MinFamNum','TruncNames',
'TextScale','SpecDup']
self.optlist = ['Rooted','ReRooted','Branchlengths','Bootstrapped','QueryGroup','Orphans','AllowVar','Kimura',
'OutputBranchLen','AutoLoad','SeqNum','QryVar','9SPEC']
self.listlist = ['TreeFormats']
self.dictlist = []
self.objlist = ['SeqList','PAM']
### Defaults ###
self._setDefaults(info='None',opt=False,stat=0.0,obj=None,setlist=True,setdict=True)
self.setInfo({'Type':'Unknown','Rooting':'man','ClustalW':'',
'Phylip':'','OutNames':'short','SaveType':'nwk',
'FastTree':'','IQTree':'iqtree'})
self.setStat({'DefLen':0.1,'TextScale':4,'RootBuffer':0.1,'BootCut':0.7,'MinFamSize':3,'TruncNames':123,'SpecDup':1})
self.setOpt({'Orphans':True,'Kimura':True,'OutputBranchLen':True,'AutoLoad':True,'SeqNum':False,'9SPEC':False})
self.list['TreeFormats'] = ['nwk']
self.obj['SeqList'] = None
### Other Attributes ###
self.node = [] # List of Node Objects
self.branch = [] # List of Branch Objects
self.subfam = [] # List of Node Objects specifiying subfamilies
#########################################################################################################################
def _cmdList(self): ### Sets Attributes from commandline
'''
Sets attributes according to commandline parameters:
- see .__doc__ or run with 'help' option
'''
### ~ [0] ~ Setup Parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
seqfile = None
ancseq = None
### ~ [1] ~ Read commands ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
for cmd in self.cmd_list:
try:## ~ [1a] ~ General Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
self._generalCmd(cmd)
## ~ [1b] Normal Class Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
self._cmdRead(cmd,type='info',att='Rooting',arg='root')
self._cmdReadList(cmd,'stat',['DefLen','TextScale','RootBuffer','BootCut'])
self._cmdReadList(cmd,'int',['MinFamSize','MinFamNum','Bootstraps','TruncNames','SpecDup'])
self._cmdRead(cmd,type='int',att='MinFamSize',arg='mfs')
self._cmdRead(cmd,type='int',att='MinFamNum',arg='fam')
self._cmdRead(cmd,type='opt',att='Orphans',arg='orphan')
self._cmdReadList(cmd,'opt',['Orphans','AllowVar','Kimura','AutoLoad','SeqNum','QryVar','9SPEC'])
self._cmdRead(cmd,type='info',att='Grouping',arg='group')
self._cmdRead(cmd,type='info',att='GroupSpecies',arg='groupspec')
self._cmdReadList(cmd,'file',['CWTree','ClustalW','PhyOptions','ProtDist','MakeTree','DisIn','SaveTree','FastTree','IQTree'])
self._cmdRead(cmd,type='path',att='Phylip')
self._cmdRead(cmd,type='int',att='Bootstraps',arg='bootstrap')
self._cmdReadList(cmd,'info',['OutNames','SaveType'])
self._cmdRead(cmd,type='opt',att='OutputBranchLen',arg='branchlen')
self._cmdReadList(cmd,'list',['TreeFormats'])
## ~ [1c] ~ Special ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
if cmd.find('seqin=') == 0:
seqfile = cmd[len('seqin='):]
ancseq = None
if cmd.find('useanc=') == 0:
ancseq = cmd[len('useanc='):]
seqfile = None
self._cmdRead(cmd,type='file',att='Name',arg='nsfin')
self._cmdRead(cmd,type='file',att='Name',arg='phbin')
except:
self.log.errorLog('Problem with cmd:%s' % cmd)
### ~ [2] ~ Adjustments ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
self.info['SaveType'] = self.info['SaveType'].lower()
self.list['TreeFormats'] = [self.info['SaveType']] + string.split(string.join(self.list['TreeFormats']).lower())
for format in self.list['TreeFormats'][0:]:
if format not in treeformats or self.list['TreeFormats'].count(format) > 1: self.list['TreeFormats'].remove(format)
if self.info['SaveTree'] in ['','none'] and self.list['TreeFormats'] and self.info['Basefile'].lower() not in ['','none']:
self.info['SaveTree'] = '%s.%s' % (self.info['Basefile'],self.list['TreeFormats'][0])
if self.info['CWTree'] != 'None':
seqfile = self.info['CWTree']
self.info['MakeTree'] = 'clustalw'
### ~ [3] ~ Actions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
if not self.opt['AutoLoad']: return
if seqfile and seqfile.lower() != 'none':
self.obj['SeqList'] = rje_seq.SeqList(log=self.log,cmd_list=self.cmd_list+['seqin=%s' % seqfile])
if (self.obj['SeqList'] or self.info['DisIn'].lower() != 'none') and self.info['MakeTree'] != 'None':
self.makeTree(make_seq=self.obj['SeqList'])
#ltype = self.makeTree()
#self.loadTree(file=self.info['Name'],seqlist=treeseq,type=ltype)
if self.opt['OutputBranchLen']: withbranchlengths = 'Length'
else: withbranchlengths = 'none'
outnames = self.info['OutNames']
maxnamelen = self.stat['TruncNames']
self.saveTrees(seqname=outnames,blen=withbranchlengths)
#if self.obj['SeqList']: self.saveTree(seqnum=self.opt['SeqNum'],type=self.info['SaveType'],seqname=outnames,maxnamelen=maxnamelen,blen=withbranchlengths)
#else: self.saveTree(seqnum=False,type=self.info['SaveType'],seqname=outnames,maxnamelen=maxnamelen,blen=withbranchlengths)
#x#if self.opt['SoapLab']: self.rTree('output.png',seqname=outnames,blen=withbranchlengths,compress=False)
elif self.info['Name'] != 'None':
if 'phbin=%s' % self.info['Name'] in self.cmd_list:
self.loadTree(file=self.info['Name'],seqlist=self.obj['SeqList'],type='phb')
else: self.loadTree(file=self.info['Name'],seqlist=self.obj['SeqList'])
if self.info['SaveTree'].lower() not in ['','none'] or self.list['TreeFormats']:
if self.opt['OutputBranchLen']: withbranchlengths = 'Length'
else: withbranchlengths = 'none'
outnames = self.info['OutNames']
maxnamelen = self.stat['TruncNames']
if self.getStrLC('SaveTree'): self.info['Basefile'] = rje.baseFile(self.info['SaveTree'])
else: self.info['Basefile'] = rje.baseFile(self.info['Name'])
self.saveTrees(seqname=outnames,blen=withbranchlengths)
#if self.obj['SeqList']:
# self.saveTree(seqnum=self.opt['SeqNum'],type=self.info['SaveType'],seqname=outnames,maxnamelen=maxnamelen,blen=withbranchlengths)
#else: self.saveTree(seqnum=False,type=self.info['SaveType'],seqname=outnames,maxnamelen=maxnamelen,blen=withbranchlengths)
if ancseq and ancseq.lower() != 'none': self.mapAncSeq(ancseq)
if self.info['Grouping'] != 'None' and self.obj['SeqList']: self._autoGroups(self.info['Grouping'])
#########################################################################################################################
def _cutCmdList(self,cmds=None): ### Sets reduced Attribute set from commandline
'''
Sets attributes according to commandline parameters:
- see .__doc__ or run with 'help' option
'''
### ~ [0] ~ Setup Parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
if cmds == None: cmds = self.cmd_list
### ~ [1] ~ Read commands ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
for cmd in cmds:
try:## ~ [1a] ~ General Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
self._cmdRead(cmd,type='info',att='Rooting',arg='root')
self._cmdReadList(cmd,'stat',['DefLen','TextScale','RootBuffer','BootCut'])
self._cmdReadList(cmd,'int',['MinFamSize','MinFamNum','Bootstraps','TruncNames','SpecDup'])
self._cmdRead(cmd,type='int',att='MinFamSize',arg='mfs')
self._cmdRead(cmd,type='int',att='MinFamNum',arg='fam')
self._cmdRead(cmd,type='opt',att='Orphans',arg='orphan')
self._cmdReadList(cmd,'opt',['Orphans','AllowVar','QryVar'])
self._cmdRead(cmd,type='info',att='Grouping',arg='group')
self._cmdRead(cmd,type='info',att='GroupSpecies',arg='groupspec')
self._cmdRead(cmd,type='int',att='Bootstraps',arg='bootstrap')
self._cmdReadList(cmd,'info',['OutNames','SaveType'])
self._cmdRead(cmd,type='opt',att='OutputBranchLen',arg='branchlen')
self._cmdReadList(cmd,'list',['TreeFormats'])
except: self.log.errorLog('Problem with cmd:%s' % cmd)
#########################################################################################################################
### <2> ### Tree Reading/Building #
### => Read from various formats and convert to NSF string with branch lengths (these may be arbitrary) #
### => NSF string is then processed to tree #
#########################################################################################################################
def run(self): ### Main run method
'''Main run method.'''
try:### [0] Basic run options handled in self._cmdList(). ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
if self.i() >= 0: treeMenu(self,self.log,self.cmd_list,self)
except: self.errorLog('Error during Tree.run()')
#########################################################################################################################
def loadTree(self,file='tree',type='nsf',boot=0,seqlist=None,postprocess=True): ### Loads trees from saved files
'''
Calls appropriate method to load a tree from a certain format of file.
>> file:str ['tree'] = filename
>> type:str ['nsf'] = Type of file (e.g. nsf)
- 'nsf' = Newick Standard Format
- 'phb' = Newick Standard Format from ClustalW
- 'sim' = build from *.sim.anc.fas file of GASP test simulation data
>> boot:int [0] = number of bootstraps, if important (0 = ignore bootstraps)
>> seqlist:SeqList object to map onto tree
>> postprocess:boolean = Whether to re-root tree and identify duplications [True]
'''
self.stat['Bootstraps'] = boot
self.info['Name'] = file
self.node = []
self.branch = []
if type == 'sim':
self.verbose(0,0,'treeFromSim() currently not implemented. Sorry.',1)
raise ValueError #X# self.treeFromSim(file)
nsftree = self.treeFromNSF(file)
self.log.printLog('#TREE','Loaded %s tree data from %s.' % (type,file))
self.verbose(1,3,'\nTree: %s' % nsftree,2)
self.buildTree(nsftree,seqlist,type=type,postprocess=postprocess)
#########################################################################################################################
def treeFromNSF(self,nsf_file): ### Reads tree from NSF file and returns nsftree
'''
Reads from Newick Standard Format file and returns NSF tree.
* NOTE: whitespace is removed - do not have whitespace in sequence names
>> nsf_file:str = filename
<< nsftree:str
'''
### ~ [1] ~ Open file & Read Lines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
file_lines = self.loadFromFile(filename=nsf_file,v=0,checkpath=False,chomplines=True)
if not file_lines: raise ValueError
### ~ [2] ~ Remove whitespace and return ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
multi_seq_per_line = False
for line in file_lines:
if line.count(':') > 1: multi_seq_per_line = True; break
if multi_seq_per_line: return string.join(string.split(string.join(file_lines)),'')
nsftree = ''
for line in file_lines:
if line.find(':') > 0:
start = string.split(string.replace(line,':',' '))[0]
end = string.split(line,':')[-1]
nsftree += '%s:%s' % (start,end)
#self.deBug(nsftree)
else: nsftree += line
nsftree = nsftree[:nsftree.find(';')+1]
#self.deBug(nsftree)
return nsftree
#########################################################################################################################
def buildTree(self,nsftree,seqlist=None,type='nsf',postprocess=True): ### Builds Tree Object from nsf string
'''
Builds tree from NSF string.
>> nsftree:str = Newick Standard Format tree
>> seqlist:SeqList object to map onto tree
>> type:str = Type (Format) of tree
>> postprocess:boolean = Whether to re-root tree and identify duplications [True]
'''
try:
### <a> ### Determine attributes of tree
_stage = '<a> Determination of tree attributes'
## <i> ## Sequence names
seqnames = False # Whether sequence names (as opposed to numbers) are used in tree
re_txtname = re.compile('[A-Za-z]')
if re_txtname.search(nsftree):
seqnames = True
## <ii> ## Branchlengths
nsftree = self.reformatIntegerBranchLengths(nsftree)
re_branchlength = re.compile(':(\-?\d+\.\d+)[,\)\[]')
if re_branchlength.search(nsftree):
self.opt['Branchlengths'] = True
## <iii> ## Bootstraps
myboot = self.stat['Bootstraps'] # Empirical number of bootstraps
if (type != 'phb' and re.search('\)\d+',nsftree)) or (type == 'phb' and re.search('\[\d+\][,\)]',nsftree)):
self.opt['Bootstrapped'] = True
except:
self.verbose(0,3,nsftree,1)
self.log.errorLog('Problem with BuildTree(%s).' % _stage)
raise
### <b> ### Read in terminal branches and nodes to leave numbers only
_stage = '<b> Read termini'
self.node = []
self.branch = []
try:
## <i> ## Make RE pattern
if self.opt['Branchlengths']:
re_tipre = '([\(,])([=<>\w\.\'\#\-\/\[\]\{\}]+):(\-?\d+\.\d+)([,\)])'
re_tipre = '([\(,])([^\(\),:]+):(\-?\d+\.\d+)([,\)])'
else:
re_tipre = '([\(,])([=<>\w\.\'\#\-\/\[\]\{\}]+)([,\)])'
re_tipre = '([\(,])([^\(\),:]+)([,\)])'
re_tip = re.compile(re_tipre)
#self.deBug(nsftree)
#self.deBug(re_tipre)
#self.deBug(rje.matchExp(re_tipre,nsftree))
## <ii> ## Replacements
tmptree = '%s' % nsftree
self.stat['SeqNum'] = 0
while re_tip.search(tmptree):
m_tip = re_tip.search(tmptree)
n_tip = m_tip.groups()
name = n_tip[1]
blen = self.stat['DefLen']
if self.opt['Branchlengths']:
blen = float(n_tip[2])
deltxt = m_tip.group()[:-1] + m_tip.group()[-1]
tmptree = rje.strReplace(tmptree,deltxt,n_tip[0] + n_tip[-1])[0]
nsftree = rje.strReplace(nsftree,deltxt,n_tip[0] + '%d' % self.stat['SeqNum'] + n_tip[-1])[0]
#self.deBug(nsftree)
## <iii> ## New node and branch
newnode = Node(log=self.log,cmd_list=self.cmd_list)
newnode.info['Name'] = name
newnode.stat['ID'] = self.stat['SeqNum']
newbranch = Branch(log=self.log,cmd_list=self.cmd_list)
newbranch.stat['Length'] = blen
newbranch.node = [newnode]
self.node.append(newnode)
newnode.branch = [newbranch]
self.branch.append(newbranch)
self.stat['SeqNum'] += 1
## <iv> ## Check treeseq matches seqnum
self.log.printLog('#SEQ','%d sequences in Tree.' % self.stat['SeqNum'])
#self.debugTree()
self.verbose(2,3,nsftree,2)
except:
self.verbose(0,3,nsftree,1)
self.verbose(0,3,tmptree,1)
self.log.errorLog('Problem with reading terminal nodes.')
raise
### Now have a tree with termini as numbers only
### <c> ### Build internal nodes and branches
try:
## <i> ## Make RE pattern
if self.opt['Branchlengths']:
if type == 'phb':
re_clade = re.compile('\((\d+),(\d+)\):(\-?\d+\.\d+)\[*(\d*)\]*[,\)]')
else:
re_clade = re.compile('\((\d+),(\d+)\)([\.\d]*):(\-?\d+\.\d+)[,\)]')
else:
if type == 'phb':
re_clade = re.compile('\((\d+),(\d+)\)\[*(\d*)\]*[,\)]')
else:
re_clade = re.compile('\((\d+),(\d+)\)([\.\d]*)[,\)]')
## <ii> ## Search and replace
nodex = self.stat['SeqNum']
while re_clade.search(nsftree):
m_clade = re_clade.search(nsftree)
n_clade = m_clade.groups()
if type == 'phb': n_clade = [n_clade[0],n_clade[1],n_clade[-1],n_clade[2]]
n0 = int(n_clade[0])
n1 = int(n_clade[1])
if self.opt['Bootstrapped']:
try:
if '.' in n_clade[2]: boot = int(self.stat['Bootstraps']*string.atof(n_clade[2])+0.5)
else: boot = string.atoi(n_clade[2])
except: boot = 0
myboot = self._maxBoot(boot,myboot)
else: boot = -1
blen = self.stat['DefLen']
if self.opt['Branchlengths']:
blen = float(n_clade[3])
deltxt = '\\' + m_clade.group()[:-1]
deltxt = re.sub('\)','\\)',deltxt)
deltxt = re.sub('\]','\\]',deltxt)
deltxt = re.sub('\[','\\[',deltxt)
nsftree = re.sub(deltxt, '%d' % nodex, nsftree)
## <iii> ## New nodes and branches
newnode = Node(log=self.log,cmd_list=self.cmd_list)
newnode.info['Name'] = 'Node %d (%d,%d)' % (nodex+1,n0+1,n1+1)
newnode.stat['ID'] = nodex
newbranch = Branch(log=self.log,cmd_list=self.cmd_list)
newbranch.stat['Length'] = blen
if self.opt['Bootstrapped']:
newbranch.stat['Bootstrap'] = boot
newbranch.node = [newnode]
self.node.append(newnode)
self.branch.append(newbranch)
newnode.branch = [self.branch[n0],self.branch[n1],newbranch]
## <iv> ## Existing nodes and branches
self.branch[n0].node.append(newnode)
self.branch[n1].node.append(newnode)
if int(self.branch[n0].node[0].stat['ID']) != n0 or int(self.branch[n1].node[0].stat['ID']) != n1:
self.log.errorLog('List index problems during Tree Build!',printerror=False)
raise ValueError
nodex += 1
#self.deBug(nsftree)
self.verbose(1,3,"%d nodes in Tree. " % (nodex+1),0)
#x#self.debugTree()
self.stat['Bootstraps'] = myboot
for s in range(self.stat['SeqNum']): self.branch[s].stat['Bootstrap'] = myboot
except:
self.verbose(0,3,nsftree,1)
self.log.errorLog('Problem with reading internal nodes.')
raise
### <d> ### Add root or trichotomy
try:
## <i> ## Rooting Status
re_last = re.compile('\((\d+),(\d+),(\d+)\)')
re_root = re.compile('\((\d+),(\d+)\)')
if re_last.search(nsftree): # Trichotomy
self.opt['Rooted'] = False
elif re_root.search(nsftree): # Rooted
self.info['RootMethod'] = 'Loaded'
self.opt['Rooted'] = True
re_last = re_root
else:
self.log.errorLog("Problem with tree formatting. %s remains." % nsftree,printerror=False)
raise ValueError
#self.deBug(nsftree)
## <ii> ## Add node
m_last = re_last.search(nsftree)
n_last = m_last.groups()
n0 = int(n_last[0])
n1 = int(n_last[1])
n2 = int(n_last[-1])
newnode = Node(log=self.log,cmd_list=self.cmd_list)
newnode.stat['ID'] = nodex
## <iii> ## Existing nodes and branches
self.branch[n0].node.append(newnode)
self.branch[n1].node.append(newnode)
if self.opt['Rooted']:
newnode.branch = [self.branch[n0],self.branch[n1]]
self.verbose(0,3,'(Rooted)',1)
newnode.info['Name'] = 'Root Node %d (%d,%d)' % (nodex+1,n0+1,n1+1)
else:
newnode.branch = [self.branch[n0],self.branch[n1],self.branch[n2]]
self.branch[n2].node.append(newnode)
self.verbose(0,3,'(Unrooted)',1)
newnode.info['Name'] = 'Node %d (%d,%d,%d)' % (nodex+1,n0+1,n1+1,n2+1)
self.node.append(newnode)
if int(self.branch[n0].node[0].stat['ID']) != n0 or int(self.branch[n1].node[0].stat['ID']) != n1 or int(self.branch[n2].node[0].stat['ID']) != n2:
self.log.errorLog('List index problems during Tree Build!', False, False)
raise ValueError
nodex+=1
#X#self.debugTree()
if len(self.node) != nodex or len(self.branch) != (nodex-1):
self.log.errorLog('List size problems during Tree Build!',printerror=False)
raise ValueError
except:
self.verbose(0,3,nsftree,1)
self.log.errorLog('Problem with final node.')
raise
### <e> ### Raise IDs to be 1-N not 0-N and Map Sequences if Given
try:
_stage = '<e> Raising IDs'
## Check Node numbers in names ##
nodenameid = True
for node in self.node:
if seqnames and rje.matchExp('^(\d+)_(.+)$',node.info['Name']):
mname = rje.matchExp('^(\d+)_(.+)$',node.info['Name'])
if string.atoi(mname[0]) > self.nodeNum(): nodenameid = False
else: nodenameid = False
if not nodenameid: break
for node in self.node:
node.stat['ID'] += 1
#!# Check that this next change does not cause problems!
if seqnames and nodenameid:
mname = rje.matchExp('^(\d+)_(.+)$',node.info['Name'])
node.info['Name'] = mname[1]
node.stat['ID'] = string.atoi(mname[0])
#self.deBug('%s:%s' % (node.info, node.stat))
#!# Check that this next change does not cause problems!
if seqnames : self._reorderNodes()
self._renumberNodes()
### <f> ### Rescale default drawing
_stage = '<f> Rescaling'
max_branch_len = 0.0
for branch in self.branch:
if branch.stat['Length'] > max_branch_len: max_branch_len = branch.stat['Length']
if max_branch_len > 2 or max_branch_len < 0.1: self.stat['DefLen'] = max_branch_len / 10.0
for cmd in self.cmd_list: self._cmdRead(cmd,type='stat',att='DefLen')
### <g> ### Option to re-root
_stage = '<g> Mapping sequences'
if seqlist or self.obj['SeqList']: self.mapSeq(seqlist)
if self.stat['Verbose'] >= 0: self.textTree()
if postprocess: self.treeRoot()
except:
self.verbose(0,3,nsftree,1)
self.log.errorLog('Problem with BuildTree(%s).' % _stage)
raise
#########################################################################################################################
def reformatIntegerBranchLengths(self,nsftree): ### Reformats any integer branch lengths to floats
'''
Reformats any integer branch lengths to floats.
>> nsftree:str = NSF tree
<< newtree:str = Returned tree with reformatted branchlengths
'''
try:
newtree = nsftree
mtree = rje.matchExp('^(.+:)(\d+)([,\)\[].+)$',newtree)
while mtree:
newtree = '%s%f%s' % (mtree[0],float(mtree[1]),mtree[2])
mtree = rje.matchExp('^(.+:)(\d+)([,\)\[].+)$',newtree)
return newtree
except:
self.log.errorLog('Problem with reformatIntegerBranchLengths(). Keeping input tree format.')
return nsftree
#########################################################################################################################
def debugTree(self): # ! # Tmp
b = 1
print
for branch in self.branch:
print b, branch.node
b += 1
raw_input()
#########################################################################################################################
def _checkTree(self): ### Checks integrity of tree - that nodes and branches match
'''
Checks integrity of tree
- that nodes and branches match
- nodes have correct number of branches (1-3)
- branches have correct number of nodes (2)
<< True if OK. False if Bad.
'''
try:
dandy = True
### <a> ### Check Numbers
if len(self.node) != (len(self.branch)+1):
self.verbose(0,2,'Wrong number of nodes (%d) to branches (%d)!' % (len(self.node),len(self.branch)),1)
dandy = False
### <b> ### Check Nodes
for node in self.node:
if node.stat['ID'] <= self.stat['SeqNum'] and len(node.branch) != 1:
self.verbose(0,2,'Wrong number of branches (%d) for terminal node %d (%s)!' % (len(node.branch),node.stat['ID'],node.info['Name']),1)
dandy = False
if len(node.branch) > 3 or len(node.branch) < 1:
self.verbose(0,2,'Wrong number of branches (%d) for node %d!' % (len(node.branch),node.stat['ID']),1)
dandy = False
for branch in node.branch:
if node in branch.node:
continue # OK
else:
self.verbose(0,2,'Node %d missing from one of its branches (%s)!' % (node.stat['ID'],branch.show()),1)
dandy = False
### <c> ### Check Branches
for branch in self.branch:
if len(branch.node) != 2:
self.verbose(0,2,'Wrong number of nodes (%d) for branch %s!' % (len(branch.node),branch.show()),1)
dandy = False
for node in branch.node:
if branch in node.branch:
continue # OK
else:
self.verbose(0,2,'Branch %s missing from one of its nodes (%d)!' % (branch.show(),node.stat['ID']),1)
dandy = False
return dandy
except:
self.log.errorLog('Major problem during _checkTree()')
return False
#########################################################################################################################
def _renumberNodes(self): ### Renumbers nodes from root
'''Renumbers nodes from root.'''
try:
### Setup ###
ptext = 'Renumbering Internal Nodes (Root:%s)' % self.opt['Rooted']
self.log.printLog('\n#TREE',ptext,log=False,newline=False)
intorder = []
inttarget = (self.nodeNum() - self.stat['SeqNum'])
next = []
if self.opt['Rooted']:
next = [self._getRootNode()]
else:
maxid = 0
for node in self.node:
if node.stat['ID'] > maxid:
maxid = node.stat['ID']
next = [node]
### Renumber internal nodes ###
while len(next) > 0:
self.log.printLog('\r#TREE','%s ... %.1f%%' % (ptext,(100.0 * len(intorder))/inttarget),log=False,newline=False)
node = next.pop(0)
intorder.append(node)
for branch in node.branch:
nextnode = branch.link(node)
if nextnode in intorder or nextnode.stat['ID'] <= self.stat['SeqNum']: continue
else:
#self.deBug('%s %s' % (nextnode.info,nextnode.stat))
next.append(nextnode)
self.log.printLog('\r#TREE','%s ... %.1f%%' % (ptext,(100.0 * len(intorder))/inttarget),log=False)
if len(intorder) != inttarget:
a = len(intorder)
b = (self.nodeNum() - self.stat['SeqNum'])
self.log.errorLog('Wrong number of internal nodes! (%d not %d-%d = %d)' % (a,self.nodeNum(),self.stat['SeqNum'],b),printerror=False)
print self.nodeList(intorder)
print self.nodeList(self.node)
raise ValueError
else:
n = self.nodeNum()
for node in intorder:
node.stat['ID'] = n
n -= 1
if n != self.stat['SeqNum']:
self.log.errorLog('Next (terminal) node should be numbered %d but %d sequences!' % (n,self.stat['SeqNum']),printerror=False)
raise ValueError
self._reorderNodes()
### Rename ###
for node in self.node:
node.rename(rooting=self.info['RootMethod'])
for branch in self.branch:
if branch.node[0].stat['ID'] > branch.node[1].stat['ID']:
branch.info['Name'] = '%s -> %s' % (branch.node[0].shortName(),branch.node[1].shortName())
else:
branch.info['Name'] = '%s -> %s' % (branch.node[1].shortName(),branch.node[0].shortName())
except:
self.log.errorLog('Problem in renumbering internal nodes: check there is <=1 trichotomy.')
raise
#########################################################################################################################
def _reorderNodes(self): ### Reorders nodes in ID order (for output clarity)
'''Renumbers nodes from root.'''
try:### ~ [1] Setup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
n = 1
ptext = 'Reordering Internal Nodes (Root:%s) ...' % self.opt['Rooted']
orderednodes = []
self.log.printLog('\r#TREE','%s %.1f%%' % (ptext,(100.0 * n)/self.nodeNum()),log=False,newline=False)
### ~ [2] Reorder ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
while n <= self.nodeNum():
pren = n
for node in self.node:
#X#self.log.printLog('\r#TREE','%s ... %d' % (ptext,n),log=False,newline=False)
if node.stat['ID'] == n:
orderednodes.append(node)
n += 1
self.log.printLog('\r#TREE','%s %.1f%%' % (ptext,(100.0 * n)/self.nodeNum()),log=False,newline=False)
if n == pren:
self.log.printLog('\r#TREE','%s %.1f%%' % (ptext,(100.0 * n)/self.nodeNum()),log=False)
self.log.errorLog('Problem reordering nodes! Stuck on %d' % n,printerror=False)
raise ValueError
### ~ [3] Finish ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
self.log.printLog('\r#TREE','%s %.1f%%' % (ptext,100.0),log=False)
self.node = orderednodes
except:
self.log.errorLog('Problem reordering nodes (%d)' % n)
raise
#########################################################################################################################
def _maxBoot(self,b,maxb): ### Returns predicted no. Bootstraps
'''
Returns predicted number of bootstraps assuming a power of ten.
>> b:int = branch bootstrap
>> max:int = current max
'''
boot = max(10,maxb)
while b > boot: boot *= 10
return boot
#########################################################################################################################
def _nodesNumbered(self,check1toN=False): ### Whether sequence names are purely numbers
'''
Whether sequence names are purely numbers.
>> check1toN:boolean = whether to also check that the numbers are 1 to N [False]
<< Returns True or False
'''
try:
numlist = []
for node in self.node:
if node.stat['ID'] < self.stat['SeqNum'] and re.search('\D',node.info['Name']): return False
elif node.stat['ID'] <= self.stat['SeqNum'] and check1toN: numlist.append(string.atoi(node.info['Name']))
numlist.sort()
if check1toN and numlist != range(1,len(numlist)+1): return False
return True
except:
self.log.errorLog('Error during _nodesNumbered()')
raise
#########################################################################################################################
def mapAncSeq(self,filename=None): ### Maps Ancestral Sequences to tree
'''
Maps Ancestral Sequences to tree.
>> filename:str = name of ancestral sequence file. Should be in GASP output format.
'''
try:
### <a> ### Load sequences in SeqList object
_stage ='<a> Load Sequences'
if self.stat['SeqNum'] < 1:
self.log.errorLog('Cannot Map Ancestral Sequences from %s - no tree to map to!' % filename,printerror=False)
raise ValueError
anclist = rje_seq.SeqList(log=self.log,cmd_list=self.cmd_list+['seqin=%s' % filename,'accnr=F'])
### <b> ### Map Terminal sequences
_stage ='<b> Map Termini'
## <i> ## Setup
_stage ='<b-i> Map Termini - Setup'
#X#self.verbose(0,3,'Matching Ancestral Sequence Names to Tree Names...',1)
seqdic = anclist.seqNameDic(key='NumName')
#self.deBug(seqdic)
## <ii> ## Work through each leaf in turn
_stage ='<b-ii> Map Termini - Leaves'
mapseq = []
mapn = 0
for node in self.node[:self.stat['SeqNum']]:
self.log.printLog('\r#ANC','Mapping Ancestral Sequences from %s: %.1f%%' % (filename,100.0 * mapn / self.nodeNum()),newline=False,log=False)
mapped = None
node.obj['Sequence'] = None # Clear sequence
## <iii> ## Text Match
_stage ='<b-iii> Map Termini - Text Match'
if seqdic.has_key(node.info['Name']): # Exact match
mapped = seqdic[node.info['Name']]
else: # Partial Match
for seq in anclist.seq:
if seq.info['Name'].find(node.info['Name']) > 1: # Matches somewhere in Name (but not at start - that's the node number!)
mapped = seq
break
elif rje.matchExp('^\d+\s+(\S+)',seq.info['Name']) and node.info['Name'].find(rje.matchExp('^\d+\s+(\S+)',seq.info['Name'])[0]) == 0: ## Shortname at start of nodename
mapped = seq
break
## <iv> ## Make match
_stage ='<b-iv> Map Termini - Make match'
#print mapped
if mapped:
#self.deBug('%s = %s' % (seq.info['Name'],node.info['Name']))
if mapped in mapseq:
self.log.errorLog('WARNING!: %s maps to multiple nodes!' % (mapped.info['Name']),printerror=False)
raise ValueError
## <v> ## Remake sequence name
_stage ='<b-v> Map Termini - SeqName'
if re.search('^(\d+)\s(\S.+)',mapped.info['Name']):
details = rje.matchExp('^(\d+)\s(\S.+)',mapped.info['Name'])
#print details
s = string.atoi(details[0])
mapped.info['Name'] = details[1]
mapped.extractDetails()
else:
self.log.printLog('AncSeqMatch Error - Node %d (%s) mapped to Sequence %s without ID.' % (node.stat['ID'],node.info['Name'],mapped.info['ID']))
raise ValueError
self.verbose(1,4,'\rNode %d (%s) mapped to Sequence %d (%s).' % (node.stat['ID'],node.info['Name'],s,mapped.info['ID']),1)
#print mapped,anclist.seq.index(mapped)
## <vi> ## Map Seq
_stage ='<b-vi> Map Termini - MapSeq'
node.mapSeq(seq=mapped,id=s)
mapseq.append(mapped)
mapn += 1
#print mapn
else:
self.log.errorLog('Unable to map Node %d (%s). Check tree names within sequence names (or numbered).' % (node.stat['ID'],node.info['Name']),printerror=False)
raise ValueError
## <vii> ## Finish off
_stage ='<b-vii> Map Termini - Finish'
#X#self.verbose(0,2,'%d of %d leaf nodes mapped to %d sequences.' % (mapn,self.stat['SeqNum'],len(mapseq)),1)
self.log.printLog('\r#ANC','Mapping Ancestral Sequences from %s: %d Termini mapped.' % (filename,mapn),log=False)
if mapn != len(mapseq):
self.log.errorLog('Mapping Error: Number of mapped nodes (%d) != mapped sequences (%d)!' % (mapn,len(mapseq)),printerror=False,quitchoice=True)
### <c> ### Map ancestral sequences based on IDs
_stage ='<c> Map Ancestrals'
## <i> ## Work through each internal node in turn
for node in self.node[self.stat['SeqNum']:]:
self.log.printLog('\r#ANC','Mapping Ancestral Sequences from %s: %.1f%%' % (filename,100.0 * mapn / self.nodeNum()),newline=False,log=False)
mapped = None
node.obj['Sequence'] = None # Clear sequence
## <iii> ## Match according to links
for seq in anclist.seq:
if re.search('^\d.+\S*Node \d+ \((\S+)\)',seq.info['Name']):
links = string.split(rje.matchExp('^\d.+\S*Node \d+ \((\S+)\)',seq.info['Name'])[0],',') # List of link IDs
mapped = seq
for desc in node.neighbours(ignore=[node.ancNode()]):
d = '%d' % desc.stat['ID']
#print d, links
if d not in links:
mapped = None
if mapped:
break
else:
pass
#self.deBug('%s not internal?' % seq.info['Name'])
## <iv> ## Make match
#print mapped
if mapped:
if mapped in mapseq:
self.log.errorLog('WARNING!: %s maps to multiple nodes!' % (mapped.info['Name']),printerror=False)
raise ValueError
## <v> ## Remake sequence name
if re.search('^(\d+)\s(\S.+)',mapped.info['Name']):
details = rje.matchExp('^(\d+)\s(\S.+)',mapped.info['Name'])
#print details
s = string.atoi(details[0])
mapped.info['Name'] = details[1]
mapped.extractDetails()
else:
self.log.printLog('AncSeqMatch Error - Node %d (%s) mapped to Sequence %s without ID.' % (node.stat['ID'],node.info['Name'],mapped.info['ID']),printerror=False)
raise ValueError
self.verbose(1,4,'\rNode %d (%s) mapped to Sequence %d: %s.' % (node.stat['ID'],node.info['Name'],s,self.nodeList(node.neighbours(ignore=[node.ancNode()]))),1)
#print mapped,anclist.seq.index(mapped)
## <vi> ## Map Seq
node.mapSeq(seq=mapped,id=s)
mapseq.append(mapped)
mapn += 1
#print mapn
else:
self.log.errorLog('Unable to map Node %d (%s). Check tree names within sequence names (or numbered).' % (node.stat['ID'],node.info['Name']),printerror=False)
raise ValueError
## <vi> ## Finish off
self.log.printLog('\r#ANC','Mapping Ancestral Sequences from %s: %d nodes mapped.' % (filename,mapn))
#X#self.verbose(0,2,'%d of %d nodes mapped to %d sequences.' % (mapn,len(self.node),len(mapseq)),1)
if mapn != len(mapseq):
self.log.errorLog('Mapping Error: Number of mapped nodes (%d) != mapped sequences (%d)!' % (mapn,len(mapseq)),printerror=False,quitchoice=True)
### <d> ### Reorder self.node (for output clarity only)
_stage ='<d> Reorder nodes'
self.obj['SeqList'] = copy.deepcopy(anclist)
self.obj['SeqList'].seq = mapseq
self.obj['SeqList'].querySeq()
self._renumberNodes()
if self.opt['Rooted']: self.findDuplications(duptext='New sequence info')
#self.textTree()
except:
self.obj['SeqList'] = None
for node in self.node:
node.obj['Sequence'] = None
self.log.errorLog('Major Problem in mapAncSeq(%s):' % _stage)
#########################################################################################################################
def clearSeq(self): ### Clears current sequence information
'''Clears current sequence information.'''
self.obj['SeqList'] = None
for node in self.node: node.obj['Sequence'] = None
#########################################################################################################################
def mapSeq(self,seqlist=None,clearseq=True): ### Maps SeqList object onto tree
'''
Maps SeqList object onto Tree.
>> seqlist:rje_seq.SeqList Object.
>> clearseq:boolean = whether to clear any current node sequence before matches
- if matching from multiple SeqLists then set to False for 2nd and subsequent matches
*** It is best to combine into a single SeqList object, which can be linked to the tree object. ***
Names should either include tree sequence names (at start of name) or be ordered according to tree sequences (1-N).
Will take sequences from a larger seqlist than the tree and try to find each node, first with an exact match and then partial.
'''
try:
### Setup SeqList ###
if seqlist:
self.obj['SeqList'] = seqlist
else:
seqlist = self.obj['SeqList']
if not seqlist:
self.log.errorLog('Major error with Tree.mapSeq() - no SeqList given!',printerror=False)
self.clearSeq()
return False
if not seqlist.seq:
self.log.errorLog('Major error with Tree.mapSeq() - SeqList has no sequences!',printerror=False)
self.clearSeq()
return False
### Setup Naming Formats ###
seqnumbers = seqlist.numbersForNames(check1toN=True) # Sequence names are pure numbers 1 to N - use EXACT match
treenumbers = self._nodesNumbered(check1toN=True) # Leaves are pure numbers 1 to N - match numbers unless seqnumbers
numbernames = True # Sequence names have a node number followed by the sequence names: Match number or Name
numlist = []
for seq in seqlist.seq:
if rje.matchExp('^(\d+)\s+\S',seq.info['Name']):
numlist.append(string.atoi(rje.matchExp('^(\d+)\s+\S',seq.info['Name'])[0]))
else:
numbernames = False
numlist.sort()
if numbernames and numlist != range(1,len(numlist)+1):
numbernames = False
matchnumbers = False # Whether to match using terminal node numbers [True] or sequence name [False]
#!#print treenumbers, numbernames, seqnumbers
if treenumbers and not numbernames and not seqnumbers:
matchnumbers = True
self.verbose(0,3,'Matching Sequence Names to Terminal Node Numbers...',1)
else:
self.verbose(0,3,'Matching Sequence Names to Tree Names...',1)
#X#seqdic = seqlist.seqNameDic(key='Name')
### Map each leaf in turn ###
mapseq = [] # List of Mapped sequence objects
mapn = 0 # Number of mapped leaf nodes
for node in self.node[:self.stat['SeqNum']]: # Each leaf node in turn
mapped = {'EXACT':[],'NUMBERS':[],'UNDERSCORE':[]} # Dictionary of Method:Mapped sequence(s)
if clearseq:
node.obj['Sequence'] = None # Clear sequence
## Numbered match ##
if matchnumbers: ### Get appropriate sequence
num = int(node.info['Name'])
if seqlist.seqNum() < num: # Not enough sequences!
self.log.errorLog('Not enough sequences to map leaf numbered %d' % num,printerror=False)
raise ValueError
else: # Map to number
mapped['NUMBERS'].append(seqlist.seq[num-1])
## Name Match ##
else:
name = string.split(node.info['Name'])[0]
if treenumbers:
num = string.atoi(name)
for seq in seqlist.seq:
seqname = seq.shortName()
if numbernames and len(string.split(seq.info['Name'])) > 1:
seqname = string.split(seq.info['Name'])[1]
## EXACT ##
if seqname == name:
mapped['EXACT'].append(seq)
## NUMBERS ##
elif numbernames and treenumbers and num == string.atoi(seq.shortName()):
mapped['NUMBERS'].append(seq)
## UNDERSCORE ##
else:
if name.find(seq.shortName() + '_') == 0:
mapped['UNDERSCORE'].append(seq)
elif numbernames and name.find(seq.shortName() + '_' + seqname + '_') == 0:
mapped['UNDERSCORE'].append(seq)
## Extract best match ##
nmapped = None
for method in ['EXACT','NUMBERS','UNDERSCORE']:
#X#print method, mapped[method]
if mapped[method]:
if len(mapped[method]) > 1:
self.log.errorLog('Node "%s" has %d %s mappings!' % (name,len(mapped['EXACT']),method),printerror=False)
raise ValueError
else:
nmapped = mapped[method][0]
break
## Make match ##
if nmapped:
s = seqlist.seq.index(nmapped) + 1
self.verbose(1,4,'Node %d (%s) mapped to Sequence %d (%s).' % (node.stat['ID'],node.info['Name'],s,nmapped.shortName()),1)
#print mapped,seqlist.seq.index(mapped)
node.mapSeq(seq=nmapped,id=s)
#print mapseq
if nmapped in mapseq:
self.log.errorLog('Sequence %d (%s) maps to multiple nodes!' % (s,nmapped.shortName()),printerror=False)
raise ValueError
else:
mapseq.append(nmapped)
mapn += 1
#print mapn
else:
self.log.errorLog('Unable to map Node %d (%s). Check tree names match sequence names (or are numbered).' % (node.stat['ID'],node.info['Name']))
raise ValueError
## <vi> ## Finish off
self.verbose(0,2,'%d of %d leaf nodes mapped to %d sequences.' % (mapn,self.stat['SeqNum'],len(mapseq)),1)
if mapn != len(mapseq):
self.log.errorLog('Mapping Error: Number of mapped nodes (%d) != mapped sequences (%d)!' % (mapn,len(mapseq)),printerror=False)
raise ValueError
self.obj['SeqList'] = seqlist
### <c> ### Reorder self.node (for output clarity only)
self._renumberNodes()
if self.opt['Rooted']: self.findDuplications(duptext='New sequence info')
return True
except:
self.clearSeq()
self.log.errorLog('Major problem mapping SeqList object onto tree.',quitchoice=True)
return False
#########################################################################################################################
def _prune(self,branch=None,remtext='Manual Tree Pruning'): ### Removes branch and all descendants
'''
Removes branch and all descendants.
>> branch:Branch object
>> remtext:str = text description for reason of sequence removal
'''
try:
### <a> ### Lists of stuff to remove
delnode = [] # Nodes to remove
delbranch = [] # Branches to remove
for node in self.node:
if branch in self.rootPath(node): # If deleted branch is ancestral
delnode.append(node)
delbranch.append(node.ancBranch())
### <b> ### Combine other branches
fami = -1
anc = branch.ancNode()
if anc in self.subfam:
fami = self.subfam.index(anc)
self.subfam[fami] = None
delnode.append(anc)
if anc == self.node[-1] and self.opt['Rooted']: # Root
delbranch.remove(branch)
delbranch += anc.branch
else: # Internal
mergeb = copy.copy(anc.branch)
mergeb.remove(branch)
ancb = mergeb[0]
descb = mergeb[1]
if ancb.commonNode(descb) != anc:
print 'Problem with ancestral node not linking correct branches!'
raise ValueError
if anc == self.node[-1]: # Trichotomy
ancn = ancb.link(anc)
elif anc.ancBranch() == descb:
[ancb,descb] = [descb,ancb]
ancn = ancb.ancNode()
else:
ancn = ancb.ancNode()
self.verbose(0,3,"Remove node %d and combine branches %s and %s." % (anc.stat['ID'],ancb.show(),descb.show()),1)
ancb.combine(anc,descb)
ancb.link(ancn).branch.append(ancb)
delbranch.append(descb)
if fami >= 0: # Move subfam to new node
self.subfam[fami] = ancb.descNode()
fami = -1
### <c> ### Remove nodes, seqs and branches
## <i> ## Tidy = reduce delnode and delbranch to single copies of each node/branch
for node in delnode:
while delnode.count(node) > 1:
delnode.remove(node)
for branch in delbranch:
while delbranch.count(branch) > 1:
delbranch.remove(branch)
self.verbose(1,3,'Removing %d nodes and %d branches...' % (len(delnode),len(delbranch)),1)
## <ii> ## Remove nodes
for node in delnode:
if self.obj['SeqList'] != None and node.obj['Sequence'] != None:
self.obj['SeqList'].removeSeq(remtext,node.obj['Sequence'])
#if node.stat['ID'] <= self.seqNum():
if node in self.subfam:
self.subfam.remove(node)
for othernode in self.node:
if node.stat['ID'] < othernode.stat['ID']:
othernode.stat['ID'] -= 1
self.node.remove(node)
self.stat['SeqNum'] = self.seqNum()
## <iii> ## Remove branches
for branch in delbranch:
for node in self.node:
if branch in node.branch:
node.branch.remove(branch)
self.branch.remove(branch)
### <d> ### Adjust
if self._checkTree() == False:
raise ValueError
self._renumberNodes()
if fami >= 0:
self.subfam[fami] = self.node[-1]
except:
self.log.errorLog('Major Problem in _prune().')
raise
#########################################################################################################################
### <3> ### Tree Making #
#########################################################################################################################
def makeTreeMenu(self,interactiveformenu=0,force=False,make_seq=None): ### Menu for making tree
'''
Menu for making tree.
>> interactiveformenu:int = Interactive level at which to give menu options [0]
>> force:boolean = Whether to force making of tree (not allow exit without) [False]
>> make_seq:SeqList object from which to make tree
'''
try:
### Setup ###
if self.stat['Interactive'] < interactiveformenu:
self.makeTree(make_seq)
return
### Prepare Menu Parameters ##
seqin = 'None'
if make_seq:
seqin = make_seq.info['Name']
### Show Settings ###
print '\n\n### Tree Making Menu ###'
print 'Tree Generation Method: %s' % self.info['MakeTree']
print 'Bootstraps: %d' % self.stat['Bootstraps']
print 'Sequence File: %s' % seqin
if self.info['MakeTree'] in ['neighbor','upgma','fitch','kitch']: ### PHYLIP
print 'Distance Matrix File: %s' % self.info['DisIn']
if self.info['MakeTree'] in ['neighbor','upgma','protpars','proml','fitch','kitch']: ### PHYLIP
print 'Phylip Path: %s' % self.info['Phylip']
print 'Phylip Options File: %s' % self.info['PhyOptions']
print 'Protdist Options File: %s' % self.info['ProtDist']
if self.info['MakeTree'] in ['clustalw']:
print 'ClustalW Path: %s' % self.info['ClustalW']
print 'Use Kimura multiple hit correction: %s' % self.opt['Kimura']
if self.info['MakeTree'] in ['fasttree']:
print 'FastTree Path: %s' % self.info['FastTree']
if self.info['MakeTree'] in ['iqtree']:
print 'IQTree Path: %s' % self.info['IQTree']
### Options ###
choicetext = '\n<M>ake Tree, Change <O>ptions'
choices = ['M','O']
if not force:
choicetext += ', <Q>uit MakeTree'
choices.append('Q')
choice = ''
while choice not in choices:
choice = rje.choice('%s\n\nChoice?:' % choicetext,default='M').upper()[:1]
if choice == 'M':
self.makeTree(make_seq)
elif choice == 'Q' and not force:
return
elif choice == 'O': ### Change Options ###
self.info['MakeTree'] = rje.choice('Tree Generation Method:',self.info['MakeTree'],True)
self.stat['Bootstraps'] = rje.getInt('Bootstraps:',default=self.stat['Bootstraps'],confirm=True)
newseqin = rje.choice('Sequence File:',seqin,True)
if newseqin != seqin:
make_seq = rje_seq.SeqList(log=self.log,cmd_list=self.cmd_list+['seqin=%s' % newseqin,'autoload=T'])
if self.info['MakeTree'] in ['neighbor','upgma','fitch','kitch']: ### PHYLIP
self.info['DisIn'] = rje.choice('Distance Matrix File:',self.info['DisIn'],True)
if self.info['MakeTree'] in ['neighbor','upgma','protpars','proml','fitch','kitch']: ### PHYLIP
self.info['Phylip'] = rje.choice('Phylip Path:',self.info['Phylip'],True)
self.info['PhyOptions'] = rje.choice('Phylip Options File:',self.info['PhyOptions'],True)
self.info['ProtDist'] = rje.choice('Protdist Options File:',self.info['ProtDist'],True)
if self.info['MakeTree'] in ['clustalw']:
self.info['ClustalW'] = rje.choice('ClustalW Path:', self.info['ClustalW'],True)
self.opt['Kimura'] = rje.yesNo('Use Kimura multiple hit correction?')
if self.info['MakeTree'] in ['fasttree']:
self.info['FastTree'] = rje.choice('FastTree Path:', self.info['FastTree'],True)
if self.info['MakeTree'] in ['iqtree']:
self.info['FastTree'] = rje.choice('IQTree Path:', self.info['IQTree'],True)
self.makeTreeMenu(interactiveformenu,force,make_seq)
except:
self.log.errorLog('Major Problem in makeTreeMenu().',True,True)
#########################################################################################################################
def makeTree(self,make_seq=None,keepfile=True): ### Uses attributes to call program and make tree
'''
Uses attributes to call program and make tree.
>> make_seq:SeqList object from which to make tree
>> keepfile:bool = whether to keep the tree file produced by makeTree or delete
'''
try:### ~ [0] Setup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
if not make_seq: make_seq = rje_seq.SeqList(log=self.log,cmd_list=self.cmd_list+['autoload=T'])
if make_seq.info['Name'] == 'None' and self.info['CWTree'].lower() != 'none':
make_seq = rje_seq.SeqList(log=self.log,cmd_list=self.cmd_list+['seqin=%s' % self.info['CWTree'],'autoload=T'])
if make_seq.seqNum() < 2: return self.errorLog('Cannot make tree with %d sequences!' % make_seq.seqNum())
## ~ [0a] Setup tree parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
self.opt['ReRooted'] = False
while self.info['MakeTree'].lower() in ['','none']:
if self.stat['Interactive'] >= 0: self.info['MakeTree'] = rje.choice('Enter method or path for makeTree:',default='clustalw',confirm=True)
else: self.info['MakeTree'] = 'clustalw'
if not os.path.exists(self.info['MakeTree']): self.info['MakeTree'] = self.info['MakeTree'].lower()
if self.info['DisIn'].lower() != 'none' and not os.path.exists(self.info['DisIn']):
if make_seq:
self.errorLog('Distance Matrix file %s missing. Will make tree from %s.' % (self.info['DisIn'],make_seq.info['Name']),printerror=False)
self.info['DisIn'] = 'None'
else:
self.errorLog('Distance Matrix file %s missing and no sequence file given!' % self.info['DisIn'],printerror=False)
raise IOError
### ~ [1] Generate tree ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
## ~ [1a] PHYLIP Tree ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
if self.info['MakeTree'] in ['neighbor','upgma','protpars','proml','fitch','kitch']: ### PHYLIP
## Make Directory ##
make_id = 'phylip_tmp_%s' % rje.randomString(8)
os.mkdir(make_id)
os.chdir(make_id)
## Run ##
self.phylipTree(make_id,make_seq,self.info['DisIn'])
## Process results ##
os.chdir('..')
rje.fileTransfer(fromfile='%s%s%s' % (make_id,os.sep,self.log.info['LogFile']),tofile=self.log.info['LogFile'],deletefrom=True)
if make_seq.info['Name'].lower() == 'none':
self.info['Name'] = '%s.%s.ph' % (rje.baseFile(self.info['DisIn'],True),self.info['MakeTree'])
else:
self.info['Name'] = '%s.%s.ph' % (rje.baseFile(make_seq.info['Name'],True),self.info['MakeTree'])
if os.path.exists(self.info['Name']):
self.verbose(2,1,'%s exists and will be overwritten.' % self.info['Name'],1)
os.unlink(self.info['Name'])
self.log.printLog('#TREE','Unbootstrapped %s tree saved as %s.' % (self.info['MakeTree'].upper(),self.info['Name']))
os.rename('%s%souttree' % (make_id,os.sep),self.info['Name'])
## Bootstraps ##
if self.stat['Bootstraps'] > 0 and make_seq: ### Make boostraps
tempstat = {'Interactive':self.stat['Interactive'],'Bootstraps':self.stat['Bootstraps']}
self.stat['Interactive'] = -1
self.opt['Bootstrapped'] = False
self.loadTree(file=self.info['Name'],seqlist=None,type='phb',postprocess=False)
self.setStat(tempstat)
os.chdir(make_id)
#self.verbose(0,2,'Generating %d bootstraps...' % self.stat['Bootstraps'],0)
for b in range(self.stat['Bootstraps']):
# Make Sequences #
bootseq = rje_seq.SeqList(log=self.log,cmd_list=['i=-1','v=%d' % (self.stat['Verbose']-1)])
bootseq.seq = []
boot_order = []
self.verbose(0,3,'Bootstrap %d of %d...' % ((b+1),self.stat['Bootstraps']),0)
for r in range(make_seq.seq[0].seqLen()):
boot_order.append(random.randint(0,make_seq.seq[0].seqLen()-1))
for seq in make_seq.seq:
randseq = ''
for i in boot_order:
randseq += seq.info['Sequence'][i]
bootseq._addSeq(seq.info['Name'],randseq)
self.verbose(0,3,'Sequences made. Making Phylip tree...',2)
# Run phylip #
self.phylipTree(make_id,bootseq,'none')
# Process Tree #
os.rename('outtree','boottree_%d' % b)
#self.verbose(0,2,rje.progressPrint(self,b+1,10,100),0)
#self.verbose(0,1,'Done!',1)
# Compile Bootstraps #
self.log.printLog('#TREE','Mapping %d bootstraps onto tree.' % self.stat['Bootstraps'])
self.verbose(0,2,'Compiling %d bootstraps...' % self.stat['Bootstraps'],0)
branch_clades = {}
for branch in self.branch:
branch.stat['Bootstrap'] = 0
real_clades = self.branchClades(branch) # Node objects
branch_clades[branch] = ([],[])
for i in [0,1]:
for node in real_clades[i]:
branch_clades[branch][i].append(node.info['Name'])
branch_clades[branch][i].sort()
for b in range(self.stat['Bootstraps']):
boottree = Tree(log=self.log,cmd_list=['i=-1','v=-1'])
boottree.loadTree(file='boottree_%d' % b,seqlist=None,type='phb',postprocess=False)
for bbranch in boottree.branch:
bclades = boottree.branchClades(bbranch) # Node objects
comp = ([],[])
for i in [0,1]:
for node in bclades[i]:
comp[i].append(node.info['Name'])
comp[i].sort()
for branch in self.branch:
if comp[0][0:] in branch_clades[branch]: # Boot +
if comp[1][0:] in branch_clades[branch]: # OK
branch.stat['Bootstrap'] += 1
break
else: # Buggered
self.log.errorLog('Knackers. Branch shares one clade but not the other!',printerror=False)
os.unlink('boottree_%d' % b)
rje.progressPrint(self,(b+1),1,10)
self.opt['Bootstrapped'] = True
self.verbose(0,1,'Done!',1)
# Tidy up #
os.chdir('..')
rje.fileTransfer(fromfile='%s%s%s' % (make_id,os.sep,self.log.info['LogFile']),tofile=self.log.info['LogFile'],deletefrom=True)
self.info['Name'] = '%s.nsf' % rje.baseFile(self.info['Name'])
self.opt['Bootstrapped'] = True
self.textTree()
self.saveTree(filename=self.info['Name'],type=self.info['SaveType'],seqname='num',maxnamelen=125,multiline=False)
self.mapSeq(make_seq)
self.textTree()
self.treeRoot()
#rtype = 'nsf'
else:
self.loadTree(file=self.info['Name'],seqlist=make_seq,type='phb')
## Finish! ##
os.rmdir(make_id)
## ~ [1b] FastTree Tree ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
elif self.info['MakeTree'] in ['fasttree','iqtree']:
infile = '%s_tree.fas' % rje.baseFile(make_seq.info['Name'],True)
make_seq.saveFasta(seqfile=infile,name='Short')
self.info['Name'] = '%s.nsf' % rje.baseFile(make_seq.info['Name'],True)
if self.info['MakeTree'] in ['fasttree']:
cpath = rje.makePath(self.info['FastTree'],wholepath=True)
seed = random.randint(1,999)
command = cpath + ' -boot %d -seed %d %s' % (self.stat['Bootstraps'],seed,infile)
if self.v() < 0: command = '%s -quiet' % command
self.printLog('#TREE',command)
try: self.buildTree(os.popen(command).read(),make_seq,type='nsf')
except:
self.errorLog('FastTree build failure. Will try ClustalW instead')
self.info['MakeTree'] = 'clustalw'
self.makeTree(make_seq,keepfile)
self.info['MakeTree'] = 'fasttree'
else:
cpath = rje.makePath(self.info['IQTree'],wholepath=True)
seed = random.randint(1,999)
command = cpath + ' -s %s ' % infile
if self.stat['Bootstraps'] >= 100: command = '%s-b %d ' % (command,self.stat['Bootstraps'])
elif self.stat['Bootstraps']:
self.printLog('#BOOT','Boostraps increased from %s to 100 for IQTree.' % self.stat['Bootstraps'])
self.setStat({'Bootstraps':100})
command = '%s-b %d ' % (command,self.stat['Bootstraps'])
if self.v() < 0: command = '%s -quiet' % command
self.printLog('#TREE',command)
if self.v() < 0: os.popen(command).read()
else: os.system(command)
try:
self.debug('%s.treefile' % infile)
self.debug(rje.exists('%s.treefile' % infile))
os.rename('%s.treefile' % infile,self.info['Name'])
self.buildTree(open(self.info['Name']).read(),make_seq,type='nsf')
except:
#!# Need to add file checks and/or cleanup and "redo" option.
self.errorLog('IQTree build failure. Will try ClustalW instead')
self.info['MakeTree'] = 'clustalw'
self.makeTree(make_seq,keepfile)
self.info['MakeTree'] = 'iqtree'
if infile != make_seq.info['Name']: os.unlink(infile)
if not keepfile and os.path.exists(self.info['Name']): os.unlink(self.info['Name'])
## ~ [1c] ClustalW Tree ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
else:
if self.info['MakeTree'] in ['clustalw','clustalw2']:
if make_seq.seqNum() < 4:
self.printLog('#TREE','%s has too few sequences (<4) for ClustalW Tree' % make_seq.info['Name'])
return self.upgmaIDTree(make_seq)
path = self.info['ClustalW']
infile = '%s_cw.fas' % rje.baseFile(make_seq.info['Name'],True)
make_seq.saveFasta(seqfile=infile,name='Number')
else:
infile = make_seq.info['Name']
path = self.info['MakeTree']
cpath = rje.makePath(path,wholepath=True)
seed = random.randint(1,999)
command = cpath + ' '
if self.opt['Win32'] == False:
command += '-infile='
command += '%s -bootstrap=%d -seed=%d' % (infile,self.stat['Bootstraps'],seed)
if self.opt['Kimura']:
command += ' -kimura'
self.log.printLog('#TREE',command)
if self.v() < 0: os.popen(command).read()
else: os.system(command)
self.info['Name'] = '%s.phb' % rje.baseFile(make_seq.info['Name'],True)
if os.path.exists(self.info['Name']):
os.unlink(self.info['Name'])
os.rename('%s_cw.phb' % rje.baseFile(make_seq.info['Name'],True),self.info['Name'])
#!# Warning, this replaces self Name with *.phb
self.loadTree(file=self.info['Name'],seqlist=make_seq,type='phb')
if infile != make_seq.info['Name']:
os.unlink(infile)
if not keepfile:
os.unlink(self.info['Name'])
#return rtype
except: self.errorLog('Problem with makeTree().'); raise
#########################################################################################################################
def upgmaIDTree(self,seqlist): ### Makes UPGMA tree based on MSA %ID
'''Makes UPGMA tree based on MSA %ID.'''
try:### ~ [1] Setup distance matrix ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
seqlist.obj['MSA ID'] = None
seqlist.addMatrix('MSA ID')
seqlist._checkAln(aln=True,realign=True)
for seq1 in seqlist.seqs():
for seq2 in seqlist.seqs(): seqlist.getDis(seq1,seq2,'MSA ID')
### ~ [2] Make Tree ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
self.buildTree(seqlist.obj['MSA ID'].upgma(nosim=100.0),seqlist,type='nsf')
except: self.errorLog('Problem during Tree.upgmaIDTree()'); raise
#########################################################################################################################
def phylipTree(self,make_id,make_seq,make_dis): ### Makes a Phylip tree from make_seq and make_dis
'''
>> make_id:random string for temp phylip directory
>> make_seq:SeqList object from which to make tree
>> make_dis:Distance Matrix file to build tree from
'''
## Basic Options ##
phy_opt = []
if self.info['PhyOptions'] != 'None':
if os.path.exists(self.info['PhyOptions']):
PHYOPT = open(self.info['PhyOptions'],'r')
phy_opt += PHYOPT.readlines()
PHYOPT.close()
else:
self.log.errorLog('Phylip tree options file "%s" missing! Proceeding with defaults.' % self.info['PhyOptions'],True,False)
#if make_seq.stat['Verbose'] < 0:
# phy_opt += ['2\n']
phy_opt += ['3\ny\n']
## ProtDist Options ##
pdis_opt = []
if self.info['ProtDist'] != 'None' and make_dis.lower() == 'none':
if os.path.exists(self.info['ProtDist']):
PHYOPT = open(self.info['ProtDist'],'r')
pdis_opt += PHYOPT.readlines()
PHYOPT.close()
else:
self.log.errorLog('Phylip ProtDist options file "%s" missing! Proceeding with defaults.' % self.info['ProtDist'],True,False)
#if make_seq.stat['Verbose'] < 0:
# pdis_opt += ['2\n']
pdis_opt += ['y\n','\n','\n']
## Make Input files ##
if make_dis.lower() == 'none' or self.info['MakeTree'] in ['protpars','proml']:
make_seq.savePhylip(seqfile='infile')
if self.info['MakeTree'] in ['protpars','proml','fitch','kitsch']:
phy_opt = ['1\n'] + phy_opt
phy_opt = ['j\n','%d\n' % (4 * random.randint(1,8000) + 1)] + phy_opt
## Make dismatrix ##
if self.info['MakeTree'] in ['neighbor','upgma','fitch','kitsch']:
if make_dis.lower() != 'none':
rje.fileTransfer('..%s%s' % (os.sep,make_dis),'infile',False)
self.log.printLog('#TREE','Using %s for %s tree distance matrix.' % (make_dis,self.info['MakeTree'].upper()))
else:
OPTFILE = open('%s.txt' % make_id,'w')
OPTFILE.writelines(pdis_opt)
OPTFILE.close()
command = '%sprotdist < %s.txt' % (rje.makePath(self.info['Phylip']),make_id)
self.log.printLog('#CMD',command)
os.system(command)
os.unlink('infile')
os.rename('outfile','infile')
## Run tree program ##
if self.info['MakeTree'] == 'upgma':
phy_opt = ['n\n'] + pdis_opt
command = '%sneighbor < %s.txt' % (rje.makePath(self.info['Phylip']),make_id)
else:
command = '%s%s < %s.txt' % (rje.makePath(self.info['Phylip']),self.info['MakeTree'],make_id)
OPTFILE = open('%s.txt' % make_id,'w')
OPTFILE.writelines(phy_opt)
OPTFILE.close()
self.log.printLog('#CMD',command)
os.system(command)
os.unlink('infile')
os.unlink('outfile')
os.unlink('%s.txt' % make_id)
#########################################################################################################################
### <4> ### Tree Output #
#########################################################################################################################
def fullDetails(self,nodes=True,branches=True): ### Displays details of Tree, Nodes and Branches
'''Displays details of SeqList and all Sequences.'''
self.verbose(0,1,self.details(),0)
if nodes:
for node in self.node: self.verbose(0,1,node.details(),0)
if branches:
for branch in self.branch: self.verbose(0,1,branch.details(),0)
#########################################################################################################################
def sumTree(self): ### Print summary of tree
'''Prints Summary of Tree.'''
try:
if self.opt['Rooted']: sumtxt = '\nRooted Tree '
else: sumtxt = '\nUnrooted Tree '
if self.opt['Bootstrapped']: sumtxt += '(%d bootstraps).' % self.stat['Bootstraps']
else: sumtxt += '(No bootstraps).'
if self.opt['Branchlengths']: sumtxt += ' Branch Lengths given (total=%s).' % (rje.sf(self.treeLen(),3))
else: sumtxt += ' No Branch Lengths.'
sumtxt += ' %d nodes.' % self.nodeNum()
self.verbose(0,1,sumtxt,2)
except:
self.log.errorLog('Problem with sumTree(). Execution Continued.')
#########################################################################################################################
def treeLen(self): return self.pathLen(self.branch)
#########################################################################################################################
def nodeList(self,nodelist,id=False,space=True): ### Returns a text summary of listed nodes '(X,Y,Z)' etc.
'''
Returns a text summary of listed nodes '(X,Y,Z)' etc.
>> nodelist:list of Node Objects
>> id:Boolean [False] = whether to use node IDs (True) or names (False)
>> space:Boolean [True] = whether to have a space after commas for clarity
<< sumtxt:str shortnames of listed nodes (X,Y,Z...)
'''
try:
sumtxt = []
for node in nodelist:
if id: sumtxt.append('%d' % node.stat['ID'])
else: sumtxt.append(node.shortName())
if space: return '(%s)' % string.join(sumtxt,', ')
else: return '(%s)' % string.join(sumtxt,',')
except:
self.log.errorLog('Problem with nodeList()')
raise
#########################################################################################################################
def _getNode(self,id): ### Returns Node Object with given ID
'''
Returns Node Object with given ID.
>> id:int = node.stat['ID']
<< node:Node Object
'''
if self.node[id-1].stat['ID'] == id: return self.node[id-1]
else:
for node in self.node:
if node.stat['ID'] == id: return node
return None
#########################################################################################################################
def _makeNSFTree(self,seqnum=False,seqname='short',maxnamelen=123,blen='Length',bootstraps='boot',multiline=True,te=True):
"""
Generates an NSF Tree from tree data.
>> seqnum:boolean [False] = whether to print sequence numbers
>> seqname:str ['short'] = name to use for sequences
- 'num' = numbers only; 'short' = short sequence names; 'long' = long names;
>> maxnamelen:int [123] = truncate names to this length for compatability with other programs.
>> blen:str ['Length'] = stat to use for branch lengths
- 'none' = do not use branch lengths; 'fix' = fix at _deflen;
- 'pam' = replace with PAM distances if calculated (else none)
- other = use node.stat[blen]
>> bootstraps:str ['boot'] = what to print for bootstraps
- 'none' = nothing; 'boot' = boostraps if given (else none); 'node' = node numbers
>> multiline:boolean [True] = whether to spread file over multiple lines (1 per node)
>> te:boolean [True] = make TreeExplorer compatible
- whitespaces are replaced with underscores, brackets with '' and colons/semicolons with -
<< outtree:str = NSF tree
"""
try:### ~ [0] ~ Seed Tree with root or trichotomy ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
nodes = self.node[-1].neighbours()
outtree = '%s;' % self.nodeList(nodes,id=True,space=False)
nodeout = [self.node[-1]]
### ~ [1] ~ Expand internal nodes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
n = 2
while self.node[-n].stat['ID'] > self.stat['SeqNum']: # Still nodes to be expanded
node = self.node[-n]
re_node = re.compile('([\(,\n])%d([\),])' % node.stat['ID'])
if re_node.search(outtree):
## ~ [1a] ~ New Details ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
nodeout.append(node)
nodes = node.neighbours(ignore=nodeout)
rep = self.nodeList(nodes,id=True,space=False)
branch = node.ancBranch()
if (bootstraps == 'boot') and self.opt['Bootstrapped']: rep += '%d' % branch.stat['Bootstrap']
elif bootstraps == 'node': rep += '%d' % node.stat['ID']
if blen == 'fix': rep += ':%f' % self.stat['DefLen']
elif blen.lower() == 'pam': rep += ':%f' % (float(branch.stat['PAM']) / 100)
elif blen.lower() != 'none': rep += ':%f' % branch.stat[blen]
## ~ [1b] ~ Replacement ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
m_node = re_node.search(outtree)
g_node = m_node.groups()
rep = '%s%s%s' % (g_node[0],rep,g_node[1])
if multiline == 1: rep += '\n'
outtree = re_node.sub(rep,outtree)
n += 1
else:
self.log.errorLog("Node %d missing from tree: %s" % (node.stat['ID'],outtree))
raise
### ~ [2] ~ Termini ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
for node in self.node:
if node.stat['ID'] > self.stat['SeqNum']: continue # Internal
else:
re_node = re.compile('([\(,\n])%d([\),])' % node.stat['ID'])
if re_node.search(outtree):
## ~ [2a] ~ Name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
rep = ''
if seqnum:
rep = rje.preZero(node.stat['ID'],self.nodeNum())
if seqname != 'num': rep += ' '
if seqname == 'short': rep += node.shortName()
elif seqname == 'long': rep += node.info['Name']
if te:
rep = re.sub('\s','_',rep)
rep = re.sub('[\(\)\[\]]','"',rep)
rep = re.sub('[:;]','-',rep)
rep = re.sub(',','_-',rep)
else:
rep = re.sub('\(','{',rep)
rep = re.sub('\)','}',rep)
rep = re.sub('[:;]','-',rep)
rep = re.sub(',',' -',rep)
if len(rep) > maxnamelen and maxnamelen > 3:
mx = maxnamelen - 3
rep = '%s...' % (rep[:mx])
## <ii> ## Branch
branch = node.branch[0]
if blen == 'fix': rep += ':%f' % self.stat['DefLen']
elif blen.lower() == 'pam': rep += ':%f' % (float(branch.stat['PAM']) / 100)
elif blen.lower() != 'none': rep += ':%f' % branch.stat[blen]
m_node = re_node.search(outtree)
g_node = m_node.groups()
rep = '%s%s%s' % (g_node[0],rep,g_node[1])
if multiline == 1: rep += '\n'
outtree = re_node.sub(rep,outtree)
else:
self.log.errorLog("Node %d missing from tree: %s" % (node.stat['ID'],outtree))
raise
return outtree
except:
self.log.errorLog("Problems making tree in _makeNSFTree()!")
raise
#########################################################################################################################
def saveTrees(self,seqname='long',blen='Length',bootstraps='boot'): ### Generates all tree file formats selected in normal format
'''
Generates all tree file formats selected in normal format.
>> seqname:str ['long'] = name to use for sequences
- 'num' = numbers only; 'short' = short sequence names; 'long' = long names;
- whitespaces are replaced with underscores, brackets with '' and colons/semicolons with -
>> blen:str ['Length'] = branch lengths
- 'none' = do not use branch lengths; 'fix' = fix at _deflen;
- 'pam' = replace with PAM distances if calculated (else none)
- other = use node.stat[blen]
>> bootstraps:str ['boot'] = what to print for bootstraps
- 'none' = nothing; 'boot' = bootstraps if given (else none); 'node' = node numbers
'''
try:### ~ [1] ~ Try each tree format in turn ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
#!# Replace type!
for type in self.list['TreeFormats']:
treefile = '%s.%s' % (self.info['Basefile'],formatext[type])
if type == 'text':
self.saveTree(filename=treefile,type=type,seqnum=True,seqname=seqname,blen=blen,bootstraps=bootstraps,multiline=True,maxnamelen=0)
elif type == 'te': self.saveTree(filename=treefile,type=type,seqnum=False,seqname=seqname,blen=blen,bootstraps=bootstraps,multiline=True,maxnamelen=120)
elif self.obj['SeqList']: self.saveTree(filename=treefile,type=type,seqnum=self.opt['SeqNum'],seqname=seqname,blen=blen,bootstraps=bootstraps,multiline=True,maxnamelen=self.stat['TruncNames'])
else: self.saveTree(filename=treefile,type=type,seqnum=False,seqname=seqname,blen=blen,bootstraps=bootstraps,multiline=True,maxnamelen=self.stat['TruncNames'])
except: self.errorLog('Major problem with saveTrees.')
#########################################################################################################################
def saveTree(self,filename='None',type='nsf',seqnum=False,seqname='short',maxnamelen=123,blen='Length',bootstraps='boot',multiline=True):
'''
Saves tree to a file.
>> filename:str ['None']
>> type:str ['nsf']
- 'nsf' = Newick Standard Format; 'text' = text; 'r' = for r graphic, 'png' = r png, 'te' = TreeExplorer NSF
>> seqnum:boolean [False] = whether to print sequence numbers (from zero if bootstraps = 'num')
>> seqname:str ['short'] = name to use for sequences
- 'num' = numbers only; 'short' = short sequence names; 'long' = long names;
- whitespaces are replaced with underscores, brackets with '' and colons/semicolons with -
>> maxnamelen:int [123] = truncate names to this length for compatability with other programs.
>> blen:str ['Length'] = branch lengths
- 'none' = do not use branch lengths; 'fix' = fix at _deflen;
- 'pam' = replace with PAM distances if calculated (else none)
- other = use node.stat[blen]
>> bootstraps:str ['boot'] = what to print for bootstraps
- 'none' = nothing; 'boot' = boostraps if given (else none); 'node' = node numbers
>> multiline:boolean = whether to spread file over multiple lines (1 per node)
'''
try:### ~ [1] ~ Setup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
if filename.lower() in ['none','']: filename = self.info['SaveTree']
if filename.lower() in ['none','']: filename = '%s.%s' % (rje.baseFile(self.info['Name'],True),type)
if filename.lower() in ['none','']: filename = 'out.nsf'
if seqname == 'num': seqnum = True
try: self.printLog('\r#TREE','Saving tree to %s as %s.' % (filename,treeformats[type]))
except: self.printLog('\r#TREE','Saving tree to %s in %s format.' % (filename,type))
self.log.printLog("#OUT","filename='%s', type='%s', seqnum=%s, seqname='%s', maxnamelen=%d, blen='%s', bootstraps='%s'\n" % (filename,type,seqnum,seqname,maxnamelen,blen,bootstraps))
### ~ [2] ~ Generate Tree ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
## ~ [2a] ~ NSF Format ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
if type in ['nsf','te','nwk']: outtree = self._makeNSFTree(seqnum,seqname,maxnamelen,blen,bootstraps,multiline,te=type=='te')
## ~ [2b] ~ Plain text ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
elif type == 'text': return self.textTree(filename,seqnum,seqname,maxnamelen,blen=blen,showboot=bootstraps=='boot',compress=False)
## ~ [2c] ~ R Graphic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
elif type == 'r': return self.rTree(filename,seqname,blen=blen,compress=False)
elif type in ['png','bud','qspec','cairo']: return self.pngTree(filename,seqname,blen=blen,compress=False,type=type)
## ~ [2d] ~ SVG Graphic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
elif type == 'svg': return self.svgTree(filename,seqname,blen=blen,compress=False,save=True)
elif type == 'html': return self.htmlTree(filename,seqname,blen=blen,compress=False)
## ~ [2x] ~ Unsupported Format ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
else:
self.log.errorLog('Sorry. Output type %s not supported.' % type,printerror=False)
raise ValueError
### ~ [3] ~ Save file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
if multiline: outtree = string.replace(outtree,'(','(\n')
open(filename, 'w').write(outtree)
except: self.errorLog('Major problem with saveTree(%s).' % type)
#########################################################################################################################
def editTree(self,groupmode=False,fromnode=None,reroot=True): ### Options to alter tree details and compress nodes etc.
'''
Options to alter tree details and compress nodes etc.
- Expand/Collapse nodes
- Flip Clade
- Zoom to Clade (show subset of tree)
- Prune Tree (permanently delete branches and nodes)
- Edit Branch
- Edit Terminal Node
- ReRoot/Unroot
- Display Options
- Save Text Tree
>> groupmode:Boolean [False] = whether node compression defines groups
>> fromnode:Node Object [None] = start by drawing tree from given Node only (Zoom)
>> reroot:Boolean [True] = whether to allow rerooting of tree
'''
try:
### <a> ### Set Options
seqname = 'short'
maxnamelen = 0
showboot = True
showlen = 'branch'
showdesc = False # Show descriptions
blen = 'Length'
scale = self.stat['TextScale']
spacer = 1
pause = 50
### <b> ### Choices
while self.stat['Interactive'] >= 0:
self.textTree(filename=None,seqnum=True,seqname=seqname,maxnamelen=maxnamelen,nodename='num',showboot=showboot,showlen=showlen,blen=blen,scale=scale,spacer=spacer,pause=pause,fromnode=fromnode)
if groupmode:
print '\nDisplay: <C>ollapse/Group, <E>xpand/Ungroup, ',
else:
print '\nDisplay: <C>ollapse, <E>xpand, ',
print '<F>lip, <N>ame Clade, <Z>oom, <O>ptions, <D>escriptions [%s], <S>ave to file, <Q>uit' % (showdesc)
print 'Edit: <B>ranch, <T>erminal node, <P>rune',
if reroot:
print ', <R>oot on Branch, <U>nroot, Root <M>enu'
else:
print
choice = rje.choice('Choice?: ',default='Q').upper()
while not reroot and choice in ['R','U','M']:
choice = rje.choice('Choice?: ',default='Q').upper()
neednode = ['C','E','F','N','T']
needbranch = ['B','P','R']
branch = None
## Add automatic collapse/expand if number given
try:
n = string.atoi(choice) # Will raise ValueError if choice not an integer string
node = self._getNode(n)
if node.opt['Compress']:
choice = 'E'
else:
choice = 'C'
except:
node = None
#print choice, node
## Choose node/branch if appropriate
while choice[0] in neednode and node == None: # Choose Node
n = rje.getInt('Node: ')
node = self._getNode(n)
if node == None:
print 'Cannot find Node %d!' % n
while choice[0] in needbranch and branch == None: # Choose Branch
n = rje.getInt('Descendant Node: ')
node = self._getNode(n)
if node == None:
print 'Cannot find Node %d!' % n
else:
branch = node.ancBranch()
## <i> ## Collapse/Name node
if choice.find('C') == 0 or choice.find('N') == 0:
if choice.find('C') == 0:
node.opt['Compress'] = True
if groupmode:
self._addGroup(node)
if node.info['CladeName'] == 'None':
clades = self._descClades(node)
clades = clades[0] + clades[1]
node.info['CladeName'] = '%d Seqs %s' % (len(clades),self.nodeList(clades))
#print 'Clade Name (Blank to Keep)',node.info['CladeName']
node.info['CladeName'] = self._editChoice(text='Clade Name (Blank to Keep)',value=node.info['CladeName'])
## <ii> ## Expand node
if choice.find('E') == 0:
node.opt['Compress'] = False
if groupmode and node in self.subfam:
self.subfam.remove(node)
## <iii> ## Flip node
if choice.find('F') == 0:
node.flipDesc()
## <iv> ## Options
if choice.find('D') == 0:
showdesc = not showdesc
if showdesc:
seqname = 'long'
else:
seqname = 'short'
if choice.find('O') == 0:
print self.textTree.__doc__
seqname = self._editChoice('Sequence name display (num/short/full)',seqname)
showdesc = False
if seqname == 'long':
showdesc = True
maxnamelen = int(self._editChoice('Maximum Name Length',maxnamelen,numeric=True))
showboot = self._editChoice('Show Bootstraps',showboot,boolean=True)
showlen = self._editChoice('Show Lengths',showlen)
blen = self._editChoice('Branch Lengths',blen)
scale = int(self._editChoice('Scale',scale,numeric=True))
spacer = int(self._editChoice('Spacer',spacer,numeric=True))
pause = int(self._editChoice('Pause',pause,numeric=True))
## <v> ## Save to file
if choice.find('S') == 0:
filename = rje.choice('Filename: ',default=self.info['Name'])
if rje.yesNo('Save text tree as %s?' % filename):
self.textTree(filename=filename,seqnum=True,seqname=seqname,maxnamelen=maxnamelen,nodename='num',showboot=showboot,showlen=showlen,blen=blen,scale=scale,spacer=spacer,pause=pause,fromnode=fromnode)
## <vi> ## Edit Branch
if choice.find('B') == 0:
branch.edit()
## <vii> ## Save to file
if choice.find('T') == 0:
print 'Currently Unavailable!'
## <viii> ## Prune Tree
if choice.find('P') == 0:
if rje.yesNo('Remove %d and all descendant nodes and branches?' % n):
self._prune(branch)
## <ix> ## Root on Branch
if choice.find('R') == 0:
self.unRoot()
self.placeRoot('Manual',branch)
## <x> ## Unroot
if choice.find('U') == 0:
self.unRoot()
## <xi> ## Root Menu
if choice.find('M') == 0:
self.info['Rooting'] = 'man'
self.treeRoot()
## <xii> ## Quit
if choice.find('Q') == 0 and rje.yesNo('Quit Tree Edit?'): # Quit
return
## <xiii> ## Zoom
if choice.find('Z') == 0:
n = rje.getInt('Node (0 to Zoom Out): ')
if n == 0:
fromnode = None
else:
fromnode = self._getNode(n)
if fromnode == None:
print 'Cannot find Node %d!' % n
elif fromnode == self.node[-1]:
fromnode = None
# except KeyboardInterrupt:
# if rje.yesNo('Quit Tree Edit?'): # Quit
# return
# else:
# self.editTree()
except:
self.log.errorLog('Major Problem during editTree().',True)
#########################################################################################################################
def textTree(self,filename=None,seqnum=True,seqname='short',maxnamelen=50,nodename='num',showboot=True,showlen='branch',blen='Length',scale=-1,spacer=1,pause=50,fromnode=None,compress=True):
'''
Outputs tree as ASCII text.
>> filename:str [None]
>> seqnum:boolean [True] = whether to print sequence numbers (from zero if nodename <> 'none')
>> seqname:str ['short'] = name to use for sequences
- 'num' = numbers only; 'short' = short sequence names; 'long' = long names
>> maxnamelen:int [50] = truncate names to this length
>> nodename:str ['num'] = how to label nodes
- 'none' = no label, 'num' = numbers only, 'short' = short names, 'long' = long names
>> showboot:boolean [True] = whether to show boostraps if given
>> showlen:str ['branch'] = whether to show lengths of branches leading to nodes
- 'none' = no lengths, 'branch' = branch lengths, 'sum' = summed length from root
>> blen:str ['Length'] = branch lengths
- 'none' = do not use branch lengths; 'fix' = fix at _deflen;
- 'pam' = replace with PAM distances if calculated (else none)
- other = use node.stat[blen]
>> scale:int [-1] = no. of characters per self._deflen distance
>> spacer:int [1] = 'blank' rows between nodes
>> pause:int [50] = Number of lines printed before pausing for user <ENTER>
>> fromnode:Node Object [None] = draw subtree from Node
>> compress:boolean = whether to compress compressed nodes
'''
try:### ~ [0] ~ Setup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
## ~ [0a] ~ Setup Scale ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
if self.stat['DefLen'] <= 0.0:
self.printLog('#DEF','Default branch length cannot be <= 0.0 - reset to 0.1')
self.stat['DefLen'] = 0.1
xpos = {} # Dictionary of node positions on x-axis
if scale <= 0: scale = self.stat['TextScale']
if scale <= 0:
self.log.errorLog('Scale must be > 0! Changed to 1.',printerror=False)
scale = 1
self.stat['TextScale'] = 1
## ~ [0b] ~ Generate PAM BranchLengths if needed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
if (blen == 'pam') and (self.branch[0].stat['PAM'] < 0): self.branchPam()
### ~ [1] ~ Establish Base of Tree ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
ignore = [] # List of nodes to ignore when expanding tree (not in tree or already expanded)
tric = False # Whether base of tree is a trichotomy
if not fromnode or fromnode == self.node[-1]:
basenode = self.node[-1]
if len(basenode.branch) == 3: tric = True # Trichotomy
xpos[basenode] = scale + 1
else:
basenode = fromnode
anc = basenode.ancNode()
ignore.append(anc)
xpos[anc] = 1
branch = basenode.ancBranch()
if blen == 'fix': mylen = self.stat['DefLen']
elif blen.lower() == 'pam': mylen = float(branch.stat['PAM']) / 100
else: mylen = branch.stat[blen]
xpos[basenode] = int(mylen * scale / self.stat['DefLen']) + 2 + xpos[anc]
### ~ [2] ~ Make a list of order of node output and calculate X-pos ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
ynode = [basenode] # List of ynodes in order
replacements = True # Controls continuing of loop until no node replaced with clade
while replacements: # Loop while replacements being made
replacements = False
newy = [] # New ynode list to replace ynode
for node in ynode:
## ~ [2a] ~ Check if node already replaced or terminus/outside subtree ~~~~~~~~ ##
if node in ignore or node.stat['ID'] <= self.stat['SeqNum']:
newy.append(node)
continue
## ~ [2b] ~ Process node ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
replacements = True # Keep Looping
ignore.append(node) # Ignore this node next time
if node.opt['Compress'] and compress: newy.append(node) # Compress clade to node (do not expand)
elif node.stat['ID'] > self.stat['SeqNum']:
## ~ [2c] ~ Calculate ypos ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
nodes = node.neighbours(ignore=ignore)
newy += [nodes[0],node] + nodes[1:]
ignore.append(node)
## ~ [2d] ~ Calculate xpos ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
for i in range(len(nodes)):
branch = nodes[i].link(node)
if blen == 'fix': mylen = self.stat['DefLen']
elif blen.lower() == 'pam': mylen = float(branch.stat['PAM']) / 100
else: mylen = branch.stat[blen]
xpos[nodes[i]] = int(mylen * scale / self.stat['DefLen']) + 2 + xpos[node]
else: raise ValueError
ynode = newy # Update ynode list
### ~ [3] ~ Generate Text Tree ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
maxpos = 0 # Establish maximum x position of node
vline = {} # Dictionary used for drawing vertical lines
for node in ynode:
vline[node] = False # List of on/off values for vertical line
maxpos = max(maxpos,xpos[node])
treelines=[] # List of text lines to be output
## ~ [3a] ~ Build lines, node by node ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
for node in ynode:
branch = node.ancBranch()
## ~ [3b] ~ Branch leading to node ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
if not branch: # Root/Trichotomy
line = '+' # Start of branch
while len(line) < (xpos[node] - 1): line += '-'
else:
anc = branch.link(node)
line = ' ' * (xpos[anc] - 1) # Space before Branch
if anc.opt['Duplication']: # Duplication-specific branch characters
line += '#'
while len(line) < (xpos[node] - 1): line += '='
else:
if anc.opt['SpecDup']: line += '*'
else: line += '+'
while len(line) < (xpos[node] - 1): line += '-'
if node.opt['Duplication']: line += '#' # End of branch
elif node.opt['SpecDup']: line += '*'
else: line += '+'
## ~ [3c] ~ Node Name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
txtname = ''
if node.stat['ID'] <= self.stat['SeqNum']: # Terminal node
if seqnum or (seqname == 'None') or (seqname == 'num'):
txtname = '%d' % node.stat['ID']
if seqname != 'num' and seqname != 'None': txtname += ': '
if seqname == 'short': txtname += node.shortName()
elif seqname == 'long': txtname += node.info['Name']
if len(txtname) > maxnamelen and maxnamelen > 0: txtname = txtname[:maxnamelen] + '...'
else: # Internal node
if nodename == 'none': txtname = ''
elif node.opt['Compress'] and compress:
if nodename == 'num': txtname = '*%d*: ' % node.stat['ID']
txtname += node.info['CladeName']
elif nodename == 'num': txtname = '%d' % node.stat['ID']
elif nodename == 'short': txtname += node.shortName()
elif nodename == 'long': txtname += node.info['Name']
## ~ [3d] ~ Bootstrap ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
if showboot and self.opt['Bootstrapped'] and branch and node.stat['ID'] > self.stat['SeqNum']:
txtname += ' [%d]' % branch.stat['Bootstrap']
## ~ [3e] ~ Branch lengths ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
if branch:
if showlen == 'branch':
if blen == 'fix': mylen = self.stat['DefLen']
elif blen.lower() == 'pam': mylen = float(branch.stat['PAM']) / 100
else: mylen = branch.stat[blen]
txtname += ' {%f}' % mylen
elif showlen == 'sum': txtname += ' {%f}' % self.pathLen(self.rootPath(node))
line += ' ' + txtname
## ~ [3f] ~ Add vertical lines preceeding clade ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
for vnode in ynode:
if vline[vnode] and vnode != anc and vnode != node:
vx = xpos[vnode] - 1
line = line[:vx] + '|' + line[(vx+1):]
if branch != None and node != fromnode:
vline[anc] = not vline[anc]
if anc == basenode and tric and vline[anc] == False:
vline[anc] = True
tric = False
treelines.append('%s\n' % line)
## ~ [3g] ~ Add spacer lines between node lines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
for y in range(spacer):
line = ' ' * xpos[node]
for vnode in ynode:
if vline[vnode]:
vx = xpos[vnode] - 1
line = line[:vx] + '|' + line[(vx+1):]
treelines.append('%s\n' % line)
### ~ [4] ~ Save and/or Print Tree ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
_stage = 'd'
if filename and filename.lower() != 'none':
try:
open(filename, 'w').write(string.join(treelines,''))
self.log.printLog("#OUT","Text tree saved to %s" % filename,1)
except:
self.log.errorLog("Problem saving text tree to %s" % filename)
raise
else:
p = 1
self.verbose(0,5,'\n',1)
for line in treelines:
if p < pause:
self.verbose(0,5,line,0)
p += 1
else:
self.verbose(0,1,line,0)
p = 0
return string.join(treelines,'')
except: self.errorLog('Major Problem with Tree.textTree()')
#########################################################################################################################
def rTree(self,filename,seqname='short',nodename='long',blen='Length',fromnode=None,compress=True,title=None,qry='qry'):
'''
Outputs details of tree to a file to be read in and processed by R.
>> filename:str [None]
>> seqname:str ['short'] = name to use for sequences
- 'num' = numbers only; 'short' = short sequence names; 'long' = long names
>> nodename:str ['num'] = how to label nodes
- 'none' = no label, 'num' = numbers only, 'short' = short names, 'long' = long names
>> blen:str ['Length'] = branch lengths
- 'none' = do not use branch lengths; 'fix' = fix at _deflen;
- 'pam' = replace with PAM distances if calculated (else none)
- other = use node.stat[blen]
>> fromnode:Node Object [None] = draw subtree from Node
>> compress:boolean = whether to compress compressed nodes
'''
try:### ~ [0] ~ Setup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
xpos = {} # Dictionary of node positions on x-axis
if qry == 'qspec': qseq = self.obj['SeqList'].obj['QuerySeq']
else: qseq = None
## ~ [0a] ~ Generate PAM BranchLengths if needed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
if (blen == 'pam') and (self.branch[0].stat['PAM'] < 0): self.branchPam()
## ~ [0b] ~ Setup file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
headers = ['nodenum','ypos','xpos','anc','ancy','ancx','name','boot','family']
rje.delimitedFileOutput(self,filename,headers,',',rje_backup=True)
## ~ [0c] ~ Setup families ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
subfams = {}
for subfam in self.subfams():
famname = subfam.info['CladeName']
if rje.matchExp('(\d+) Seqs \(',famname): famname = 'SubFam%d' % self.subfams().index(subfam)
subfams[subfam] = famname
for node in self._nodeClade(subfam,internal=True): subfams[node] = famname
for node in self.nodes():
if string.split(node.info['Name'],'_')[0] == qry: subfams[node] = qry
elif node.obj['Sequence'] and qseq and node.obj['Sequence'].sameSpec(qseq): subfams[node] = 'qry'
#self.debug(subfams)
### ~ [1] ~ Establish Base of Tree ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
ignore = [] # List of nodes to ignore when expanding tree (not in tree or already expanded)
tric = False # Whether base of tree is a trichotomy
if not fromnode or fromnode == self.node[-1]:
basenode = self.node[-1]
if len(basenode.branch) == 3: tric = True # Trichotomy
xpos[basenode] = 0
else:
basenode = fromnode
anc = basenode.ancNode()
ignore.append(anc)
xpos[anc] = 0
branch = basenode.ancBranch()
if blen == 'fix': mylen = self.stat['DefLen']
elif blen.lower() == 'pam': mylen = float(branch.stat['PAM']) / 100
else: mylen = branch.stat[blen]
xpos[basenode] = max(0,mylen) + xpos[anc]
### ~ [2] ~ Make a list of order of node output and calculate X-pos ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
ynode = [basenode] # List of ynodes in order
replacements = True # Controls continuing of loop until no node replaced with clade
while replacements: # Loop while replacements being made
replacements = False
newy = [] # New ynode list to replace ynode
for node in ynode:
## ~ [2a] ~ Check if node already replaced or terminus/outside subtree ~~~~~~~~ ##
if node in ignore or node.stat['ID'] <= self.stat['SeqNum']:
newy.append(node)
continue
## ~ [2b] ~ Process node ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
replacements = True # Keep Looping
ignore.append(node) # Ignore this node next time
if node.opt['Compress'] and compress: newy.append(node) # Compress clade to node (do not expand)
elif node.stat['ID'] > self.stat['SeqNum']:
## ~ [2c] ~ Calculate ypos ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
nodes = node.neighbours(ignore=ignore)
newy += [nodes[0],node] + nodes[1:]
ignore.append(node)
## ~ [2d] ~ Calculate xpos ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
for i in range(len(nodes)):
branch = nodes[i].link(node)
if blen == 'fix': mylen = self.stat['DefLen']
elif blen.lower() == 'pam': mylen = float(branch.stat['PAM']) / 100
else: mylen = max(0,branch.stat[blen])
xpos[nodes[i]] = mylen + xpos[node]
else: raise ValueError
ynode = newy # Update ynode list
### ~ [3] ~ Output Tree Data ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
for node in ynode:
data = {'nodenum':node.stat['ID'],'ypos':ynode.index(node),'xpos':xpos[node],'name':node.info['Name']}
if node == self.node[-1]:
data['ancx'] = -0.1
data['ancy'] = data['ypos']
else:
anc = node.ancNode()
data['anc'] = anc.stat['ID']
data['ancx'] = xpos[anc]
data['ancy'] = ynode.index(anc)
if node in subfams: data['family'] = subfams[node]
#self.debug(data)
data['boot'] = ''
if self.opt['Bootstrapped'] and node.stat['ID'] > self.stat['SeqNum']:
branch = node.ancBranch()
if branch: data['boot'] = branch.stat['Bootstrap']
if node.stat['ID'] <= self.stat['SeqNum']: # Terminal node
if seqname == 'num': data['name'] = node.stat['ID']
if seqname == 'short': data['name'] = node.shortName()
elif seqname == 'long': data['name'] = node.info['Name']
if not qseq and node.obj['Sequence'] and node.obj['Sequence'].info['AccNum'][:1] == 'E' and node.obj['Sequence'].info['SpecCode'] == 'EMIHU':
#if node.obj['Sequence'].info['Description'] == 'unnamed protein product':
# data['name'] = '*** %s Consensus EST translation %s *** ' % (node.shortName(),node.obj['Sequence'].info['AccNum'])
#else: data['name'] = '*** %s *** ' % data['name']
data['family'] = 'EHUX'
else: # Internal node
#data['family'] = '' # Why???
if nodename == 'none': txtname = ''
elif node.opt['Compress'] and compress: data['name'] = node.info['CladeName']
elif nodename == 'num': data['name'] = node.stat['ID']
elif nodename == 'short': data['name'] = node.shortName()
elif nodename == 'long': data['name'] = node.info['Name']
data['name'] = string.replace(data['name'],'"',"'")
rje.delimitedFileOutput(self,filename,headers,',',data)
self.printLog('#RTREE','Data for %d nodes output to %s' % (len(ynode),filename))
except: self.log.errorLog('Major Problem with Tree.rTree()')
#########################################################################################################################
def pngTree(self,filename,seqname='short',nodename='long',blen='Length',fromnode=None,compress=True,title=None,type='png'):
'''
Outputs details of tree to a file to be read in and processed by R.
>> filename:str [None]
>> seqname:str ['short'] = name to use for sequences
- 'num' = numbers only; 'short' = short sequence names; 'long' = long names
>> nodename:str ['num'] = how to label nodes
- 'none' = no label, 'num' = numbers only, 'short' = short names, 'long' = long names
>> blen:str ['Length'] = branch lengths
- 'none' = do not use branch lengths; 'fix' = fix at _deflen;
- 'pam' = replace with PAM distances if calculated (else none)
- other = use node.stat[blen]
>> fromnode:Node Object [None] = draw subtree from Node
>> compress:boolean = whether to compress compressed nodes
'''
try:### ~ [0] ~ Setup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
rtreefile = '%s.r.csv' % rje.baseFile(filename)
self.rTree(rtreefile,seqname,nodename,blen,fromnode,compress,title,type)
if not os.path.exists(rtreefile):
self.errorLog('PNG Tree error: CSV file not made!',printerror=False)
raise IOError
### ~ [1] ~ Try to run R to generate PNG ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
self.printLog('#RPATH',self.info['RPath'],log=False,screen=self.v()>0)
#self.info['RPath'] = 'c:\\"Program Files"\\R\\R-2.6.2\\bin\\R.exe'
#print self.info['RPath']
rfile = {'png':'rje','bud':'budapest','qspec':'budapest','cairo':'rje_tree.cairo'}[type]
self.info['PathR'] = rje.makePath(os.path.abspath(string.join(string.split(sys.argv[0],os.sep)[:-1]+[''],os.sep)))
rtree = rje.makePath('%s%s.r' % (self.info['PathR'],rfile),wholepath=True)
if not os.path.exists(rtree):
self.info['PathR'] = rje.makePath(os.path.abspath(string.join(string.split(sys.argv[0],os.sep)[:-2]+['libraries','r',''],os.sep)))
rtree = rje.makePath('%s%s.r' % (self.info['PathR'],rfile),wholepath=True)
self.printLog('#%s' % type.upper(),rtree)
if rfile == 'rje':
rcmd = '%s --no-restore --no-save --args "tree" "%s" "rdir=%s"' % (self.info['RPath'],rje.baseFile(filename),self.info['PathR'])
if title: rcmd += ' "treetitle=%s"' % title
else: rcmd += ' "treetitle=%s"' % rje.baseFile(filename,strip_path=True)
else:
rcmd = '%s --no-restore --no-save --args "%s" "%s"' % (self.info['RPath'],rtreefile,filename)
if title: rcmd += ' "%s"' % title
#rcmd += ' < "%s" > "%s.r.tmp.txt" 2>&1' % (rtree,rje.baseFile(filename))
rcmd += ' < "%s" > "%s.r.run"' % (rtree,rje.baseFile(filename))
#x#rcmd = string.replace(rcmd,'\\','\\\\')
self.printLog('#RTREE',rcmd)
problems = os.popen(rcmd).read()
if problems:
self.errorLog(problems,printerror=False)
for ptxt in problems: self.warnLog(ptxt)
elif rje.exists(filename) and rje.exists(rtreefile) and not (self.getBool('DeBug') or self.getBool('Test')): os.unlink(rtreefile)
if not self.getBool('DeBug') and not self.getBool('Test') and os.path.exists('%s.r.run' % rje.baseFile(filename)): os.unlink('%s.r.run' % rje.baseFile(filename))
return rcmd
except: self.log.errorLog('Major Problem with Tree.pngTree()')
#########################################################################################################################
def dictTree(self,seqname='short',nodename='long',blen='Length',fromnode=None,compress=True,title=None,qry='qry'):
'''
Returns tree as data dictionary for SVG (and R) output.
>> filename:str [None]
>> seqname:str ['short'] = name to use for sequences
- 'num' = numbers only; 'short' = short sequence names; 'long' = long names
>> nodename:str ['num'] = how to label nodes
- 'none' = no label, 'num' = numbers only, 'short' = short names, 'long' = long names
>> blen:str ['Length'] = branch lengths
- 'none' = do not use branch lengths; 'fix' = fix at _deflen;
- 'pam' = replace with PAM distances if calculated (else none)
- other = use node.stat[blen]
>> fromnode:Node Object [None] = draw subtree from Node
>> compress:boolean = whether to compress compressed nodes
'''
try:### ~ [0] ~ Setup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
xpos = {} # Dictionary of node positions on x-axis
## ~ [0a] ~ Generate PAM BranchLengths if needed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
if (blen == 'pam') and (self.branch[0].stat['PAM'] < 0): self.branchPam()
## ~ [0b] ~ Setup file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
datadict = {}
headers = ['nodenum','ypos','xpos','anc','ancy','ancx','name','boot','family']
## ~ [0c] ~ Setup families ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
subfams = {}
for subfam in self.subfams():
famname = subfam.info['CladeName']
if rje.matchExp('(\d+) Seqs \(',famname): famname = 'SubFam%d' % self.subfams().index(subfam)
subfams[subfam] = famname
for node in self._nodeClade(subfam,internal=True):
subfams[node] = famname
if string.split(node.info['Name'],'_')[0] == type: subfams[node] = type
### ~ [1] ~ Establish Base of Tree ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
ignore = [] # List of nodes to ignore when expanding tree (not in tree or already expanded)
tric = False # Whether base of tree is a trichotomy
if not fromnode or fromnode == self.node[-1]:
basenode = self.node[-1]
if len(basenode.branch) == 3: tric = True # Trichotomy
xpos[basenode] = 0
else:
basenode = fromnode
anc = basenode.ancNode()
ignore.append(anc)
xpos[anc] = 0
branch = basenode.ancBranch()
if blen == 'fix': mylen = self.stat['DefLen']
elif blen.lower() == 'pam': mylen = float(branch.stat['PAM']) / 100
else: mylen = branch.stat[blen]
xpos[basenode] = max(0,mylen) + xpos[anc]
### ~ [2] ~ Make a list of order of node output and calculate X-pos ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
ynode = [basenode] # List of ynodes in order
replacements = True # Controls continuing of loop until no node replaced with clade
while replacements: # Loop while replacements being made
replacements = False
newy = [] # New ynode list to replace ynode
for node in ynode:
## ~ [2a] ~ Check if node already replaced or terminus/outside subtree ~~~~~~~~ ##
if node in ignore or node.stat['ID'] <= self.stat['SeqNum']:
newy.append(node)
continue
## ~ [2b] ~ Process node ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
replacements = True # Keep Looping
ignore.append(node) # Ignore this node next time
if node.opt['Compress'] and compress: newy.append(node) # Compress clade to node (do not expand)
elif node.stat['ID'] > self.stat['SeqNum']:
## ~ [2c] ~ Calculate ypos ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
nodes = node.neighbours(ignore=ignore)
newy += [nodes[0],node] + nodes[1:]
ignore.append(node)
## ~ [2d] ~ Calculate xpos ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
for i in range(len(nodes)):
branch = nodes[i].link(node)
if blen == 'fix': mylen = self.stat['DefLen']
elif blen.lower() == 'pam': mylen = float(branch.stat['PAM']) / 100
else: mylen = max(0,branch.stat[blen])
xpos[nodes[i]] = mylen + xpos[node]
else: raise ValueError
ynode = newy # Update ynode list
### ~ [3] ~ Make Tree Data Dictionary ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
for node in ynode:
data = {'nodenum':node.stat['ID'],'ypos':ynode.index(node),'xpos':xpos[node],'name':node.info['Name']}
if node == self.node[-1]:
data['ancx'] = -0.1
data['ancy'] = data['ypos']
else:
anc = node.ancNode()
data['anc'] = anc.stat['ID']
data['ancx'] = xpos[anc]
data['ancy'] = ynode.index(anc)
if node in subfams: data['family'] = subfams[node]
data['boot'] = ''
if self.opt['Bootstrapped'] and node.stat['ID'] > self.stat['SeqNum']:
branch = node.ancBranch()
if branch: data['boot'] = branch.stat['Bootstrap']
if node.stat['ID'] <= self.stat['SeqNum']: # Terminal node
if seqname == 'num': data['name'] = node.stat['ID']
if seqname == 'short': data['name'] = node.shortName()
elif seqname == 'long': data['name'] = node.info['Name']
if node.obj['Sequence'] and node.obj['Sequence'].info['AccNum'][:1] == 'E' and node.obj['Sequence'].info['SpecCode'] == 'EMIHU':
if node.obj['Sequence'].info['Description'] == 'unnamed protein product':
data['name'] = '*** %s Consensus EST translation %s *** ' % (node.shortName(),node.obj['Sequence'].info['AccNum'])
else: data['name'] = '*** %s *** ' % data['name']
data['family'] = 'EHUX'
else: # Internal node
if nodename == 'none': txtname = ''
elif node.opt['Compress'] and compress: data['name'] = node.info['CladeName']
elif nodename == 'num': data['name'] = node.stat['ID']
elif nodename == 'short': data['name'] = node.shortName()
elif nodename == 'long': data['name'] = node.info['Name']
data['name'] = string.replace(data['name'],'"',"'")
for h in headers:
if h not in data: data[h] = ''
datadict[node.stat['ID']] = data
return datadict
except: self.log.errorLog('Major Problem with Tree.dictTree()')
#########################################################################################################################
def svgTree(self,filename,seqname='short',nodename='long',blen='Length',fromnode=None,compress=True,title=None,qry='qry',save=True,treesplit=0.5,font=12,maxfont=20,width=1600,height=0,xoffset=0,yoffset=0):
'''
Generates a data dictionary similar to that output to a file to be read in and processed by R for SVG generation.
See rje_tree.dictTee() and rje_svg.svgTree() for parameters.
'''
try:### ~ [0] ~ Setup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
datadict = self.dictTree(seqname,nodename,blen,fromnode,compress,title,qry)
### ~ [1] ~ Generate SVG Tree code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
svg = rje_svg.SVG(self.log,self.cmd_list).svgTree(rje.baseFile(filename,extlist=['.svg']),datadict,treesplit,font,maxfont,width,height,save,xoffset,yoffset)
return svg
except: self.log.errorLog('Major Problem with Tree.svgTree()')
#########################################################################################################################
def htmlTree(self,filename,seqname='short',nodename='long',blen='Length',fromnode=None,compress=True,title=None,qry='qry',treesplit=0.5,font=12,maxfont=20,width=1600,height=0,xoffset=0,yoffset=0):
'''
Generates a data dictionary similar to that output to a file to be read in and processed by R for SVG generation.
See rje_tree.dictTee() and rje_svg.svgTree() for parameters.
'''
try:### ~ [0] ~ Setup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
svgfile = rje.baseFile(filename,strip_path=False,extlist=['.svg']) + '.svg'
svglink = rje.baseFile(filename,strip_path=True,extlist=['.svg']) + '.svg'
svg = self.svgTree(filename,seqname,nodename,blen,fromnode,compress,title,qry,True,treesplit,font,maxfont,width,height,xoffset,yoffset)
if not title: title = 'Tree "%s"' % self.info['Name']
html = rje_html.htmlHead(title,stylesheets=[],tabber=False,frontpage=False,nobots=True)
html += rje_svg.SVG(self.log,self.cmd_list).svgHTML(svgfile,title,svgfile)
html += rje_html.htmlTail(tabber=False)
open(filename,'w').write(html)
self.printLog('#HTML','Tree %s output to %s and %s' % (self.info['Name'],svgfile,filename))
except: self.log.errorLog('Major Problem with Tree.svgTree()')
#########################################################################################################################
def _vertOrder(self,fromnode=None,compress=False,internal=True,namelist=False): ### Returns vertical (tree) ordering of nodes
'''
Returns vertical (tree) ordering of nodes.
>> fromnode:Node Object = root of tree (Actual root if None)
>> compress:bool [False] = whether to compress 'compressed' nodes
>> internal:bool [True] = whether to return internal nodes (or just leaves)
>> namelist:bool [False] = whether to return list of names rather than node objects
'''
try:### ~ [1] ~ Setup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
ignore = [] # List of nodes to ignore from compression etc.
tric = False # Whether base is trichotomy
if not fromnode or fromnode == self.node[-1]:
basenode = self.node[-1] # Start from root
if len(basenode.branch) == 3: tric = True # Trichotomy
else:
basenode = fromnode
anc = basenode.ancNode()
ignore.append(anc)
ynode = [basenode]
### ~ [2] ~ Make a list of order of node output ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
replacements = True
while replacements:
replacements = False
newy = []
for node in ynode: # ! # Add in future 'clade' option
if node in ignore or node.stat['ID'] <= self.stat['SeqNum']:
newy.append(node) # Already replaced/terminus - already handled
elif compress and node.opt['Compress']: # Compress clade to node
replacements = True # Keep Looping
newy.append(node) # Do not expand
ignore.append(node)
elif node.stat['ID'] > self.stat['SeqNum']:
replacements = True # Keep Looping
nodes = node.neighbours(ignore=ignore)
newy += [nodes[0],node] + nodes[1:]
ignore.append(node)
else: raise ValueError
ynode = newy
### ~ [3] ~ Tidy up if desired ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
for node in ynode[0:]:
if not internal and node.stat['ID'] > self.stat['SeqNum']: ynode.remove(node)
elif namelist: ynode[ynode.index(node)] = node.info['Name']
return ynode
except: self.errorLog('Fatal Error with _vertOrder().')
#########################################################################################################################
def _regenerateSeqList(self,seqlist=None,nodelist=[],id=False): ### Reorders/resizes SeqList to match given nodelist
'''
Reorders/resizes SeqList to match given nodelist.
>> seqlist:rje_seq.SeqList Object
>> nodelist:list of Node Objects, which may or may not have Sequence objects associated with them.
>> id:boolean [False] = Whether to append Node ID to front of name (for AncSeqOut)
'''
try:
if seqlist == None:
self.log.errorLog('Called _regenerateSeqList without SeqList!',printerror=False)
raise
seqlist.seq = []
for node in nodelist:
seq = node.obj['Sequence']
if seq != None:
seqlist.seq.append(seq)
if id:
seq.info['Name'] = '%s %s' % (rje.preZero(node.stat['ID'],self.nodeNum()),seq.info['Name'])
except:
self.log.errorLog('Major Problem with _regenerateSeqList().')
raise
#########################################################################################################################
def ancSeqOut(self,file=None,type='fas',ordered=False): ### Output of ancestral sequences.
'''
Output of ancestral sequences.
Makes a new SeqList object and outputs it.
>> file:str [None] = filename
>> type:str ['fas'] = type of file
>> ordered:int [0] = whether to order nodes after seqs. (Default intersperses.)
'''
try:
if file == None:
self.verbose(0,1,"No file output.",2)
return 0
seqlist = self.obj['SeqList']
### <a> ### Determine output order
self.verbose(0,1,"Saving Ancestral Sequences in %s..." % file,1)
if ordered: # Use order given in self.node = existing SeqList
self._regenerateSeqList(seqlist,self.node,id=True)
else:
self._regenerateSeqList(seqlist,self._vertOrder(),id=True)
### <b> ### Output
seqlist.saveFasta(seqfile=file) #!# Change this to saveSeqList when this exists!!
self._regenerateSeqList(seqlist,self.node)
for seq in seqlist.seq:
if rje.matchExp('^(\d+\s+)\S',seq.info['Name']):
try: seq.info['Name'] = string.replace(seq.info['Name'],rje.matchExp('^(\d+\s+)\S',seq.info['Name'])[0],'',1)
except: seq.info['Name'] = seq.info['Name'].replace(rje.matchExp('^(\d+\s+)\S',seq.info['Name'])[0],'',1)
except:
self.log.errorLog('Major Problem with ancSeqOut().')
#########################################################################################################################
### <5> ### Tree Rooting/Editing #
#########################################################################################################################
def _getRootNode(self): ### Returns root node or None if not rooted
'''Returns root node or None if not rooted.'''
try:
root = None
for node in self.node:
node.setType()
if node.info['Type'].find('Root') == 0:
root = node
return root
except:
self.log.errorLog('Problem with _getRootNode()')
raise
#########################################################################################################################
def treeRoot(self): ### Tree Rooting loop.
'''Tree Rooting loop.'''
while self._changeRoot():
self.opt['ReRooted'] = True # Distinguishes loaded root from method rooting
self.verbose(1,2," => Root Changed!",1)
self.textTree()
#########################################################################################################################
def _changeRoot(self): ### Gives options to Re-root Tree
'''
Gives options to Re-root (or unroot) Tree.
Returns True if root changes or False if no change.
Should call treeRoot() from other modules - will loop this method as appropriate.
'''
try:
self.sumTree()
rooting = self.info['Rooting']
self.verbose(1,2,'(Root=%s. Rooted:%s. ReRooted:%s.)' % (rooting,self.opt['Rooted'],self.opt['ReRooted']),1)
## <a> ## Want unrooted tree
if rooting.lower() in ['no','none','unrooted']:
if self.opt['Rooted']: return self.unRoot()
else: return False
## <b> ## First time rooting => automatic options
elif self.opt['ReRooted'] == False:
if rooting.lower() == 'mid': # Midpoint root
return self.midRoot()
elif rooting.lower() == 'ran': # Random root, no branch weighting
return self.randomRoot()
elif rooting.lower() == 'ranwt': # Random root, branch weighting
return self.randomWtRoot()
elif rooting.lower() == 'yes':
if self.opt['Rooted'] == False: # Must root but give choice
if self.stat['Interactive'] >= 0:
return self.manRoot() # Give manual choice
else:
return self.midRoot() # If no interaction, must root somehow!
elif self.stat['Interactive'] > 0:
return self.manRoot() # Give manual choice # ! # Change to >1 and have a second menu for i=1
else: # Rooted & no need to ask
return False
elif rooting.lower() == 'man': # Ask whether to root
if self.stat['Interactive'] >= 0: # Option to re-root tree
return self.manRoot()
else: return False
elif os.path.exists(rooting): # Root from outgroup file
return self.fileRoot(rooting)
else:
self.printLog('#ROOT','Rooting option "%s" unrecognised and not found as file. No re-rooting.' % rooting)
return False
## <c> ## Re-rooting options
else:
if self.stat['Interactive'] >= 1: # Option to re-root tree
return self.manRoot()
elif (rooting == 'man') & (self.stat['Interactive'] >= 0): # Option to re-root tree
return self.manRoot()
else: return False
except:
self.log.errorLog('Major Problem with _changeRoot().')
raise
#########################################################################################################################
def unRoot(self): ### UnRoots the tree.
''''Unroots' the tree => Changes node number and branches.'''
try:
### <a> ### Setup
root = self._getRootNode()
if root == None:
self.log.errorLog('Trying to unroot tree but no root found!',printerror=False)
return False
self.log.printLog('#ROOT','Unrooting Tree.')
tric = root.branch[0].link(root)
self.verbose(1,3,"Remove node %d and combine branches %s and %s." % (root.stat['ID'],root.branch[0].show(),root.branch[1].show()),1)
### <b> ### Combine branches
root.branch[1].combine(root,root.branch[0])
tric.branch.remove(root.branch[0])
tric.branch.append(root.branch[1])
self.branch.remove(root.branch[0])
self.node.remove(root)
self.opt['Rooted'] = False
self.info['RootMethod'] = 'None'
self._renumberNodes()
if self._checkTree() == False:
raise ValueError
self.findDuplications(duptext='Tree unrooted')
return True
except:
self.log.errorLog("Big Problem unrooting Tree!")
raise
#########################################################################################################################
def midRoot(self,fixlen=0.1): ### Midpoint roots tree
'''
Midpoint roots tree.
Returns True if successful and False if fails.
'''
### <a> ### Prepare for Rooting
try:
if self.opt['Rooted']: self.unRoot()
#X#self.verbose(0,3,'\nMidpoint rooting tree...',1)
maxdis = 0
extremetip = (None,None)
rootpath = []
max_prog = (self.nodeNum() - 1) * self.nodeNum()
### <b> ### Find extreme tips (furthest distance)
for n0 in range(self.nodeNum()-1):
for n1 in range(n0 + 1,self.nodeNum()):
node = (self.node[n0],self.node[n1])
if node[0].stat['ID'] <= self.stat['SeqNum'] and node[1].stat['ID'] <= self.stat['SeqNum']:
path = self.pathLink(node[0],node[1])
dis = self.pathLen(path,'Length')
if dis > maxdis:
maxdis = dis
extremetip = (node[0],node[1])
rootpath = path[0:]
#X#self.verbose(0,3,'%d..%d = %f' % (node[0].stat['ID'],node[1].stat['ID'],maxdis),0)
progtxt = 'Midpoint root - Establishing Extreme Tips %.1f%%' % (100.0*(n0*self.nodeNum()+n1)/max_prog)
if extremetip[0] and extremetip[1]:
self.log.printLog('\r#ROOT','%s: MaxDis = %f, %3d..%3d' % (progtxt,maxdis,extremetip[0].stat['ID'],extremetip[1].stat['ID']),log=False,newline=False)
else:
self.log.printLog('\r#ROOT','%s: MaxDis = %f, None' % (progtxt,maxdis),log=False,newline=False)
progtxt = 'Midpoint root - Established Extreme Tips 100.0%%'
self.log.printLog('\r#ROOT','%s: MaxDis = %f, %3d..%3d' % (progtxt,maxdis,extremetip[0].stat['ID'],extremetip[1].stat['ID']))
except:
self.log.errorLog('Problem establishing Extreme Tip Distance.')
return False
### <b> ### Root
try:
## <i> ## identify branch
self.verbose(0,3,'=> %s' % self.pathSummary(rootpath),1)
rootperc = 0
rootdis = 0
b = -1 # Counter for branch in rootpath
while rootdis < (maxdis/2): # Find halfway point of extremes = root
b += 1
root = rootpath[b] # Current branch
rootdis += root.stat['Length'] # Add length until half maxdis exceeded
## <ii> ## Pick spot
rootdis -= (maxdis/2) # Overhang in current branch
#rootdis = root.stat['Length'] - rootdis
try:
rootperc = rootdis / root.stat['Length'] # Distance along branch anc -> desc
except(ZeroDivisionError):
self.log.errorLog('Branch %s has zero length?! (%d)' % (root.show(),root.stat['Length']))
# Work out which end of branch to root from
firstnode = None
lastnode = None
if b > 0: # Occurred on first branch
firstnode = root.commonNode(rootpath[b-1])
if b < (len(rootpath)-1):
lastnode = root.commonNode(rootpath[b+1])
if firstnode == root.descNode() or lastnode == root.ancNode(): # Rooted 'backwards'
rootperc = 1 - rootperc
#self.log.printLog('#ROOT','Midpoint root found! (%.1f of %s)' % (rootperc,root.show()),2)
self.placeRoot('Midpoint',root,fraction=rootperc)
return True
except:
self.log.errorLog('Midpoint Rooting Problem!')
raise
#########################################################################################################################
def randomRoot(self): ### Places root on random branch, ignoring branch lengths.
"""Places root on random branch, ignoring branch lengths."""
try:
if self.opt['Rooted']:
self.unRoot()
rb = random.randint(0, len(self.branch))
self.verbose(1,3,'Placing random root on branch: %s' % self.branch[rb].show(),1)
self.placeRoot('Random',self.branch[rb])
return True
except:
self.log.errorLog('Major Problem during random rooting.')
return True # Still want to repeat even if failure
#########################################################################################################################
def randomWtRoot(self): ### Places root on random branch, weighted by branch lengths.
"""Places root on random branch, weighted by branch lengths."""
try:
if self.opt['Rooted']:
self.unRoot()
tblen = 0
for branch in self.branch:
tblen += branch.stat['Length']
if tblen == 0:
return self.randomRoot() # No branch lengths to use!
else:
rlen = random.random() * tblen
for branch in self.branch:
if rlen <= branch.stat['Length']: # Root
try:
rf = rlen/branch.stat['Length']
except(ZeroDivisionError):
self.log.errorLog("Branch %s has zero length?! (%f)" % (branch.show(),branch.stat['Length']))
rf = 0.0
self.verbose(1,3,'Placing random root at %f of branch: %s' % (rf,branch.show()),1)
self.placeRoot('Random (Weighted)',branch,fraction=rf)
return True
else:
rlen -= branch.stat['Length']
self.log.errorLog("Problem with randomWtRoot - unable to find root!",printerror=False)
return True # Still want to repeat even if failure
except:
self.log.errorLog('Major Problem during weighted random rooting.')
return True # Still want to repeat even if failure
#########################################################################################################################
def manRoot(self): ### Gives manual options for rooting.
'''
Gives manual choices for rooting.
<< False if unchanged, True if changed.
'''
### <a> ### Show Choices
try:
print '\n#*# Rooting Options [%s] #*#\n' % self.opt['Rooted']
current = self._getRootNode()
if current != None:
current = current.info['Name']
print 'Current rooting: %s\n' % current
keepok = True
if self.info['Rooting'] == 'yes':
keepok = self.opt['Rooted']
if keepok:
print ' <0> Keep current rooting.'
print ' --- '
print ' <1> Midpoint Root.'
print ' <2> Root from Outgroup File.'
print ' <3> Make Outgroup File.'
print ' <4> Root on Branch.'
print ' <5> Manual rooting using text Tree (with editing options).'
print ' <6> Random Root.'
print ' <7> Random Root (branch-length weighted).'
if self.opt['Rooted']:
print ' --- \n <8> Unroot.'
except:
self.log.errorLog('Problem with manRoot() choice display.')
### <b> ### Make Choice
try:
choice = rje.getInt(text='\nChoice for Rooting?',blank0=True)
if (choice == 0) and keepok: # Keep current rooting
return False
elif choice == 1: # Midpoint Root
return self.midRoot()
elif choice == 2: # Root from file
try:
rootfile = raw_input('Name of Outgroup file: ')
TEST = open(rootfile, 'r')
TEST.close()
return self.fileRoot(rootfile)
except(IOError): # If file does not exist then give fresh choice
print '%s not found!' % rootfile
elif choice == 3: # Make outgroup file. Give option afterwards to root from it!
return self.makeRootFile()
elif choice == 4: # Root on Branch.
return self.branchRoot() # Options for terminal or internal. <R>oot, <N>ext, <C>ancel
elif choice == 5: # editTree() rooting
self.editTree()
return False
elif choice == 6: # Random root
return self.randomRoot() # Root on random branch
elif choice == 7: # Random root (weighted)
return self.randomWtRoot() # Option for weighting by branch lengths
elif (choice == 8) and self.opt['Rooted']: # Unroot
return self.unRoot()
else: # Failed to choose
return self.manRoot()
except:
self.log.errorLog('Problem with manRoot() choice.')
return False
#########################################################################################################################
def branchRoot(self,nextb=0,inroot=None): ### Manually places root on branch. Option to save outgroup.
'''
Manually places root on branch. Option to save outgroup.
'''
try:
### <a> ### Setup & Unroot if rooted
b = nextb
if inroot == None:
inroot = self.opt['Rooted']
if self.opt['Rooted']:
self.unRoot()
branch = self.branch[b]
clades = self.branchClades(branch)
### <b> ### Choices
print '\nBranch %s:\n%s\n vs\n%s\n' % (branch.show(),self.nodeList(clades[0]),self.nodeList(clades[1]))
print '<R>oot, <N>ext, <P>revious, <I>nternal branches, <Q>uit',
choice = rje.choice(': ',default='N').upper()
print choice
if choice.find('R') == 0:
self.placeRoot('Manual',branch)
return True
elif choice.find('P') == 0:
b -= 1
elif choice.find('I') == 0:
b = self.stat['SeqNum']
elif choice.find('Q') == 0:
if inroot:
return True
else:
return False
elif choice[0] == 'N':
b += 1
### <c> ### 'Wraparound' branches and iterate
if b < 0:
b = len(self.branch) - 1
if b >= len(self.branch):
b = 0
return self.branchRoot(nextb=b,inroot=inroot)
except:
self.log.errorLog('Major Problem with branchRoot()')
if inroot:
return True
else:
return False
#########################################################################################################################
def fileRoot(self,rootfile,inroot=False): ### Places root on unrooted tree based on outgroup sequences
'''
Places root on unrooted tree based on outgroup sequences.
>> rootfile:str = filename
>> inroot:boolean = whether tree already rooted (for Exception return)
<< returns True if rooting changed, False if not
'''
try:
### Read sequence names for 'outgroup' ###
self.verbose(0,3,'Rooting tree using %s...' % rootfile,1)
rootseqs = self.loadFromFile(rootfile,chomplines=True)
### Unroot if rooted ###
if self.opt['Rooted']:
inroot = True
self.unRoot()
### Make list of outgroup nodes from sequence names/numbers in file ###
# - Numbers must match order of input sequences
# - Names must be included in names of nodes
outgroup = []
## <i> ## Numbered only
named = False
for name in rootseqs:
if re.search('\D.*',name):
named = True
elif name and rje.matchExp('(\d+)',name):
num = int(rje.matchExp('(\d+)',name)[0])
if num <= self.stat['SeqNum']:
outgroup.append(self.node[num-1])
else:
self.log.errorLog('Sequence numbers from %s exceed number of sequences (%d)! Trying as names...' % (rootfile,self.stat['SeqNum']),printerror=False)
named = True
break
## <ii> ## Named
if named:
outgroup = []
for name in rootseqs:
if rje.matchExp('^(\S.+)\s*$',name):
match = rje.matchExp('^(\S.+)\s*$',name)[0]
for n in range(self.stat['SeqNum']):
if self.node[n].info['Name'].find(match) == 0:
outgroup.append(self.node[n])
### Place Root using outgroup ###
# - include all outgroup seqs in clade but minimise others
root = None
if len(outgroup) == 0:
self.log.errorLog("No %s Root Sequences found in tree!" % rootfile,printerror=False)
raise
elif len(outgroup) == 1: # Single outgroup sequence
root = outgroup[0].branch[0]
else:
minseq = len(self.node)
for branch in self.branch:
clades = self.branchClades(branch)
outbranch = [True,True]
for node in outgroup:
if node in clades[0]:
outbranch[1] = False
elif node in clades[1]:
outbranch[0] = False
else:
self.log.errorLog('Major Problem in fileRoot(). Outgroup node missing from Branch Clades.',printerror=False)
raise
if outbranch[0] and (len(clades[0]) < minseq):
minseq = len(clades[0])
root = branch
elif outbranch[1] and (len(clades[1]) < minseq):
minseq = len(clades[1])
root = branch
### Place Root ###
if root == None:
self.log.errorLog("Cannot place root in tree! Check outgroups in single clade." % rootfile,printerror=False)
raise
else:
self.verbose(1,3,"Rooting on %d of %d input seqs %s" % (len(outgroup),len(rootseqs),self.nodeList(outgroup)),1)
self.placeRoot(method='File (%s)' % rootfile, root=root)
except:
self.log.errorLog('Major Problem with fileRoot()')
if inroot:
return True
else:
return False
#########################################################################################################################
def makeRootFile(self): ### Makes outgroup list and places in file. Gives option to root from it.
'''
Makes outgroup list and places in file. Gives option to root from it.
<< False if no rooting, True if rooted.
'''
try:
### <a> ### Make file
while 1:
print 'Name of Outgroup file: ',
outfile = raw_input('')
print outfile
if outfile != '' and rje.yesNo("Save as '%s'" % outfile):
break
OUT = open(outfile,'w')
### <b> ### Choose sequence
outgroup = []
snum = self.stat['SeqNum']
s = 0
while len(outgroup) < (snum-1): # Must have at least one sequence not in outgroup!
if self.node[s] in outgroup:
s += 1
else:
print '%s: %s' % (rje.preZero((s+1),snum),self.node[s].info['Name'])
print ' <O>utgroup, <N>ext, <P>revious, <Q>uit'
action = raw_input(': ').lower()
if action.find('o') == 0:
OUT.write('%s\n' % self.node[s].info['Name'])
outgroup.append(self.node[s])
elif action.find('p') == 0:
s -=1
elif action.find('q') == 0:
if rje.yesNo('Finish file with %d outgroup seqs %s?' % (len(outgroup),self.nodeList(outgroup))):
break
else:
s +=1
if s < 0:
s = snum - 1
elif s > snum:
s = 0
### <c> ### Finish
OUT.close()
self.log.printLog('#OUT','%d Outgroup seqs saved in %s %s\n' % (len(outgroup),outfile,self.nodeList(outgroup)),1)
if rje.yesNo('Root using %s' % outfile):
return self.fileRoot(outfile)
else:
return False
except:
self.log.errorLog('Major Problem with makeRootFile()')
return False
#########################################################################################################################
def placeRoot(self,method,root,fraction=None): ### Places root on unrooted tree.
'''
Places root on unrooted tree.
>> method:str = Method of rooting
>> root:Branch = branch on which to place root
>> fraction:float = fraction along branch to place root anc -> desc
'''
try:
### <a> ### Setup
calcfrac = False
if fraction == None:
calcfrac = True
elif (fraction < 0) | (fraction > 1):
self.log.errorLog("Root was to be placed outside boundaries of root branch!",printerror=False)
calcfrac = True
rootbuffer = self.stat['RootBuffer']
rootlen = root.stat['Length']
self.verbose(2,3,'\nPlacing root on %s' % root.show(),1)
### <b> ### Position root along branch if placement not given
if calcfrac:
## <i> ## Calculate mean distance from tips to middle of branch
self.verbose(1,3,'Calculating position on branch to place root...',1)
rdis = [0.0,0.0] # Mean distance to middle of branch
rx = [0,0] # Number of seqs from middle of branch
rn = root.node
for s in range(self.stat['SeqNum']):
s_path = self.pathLink(self.node[s],rn[0])
if root in s_path: # Path always includes root to give at least one branch
n = 1
else:
n = 0
s_path.append(root)
rdis[n] = rdis[n] + float(self.pathLen(s_path))
rx[n] += 1
rdis[0] = (rdis[0]/rx[0]) - (rootlen/2)
rdis[1] = (rdis[1]/rx[1]) - (rootlen/2)
self.verbose(2,3,'%d Tips through %d = %f\n%d Tips through %d = %f' % (rx[0],rn[0].stat['ID'],rdis[0],rx[1],rn[1].stat['ID'],rdis[1]),2)
## <ii> ## Place root nearest the deeper node
if rdis[0] >= rdis[1]: # Place Root nearer rn[0]
dif = rdis[0] - rdis[1]
dis = (rootlen - dif) / 2
if dis < rootbuffer:
dis = rootlen * rootbuffer
else: # Place Root nearer rn[1]
dif = rdis[1] - rdis[0]
dis = (rootlen + dif) / 2
if (rootlen - dis) < rootbuffer:
dis = rootlen * (1 - rootbuffer)
try:
fraction = dis / rootlen
except(ZeroDivisionError):
self.log.errorLog("Root Branch has zero length?! (%d)" % rootlen)
fraction = 0.5 # Will not matter if zero length!
### <c> ### Place root
self.log.printLog('\r#ROOT','%s Root placed. (%.1f%% of %s, len %f)' % (method,100.0*fraction,root.show(),rootlen),1)
## <i> ## New node and branch
newnode = Node(log=self.log,cmd_list=self.cmd_list)
newnode.info['Name'] = '%s Root' % method
newnode.stat['ID'] = self.nodeNum() + 1
newbranch = Branch(log=self.log,cmd_list=self.cmd_list)
newbranch.stat['Length'] = rootlen * (1 - fraction)
newbranch.stat['Bootstrap'] = root.stat['Bootstrap']
newbranch.node = [root.node[1],newnode]
newnode.branch = [root,newbranch]
## <ii> ## Adjust existing nodes and branches
## Node 'beyond' root
root.node[1].branch.remove(root)
root.node[1].branch.append(newbranch)
## Rooted branch
root.stat['Length'] = rootlen * fraction
root.node.remove(root.node[1])
root.node.append(newnode)
self.node.append(newnode)
self.branch.append(newbranch)
self.opt['Rooted'] = True
self.info['RootMethod'] = method
self._renumberNodes()
if self._checkTree() == False:
raise ValueError
self.findDuplications(duptext='Root Placed')
except:
self.log.errorLog('Major problem with placeRoot()')
raise
#########################################################################################################################
### <6> ### Path Links etc. #
#########################################################################################################################
def pathLink(self,node1,node2): ### Returns list of branches linking nodes
'''
Returns list of branches linking nodes.
>> node1:Node Object
>> node2:Node Object
>> retry:boolean = whether to retry if fails
<< list of branches in order node1 -> node2,
'''
try:
### <a> ### Find Common branch
path1 = self.rootPath(node1)
path2 = self.rootPath(node2)
path2.reverse()
for branch in path1:
if branch in path2:
path = path1[:path1.index(branch)] + path2[path2.index(branch)+1:]
return path
### <b> ### Retry if failure
path = path1 + path2
return path
except:
self.log.errorLog('pathLink() Problem!')
raise
#########################################################################################################################
def rootPath(self,node): ### Returns path to root or 'trichotomy'
'''
Returns path to root or 'trichotomy'.
<< list of branch objects
'''
try:
### <a> ### First Branch
path = []
nextnode = node
while nextnode.stat['ID'] < self.nodeNum():
prevnode = nextnode
for branch in nextnode.branch:
if branch.link(nextnode).stat['ID'] > nextnode.stat['ID']:
path.append(branch)
nextnode = branch.link(nextnode)
break
if prevnode == nextnode: ## No change!
self.log.errorLog('Major problem with node numbering.',printerror=False)
raise ValueError('Major problem with node numbering for rootPath()')
return path
except:
self.log.errorLog('Major problem with rootPath().')
raise
#########################################################################################################################
def pathLen(self,path,stat='Length'): ### Returns length of path (list of branches)
'''
Returns length of path as defined by given stat.
>> path:list of Branch objects
>> stat:key for branch.stat dictionary
<< dis:float = total length as float
'''
try:
dis = 0.0
for branch in path:
dis += float(branch.stat[stat])
return dis
except:
self.log.errorLog('pathLen Problem!')
raise
#########################################################################################################################
def pathSummary(self,pathin): ### Returns summary of path as Node numbers X -> Y etc.
'''
Returns summary of path as Node numbers X -> Y etc.
>> path:list of branch objects
<< summary:str = text summary of path
'''
try:
path = pathin[0:]
if len(path) == 1:
return path[0].show()
else:
firstlink = path[0].commonNode(path[1])
summary = '%d' % path[0].link(firstlink).stat['ID']
while len(path) > 1:
nextlink = path[0].commonNode(path[1])
summary += ' -> %d' % nextlink.stat['ID']
path.pop(0)
summary += ' -> %d' % path[0].link(nextlink).stat['ID']
return summary
except:
self.log.errorLog('pathSummary() Problem!')
raise
#########################################################################################################################
def branchClades(self,branch,internal=False): ### Return tuple of lists of sequences either side of branch ('anc','desc')
'''
Returns lists of sequences either side of branch, (anc,desc)
>> branch:Branch
>> internal:bool [False] = whether to return internal nodes as well as termini
<< tuple:lists of Node Objects
'''
try:
ntuple = ([],[])
for node in self.node:
if internal or len(node.branch) == 1: ### Terminal node
if node.stat['ID'] > self.seqNum() and not internal:
self.log.errorLog('Terminal node %s not really terminal? ID:%d, %d termini?' % (node.info['Name'],node.stat['ID'],self.seqNum()),True,printerror=False)
print self.obj['SeqList']
print self.node
link = self.pathLink(branch.ancNode(),node)
if branch in link: ntuple[1].append(node) ### Node is in 'descendant' clade
else: ntuple[0].append(node)
return ntuple
except:
self.log.errorLog('Major Problem with branchClades(%s)' % branch)
print branch.stat, branch.node
raise
#########################################################################################################################
def _descClades(self,node,internal=False): ### Returns tuple of lists of both descendant clades
'''
Returns tuple of lists of both descendant clades.
>> node:Node Object = ancestral node
>> internal:bool [False] = whether to return internal nodes as well as termini
<< tuple:lists of node objects in descendant clades
'''
try:
if len(node.branch) == 1: return ([node],[]) # Terminal Sequence
if len(node.branch) == 2: # Root
desc = node.neighbours()
else:
ancb = node.ancBranch()
ancn = ancb.link(node)
desc = node.neighbours(ignore=[ancn])
return (self.branchClades(node.link(desc[0]),internal=internal)[1],self.branchClades(node.link(desc[1]),internal=internal)[1])
except:
self.log.errorLog('Fatal Error with _descClades().')
raise
#########################################################################################################################
def _nodeClade(self,node,internal=False): ### Returns list of descendant clade
'''Returns list of descendant clade.'''
if node == self.node[-1] or node.ancBranch() == None:
if internal: return self.nodes()
else: return self.node[:self.stat['SeqNum']]
else: return self.branchClades(node.ancBranch(),internal=internal)[1]
#########################################################################################################################
def _nodeSeqs(self,nodelist): ### Returns list of seqs from list of nodes
'''Returns list of descendant clade.'''
if self.obj['SeqList']:
seqs = []
for node in nodelist: seqs.append(node.obj['Sequence'])
return seqs
else: return []
#########################################################################################################################
def _bestCladeNode(self,nodelist): ### Returns the best ancestral node for the nodelist clade given
'''
Returns the best ancestral node for the nodelist clade given.
- include all seqs in clade but minimise others.
>> nodelist:list of node objects
<< cladenode:Node object
'''
try:
cladenode = None
if len(nodelist) == 0: # No sequences
cladnode = None
if len(nodelist) == 1: # Single sequence
cladnode = nodelist[0]
else:
minseq = len(self.node)
for cnode in self.node:
clade = self._nodeClade(cnode)
ok = True
extra = 0
for node in self.node[:self.stat['SeqNum']]:
if node in nodelist and node not in clade:
ok = False
elif node in clade and node not in nodelist:
extra += 1
if ok and extra < minseq:
minseq = extra
cladenode = cnode
return cladenode
except:
self.log.errorLog('Problem with _bestCladeNode().')
raise
#########################################################################################################################
def outGroupNode(self,node): ### Returns 'outgroup' to node = other descendant of ancestral node
'''
Returns 'outgroup' to node = other descendant of ancestral node.
>> node:Node Object
'''
anc = node.ancNode()
out = anc.neighbours(ignore=[node,anc.ancNode()])
if len(out) != 1:
self.log.errorLog('Problem with outGroupNode(). Not returning a single node. (%s)' % out,printerror=False)
return None
return out[0]
#########################################################################################################################
def cladeSpec(self,node): ### Returns dictionary of {species code:count} for descendant clade (assumes gn_sp__acc)
'''Returns list of species codes for descendant clade (assumes gn_sp__acc).'''
specdict = {}
for node in self._nodeClade(node,internal=False):
try: spec = string.split(node.shortName(),'_')[1]
except: spec = 'Unknown'
if spec not in specdict: specdict[spec] = 0
specdict[spec] += 1
return specdict
#########################################################################################################################
### <7> ### Duplications #
#########################################################################################################################
def _isAnc(self,an,dn): ### Returns boolean whether an is ancestral to dn
'''
Returns boolean whether an is descendant of dn.
>> an:Node = putative ancestral node
>> dn:Node = putative descendant node
<< anc:boolean = whether an is ancestral of dn
'''
try:
if an == dn:
return False
if an.stat['ID'] < dn.stat['ID']:
return False
#path = self.pathLink(an,dn)
#for branch in self.node[-1].branch:
path = self.pathLink(dn,self.node[-1]) # Path to root
for branch in an.branch:
if branch in path:
return True
return False
except:
self.log.errorLog('Problem with _isAnc().')
raise
#########################################################################################################################
def findDuplications(self,species=None,duptext=''): ### Finds Duplication Nodes
'''
Finds Duplication nodes in tree.
>> species:str = mark duplication for this species only [None]
'''
try:
### <a> ### Make sure sequences are present and have species
if self.obj['SeqList'] == None:
self.log.printLog('#DUP','Cannot find Duplications without sequence information.')
for node in self.node: node.opt['Duplication'] = False
return False
elif self.opt['Rooted'] == False:
self.log.printLog('#DUP','Unrooted tree: clearing Duplications.')
for node in self.node: node.opt['Duplication'] = False
return
else:
for seq in self.obj['SeqList'].seq:
if seq.info['Species'] == 'Unknown':
seq.info['Species'] = seq.info['SpecCode']
### <b> ### Identify Duplications using species data
if duptext: duptext = ' (%s)' % duptext
for node in self.node:
self.log.printLog('\r#DUP','Finding Duplications %s: %.1f%%' % (duptext,100.0*self.node.index(node)/len(self.node)),newline=False,log=False)
node.opt['Duplication'] = False
if len(node.branch) > 1: # Internal
clade = self._descClades(node)
cladespec = []
for s in clade[0] + clade[1]:
spcode = s.obj['Sequence'].info['SpecCode']
if spcode.startswith('9') and not self.getBool('9SPEC'): spcode = 'UNK'
if spcode not in cladespec: cladespec.append(spcode)
for s in clade[0]:
if node.opt['Duplication']: break
elif (species == None) or (species == s.obj['Sequence'].info['Species']) or (species == s.obj['Sequence'].info['SpecCode']):
myspec = s.obj['Sequence'].info['SpecCode']
if myspec.startswith('9') and not self.getBool('9SPEC'): myspec = 'UNK'
for t in clade[1]:
tspec = t.obj['Sequence'].info['SpecCode']
if tspec.startswith('9') and not self.getBool('9SPEC'): tspec = 'UNK'
if node.opt['Duplication']: break
elif (tspec != 'UNK') and (tspec == myspec): node.opt['Duplication'] = True
if node.opt['Duplication'] and len(cladespec) < self.stat['SpecDup'] and 'UNK' not in cladespec:
node.opt['SpecDup'] = True; node.opt['Duplication'] = False
self.log.printLog('\r#DUP','Finding Duplications %s: 100.0%%' % duptext)
except: self.log.errorLog('Problem in findDuplications().',printerror=True,quitchoice=False)
#########################################################################################################################
def findDuplicationsNoSeq(self,species=None,duptext=''): ### Finds Duplication Nodes
'''
Finds Duplication nodes in tree.
>> species:str = mark duplication for this species only [None]
'''
try:
### <a> ### Make sure sequences are present and have species
if self.opt['Rooted'] == False:
self.log.printLog('#DUP','Unrooted tree: clearing Duplications.')
for node in self.node: node.opt['Duplication'] = False
return
### <b> ### Identify Duplications using species data
if duptext: duptext = ' (%s)' % duptext
for node in self.node:
self.log.printLog('\r#DUP','Finding Duplications %s: %.1f%%' % (duptext,100.0*self.node.index(node)/len(self.node)),newline=False,log=False)
node.opt['Duplication'] = False
if len(node.branch) > 1: # Internal
clade = self._descClades(node)
cladespec = []
for s in clade[0] + clade[1]:
spcode = string.split(s.info['Name'],'_')[1]
if spcode.startswith('9') and not self.getBool('9SPEC'): spcode = 'UNK'
if spcode not in cladespec: cladespec.append(spcode)
for s in clade[0]:
spcode = string.split(s.info['Name'],'_')[1]
if spcode.startswith('9') and not self.getBool('9SPEC'): spcode = 'UNK'
if node.opt['Duplication']: break
elif (species == None) or (species == spcode):
myspec = spcode
for t in clade[1]:
tspec = string.split(t.info['Name'],'_')[1]
if tspec.startswith('9') and not self.getBool('9SPEC'): tspec = 'UNK'
if node.opt['Duplication']: break
elif (tspec != 'UNK') and (tspec == myspec): node.opt['Duplication'] = True
if node.opt['Duplication'] and len(cladespec) < self.stat['SpecDup'] and 'UNK' not in cladespec:
node.opt['SpecDup'] = True; node.opt['Duplication'] = False
self.log.printLog('\r#DUP','Finding Duplications %s: 100.0%%' % duptext)
except: self.log.errorLog('Problem in findDuplicationsNoSeq().',printerror=True,quitchoice=False)
#########################################################################################################################
### <8> ### Tree Subfamilies and Groupings #
### Note that the contents of these methods have been moved to rje_tree_group.py #
#########################################################################################################################
## <8A> ## Master Subfamily/Grouping Methods #
#########################################################################################################################
def _checkGroupNames(self): ### Automatically names groups after given gene unless already renamed
return rje_tree_group._checkGroupNames(self)
#########################################################################################################################
def treeGroup(self,callmenu=False): ### Master Tree Grouping loop.
'''See rje_tree_group.treeGroup().'''
rje_tree_group.treeGroup(self,callmenu)
#########################################################################################################################
def _autoGroups(self,method='man'): #### Automatically goes into grouping routines
'''See rje_tree_group._autoGroups().'''
rje_tree_group._autoGroups(self,method)
#########################################################################################################################
def _checkGroups(self): ### Checks that Group selection does not break 'rules'
'''See rje_tree_group._checkGroups().'''
return rje_tree_group._checkGroups(self)
#########################################################################################################################
## <8B> ## Grouping Gubbins #
#########################################################################################################################
def _orphanCount(self): ### Returns number of orphan sequences
'''See rje_tree_group._orphanCount().'''
return rje_tree_group._orphanCount(self)
#########################################################################################################################
def _purgeOrphans(self): ### Removes orphan nodes
'''See rje_tree_group._purgeOrphans().'''
return rje_tree_group._purgeOrphans(self)
#########################################################################################################################
def _resetGroups(self): ### Clears compression of non-group nodes
'''See rje_tree_group._resetGroups().'''
rje_tree_group._resetGroups(self)
#########################################################################################################################
def _addGroup(self,node): ### Adds group based at node, removing existing descendant groups
'''See rje_tree_group._addGroup().'''
rje_tree_group._addGroup(self,node)
#########################################################################################################################
def _grpVarDel(self,delseq=[],kept=None,fam=None): ### Deletes all variants in list
'''See rje_tree_group._grpVarDel().'''
rje_tree_group._grpVarDel(self,delseq,kept,fam)
#########################################################################################################################
def _grpSeqSort(self,seqs=[],compseq=None): ### Reorders seqs according to %ID, Gaps and Extra
'''See rje_tree_group._grpSeqSort().'''
rje_tree_group._grpSeqSort(self,seqs,compseq)
#########################################################################################################################
def _reorderSeqToGroups(self): ### Reorders sequences according to groups #!# Add query? And _grpSeqSort()?
'''See rje_tree_group._reorderSeqToGroups().'''
rje_tree_group._reorderSeqToGroups(self)
#########################################################################################################################
## <8C> ## Interactive Grouping #
#########################################################################################################################
def _groupChoice(self): ### Gives manual options for grouping and updates self.info['Grouping'].
'''See rje_tree_group._groupChoice().'''
return rje_tree_group._groupChoice(self)
#########################################################################################################################
def _sumGroups(self): ### Prints summary of Groups
'''See rje_tree_group._sumGroups().'''
return rje_tree_group._sumGroups(self)
#########################################################################################################################
def _groupRules(self): ### Options to change grouping options
'''See rje_tree_group._groupRules().'''
rje_tree_group._groupRules(self)
#########################################################################################################################
def _saveGroups(self,filename='rje_tree.grp',groupnames=True): # Saves sequence names in Groups
'''See rje_tree_group._saveGroups().'''
rje_tree_group._saveGroups(self,filename,groupnames)
#########################################################################################################################
## <8D> ## Grouping Methods #
#########################################################################################################################
def _clearGroups(self): ### Clears current group selection
'''See rje_tree_group._clearGroups().'''
return rje_tree_group._clearGroups(self)
#########################################################################################################################
def _loadGroups(self,filename='rje_tree.grp'): # Saves sequence names in Groups
'''See rje_tree_group._loadGroups().'''
rje_tree_group._loadGroups(self,filename)
#########################################################################################################################
def _dupGroup(self): ### Duplication grouping
'''See rje_tree_group._dupGroup().'''
rje_tree_group._dupGroup(self)
#########################################################################################################################
## <8E> ## Review Grouping #
#########################################################################################################################
def _reviewGroups(self,interactive=1): ### Summarise, scan for variants (same species), edit group
'''See rje_tree_group._reviewGroups().'''
rje_tree_group._reviewGroups(self,interactive)
#########################################################################################################################
def _groupDisSum(self,seq1,seq2,text=''): ### Prints ID, Gaps and Extra Summary of seq1 vs seq2
'''See rje_tree_group._groupDisSum().'''
rje_tree_group._groupDisSum(self,seq1,seq2,text)
#########################################################################################################################
### <9> ### Miscellaneous Tree Methods #
#########################################################################################################################
def branchPam(self,pam=None): ### Calculate PAM distances for branches
'''
Calculates PAM distances for branches.
>> pam:rje_pam.PamCtrl Object [None]
'''
try:### ~ [1] ~ Set up PAM Control Object ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
if pam: self.obj['PAM'] = pam
if not self.obj['PAM']: self.obj['PAM'] = rje_pam.PamCtrl(self,self.log,self.cmd_list)
### ~ [2] ~ Calculate PAM distances ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
(bx,btot) = (0.0,self.branchNum())
for branch in self.branch:
self.printLog('\r#PAM','Calculating branch ML PAM: %.1f%%' % (bx/btot),newline=False,log=False)
bx += 100.0
n = [branch.node[0].stat['ID'],branch.node[1].stat['ID']]
if branch.node[0].obj['Sequence'] == None or branch.node[1].obj['Sequence'] == None:
self.log.errorLog('Attempting to calculate PAM distance with missing sequence (%d or %d)' % (n[0],n[1]),printerror=False)
else:
seq = [branch.node[0].obj['Sequence'].info['Sequence'],branch.node[1].obj['Sequence'].info['Sequence']]
if n[0] > n[1]: branch.stat['PAM'] = self.obj['PAM'].pamML('Branch %d->%d' % (n[0],n[1]),seq[0],seq[1])
else: branch.stat['PAM'] = self.obj['PAM'].pamML('Branch %d->%d' % (n[1],n[0]),seq[1],seq[0])
self.verbose(2,4,'Branch %s = PAM%d' % (branch.show(),branch.stat['PAM']),1)
self.printLog('\r#PAM','Calculation of branch ML PAM complete.',log=False)
except:
self.log.errorLog("Major problem calculating branch PAM distances")
raise
#########################################################################################################################
def indelTree(self,filename='indel.txt'): ### Produces a text tree with indels marked
'''
Produces a text tree with indels marked.
> filename:str = output file name
'''
try:
### <a> ### Make branch indel dictionaries
indel = {}
indeltxt = {}
keys = ['ins_num','ins_aa','del_num','del_aa']
self.verbose(0,3,'Calculating indel stats...',0)
for branch in self.branch:
## <i> ## Setup
indel[branch] = {}
for key in keys:
indel[branch][key] = 0
status = 'None'
anc = branch.ancNode().obj['Sequence']
desc = branch.descNode().obj['Sequence']
if anc == None or desc == None:
self.log.errorLog('Ancestral or Descendant sequences missing!',printerror=False)
raise ValueError
seqlen = anc.seqLen()
if desc.seqLen() != seqlen:
self.log.errorLog('Ancestral (%s) and Descendant (%s) Sequences have different lengths!' % (anc.info['ID'],desc.info['ID']),printerror=False)
raise ValueError
## <ii> ## Calculate
for r in range(seqlen):
if anc.info['Sequence'][r] == '-' and desc.info['Sequence'][r] == '-': # Gap
status = 'None'
elif anc.info['Sequence'][r] != '-' and desc.info['Sequence'][r] != '-': # Seq
status = 'None'
elif anc.info['Sequence'][r] == '-' and desc.info['Sequence'][r] != '-': # Insertion
indel[branch]['ins_aa'] += 1
if status != 'Ins': # New insertion
indel[branch]['ins_num'] += 1
status = 'Ins'
elif anc.info['Sequence'][r] != '-' and desc.info['Sequence'][r] == '-': # Deletion
indel[branch]['del_aa'] += 1
if status != 'Del': # New insertion
indel[branch]['del_num'] += 1
status = 'Del'
## <iii> ## Make indeltxt
indeltxt[branch] = '{+%d(%d),-%d(%d)}' % (indel[branch]['ins_aa'],indel[branch]['ins_num'],indel[branch]['del_aa'],indel[branch]['del_num'])
self.verbose(0,3,'Done!',1)
except:
self.log.errorLog('Major problem with indelTree() Calculations.')
raise
### <b> ### Tree Output #!# Copies textTree for now!
try:
## <i> ## Setup
seqnum = True
seqname = 'short'
maxnamelen = 50
nodename = 'num'
showboot = True
showlen = 'branch'
blen = 'Length'
scale = 4
spacer = 1
pause = 50
fromnode = None
## <ii> ## textTree() #!# Confusing numbering of comments ahead! :o)
### <a> ### Setup
ignore = []
## <i> ## Scale
xpos = {}
if scale <= 0:
self.log.errorLog("Scale must be > 0! Changed to 1.",printerror=False)
scale = 1
## <ii> ## BranchLengths
if (blen == 'pam') & (self.branch[0].stat['PAM'] < 0):
self.branchPam()
## <iii> ### Base of Tree
tric = False
if fromnode == None or fromnode == self.node[-1]:
basenode = self.node[-1]
if len(basenode.branch) == 3: # Trichotomy
print 'Trichotomy'
tric = True
xpos[basenode] = scale + 1
else:
basenode = fromnode
anc = basenode.ancNode()
ignore.append(anc)
xpos[anc] = 1
branch = basenode.ancBranch()
if blen == 'fix':
mylen = self.stat['DefLen']
elif blen.lower() == 'pam':
mylen = float(branch.stat['PAM']) / 100
else:
mylen = branch.stat[blen]
xpos[basenode] = int(mylen * scale / self.stat['DefLen']) + 2 + xpos[anc]
ynode = [basenode]
### <b> ### Make a list of order of node output and calculate X-pos
replacements = True
while replacements:
replacements = False
newy = []
for node in ynode: # ! # Add in future 'clade' option
if node in ignore or node.stat['ID'] <= self.stat['SeqNum']:
newy.append(node) # Already replaced/terminus - already handled
elif node.opt['Compress']: # Compress clade to node
replacements = True # Keep Looping
newy.append(node) # Do not expand
ignore.append(node)
elif node.stat['ID'] > self.stat['SeqNum']:
replacements = True # Keep Looping
## <i> ## ypos
nodes = node.neighbours(ignore=ignore)
newy += [nodes[0],node] + nodes[1:]
ignore.append(node)
## <ii> ## xpos
for i in range(len(nodes)):
branch = nodes[i].link(node)
if blen == 'fix':
mylen = self.stat['DefLen']
elif blen.lower() == 'pam':
mylen = float(branch.stat['PAM']) / 100
else:
mylen = branch.stat[blen]
#!#
mylen = int(mylen * scale / self.stat['DefLen'])
mylen = (2 * mylen) + len(indeltxt[branch]) #!# Sandwich indel data!
xpos[nodes[i]] = mylen + 2 + xpos[node]
else:
raise ValueError
ynode = newy
#print self.nodeList(ynode)
### <c> ### Draw Tree
maxpos = 0
vline = {}
for node in ynode:
#print node.stat['ID'], xpos[node]
vline[node] = False # List of on/off values for vertical line
maxpos = max(xpos[node],maxpos)
self.verbose(0,5,'\n',0)
treelines=[]
for node in ynode:
#print node.stat['ID']
branch = node.ancBranch()
## <i> ## Branch
if branch == None: # Root/Trichotomy
line = '+' # Space before Branch
while len(line) < (xpos[node] - 1): line += '-'
else:
anc = branch.link(node)
line = ' ' * (xpos[anc] - 1) # Space before Branch
#!# # Start of branch
line += '+'
if blen == 'fix': mylen = self.stat['DefLen']
elif blen.lower() == 'pam': mylen = float(branch.stat['PAM']) / 100
else: mylen = branch.stat[blen]
mylen = int(mylen * scale / self.stat['DefLen'])
line = line + ('-' * mylen) + indeltxt[branch] + ('-' * mylen)
line += '-+'
## <ii> ## Name
txtname = ''
if node.stat['ID'] <= self.stat['SeqNum']: # Terminal node
if seqnum or (seqname == 'None') or (seqname == 'num'):
txtname = '%d' % node.stat['ID']
if seqname != 'num' and seqname != 'None': txtname += ': '
if seqname == 'short': txtname += node.shortName()
elif seqname == 'long': txtname += node.info['Name']
if len(txtname) > maxnamelen: txtname = txtname[:maxnamelen] + '...'
else: # Internal node
if nodename == 'none': txtname = ''
elif node.opt['Compress']:
if nodename == 'num': txtname = '*%d*: ' % node.stat['ID']
txtname += node.info['CladeName']
elif nodename == 'num': txtname = '%d' % node.stat['ID']
elif nodename == 'short': txtname += node.shortName()
elif nodename == 'long': txtname += node.info['Name']
if showboot and self.opt['Bootstrapped'] and branch != None and node.stat['ID'] > self.stat['SeqNum']:
txtname += ' [%d]' % branch.stat['Bootstrap']
# display branchlengths?
if branch != None:
if showlen == 'branch':
if blen == 'fix': mylen = self.stat['DefLen']
elif blen.lower() == 'pam': mylen = float(branch.stat['PAM']) / 100
else: mylen = branch.stat[blen]
txtname += ' {%f}' % mylen
elif showlen == 'sum': txtname += ' {%f}' % self.pathLen(self.rootPath(node))
txtname += ' (%d aa)' % branch.descNode().obj['Sequence'].aaLen()
else: txtname += ' (%d aa)' % self.node[-1].obj['Sequence'].aaLen()
line += ' ' + txtname
## <iii> ## vlines anc of xn
for vnode in ynode:
if vline[vnode] and vnode != anc and vnode != node:
vx = xpos[vnode] - 1
line = line[:vx] + '|' + line[(vx+1):]
if branch != None and node != fromnode:
vline[anc] = not vline[anc]
if anc == basenode and tric and vline[anc] == False:
vline[anc] = True
tric = False
#self.verbose(0,5,line,1)
treelines.append('%s\n' % line)
## <iv> ## spacer
for y in range(spacer):
line = ' ' * xpos[node]
for vnode in ynode:
if vline[vnode]:
vx = xpos[vnode] - 1
line = line[:vx] + '|' + line[(vx+1):]
#self.verbose(0,5,line,1)
treelines.append('%s\n' % line)
### <c> ### Save/Print Tree
if filename != None:
try:
open(filename, 'w').write(string.join(treelines,'\n'))
self.log.printLog("#OUT","Text tree saved to %s" % filename,1)
except:
self.log.errorLog("Problem saving text tree to %s" % filename)
raise
else:
p = 1
self.verbose(0,5,'\n',0)
for line in treelines:
if p < pause:
self.verbose(0,5,line,0)
p += 1
else:
self.verbose(0,1,line,0)
p = 0
except: self.log.errorLog('Major Problem with textTree().')
#########################################################################################################################
## End of Tree Class #
#########################################################################################################################
### ~ ### ~ ###
#########################################################################################################################
## Node Class: Individual Tree Nodes #
#########################################################################################################################
class Node(rje.RJE_Object):
'''
Individual nodes (internal and leaves) for Tree object. Author: Rich Edwards (2005).
Info:str
- Name = Name of Node
- CladeName = Name to be used if describing descendant clade
- Type = Type of node = Internal/Terminal/Root/(Duplication)
Opt:boolean
- Duplication = Whether the node is a duplication node
- Compress = Whether to compress clade in Tree.textree()
- SpecDup = Wheter node is a species-specific(ish) duplication
Stat:numeric
- ID = node number
Obj:RJE_Objects
- Sequence = rje_seq.Sequence object
Other:
- branch = list of branches (1 for terminal, 2 for root, 3 for internal)
'''
### Old Node Attributes
## Info:
# Name : name=None # Short name of node
# - longname=None # Full name of node
# CladeName : cladename=None # Name of node to be used if describing descendant clade
# Type: type=None # Type of node = Internal/Terminal/Root/Trichotomy/Duplication
## Stat:
# ID : id=0 # Node ID number
## Obj:
# Sequence : sequence=None # Node sequence
## None:
# - nodelink=[-1,-1,-1] # Nodes linked to self: [0]&[1]=desc, [2]=anc
# - nodepath=None # Path from Node to root
### Other attributes
branch = [] # List of branches linking node to other nodes
#########################################################################################################################
### <1> ### Class Initiation etc.: sets attributes
#########################################################################################################################
def _setAttributes(self): ### Sets Attributes of Object
'''Sets Attributes of Object.'''
### Basics ###
self.infolist = ['Name','Type','CladeName']
self.statlist = ['ID']
self.optlist = ['Duplication','Compress','SpecDup']
self.objlist = ['Sequence']
self.listlist = []
self.dictlist = []
### Defaults ###
self._setDefaults(info='None',opt=False,stat=0.0,obj=None,setlist=True,setdict=True)
self.info['Name'] = 'Node'
self.branch = []
#########################################################################################################################
def _cmdList(self): ### Sets Attributes from commandline
'''
Sets attributes according to commandline parameters:
- see .__doc__ or run with 'help' option
'''
for cmd in self.cmd_list:
try: self._generalCmd(cmd)
except: self.log.errorLog('Problem with cmd:%s' % cmd)
return
#########################################################################################################################
### <2> ### General Class Methods
#########################################################################################################################
def setType(self): ### Sets the node's type as a string
'''
Sets the node's type based on link and duplication.
'''
try:
try: type = ['Unformed','Terminal','Root','Internal'][len(self.branch)]
except: type = 'Erroneous'
if self.opt['Duplication']: type += ' (Duplication)'
elif self.opt['SpecDup']: type += ' (Lineage-specific duplication)'
self.info['Type'] = type
return type
except:
self.log.errorLog('Major problem establishing %s (%d) type' % (self.info['Name'],self.stat['ID']))
raise
#########################################################################################################################
def mapSeq(self,seq=None,id=0): ### Maps a Sequence object onto the node
'''
Maps a rje_seq.Sequence object onto Node.
>> seq:rje_seq.Sequence object
>> id:int = order of sequence in SeqList (for output clarity only)
'''
try:
if seq == None: return
self.obj['Sequence'] = seq
self.stat['ID'] = id
self.info['CladeName'] = self.info['Name'] = seq.info['Name']
except:
self.log.errorLog('Major problem mapping Sequence %d to Node' % id)
raise
#########################################################################################################################
def shortName(self): ### Returns short name.
'''Returns short name = first word of name.'''
try:
word = self.info['Name'].find(' ')
if self.info['Type'] == 'Terminal' and word > 0: return self.info['Name'][:word]
else: return self.info['Name']
except:
self.log.errorLog('Major problem with shortName(%s)' % self.info['Name'])
raise
#########################################################################################################################
def rename(self,rooting=None): ### Gives node a good name
'''
Gives internal nodes a good name based on numbering.
>> rooting:str = method of rooting if to be added.
'''
try:
if len(self.branch) == 1: return # Terminus
links = []
for branch in self.branch: links.append('%d' % branch.link(self).stat['ID'])
newname = 'Node %d (%s)' % (self.stat['ID'],string.join(links,','))
if self.opt['Duplication']: newname = 'Duplication ' + newname
elif self.opt['SpecDup']: newname = 'Lineage-specific duplication' + newname
if len(self.branch) == 2: # Root
newname = 'Root ' + newname
if rooting != None: newname = '%s ' % rooting + newname
self.info['Name'] = newname
except:
self.log.errorLog('Major problem with rename(%s)' % self.info['Name'])
raise
#########################################################################################################################
def link(self,othernode): ### Returns branch that links node with self or None if none
'''
Returns branch that links node with self or None if none.
>> othernode:Node Object to link
<< link:Branch Object
'''
try:
for branch in self.branch:
if othernode in branch.node: return branch
return None
except:
self.log.errorLog('Major Problem with Node link().')
raise
#########################################################################################################################
def ancBranch(self): ### Returns branch that links node with 'ancestor' or None if none
'''
Returns branch that links node with 'ancestor' or None if none.
<< branch:Branch Object
'''
try:
for branch in self.branch:
if branch.link(self).stat['ID'] > self.stat['ID']: return branch
#self.verbose(1,4,'No ancbranch for node %d - check number of nodes!' % (self.stat['ID']),1)
return None
except:
self.log.errorLog('Major Problem with Node.ancBranch().')
print self.branch
print self.stat
raise
#########################################################################################################################
def ancNode(self): ### Returns linked node that is 'ancestral' or None if none
'''
Returns linked node that is 'ancestral' or None if none
<< node:Node Object
'''
try:
for branch in self.branch:
node = branch.link(self)
if node.stat['ID'] > self.stat['ID']: return node
return None
except:
self.log.errorLog('Major Problem with Node.ancNode().')
raise
#########################################################################################################################
def neighbours(self,ignore=[]): ### Returns list of Node objects linked by a single branch
'''
Returns list of Node objects linked by a single branch.
>> ignore:list of Node objects
<< neighbours:list of Node Objects
'''
try:
neighbours = []
for branch in self.branch:
node = branch.link(self)
if node not in ignore:
neighbours.append(node)
return neighbours
except:
self.log.errorLog('Major Problem with Node link().')
raise
#########################################################################################################################
def flipDesc(self): ### Flips 'Descendant' Nodes
'''Flips 'Descendant' Nodes by swapping Branches in self.branch.'''
try:
if len(self.branch) < 2: return
elif len(self.branch) > 2:
anc = self.ancBranch()
newb = [anc]
self.branch.remove(anc)
newb = newb + [self.branch[1],self.branch[0]]
self.branch = newb
else: self.branch = [self.branch[1],self.branch[0]]
except:
self.log.errorLog('Major Problem with Node flipDesc().')
raise
#########################################################################################################################
## End of Node Class #
#########################################################################################################################
### ~ ### ~ ###
#########################################################################################################################
## Branch Class: Individual Tree Branches #
#########################################################################################################################
class Branch(rje.RJE_Object):
'''
Individual branches for Tree object. Author: Rich Edwards (2005).
Info:str
- Name = Name of Branch
Stat:numeric
- Bootstrap = Bootstrap Support (-1 = none)
- Length = Branch Length (-1 = none)
- PAM = Branch PAM (-1 = none)
Obj:RJE_Objects
- Sequence = rje_seq.Sequence object
Other:
- node = list of two nodes connected to branch
'''
### Old Branch Attributes
## Stat:
# Bootstrap : bootstrap = 0 # Bootstrap Support
# Length : length = 0 # Branch Length
# PAM : pam = -1 # Branch PAM (-1 = none)
## None:
# ancnode = -1 # Ancestral node (parent tree object)
# descnode = -1 # Descendant node (parent tree object)
### Other attributes
node = []
#########################################################################################################################
### <1> ### Class Initiation etc.: sets attributes
#########################################################################################################################
def _setAttributes(self): ### Sets Attributes of Object
'''Sets Attributes of Object.'''
### Basics ###
self.infolist = ['Name','Type']
self.statlist = ['Bootstrap','Length','PAM']
self.optlist = []
self.listlist = []
self.dictlist = []
self.objlist = []
### Defaults ###
self._setDefaults(info='None',opt=False,stat=-1.0,obj=None,setlist=True,setdict=True)
self.info['Type'] = 'Branch'
### Other Attributes ###
self.node = []
#########################################################################################################################
### <2> ### General Class Methods #
#########################################################################################################################
def link(self,node): ### Returns other end of branch (Node Object)
'''
Returns other end of branch.
>> node:Node object
<< link:Node object
'''
try:
if node in self.node: # OK
if len(self.node) < 2 or len(self.node) > 2:
self.log.errorLog('Branch has wrong number of nodes!',printerror=False)
raise
else:
for link in self.node:
if link != node: return link
else:
self.log.errorLog('link() called for wrong branch for given node (%s vs %s)!\n' % (node,self.node),printerror=False)
raise
except:
self.log.errorLog('Major problem with link().')
raise
#########################################################################################################################
def combine(self,node,branch): ### Combines data from another branch (during unrooting)
'''
Combines data from another branch, usually during unrooting.
Will warn if bootstraps are not compatible and die if node is incorrect.
>> node:Node object = common node between branches
>> branch:Branch object = other branch
'''
try:### ~ [1] ~ Check Data ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
if node in self.node and node in branch.node: # OK
if self.stat['Bootstrap'] != branch.stat['Bootstrap']:
self.log.printLog('#TREE','%s:[%s] vs %s:[%s]' % (self.info['Name'],self.stat['Bootstrap'],branch.info['Name'],branch.stat['Bootstrap']))
self.log.printLog('#TREE','Bootstrap disagreement during branch combining. Will retain higher.')
if branch.stat['Bootstrap'] == None: self.log.errorLog('Bootstrap Missing! Retaining non-missing value.',printerror=False)
elif self.stat['Bootstrap'] < branch.stat['Bootstrap']: self.stat['Bootstrap'] = branch.stat['Bootstrap']
### ~ [2] ~ Combine ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
self.info['Name'] = 'Combined %s and %s' % (self.info['Name'],branch.info['Name'])
self.stat['Length'] += branch.stat['Length']
if self.stat['PAM'] >= 0 and branch.stat['PAM'] >= 0: self.stat['PAM'] += branch.stat['PAM']
else: self.stat['PAM'] = -1
self.node.remove(node)
branch.node.remove(node)
self.node += branch.node
### ~ [3] ~ Big Problem ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
else:
self.log.errorLog('Incorrect common node given for combining branches!',printerror=False)
raise
except:
self.log.errorLog('Major problem in combine().')
raise
#########################################################################################################################
def show(self): ### Shows nodes X -> Y
'''Returns Node numbers X -> Y.'''
if self.node[0].stat['ID'] > self.node[1].stat['ID']: return '%d -> %d' % (self.node[0].stat['ID'],self.node[1].stat['ID'])
else: return '%d -> %d' % (self.node[1].stat['ID'],self.node[0].stat['ID'])
#########################################################################################################################
def ancNode(self): ### Returns 'ancestral' node
'''Returns 'ancestral' node.'''
try:
if self.node[0].stat['ID'] > self.node[1].stat['ID']: return self.node[0]
else: return self.node[1]
except:
self.log.errorLog('Problem with ancNode().')
raise
#########################################################################################################################
def descNode(self): ### Returns 'descendant' node
'''Returns 'descendant' node.'''
try:
if self.node[0].stat['ID'] < self.node[1].stat['ID']: return self.node[0]
else: return self.node[1]
except:
self.log.errorLog('Problem with descNode().')
raise
#########################################################################################################################
def commonNode(self,branch): ### Common node with another branch
'''
Returns common node with other branch.
>> branch:Branch Object
<< node:Node Object or None if not common.
'''
try:
if self.node[0] in branch.node: return self.node[0]
elif self.node[1] in branch.node: return self.node[1]
else: return None
except:
self.log.errorLog('Major problem finding Common Node (%s vs %s)' % (self.node,branch.node))
return None
#########################################################################################################################
## End of Branch Class #
#########################################################################################################################
#########################################################################################################################
## End of SECTION II: Module Classes #
#########################################################################################################################
### ~ ### ~ ###
#########################################################################################################################
### SECTION III: SPECIFIC METHODS #
#########################################################################################################################
def treeMenu(out,mainlog,cmd_list,tree=None): ### Menu for handling Tree Functions in 'standalone' running
'''
Menu for handling Tree Functions in 'standalone' running.
- load sequences
- load tree
- save tree
- edit tree
- define subfams
'''
try:
### <a> ### Setup parameters etc.
if tree == None:
print 'No Tree!'
return
#tree = Tree(log=mainlog,cmd_list=cmd_list)
### <b> ### Menu
while out.stat['Interactive'] >= 0:
## <i> ## Options
print '\n\n *** Tree Menu *** \n'
print '<L>oad Tree'
print '<M>ake Tree'
if len(tree.node) > 0:
print '<S>ave Tree'
print '<I>mport Sequence Data'
print ' --- \n<R>oot Options'
print '<E>dit Tree'
print '<G>rouping Options'
if len(tree.node) > 0 and tree.obj['SeqList']:
print ' --- \n<A>ncestral Sequence Prediction (GASP)'
print 'E<x>port Sequence Data'
print ' --- \n<Q>uit'
## <ii> ## Choice
choice = rje.choice('\nChoice: ',default='Q').upper()
if choice.find('L') == 0: # Load Tree
filename = rje.choice('Filename: ')
useseq = False
if tree.obj['SeqList']: useseq = rje.yesNo('Use currently loaded sequence list?')
try:
if useseq: tree.loadTree(file=filename,seqlist=tree.obj['SeqList'])
else: tree.loadTree(file=filename)
except: continue
elif choice.find('M') == 0: # Load Tree
tree.makeTreeMenu(interactiveformenu=0,force=False,make_seq=tree.obj['SeqList'])
elif choice.find('S') == 0 and len(tree.node) > 0: # Save
filename = rje.choice('Filename: ',default=tree.info['SaveTree'])
if tree.opt['OutputBranchLen']: withbranchlengths = 'Length'
else: withbranchlengths = 'none'
outnames = tree.info['OutNames']
maxnamelen = tree.stat['TruncNames']
useseqnum = tree.opt['SeqNum'] and tree.obj['SeqList']
if not rje.yesNo('Save with branch lengths?'): withbranchlengths = 'none'
if rje.yesNo('Use full sequence names?'):
outnames = 'long'
if not rje.yesNo('Truncate long names for program compatability?'):
maxnamelen = 0
if tree.obj['SeqList']: useseqnum = rje.yesNo('Save with sequence numbers?',default='N')
#!# Add ... ,type=self.info['SaveType'] #!#
tree.saveTree(filename=filename,seqnum=useseqnum,seqname=outnames,maxnamelen=maxnamelen,blen=withbranchlengths)
elif choice.find('I') == 0 and len(tree.node) > 0: # Import Seqs
filename = rje.choice('Filename: ')
seqs = rje_seq.SeqList(log=mainlog,cmd_list=cmd_list+['accnr=F'])
seqs.loadSeqs(seqfile=filename,nodup=False)
tree.mapSeq(seqlist=seqs)
tree.textTree()
elif choice.find('X') == 0 and tree.obj['SeqList']: # Import Seqs
filename = rje.choice('Filename: ')
tree.obj['SeqList'].saveFasta(seqfile=filename)
elif choice.find('R') == 0 and len(tree.node) > 0: # Root Options
tree.info['Rooting'] = 'man'
tree.treeRoot()
elif choice.find('G') == 0 and len(tree.node) > 0: # Grouping Options
if tree.stat['MinFamNum'] < 1:
tree.stat['MinFamNum'] = 1
tree.treeGroup(callmenu=True)
elif choice.find('E') == 0 and len(tree.node) > 0: # Edit Options
tree.editTree(reroot=True)
elif choice.find('A') == 0 and len(tree.node) > 0 and tree.obj['SeqList'] != None: # GASP
filename = rje.choice('Root filename (FILE.anc.fas, FILE.anc.nsf, FILE.txt): ',default=tree.obj['SeqList'].info['Basefile'])
if rje.yesNo('Use %s as root filename?' % filename):
mygasp = rje_ancseq.Gasp(tree=tree,ancfile=filename,cmd_list=cmd_list,log=mainlog)
out.verbose(0,2,'%s' % mygasp.details(),1)
if not rje.yesNo('Use these parameters?'): mygasp.edit()
mygasp.gasp()
elif choice.find('Q') == 0 and rje.yesNo('Quit Tree Menu?'): # Quit
return tree
return tree
except IOError:
out.verbose(0,1,'Problem with given File!',1)
treeMenu(out,mainlog,cmd_list,tree)
except KeyboardInterrupt:
if rje.yesNo('Quit Tree Menu?'): raise
else: treeMenu(out,mainlog,cmd_list,tree)
except:
mainlog.errorLog('Fatal Error in main TreeMenu()')
raise
#########################################################################################################################
### END OF SECTION III #
#########################################################################################################################
### ~ ### ~ ###
#########################################################################################################################
### SECTION IV: MAIN PROGRAM #
#########################################################################################################################
def runMain():
### ~ [1] ~ Basic Setup of Program ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
try: [info,out,mainlog,cmd_list] = setupProgram()
except SystemExit: return
except:
print 'Unexpected error during program setup:', sys.exc_info()[0]
return
### ~ [2] ~ Rest of Functionality... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
try:
Tree(log=mainlog,cmd_list=cmd_list).run()
#if 'reroot' in cmd_list: tree.saveTree(tree.info['Name'],tree=self.info['SaveType'],seqname='long',maxnamelen=1000)
#else: treeMenu(out,mainlog,cmd_list,tree)
### ~ [3] ~ End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ###
except SystemExit: return # Fork exit etc.
except KeyboardInterrupt: mainlog.errorLog('User terminated.')
except: mainlog.errorLog('Fatal error in main %s run.' % info.program)
mainlog.endLog(info)
#########################################################################################################################
if __name__ == "__main__": ### Call runMain
try: runMain()
except: print 'Cataclysmic run error:', sys.exc_info()[0]
sys.exit()
#########################################################################################################################
### END OF SECTION IV #
#########################################################################################################################
| [
"richard.edwards@unsw.edu.au"
] | richard.edwards@unsw.edu.au |
cf885552e84010143da31e48274a4eca2885c0f0 | f4ee2133e733c2eccad7cff39d09a3909aa0152f | /apps/account/views.py | 20ad1963b85765cb879b11792a9c4174622b879d | [] | no_license | shakiill/TechFort | d50aae59b55b1430af0aa3872cae61cafc35e1b9 | 700ebcb9e06eaf8ae9346d3df375541bb4d50823 | refs/heads/master | 2023-01-29T17:27:31.225976 | 2020-12-14T18:30:33 | 2020-12-14T18:30:33 | 321,437,138 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,720 | py | from django.shortcuts import render, HttpResponseRedirect, redirect
from django.urls import reverse, reverse_lazy
from django.http import HttpResponse
# Authentication
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.decorators import login_required
from django.contrib.auth import login, logout, authenticate
# Forms and Models
from django.views.generic import CreateView
from .models import Profile
from .forms import ProfileForm, SignUpForm, LoginForm
from .models import User
# Messages
from django.contrib import messages
# Create your views here.
# def home(request):
# return render(request, 'home.html')
# def sign_up(request):
# form = SignUpForm()
# if request.method == 'POST':
# print("start")
# form = SignUpForm(request.POST)
# if form.is_valid():
# print("success")
# form.save()
# messages.success(request, "Account Created Successfully!")
# return HttpResponseRedirect(reverse('account:login'))
# elif form.password1 != form.password2:
# error_msg = {'Passwords are not same'}
# return render(request, 'account/register.html', context={'form': form, 'error_msg': error_msg})
# return render(request, 'account/register.html', context={'form': form})
def sign_up(request):
form = SignUpForm()
if request.method == 'POST':
form = SignUpForm(request.POST)
if form.is_valid():
# post = form.save(commit=False)
# post.save()
print("valid")
form.save()
messages.success(request, "Your account has been created successfully!")
return HttpResponseRedirect(reverse('App_Auth:login'))
# return render(request, 'account/login.html', context=context)
elif not form.is_valid():
messages.error(request, form.error_messages)
print(form.error_messages)
return render( request, 'App_Auth/register.html', context={'form': form} )
# return HttpResponseRedirect("/signup/")
return render( request, 'App_Auth/register.html', context={'form': form} )
def login_user(request):
# form = AuthenticationForm()
form = LoginForm()
if request.method == 'POST':
form = AuthenticationForm(data=request.POST)
if form.is_valid():
username = form.cleaned_data.get('username')
password = form.cleaned_data.get('password')
user = authenticate(username=username, password=password)
if user is not None:
login(request, user)
messages.success(request, "You have logged in.")
return render( request, 'home.html' )
# return HttpResponseRedirect(reverse('account:login'))
return render( request, 'App_Auth/login.html', context={'form': form} )
@login_required
def logout_user(request):
logout(request)
messages.warning(request, "You have been logged out!")
return HttpResponseRedirect(reverse('products:home'))
# return render(request, 'home.html')
@login_required
def user_profile(request, pk):
profile = Profile.objects.get(id=pk)
form = ProfileForm(instance=profile)
# form.fields['username'].widget.attrs['placeholder'] = profile.user
form.fields['firstname'].widget.attrs['placeholder'] = profile.user.first_name
if form.fields['firstname'].widget.attrs['value'] != "":
form.fields['firstname'].widget.attrs['value'] = profile.user.first_name
form.fields['phone'].widget.attrs['placeholder'] = profile.user.phone
if form.fields['phone'].widget.attrs['value'] != "":
form.fields['phone'].widget.attrs['value'] = profile.user.phone
form.fields['email'].widget.attrs['placeholder'] = profile.user.email
if form.fields['email'].widget.attrs['value'] != "":
form.fields['email'].widget.attrs['value'] = profile.user.email
form.fields['lastname'].widget.attrs['placeholder'] = profile.lastname
if form.fields['lastname'].widget.attrs['value'] != "":
form.fields['lastname'].widget.attrs['value'] = profile.user.lastname
# form.fields['phone'].widget.attrs['placeholder'] = profile.firstname
form.fields['address_1'].widget.attrs['placeholder'] = profile.address_1
if request.method == 'POST':
form = ProfileForm(request.POST, instance=profile)
form.save()
return render( request, 'App_Auth/myAccountScreen.html',
context={'form': form} )
return render( request, 'App_Auth/myAccountScreen.html',
context={'form': form} )
def forgot_pass(request):
return render( request, 'App_Auth/forgot-password.html' ) | [
""
] | |
0a781a4c64581b3ff11b1a775649eef398bd470f | 5aa6a4cbce18f781067530291e29181d118f0911 | /allocate_new.py | 6b792ff0241af8f4378585f823e0e5d05cea96e1 | [] | no_license | AllenZYoung/keyword-util | 9f860b66533cfb365187ed1266d32d5b4701c53b | 779374d567e3e22074a788a77448d779018520b0 | refs/heads/master | 2021-01-22T21:00:36.893556 | 2017-08-23T08:56:06 | 2017-08-23T08:56:06 | 100,683,406 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,676 | py | from random import shuffle
list1 = [
'/Users/zhangyang/PycharmProjects/IdiomSpider/stage-nd/newdir/winrar/ALLOCATE-ULTRA-KEYWORD-LOWERSOURCE-book_summaries_filter.txt',
'/Users/zhangyang/PycharmProjects/IdiomSpider/stage-nd/newdir/winrar/ALLOCATE-ULTRA-KEYWORD-LOWERSOURCE-movie_summaries_filter.txt',
'/Users/zhangyang/PycharmProjects/IdiomSpider/stage-nd/newdir/winrar/ALLOCATE-ULTRA-KEYWORD-LOWERSOURCE-stories-100word_filter.txt',
'/Users/zhangyang/PycharmProjects/IdiomSpider/stage-nd/newdir/winrar/ALLOCATE-ULTRA-KEYWORD-LOWERSOURCE-wikiPlots_filter.txt',
]
list2 = [
'/Users/zhangyang/PycharmProjects/IdiomSpider/stage-nd/newdir/winrar/ALLOCATE-ULTRA-SOURCE-ALL-LOWERSOURCE-book_summaries_filter.txt',
'/Users/zhangyang/PycharmProjects/IdiomSpider/stage-nd/newdir/winrar/ALLOCATE-ULTRA-SOURCE-ALL-LOWERSOURCE-movie_summaries_filter.txt',
'/Users/zhangyang/PycharmProjects/IdiomSpider/stage-nd/newdir/winrar/ALLOCATE-ULTRA-SOURCE-ALL-LOWERSOURCE-stories-100word_filter.txt',
'/Users/zhangyang/PycharmProjects/IdiomSpider/stage-nd/newdir/winrar/ALLOCATE-ULTRA-SOURCE-ALL-LOWERSOURCE-wikiPlots_filter.txt',
]
output_kw_path = '/Users/zhangyang/PycharmProjects/IdiomSpider/stage-nd/newdir/winrar/ALL-KW.txt'
output_source_path = '/Users/zhangyang/PycharmProjects/IdiomSpider/stage-nd/newdir/winrar/ALL-SOURCE.txt'
def Linenum_counter(path):
ctr = 0
with open(path, 'r') as f:
for line in f:
ctr += 1
return ctr
list_kw = []
list_source = []
for i in range(0, 4): # write keywords
path1 = list1[i]
with open(path1, 'r') as kw_f:
# f_out = open(output_kw_path, 'a')
if Linenum_counter(path1) % 3 != 0:
print 'ERROR!'
break
ctr_line = 0
case_kw = ''
for line in kw_f:
ctr_line += 1
case_kw += line
if ctr_line % 3 == 0:
list_kw.append(case_kw)
# f_out.write(case_kw)
case_kw = ''
# f_out.close()
for i in range(0, 4): # write cases
path2 = list2[i]
with open(path2, 'r') as case_f:
# f_out = open(output_source_path, 'a')
ctr_line = 0
for line in case_f:
ctr_line += 1
list_source.append(line)
# f_out.write(case_source)
case_source = ''
# f_out.close()
print len(list_kw)
print len(list_source)
list_whole = zip(list_kw, list_source)
shuffle(list_whole)
f_out_kw = open(output_kw_path, 'a')
f_out_source = open(output_source_path, 'a')
for one in list_whole:
keyword = one[0]
case = one[1]
f_out_kw.write(keyword)
f_out_source.write(case)
f_out_kw.close()
f_out_source.close()
del list_kw
del list_source
print Linenum_counter(output_kw_path)
print Linenum_counter(output_source_path)
| [
"allenzyoungazy@gmail.com"
] | allenzyoungazy@gmail.com |
148189703be9ceae30cceda182d90852094df8a4 | aa56a7336260dd79711ded10c638dc18cf063d32 | /pizza_cost.py | 67d0effcf3ee6a475013e1144d9e2bda1c389f26 | [] | no_license | ZenSorcere/pizza_costPerInch | f150a14786284415c6a07c318608b54641150a75 | cec465fb36c2a50093e0a0795f38ad3b6fb9edc5 | refs/heads/master | 2020-06-20T13:25:52.798296 | 2019-07-16T06:46:11 | 2019-07-16T06:46:11 | 197,136,429 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 958 | py | # pizza_cost.py
# calculate the cost per square inch of a circular pizza
# Import math library
from math import *
def main ():
# Inform user of program purpose.
print("This program calculates the price per square inch of a pizza. \n")
# Get size of pizza, and divide by 2 to get radius (pizza sizes are
# always the diameter). Then calculate the area of a circle.
diameter = int(input("Enter the pizza size (in inches): "))
radius = diameter / 2
area = pi * (radius**2)
# get cost of pizza in dollars and cents (as seen on a menu).
cost = float(input("Enter the cost of the pizza (in dollars & cents): "))
# take price of pizza, multiply by 100 to get raw cents, then
# divid by the area to get cost/inch.
inchCost = (cost*100) / area
# Round the value of "inchCost" to second decimal place, and output answer.
print("The cost is", round(inchCost, 2), "cents per square inch.")
main()
| [
"noreply@github.com"
] | noreply@github.com |
4ba9dd5155a46583999e303364738eb845069c8e | 94838674ffd175df6194437c1ccc3f90ab409d6c | /pillowV3/log/2018-12-30 14:32:11.007864 | f0ffac647e42c1490e5d2efabb7c2febde427f75 | [] | no_license | WojciechKoz/MyFirstNeuralNetwork | 4fdb3140d8f02257599d005638598f78055c1ac8 | 3cd032aba80ecd71edb0286724ae9ba565b75a81 | refs/heads/master | 2020-04-02T03:02:48.680433 | 2020-02-29T17:57:43 | 2020-02-29T17:57:43 | 153,943,121 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 278,221 | 007864 | #!/usr/bin/env python3
# -*- coding: utf8 -*-
from __future__ import print_function # new print() on python2
from datetime import datetime
import sys
import numpy as np
from mnist import MNIST
# Display full arrays
np.set_printoptions(threshold=np.inf)
mndata = MNIST('./data')
images_full, labels_full = mndata.load_training()
images = []
labels = []
# dynamic arguments
batch_size = int(sys.argv[1])
size_1 = int(sys.argv[2])
size_2 = int(sys.argv[3])
batch_training_size = int(sys.argv[4])
data_part = 5 # only one fifth of the whole dataset to speed up training
for i in range(len(labels_full) // batch_size // data_part):
images.append(images_full[i*batch_size : (i+1)*batch_size])
labels.append(labels_full[i*batch_size : (i+1)*batch_size])
def sigmoid_prime(x):
return np.exp(-x) / ((np.exp(-x) + 1) ** 2)
def sigmoid(x):
return 1 / (1 + np.exp(-x))
# nowe, przyda się?
def relu(x):
return np.maximum(x, x * 0.01)
def relu_prime(x):
if x >= 0:
return 1
# ej nie jest tak xd
# a jak xd?
type(x) == no.ndarray
# no x to macierz xd
# np.exp jest przeładowane ale jakakoleiwk funkcja to chyba nie
# to co foreach ? :(
# właśnie nie wiem, a co z gpu?
# to miało być szybsze a nie xd
# mamy duzo mozliwosci zmian ale nie na raz trzeba ustalic jakos
# hm TODO gpu TODO wincyj procent TODO gui gotowe
# xd
# tamto myliło hah
# to co najpierw? :p
# ssh daje wglad do basha tylko tak ?
# nie, to jest taki fajny programik, byobu
# i ten pasek na dole też jest z byobu
# on udostepnia tylko basha ?
# tak, ale basha multiplayer xd
# szkoda że 2 kursorow nie ma
# hm
return 0.01 # chyba tak xd nikt nie widzial xd
# ale x to macierz :p
# ale to jest przeciazone i jak jest funkcja od macierzy to bierze po kolei kazdy element
# w sumie
# zobacze na drugiej karcie xd
#X = np.array([[0, 0],
# [0, 1],
# [1, 0],
# [1, 1]])
#X = np.array(images)
y = []
for batch in labels:
y.append([])
for label in batch:
y[-1].append([1.0 if i == label else 0.0 for i in range(10)])
y = np.array(y)
#y = np.array([[0],
# [1],
# [1],
# [0]])
np.random.seed(1)
LEN = len(labels)
SIZES = [ 784, size_1, size_2, 10 ]
syn0 = 2 * np.random.random((SIZES[0], SIZES[1])) - 1
syn1 = 2 * np.random.random((SIZES[1], SIZES[2])) - 1
syn2 = 2 * np.random.random((SIZES[2], SIZES[3])) - 1
# biases for respective layers
b0 = 2 * np.random.random((1, SIZES[1])) - 1
b1 = 2 * np.random.random((1, SIZES[2])) - 1
b2 = 2 * np.random.random((1, SIZES[3])) - 1
for i, batch in list(enumerate(images)):
X = np.array(batch)
print("x:")
print(np.shape(X))
print("======================= BATCH {} =======================".format(i))
error = 1
j = 0
while j < batch_training_size:
l0 = X
l1 = sigmoid(np.dot(l0, syn0) + b0)
l2 = sigmoid(np.dot(l1, syn1) + b1)
l3 = sigmoid(np.dot(l2, syn2) + b2)
l3_error = (y[i] - l3)#** 2
error = np.mean(np.abs(l3_error))
j += 1
if j % 20 == 0:
print(("[%d] error: " % j) + str(error))
l3_delta = l3_error * sigmoid_prime(l3)
l2_error = l3_delta.dot(syn2.T)
l2_delta = l2_error * sigmoid_prime(l2)
l1_error = l2_delta.dot(syn1.T)
l1_delta = l1_error * sigmoid_prime(l1)
syn2 += l2.T.dot(l3_delta)
syn1 += l1.T.dot(l2_delta)
syn0 += l0.T.dot(l1_delta)
b0 += l1_delta.mean(axis=0)
b1 += l2_delta.mean(axis=0)
b2 += l3_delta.mean(axis=0)
def predict(data):
l0 = [data]
l1 = sigmoid(np.dot(l0, syn0) + b0)
l2 = sigmoid(np.dot(l1, syn1) + b1)
l3 = sigmoid(np.dot(l2, syn2) + b2)
return np.argmax(l3)
print("Output after training: ")
print(l3)
for i, el in enumerate(l3):
print(labels[0][i], "=", np.argmax(el), " predictions: ", el)
testing_images, testing_labels = mndata.load_testing()
correct = 0.0
for i, (image, label) in enumerate(zip(testing_images, testing_labels)):
prediction = predict(image)
if label == prediction:
correct += 1.0
correct_rate = correct / (i + 1.0)
print("{} = {} (correct {}%)".format(label, prediction, 100 * correct_rate))
with open('log/' + str(datetime.now()), 'a') as f:
with open(__file__, 'r') as myself:
print(myself.read(), file=f)
print("", file=f)
print("#### answers:", file=f)
print("argv =", sys.argv, file=f)
print("correct_rate =", correct_rate, file=f)
print("SIZES =", SIZES, file=f)
print("syn0 =", syn0, file=f)
print("syn1 =", syn1, file=f)
print("syn2 =", syn2, file=f)
print("b0 =", b0, file=f)
print("b1 =", b1, file=f)
print("b2 =", b2, file=f)
#### answers:
argv = ['./main.py', '83', '20', '26', '7']
correct_rate = 0.1827
SIZES = [784, 20, 26, 10]
syn0 = [[-1.65955991e-01 4.40648987e-01 -9.99771250e-01 -3.95334855e-01
-7.06488218e-01 -8.15322810e-01 -6.27479577e-01 -3.08878546e-01
-2.06465052e-01 7.76334680e-02 -1.61610971e-01 3.70439001e-01
-5.91095501e-01 7.56234873e-01 -9.45224814e-01 3.40935020e-01
-1.65390395e-01 1.17379657e-01 -7.19226123e-01 -6.03797022e-01]
[ 6.01489137e-01 9.36523151e-01 -3.73151644e-01 3.84645231e-01
7.52778305e-01 7.89213327e-01 -8.29911577e-01 -9.21890434e-01
-6.60339161e-01 7.56285007e-01 -8.03306332e-01 -1.57784750e-01
9.15779060e-01 6.63305699e-02 3.83754228e-01 -3.68968738e-01
3.73001855e-01 6.69251344e-01 -9.63423445e-01 5.00288630e-01]
[ 9.77722178e-01 4.96331309e-01 -4.39112016e-01 5.78558657e-01
-7.93547987e-01 -1.04212948e-01 8.17191006e-01 -4.12771703e-01
-4.24449323e-01 -7.39942856e-01 -9.61266084e-01 3.57671066e-01
-5.76743768e-01 -4.68906681e-01 -1.68536814e-02 -8.93274910e-01
1.48235211e-01 -7.06542850e-01 1.78611074e-01 3.99516720e-01]
[-7.95331142e-01 -1.71888024e-01 3.88800315e-01 -1.71641461e-01
-9.00093082e-01 7.17928118e-02 3.27589290e-01 2.97782241e-02
8.89189512e-01 1.73110081e-01 8.06803831e-01 -7.25050592e-01
-7.21447305e-01 6.14782577e-01 -2.04646326e-01 -6.69291606e-01
8.55017161e-01 -3.04468281e-01 5.01624206e-01 4.51995971e-01]
[ 7.66612182e-01 2.47344414e-01 5.01884868e-01 -3.02203316e-01
-4.60144216e-01 7.91772436e-01 -1.43817620e-01 9.29680094e-01
3.26882996e-01 2.43391440e-01 -7.70508054e-01 8.98978517e-01
-1.00175733e-01 1.56779229e-01 -1.83726394e-01 -5.25946040e-01
8.06759041e-01 1.47358973e-01 -9.94259346e-01 2.34289827e-01]
[-3.46710196e-01 5.41162045e-02 7.71884199e-01 -2.85460480e-01
8.17070302e-01 2.46720232e-01 -9.68357514e-01 8.58874467e-01
3.81793835e-01 9.94645701e-01 -6.55318983e-01 -7.25728501e-01
8.65190926e-01 3.93636323e-01 -8.67999655e-01 5.10926105e-01
5.07752377e-01 8.46049071e-01 4.23049517e-01 -7.51458076e-01]
[-9.60239732e-01 -9.47578026e-01 -9.43387024e-01 -5.07577865e-01
7.20055897e-01 7.76621287e-02 1.05643957e-01 6.84061785e-01
-7.51653370e-01 -4.41632642e-01 1.71518543e-01 9.39191497e-01
1.22060439e-01 -9.62705421e-01 6.01265345e-01 -5.34051452e-01
6.14210391e-01 -2.24278712e-01 7.27083709e-01 4.94243285e-01]
[ 1.12480468e-01 -7.27089549e-01 -8.80164621e-01 -7.57313089e-01
-9.10896243e-01 -7.85011742e-01 -5.48581323e-01 4.25977961e-01
1.19433964e-01 -9.74888040e-01 -8.56051441e-01 9.34552660e-01
1.36200924e-01 -5.93413531e-01 -4.95348511e-01 4.87651708e-01
-6.09141038e-01 1.62717855e-01 9.40039978e-01 6.93657603e-01]
[-5.20304482e-01 -1.24605715e-02 2.39911437e-01 6.57961799e-01
-6.86417211e-01 -9.62847596e-01 -8.59955713e-01 -2.73097781e-02
2.12658923e-01 1.37702874e-01 -3.65275181e-01 9.77232309e-01
1.59490438e-01 -2.39717655e-01 1.01896438e-01 4.90668862e-01
3.38465787e-01 -4.70160885e-01 -8.67330331e-01 -2.59831604e-01]
[ 2.59435014e-01 -5.79651980e-01 5.05511107e-01 -8.66927037e-01
-4.79369803e-01 6.09509127e-01 -6.13131435e-01 2.78921762e-01
4.93406182e-02 8.49615941e-01 -4.73406459e-01 -8.68077819e-01
4.70131927e-01 5.44356059e-01 8.15631705e-01 8.63944138e-01
-9.72096854e-01 -5.31275828e-01 2.33556714e-01 8.98032641e-01]
[ 9.00352238e-01 1.13306376e-01 8.31212700e-01 2.83132418e-01
-2.19984572e-01 -2.80186658e-02 2.08620966e-01 9.90958430e-02
8.52362853e-01 8.37466871e-01 -2.10248774e-01 9.26525057e-01
-6.52088667e-01 -7.47340961e-01 -7.29841684e-01 1.13243314e-02
-9.56950389e-01 8.95940422e-01 6.54230942e-01 -9.69962039e-01]
[-6.47607489e-01 -3.35872851e-01 -7.38006310e-01 6.18981384e-01
-3.10526695e-01 8.80214965e-01 1.64028360e-01 7.57663969e-01
6.89468891e-01 8.10784637e-01 -8.02394684e-02 9.26936320e-02
5.97207182e-01 -4.28562297e-01 -1.94929548e-02 1.98220615e-01
-9.68933449e-01 1.86962816e-01 -1.32647302e-01 6.14721058e-01]
[-3.69510394e-01 7.85777417e-01 1.55714431e-01 -6.31979597e-01
5.75858468e-01 2.24062354e-01 -8.92181456e-01 -1.59612640e-01
3.58137673e-01 8.37203556e-01 -9.99195950e-01 9.53518298e-01
-2.46839371e-01 9.47567077e-01 2.09432202e-01 6.57691616e-01
1.49423009e-01 2.56152397e-01 -4.28847437e-01 1.73666681e-01]
[ 5.00043527e-01 7.16627673e-01 5.10164377e-01 3.96114497e-01
7.28958860e-01 -3.54638006e-01 3.41577582e-01 -9.82521272e-02
-2.35794496e-01 -1.78377300e-01 -1.97040833e-01 -3.65232108e-01
2.43838736e-01 -1.39505458e-01 9.47604156e-01 3.55601783e-01
-6.02860223e-01 -1.46597981e-01 -3.13307520e-01 5.95277608e-01]
[ 7.59996577e-01 8.07683912e-01 3.25439625e-01 -4.59583476e-01
-4.95266597e-01 7.09795885e-01 5.54292926e-02 6.04322168e-01
1.44977034e-01 4.66285051e-01 3.80232549e-02 5.41767821e-01
1.37715981e-01 -6.85802428e-02 -3.14622184e-01 -8.63581303e-01
-2.44151641e-01 -8.40747845e-01 9.65634227e-01 -6.36774297e-01]
[ 6.23717395e-01 7.49923290e-01 3.76826505e-01 1.38988825e-01
-6.78057126e-01 -6.62399545e-02 -3.09655898e-01 -5.49920084e-01
1.85023738e-01 -3.75460325e-01 8.32611107e-01 8.19271050e-01
-4.85763412e-01 -7.78217399e-01 -6.14074536e-01 -8.31658642e-04
4.57171336e-01 -5.83611123e-01 -5.03932883e-01 7.03343750e-01]
[-1.68302563e-01 2.33370134e-01 -5.32667722e-01 -7.96065481e-01
3.17140339e-02 -4.57180259e-02 -6.94656712e-01 2.43612463e-01
8.80202376e-02 3.08274694e-01 -7.10908920e-01 5.03055634e-01
-5.55901720e-01 3.87036487e-02 5.70592056e-01 -9.55339144e-01
-3.51275081e-01 7.45844753e-01 6.89419215e-01 7.68811852e-02]
[ 7.33216548e-01 8.99611983e-01 6.52813995e-01 7.08230888e-01
-8.02513196e-01 3.02608665e-01 4.07033976e-01 2.20481625e-01
5.99230523e-01 -9.30857560e-01 5.40477469e-01 4.63457201e-01
-4.80603213e-01 -4.85861402e-01 2.64606635e-01 -3.09405077e-01
5.93177356e-01 -1.07707536e-01 5.65498830e-01 9.80943567e-01]
[-3.99503321e-01 -7.13988343e-01 8.02616873e-01 8.31187578e-02
9.49480742e-01 2.73208800e-01 9.87826049e-01 9.21416083e-02
5.28518678e-02 -7.29144194e-01 -2.88589658e-01 -9.47562865e-01
-6.79209641e-01 4.91274385e-01 -9.39200620e-01 -2.66913806e-01
7.24692506e-01 3.85355435e-01 3.81884284e-01 -6.22726398e-01]
[-1.16191439e-01 1.63154815e-01 9.79503415e-01 -5.92187550e-01
-5.04534196e-01 -4.75653832e-01 5.00344827e-01 -8.60493451e-02
-8.86141123e-01 1.70324812e-02 -5.76079671e-01 5.97208490e-01
-4.05337237e-01 -9.44787976e-01 1.86864899e-01 6.87680858e-01
-2.37967752e-01 4.99716621e-01 2.22829566e-02 8.19036099e-02]
[ 9.18868642e-01 6.07921783e-01 -9.35353867e-01 4.18774502e-01
-6.99970369e-02 8.95097883e-01 -5.57134531e-01 -4.65855961e-01
-8.37052070e-01 -1.42762343e-01 -7.81962472e-01 2.67573521e-01
6.05926475e-01 3.93600992e-01 5.32422762e-01 -3.15091760e-01
6.91702966e-01 -1.42462450e-01 6.48019741e-01 2.52992317e-01]
[-7.13153903e-01 -8.43226200e-01 -9.63334714e-01 -8.66550005e-01
-8.28323726e-02 -7.73316154e-01 -9.44433302e-01 5.09722963e-01
-2.10299039e-01 4.93876991e-01 -9.51903465e-02 -9.98265060e-02
-4.38549866e-02 -5.19921469e-02 6.06326684e-01 -1.95214960e-01
8.09372321e-01 -9.25877904e-01 5.47748685e-01 -7.48717238e-01]
[ 2.37027134e-01 -9.79271477e-01 7.72545652e-02 -9.93964087e-01
9.02387571e-01 8.10804067e-01 5.91933884e-01 8.30548640e-01
-7.08883538e-01 -6.84539860e-01 -6.24736654e-01 2.44991805e-01
8.11618992e-01 9.79910357e-01 4.22244918e-01 4.63600818e-01
8.18586409e-01 -1.98252535e-01 -5.00298640e-01 -6.53139658e-01]
[-7.61085899e-01 6.25221176e-01 -7.06415253e-01 -4.71405035e-01
6.38178357e-01 -3.78825496e-01 9.64834899e-01 -4.66722596e-01
6.73066899e-02 -3.71065978e-01 8.21545662e-01 -2.66886712e-01
-1.32815345e-01 2.45853846e-02 8.77772955e-01 -9.38101987e-01
4.33757327e-01 7.82037909e-01 -9.45425553e-01 4.41024945e-02]
[-3.48020376e-01 7.18978642e-01 1.17033102e-01 3.80455736e-01
-9.42930001e-02 2.56618075e-01 -4.19806297e-01 -9.81302844e-01
1.53511870e-01 -3.77111572e-01 3.45351970e-02 8.32811706e-01
-1.47050423e-01 -5.05207927e-01 -2.57412477e-01 8.63722233e-01
8.73736763e-01 6.88659897e-01 8.40413029e-01 -5.44199420e-01]
[-8.25035581e-01 -5.45380527e-01 -3.71246768e-01 -6.50468247e-01
2.14188324e-01 -1.72827170e-01 6.32703024e-01 -6.29739203e-01
4.03753060e-01 -5.19288750e-01 1.48438178e-01 -3.02024806e-01
-8.86071201e-01 -5.42372658e-01 3.28205111e-01 -5.49981328e-03
3.80319681e-02 -6.50559700e-01 1.41431703e-01 9.93506850e-01]
[ 6.33670218e-01 1.88745248e-01 9.51978137e-01 8.03125169e-01
1.91215867e-01 -9.35147349e-01 -8.12845808e-01 -8.69256570e-01
-9.65337026e-02 -2.49130334e-01 9.50700069e-01 -6.64033414e-01
9.45575184e-01 5.34949738e-01 6.48475679e-01 2.65231634e-01
3.37465540e-01 -4.62353330e-02 -9.73727286e-01 -2.93987829e-01]
[-1.58563970e-02 4.60182422e-01 -6.27433145e-02 -8.51901678e-02
-7.24674518e-01 -9.78222532e-01 5.16556521e-01 -3.60094324e-01
9.68766900e-01 -5.59531548e-01 -3.22583949e-01 4.77922713e-02
5.09782914e-01 -7.22844322e-02 -7.50354914e-01 -3.74997243e-01
9.03833940e-03 3.47698016e-01 5.40299913e-01 -7.39328438e-01]
[-9.54169737e-01 3.81646444e-02 6.19977421e-01 -9.74792466e-01
3.44939689e-01 3.73616453e-01 -1.01506493e-01 8.29577373e-01
2.88722170e-01 -9.89520325e-01 -3.11431090e-02 7.18635612e-01
6.60799140e-01 2.98308394e-01 3.47396848e-01 1.56999160e-01
-4.51760450e-01 1.21059981e-01 3.43459570e-01 -2.95140740e-01]
[ 7.11656735e-01 -6.09925028e-01 4.94641621e-01 -4.20794508e-01
5.47598574e-01 -1.44525341e-01 6.15396818e-01 -2.92930275e-01
-5.72613525e-01 5.34569017e-01 -3.82716105e-01 4.66490135e-01
4.88946306e-01 -5.57206598e-01 -5.71775726e-01 -6.02104153e-01
-7.14963324e-01 -2.45834802e-01 -9.46744231e-01 -7.78159262e-01]
[ 3.49128048e-01 5.99553074e-01 -8.38940946e-01 -5.36595379e-01
-5.84748676e-01 8.34667126e-01 4.22629036e-01 1.07769222e-01
-3.90964024e-01 6.69708095e-01 -1.29388085e-01 8.46912430e-01
4.12103609e-01 -4.39373841e-02 -7.47579793e-01 9.52087101e-01
-6.80332699e-01 -5.94795750e-01 -1.37636490e-01 -1.91596188e-01]
[-7.06497038e-01 4.58637839e-01 -6.22509866e-01 2.87791289e-01
5.08611901e-01 -5.78535216e-01 2.01908496e-01 4.97856750e-01
2.76437421e-01 1.94254606e-01 -4.09035429e-01 4.63212942e-01
8.90616880e-01 -1.48877219e-01 5.64363634e-01 -8.87717921e-01
6.70543205e-01 -6.15499966e-01 -2.09806262e-01 -3.99837908e-01]
[-8.39792712e-01 8.09262006e-01 -2.59691645e-01 6.13948770e-02
-1.17674682e-02 -7.35677716e-01 -5.87091882e-01 -8.47622382e-01
1.58433999e-02 -4.76900896e-01 -2.85876782e-01 -7.83869343e-01
5.75103679e-01 -7.86832246e-01 9.71417647e-01 -6.45677671e-01
1.44810225e-01 -9.10309331e-01 5.74232579e-01 -6.20788104e-01]
[ 5.58079568e-02 4.80155086e-01 -7.00137030e-01 1.02174348e-01
-5.66765583e-01 5.18392099e-01 4.45830387e-01 -6.46901931e-01
7.23933115e-01 -9.60449801e-01 7.20473995e-01 1.17807622e-01
-1.93559056e-01 5.17493862e-01 4.33858003e-01 9.74652350e-01
-4.43829903e-01 -9.92412655e-01 8.67805217e-01 7.15794209e-01]
[ 4.57701755e-01 3.33775658e-02 4.13912490e-01 5.61059114e-01
-2.50248113e-01 5.40645051e-01 5.01248638e-01 2.26422423e-01
-1.96268152e-01 3.94616039e-01 -9.93774284e-01 5.49793293e-01
7.92833205e-01 -5.21368585e-01 -7.58465631e-01 -5.59432024e-01
-3.95806537e-01 7.66057017e-01 8.63328605e-02 -4.26576701e-01]
[-3.42881096e+03 -3.23801317e+03 -1.24776936e+03 -3.44795683e+03
-3.27408337e+03 -3.43381477e+03 -3.31742412e+03 -3.46535455e+03
-3.26765327e+03 -3.41701109e+03 -3.24255613e+03 -3.47443225e+03
-3.23684078e+03 -3.23245007e+03 -3.29215542e+03 -3.47096492e+03
-3.42415463e+03 -3.28691436e+03 -3.45905405e+03 -3.27597222e+03]
[-1.16623538e+04 -1.10133473e+04 -4.24542625e+03 -1.17280838e+04
-1.11380037e+04 -1.16813269e+04 -1.12872936e+04 -1.17893636e+04
-1.11152319e+04 -1.16248427e+04 -1.10291181e+04 -1.18202705e+04
-1.10096492e+04 -1.09980282e+04 -1.12019497e+04 -1.18076501e+04
-1.16498775e+04 -1.11814123e+04 -1.17679532e+04 -1.11432082e+04]
[-2.51350781e+04 -2.75746427e+04 -1.16017795e+04 -2.54430771e+04
-2.75380230e+04 -2.53387577e+04 -2.75627331e+04 -2.54011646e+04
-2.75045881e+04 -2.52098759e+04 -2.75521275e+04 -2.53182073e+04
-2.74257198e+04 -2.72872825e+04 -2.78315174e+04 -2.53709954e+04
-2.53116801e+04 -2.68933892e+04 -2.55001754e+04 -2.76889856e+04]
[-4.60748644e+04 -5.44700128e+04 -2.76405478e+04 -4.67680803e+04
-5.42413772e+04 -4.65440271e+04 -5.41736423e+04 -4.65861416e+04
-5.41637441e+04 -4.63121752e+04 -5.44274271e+04 -4.63101470e+04
-5.41144367e+04 -5.38960058e+04 -5.47448710e+04 -4.64285408e+04
-4.65377327e+04 -5.20708092e+04 -4.67637106e+04 -5.45033943e+04]
[-6.63837078e+04 -7.96793928e+04 -4.14376960e+04 -6.78483946e+04
-7.88050748e+04 -6.73782202e+04 -7.83027670e+04 -6.74407264e+04
-7.86769533e+04 -6.70141514e+04 -7.93595902e+04 -6.65652983e+04
-7.88754126e+04 -7.80221861e+04 -8.02557036e+04 -6.69528135e+04
-6.75964611e+04 -7.61073212e+04 -6.79132283e+04 -7.97643582e+04]
[-5.28716233e+04 -6.13812035e+04 -3.52647936e+04 -5.37922827e+04
-6.11539494e+04 -5.35129660e+04 -6.08931570e+04 -5.35453707e+04
-6.08729881e+04 -5.31980803e+04 -6.12610058e+04 -5.30755768e+04
-6.08546411e+04 -6.05831661e+04 -6.17760330e+04 -5.32761487e+04
-5.36240420e+04 -5.89478301e+04 -5.38468633e+04 -6.14961060e+04]
[-8.08279083e+04 -9.25916950e+04 -5.56487269e+04 -8.14732588e+04
-9.32567876e+04 -8.12853571e+04 -9.35381620e+04 -8.14672466e+04
-9.28525216e+04 -8.09120311e+04 -9.28289926e+04 -8.15411491e+04
-9.24105895e+04 -9.28203495e+04 -9.29828663e+04 -8.15328683e+04
-8.10438124e+04 -8.89571731e+04 -8.13330198e+04 -9.27489567e+04]
[-1.36030000e+05 -1.67764420e+05 -6.85049808e+04 -1.37425206e+05
-1.67817350e+05 -1.37314581e+05 -1.67463020e+05 -1.37043403e+05
-1.67696625e+05 -1.36771190e+05 -1.68126007e+05 -1.36999565e+05
-1.67329585e+05 -1.67447919e+05 -1.67931488e+05 -1.37187596e+05
-1.36720338e+05 -1.58555639e+05 -1.37159077e+05 -1.67616336e+05]
[-1.17317164e+05 -1.44863399e+05 -4.51507950e+04 -1.19127185e+05
-1.43972143e+05 -1.18944438e+05 -1.43426169e+05 -1.18553287e+05
-1.44112823e+05 -1.18361213e+05 -1.44920096e+05 -1.18014906e+05
-1.43982425e+05 -1.43480142e+05 -1.45128958e+05 -1.18356505e+05
-1.18543701e+05 -1.37055616e+05 -1.19145299e+05 -1.44710330e+05]
[-1.19692573e+05 -1.54208598e+05 -6.72630465e+04 -1.22622442e+05
-1.51949258e+05 -1.22040980e+05 -1.50543887e+05 -1.21546145e+05
-1.52039548e+05 -1.21281046e+05 -1.53776919e+05 -1.20059298e+05
-1.52469696e+05 -1.51062065e+05 -1.54692686e+05 -1.20821187e+05
-1.22055368e+05 -1.44951538e+05 -1.22640685e+05 -1.53726512e+05]
[-7.20700919e+04 -8.26160169e+04 -4.39772598e+04 -7.31751622e+04
-8.24957285e+04 -7.27654319e+04 -8.27180416e+04 -7.30934452e+04
-8.23236482e+04 -7.23802413e+04 -8.25893998e+04 -7.26773235e+04
-8.21010064e+04 -8.19019903e+04 -8.31619615e+04 -7.27907610e+04
-7.27749826e+04 -7.95483568e+04 -7.31175648e+04 -8.27607074e+04]
[-6.99744855e+04 -7.61087249e+04 -4.32473423e+04 -7.04719273e+04
-7.68314742e+04 -7.01741332e+04 -7.76480608e+04 -7.06344930e+04
-7.65442521e+04 -6.98634222e+04 -7.63402834e+04 -7.07253128e+04
-7.60160295e+04 -7.64519222e+04 -7.65595203e+04 -7.06012911e+04
-7.00457968e+04 -7.39391300e+04 -7.03716712e+04 -7.63781776e+04]
[-7.66447857e+04 -8.55698338e+04 -4.81556692e+04 -7.71085870e+04
-8.64443360e+04 -7.68511132e+04 -8.73531483e+04 -7.72825006e+04
-8.61642720e+04 -7.65342489e+04 -8.59270292e+04 -7.75058942e+04
-8.55368326e+04 -8.62158775e+04 -8.58649136e+04 -7.73254105e+04
-7.66132148e+04 -8.25054734e+04 -7.69224378e+04 -8.57363918e+04]
[-5.21306795e+04 -5.77726718e+04 -3.10875213e+04 -5.25731586e+04
-5.81873121e+04 -5.23439478e+04 -5.86978682e+04 -5.26433830e+04
-5.79823908e+04 -5.21378200e+04 -5.78891554e+04 -5.26172313e+04
-5.76841451e+04 -5.79024875e+04 -5.81194360e+04 -5.26111662e+04
-5.22443138e+04 -5.59271228e+04 -5.25062814e+04 -5.79480176e+04]
[-1.72914349e+04 -1.92123629e+04 -8.32643721e+03 -1.76099879e+04
-1.91209444e+04 -1.74641653e+04 -1.91780068e+04 -1.75810951e+04
-1.90661600e+04 -1.73903350e+04 -1.91345196e+04 -1.73888233e+04
-1.90804988e+04 -1.89126857e+04 -1.94339466e+04 -1.74772037e+04
-1.75113232e+04 -1.86910861e+04 -1.76270063e+04 -1.92946306e+04]
[-1.45128427e+04 -1.55528111e+04 -8.46351291e+03 -1.46628674e+04
-1.56910101e+04 -1.45711544e+04 -1.58793777e+04 -1.46824832e+04
-1.55839235e+04 -1.45078719e+04 -1.55512342e+04 -1.46259883e+04
-1.55288682e+04 -1.55766525e+04 -1.57040069e+04 -1.46468763e+04
-1.45860412e+04 -1.51879600e+04 -1.46534976e+04 -1.56232423e+04]
[-1.35025334e+04 -1.41418022e+04 -9.82402522e+03 -1.34991150e+04
-1.45006753e+04 -1.34625335e+04 -1.48179264e+04 -1.35642269e+04
-1.43548107e+04 -1.34029296e+04 -1.42340693e+04 -1.36504528e+04
-1.42114341e+04 -1.44891239e+04 -1.41953327e+04 -1.35936949e+04
-1.34275154e+04 -1.37799477e+04 -1.34560858e+04 -1.41913152e+04]
[-9.13418124e-01 -2.71185137e-02 -5.21177912e-01 9.04947563e-01
8.87785256e-01 2.27868005e-01 9.46974795e-01 -3.10277313e-01
7.95701435e-01 -1.30810053e-01 -5.28370726e-01 8.81655926e-01
3.68436102e-01 -8.70176829e-01 7.40849714e-01 4.02760589e-01
2.09853746e-01 4.64749798e-01 -4.93121915e-01 2.00977911e-01]
[ 6.29238363e-01 -8.91772679e-01 -7.38978657e-01 6.84891620e-01
2.36691739e-01 6.25756210e-02 -5.03418542e-01 -4.09842850e-01
7.45372330e-01 -1.56668130e-01 -8.71139489e-01 7.93970139e-01
-5.93238334e-01 6.52455071e-01 7.63541246e-01 -2.64985104e-02
1.96929386e-01 5.45349130e-02 2.49642588e-01 7.10083443e-01]
[-4.35721103e-01 7.67511016e-01 1.35380660e-01 -7.69793918e-01
-5.45997670e-01 1.91964771e-01 -5.21107526e-01 -7.37168679e-01
-6.76304572e-01 6.89745036e-01 2.04367308e-01 9.27134174e-01
-3.08641573e-01 1.91250196e-01 1.97970578e-01 2.31408574e-01
-8.81645586e-01 5.00634369e-01 8.96418996e-01 6.93581144e-02]
[-6.14887958e-01 5.05851830e-01 -9.85362061e-01 -3.43487793e-01
8.35212695e-01 1.76734666e-01 7.10380568e-01 2.09344105e-01
6.45156305e-01 7.58967047e-01 -3.58027251e-01 -7.54090457e-01
4.42606688e-01 -1.19305826e-01 -7.46528582e-01 1.79647296e-01
-9.27863371e-01 -5.99635767e-01 5.76602379e-01 -9.75806480e-01]
[-3.93308657e-01 -9.57248078e-01 9.94969985e-01 1.64059953e-01
-4.13247443e-01 8.57898924e-01 1.42388471e-02 -9.06155449e-02
1.75743013e-01 -4.71724712e-01 -3.89423401e-01 -2.56690847e-01
-5.11104001e-01 1.69094532e-01 3.91692268e-01 -8.56105560e-01
9.42166639e-01 5.06141312e-01 6.12326326e-01 5.03280808e-01]
[-8.39878045e-01 -3.66074340e-02 -1.08654087e-01 3.44945301e-01
-1.02525482e-01 4.08626797e-01 3.63290675e-01 3.94297058e-01
2.37201485e-01 -6.98038533e-01 5.21604913e-01 5.62091644e-01
8.08205972e-01 -5.32462615e-01 -6.46642214e-01 -2.17801754e-01
-3.58870692e-01 6.30953858e-01 2.27051799e-01 5.20003505e-01]
[-1.44669801e-01 -8.01118874e-01 -7.69929976e-01 -2.53185737e-01
-6.12304465e-01 6.41492997e-01 1.99272017e-01 3.77690518e-01
-1.77800774e-02 -8.23652638e-01 -5.29844727e-01 -7.67958382e-02
-6.02816994e-01 -9.49047528e-01 4.58795397e-01 4.49833494e-01
-3.39216507e-01 6.86988252e-01 -1.43115048e-01 7.29372290e-01]
[ 3.14130849e-01 1.62071315e-01 -5.98545024e-01 5.90932210e-02
7.88864837e-01 -3.90012048e-01 7.41891218e-01 8.17490546e-01
-3.40310875e-01 3.66148733e-01 7.98441899e-01 -8.48606236e-01
7.57175726e-01 -6.18321273e-01 6.99537820e-01 3.34237577e-01
-3.11321609e-01 -6.97248860e-01 2.70741923e-01 6.95576087e-01]
[-2.11524722e+03 -2.47184293e+03 -7.85368972e+02 -2.18889588e+03
-2.41167263e+03 -2.16025370e+03 -2.38062895e+03 -2.17220814e+03
-2.40900986e+03 -2.14814518e+03 -2.44032904e+03 -2.11459969e+03
-2.43321037e+03 -2.36107135e+03 -2.51649575e+03 -2.14241961e+03
-2.18034407e+03 -2.39580924e+03 -2.19670994e+03 -2.48475499e+03]
[-7.14801574e+02 -8.27533110e+02 -2.95924280e+02 -7.32317325e+02
-8.14667661e+02 -7.25888258e+02 -8.08985837e+02 -7.28607496e+02
-8.14648182e+02 -7.22035587e+02 -8.21079795e+02 -7.16112014e+02
-8.18959870e+02 -8.00761250e+02 -8.40467461e+02 -7.24044892e+02
-7.28774793e+02 -8.01419384e+02 -7.34931670e+02 -8.32214191e+02]
[-7.73438423e+03 -8.78287455e+03 -4.66956675e+03 -7.80321652e+03
-8.82743332e+03 -7.76820312e+03 -8.89557634e+03 -7.81195893e+03
-8.80862404e+03 -7.73738956e+03 -8.80308934e+03 -7.80931200e+03
-8.76391182e+03 -8.79141665e+03 -8.82575923e+03 -7.80179506e+03
-7.75217997e+03 -8.45275859e+03 -7.78544178e+03 -8.79791288e+03]
[-4.57038109e+03 -3.65812159e+03 -7.00998487e+03 -4.48746635e+03
-3.88210888e+03 -4.57144369e+03 -3.99626810e+03 -4.59729790e+03
-3.81524622e+03 -4.47494764e+03 -3.70758369e+03 -4.70809302e+03
-3.65125017e+03 -3.84186772e+03 -3.66132927e+03 -4.59214524e+03
-4.52327984e+03 -3.82129807e+03 -4.51037085e+03 -3.66806611e+03]
[-1.02833532e+05 -1.19878471e+05 -6.13912953e+04 -1.04302410e+05
-1.19723709e+05 -1.03927647e+05 -1.19431853e+05 -1.03824867e+05
-1.19204087e+05 -1.03309763e+05 -1.19780408e+05 -1.03290785e+05
-1.19083057e+05 -1.18916962e+05 -1.20567334e+05 -1.03600697e+05
-1.03897304e+05 -1.14941581e+05 -1.04360226e+05 -1.19936487e+05]
[-2.55237443e+05 -2.98698434e+05 -1.57483252e+05 -2.59157933e+05
-2.97819500e+05 -2.57963416e+05 -2.97164863e+05 -2.58043995e+05
-2.96926885e+05 -2.56501059e+05 -2.98414889e+05 -2.56455656e+05
-2.96670440e+05 -2.95749302e+05 -3.00444423e+05 -2.57244413e+05
-2.58064131e+05 -2.86242545e+05 -2.59207900e+05 -2.98899213e+05]
[-4.03468718e+05 -4.77971211e+05 -2.38541149e+05 -4.10511968e+05
-4.75051859e+05 -4.08291032e+05 -4.73750013e+05 -4.08481365e+05
-4.74116567e+05 -4.06091817e+05 -4.77065513e+05 -4.05050021e+05
-4.74246745e+05 -4.71606706e+05 -4.80857347e+05 -4.06681893e+05
-4.08633680e+05 -4.57051220e+05 -4.10693302e+05 -4.78181809e+05]
[-5.77979433e+05 -6.90549505e+05 -3.56948019e+05 -5.89417665e+05
-6.84875706e+05 -5.85923093e+05 -6.81547020e+05 -5.86060788e+05
-6.83586931e+05 -5.82597659e+05 -6.88664219e+05 -5.79891191e+05
-6.84439010e+05 -6.79245453e+05 -6.95043004e+05 -5.82779869e+05
-5.87023161e+05 -6.59623435e+05 -5.89748220e+05 -6.90789249e+05]
[-9.08689683e+05 -1.07871392e+06 -6.19073677e+05 -9.25356705e+05
-1.07159248e+06 -9.20184817e+05 -1.06695585e+06 -9.20536530e+05
-1.06938606e+06 -9.14982793e+05 -1.07639560e+06 -9.12253392e+05
-1.07002487e+06 -1.06296597e+06 -1.08543675e+06 -9.16100045e+05
-9.21770333e+05 -1.03159679e+06 -9.25666992e+05 -1.07937251e+06]
[-1.25286216e+06 -1.46025615e+06 -8.67432477e+05 -1.27224585e+06
-1.45638530e+06 -1.26589327e+06 -1.45371577e+06 -1.26805626e+06
-1.45283067e+06 -1.25899354e+06 -1.45907856e+06 -1.26028599e+06
-1.45097608e+06 -1.44545044e+06 -1.46919540e+06 -1.26364219e+06
-1.26680923e+06 -1.40125387e+06 -1.27186315e+06 -1.46212780e+06]
[-1.70302419e+06 -1.97618743e+06 -1.10562276e+06 -1.72798277e+06
-1.97271173e+06 -1.72000031e+06 -1.97113093e+06 -1.72354883e+06
-1.96865451e+06 -1.71095493e+06 -1.97563763e+06 -1.71478498e+06
-1.96482674e+06 -1.95877964e+06 -1.98817521e+06 -1.71866861e+06
-1.71981590e+06 -1.89802369e+06 -1.72728004e+06 -1.97913020e+06]
[-2.21125086e+06 -2.52818018e+06 -1.31791448e+06 -2.24482375e+06
-2.52309254e+06 -2.23337288e+06 -2.52262587e+06 -2.24007926e+06
-2.51763256e+06 -2.22199371e+06 -2.52633836e+06 -2.22647579e+06
-2.51327522e+06 -2.50355163e+06 -2.54520128e+06 -2.23195809e+06
-2.23466947e+06 -2.43760633e+06 -2.24416932e+06 -2.53324891e+06]
[-2.85784492e+06 -3.24327754e+06 -1.65733574e+06 -2.89777643e+06
-3.23919999e+06 -2.88339567e+06 -3.24011968e+06 -2.89336301e+06
-3.23264031e+06 -2.87010349e+06 -3.24134233e+06 -2.87845959e+06
-3.22686205e+06 -3.21413920e+06 -3.26540875e+06 -2.88468000e+06
-2.88436339e+06 -3.13349629e+06 -2.89666408e+06 -3.25102040e+06]
[-2.90554339e+06 -3.26642987e+06 -1.71352208e+06 -2.94102217e+06
-3.26877153e+06 -2.92706323e+06 -3.27397466e+06 -2.93935819e+06
-3.26209009e+06 -2.91421735e+06 -3.26673022e+06 -2.92904551e+06
-3.25321733e+06 -3.24421188e+06 -3.28856249e+06 -2.93300833e+06
-2.92662954e+06 -3.16194664e+06 -2.93906534e+06 -3.27560072e+06]
[-2.49390686e+06 -2.78352710e+06 -1.47021529e+06 -2.51869604e+06
-2.79347630e+06 -2.50791634e+06 -2.80366971e+06 -2.51978966e+06
-2.78722117e+06 -2.49742564e+06 -2.78708094e+06 -2.51666246e+06
-2.77579233e+06 -2.77497383e+06 -2.80061689e+06 -2.51733992e+06
-2.50521607e+06 -2.69657541e+06 -2.51597212e+06 -2.79175262e+06]
[-1.74366933e+06 -1.93858340e+06 -1.06126212e+06 -1.75757374e+06
-1.95115369e+06 -1.75099702e+06 -1.96261032e+06 -1.75988725e+06
-1.94638385e+06 -1.74374159e+06 -1.94333973e+06 -1.76160634e+06
-1.93584898e+06 -1.94033335e+06 -1.94963574e+06 -1.76015830e+06
-1.74735303e+06 -1.87787378e+06 -1.75501632e+06 -1.94449937e+06]
[-8.82024109e+05 -9.70191732e+05 -5.69108988e+05 -8.88905458e+05
-9.78274737e+05 -8.85393871e+05 -9.85935181e+05 -8.90820660e+05
-9.75437247e+05 -8.81351441e+05 -9.73176071e+05 -8.91942160e+05
-9.68865166e+05 -9.72970243e+05 -9.75777045e+05 -8.90557680e+05
-8.83641209e+05 -9.41310592e+05 -8.87403467e+05 -9.73440534e+05]
[-4.03576454e+05 -4.38702136e+05 -2.67947590e+05 -4.06106624e+05
-4.43639626e+05 -4.04714355e+05 -4.47439687e+05 -4.07234274e+05
-4.41712492e+05 -4.02864889e+05 -4.40241869e+05 -4.08119427e+05
-4.38452040e+05 -4.41242710e+05 -4.41206212e+05 -4.07268802e+05
-4.03871257e+05 -4.26479180e+05 -4.05423284e+05 -4.40414853e+05]
[-1.31512068e+05 -1.38499635e+05 -9.62498669e+04 -1.32114024e+05
-1.40678446e+05 -1.31690223e+05 -1.41973673e+05 -1.32604932e+05
-1.39747332e+05 -1.31050308e+05 -1.39056602e+05 -1.32981197e+05
-1.38536740e+05 -1.39715828e+05 -1.39408635e+05 -1.32627933e+05
-1.31526304e+05 -1.35610266e+05 -1.31928506e+05 -1.39273928e+05]
[-4.68068728e+04 -5.36638314e+04 -3.66016959e+04 -4.72244586e+04
-5.40897482e+04 -4.71014370e+04 -5.42152138e+04 -4.71226178e+04
-5.36831055e+04 -4.68461670e+04 -5.37790422e+04 -4.70712815e+04
-5.34717477e+04 -5.38394923e+04 -5.38192803e+04 -4.70778316e+04
-4.70586172e+04 -5.14362817e+04 -4.71782417e+04 -5.37182895e+04]
[-1.15313981e+04 -1.46512141e+04 -8.22433811e+03 -1.17350090e+04
-1.45383111e+04 -1.16968617e+04 -1.44087891e+04 -1.16275110e+04
-1.44874954e+04 -1.16348599e+04 -1.46254590e+04 -1.15295213e+04
-1.45230472e+04 -1.44677436e+04 -1.46775034e+04 -1.15914634e+04
-1.16961579e+04 -1.37754625e+04 -1.17383147e+04 -1.46124380e+04]
[ 6.92109198e-01 8.55161885e-01 3.20915455e-01 1.56347837e-01
-2.02568913e-01 9.33224985e-01 -6.91841656e-01 7.90173617e-01
-3.77973864e-01 9.69781793e-02 3.64132517e-01 -5.27060697e-01
-6.64526630e-01 1.69640269e-02 5.83727751e-01 3.84828924e-01
-7.62053326e-01 8.01484430e-01 -4.05248659e-02 8.93353358e-01]
[ 1.06867412e-01 -8.30396357e-01 -5.95073929e-01 7.08475946e-01
4.11854734e-01 7.89879040e-01 -3.41707996e-01 5.60027933e-02
3.00796265e-01 1.88581707e-01 -5.37074129e-01 -1.46357301e-01
-5.03777072e-01 6.91229924e-01 9.73354890e-01 -8.66858394e-01
4.27856065e-01 -3.39768896e-01 2.50870757e-01 -4.83740701e-01]
[ 3.02015219e-01 -2.57705631e-01 -4.10358241e-01 8.23526347e-01
8.84997748e-01 2.27100053e-01 -5.71064438e-01 8.78837742e-01
5.00907093e-01 5.02179615e-01 -5.76557330e-01 6.60313052e-01
-5.19809692e-01 2.63241491e-01 4.21479140e-01 4.84766859e-01
-2.19470591e-01 5.19650793e-01 8.05871804e-01 1.74840038e-01]
[-8.19180569e-01 -7.42048032e-01 -7.89474947e-01 -6.54545073e-01
-7.47138219e-01 5.56601780e-01 -9.21176976e-01 -5.16883165e-01
7.58132803e-01 9.47037722e-01 2.10844015e-01 9.52476529e-01
-9.13096917e-01 8.97145537e-01 -3.77407835e-01 5.97945681e-01
6.21258207e-01 7.19997183e-01 -8.28983782e-02 8.61288784e-01]
[-4.84214031e-01 8.68890985e-01 2.38239267e-01 9.70889830e-01
-9.34712268e-01 4.50333318e-01 1.31108471e-01 -1.51519052e-02
-4.81563749e-01 -3.46338630e-01 -5.01075587e-01 -5.61464179e-01
5.99321675e-01 4.79001180e-03 -8.33620223e-01 5.53968384e-01
6.72981522e-02 4.78775575e-01 3.07873863e-02 -2.00108152e-01]
[ 9.72493565e-01 -9.43514760e-01 8.65527816e-01 8.61709936e-01
-2.18162577e-01 -5.71070258e-01 2.38426596e-01 -6.44055329e-01
6.06416389e-01 -4.92132288e-01 -4.18387690e-01 8.31831580e-01
8.05833667e-01 7.07617835e-02 7.25677961e-01 -2.94934862e-01
9.95768556e-01 -1.32620521e-01 -4.10375976e-01 -9.16851532e-01]
[ 9.79413908e-01 -7.02247382e-02 4.69170028e-01 2.81615248e-01
4.46186799e-01 -8.97778192e-01 8.40090811e-01 8.53682436e-01
1.03990054e-01 9.27831777e-01 -4.38088926e-01 2.04293254e-01
-2.07074620e-01 2.56046464e-01 -3.98735423e-01 6.38716769e-01
-8.60428043e-01 -9.16244859e-01 -9.01207231e-01 -6.99089943e-01]
[ 4.48226735e+02 2.12134993e+03 -3.07470875e+03 5.72962833e+02
1.88706703e+03 5.31112317e+02 1.69606051e+03 4.61289255e+02
1.91124132e+03 5.61707651e+02 2.03441725e+03 3.44787028e+02
2.07448851e+03 1.86577479e+03 2.15727069e+03 4.57892673e+02
5.73452106e+02 1.74472453e+03 5.98269132e+02 2.10158936e+03]
[-4.75194957e+04 -5.77978177e+04 -3.66431621e+04 -4.81026462e+04
-5.75843971e+04 -4.80372612e+04 -5.72035789e+04 -4.78385845e+04
-5.74698896e+04 -4.77089630e+04 -5.78026593e+04 -4.76589609e+04
-5.73578574e+04 -5.72577925e+04 -5.78948451e+04 -4.77371189e+04
-4.79649409e+04 -5.48470947e+04 -4.80818432e+04 -5.76695114e+04]
[-1.34302296e+05 -1.67768093e+05 -8.67844869e+04 -1.35784148e+05
-1.67084083e+05 -1.35692172e+05 -1.66053922e+05 -1.34787971e+05
-1.66770369e+05 -1.34890875e+05 -1.67852215e+05 -1.34538804e+05
-1.66611584e+05 -1.66645105e+05 -1.67891275e+05 -1.34888792e+05
-1.35132850e+05 -1.58060133e+05 -1.35789664e+05 -1.67206437e+05]
[-2.74948758e+05 -3.52544585e+05 -1.68846379e+05 -2.79712212e+05
-3.49122812e+05 -2.78923472e+05 -3.46078879e+05 -2.76791720e+05
-3.48434879e+05 -2.77235323e+05 -3.51869537e+05 -2.74775736e+05
-3.49286865e+05 -3.47901489e+05 -3.53282985e+05 -2.76282819e+05
-2.78399089e+05 -3.30871736e+05 -2.79896435e+05 -3.51063094e+05]
[-5.92223923e+05 -7.58189098e+05 -3.28355921e+05 -6.04343643e+05
-7.48855621e+05 -6.01888788e+05 -7.41375534e+05 -5.97653564e+05
-7.47542557e+05 -5.98243153e+05 -7.55861308e+05 -5.91646516e+05
-7.50350883e+05 -7.45124384e+05 -7.60970122e+05 -5.95783852e+05
-6.01609465e+05 -7.12857004e+05 -6.05046024e+05 -7.55525095e+05]
[-1.03701381e+06 -1.35339817e+06 -5.47645089e+05 -1.06250366e+06
-1.33080538e+06 -1.05736746e+06 -1.31417906e+06 -1.04895661e+06
-1.32958143e+06 -1.05047550e+06 -1.34751832e+06 -1.03457578e+06
-1.33662441e+06 -1.32316753e+06 -1.35885026e+06 -1.04369870e+06
-1.05790012e+06 -1.26867498e+06 -1.06426607e+06 -1.34780585e+06]
[-1.69608502e+06 -2.23593491e+06 -8.40359798e+05 -1.74358798e+06
-2.19012139e+06 -1.73362905e+06 -2.15882577e+06 -1.71917086e+06
-2.18962958e+06 -1.72177406e+06 -2.22310089e+06 -1.69014323e+06
-2.20456195e+06 -2.17551939e+06 -2.24699777e+06 -1.70773706e+06
-1.73615348e+06 -2.09395790e+06 -1.74755320e+06 -2.22622346e+06]
[-2.62751530e+06 -3.44615787e+06 -1.33494381e+06 -2.70050515e+06
-3.37719387e+06 -2.68495344e+06 -3.32959653e+06 -2.66423880e+06
-3.37627322e+06 -2.66665580e+06 -3.42664284e+06 -2.61950361e+06
-3.39877071e+06 -3.35400324e+06 -3.46354525e+06 -2.64599767e+06
-2.68943626e+06 -3.23111679e+06 -2.70603309e+06 -3.43192048e+06]
[-3.74930461e+06 -4.82030722e+06 -2.01631094e+06 -3.84054571e+06
-4.74214053e+06 -3.82102379e+06 -4.68664330e+06 -3.79731844e+06
-4.73900290e+06 -3.79584238e+06 -4.79880283e+06 -3.74518100e+06
-4.76239913e+06 -4.71191983e+06 -4.84344835e+06 -3.77629196e+06
-3.82432709e+06 -4.53470148e+06 -3.84574420e+06 -4.80342925e+06]
[-5.15965660e+06 -6.51218390e+06 -2.89128790e+06 -5.27267043e+06
-6.42572317e+06 -5.24824323e+06 -6.36428435e+06 -5.22301627e+06
-6.41952255e+06 -5.21458187e+06 -6.48917875e+06 -5.16301683e+06
-6.44182113e+06 -6.38628018e+06 -6.54273435e+06 -5.19817920e+06
-5.24977031e+06 -6.14646802e+06 -5.27758302e+06 -6.49381163e+06]
[-6.78116776e+06 -8.35152423e+06 -3.82720527e+06 -6.91227111e+06
-8.26722715e+06 -6.88148150e+06 -8.20844479e+06 -6.86096955e+06
-8.25601863e+06 -6.84051183e+06 -8.32857183e+06 -6.79644475e+06
-8.27458434e+06 -8.21666614e+06 -8.39318749e+06 -6.83399500e+06
-6.88178142e+06 -7.92152202e+06 -6.91605652e+06 -8.33676034e+06]
[-8.44740012e+06 -1.02642511e+07 -4.74534397e+06 -8.60142840e+06
-1.01756352e+07 -8.56248327e+06 -1.01145079e+07 -8.54712799e+06
-1.01600045e+07 -8.51517510e+06 -1.02384055e+07 -8.47232217e+06
-1.01784341e+07 -1.01096717e+07 -1.03181573e+07 -8.51451506e+06
-8.56431643e+06 -9.76525176e+06 -8.60446455e+06 -1.02542522e+07]
[-9.19242630e+06 -1.10860292e+07 -5.17076199e+06 -9.35175934e+06
-1.10032505e+07 -9.30903048e+06 -1.09472208e+07 -9.30073549e+06
-1.09861038e+07 -9.26052224e+06 -1.10613829e+07 -9.22606723e+06
-1.10005022e+07 -1.09294957e+07 -1.11458785e+07 -9.26783268e+06
-9.31017264e+06 -1.05639774e+07 -9.35362576e+06 -1.10818206e+07]
[-8.70326009e+06 -1.03730110e+07 -4.91781001e+06 -8.84170404e+06
-1.03145055e+07 -8.80218810e+06 -1.02776474e+07 -8.80332405e+06
-1.02979563e+07 -8.75884787e+06 -1.03557688e+07 -8.74380867e+06
-1.03026753e+07 -1.02458666e+07 -1.04296118e+07 -8.77663489e+06
-8.80090869e+06 -9.90807584e+06 -8.84144178e+06 -1.03754360e+07]
[-6.84504350e+06 -8.07873682e+06 -3.94143725e+06 -6.94970881e+06
-8.04319889e+06 -6.91655732e+06 -8.02507790e+06 -6.92463935e+06
-8.02913377e+06 -6.88352638e+06 -8.06798428e+06 -6.88059045e+06
-8.02788197e+06 -7.98913464e+06 -8.12430622e+06 -6.90381943e+06
-6.91597595e+06 -7.73216093e+06 -6.94800653e+06 -8.08429978e+06]
[-4.59954770e+06 -5.42601672e+06 -2.76666402e+06 -4.66815471e+06
-5.40728661e+06 -4.64452761e+06 -5.40005236e+06 -4.65315514e+06
-5.39637788e+06 -4.62302575e+06 -5.41948606e+06 -4.62407190e+06
-5.39474104e+06 -5.37212741e+06 -5.45743738e+06 -4.63968230e+06
-4.64402020e+06 -5.19244727e+06 -4.66538476e+06 -5.43010968e+06]
[-2.48332838e+06 -2.89905620e+06 -1.60004397e+06 -2.51673809e+06
-2.89680392e+06 -2.50338968e+06 -2.89937216e+06 -2.51083897e+06
-2.88893597e+06 -2.49180983e+06 -2.89741817e+06 -2.49812468e+06
-2.88560804e+06 -2.88023626e+06 -2.91666538e+06 -2.50516656e+06
-2.50239591e+06 -2.77904114e+06 -2.51385034e+06 -2.90125635e+06]
[-1.23414249e+06 -1.42405677e+06 -8.71094594e+05 -1.24910906e+06
-1.42628726e+06 -1.24164710e+06 -1.42947629e+06 -1.24710455e+06
-1.42108476e+06 -1.23617586e+06 -1.42331889e+06 -1.24149117e+06
-1.41950264e+06 -1.41860030e+06 -1.43388156e+06 -1.24485294e+06
-1.24198604e+06 -1.36862489e+06 -1.24677635e+06 -1.42536620e+06]
[-4.96008593e+05 -5.53632664e+05 -3.97535113e+05 -5.00175862e+05
-5.57302374e+05 -4.96630665e+05 -5.60549830e+05 -5.00541062e+05
-5.54481873e+05 -4.94640102e+05 -5.53444442e+05 -4.99174703e+05
-5.53590830e+05 -5.54436776e+05 -5.58492286e+05 -5.00316793e+05
-4.97306859e+05 -5.36024914e+05 -4.98477647e+05 -5.54553584e+05]
[-1.50564744e+05 -1.67725893e+05 -1.35727939e+05 -1.51455415e+05
-1.69210359e+05 -1.50111824e+05 -1.70539501e+05 -1.51789219e+05
-1.68188424e+05 -1.49462663e+05 -1.67523192e+05 -1.51538611e+05
-1.68149205e+05 -1.68603257e+05 -1.69484694e+05 -1.51885487e+05
-1.50611241e+05 -1.62396037e+05 -1.50581359e+05 -1.67711649e+05]
[-5.07942113e+04 -5.29122386e+04 -5.15666957e+04 -5.07057198e+04
-5.40806410e+04 -5.01648900e+04 -5.50322997e+04 -5.10521846e+04
-5.35628722e+04 -4.99605406e+04 -5.29175734e+04 -5.12815038e+04
-5.34776076e+04 -5.40021545e+04 -5.37086740e+04 -5.12589448e+04
-5.04323103e+04 -5.20288283e+04 -5.02324269e+04 -5.29333319e+04]
[-3.57952184e+03 -3.90425424e+03 -2.42561673e+03 -3.58838045e+03
-3.96248614e+03 -3.57410898e+03 -4.02559643e+03 -3.59569783e+03
-3.93466833e+03 -3.56039882e+03 -3.92161665e+03 -3.60914203e+03
-3.90702510e+03 -3.95569192e+03 -3.91931145e+03 -3.59618293e+03
-3.56694030e+03 -3.77271105e+03 -3.58172385e+03 -3.91397267e+03]
[ 4.65539707e-01 -1.19324346e-01 3.26313646e-01 -5.22180090e-01
9.97198177e-01 -5.14242957e-01 8.81656829e-01 -5.65560499e-01
-4.87123079e-03 6.42353930e-01 4.33176094e-01 4.11160824e-01
-1.19118880e-01 5.08350051e-01 8.39907154e-01 -1.17296509e-01
5.59309683e-02 -8.67928832e-01 -2.18453853e-01 -6.55228673e-02]
[ 7.90275422e-01 -7.78885119e-01 4.62275206e-01 9.09423371e-02
2.13070861e-01 -9.40434112e-01 -7.06505240e-01 -4.32033549e-01
-9.90255904e-01 3.38315596e-01 7.40515898e-01 9.39366185e-02
8.63280950e-02 2.31451857e-01 -3.95636999e-01 -2.66536037e-01
1.49879455e-01 6.18433167e-01 -5.96806731e-01 -3.44951888e-01]
[ 4.85842501e-01 -3.18159502e-01 -9.04778143e-01 -6.87286143e-01
-6.12270281e-01 -9.77527488e-03 2.70249922e-01 7.60439954e-01
8.05073113e-01 -3.85678463e-01 5.06760146e-01 -4.35143939e-01
-2.62846260e-01 -4.14546876e-01 -1.72618528e-01 -5.70568609e-01
-3.62027987e-01 -7.56160372e-01 9.26036479e-01 7.96601880e-03]
[ 8.46201365e-01 4.92320282e-01 -8.45894246e-02 5.09244451e-01
2.56046157e-01 -3.92483132e-01 4.33186268e-02 4.24624391e-01
-3.89372937e-01 -9.74954326e-01 -4.63474342e-01 5.93490951e-01
8.59986178e-01 2.50662310e-01 -7.34385031e-01 5.15140718e-01
5.38106921e-02 5.07738143e-01 7.17223406e-01 8.95083102e-01]
[ 3.09075069e-01 7.08516420e-01 4.85176115e-01 4.54202377e-01
7.17581513e-01 8.46006082e-01 8.04152003e-01 -2.08499477e-01
-8.31957440e-01 6.59147437e-01 7.78631066e-02 8.41523095e-02
6.50350661e-01 -9.36031631e-01 7.55920837e-01 -9.30731997e-01
3.86389117e-01 1.74968959e-01 2.83498362e-01 -2.51839625e-01]
[ 1.12194152e+03 4.09305070e+03 2.97328511e+03 1.63325273e+03
3.45727781e+03 1.47094184e+03 3.10995056e+03 1.42829962e+03
3.56065397e+03 1.47193248e+03 3.89894842e+03 9.71650516e+02
3.83999190e+03 3.29900596e+03 4.13956077e+03 1.15869095e+03
1.67916273e+03 3.51670816e+03 1.64956164e+03 4.03806888e+03]
[ 3.63446940e+03 2.13920190e+04 7.03565817e+03 6.75128251e+03
1.74282220e+04 5.76548033e+03 1.52147075e+04 5.45566487e+03
1.80444584e+04 5.76905380e+03 2.01493691e+04 2.63889114e+03
1.98432394e+04 1.64444524e+04 2.17731980e+04 3.87623708e+03
7.06783963e+03 1.80084307e+04 6.89649220e+03 2.10797833e+04]
[-1.93256751e+05 -2.26266393e+05 -1.08753639e+05 -1.92085986e+05
-2.29219680e+05 -1.92830108e+05 -2.29844421e+05 -1.91781705e+05
-2.27790341e+05 -1.91817151e+05 -2.27265162e+05 -1.94282553e+05
-2.26243333e+05 -2.29681549e+05 -2.26485677e+05 -1.93780662e+05
-1.90560954e+05 -2.14906805e+05 -1.92081538e+05 -2.25799046e+05]
[-3.72393458e+05 -4.53478368e+05 -1.92754899e+05 -3.72794047e+05
-4.55555832e+05 -3.73497725e+05 -4.55056026e+05 -3.70787525e+05
-4.53343412e+05 -3.71402053e+05 -4.54373927e+05 -3.73372543e+05
-4.51862581e+05 -4.56131985e+05 -4.54191526e+05 -3.73687709e+05
-3.69760702e+05 -4.27866845e+05 -3.72976318e+05 -4.51774638e+05]
[-6.94055309e+05 -8.76043676e+05 -2.74425885e+05 -7.00167944e+05
-8.71997915e+05 -7.00640266e+05 -8.66639928e+05 -6.93810843e+05
-8.67854478e+05 -6.95686289e+05 -8.74457051e+05 -6.93567582e+05
-8.68237449e+05 -8.71362412e+05 -8.79027714e+05 -6.97149851e+05
-6.94587245e+05 -8.21230296e+05 -7.01745052e+05 -8.71581639e+05]
[-1.30852593e+06 -1.62885508e+06 -4.90525637e+05 -1.31749852e+06
-1.62458246e+06 -1.31913468e+06 -1.61606995e+06 -1.30699340e+06
-1.61680386e+06 -1.30942020e+06 -1.62707061e+06 -1.30899872e+06
-1.61580256e+06 -1.62395020e+06 -1.63501054e+06 -1.31506128e+06
-1.30689863e+06 -1.53131523e+06 -1.31994413e+06 -1.62080569e+06]
[-2.52660699e+06 -3.18893007e+06 -9.65438864e+05 -2.55394352e+06
-3.16802738e+06 -2.55445275e+06 -3.14478352e+06 -2.53062579e+06
-3.15602230e+06 -2.53518956e+06 -3.18206399e+06 -2.52570453e+06
-3.15934867e+06 -3.16376741e+06 -3.20178526e+06 -2.54043019e+06
-2.53551344e+06 -2.99433688e+06 -2.55845729e+06 -3.17203791e+06]
[-3.75368228e+06 -4.66022177e+06 -1.40067892e+06 -3.78311306e+06
-4.64283283e+06 -3.78838554e+06 -4.61627444e+06 -3.75519579e+06
-4.62380620e+06 -3.75749372e+06 -4.65463994e+06 -3.75808603e+06
-4.62035761e+06 -4.63963524e+06 -4.67863070e+06 -3.77519907e+06
-3.75459440e+06 -4.38662658e+06 -3.78899826e+06 -4.63548211e+06]
[-5.25749056e+06 -6.57434358e+06 -1.92407656e+06 -5.30931882e+06
-6.53436034e+06 -5.31526646e+06 -6.48666983e+06 -5.26884491e+06
-6.50872929e+06 -5.27144306e+06 -6.55923430e+06 -5.26052628e+06
-6.51181050e+06 -6.52282000e+06 -6.60172616e+06 -5.28908349e+06
-5.27318520e+06 -6.18364646e+06 -5.31889230e+06 -6.54050283e+06]
[-7.94722591e+06 -9.96889414e+06 -2.96199449e+06 -8.03176032e+06
-9.90178792e+06 -8.04273395e+06 -9.82897646e+06 -7.97701812e+06
-9.87567239e+06 -7.98326787e+06 -9.95014623e+06 -7.95902547e+06
-9.87883683e+06 -9.88147622e+06 -9.99484563e+06 -7.99591976e+06
-7.98466682e+06 -9.37328992e+06 -8.04406997e+06 -9.92570062e+06]
[-1.16896936e+07 -1.47608174e+07 -4.41923472e+06 -1.18409189e+07
-1.46312688e+07 -1.18512927e+07 -1.45141582e+07 -1.17607568e+07
-1.46108382e+07 -1.17734731e+07 -1.47293312e+07 -1.17092937e+07
-1.46262413e+07 -1.45894466e+07 -1.47853092e+07 -1.17638188e+07
-1.17841060e+07 -1.38700378e+07 -1.18595037e+07 -1.47096560e+07]
[-1.55413286e+07 -1.96847831e+07 -5.97028710e+06 -1.57605976e+07
-1.94975830e+07 -1.57674788e+07 -1.93396565e+07 -1.56569145e+07
-1.94828149e+07 -1.56740654e+07 -1.96399479e+07 -1.55726593e+07
-1.95141514e+07 -1.94306106e+07 -1.97128422e+07 -1.56446565e+07
-1.56955005e+07 -1.84965125e+07 -1.57831730e+07 -1.96309128e+07]
[-1.81285620e+07 -2.32268973e+07 -6.73939033e+06 -1.84383312e+07
-2.29435873e+07 -1.84248323e+07 -2.27270789e+07 -1.83036589e+07
-2.29334217e+07 -1.83225125e+07 -2.31466599e+07 -1.81491345e+07
-2.30074693e+07 -2.28399010e+07 -2.32706426e+07 -1.82550157e+07
-1.83707581e+07 -2.17958563e+07 -1.84646831e+07 -2.31671298e+07]
[-1.95175600e+07 -2.52843821e+07 -7.06367237e+06 -1.99048579e+07
-2.49106866e+07 -1.98695632e+07 -2.46461078e+07 -1.97449471e+07
-2.49161555e+07 -1.97645917e+07 -2.51760343e+07 -1.95280846e+07
-2.50276088e+07 -2.47798167e+07 -2.53369259e+07 -1.96613355e+07
-1.98386146e+07 -2.36941585e+07 -1.99330679e+07 -2.52196858e+07]
[-1.86450349e+07 -2.40175007e+07 -7.17088353e+06 -1.89827848e+07
-2.37097126e+07 -1.89573071e+07 -2.34975758e+07 -1.88489004e+07
-2.37238751e+07 -1.88643895e+07 -2.39393389e+07 -1.86784705e+07
-2.38059318e+07 -2.36036903e+07 -2.40509968e+07 -1.87848033e+07
-1.89168694e+07 -2.25214219e+07 -1.90031344e+07 -2.39653659e+07]
[-1.49687585e+07 -1.93067112e+07 -6.04854361e+06 -1.52362335e+07
-1.90660743e+07 -1.52140204e+07 -1.89079274e+07 -1.51326797e+07
-1.90823985e+07 -1.51446809e+07 -1.92484477e+07 -1.49971878e+07
-1.91463274e+07 -1.89875645e+07 -1.93263139e+07 -1.50815273e+07
-1.51804576e+07 -1.80947632e+07 -1.52496641e+07 -1.92683006e+07]
[-1.04541395e+07 -1.36017501e+07 -4.43362110e+06 -1.06472094e+07
-1.34234176e+07 -1.06267322e+07 -1.33102337e+07 -1.05725395e+07
-1.34391701e+07 -1.05819124e+07 -1.35587289e+07 -1.04691933e+07
-1.34905763e+07 -1.33716887e+07 -1.36115047e+07 -1.05331858e+07
-1.06055958e+07 -1.27254133e+07 -1.06532038e+07 -1.35723298e+07]
[-6.12855185e+06 -8.01765431e+06 -2.94972823e+06 -6.24681121e+06
-7.90835658e+06 -6.22689112e+06 -7.83937096e+06 -6.20107471e+06
-7.91540482e+06 -6.20447804e+06 -7.98761960e+06 -6.13105102e+06
-7.95550501e+06 -7.87694859e+06 -8.02651229e+06 -6.17529131e+06
-6.22123479e+06 -7.49827417e+06 -6.24531380e+06 -7.99888926e+06]
[-2.84984965e+06 -3.76553879e+06 -1.62418548e+06 -2.91445239e+06
-3.70352001e+06 -2.89493971e+06 -3.66898978e+06 -2.89053592e+06
-3.70420871e+06 -2.88619639e+06 -3.74127270e+06 -2.84431779e+06
-3.73760809e+06 -3.68633901e+06 -3.78041205e+06 -2.87433643e+06
-2.90202072e+06 -3.52213636e+06 -2.91014305e+06 -3.75456050e+06]
[-1.14710488e+06 -1.47589351e+06 -8.67062057e+05 -1.17360060e+06
-1.45230454e+06 -1.15691703e+06 -1.44266875e+06 -1.16547788e+06
-1.44933816e+06 -1.15599171e+06 -1.46010615e+06 -1.14109005e+06
-1.47109236e+06 -1.44534216e+06 -1.49189986e+06 -1.15866761e+06
-1.16663856e+06 -1.39394279e+06 -1.16660704e+06 -1.47040921e+06]
[-3.52831555e+05 -4.49313648e+05 -3.53977262e+05 -3.64723324e+05
-4.37892582e+05 -3.52194674e+05 -4.34139412e+05 -3.61592861e+05
-4.34283166e+05 -3.53774573e+05 -4.37671810e+05 -3.45859042e+05
-4.50561982e+05 -4.33926930e+05 -4.62790726e+05 -3.57804665e+05
-3.61522709e+05 -4.31303302e+05 -3.59443023e+05 -4.46385116e+05]
[ 9.66060445e+03 -9.81938047e+03 -7.93172921e+04 3.93973867e+03
-2.67982282e+03 1.04541575e+04 -8.31192532e+02 5.39569761e+03
-5.68335978e+02 9.48615094e+03 -2.60780057e+03 1.45157926e+04
-1.04151463e+04 -1.04542401e+03 -1.75280839e+04 8.02642742e+03
4.61759641e+03 -9.87337567e+03 6.09224892e+03 -7.92495649e+03]
[ 2.55285537e+04 3.35819526e+04 1.36603522e+04 2.54958770e+04
3.37808011e+04 2.65802458e+04 3.31419089e+04 2.53858321e+04
3.45430771e+04 2.62461311e+04 3.49395602e+04 2.63780292e+04
3.26290932e+04 3.36528214e+04 3.16488676e+04 2.52077771e+04
2.57267836e+04 3.03079737e+04 2.58945105e+04 3.38954311e+04]
[ 5.35567107e+01 9.80961577e+01 3.78282996e+02 5.64126669e+01
9.72771020e+01 6.21531634e+01 9.30096300e+01 5.56604285e+01
1.02134735e+02 5.66020543e+01 1.04919401e+02 5.64779492e+01
9.13176335e+01 9.76185790e+01 8.52885983e+01 4.90021709e+01
5.99422005e+01 7.80061363e+01 5.76390151e+01 9.75109000e+01]
[ 3.59111789e-01 -9.29852761e-01 -3.43779370e-01 4.90583746e-01
8.85615970e-01 6.05465100e-01 -5.18347581e-01 -5.34169063e-01
-6.19326411e-01 7.64995070e-01 -5.24288626e-01 5.16361247e-01
-4.77900537e-01 -9.33836313e-01 4.66895400e-01 4.52403620e-01
-8.22081778e-01 -3.46597484e-01 8.96730580e-01 -6.74102003e-01]
[-8.26655055e-01 1.89207776e-01 8.61979731e-01 -7.32443385e-01
2.60245873e-02 3.67998428e-01 -6.56340481e-01 -9.77480213e-01
7.75366261e-01 -9.29537459e-01 -4.85083432e-01 3.03368063e-01
-4.28434133e-01 -9.80584807e-01 1.50903669e-01 -3.84415443e-01
-6.96971876e-01 9.42566623e-01 -6.70055464e-01 4.54470882e-01]
[ 7.81448383e-01 7.17430231e-01 -6.31485866e-01 -5.26382933e-01
-9.63274727e-01 8.62810935e-01 7.74242353e-01 1.90932338e-01
-7.81264689e-01 -6.52914706e-01 1.53920742e-01 -4.96686053e-01
-3.99656334e-01 -6.58025302e-01 -6.20816562e-01 -7.31576912e-02
1.97479453e-02 2.31597793e-02 9.94277599e-01 -7.40808365e-01]
[-7.43066948e+03 -7.61320951e+03 -4.55380359e+03 -7.20228715e+03
-7.94571622e+03 -7.33165604e+03 -8.17605527e+03 -7.27968712e+03
-7.94816436e+03 -7.31715206e+03 -7.76861228e+03 -7.60661405e+03
-7.77540200e+03 -8.08101641e+03 -7.52966802e+03 -7.45515837e+03
-7.16569996e+03 -7.38873812e+03 -7.21751870e+03 -7.65528260e+03]
[-4.41590501e+02 1.85791472e+04 2.07994238e+04 2.68615223e+03
1.46979141e+04 1.56399215e+03 1.25809177e+04 1.46824199e+03
1.53094891e+04 1.64652045e+03 1.73548552e+04 -1.45472248e+03
1.70855129e+04 1.36619180e+04 1.89035650e+04 -2.39004730e+02
2.93872169e+03 1.48417524e+04 2.68828693e+03 1.82703904e+04]
[-1.25219244e+05 -9.01475770e+04 -5.55837284e+03 -1.15760201e+05
-1.02669301e+05 -1.19042031e+05 -1.09080063e+05 -1.19063046e+05
-1.00022082e+05 -1.18480069e+05 -9.38851790e+04 -1.28495474e+05
-9.45665916e+04 -1.05905212e+05 -8.95852313e+04 -1.24868814e+05
-1.14090732e+05 -9.45222007e+04 -1.15616939e+05 -9.07087704e+04]
[-4.81570302e+05 -4.68710827e+05 -1.83097625e+05 -4.62340348e+05
-4.96311754e+05 -4.69242533e+05 -5.09450468e+05 -4.68041293e+05
-4.90030938e+05 -4.66932146e+05 -4.77674124e+05 -4.89418490e+05
-4.77261340e+05 -5.03633520e+05 -4.67436739e+05 -4.81990333e+05
-4.56378619e+05 -4.59279998e+05 -4.61492645e+05 -4.68547020e+05]
[-9.74436907e+05 -1.02408027e+06 -3.55423822e+05 -9.47361294e+05
-1.06388896e+06 -9.57984613e+05 -1.08088449e+06 -9.53369936e+05
-1.05305720e+06 -9.53051140e+05 -1.03688603e+06 -9.85283545e+05
-1.03439826e+06 -1.07480630e+06 -1.02304836e+06 -9.76262732e+05
-9.36114049e+05 -9.89607042e+05 -9.46316265e+05 -1.02199895e+06]
[-1.59638444e+06 -1.71206267e+06 -4.99282591e+05 -1.55357414e+06
-1.77272839e+06 -1.57161791e+06 -1.79619346e+06 -1.56153795e+06
-1.75399671e+06 -1.56159079e+06 -1.73109296e+06 -1.61201089e+06
-1.72428424e+06 -1.78992459e+06 -1.71163365e+06 -1.59976124e+06
-1.53415732e+06 -1.64537229e+06 -1.55275068e+06 -1.70655155e+06]
[-2.69858311e+06 -3.02457522e+06 -8.31650230e+05 -2.65111181e+06
-3.09447234e+06 -2.67408725e+06 -3.11640636e+06 -2.65506238e+06
-3.06539078e+06 -2.65499874e+06 -3.04430938e+06 -2.71638731e+06
-3.03002012e+06 -3.11438483e+06 -3.03026758e+06 -2.70700166e+06
-2.62113268e+06 -2.88707497e+06 -2.65110072e+06 -3.01161599e+06]
[-4.12753477e+06 -4.92664554e+06 -1.01845840e+06 -4.10575619e+06
-4.96068176e+06 -4.12775423e+06 -4.95275787e+06 -4.09209868e+06
-4.92301790e+06 -4.09584957e+06 -4.92910753e+06 -4.13588794e+06
-4.90263300e+06 -4.97329063e+06 -4.94495708e+06 -4.14462780e+06
-4.06432628e+06 -4.65642351e+06 -4.11078179e+06 -4.89852719e+06]
[-5.52268146e+06 -7.02416708e+06 -1.05225088e+06 -5.56394916e+06
-6.96724303e+06 -5.57469139e+06 -6.89444331e+06 -5.51928043e+06
-6.92412744e+06 -5.52772882e+06 -6.98686185e+06 -5.50353334e+06
-6.94281308e+06 -6.95441774e+06 -7.06223112e+06 -5.55063212e+06
-5.51514430e+06 -6.57269708e+06 -5.57781851e+06 -6.97698653e+06]
[-6.96622907e+06 -9.89445730e+06 -2.27671002e+05 -7.18502168e+06
-9.57964318e+06 -7.15701166e+06 -9.33982012e+06 -7.06334263e+06
-9.54699876e+06 -7.09496932e+06 -9.75502419e+06 -6.86942248e+06
-9.68164595e+06 -9.49478771e+06 -9.96305048e+06 -7.00792769e+06
-7.14728484e+06 -9.10926453e+06 -7.22099041e+06 -9.81849637e+06]
[-9.71120593e+06 -1.43839676e+07 6.66669605e+04 -1.01207061e+07
-1.38093358e+07 -1.00590596e+07 -1.34049968e+07 -9.92105791e+06
-1.37961581e+07 -9.98048195e+06 -1.41512722e+07 -9.55254198e+06
-1.40379480e+07 -1.36527158e+07 -1.44708221e+07 -9.77806204e+06
-1.00906627e+07 -1.31692645e+07 -1.01780180e+07 -1.42830210e+07]
[-1.44649047e+07 -2.16350471e+07 -2.58418413e+05 -1.51143606e+07
-2.07452297e+07 -1.50184722e+07 -2.01427695e+07 -1.48154004e+07
-2.07642473e+07 -1.49192251e+07 -2.12984851e+07 -1.42434661e+07
-2.11328041e+07 -2.05036083e+07 -2.17325441e+07 -1.45695391e+07
-1.50928081e+07 -1.97863666e+07 -1.51988900e+07 -2.15081623e+07]
[-1.86678427e+07 -2.86067365e+07 -2.95387532e+05 -1.96199994e+07
-2.73158576e+07 -1.94691964e+07 -2.64718130e+07 -1.91981054e+07
-2.73821297e+07 -1.93521734e+07 -2.81371394e+07 -1.83607066e+07
-2.79174849e+07 -2.69673897e+07 -2.87225477e+07 -1.88119959e+07
-1.96181855e+07 -2.60814628e+07 -1.97371731e+07 -2.84511316e+07]
[-2.21777731e+07 -3.42202472e+07 -6.61167993e+05 -2.33462827e+07
-3.26511506e+07 -2.31563029e+07 -3.16378102e+07 -2.28384804e+07
-3.27566290e+07 -2.30265689e+07 -3.36656663e+07 -2.18194265e+07
-3.34034236e+07 -3.22296974e+07 -3.43414782e+07 -2.23555723e+07
-2.33551339e+07 -3.11751841e+07 -2.34813919e+07 -3.40435789e+07]
[-2.22259478e+07 -3.50489537e+07 -4.89509460e+05 -2.35142050e+07
-3.33142394e+07 -2.32887443e+07 -3.22135415e+07 -2.29610473e+07
-3.34432046e+07 -2.31624333e+07 -3.44362740e+07 -2.18247695e+07
-3.41677199e+07 -3.28559914e+07 -3.51810461e+07 -2.24130608e+07
-2.35338784e+07 -3.18423858e+07 -2.36558690e+07 -3.48580296e+07]
[-2.03065807e+07 -3.26315502e+07 -7.40397397e+05 -2.15589348e+07
-3.09380556e+07 -2.13312802e+07 -2.98796613e+07 -2.10190248e+07
-3.10788006e+07 -2.12224335e+07 -3.20379045e+07 -1.99091506e+07
-3.17933032e+07 -3.05080527e+07 -3.27498670e+07 -2.04805141e+07
-2.15826623e+07 -2.95664944e+07 -2.16920351e+07 -3.24460159e+07]
[-1.64966480e+07 -2.65668085e+07 -1.20408606e+06 -1.75065504e+07
-2.52004458e+07 -1.73181781e+07 -2.43588550e+07 -1.70702893e+07
-2.53216274e+07 -1.72380002e+07 -2.60890380e+07 -1.61752164e+07
-2.59057361e+07 -2.48703569e+07 -2.66542699e+07 -1.66383657e+07
-1.75205949e+07 -2.40597564e+07 -1.76063820e+07 -2.64120006e+07]
[-1.13540574e+07 -1.87629104e+07 -1.04756339e+06 -1.21111695e+07
-1.77301919e+07 -1.19530801e+07 -1.71019663e+07 -1.17831481e+07
-1.78211467e+07 -1.19045718e+07 -1.83929876e+07 -1.10968982e+07
-1.82802479e+07 -1.74893892e+07 -1.88377868e+07 -1.14562989e+07
-1.21186855e+07 -1.69386127e+07 -1.21765809e+07 -1.86416961e+07]
[-7.24314318e+06 -1.21807837e+07 -1.25236683e+06 -7.75489099e+06
-1.14865783e+07 -7.62594842e+06 -1.10708426e+07 -7.53398833e+06
-1.15393835e+07 -7.60149446e+06 -1.19188606e+07 -7.05878515e+06
-1.18710608e+07 -1.13274827e+07 -1.22506708e+07 -7.31312079e+06
-7.75379175e+06 -1.09827107e+07 -7.78464197e+06 -1.20916328e+07]
[-3.29504420e+06 -6.18685528e+06 -7.26750741e+05 -3.63413167e+06
-5.72565829e+06 -3.52365611e+06 -5.45991660e+06 -3.49134964e+06
-5.74938698e+06 -3.51842709e+06 -5.99408063e+06 -3.15423492e+06
-5.99810250e+06 -5.61784064e+06 -6.26089034e+06 -3.33689184e+06
-3.63487592e+06 -5.52325739e+06 -3.64454451e+06 -6.12659517e+06]
[-1.58337559e+06 -3.02852467e+06 -7.84747910e+05 -1.76299398e+06
-2.79136729e+06 -1.68517568e+06 -2.66195839e+06 -1.68969170e+06
-2.79492747e+06 -1.68942229e+06 -2.91492420e+06 -1.50112859e+06
-2.94601135e+06 -2.73497888e+06 -3.09013361e+06 -1.60909991e+06
-1.75756499e+06 -2.71471176e+06 -1.75794142e+06 -2.99446320e+06]
[-7.37847182e+05 -1.27939276e+06 -6.31095762e+05 -8.07082513e+05
-1.19343919e+06 -7.60637943e+05 -1.15505269e+06 -7.81451652e+05
-1.18622225e+06 -7.67264514e+05 -1.22322907e+06 -7.01478151e+05
-1.26436581e+06 -1.17416682e+06 -1.32560607e+06 -7.53684556e+05
-7.99326820e+05 -1.17353912e+06 -7.95051764e+05 -1.26250101e+06]
[-3.34587233e+05 -4.60415128e+05 -4.16306073e+05 -3.48384219e+05
-4.47556730e+05 -3.26830663e+05 -4.49329067e+05 -3.45118592e+05
-4.38707299e+05 -3.30781209e+05 -4.38988121e+05 -3.24392753e+05
-4.70664355e+05 -4.46476766e+05 -4.88299800e+05 -3.43627102e+05
-3.42442590e+05 -4.41966963e+05 -3.38073536e+05 -4.52983969e+05]
[-9.64941218e+04 -1.50257385e+05 -5.75292330e+04 -1.02178632e+05
-1.43471875e+05 -9.52091778e+04 -1.42148204e+05 -9.99699390e+04
-1.40534664e+05 -9.67769457e+04 -1.42223743e+05 -9.20572240e+04
-1.52488559e+05 -1.42349050e+05 -1.59717514e+05 -9.95858283e+04
-1.00283919e+05 -1.41695114e+05 -9.94133692e+04 -1.47807404e+05]
[ 1.56127295e+04 -8.30330537e+03 3.35644631e+04 1.12718889e+04
-1.89587356e+03 1.28940076e+04 1.67941744e+03 1.31847163e+04
-2.28506325e+03 1.27379954e+04 -5.53323329e+03 1.79333087e+04
-5.87160343e+03 -1.96991349e+02 -9.59598561e+03 1.54204308e+04
1.08542134e+04 -3.96857680e+03 1.09301240e+04 -7.83616425e+03]
[-1.70177869e+02 1.10553503e+01 -5.70044111e+02 -1.44935424e+02
-2.73623180e+01 -1.37908652e+02 -5.19801816e+01 -1.57940356e+02
-1.99015660e+01 -1.37567239e+02 5.92650725e+00 -1.77507231e+02
-1.43368504e+01 -3.60894253e+01 -3.10801124e-02 -1.71079075e+02
-1.45533354e+02 -3.49340723e+01 -1.29891474e+02 1.26207663e+01]
[-4.73505882e-01 -9.98426917e-01 -5.29004477e-01 3.47133396e-01
7.56640399e-01 6.61405138e-01 -7.83785229e-01 -8.57750041e-01
5.23184624e-01 -4.30333256e-01 -4.56393895e-01 -9.95999399e-01
-8.02921979e-01 -7.28805905e-01 -6.81279588e-01 -1.09372795e-01
6.28271629e-01 6.24596231e-01 8.19979243e-01 -1.12815923e-01]
[ 4.17421016e-01 -2.33317638e-02 -9.00314884e-01 -8.39137132e-01
-5.08115330e-01 9.63243457e-01 3.83834459e-01 -4.63984836e-01
4.12526489e-01 3.22692269e-01 -9.13419678e-01 -2.77024831e-01
5.47455967e-01 -8.42954170e-01 7.68768234e-01 8.61736593e-01
7.06171025e-01 -7.65244792e-01 1.30346963e-01 4.15119896e-01]
[-9.18070266e+03 -8.26358888e+03 -3.74231206e+03 -8.55504749e+03
-9.08819155e+03 -8.79802235e+03 -9.54650920e+03 -8.83017636e+03
-8.99715596e+03 -8.75688228e+03 -8.55433890e+03 -9.49062112e+03
-8.55557112e+03 -9.32113254e+03 -8.17472338e+03 -9.25008515e+03
-8.38378952e+03 -8.10481420e+03 -8.50103348e+03 -8.29983047e+03]
[-6.81720765e+04 -2.64802395e+04 5.02967093e+04 -6.14571075e+04
-3.43761130e+04 -6.38229211e+04 -3.87380933e+04 -6.40208714e+04
-3.31886870e+04 -6.36514732e+04 -2.88980500e+04 -7.01290987e+04
-2.94022829e+04 -3.67628833e+04 -2.58770881e+04 -6.78756642e+04
-6.04435962e+04 -3.46002340e+04 -6.13971321e+04 -2.68149963e+04]
[-2.93687437e+05 -1.90300702e+05 2.31920030e+04 -2.71893917e+05
-2.18674312e+05 -2.78641286e+05 -2.33795282e+05 -2.79879371e+05
-2.12845553e+05 -2.78119283e+05 -1.98302438e+05 -3.00598838e+05
-2.01345005e+05 -2.26251218e+05 -1.89251616e+05 -2.92924612e+05
-2.67955607e+05 -2.07686014e+05 -2.70995353e+05 -1.91307643e+05]
[-6.32285554e+05 -4.67164394e+05 -1.83401588e+05 -5.84804303e+05
-5.31365633e+05 -6.00587746e+05 -5.63406976e+05 -6.01405957e+05
-5.18878919e+05 -5.98073454e+05 -4.87730830e+05 -6.49434268e+05
-4.90359023e+05 -5.48184574e+05 -4.62925711e+05 -6.31422175e+05
-5.74627644e+05 -4.87312818e+05 -5.82236013e+05 -4.68562127e+05]
[-1.00542396e+06 -7.93047629e+05 -2.75033318e+05 -9.30243126e+05
-8.91316263e+05 -9.56361706e+05 -9.36869903e+05 -9.54310982e+05
-8.69958225e+05 -9.50471132e+05 -8.24364825e+05 -1.02973259e+06
-8.24619537e+05 -9.16813444e+05 -7.86884722e+05 -1.00378507e+06
-9.12411829e+05 -8.09475074e+05 -9.27385707e+05 -7.93659108e+05]
[-1.62030777e+06 -1.46924426e+06 -3.66226819e+05 -1.52304314e+06
-1.59158415e+06 -1.55855219e+06 -1.64093432e+06 -1.54988036e+06
-1.55800881e+06 -1.54622159e+06 -1.50565276e+06 -1.64668362e+06
-1.50031455e+06 -1.62345501e+06 -1.46469719e+06 -1.61873071e+06
-1.49449912e+06 -1.45105951e+06 -1.52092871e+06 -1.46465717e+06]
[-2.23787510e+06 -2.40275151e+06 -1.01990553e+05 -2.16306959e+06
-2.48507895e+06 -2.19553927e+06 -2.50003126e+06 -2.17422753e+06
-2.44159034e+06 -2.17444003e+06 -2.41734856e+06 -2.24512175e+06
-2.40304091e+06 -2.50597486e+06 -2.41029575e+06 -2.23872843e+06
-2.12790325e+06 -2.29947492e+06 -2.16595027e+06 -2.38509232e+06]
[-2.91736274e+06 -3.95407237e+06 4.35059797e+05 -2.95332033e+06
-3.87444543e+06 -2.95433779e+06 -3.78315427e+06 -2.91457331e+06
-3.82796258e+06 -2.92295158e+06 -3.89574297e+06 -2.86983640e+06
-3.87220630e+06 -3.85151844e+06 -3.99473464e+06 -2.92695324e+06
-2.91935516e+06 -3.65373592e+06 -2.96646320e+06 -3.90948116e+06]
[-3.58156570e+06 -6.10254977e+06 1.41574797e+06 -3.81889498e+06
-5.72955291e+06 -3.76587898e+06 -5.44706438e+06 -3.69347266e+06
-5.69106786e+06 -3.72374398e+06 -5.92256499e+06 -3.43664238e+06
-5.87615231e+06 -5.62329372e+06 -6.18449826e+06 -3.60161998e+06
-3.79808062e+06 -5.47322254e+06 -3.85076611e+06 -6.02192610e+06]
[-3.47246127e+06 -7.83486284e+06 3.40392225e+06 -3.99931668e+06
-7.04256859e+06 -3.86662912e+06 -6.49537994e+06 -3.75252154e+06
-7.02782091e+06 -3.81871865e+06 -7.48736548e+06 -3.18641653e+06
-7.40873400e+06 -6.81305928e+06 -7.96677497e+06 -3.50151194e+06
-4.01016133e+06 -6.81786079e+06 -4.05910942e+06 -7.71814961e+06]
[-4.82313376e+06 -1.09897162e+07 4.63504255e+06 -5.57955674e+06
-9.88019114e+06 -5.39161573e+06 -9.12631131e+06 -5.23585825e+06
-9.88564586e+06 -5.34129159e+06 -1.05201872e+07 -4.43681378e+06
-1.04145557e+07 -9.55266862e+06 -1.11507626e+07 -4.86463524e+06
-5.61578009e+06 -9.55882530e+06 -5.65943246e+06 -1.08518014e+07]
[-8.22053672e+06 -1.61973981e+07 5.07986774e+06 -9.15362528e+06
-1.48605734e+07 -8.93896316e+06 -1.39519403e+07 -8.73369269e+06
-1.48893840e+07 -8.88192575e+06 -1.56506932e+07 -7.78064268e+06
-1.55194212e+07 -1.44621768e+07 -1.63665142e+07 -8.28004515e+06
-9.21382460e+06 -1.43144685e+07 -9.25046102e+06 -1.60494009e+07]
[-1.26799576e+07 -2.19791438e+07 4.97907396e+06 -1.36683366e+07
-2.05826141e+07 -1.34678424e+07 -1.96140071e+07 -1.32192174e+07
-2.06343643e+07 -1.34037654e+07 -2.14296909e+07 -1.22478194e+07
-2.12801516e+07 -2.01639913e+07 -2.21258423e+07 -1.27547086e+07
-1.37434835e+07 -1.97212389e+07 -1.37702149e+07 -2.18363707e+07]
[-1.52876943e+07 -2.50886034e+07 4.34599742e+06 -1.62320415e+07
-2.37625670e+07 -1.60640225e+07 -2.28191559e+07 -1.57974453e+07
-2.38267148e+07 -1.59960274e+07 -2.45864224e+07 -1.48981282e+07
-2.44243622e+07 -2.33707216e+07 -2.51979689e+07 -1.53709840e+07
-1.63016454e+07 -2.26522063e+07 -1.63237807e+07 -2.49489901e+07]
[-1.58048317e+07 -2.56405892e+07 3.54715401e+06 -1.67051873e+07
-2.43703742e+07 -1.65588742e+07 -2.34622636e+07 -1.62846461e+07
-2.44451609e+07 -1.64921220e+07 -2.51759777e+07 -1.54413821e+07
-2.50067478e+07 -2.40171994e+07 -2.57148597e+07 -1.58866833e+07
-1.67645655e+07 -2.31709486e+07 -1.67886970e+07 -2.54934006e+07]
[-1.42288304e+07 -2.42452772e+07 3.25370491e+06 -1.51891200e+07
-2.28699448e+07 -1.50234776e+07 -2.19236733e+07 -1.47411655e+07
-2.29693971e+07 -1.49660907e+07 -2.37489795e+07 -1.38323605e+07
-2.35811899e+07 -2.25202841e+07 -2.43118436e+07 -1.43068696e+07
-1.52497378e+07 -2.17650359e+07 -1.52801396e+07 -2.40813655e+07]
[-1.18788097e+07 -2.11972438e+07 2.30318111e+06 -1.28059283e+07
-1.98611946e+07 -1.26312295e+07 -1.89717797e+07 -1.23797686e+07
-1.99625432e+07 -1.25868535e+07 -2.07097618e+07 -1.14899396e+07
-2.05725260e+07 -1.95434171e+07 -2.12632527e+07 -1.19538805e+07
-1.28570841e+07 -1.89223021e+07 -1.28880869e+07 -2.10296309e+07]
[-7.67738130e+06 -1.55356534e+07 2.05105629e+06 -8.53811233e+06
-1.42907051e+07 -8.34157916e+06 -1.34948210e+07 -8.15565947e+06
-1.43791798e+07 -8.31355445e+06 -1.50615742e+07 -7.30062621e+06
-1.49732442e+07 -1.39998335e+07 -1.56274804e+07 -7.74498198e+06
-8.58235860e+06 -1.36800023e+07 -8.60334510e+06 -1.53751371e+07]
[-3.92055379e+06 -9.83368632e+06 1.69460914e+06 -4.64515235e+06
-8.78604219e+06 -4.44276326e+06 -8.14010838e+06 -4.33278516e+06
-8.84530933e+06 -4.43097331e+06 -9.40926758e+06 -3.58136213e+06
-9.37478341e+06 -8.53657058e+06 -9.95017595e+06 -3.97376429e+06
-4.68005349e+06 -8.49709854e+06 -4.68712969e+06 -9.69625626e+06]
[-1.84651491e+06 -6.12155219e+06 1.15048850e+06 -2.42698671e+06
-5.29389009e+06 -2.23071964e+06 -4.80638745e+06 -2.18165650e+06
-5.32878136e+06 -2.23378837e+06 -5.76458563e+06 -1.56357947e+06
-5.78049109e+06 -5.09317676e+06 -6.25427215e+06 -1.89103224e+06
-2.44973925e+06 -5.20566223e+06 -2.44799613e+06 -6.01422416e+06]
[-4.71285367e+05 -3.10873865e+06 9.04347986e+05 -8.66641429e+05
-2.54971624e+06 -7.08741844e+05 -2.23780617e+06 -7.03209773e+05
-2.56510601e+06 -7.20737183e+05 -2.84948644e+06 -2.68911895e+05
-2.89949925e+06 -2.41213209e+06 -3.23085944e+06 -5.05323926e+05
-8.80038289e+05 -2.58127716e+06 -8.73200998e+05 -3.03911430e+06]
[-1.64893818e+05 -1.38101495e+06 3.74992587e+05 -3.63491577e+05
-1.10377619e+06 -2.61251475e+05 -9.64127531e+05 -2.85080536e+05
-1.10019893e+06 -2.74485099e+05 -1.23121506e+06 -5.56694099e+04
-1.29922675e+06 -1.03697906e+06 -1.47663887e+06 -1.90173332e+05
-3.65742735e+05 -1.16367186e+06 -3.55417001e+05 -1.34285498e+06]
[-3.30598204e+05 -7.75727510e+05 -3.19977142e+04 -4.01910120e+05
-6.79332237e+05 -3.49550285e+05 -6.38964963e+05 -3.74901105e+05
-6.69337924e+05 -3.58097811e+05 -7.08404276e+05 -2.86492728e+05
-7.62982831e+05 -6.57269518e+05 -8.34803339e+05 -3.47301170e+05
-3.98864719e+05 -7.06245721e+05 -3.89302202e+05 -7.58302354e+05]
[-5.69228626e+04 -1.82086625e+05 6.65901605e+04 -7.83732572e+04
-1.52726586e+05 -5.95832543e+04 -1.42123159e+05 -7.04693069e+04
-1.48099122e+05 -6.27535524e+04 -1.58325962e+05 -4.22192215e+04
-1.81701493e+05 -1.46134765e+05 -2.05816093e+05 -6.36953099e+04
-7.76747564e+04 -1.66483343e+05 -7.27949296e+04 -1.76150740e+05]
[-3.88356716e+04 -8.60301008e+04 2.91711048e+04 -4.50602288e+04
-7.76350756e+04 -4.12676430e+04 -7.33829710e+04 -4.23719002e+04
-7.68173831e+04 -4.19120917e+04 -8.06328334e+04 -3.50018398e+04
-8.44426391e+04 -7.52497937e+04 -9.05724753e+04 -4.02700471e+04
-4.49384530e+04 -7.73040821e+04 -4.43830033e+04 -8.49517712e+04]
[ 1.47850746e+04 -1.67233266e+04 3.86644230e+04 9.24668974e+03
-8.77278300e+03 1.09870841e+04 -4.43448846e+03 1.15575373e+04
-9.35159006e+03 1.09104205e+04 -1.34086647e+04 1.72486680e+04
-1.35061915e+04 -6.72223762e+03 -1.81014429e+04 1.44423732e+04
8.65609321e+03 -1.06302546e+04 8.66466156e+03 -1.61451193e+04]
[ 1.86217002e+03 3.23799780e+03 4.21284055e+02 2.05116892e+03
2.98435493e+03 1.99132545e+03 2.85705961e+03 1.96773344e+03
3.01574197e+03 1.98593268e+03 3.14335299e+03 1.80159138e+03
3.12933720e+03 2.93211295e+03 3.28692580e+03 1.87792146e+03
2.05384347e+03 2.91918841e+03 2.06955975e+03 3.21475678e+03]
[ 1.42760785e+04 2.56028194e+04 2.62862135e+03 1.58895299e+04
2.35110299e+04 1.53848420e+04 2.24447788e+04 1.51783059e+04
2.37432074e+04 1.53559078e+04 2.48197179e+04 1.37664142e+04
2.47403606e+04 2.30450791e+04 2.59835378e+04 1.44178153e+04
1.59409597e+04 2.30757594e+04 1.60334754e+04 2.54271758e+04]
[ 2.44036670e+04 4.49223836e+04 -8.23215561e+03 2.75774772e+04
4.06221825e+04 2.65699956e+04 3.86088323e+04 2.61837565e+04
4.11588464e+04 2.65654526e+04 4.32383924e+04 2.33361269e+04
4.32118662e+04 3.97224546e+04 4.57952951e+04 2.46596540e+04
2.76656589e+04 4.04169125e+04 2.79658996e+04 4.46557014e+04]
[-4.96983251e+04 6.79817445e+04 2.86065638e+04 -3.02835950e+04
4.32384906e+04 -3.65970950e+04 3.06172544e+04 -3.82051391e+04
4.67845985e+04 -3.67866306e+04 5.95910520e+04 -5.59352527e+04
5.78565170e+04 3.72416371e+04 7.11556882e+04 -4.85054585e+04
-2.86097501e+04 4.34958700e+04 -2.90025068e+04 6.63176886e+04]
[-1.73418114e+05 1.00013709e+05 -1.16150917e+04 -1.23805048e+05
3.45716537e+04 -1.39496443e+05 2.17346693e+03 -1.43246202e+05
4.51160676e+04 -1.39644060e+05 7.79193761e+04 -1.89354137e+05
7.37717841e+04 1.92892777e+04 1.07650271e+05 -1.70633081e+05
-1.18166048e+05 4.57606286e+04 -1.20199469e+05 9.60162703e+04]
[-1.48419017e+05 2.70815967e+05 -5.37217629e+04 -6.92981038e+04
1.69014175e+05 -9.45768209e+04 1.22382304e+05 -9.88125374e+04
1.87473791e+05 -9.42987769e+04 2.36707970e+05 -1.71244308e+05
2.32452453e+05 1.45737224e+05 2.82658879e+05 -1.42917071e+05
-5.86802593e+04 1.88229090e+05 -6.42364723e+04 2.65965852e+05]
[ 2.04789319e+05 8.87274751e+05 6.43993915e+04 3.21030359e+05
7.44375729e+05 2.83994398e+05 6.83018707e+05 2.78722160e+05
7.73626691e+05 2.85431872e+05 8.40745148e+05 1.76594636e+05
8.37203085e+05 7.13459581e+05 9.02848863e+05 2.15956199e+05
3.34728698e+05 7.44538662e+05 3.26255878e+05 8.81266793e+05]
[ 6.91080683e+05 1.45177674e+06 3.19233404e+05 8.12800692e+05
1.31367559e+06 7.73436733e+05 1.26537078e+06 7.69268680e+05
1.35182529e+06 7.78057032e+05 1.41190080e+06 6.71350517e+05
1.41211353e+06 1.28706528e+06 1.46455013e+06 7.05636707e+05
8.27276964e+05 1.28586361e+06 8.16667331e+05 1.45184081e+06]
[ 1.68114730e+06 2.07206622e+06 1.31091764e+06 1.71248547e+06
2.07704481e+06 1.70518499e+06 2.12262988e+06 1.70797517e+06
2.11742054e+06 1.71072072e+06 2.09854805e+06 1.72073427e+06
2.10116170e+06 2.09201648e+06 2.05782349e+06 1.69908384e+06
1.71620898e+06 1.95680548e+06 1.70873352e+06 2.09229564e+06]
[ 2.87273810e+06 2.66675483e+06 2.34877071e+06 2.77957031e+06
2.85754327e+06 2.81627977e+06 3.02943043e+06 2.82289353e+06
2.90065313e+06 2.82185435e+06 2.78002439e+06 2.98631355e+06
2.78309737e+06 2.93333031e+06 2.61884972e+06 2.89208857e+06
2.76607871e+06 2.64610522e+06 2.77096699e+06 2.71171897e+06]
[ 4.13726659e+06 2.85942709e+06 3.81699154e+06 3.84482674e+06
3.33486009e+06 3.95132162e+06 3.70021289e+06 3.97073604e+06
3.37537677e+06 3.95285621e+06 3.09910195e+06 4.36594323e+06
3.10639975e+06 3.50622490e+06 2.76505905e+06 4.16125139e+06
3.80044773e+06 3.03088355e+06 3.82867943e+06 2.93337696e+06]
[ 5.60168292e+06 3.24890281e+06 5.65463376e+06 5.10163438e+06
4.01662661e+06 5.28205262e+06 4.58665499e+06 5.31701138e+06
4.05053194e+06 5.27217733e+06 3.61350843e+06 5.95554883e+06
3.62774195e+06 4.29481840e+06 3.11037044e+06 5.63668031e+06
5.01796996e+06 3.60744760e+06 5.07772718e+06 3.34057310e+06]
[ 5.16423446e+06 2.86189805e+06 6.16910542e+06 4.68817818e+06
3.58081692e+06 4.86419911e+06 4.15772904e+06 4.89493670e+06
3.63124309e+06 4.84352044e+06 3.21554355e+06 5.52424898e+06
3.21632593e+06 3.87452217e+06 2.72795022e+06 5.21466720e+06
4.58373680e+06 3.20903349e+06 4.67914286e+06 2.94009787e+06]
[ 7.20561639e+05 -1.29551330e+06 4.82865242e+06 4.08886807e+05
-8.41529338e+05 5.20846703e+05 -3.88064260e+05 5.50536359e+05
-7.75932457e+05 4.99672927e+05 -1.05342808e+06 9.85182301e+05
-1.06638132e+06 -5.98174943e+05 -1.38669003e+06 7.70194954e+05
3.04677597e+05 -9.36849603e+05 4.23696011e+05 -1.25323127e+06]
[-5.10482402e+06 -6.57096278e+06 2.53351451e+06 -5.10968013e+06
-6.56879385e+06 -5.12571982e+06 -6.35810959e+06 -5.08835996e+06
-6.49111160e+06 -5.13839621e+06 -6.52984038e+06 -5.01892860e+06
-6.55053101e+06 -6.45395130e+06 -6.56823245e+06 -5.06418922e+06
-5.18853834e+06 -6.18828939e+06 -5.06382747e+06 -6.56978102e+06]
[-8.34861463e+06 -9.15814122e+06 8.73040589e+05 -8.07871162e+06
-9.53664024e+06 -8.20562033e+06 -9.53608447e+06 -8.16103685e+06
-9.44987694e+06 -8.21346038e+06 -9.28851029e+06 -8.40529823e+06
-9.31006979e+06 -9.54758636e+06 -9.06563822e+06 -8.30653001e+06
-8.12770005e+06 -8.80656953e+06 -8.00798046e+06 -9.18001208e+06]
[-8.20926321e+06 -9.02071868e+06 1.09973016e+06 -7.88853112e+06
-9.43461627e+06 -8.04678604e+06 -9.45973231e+06 -7.97967067e+06
-9.36292861e+06 -8.05731725e+06 -9.18163374e+06 -8.28335387e+06
-9.19483036e+06 -9.49395055e+06 -8.88786994e+06 -8.16079809e+06
-7.92450883e+06 -8.64299243e+06 -7.81997327e+06 -9.02965977e+06]
[-5.84701882e+06 -7.29270932e+06 1.42516915e+06 -5.66593857e+06
-7.47328795e+06 -5.78702044e+06 -7.38433669e+06 -5.69881444e+06
-7.42901044e+06 -5.79688141e+06 -7.36795266e+06 -5.84976456e+06
-7.36706228e+06 -7.50830265e+06 -7.17080878e+06 -5.80018338e+06
-5.70164275e+06 -6.81379554e+06 -5.61740716e+06 -7.26171967e+06]
[-2.62101937e+06 -5.42721894e+06 2.45562890e+06 -2.75788933e+06
-5.13848846e+06 -2.77212336e+06 -4.80620042e+06 -2.66666990e+06
-5.12823159e+06 -2.78361504e+06 -5.31257928e+06 -2.46973163e+06
-5.29679535e+06 -5.06740758e+06 -5.36712745e+06 -2.58675605e+06
-2.80754007e+06 -4.73163050e+06 -2.74378191e+06 -5.34615146e+06]
[ 2.83274523e+05 -3.22601601e+06 3.26715474e+06 -1.15595905e+05
-2.56862448e+06 -2.01494263e+04 -2.05980028e+06 6.84648935e+04
-2.57796394e+06 -3.26797927e+04 -2.94975108e+06 5.60215066e+05
-2.93562839e+06 -2.39994082e+06 -3.24796337e+06 3.00528625e+05
-1.75352421e+05 -2.47772257e+06 -1.20541815e+05 -3.11023860e+06]
[ 2.85293655e+06 -7.42216346e+05 3.63015050e+06 2.31031013e+06
1.02044298e+05 2.48487159e+06 6.67305439e+05 2.53867523e+06
9.04662810e+04 2.46799781e+06 -3.65931673e+05 3.19361386e+06
-3.80615760e+05 3.24044345e+05 -8.41329508e+05 2.85434854e+06
2.24752028e+06 -5.08274708e+04 2.29743293e+06 -6.16198887e+05]
[ 2.50818388e+06 -1.11883921e+06 2.98684344e+06 1.91509919e+06
-2.35834092e+05 2.12742515e+06 3.01379334e+05 2.15679388e+06
-2.57861958e+05 2.11073605e+06 -7.21276921e+05 2.84365896e+06
-7.56106279e+05 -7.55647473e+03 -1.26027679e+06 2.48746709e+06
1.86462890e+06 -4.36426219e+05 1.89999782e+06 -1.00024273e+06]
[ 1.97877885e+06 -7.63896430e+05 2.35219024e+06 1.50291160e+06
-6.66969381e+04 1.69323236e+06 3.27798079e+05 1.69211772e+06
-8.36629678e+04 1.67468678e+06 -4.37017079e+05 2.24169823e+06
-4.98202757e+05 1.11187376e+05 -9.08710679e+05 1.95001238e+06
1.46938776e+06 -2.69809550e+05 1.49502676e+06 -6.76697944e+05]
[ 1.24906435e+06 -3.53542931e+05 1.64897795e+06 9.52921596e+05
8.00375767e+04 1.09412159e+06 3.06441657e+05 1.06859160e+06
7.97369765e+04 1.07539117e+06 -1.27606353e+05 1.41944644e+06
-2.13919079e+05 1.89131997e+05 -4.83512496e+05 1.22062897e+06
9.34185836e+05 -9.24965432e+04 9.56494663e+05 -2.99738373e+05]
[ 3.35976306e+04 -6.01485555e+05 5.60492216e+05 -7.94817454e+04
-4.38255551e+05 -4.68495242e+03 -3.64474144e+05 -3.60745903e+04
-4.25590455e+05 -1.69475239e+04 -4.95013875e+05 1.05800776e+05
-5.71142285e+05 -3.98801518e+05 -6.86669323e+05 1.10996267e+04
-8.16856438e+04 -5.10618799e+05 -6.61256640e+04 -5.76484347e+05]
[-2.05631534e+05 -3.78561126e+05 1.17930442e+05 -2.35663649e+05
-3.36492609e+05 -2.07249575e+05 -3.21421224e+05 -2.24505607e+05
-3.27478429e+05 -2.12069459e+05 -3.41999299e+05 -1.83535023e+05
-3.80005563e+05 -3.26683897e+05 -4.15996377e+05 -2.16361556e+05
-2.35102554e+05 -3.59745532e+05 -2.26600339e+05 -3.69716189e+05]
[ 1.81075810e+04 -3.80120149e+04 4.12925469e+04 7.64070812e+03
-2.33988598e+04 1.46597899e+04 -1.70740497e+04 1.16759761e+04
-2.22517900e+04 1.37459570e+04 -2.82557604e+04 2.43446646e+04
-3.56190161e+04 -1.98084634e+04 -4.64295021e+04 1.57658298e+04
7.07321681e+03 -3.01996552e+04 9.00948660e+03 -3.58746660e+04]
[ 1.63605103e+04 -7.85665603e+03 2.98770106e+04 1.19621453e+04
-1.57981034e+03 1.33599859e+04 1.77817798e+03 1.38016848e+04
-1.97072255e+03 1.32818654e+04 -5.17350883e+03 1.83301369e+04
-5.36756761e+03 1.36610495e+01 -9.02789316e+03 1.60658077e+04
1.14619641e+04 -3.27683019e+03 1.14935279e+04 -7.39626120e+03]
[ 7.56618387e+03 1.31611761e+04 1.71022236e+03 8.33477534e+03
1.21311494e+04 8.09582680e+03 1.16123845e+04 7.99467397e+03
1.22526228e+04 8.06707269e+03 1.27725336e+04 7.32234962e+03
1.27154720e+04 1.19178787e+04 1.33545923e+04 7.63434499e+03
8.34405777e+03 1.18597380e+04 8.40963972e+03 1.30667641e+04]
[ 6.26994136e+04 9.21794814e+04 -9.48768176e+01 6.54645382e+04
8.86989726e+04 6.46227678e+04 8.68274506e+04 6.40128790e+04
8.89434087e+04 6.44563011e+04 9.07730616e+04 6.16504444e+04
9.06107337e+04 8.80497280e+04 9.29057945e+04 6.30197283e+04
6.52288536e+04 8.45354884e+04 6.56974811e+04 9.17344077e+04]
[ 1.67240488e+05 2.50301380e+05 -7.10444126e+03 1.75640304e+05
2.39463655e+05 1.73099627e+05 2.33901067e+05 1.71387884e+05
2.40342886e+05 1.72721973e+05 2.45914442e+05 1.64192452e+05
2.45570428e+05 2.37417183e+05 2.52618558e+05 1.68234017e+05
1.75034662e+05 2.29213649e+05 1.76462412e+05 2.49105443e+05]
[ 2.17283376e+05 4.90391078e+05 7.94677945e+03 2.54622214e+05
4.41986481e+05 2.43048508e+05 4.17096607e+05 2.38138545e+05
4.47821051e+05 2.42167147e+05 4.72799463e+05 2.04615630e+05
4.69845020e+05 4.31166264e+05 4.97815190e+05 2.20263245e+05
2.55852636e+05 4.27818919e+05 2.57713597e+05 4.86375116e+05]
[ 4.43594318e+05 1.03692424e+06 3.83378118e+03 5.26292661e+05
9.29696358e+05 5.01009825e+05 8.77908696e+05 4.91254628e+05
9.44507594e+05 4.98884766e+05 9.98339429e+05 4.17792843e+05
9.92257923e+05 9.06900845e+05 1.05318597e+06 4.51042863e+05
5.30028514e+05 9.00896710e+05 5.32970231e+05 1.02852315e+06]
[ 1.00308476e+06 1.91428341e+06 2.26753035e+04 1.12451401e+06
1.75884626e+06 1.08840325e+06 1.68836092e+06 1.07376760e+06
1.78267814e+06 1.08498485e+06 1.85856765e+06 9.69490501e+05
1.85154556e+06 1.72778003e+06 1.93867760e+06 1.01651582e+06
1.12916617e+06 1.69983012e+06 1.13504160e+06 1.90339340e+06]
[ 2.82365522e+06 4.26824777e+06 3.92329287e+05 2.97407156e+06
4.08907672e+06 2.93164564e+06 4.01066656e+06 2.90864676e+06
4.12021266e+06 2.92475691e+06 4.20672421e+06 2.79286583e+06
4.19808936e+06 4.05824618e+06 4.29721934e+06 2.84905590e+06
2.97048952e+06 3.90129991e+06 2.98428314e+06 4.25467834e+06]
[ 4.92629464e+06 6.74510864e+06 1.03668869e+06 5.07230700e+06
6.58941322e+06 5.03848755e+06 6.53872730e+06 5.00434728e+06
6.62872386e+06 5.02586655e+06 6.70094046e+06 4.91908391e+06
6.68633880e+06 6.57433957e+06 6.76961792e+06 4.96421421e+06
5.05557067e+06 6.24749276e+06 5.08452952e+06 6.73618017e+06]
[ 7.71937781e+06 9.70565707e+06 2.06710125e+06 7.81330006e+06
9.63750361e+06 7.80851697e+06 9.65352967e+06 7.75869688e+06
9.68410919e+06 7.78728470e+06 9.71003509e+06 7.76092886e+06
9.68244987e+06 9.65867380e+06 9.71107426e+06 7.77021386e+06
7.77438559e+06 9.10465029e+06 7.83084403e+06 9.71000938e+06]
[ 1.05621554e+07 1.22761822e+07 3.55968160e+06 1.05185904e+07
1.24094814e+07 1.05767847e+07 1.25664980e+07 1.05144104e+07
1.24607325e+07 1.05413814e+07 1.23795791e+07 1.07008877e+07
1.23386806e+07 1.25083151e+07 1.22417188e+07 1.06284350e+07
1.04474636e+07 1.16525478e+07 1.05376747e+07 1.22995739e+07]
[ 1.33273190e+07 1.46076833e+07 5.15959771e+06 1.31387082e+07
1.49430534e+07 1.32632460e+07 1.52574193e+07 1.31931168e+07
1.50017858e+07 1.32091609e+07 1.48079586e+07 1.35716851e+07
1.47562690e+07 1.51302209e+07 1.45344602e+07 1.34141973e+07
1.30274176e+07 1.40007423e+07 1.31646669e+07 1.46450251e+07]
[ 1.51097168e+07 1.70848479e+07 5.98361879e+06 1.49594354e+07
1.73536956e+07 1.51005575e+07 1.76659644e+07 1.49946592e+07
1.74422564e+07 1.50247295e+07 1.72824821e+07 1.53781499e+07
1.71955059e+07 1.75642348e+07 1.69952088e+07 1.52229880e+07
1.48229283e+07 1.62625573e+07 1.50122208e+07 1.71069734e+07]
[ 1.27664248e+07 1.56986272e+07 4.48430510e+06 1.28106297e+07
1.56600002e+07 1.28990220e+07 1.58194384e+07 1.27593770e+07
1.57848562e+07 1.28197995e+07 1.57856693e+07 1.29452774e+07
1.56691875e+07 1.58195734e+07 1.56348822e+07 1.28849669e+07
1.26790427e+07 1.46958455e+07 1.28970021e+07 1.56854072e+07]
[ 4.99321500e+06 8.57894968e+06 6.80915942e+05 5.36394771e+06
8.03765638e+06 5.31928463e+06 7.91424571e+06 5.17405578e+06
8.18427530e+06 5.25892083e+06 8.44829068e+06 4.96388844e+06
8.32394751e+06 8.06378732e+06 8.60369539e+06 5.08614441e+06
5.26986260e+06 7.59131549e+06 5.48282210e+06 8.51772632e+06]
[-3.59752032e+06 4.00859592e+05 -3.50297679e+06 -2.84512860e+06
-6.96774616e+05 -3.06744136e+06 -1.15467815e+06 -3.18837728e+06
-5.49525582e+05 -3.10181277e+06 8.92317291e+03 -3.88089180e+06
-1.04761195e+05 -8.60307449e+05 5.58159016e+05 -3.54032281e+06
-2.88329502e+06 -4.54021846e+05 -2.70123007e+06 2.97602929e+05]
[-8.32447419e+06 -4.22235140e+06 -5.13072770e+06 -7.29809802e+06
-5.68147918e+06 -7.65488347e+06 -6.34742370e+06 -7.73097431e+06
-5.54235793e+06 -7.67660101e+06 -4.79534184e+06 -8.76411950e+06
-4.89040636e+06 -5.99535062e+06 -3.95290755e+06 -8.27689327e+06
-7.29135715e+06 -4.93049760e+06 -7.14444638e+06 -4.34066662e+06]
[-6.42760815e+06 -2.07075217e+06 -3.77567924e+06 -5.34800869e+06
-3.54571478e+06 -5.73178362e+06 -4.22025724e+06 -5.77792428e+06
-3.41161932e+06 -5.76066503e+06 -2.65631830e+06 -6.85591103e+06
-2.74743334e+06 -3.90336148e+06 -1.77627175e+06 -6.35708650e+06
-5.32920222e+06 -2.83354338e+06 -5.20604775e+06 -2.17318284e+06]
[-2.40982810e+06 1.18141794e+06 -1.58082731e+06 -1.54282729e+06
4.97092441e+04 -1.84791060e+06 -4.21260319e+05 -1.86850648e+06
1.73263003e+05 -1.88544394e+06 7.44710383e+05 -2.69333327e+06
6.56065479e+05 -2.37037265e+05 1.42162572e+06 -2.31974943e+06
-1.53703010e+06 5.02569121e+05 -1.42550910e+06 1.13016240e+06]
[ 2.90418695e+06 4.83973703e+06 1.25850310e+06 3.35547939e+06
4.32439263e+06 3.20233118e+06 4.21102392e+06 3.20059682e+06
4.42526801e+06 3.15757552e+06 4.66672461e+06 2.85762762e+06
4.59785307e+06 4.20636873e+06 4.98176998e+06 3.00311996e+06
3.32765819e+06 4.40069846e+06 3.43535209e+06 4.85229075e+06]
[ 7.65569469e+06 7.67778409e+06 4.11057010e+06 7.59774450e+06
7.89586052e+06 7.62415541e+06 8.18856075e+06 7.63546844e+06
7.94955539e+06 7.57870636e+06 7.80489532e+06 7.86337238e+06
7.77326037e+06 7.98514645e+06 7.70582792e+06 7.74393902e+06
7.52533678e+06 7.51230600e+06 7.63282250e+06 7.75202305e+06]
[ 7.97133915e+06 6.18570045e+06 4.94372768e+06 7.55986178e+06
6.87424188e+06 7.70881090e+06 7.38708518e+06 7.72827461e+06
6.89031211e+06 7.67116364e+06 6.50748094e+06 8.31114222e+06
6.48663688e+06 7.08363227e+06 6.12103262e+06 8.02146417e+06
7.47470827e+06 6.37479603e+06 7.56631766e+06 6.29722297e+06]
[ 6.72957356e+06 4.04255990e+06 4.84530296e+06 6.16399156e+06
4.91563979e+06 6.36695255e+06 5.47051147e+06 6.38471084e+06
4.90003233e+06 6.33847120e+06 4.43788504e+06 7.08886605e+06
4.40987243e+06 5.15927954e+06 3.92506521e+06 6.74114347e+06
6.08217355e+06 4.43847063e+06 6.15218560e+06 4.15836663e+06]
[ 4.99272125e+06 2.36593345e+06 4.01430275e+06 4.46204018e+06
3.16458342e+06 4.65913297e+06 3.63271436e+06 4.66624309e+06
3.13948989e+06 4.63721668e+06 2.72897016e+06 5.29716305e+06
2.68702997e+06 3.37996511e+06 2.23253339e+06 4.98119596e+06
4.39822586e+06 2.78576353e+06 4.44436695e+06 2.45888057e+06]
[ 2.81947468e+06 9.93074587e+05 2.88839169e+06 2.45440650e+06
1.54197894e+06 2.60488447e+06 1.84694471e+06 2.59633559e+06
1.52907687e+06 2.58588442e+06 1.25742283e+06 3.02986938e+06
1.19349906e+06 1.68843391e+06 8.69411929e+05 2.80017224e+06
2.41457081e+06 1.28085197e+06 2.44407588e+06 1.05169571e+06]
[ 8.78754551e+05 -1.00944147e+04 1.39330981e+06 7.06301285e+05
2.49617835e+05 7.92966610e+05 3.84462190e+05 7.74427668e+05
2.53634318e+05 7.80872359e+05 1.32065010e+05 9.84306716e+05
6.70729543e+04 3.17716766e+05 -9.86805473e+04 8.60590544e+05
6.89924272e+05 1.22818820e+05 7.07834061e+05 1.91864894e+04]
[-2.86015734e+05 -5.36931918e+05 2.17953553e+05 -3.24775988e+05
-4.81139483e+05 -2.94259247e+05 -4.56458257e+05 -3.08849185e+05
-4.71893676e+05 -2.99849939e+05 -4.94327784e+05 -2.58341983e+05
-5.32609104e+05 -4.66861022e+05 -5.76219684e+05 -2.97020841e+05
-3.24935907e+05 -5.01181443e+05 -3.17093202e+05 -5.27571973e+05]
[ 6.10367881e+04 3.67910203e+04 6.08423615e+04 5.43487668e+04
4.67742527e+04 5.93212793e+04 5.08142689e+04 5.69194044e+04
4.76949330e+04 5.85934608e+04 4.38348059e+04 6.57021999e+04
3.81302632e+04 4.91674447e+04 3.05913013e+04 5.96798594e+04
5.36756212e+04 3.79175705e+04 5.52527314e+04 3.82271091e+04]
[ 1.38976020e+04 3.24770016e+02 1.83988384e+04 1.12854775e+04
4.12814740e+03 1.21987296e+04 6.27216793e+03 1.23717011e+04
3.85610313e+03 1.21739283e+04 1.93774810e+03 1.51667080e+04
1.83417716e+03 5.11762830e+03 -3.44681273e+02 1.38235766e+04
1.08995818e+04 2.79455871e+03 1.10925798e+04 6.41180399e+02]
[ 1.22756973e+03 2.13681420e+03 2.76570546e+02 1.35214670e+03
1.96957588e+03 1.31351292e+03 1.88422745e+03 1.29801766e+03
1.98946854e+03 1.30865167e+03 2.07342139e+03 1.18783743e+03
2.06363489e+03 1.93394814e+03 2.16840921e+03 1.23938058e+03
1.35399154e+03 1.92397914e+03 1.36474106e+03 2.12188885e+03]
[ 7.34948068e+04 1.18534587e+05 -7.14319979e+03 7.68094757e+04
1.14639177e+05 7.57821147e+04 1.12309490e+05 7.49496367e+04
1.14730494e+05 7.55403679e+04 1.16897453e+05 7.21973278e+04
1.16707554e+05 1.13893472e+05 1.19433931e+05 7.39950230e+04
7.62817682e+04 1.06458396e+05 7.69430508e+04 1.17888878e+05]
[ 2.65802087e+05 4.06597658e+05 -1.93446107e+04 2.80379217e+05
3.87772568e+05 2.75957940e+05 3.77737306e+05 2.72971081e+05
3.89200200e+05 2.75358967e+05 3.99039765e+05 2.60182966e+05
3.98326337e+05 3.83975328e+05 4.10308238e+05 2.67313435e+05
2.79607401e+05 3.71196390e+05 2.81755508e+05 4.04544559e+05]
[ 6.20461868e+05 1.04434103e+06 2.30516339e+04 6.67374503e+05
9.84332113e+05 6.53540011e+05 9.52419564e+05 6.45088202e+05
9.90409957e+05 6.51767245e+05 1.02186277e+06 6.04671714e+05
1.01825467e+06 9.71507355e+05 1.05448677e+06 6.25410001e+05
6.66499727e+05 9.40350497e+05 6.71372655e+05 1.03853328e+06]
[ 1.36520277e+06 2.15170869e+06 6.99521760e+04 1.44763522e+06
2.04788242e+06 1.42379483e+06 1.99871426e+06 1.40923215e+06
2.06060031e+06 1.41945276e+06 2.11273909e+06 1.34198824e+06
2.10731531e+06 2.02884429e+06 2.17145961e+06 1.37649602e+06
1.44416418e+06 1.95327550e+06 1.45469295e+06 2.14135484e+06]
[ 2.74779198e+06 4.13603390e+06 2.01618638e+05 2.88487169e+06
3.96523309e+06 2.84815451e+06 3.88605663e+06 2.82217117e+06
3.98809029e+06 2.83896909e+06 4.07287070e+06 2.71551993e+06
4.06349945e+06 3.93590638e+06 4.16850797e+06 2.77129012e+06
2.87717383e+06 3.77890542e+06 2.89798855e+06 4.11992872e+06]
[ 5.17817089e+06 7.34319965e+06 5.80750170e+05 5.36305572e+06
7.11967091e+06 5.31808840e+06 7.02133140e+06 5.27387125e+06
7.15285595e+06 5.30221443e+06 7.26408504e+06 5.14407660e+06
7.24889603e+06 7.08810123e+06 7.38592061e+06 5.21898610e+06
5.34220478e+06 6.76645661e+06 5.38249036e+06 7.32175121e+06]
[ 8.41212020e+06 1.13514308e+07 1.15177741e+06 8.62902411e+06
1.10952791e+07 8.58848132e+06 1.09940332e+07 8.51543494e+06
1.11433779e+07 8.56057686e+06 1.12719569e+07 8.38919117e+06
1.12388032e+07 1.10710026e+07 1.13955669e+07 8.47202085e+06
8.59021392e+06 1.05364354e+07 8.66112331e+06 1.13293890e+07]
[ 1.24943345e+07 1.59574130e+07 2.28906029e+06 1.26787042e+07
1.57577087e+07 1.26758144e+07 1.57134111e+07 1.25682351e+07
1.58202761e+07 1.26262904e+07 1.59207033e+07 1.25290735e+07
1.58608799e+07 1.57742985e+07 1.59825178e+07 1.25797183e+07
1.26112798e+07 1.49323402e+07 1.27265025e+07 1.59401030e+07]
[ 1.56002545e+07 1.91454999e+07 3.42668184e+06 1.56969958e+07
1.90625181e+07 1.57558742e+07 1.91189723e+07 1.56164303e+07
1.91448587e+07 1.56810663e+07 1.91822887e+07 1.57192249e+07
1.90900958e+07 1.91456571e+07 1.91313752e+07 1.57094346e+07
1.55991165e+07 1.80089020e+07 1.57624036e+07 1.91378914e+07]
[ 1.82098559e+07 2.18049320e+07 4.91270709e+06 1.82161022e+07
2.18387120e+07 1.83354440e+07 2.19899671e+07 1.81671778e+07
2.19398473e+07 1.82369246e+07 2.19165188e+07 1.84097378e+07
2.17884160e+07 2.19898909e+07 2.17440583e+07 1.83402260e+07
1.80839218e+07 2.05682706e+07 1.82968795e+07 2.18008834e+07]
[ 1.77679335e+07 2.18050832e+07 4.64651713e+06 1.78043055e+07
2.17729550e+07 1.79378249e+07 2.19003982e+07 1.77318022e+07
2.19009907e+07 1.78319281e+07 2.19145522e+07 1.79689344e+07
2.17532049e+07 2.19409480e+07 2.17181662e+07 1.79000205e+07
1.76635480e+07 2.04385957e+07 1.79070970e+07 2.17873121e+07]
[ 1.20124789e+07 1.59569144e+07 2.08731269e+06 1.21558225e+07
1.57342069e+07 1.22366187e+07 1.57437083e+07 1.20262005e+07
1.58716803e+07 1.21534548e+07 1.59844148e+07 1.21104298e+07
1.58263860e+07 1.58594549e+07 1.58929093e+07 1.21064635e+07
1.20404946e+07 1.47039595e+07 1.22682930e+07 1.59169297e+07]
[ 7.18738296e+05 4.17008456e+06 -3.02665629e+06 1.15220302e+06
3.50392991e+06 1.07163544e+06 3.23921601e+06 8.99818737e+05
3.63296465e+06 1.03242847e+06 3.97547002e+06 5.73733459e+05
3.85168355e+06 3.47380764e+06 4.22254670e+06 7.47549747e+05
1.10220397e+06 3.28546555e+06 1.27655657e+06 4.09704214e+06]
[-1.02626224e+07 -7.04865055e+06 -7.60705860e+06 -9.41825692e+06
-8.29867605e+06 -9.71788594e+06 -8.91708018e+06 -9.81702046e+06
-8.18877113e+06 -9.72410304e+06 -7.54115599e+06 -1.06950975e+07
-7.62825091e+06 -8.55759895e+06 -6.82305451e+06 -1.02809968e+07
-9.39255670e+06 -7.57123787e+06 -9.28330956e+06 -7.16452549e+06]
[-1.55894422e+07 -1.23144215e+07 -9.26929617e+06 -1.44347671e+07
-1.39654611e+07 -1.48897809e+07 -1.48187461e+07 -1.49256206e+07
-1.38670290e+07 -1.48824718e+07 -1.30117045e+07 -1.61976302e+07
-1.30742841e+07 -1.44018206e+07 -1.19635825e+07 -1.56145756e+07
-1.43512310e+07 -1.26519306e+07 -1.42987521e+07 -1.24466790e+07]
[-1.12911093e+07 -7.61339446e+06 -6.46460344e+06 -1.01625620e+07
-9.16142754e+06 -1.05987696e+07 -9.93691242e+06 -1.06067807e+07
-9.05537831e+06 -1.06093947e+07 -8.25906150e+06 -1.18125669e+07
-8.32799161e+06 -9.59255370e+06 -7.27895760e+06 -1.12693863e+07
-1.00870574e+07 -8.10987428e+06 -1.00458051e+07 -7.72233555e+06]
[-2.68790675e+06 9.40642108e+05 -2.31009124e+06 -1.81900316e+06
-1.91038302e+05 -2.12861812e+06 -6.90806141e+05 -2.13518272e+06
-7.55602945e+04 -2.16626503e+06 4.93490478e+05 -2.98624305e+06
4.15924966e+05 -4.96597777e+05 1.18383078e+06 -2.60650503e+06
-1.78697364e+06 2.64170052e+05 -1.72405974e+06 8.81790668e+05]
[ 5.97645746e+06 8.72227778e+06 1.93130838e+06 6.42903610e+06
8.21072670e+06 6.29274575e+06 8.10782250e+06 6.28826574e+06
8.32047354e+06 6.23207785e+06 8.54991988e+06 5.96284456e+06
8.49098138e+06 8.10861889e+06 8.85663737e+06 6.10314516e+06
6.40093527e+06 8.03219470e+06 6.49581141e+06 8.72044041e+06]
[ 1.12149329e+07 1.17887520e+07 5.17027446e+06 1.11118639e+07
1.20733952e+07 1.11611458e+07 1.24255550e+07 1.11790241e+07
1.21291735e+07 1.11004997e+07 1.19350505e+07 1.14769078e+07
1.19301136e+07 1.22031076e+07 1.18175327e+07 1.13390348e+07
1.10213115e+07 1.14227429e+07 1.11337428e+07 1.18551514e+07]
[ 1.12666943e+07 9.76798865e+06 6.37949680e+06 1.07929892e+07
1.05525631e+07 1.09484024e+07 1.11412630e+07 1.09870023e+07
1.05514850e+07 1.09045248e+07 1.01050434e+07 1.16487090e+07
1.01353845e+07 1.08051163e+07 9.73011617e+06 1.13474483e+07
1.06799253e+07 9.83605851e+06 1.07818525e+07 9.87535027e+06]
[ 9.73347965e+06 7.35616319e+06 6.28689828e+06 9.13433254e+06
8.28942311e+06 9.32175943e+06 8.90076794e+06 9.36056596e+06
8.25531992e+06 9.29423014e+06 7.74989183e+06 1.01120965e+07
7.77936650e+06 8.56480731e+06 7.28339061e+06 9.77241480e+06
9.02094937e+06 7.64862835e+06 9.10538607e+06 7.46624950e+06]
[ 7.07423432e+06 4.94696780e+06 4.77551222e+06 6.57279814e+06
5.71487365e+06 6.73251617e+06 6.18114315e+06 6.75340283e+06
5.67846687e+06 6.71632931e+06 5.27607933e+06 7.36092959e+06
5.28276937e+06 5.93169757e+06 4.86744431e+06 7.08498948e+06
6.48697443e+06 5.24783019e+06 6.54578941e+06 5.03158535e+06]
[ 4.23763731e+06 2.73718521e+06 3.38981464e+06 3.89145952e+06
3.26820773e+06 4.00923390e+06 3.57416660e+06 4.01858876e+06
3.24170635e+06 3.99700287e+06 2.97234663e+06 4.43168749e+06
2.95531068e+06 3.41431569e+06 2.65988643e+06 4.23524769e+06
3.83569763e+06 2.95485589e+06 3.86909023e+06 2.78825768e+06]
[ 1.44682529e+06 6.36702302e+05 1.61442981e+06 1.27602349e+06
8.96811447e+05 1.34408530e+06 1.04090447e+06 1.34338572e+06
8.89241298e+05 1.33598928e+06 7.60580685e+05 1.54569095e+06
7.32942052e+05 9.67670382e+05 5.78963357e+05 1.43933130e+06
1.25323179e+06 7.60709595e+05 1.26674650e+06 6.60216173e+05]
[ 1.08529516e+05 -1.37286314e+05 3.89578548e+05 6.34668591e+04
-7.00816443e+04 8.66968902e+04 -3.44814268e+04 8.27669237e+04
-6.82907294e+04 8.32105960e+04 -1.00291285e+05 1.37006434e+05
-1.17690234e+05 -5.17790842e+04 -1.61683334e+05 1.03586553e+05
5.97853400e+04 -9.85322724e+04 6.35420947e+04 -1.30646875e+05]
[ 5.09485803e+03 -7.81767548e+03 1.76999746e+04 2.56135604e+03
-4.02341722e+03 4.71093179e+03 -1.93856178e+03 3.63065916e+03
-3.46964905e+03 4.37675042e+03 -5.03453241e+03 7.22830012e+03
-7.35984213e+03 -2.71845472e+03 -1.03356362e+04 4.62405076e+03
2.25479118e+03 -6.50698299e+03 3.12682436e+03 -7.36163587e+03]
[-7.75350974e+03 -7.88604325e+03 -1.69925986e+03 -7.48835761e+03
-8.28361160e+03 -7.42071360e+03 -8.53847677e+03 -7.59717078e+03
-8.14732528e+03 -7.47484091e+03 -7.88486794e+03 -7.81527418e+03
-8.22534023e+03 -8.36970232e+03 -8.10599633e+03 -7.85638999e+03
-7.38875864e+03 -7.87156625e+03 -7.34016754e+03 -7.87389768e+03]
[-5.60559161e+00 -3.14030229e+00 -8.99079858e+00 -5.75209065e+00
-4.66728338e+00 -5.08535518e+00 -4.34486877e+00 -6.39872405e+00
-3.20593113e+00 -6.01881804e+00 -3.56574633e+00 -5.62598342e+00
-4.76288222e+00 -4.39164750e+00 -3.47875084e+00 -5.21821956e+00
-4.49098974e+00 -4.76279282e+00 -5.65928095e+00 -3.55554408e+00]
[ 7.41921651e+04 1.12822080e+05 -7.44058429e+03 7.76683137e+04
1.08473099e+05 7.65781962e+04 1.05999119e+05 7.58561557e+04
1.08665544e+05 7.63775427e+04 1.11002071e+05 7.27885607e+04
1.10817308e+05 1.07592195e+05 1.13762036e+05 7.46011655e+04
7.73272622e+04 1.02818484e+05 7.78816623e+04 1.12196118e+05]
[ 3.01901312e+05 4.55375195e+05 -4.21104766e+03 3.17160304e+05
4.35968812e+05 3.12629141e+05 4.25498409e+05 3.09404673e+05
4.37420160e+05 3.11945477e+05 4.47673687e+05 2.96293291e+05
4.46841054e+05 4.32067698e+05 4.59142370e+05 3.03657544e+05
3.16246543e+05 4.16506665e+05 3.18512023e+05 4.53177607e+05]
[ 7.66568765e+05 1.21705913e+06 1.84780954e+04 8.13601010e+05
1.15654993e+06 8.00246564e+05 1.12463647e+06 7.90966154e+05
1.16286902e+06 7.97848374e+05 1.19447562e+06 7.51291460e+05
1.19031622e+06 1.14427716e+06 1.22752968e+06 7.72275146e+05
8.11616722e+05 1.10423607e+06 8.17845190e+05 1.21075689e+06]
[ 1.88832011e+06 2.74822767e+06 1.96183324e+05 1.96584748e+06
2.65211359e+06 1.94552956e+06 2.60598503e+06 1.92845243e+06
2.66369421e+06 1.93896629e+06 2.71267879e+06 1.86952211e+06
2.70541935e+06 2.63604038e+06 2.76701401e+06 1.90186614e+06
1.95869584e+06 2.52279231e+06 1.97284580e+06 2.73692610e+06]
[ 3.81123485e+06 5.38391988e+06 4.40537665e+05 3.94445658e+06
5.21817587e+06 3.91419109e+06 5.13979197e+06 3.88132100e+06
5.24163359e+06 3.89963447e+06 5.32565563e+06 3.78668169e+06
5.31027962e+06 5.19310077e+06 5.41429527e+06 3.84161854e+06
3.92906043e+06 4.96552203e+06 3.95887750e+06 5.36536580e+06]
[ 6.13847483e+06 8.52403445e+06 6.41749459e+05 6.32752920e+06
8.28580604e+06 6.29049438e+06 8.17775177e+06 6.23160791e+06
8.32302658e+06 6.26717594e+06 8.44517678e+06 6.10753193e+06
8.41814909e+06 8.25553167e+06 8.56457326e+06 6.18663523e+06
6.29998471e+06 7.87864364e+06 6.35462060e+06 8.49989440e+06]
[ 9.22619006e+06 1.25929447e+07 9.04217376e+05 9.48391078e+06
1.22584381e+07 9.44969876e+06 1.21124428e+07 9.34754636e+06
1.23204342e+07 9.40887929e+06 1.24946230e+07 9.19568939e+06
1.24382148e+07 1.22240579e+07 1.26372534e+07 9.29829939e+06
9.44348146e+06 1.16661390e+07 9.53661010e+06 1.25641556e+07]
[ 1.31328778e+07 1.73074973e+07 1.65109658e+06 1.34037125e+07
1.69547321e+07 1.34076494e+07 1.68229212e+07 1.32523334e+07
1.70434936e+07 1.33377291e+07 1.72308741e+07 1.31483061e+07
1.71314082e+07 1.69468147e+07 1.73300074e+07 1.32360918e+07
1.33441686e+07 1.61062043e+07 1.34863060e+07 1.72790636e+07]
[ 1.59102619e+07 2.03346208e+07 2.51971391e+06 1.61189946e+07
2.00580227e+07 1.61842017e+07 2.00006986e+07 1.59829281e+07
2.01700337e+07 1.60871725e+07 2.03213266e+07 1.59970953e+07
2.01761339e+07 2.01105983e+07 2.03109464e+07 1.60355035e+07
1.60323181e+07 1.89834147e+07 1.62261147e+07 2.03091199e+07]
[ 1.60878132e+07 1.94980937e+07 3.30472216e+06 1.60809845e+07
1.95001914e+07 1.62426670e+07 1.96176910e+07 1.60247780e+07
1.96164773e+07 1.61326883e+07 1.96232614e+07 1.62869387e+07
1.94481634e+07 1.96587438e+07 1.93964864e+07 1.62061391e+07
1.59651886e+07 1.83041451e+07 1.61911200e+07 1.94903024e+07]
[ 1.24087858e+07 1.46434369e+07 2.84978187e+06 1.22535490e+07
1.48273718e+07 1.24596984e+07 1.50362732e+07 1.22447029e+07
1.49437174e+07 1.23661188e+07 1.48563052e+07 1.26455464e+07
1.46743804e+07 1.50505777e+07 1.44827604e+07 1.24829758e+07
1.21396926e+07 1.37271167e+07 1.23518075e+07 1.46436345e+07]
[ 5.26599936e+06 6.04500515e+06 1.07025304e+06 5.07516828e+06
6.26875720e+06 5.24056185e+06 6.46927863e+06 5.07231232e+06
6.35773136e+06 5.18918027e+06 6.24846276e+06 5.43929555e+06
6.11201872e+06 6.47918572e+06 5.90172884e+06 5.27352204e+06
4.99367679e+06 5.59574657e+06 5.14623938e+06 6.04567371e+06]
[-6.74300316e+06 -6.71628021e+06 -3.69601128e+06 -6.59562275e+06
-6.97883162e+06 -6.63183012e+06 -7.07550755e+06 -6.72199731e+06
-6.91176621e+06 -6.63654374e+06 -6.77076535e+06 -6.83799001e+06
-6.85324118e+06 -6.96191818e+06 -6.70696869e+06 -6.79899326e+06
-6.59927883e+06 -6.67839941e+06 -6.52587152e+06 -6.75229643e+06]
[-2.04520812e+07 -2.10100977e+07 -8.78616141e+06 -1.98036504e+07
-2.19798939e+07 -2.01123255e+07 -2.24924482e+07 -2.00920498e+07
-2.19395787e+07 -2.00804085e+07 -2.14344220e+07 -2.08921571e+07
-2.14617272e+07 -2.22501203e+07 -2.07788580e+07 -2.05530542e+07
-1.97102791e+07 -2.04412906e+07 -1.97272723e+07 -2.10939131e+07]
[-2.49360575e+07 -2.55668325e+07 -9.75584178e+06 -2.40485027e+07
-2.68371692e+07 -2.44857904e+07 -2.75090243e+07 -2.43872785e+07
-2.68120327e+07 -2.44489413e+07 -2.61584476e+07 -2.54992690e+07
-2.61504468e+07 -2.72478198e+07 -2.52218382e+07 -2.50257370e+07
-2.39123480e+07 -2.48164557e+07 -2.39819284e+07 -2.56663257e+07]
[-1.53464554e+07 -1.50564115e+07 -5.40108985e+06 -1.45934017e+07
-1.60710209e+07 -1.49455778e+07 -1.65510887e+07 -1.48417374e+07
-1.60262110e+07 -1.49436096e+07 -1.55188082e+07 -1.57253056e+07
-1.55215672e+07 -1.63977382e+07 -1.47740299e+07 -1.53553760e+07
-1.45020532e+07 -1.47078045e+07 -1.45486108e+07 -1.51288669e+07]
[-1.64203201e+06 -2.90021938e+05 -7.27391960e+02 -1.17448954e+06
-8.48333033e+05 -1.35877526e+06 -1.00223309e+06 -1.28803036e+06
-7.79047290e+05 -1.40412522e+06 -5.27335012e+05 -1.73234640e+06
-5.41587042e+05 -9.97711650e+05 -1.16625437e+05 -1.55024088e+06
-1.15997516e+06 -4.96758029e+05 -1.14503214e+06 -3.22048919e+05]
[ 9.28512257e+06 1.03612005e+07 4.62734932e+06 9.32225090e+06
1.04355437e+07 9.32886654e+06 1.06917091e+07 9.38201003e+06
1.05006316e+07 9.25286090e+06 1.04042593e+07 9.49752720e+06
1.04069462e+07 1.05104929e+07 1.04204203e+07 9.43681018e+06
9.25425299e+06 9.93551580e+06 9.32992629e+06 1.03828520e+07]
[ 1.37248455e+07 1.31894991e+07 6.98416622e+06 1.33378500e+07
1.38590270e+07 1.34796197e+07 1.44502280e+07 1.35416376e+07
1.38776653e+07 1.34098660e+07 1.34661337e+07 1.41290553e+07
1.35177788e+07 1.41093487e+07 1.31806469e+07 1.38706327e+07
1.32127901e+07 1.29991223e+07 1.33207271e+07 1.32687851e+07]
[ 1.24980371e+07 1.08783305e+07 6.75248054e+06 1.19415493e+07
1.17603030e+07 1.21084026e+07 1.24094265e+07 1.21667470e+07
1.17340182e+07 1.20685063e+07 1.12284083e+07 1.28972211e+07
1.13073009e+07 1.20486829e+07 1.08555251e+07 1.25895038e+07
1.18079747e+07 1.09500505e+07 1.19123680e+07 1.09819294e+07]
[ 1.00495813e+07 8.73027335e+06 5.36645887e+06 9.59031005e+06
9.44778408e+06 9.71427008e+06 9.93624203e+06 9.74316977e+06
9.41281090e+06 9.69753738e+06 9.01658942e+06 1.03368842e+07
9.08307217e+06 9.67440207e+06 8.71960651e+06 1.01011616e+07
9.47662803e+06 8.80788353e+06 9.56880359e+06 8.81710802e+06]
[ 6.98730216e+06 6.19445054e+06 3.41112447e+06 6.69939024e+06
6.64681039e+06 6.77037893e+06 6.93904890e+06 6.77591474e+06
6.62055458e+06 6.76557764e+06 6.37871521e+06 7.15284959e+06
6.41845642e+06 6.78780822e+06 6.19307615e+06 7.01161279e+06
6.62303054e+06 6.23857151e+06 6.68951298e+06 6.25151678e+06]
[ 3.90393642e+06 3.46280868e+06 2.19785501e+06 3.73856365e+06
3.72697829e+06 3.78108776e+06 3.88712072e+06 3.77939925e+06
3.71074496e+06 3.77872828e+06 3.57558476e+06 3.99633330e+06
3.58717610e+06 3.80726013e+06 3.45273818e+06 3.91285358e+06
3.69357305e+06 3.48489235e+06 3.73061451e+06 3.49273380e+06]
[ 1.35016705e+06 9.25877969e+05 1.12292561e+06 1.24720451e+06
1.08503077e+06 1.28007182e+06 1.17766815e+06 1.28344999e+06
1.07688265e+06 1.27725077e+06 9.95387245e+05 1.40763098e+06
9.94233917e+05 1.13134391e+06 9.05586687e+05 1.35023036e+06
1.22864561e+06 9.85957533e+05 1.23859299e+06 9.39335076e+05]
[ 2.72211154e+05 2.82048412e+04 4.64859767e+05 2.24641026e+05
9.96567743e+04 2.41749620e+05 1.40663112e+05 2.45345703e+05
9.62846241e+04 2.39982662e+05 5.92983563e+04 2.98831988e+05
5.69851189e+04 1.19518165e+05 1.51262225e+04 2.70919011e+05
2.19052905e+05 7.10257889e+04 2.19685017e+05 3.29079524e+04]
[ 8.40313929e+03 -2.12900779e+04 3.66109581e+04 3.43403911e+03
-1.38965032e+04 5.25201280e+03 -9.44178637e+03 5.65552908e+03
-1.41269920e+04 5.14869467e+03 -1.80454707e+04 1.11547995e+04
-1.83108882e+04 -1.17318786e+04 -2.27425469e+04 8.23065147e+03
2.87351050e+03 -1.56337662e+04 2.95720554e+03 -2.07503091e+04]
[-1.94061619e+03 -1.99840399e+03 9.23368438e+02 -1.86593607e+03
-2.09480200e+03 -1.85335178e+03 -2.16988080e+03 -1.89220395e+03
-2.05538717e+03 -1.87875901e+03 -1.98836107e+03 -1.95207758e+03
-2.09224089e+03 -2.11958085e+03 -2.06544763e+03 -1.97478492e+03
-1.82699000e+03 -1.99909575e+03 -1.83728700e+03 -1.99843558e+03]
[-7.26027607e+02 -4.46968351e+02 -1.22452467e+03 -6.74272865e+02
-5.39894703e+02 -6.76867227e+02 -6.01648920e+02 -6.91335834e+02
-5.02263874e+02 -6.78625700e+02 -4.59854815e+02 -7.35710833e+02
-4.83060645e+02 -5.43490420e+02 -4.53530353e+02 -7.17729719e+02
-6.78618250e+02 -4.98594585e+02 -6.68287292e+02 -4.61656990e+02]
[ 3.23128401e+04 4.91784114e+04 -6.34756567e+01 3.39668993e+04
4.70339481e+04 3.35035203e+04 4.58545796e+04 3.31589841e+04
4.72594668e+04 3.34093065e+04 4.83694061e+04 3.17654276e+04
4.82340499e+04 4.66339012e+04 4.95637377e+04 3.25275046e+04
3.38623657e+04 4.48893238e+04 3.41018285e+04 4.89159482e+04]
[ 2.82418816e+05 4.23731124e+05 1.15301044e+03 2.96631760e+05
4.05614028e+05 2.92465177e+05 3.95867483e+05 2.89506437e+05
4.07084298e+05 2.91758182e+05 4.16618764e+05 2.77404365e+05
4.15758266e+05 4.01905926e+05 4.27258185e+05 2.84074352e+05
2.95905018e+05 3.87987940e+05 2.97919705e+05 4.21757747e+05]
[ 7.44104349e+05 1.15374882e+06 1.22496249e+04 7.87767131e+05
1.09650065e+06 7.75806419e+05 1.06675825e+06 7.67057885e+05
1.10276135e+06 7.73469879e+05 1.13239523e+06 7.30355106e+05
1.12836745e+06 1.08487042e+06 1.16367794e+06 7.49501311e+05
7.86221704e+05 1.05150259e+06 7.92337099e+05 1.14814745e+06]
[ 1.63817414e+06 2.35075100e+06 1.71513016e+05 1.70342483e+06
2.26736327e+06 1.68813281e+06 2.22807422e+06 1.67283376e+06
2.27845582e+06 1.68164273e+06 2.32062653e+06 1.62392083e+06
2.31311920e+06 2.25355219e+06 2.36623705e+06 1.65084700e+06
1.69762791e+06 2.16407523e+06 1.71090563e+06 2.34157774e+06]
[ 3.25856194e+06 4.65321780e+06 4.32297998e+05 3.38102087e+06
4.49431526e+06 3.35721908e+06 4.41899942e+06 3.32351454e+06
4.51779813e+06 3.34157146e+06 4.59992422e+06 3.23693992e+06
4.58042575e+06 4.46965503e+06 4.67831963e+06 3.28819095e+06
3.36853265e+06 4.28352544e+06 3.39896347e+06 4.63743745e+06]
[ 5.18740749e+06 7.50905176e+06 2.03442397e+05 5.39881794e+06
7.22098922e+06 5.36322251e+06 7.08139677e+06 5.29258345e+06
7.26644348e+06 5.33658028e+06 7.41796065e+06 5.14428985e+06
7.37777336e+06 7.17850500e+06 7.54672706e+06 5.23545823e+06
5.38085226e+06 6.89703981e+06 5.43975909e+06 7.48551363e+06]
[ 8.37335936e+06 1.22091375e+07 6.79787914e+04 8.72185541e+06
1.17208497e+07 8.68066163e+06 1.14803650e+07 8.54304704e+06
1.18014923e+07 8.63063913e+06 1.20654968e+07 8.30433162e+06
1.19772674e+07 1.16478270e+07 1.22529781e+07 8.45148857e+06
8.69871756e+06 1.11903584e+07 8.80392550e+06 1.21752697e+07]
[ 1.18839110e+07 1.67524169e+07 2.81047503e+05 1.22793658e+07
1.61893910e+07 1.22738235e+07 1.59276644e+07 1.20668353e+07
1.63027617e+07 1.21925142e+07 1.66141973e+07 1.18423642e+07
1.64699431e+07 1.61312275e+07 1.67708625e+07 1.19912733e+07
1.22443387e+07 1.54084605e+07 1.24011448e+07 1.67140718e+07]
[ 1.29087417e+07 1.77974496e+07 5.45745643e+05 1.32345472e+07
1.73096158e+07 1.32985838e+07 1.71124226e+07 1.30395903e+07
1.74553870e+07 1.31959206e+07 1.77318958e+07 1.29348168e+07
1.75319745e+07 1.73131448e+07 1.77501950e+07 1.30243149e+07
1.31837259e+07 1.63761835e+07 1.33816029e+07 1.77622500e+07]
[ 1.05650966e+07 1.30289830e+07 1.33992872e+06 1.05242056e+07
1.30331607e+07 1.07177035e+07 1.31199899e+07 1.04736920e+07
1.31664510e+07 1.06182017e+07 1.31845434e+07 1.07486724e+07
1.29726834e+07 1.31915382e+07 1.28685446e+07 1.06380875e+07
1.04551380e+07 1.21191315e+07 1.06472494e+07 1.30270164e+07]
[ 6.14104425e+06 5.38926858e+06 3.12806040e+06 5.66286529e+06
6.01983685e+06 5.96015975e+06 6.43657345e+06 5.78880102e+06
6.10799953e+06 5.89238898e+06 5.79610120e+06 6.48242622e+06
5.62102784e+06 6.33647205e+06 5.12864038e+06 6.14305693e+06
5.58001074e+06 5.22653519e+06 5.71723987e+06 5.42966624e+06]
[-1.15666903e+05 -2.98901325e+06 3.26037862e+06 -7.07682337e+05
-2.16779494e+06 -4.50351185e+05 -1.66408340e+06 -5.23347070e+05
-2.12736264e+06 -4.75568682e+05 -2.54450153e+06 2.14247662e+05
-2.64803231e+06 -1.83957212e+06 -3.22595991e+06 -1.69801902e+05
-7.72780212e+05 -2.52154032e+06 -7.10793385e+05 -2.94112920e+06]
[-1.25651408e+07 -1.62389423e+07 -5.91767944e+05 -1.27568093e+07
-1.59658883e+07 -1.27435948e+07 -1.57849433e+07 -1.26995730e+07
-1.59611032e+07 -1.27270046e+07 -1.60975626e+07 -1.25262753e+07
-1.61335552e+07 -1.58714219e+07 -1.62786511e+07 -1.26645797e+07
-1.27451796e+07 -1.52305904e+07 -1.27721406e+07 -1.62339858e+07]
[-2.77077211e+07 -3.20562667e+07 -6.66111215e+06 -2.73421594e+07
-3.25835009e+07 -2.76262642e+07 -3.28498521e+07 -2.74567778e+07
-3.26120977e+07 -2.75757912e+07 -3.23423657e+07 -2.80488542e+07
-3.23054832e+07 -3.28027605e+07 -3.18376713e+07 -2.78442164e+07
-2.72244043e+07 -3.04547584e+07 -2.73443317e+07 -3.21084801e+07]
[-2.95209385e+07 -3.38593481e+07 -7.25912075e+06 -2.90198325e+07
-3.45628857e+07 -2.93711215e+07 -3.49009771e+07 -2.91430786e+07
-3.45977046e+07 -2.93265058e+07 -3.42488603e+07 -2.99135313e+07
-3.41865572e+07 -3.48606044e+07 -3.35712100e+07 -2.96287633e+07
-2.88833019e+07 -3.21779095e+07 -2.90266354e+07 -3.39200715e+07]
[-1.51628501e+07 -1.80145743e+07 -2.27240467e+06 -1.49150140e+07
-1.83091997e+07 -1.51014925e+07 -1.83501174e+07 -1.49098934e+07
-1.83126426e+07 -1.51073191e+07 -1.81961944e+07 -1.52755010e+07
-1.81503345e+07 -1.84389314e+07 -1.78413220e+07 -1.51632646e+07
-1.48550528e+07 -1.69994234e+07 -1.49377081e+07 -1.80429094e+07]
[ 2.43380086e+06 1.16020145e+06 3.89998892e+06 2.31215638e+06
1.43398832e+06 2.34443905e+06 1.79031945e+06 2.47796444e+06
1.45635124e+06 2.27660439e+06 1.25635772e+06 2.67315211e+06
1.28550072e+06 1.53886440e+06 1.19367399e+06 2.55184128e+06
2.26734073e+06 1.39468414e+06 2.27477623e+06 1.17127411e+06]
[ 1.27260271e+07 1.20975604e+07 6.88407723e+06 1.23313172e+07
1.27580440e+07 1.24980108e+07 1.33683818e+07 1.25859076e+07
1.27823979e+07 1.24097377e+07 1.23667963e+07 1.31571355e+07
1.24107162e+07 1.30213238e+07 1.20567162e+07 1.28902982e+07
1.22168961e+07 1.19305463e+07 1.22938663e+07 1.21446306e+07]
[ 1.31293654e+07 1.23426834e+07 6.03410902e+06 1.26541865e+07
1.30811448e+07 1.28346628e+07 1.37077885e+07 1.28945240e+07
1.30903940e+07 1.27689027e+07 1.26357578e+07 1.35454400e+07
1.27104792e+07 1.33696588e+07 1.23077820e+07 1.32685330e+07
1.25282642e+07 1.21913875e+07 1.26301109e+07 1.24134716e+07]
[ 1.01796768e+07 9.69196647e+06 4.05357108e+06 9.82259452e+06
1.02376556e+07 9.92780560e+06 1.06851596e+07 9.95337126e+06
1.02297559e+07 9.90059220e+06 9.89927510e+06 1.04467100e+07
9.98707882e+06 1.04504427e+07 9.70763249e+06 1.02652651e+07
9.71527859e+06 9.56332478e+06 9.81802644e+06 9.76168815e+06]
[ 7.47265426e+06 7.78098542e+06 2.01622416e+06 7.32688676e+06
8.00775138e+06 7.34772980e+06 8.20693602e+06 7.33133351e+06
8.00565668e+06 7.34622874e+06 7.86657035e+06 7.57332504e+06
7.93349558e+06 8.11514779e+06 7.83549553e+06 7.51833646e+06
7.25046239e+06 7.57396298e+06 7.34353978e+06 7.82728652e+06]
[ 5.00098895e+06 5.63572243e+06 8.68044333e+05 4.98201007e+06
5.67565993e+06 4.96182720e+06 5.72774615e+06 4.92899622e+06
5.67898155e+06 4.97042071e+06 5.65272965e+06 5.01179048e+06
5.69354796e+06 5.71515062e+06 5.69524782e+06 5.02390663e+06
4.93385535e+06 5.42475057e+06 5.00481074e+06 5.66307524e+06]
[ 2.67642209e+06 3.10518657e+06 4.82040367e+05 2.68160667e+06
3.10581890e+06 2.66455997e+06 3.11549367e+06 2.64034686e+06
3.10879603e+06 2.67132939e+06 3.10882572e+06 2.67053299e+06
3.12706382e+06 3.12165977e+06 3.13888469e+06 2.68576576e+06
2.65583078e+06 2.97722710e+06 2.69516681e+06 3.11764898e+06]
[ 1.05106223e+06 8.78714181e+05 6.10377793e+05 9.96000730e+05
9.63892429e+05 1.00810316e+06 1.01700306e+06 1.00867343e+06
9.58832203e+05 1.00942568e+06 9.13813959e+05 1.07905896e+06
9.22626554e+05 9.92851040e+05 8.77270996e+05 1.05332563e+06
9.81152256e+05 8.97301449e+05 9.91699688e+05 8.86786028e+05]
[ 2.32576175e+05 1.21548912e+04 3.81468593e+05 1.89650471e+05
7.62459359e+04 2.02781942e+05 1.14638942e+05 2.08247476e+05
7.26117012e+04 2.02238304e+05 3.79654640e+04 2.55524475e+05
4.07892895e+04 9.49031431e+04 3.96241548e+03 2.32531802e+05
1.83915847e+05 5.29968734e+04 1.83605532e+05 1.57612229e+04]
[ 5.03052492e+04 4.51559511e+03 9.38802454e+04 4.15856936e+04
1.79018998e+04 4.43975456e+04 2.60432229e+04 4.53956415e+04
1.73484680e+04 4.41504610e+04 1.01088692e+04 5.53092063e+04
1.02964642e+04 2.19093020e+04 2.60692824e+03 5.03192066e+04
4.04115166e+04 1.27443423e+04 4.03351320e+04 5.25053296e+03]
[ 3.28408248e+03 9.81721868e+02 4.42777030e+03 2.81924207e+03
1.67285413e+03 2.95258221e+03 2.05556129e+03 3.01743680e+03
1.61097410e+03 2.94872895e+03 1.25445036e+03 3.50567213e+03
1.27483453e+03 1.84452164e+03 8.93710270e+02 3.28008801e+03
2.75398580e+03 1.39984072e+03 2.75702406e+03 1.02854362e+03]
[-2.48997582e-01 -6.19882567e-01 3.86097949e-01 3.24211253e-01
-2.93855157e-01 -6.38794517e-01 -6.86678647e-01 -5.26020853e-01
-3.43081253e-01 7.39191349e-01 -7.56172107e-01 -6.63714235e-01
-2.59089789e-01 2.08692036e-01 -8.88370002e-01 -5.09547807e-01
6.67942862e-01 3.25767117e-01 -2.97138660e-01 -7.71575371e-01]
[ 4.11224995e+04 5.53953322e+04 -2.87171280e+03 4.19651437e+04
5.44892881e+04 4.16816842e+04 5.39561494e+04 4.13823250e+04
5.43953811e+04 4.15934936e+04 5.49467092e+04 4.06870161e+04
5.49251245e+04 5.42658986e+04 5.56950603e+04 4.12350910e+04
4.17879976e+04 5.13675140e+04 4.19767505e+04 5.52467813e+04]
[ 1.63369782e+05 2.45151951e+05 7.71575625e+01 1.71811938e+05
2.34164308e+05 1.69381327e+05 2.28516325e+05 1.67633138e+05
2.35108413e+05 1.68949498e+05 2.40811860e+05 1.60475653e+05
2.40277668e+05 2.31923697e+05 2.47382730e+05 1.64355670e+05
1.71387217e+05 2.24492062e+05 1.72673822e+05 2.44039548e+05]
[ 4.36432820e+05 6.99753623e+05 1.39399543e+04 4.64742769e+05
6.62010784e+05 4.57489275e+05 6.42581134e+05 4.51640808e+05
6.66218572e+05 4.55683904e+05 6.85935199e+05 4.27517456e+05
6.82421071e+05 6.54101593e+05 7.05408818e+05 4.39885712e+05
4.64028505e+05 6.33729193e+05 4.68076480e+05 6.96309590e+05]
[ 1.17818306e+06 1.75168127e+06 1.30268224e+05 1.23382035e+06
1.67756599e+06 1.22271128e+06 1.64210697e+06 1.20906898e+06
1.68845480e+06 1.21630227e+06 1.72652572e+06 1.16643172e+06
1.71699495e+06 1.66458400e+06 1.76209324e+06 1.18949756e+06
1.23036506e+06 1.60286646e+06 1.24152288e+06 1.74433768e+06]
[ 2.60951525e+06 3.97139259e+06 7.93216278e+04 2.75008538e+06
3.77735408e+06 2.72185953e+06 3.67975206e+06 2.68278795e+06
3.80507091e+06 2.70729220e+06 3.90722657e+06 2.57403193e+06
3.88287980e+06 3.74175038e+06 3.99740500e+06 2.63659992e+06
2.74431381e+06 3.62407616e+06 2.77480458e+06 3.95703817e+06]
[ 4.48529279e+06 7.15957133e+06 -6.31087710e+05 4.77200459e+06
6.74721113e+06 4.72169675e+06 6.52890706e+06 4.62709357e+06
6.80638945e+06 4.69371974e+06 7.02787089e+06 4.40090374e+06
6.97059183e+06 6.67085309e+06 7.20341678e+06 4.53299077e+06
4.76826131e+06 6.48506544e+06 4.83341891e+06 7.13429486e+06]
[ 6.96925048e+06 1.15307396e+07 -1.60040966e+06 7.46028468e+06
1.08114435e+07 7.39204622e+06 1.04257702e+07 7.21054670e+06
1.09170871e+07 7.33933169e+06 1.13110901e+07 6.82449577e+06
1.11914299e+07 1.06774797e+07 1.15838089e+07 7.04675888e+06
7.46471688e+06 1.03744856e+07 7.57683185e+06 1.14903665e+07]
[ 9.17030537e+06 1.50128885e+07 -2.03119737e+06 9.78176284e+06
1.41030628e+07 9.73632233e+06 1.36310536e+07 9.47207466e+06
1.42638483e+07 9.65194489e+06 1.47653730e+07 9.02509338e+06
1.45718555e+07 1.39577153e+07 1.50369275e+07 9.27623445e+06
9.79098753e+06 1.35029900e+07 9.94947156e+06 1.49598548e+07]
[ 8.16027545e+06 1.31803551e+07 -1.97324543e+06 8.61812990e+06
1.24567448e+07 8.66810810e+06 1.20990333e+07 8.36321174e+06
1.26466121e+07 8.56961088e+06 1.30554939e+07 8.10578317e+06
1.28047469e+07 1.23983398e+07 1.31052136e+07 8.24891190e+06
8.62528975e+06 1.18075352e+07 8.79866174e+06 1.31382172e+07]
[ 5.15710998e+06 7.20514539e+06 5.61355334e+04 5.16464077e+06
7.11668277e+06 5.35658477e+06 7.10853061e+06 5.09031743e+06
7.28328520e+06 5.27353152e+06 7.36042960e+06 5.29485685e+06
7.10866832e+06 7.24200223e+06 6.99291426e+06 5.18719736e+06
5.14997511e+06 6.47787140e+06 5.29311901e+06 7.20358886e+06]
[ 2.09345165e+06 4.76538798e+04 4.16688949e+06 1.52944389e+06
8.17977440e+05 1.84754551e+06 1.28165762e+06 1.70267224e+06
9.11536745e+05 1.79747430e+06 5.33365662e+05 2.46637064e+06
3.49190186e+05 1.15201609e+06 -2.73201509e+05 2.05720527e+06
1.48158536e+06 2.60517717e+05 1.55509589e+06 1.01025866e+05]
[-1.72665771e+06 -6.69088064e+06 7.29282664e+06 -2.54566351e+06
-5.48253362e+06 -2.23646207e+06 -4.76788009e+06 -2.22898498e+06
-5.46846292e+06 -2.25650673e+06 -6.08375368e+06 -1.26477625e+06
-6.17665180e+06 -5.08441246e+06 -6.99373347e+06 -1.79490030e+06
-2.60823068e+06 -5.70069882e+06 -2.60878148e+06 -6.61715544e+06]
[-1.65034873e+07 -2.34483853e+07 3.05902277e+06 -1.69954265e+07
-2.26944849e+07 -1.69251475e+07 -2.22278925e+07 -1.67534217e+07
-2.27442752e+07 -1.69096026e+07 -2.31345710e+07 -1.63117640e+07
-2.31384206e+07 -2.25187211e+07 -2.35298411e+07 -1.66157933e+07
-1.69847871e+07 -2.16040054e+07 -1.70791984e+07 -2.34133245e+07]
[-3.21786074e+07 -4.03361956e+07 -3.70431492e+06 -3.22162453e+07
-4.02711346e+07 -3.24010447e+07 -4.01739534e+07 -3.21022515e+07
-4.03563319e+07 -3.23570389e+07 -4.04042051e+07 -3.23243252e+07
-4.03375805e+07 -4.03607408e+07 -4.01833303e+07 -3.23281745e+07
-3.21142684e+07 -3.78052598e+07 -3.22853442e+07 -4.03542346e+07]
[-2.97697266e+07 -3.78102492e+07 -3.01324712e+06 -2.98651750e+07
-3.76607533e+07 -3.00182266e+07 -3.74725872e+07 -2.96929640e+07
-3.77470682e+07 -2.99927750e+07 -3.78559536e+07 -2.98453913e+07
-3.77713710e+07 -3.77174872e+07 -3.76632988e+07 -2.98749946e+07
-2.97818574e+07 -3.53692355e+07 -2.99433319e+07 -3.78227576e+07]
[-1.16249302e+07 -1.72298210e+07 2.09823584e+06 -1.19924217e+07
-1.66610089e+07 -1.19399735e+07 -1.61708085e+07 -1.17025817e+07
-1.67004395e+07 -1.19761813e+07 -1.70476656e+07 -1.13931008e+07
-1.69935139e+07 -1.65177758e+07 -1.72286384e+07 -1.16109709e+07
-1.19977968e+07 -1.57717504e+07 -1.20719834e+07 -1.72125818e+07]
[ 5.94908414e+06 4.00890981e+06 5.46058666e+06 5.51039162e+06
4.68983402e+06 5.70855175e+06 5.29330202e+06 5.80862378e+06
4.71871868e+06 5.61882298e+06 4.30122441e+06 6.37192241e+06
4.30722786e+06 4.95811670e+06 3.90214131e+06 6.07293756e+06
5.43570261e+06 4.23070070e+06 5.46420084e+06 4.03716455e+06]
[ 1.09106077e+07 1.07635564e+07 4.36238474e+06 1.05426349e+07
1.13073991e+07 1.07477059e+07 1.18326581e+07 1.07693711e+07
1.13661937e+07 1.06634297e+07 1.10137499e+07 1.13020879e+07
1.10234100e+07 1.15762913e+07 1.06593664e+07 1.10512259e+07
1.04537662e+07 1.04672981e+07 1.05335350e+07 1.07973829e+07]
[ 8.65100079e+06 9.37726094e+06 1.64672224e+06 8.46346234e+06
9.62512085e+06 8.58040367e+06 9.93342052e+06 8.55774218e+06
9.68421791e+06 8.53222561e+06 9.49608201e+06 8.87513299e+06
9.52964649e+06 9.80389042e+06 9.34398894e+06 8.75384625e+06
8.39576892e+06 8.95936036e+06 8.48780335e+06 9.40650075e+06]
[ 5.41633602e+06 6.52287544e+06 -3.60924132e+05 5.39062532e+06
6.52654971e+06 5.40647394e+06 6.62921847e+06 5.35666264e+06
6.57040355e+06 5.40072282e+06 6.53231111e+06 5.46941916e+06
6.58430095e+06 6.61100206e+06 6.56175053e+06 5.46781010e+06
5.34311713e+06 6.13356694e+06 5.43323259e+06 6.54861357e+06]
[ 4.01082867e+06 5.29793956e+06 -8.23090009e+05 4.08194095e+06
5.17244394e+06 4.03942845e+06 5.14857252e+06 3.97778027e+06
5.20359565e+06 4.05420661e+06 5.25354028e+06 3.97008792e+06
5.30289983e+06 5.19644469e+06 5.37280778e+06 4.03508990e+06
4.04451815e+06 4.94466251e+06 4.12733901e+06 5.31572683e+06]
[ 3.05457871e+06 4.38837500e+06 -9.25385492e+05 3.17933517e+06
4.19708255e+06 3.11434079e+06 4.10473239e+06 3.05287447e+06
4.22005940e+06 3.13323378e+06 4.31746555e+06 2.97206165e+06
4.35021687e+06 4.18131191e+06 4.46747432e+06 3.06598010e+06
3.15372905e+06 4.06271327e+06 3.22125523e+06 4.39817256e+06]
[ 1.84403735e+06 2.57185098e+06 -4.52569839e+05 1.91272532e+06
2.46807441e+06 1.87359724e+06 2.41610437e+06 1.83839740e+06
2.47965289e+06 1.88527776e+06 2.53321642e+06 1.79579145e+06
2.55339988e+06 2.46008806e+06 2.61983164e+06 1.84980695e+06
1.89597207e+06 2.39654130e+06 1.93599814e+06 2.57738407e+06]
[ 5.49132422e+05 6.04479845e+05 -1.35735560e+04 5.39651213e+05
6.15943465e+05 5.35978358e+05 6.26360341e+05 5.29252597e+05
6.16827829e+05 5.40443343e+05 6.09432595e+05 5.48103819e+05
6.20036146e+05 6.27660215e+05 6.13960892e+05 5.49975320e+05
5.30952770e+05 5.84583609e+05 5.42208258e+05 6.08136965e+05]
[ 7.19007574e+04 -1.08603923e+05 1.93923282e+05 3.92525393e+04
-6.19306243e+04 4.85007624e+04 -3.28308979e+04 5.31653233e+04
-6.42797905e+04 4.91024102e+04 -9.05291403e+04 8.79547621e+04
-8.61239394e+04 -4.73970175e+04 -1.13871748e+05 7.15148053e+04
3.53487885e+04 -7.25872048e+04 3.46371304e+04 -1.05868741e+05]
[ 7.23218174e+04 3.13788299e+03 1.23564193e+05 5.93217759e+04
2.28021965e+04 6.29349524e+04 3.50080946e+04 6.50975713e+04
2.16096926e+04 6.29531008e+04 1.07575901e+04 7.92726681e+04
1.21559459e+04 2.84377533e+04 1.05606813e+03 7.24551636e+04
5.75015805e+04 1.62330216e+04 5.72845166e+04 4.37176257e+03]
[ 1.12603687e+04 3.36467775e+03 1.51816435e+04 9.66204467e+03
5.73322716e+03 1.01255238e+04 7.04840140e+03 1.03424784e+04
5.52538617e+03 1.01092459e+04 4.30170302e+03 1.20215402e+04
4.37253488e+03 6.32519128e+03 3.06302326e+03 1.12426989e+04
9.44157861e+03 4.80060620e+03 9.45201055e+03 3.52990074e+03]
[ 1.14052818e-01 -2.27744895e-01 3.74132779e-01 3.61806750e-01
-6.36114490e-01 5.28302130e-01 -6.69646904e-01 -3.51785287e-01
7.40421748e-01 1.43336121e-01 -4.86801613e-01 8.47848803e-01
3.21154861e-01 1.09021067e-01 9.86640787e-01 6.91106661e-01
3.54385609e-01 -8.36538944e-01 -2.71108462e-01 4.33675380e-03]
[ 8.92774822e+03 1.18451475e+04 -1.04351655e+04 9.01317074e+03
1.17093604e+04 9.02612244e+03 1.15736870e+04 8.88737007e+03
1.16371862e+04 8.96458835e+03 1.17379042e+04 8.76651965e+03
1.17287434e+04 1.16339441e+04 1.19184323e+04 8.92081366e+03
9.05029606e+03 1.09229277e+04 9.03170050e+03 1.18318991e+04]
[ 5.81253020e+04 9.00812955e+04 -1.23761839e+04 6.16044349e+04
8.53676146e+04 6.06362120e+04 8.29473423e+04 5.98544270e+04
8.57583876e+04 6.04710450e+04 8.81909278e+04 5.68079163e+04
8.79981083e+04 8.43646549e+04 9.10444467e+04 5.84796095e+04
6.15326010e+04 8.21156548e+04 6.20396729e+04 8.96662111e+04]
[ 1.79827742e+05 3.20173037e+05 1.36778751e+04 1.95912385e+05
2.97909479e+05 1.92266771e+05 2.86940677e+05 1.89206623e+05
3.00915757e+05 1.91022231e+05 3.12440747e+05 1.75281944e+05
3.09726545e+05 2.93299970e+05 3.22678067e+05 1.82063668e+05
1.95774967e+05 2.85377211e+05 1.98088844e+05 3.18327822e+05]
[ 7.95263362e+05 1.33760768e+06 -3.56612138e+04 8.56302916e+05
1.25250474e+06 8.44136691e+05 1.20936354e+06 8.29563329e+05
1.26403725e+06 8.38229090e+05 1.30865052e+06 7.78579724e+05
1.29781375e+06 1.23523208e+06 1.34744167e+06 8.05221132e+05
8.56458965e+05 1.20249870e+06 8.66047686e+05 1.33097742e+06]
[ 2.28201392e+06 3.80286394e+06 -4.72261298e+05 2.45820691e+06
3.55109219e+06 2.41899719e+06 3.41546589e+06 2.36985245e+06
3.58236954e+06 2.40652941e+06 3.71698316e+06 2.22209781e+06
3.69073873e+06 3.49810519e+06 3.83649849e+06 2.30707763e+06
2.45991377e+06 3.43060738e+06 2.49135282e+06 3.78871243e+06]
[ 3.81683004e+06 6.84277277e+06 -1.87694168e+06 4.17346928e+06
6.31331413e+06 4.10739055e+06 6.01838553e+06 3.98901313e+06
6.38344702e+06 4.08088551e+06 6.66978418e+06 3.68819025e+06
6.60382342e+06 6.20346073e+06 6.89794231e+06 3.86303208e+06
4.18649758e+06 6.10534629e+06 4.25311237e+06 6.81794036e+06]
[ 5.28998306e+06 1.02430796e+07 -3.58863463e+06 5.88970820e+06
9.33808239e+06 5.79928608e+06 8.83568190e+06 5.58618657e+06
9.46715871e+06 5.74858578e+06 9.96060884e+06 5.08041004e+06
9.82404791e+06 9.15383378e+06 1.03059226e+07 5.36357893e+06
5.92486045e+06 9.03599297e+06 6.03311928e+06 1.02010653e+07]
[ 6.01455951e+06 1.21692992e+07 -4.59970317e+06 6.74656752e+06
1.10439468e+07 6.67935260e+06 1.04271949e+07 6.37873628e+06
1.12380907e+07 6.60219153e+06 1.18564129e+07 5.78690763e+06
1.16345138e+07 1.08403394e+07 1.21846211e+07 6.10420366e+06
6.79959013e+06 1.06458071e+07 6.94115135e+06 1.21122649e+07]
[ 3.68528208e+06 9.03661045e+06 -4.78941671e+06 4.29371109e+06
8.05367583e+06 4.31323808e+06 7.52323063e+06 3.97335426e+06
8.28541700e+06 4.22779810e+06 8.83326953e+06 3.53388793e+06
8.55116104e+06 7.92661890e+06 8.94413354e+06 3.74901299e+06
4.35781605e+06 7.67071023e+06 4.49792711e+06 8.98405320e+06]
[ 4.74814447e+05 2.65153057e+06 -1.71323044e+06 6.20199146e+05
2.33773715e+06 7.78023230e+05 2.18117741e+06 5.00136484e+05
2.54274123e+06 7.09047713e+05 2.73642019e+06 5.33697004e+05
2.46535677e+06 2.39912064e+06 2.42237353e+06 4.83613781e+05
6.63290972e+05 1.99191506e+06 7.58588256e+05 2.63779254e+06]
[-9.95283504e+05 -3.49459355e+06 4.29758610e+06 -1.51933209e+06
-2.78400974e+06 -1.20624034e+06 -2.35309749e+06 -1.32870244e+06
-2.66941563e+06 -1.25317893e+06 -3.02076530e+06 -6.26808675e+05
-3.21605379e+06 -2.47704392e+06 -3.84154643e+06 -1.03258643e+06
-1.53177534e+06 -3.10636171e+06 -1.49985606e+06 -3.44226324e+06]
[-3.63564456e+06 -1.04718304e+07 9.52505293e+06 -4.62803425e+06
-9.00044315e+06 -4.26317194e+06 -8.11100988e+06 -4.18126298e+06
-9.00131259e+06 -4.29606641e+06 -9.76304713e+06 -3.05633358e+06
-9.85234248e+06 -8.55343949e+06 -1.08190241e+07 -3.69148971e+06
-4.68719819e+06 -9.01790862e+06 -4.72225194e+06 -1.03777499e+07]
[-2.16217478e+07 -3.22714536e+07 4.55285127e+06 -2.24782453e+07
-3.10184279e+07 -2.23059967e+07 -3.02342686e+07 -2.20139118e+07
-3.11194328e+07 -2.23063979e+07 -3.17848389e+07 -2.12576820e+07
-3.17670505e+07 -3.07372867e+07 -3.24095893e+07 -2.17437216e+07
-2.24723964e+07 -2.95219278e+07 -2.26072480e+07 -3.22034728e+07]
[-3.46237387e+07 -4.68329967e+07 -1.12231161e+06 -3.52396476e+07
-4.59817509e+07 -3.52263775e+07 -4.53985406e+07 -3.48294504e+07
-4.61178331e+07 -3.52053192e+07 -4.65920657e+07 -3.44822027e+07
-4.65126595e+07 -4.58563481e+07 -4.68163804e+07 -3.47838197e+07
-3.51724043e+07 -4.34354451e+07 -3.53624229e+07 -4.68005860e+07]
[-2.83066197e+07 -3.93058213e+07 -3.33247206e+04 -2.89877118e+07
-3.83638015e+07 -2.89110929e+07 -3.76811645e+07 -2.85396964e+07
-3.84795642e+07 -2.89144570e+07 -3.90207071e+07 -2.80686696e+07
-3.89298553e+07 -3.81667625e+07 -3.93249692e+07 -2.84100082e+07
-2.89523849e+07 -3.63469313e+07 -2.91113528e+07 -3.92739501e+07]
[-7.29429460e+06 -1.29044397e+07 3.57204771e+06 -7.90437716e+06
-1.20326399e+07 -7.69556928e+06 -1.13411220e+07 -7.51209777e+06
-1.20367832e+07 -7.76038669e+06 -1.25515567e+07 -6.88766627e+06
-1.25388520e+07 -1.17412078e+07 -1.30438949e+07 -7.26105162e+06
-7.93352816e+06 -1.16287620e+07 -7.98012922e+06 -1.28745712e+07]
[ 5.45547786e+06 5.62934101e+06 2.29881700e+06 5.26648937e+06
5.87939512e+06 5.45854756e+06 6.22871545e+06 5.43834264e+06
5.99727759e+06 5.36497340e+06 5.80646398e+06 5.76745330e+06
5.73695287e+06 6.08581476e+06 5.47134761e+06 5.57235826e+06
5.23882682e+06 5.34130672e+06 5.28374571e+06 5.62899249e+06]
[ 5.80541801e+06 8.57278862e+06 -1.08333142e+06 5.95140533e+06
8.30448850e+06 6.04428581e+06 8.31840930e+06 5.93071144e+06
8.46334316e+06 5.97455703e+06 8.55011667e+06 5.91665047e+06
8.47286380e+06 8.38329192e+06 8.47869440e+06 5.91380425e+06
5.95386658e+06 7.71136495e+06 6.02415298e+06 8.55066476e+06]
[ 2.48942089e+06 5.47523476e+06 -4.07075758e+06 2.77324833e+06
4.97706416e+06 2.77029082e+06 4.80059905e+06 2.63339347e+06
5.11650826e+06 2.74790149e+06 5.33528325e+06 2.42834228e+06
5.30165695e+06 4.96887928e+06 5.46471751e+06 2.54408698e+06
2.79897796e+06 4.68206050e+06 2.86564202e+06 5.45294507e+06]
[ 1.67590462e+05 2.43053828e+06 -4.58185051e+06 4.21723689e+05
1.97628907e+06 3.65077992e+05 1.77269537e+06 2.41712801e+05
2.06918539e+06 3.80395588e+05 2.28221581e+06 3.09080360e+04
2.29342117e+06 1.94743548e+06 2.47745669e+06 1.76543973e+05
4.40040927e+05 1.88274767e+06 5.06060691e+05 2.42354717e+06]
[ 3.35864157e+05 2.32964747e+06 -3.72220573e+06 5.78459378e+05
1.91452220e+06 4.91482004e+05 1.69872791e+06 3.82525836e+05
1.97621884e+06 5.19549692e+05 2.18347896e+06 1.72301845e+05
2.21038959e+06 1.87001870e+06 2.41065647e+06 3.32986047e+05
5.82040594e+05 1.88086493e+06 6.51229600e+05 2.32578550e+06]
[ 1.03612201e+06 2.54325152e+06 -2.50700435e+06 1.22304607e+06
2.23529762e+06 1.14318874e+06 2.06866136e+06 1.06402191e+06
2.27095060e+06 1.16743281e+06 2.42918004e+06 9.03198225e+05
2.45682087e+06 2.19547626e+06 2.62321330e+06 1.03401123e+06
1.21785593e+06 2.20944200e+06 1.27670771e+06 2.54251995e+06]
[ 6.89675822e+05 1.52919430e+06 -1.49487900e+06 7.99421609e+05
1.34948524e+06 7.48778158e+05 1.25343719e+06 7.04621374e+05
1.36889608e+06 7.64504131e+05 1.46018200e+06 6.09944471e+05
1.48115814e+06 1.32577345e+06 1.58201452e+06 6.88588902e+05
7.94911466e+05 1.34815805e+06 8.30951448e+05 1.52964668e+06]
[ 8.71051840e+04 2.28151786e+05 -4.74509678e+05 9.89831244e+04
2.00910141e+05 8.86789296e+04 1.87694553e+05 7.73088878e+04
2.05688975e+05 9.55497636e+04 2.17803094e+05 6.94569448e+04
2.28735161e+05 2.03767972e+05 2.40600754e+05 8.48661045e+04
9.55813056e+04 1.97023096e+05 1.05453332e+05 2.29944205e+05]
[-8.84509204e+04 -1.97395264e+05 2.25942620e+04 -1.06998547e+05
-1.73515051e+05 -1.01854304e+05 -1.58402756e+05 -9.95449391e+04
-1.74508423e+05 -1.00682420e+05 -1.88406962e+05 -8.12627247e+04
-1.84856102e+05 -1.65022616e+05 -2.00932479e+05 -8.97905477e+04
-1.08261748e+05 -1.74252168e+05 -1.09420006e+05 -1.96127511e+05]
[ 1.36739265e+04 -2.22416470e+03 2.86615062e+04 1.06508940e+04
2.21389384e+03 1.14273554e+04 5.15434551e+03 1.20355980e+04
1.98576800e+03 1.15238898e+04 -5.74505705e+02 1.52485572e+04
-5.02444496e+01 3.53982348e+03 -2.67777426e+03 1.37053332e+04
1.02205956e+04 8.25684234e+02 1.01522461e+04 -1.92416211e+03]
[ 9.92606700e-01 6.07342743e-01 4.83087872e-01 -2.26676160e-01
-1.87656793e-01 -4.10708547e-01 -4.01525668e-01 3.06134246e-01
-9.14765760e-01 2.02066808e-01 -8.99829742e-02 -2.31953204e-01
4.42081528e-01 -8.18314420e-01 -5.02121906e-01 -6.78820636e-01
3.45042971e-01 -6.04211240e-01 -5.16189848e-02 9.04958268e-01]
[ 5.81185175e-01 3.35796801e-01 7.13074790e-01 -4.22052326e-01
5.56036631e-01 -9.61863390e-01 7.47065055e-01 -5.04562495e-01
-7.53843896e-01 -7.47299060e-01 1.75611489e-01 7.83782444e-01
-8.15055496e-01 -3.30281844e-02 7.70634091e-01 9.14315527e-01
9.81546761e-01 -2.76163839e-01 1.70637024e-01 -2.30146348e-01]
[-4.22197840e+03 -5.20009898e+03 -5.27674221e+03 -4.24253472e+03
-5.24818985e+03 -4.20420543e+03 -5.29247280e+03 -4.22745072e+03
-5.24137758e+03 -4.22341908e+03 -5.22343198e+03 -4.24789048e+03
-5.23425909e+03 -5.27827022e+03 -5.19939892e+03 -4.24046356e+03
-4.16768862e+03 -4.92751111e+03 -4.21693091e+03 -5.18616906e+03]
[-5.43882338e+03 -5.31426673e+03 -1.07745725e+04 -5.22402714e+03
-5.76605437e+03 -5.21379231e+03 -6.03835259e+03 -5.31011591e+03
-5.71073921e+03 -5.26506722e+03 -5.49722265e+03 -5.57616713e+03
-5.53564430e+03 -5.89996578e+03 -5.24834047e+03 -5.45151530e+03
-5.06950492e+03 -5.26478565e+03 -5.13858124e+03 -5.31578737e+03]
[ 1.20327466e+04 7.50201443e+04 -2.41225355e+04 2.09715036e+04
6.16031428e+04 1.96284580e+04 5.51276156e+04 1.77681665e+04
6.36734159e+04 1.84926236e+04 7.05747465e+04 9.60361629e+03
6.82397770e+04 5.86730181e+04 7.58292557e+04 1.30984159e+04
2.18875837e+04 5.97522437e+04 2.27236028e+04 7.41949127e+04]
[ 4.01107907e+05 8.68351324e+05 -3.16531155e+05 4.62803672e+05
7.77830334e+05 4.49657009e+05 7.30202218e+05 4.34911777e+05
7.89136715e+05 4.45228842e+05 8.36366873e+05 3.79554890e+05
8.27262907e+05 7.57413277e+05 8.79784775e+05 4.08749889e+05
4.66754291e+05 7.57873751e+05 4.74305817e+05 8.63693219e+05]
[ 1.73698588e+06 3.36661454e+06 -1.42173993e+06 1.94979982e+06
3.05141736e+06 1.89666766e+06 2.87493841e+06 1.83725878e+06
3.08650045e+06 1.88856092e+06 3.25421217e+06 1.64669558e+06
3.23160486e+06 2.97867592e+06 3.41412082e+06 1.75792992e+06
1.96182162e+06 2.98597858e+06 1.99320363e+06 3.35557106e+06]
[ 2.20329571e+06 5.24499713e+06 -3.66937017e+06 2.61486396e+06
4.61203120e+06 2.52891404e+06 4.25246851e+06 2.39882131e+06
4.69119235e+06 2.51027045e+06 5.02891280e+06 2.02622674e+06
4.96902528e+06 4.47076681e+06 5.31811437e+06 2.24014216e+06
2.65087416e+06 4.54101781e+06 2.71024404e+06 5.22515393e+06]
[ 2.88097503e+06 7.59748638e+06 -5.87526561e+06 3.50638512e+06
6.61994326e+06 3.40123440e+06 6.06772988e+06 3.18335032e+06
6.75496847e+06 3.36424008e+06 7.27982572e+06 2.62439379e+06
7.16283255e+06 6.41261582e+06 7.67478956e+06 2.93858016e+06
3.56944858e+06 6.49111688e+06 3.66081261e+06 7.56396677e+06]
[ 1.32281058e+06 6.82974332e+06 -8.09930480e+06 2.07282439e+06
5.61908504e+06 1.99104845e+06 4.94750932e+06 1.69547696e+06
5.82286820e+06 1.93478341e+06 6.47282555e+06 1.03522350e+06
6.28001024e+06 5.39099570e+06 6.85451259e+06 1.38444649e+06
2.16987371e+06 5.53591073e+06 2.27652938e+06 6.77973951e+06]
[-2.24723860e+06 1.96925649e+06 -8.03831577e+06 -1.67005872e+06
9.65257391e+05 -1.65430416e+06 4.18072036e+05 -1.96331804e+06
1.20272776e+06 -1.71486068e+06 1.74180209e+06 -2.43713009e+06
1.50162304e+06 8.28650091e+05 1.87258222e+06 -2.21471324e+06
-1.55766458e+06 9.60589538e+05 -1.47287506e+06 1.92395910e+06]
[-4.88113184e+06 -3.92776970e+06 -4.59719150e+06 -4.77580930e+06
-4.25041570e+06 -4.61193429e+06 -4.39719889e+06 -4.84437940e+06
-4.04428202e+06 -4.66430562e+06 -3.87160593e+06 -4.83914288e+06
-4.09642561e+06 -4.19810680e+06 -4.15939487e+06 -4.88650099e+06
-4.68885779e+06 -4.21838569e+06 -4.64407035e+06 -3.93239500e+06]
[-4.51493707e+06 -8.54826277e+06 2.75353997e+06 -5.16012419e+06
-7.71698978e+06 -4.80943893e+06 -7.17995924e+06 -4.86160829e+06
-7.61604196e+06 -4.85665606e+06 -8.06141231e+06 -4.09248894e+06
-8.20484690e+06 -7.38824647e+06 -8.89850139e+06 -4.53832585e+06
-5.15014933e+06 -7.76033305e+06 -5.15573057e+06 -8.47795097e+06]
[-9.62963300e+06 -1.93759336e+07 6.96931817e+06 -1.08671085e+07
-1.76357853e+07 -1.04288020e+07 -1.65463178e+07 -1.02485128e+07
-1.76754973e+07 -1.04717958e+07 -1.86114248e+07 -8.95915381e+06
-1.86478181e+07 -1.71385403e+07 -1.97298430e+07 -9.68398879e+06
-1.09052298e+07 -1.71901355e+07 -1.09755743e+07 -1.92502295e+07]
[-2.85631460e+07 -4.33271817e+07 1.74651291e+06 -2.98613938e+07
-4.15510057e+07 -2.95573289e+07 -4.04248016e+07 -2.91512336e+07
-4.17143994e+07 -2.95660497e+07 -4.26893453e+07 -2.80415177e+07
-4.26044589e+07 -4.11442740e+07 -4.35081874e+07 -2.87066671e+07
-2.98476555e+07 -3.95986433e+07 -3.00194861e+07 -4.32129227e+07]
[-3.65661852e+07 -5.25297811e+07 -2.02986565e+06 -3.77895283e+07
-5.09154923e+07 -3.75593566e+07 -4.98587365e+07 -3.70887883e+07
-5.11043494e+07 -3.75532066e+07 -5.20119710e+07 -3.61583128e+07
-5.18751354e+07 -5.05636479e+07 -5.26330979e+07 -3.67422944e+07
-3.77434608e+07 -4.83726243e+07 -3.79524886e+07 -5.24412705e+07]
[-2.71798597e+07 -3.96516857e+07 -1.62737080e+06 -2.82353967e+07
-3.82711637e+07 -2.79850749e+07 -3.73204880e+07 -2.76260141e+07
-3.83917108e+07 -2.80047354e+07 -3.91850244e+07 -2.67681814e+07
-3.90822534e+07 -3.79137676e+07 -3.97858760e+07 -2.72920349e+07
-2.82079909e+07 -3.64968207e+07 -2.83641150e+07 -3.95856362e+07]
[-4.31090475e+06 -7.70527406e+06 7.86962401e+05 -4.77786387e+06
-7.10767572e+06 -4.53386190e+06 -6.57500545e+06 -4.46788022e+06
-7.03622877e+06 -4.61209509e+06 -7.41232251e+06 -3.94707691e+06
-7.45983196e+06 -6.83435875e+06 -7.90460885e+06 -4.26528653e+06
-4.78285195e+06 -7.04881820e+06 -4.79903514e+06 -7.68896288e+06]
[ 3.78988970e+06 7.07585588e+06 -1.85564225e+06 4.07537556e+06
6.59358565e+06 4.17233960e+06 6.49417772e+06 4.01992296e+06
6.80878871e+06 4.08263684e+06 7.01132625e+06 3.87064095e+06
6.85771496e+06 6.62947458e+06 6.93184847e+06 3.89836504e+06
4.11990870e+06 6.11895272e+06 4.17245405e+06 7.03396542e+06]
[ 1.68934341e+06 6.94284433e+06 -5.59483250e+06 2.33523053e+06
5.92313244e+06 2.29582894e+06 5.46121436e+06 2.07530356e+06
6.16598301e+06 2.24300128e+06 6.66107068e+06 1.53403859e+06
6.51303690e+06 5.80139665e+06 6.89189495e+06 1.76972301e+06
2.42574921e+06 5.64197474e+06 2.47814105e+06 6.87943044e+06]
[-1.97605033e+06 2.13785316e+06 -7.38180663e+06 -1.40278261e+06
1.19563257e+06 -1.48676385e+06 7.17018490e+05 -1.69263132e+06
1.38472860e+06 -1.49023103e+06 1.85156888e+06 -2.21652722e+06
1.76985096e+06 1.06194505e+06 2.14372946e+06 -1.95993470e+06
-1.30997772e+06 1.19760892e+06 -1.26901501e+06 2.09443891e+06]
[-3.57575860e+06 -5.72477721e+05 -7.14476198e+06 -3.13204363e+06
-1.32999131e+06 -3.23454543e+06 -1.74386418e+06 -3.41152873e+06
-1.19859752e+06 -3.20720187e+06 -8.15180268e+05 -3.83468428e+06
-8.43976203e+05 -1.43799769e+06 -5.27833488e+05 -3.59688232e+06
-3.06523901e+06 -1.21342424e+06 -3.01848707e+06 -5.98443957e+05]
[-2.13046665e+06 2.19802748e+05 -5.64936142e+06 -1.78032622e+06
-3.74982094e+05 -1.89099981e+06 -7.09740939e+05 -2.03019749e+06
-2.90475729e+05 -1.85689711e+06 1.49582678e+04 -2.36507385e+06
2.15963061e+04 -4.63180880e+05 2.97952933e+05 -2.15257010e+06
-1.74337673e+06 -2.64622867e+05 -1.68928199e+06 2.03373572e+05]
[-5.11380328e+05 1.19899555e+06 -3.81653119e+06 -2.65058943e+05
7.83766020e+05 -3.55178671e+05 5.47167176e+05 -4.51973432e+05
8.32499822e+05 -3.27512015e+05 1.04742063e+06 -6.86369063e+05
1.06538142e+06 7.19007368e+05 1.27566349e+06 -5.24602145e+05
-2.49703533e+05 8.43961289e+05 -1.99795965e+05 1.19008887e+06]
[-3.20487081e+05 5.66115976e+05 -2.19937346e+06 -1.87005864e+05
3.37525910e+05 -2.40800532e+05 2.09801489e+05 -2.91807924e+05
3.63035459e+05 -2.23376583e+05 4.79220135e+05 -4.20226671e+05
4.95893056e+05 3.02114369e+05 6.16106940e+05 -3.28323180e+05
-1.80379327e+05 3.87015567e+05 -1.49586658e+05 5.63389588e+05]
[-2.48093159e+05 -7.76720431e+04 -6.77299035e+05 -2.26545176e+05
-1.22977636e+05 -2.38880348e+05 -1.46745950e+05 -2.52240066e+05
-1.16555638e+05 -2.31026092e+05 -9.46952111e+04 -2.73098135e+05
-8.59444667e+04 -1.25122133e+05 -6.56692434e+04 -2.52330383e+05
-2.27203870e+05 -1.12124579e+05 -2.17417742e+05 -7.61346456e+04]
[-1.69942905e+05 -2.06517551e+05 -8.66532953e+04 -1.75793194e+05
-2.02259291e+05 -1.74064794e+05 -1.99443510e+05 -1.74346731e+05
-2.01723499e+05 -1.72766034e+05 -2.04843986e+05 -1.69884939e+05
-2.03058946e+05 -1.98950630e+05 -2.08405779e+05 -1.71645068e+05
-1.75415107e+05 -1.97717751e+05 -1.76177310e+05 -2.06531715e+05]
[-1.39990926e+04 -1.71825333e+04 -9.46849224e+03 -1.42731532e+04
-1.70962373e+04 -1.42183384e+04 -1.69600413e+04 -1.41040407e+04
-1.69765124e+04 -1.41277018e+04 -1.71642995e+04 -1.39851787e+04
-1.69996138e+04 -1.70060091e+04 -1.72490482e+04 -1.40446773e+04
-1.42329759e+04 -1.62694415e+04 -1.43008808e+04 -1.71445299e+04]
[ 4.22917398e-01 -1.34089038e-01 -4.01584901e-02 -8.26141802e-01
2.20074938e-01 -4.39359593e-01 8.37832317e-01 -5.23563766e-01
5.01308304e-01 4.10289979e-01 -7.54436080e-01 -5.82545165e-01
-6.05658467e-01 5.68660812e-01 1.02302474e-01 1.59704526e-02
4.85152291e-01 7.54975916e-01 -8.59908745e-01 -2.47355330e-01]
[-3.16451043e-01 6.88559911e-01 5.37703721e-01 6.49947586e-02
-8.20904123e-01 8.50216061e-01 1.15886687e-01 -9.52181234e-01
2.92126133e-01 -4.52581517e-01 -9.26470613e-02 7.91234069e-01
-5.91913884e-01 -7.72723306e-01 2.36337868e-01 3.50974829e-01
9.77702073e-01 -3.56862158e-01 8.14450708e-01 1.80942173e-01]
[-2.10164515e+02 -2.57020908e+02 -2.61544028e+02 -2.10445417e+02
-2.60182557e+02 -2.08395763e+02 -2.62114554e+02 -2.09329052e+02
-2.60512989e+02 -2.09434625e+02 -2.59687399e+02 -2.10711650e+02
-2.60384546e+02 -2.60869028e+02 -2.57103893e+02 -2.10868254e+02
-2.07230250e+02 -2.44237745e+02 -2.10031525e+02 -2.56213066e+02]
[ 4.60089122e+02 2.89188867e+03 2.21410561e+03 9.14632879e+02
2.23227795e+03 8.23714116e+02 1.84376999e+03 7.88354765e+02
2.41529818e+03 7.64889107e+02 2.76220111e+03 3.59204437e+02
2.54480987e+03 2.05823510e+03 2.81702866e+03 4.82717993e+02
9.98678083e+02 2.36287368e+03 9.18385718e+02 2.82935320e+03]
[-3.49423015e+04 8.82639019e+02 -6.90502152e+04 -2.94510203e+04
-7.92576199e+03 -2.97316520e+04 -1.26684779e+04 -3.14651737e+04
-6.75042205e+03 -3.04563888e+04 -2.12632960e+03 -3.68927560e+04
-3.72887329e+03 -1.04120202e+04 1.11304409e+03 -3.45923723e+04
-2.79693867e+04 -7.77393964e+03 -2.79577019e+04 8.49646990e+02]
[ 2.30853220e+05 6.49180878e+05 -4.57369953e+05 2.91432984e+05
5.58692656e+05 2.76092118e+05 5.09918402e+05 2.61610038e+05
5.69226869e+05 2.74531024e+05 6.16192869e+05 2.05454395e+05
6.10715387e+05 5.36675076e+05 6.62917660e+05 2.36561855e+05
2.96560041e+05 5.54307919e+05 3.03434892e+05 6.47334297e+05]
[ 8.85362708e+05 2.37961458e+06 -2.12766781e+06 1.10839933e+06
2.04108831e+06 1.04595073e+06 1.85196403e+06 9.86587400e+05
2.07837199e+06 1.04522653e+06 2.25554542e+06 7.78162251e+05
2.24146284e+06 1.95905396e+06 2.43651947e+06 9.00228296e+05
1.12813185e+06 2.04878526e+06 1.15785264e+06 2.37675581e+06]
[ 5.22871361e+04 2.54008248e+06 -5.08134525e+06 4.41236494e+05
1.91713445e+06 3.46776254e+05 1.56713082e+06 2.28908927e+05
1.99211619e+06 3.43599219e+05 2.31592711e+06 -1.44726499e+05
2.28384936e+06 1.77221224e+06 2.62632507e+06 7.19611323e+04
4.92745199e+05 1.99773842e+06 5.39191508e+05 2.53595570e+06]
[-1.41459215e+06 1.86907068e+06 -8.15163337e+06 -8.94598747e+05
9.98581402e+05 -9.96256466e+05 5.11311413e+05 -1.17490409e+06
1.11962042e+06 -1.00487344e+06 1.56989204e+06 -1.67839996e+06
1.50953828e+06 8.11450711e+05 1.95332176e+06 -1.39129355e+06
-8.09072388e+05 1.15479692e+06 -7.50021589e+05 1.86151672e+06]
[-4.75021429e+06 -1.48222193e+06 -1.07958170e+07 -4.20670201e+06
-2.46219948e+06 -4.26424477e+06 -2.99359177e+06 -4.49063602e+06
-2.28916124e+06 -4.28324866e+06 -1.78839273e+06 -5.01947984e+06
-1.89314652e+06 -2.63553353e+06 -1.46121301e+06 -4.73469811e+06
-4.08763701e+06 -2.18966967e+06 -4.02980291e+06 -1.50024250e+06]
[-8.38628946e+06 -6.93713236e+06 -1.05519845e+07 -8.10045217e+06
-7.59949386e+06 -8.03794448e+06 -7.93010132e+06 -8.24894446e+06
-7.40914861e+06 -8.06177175e+06 -7.08662633e+06 -8.51889629e+06
-7.21309906e+06 -7.65243686e+06 -7.04049045e+06 -8.39263386e+06
-7.97467994e+06 -7.24797910e+06 -7.94389633e+06 -6.94535974e+06]
[-9.52807841e+06 -1.18242791e+07 -6.02604852e+06 -9.81154461e+06
-1.16557186e+07 -9.56666990e+06 -1.14804260e+07 -9.67202492e+06
-1.15129296e+07 -9.59601492e+06 -1.16415497e+07 -9.35751021e+06
-1.17404918e+07 -1.14815774e+07 -1.20677232e+07 -9.54963212e+06
-9.72817212e+06 -1.13393226e+07 -9.73502007e+06 -1.17851714e+07]
[-8.70104562e+06 -1.65615288e+07 8.13707726e+05 -9.79569815e+06
-1.51642168e+07 -9.34457709e+06 -1.42575547e+07 -9.25180596e+06
-1.51464946e+07 -9.38207600e+06 -1.59337780e+07 -8.12434794e+06
-1.59480408e+07 -1.47056935e+07 -1.69142639e+07 -8.73590777e+06
-9.79252555e+06 -1.48696264e+07 -9.84677211e+06 -1.64422707e+07]
[-1.77654887e+07 -3.19311042e+07 2.37836816e+06 -1.94441547e+07
-2.96798230e+07 -1.89246820e+07 -2.82540865e+07 -1.85876329e+07
-2.98197131e+07 -1.89501818e+07 -3.10734666e+07 -1.69951448e+07
-3.09577402e+07 -2.90729089e+07 -3.22537634e+07 -1.78560680e+07
-1.94713390e+07 -2.86449567e+07 -1.96019023e+07 -3.17629113e+07]
[-3.52738012e+07 -5.40084146e+07 -3.34432450e+06 -3.70401382e+07
-5.17011641e+07 -3.66213012e+07 -5.02319719e+07 -3.61035772e+07
-5.19473275e+07 -3.66084135e+07 -5.32497076e+07 -3.46376898e+07
-5.30235161e+07 -5.11553976e+07 -5.41945141e+07 -3.54593340e+07
-3.70168837e+07 -4.93367102e+07 -3.72346816e+07 -5.38458497e+07]
[-3.91039904e+07 -5.72545740e+07 -6.81646313e+06 -4.06793924e+07
-5.52601525e+07 -4.03376896e+07 -5.39707753e+07 -3.98301900e+07
-5.54957353e+07 -4.03164072e+07 -5.66400188e+07 -3.86109570e+07
-5.64099458e+07 -5.47931276e+07 -5.73834178e+07 -3.93115758e+07
-4.06290636e+07 -5.26425323e+07 -4.08558623e+07 -5.71255285e+07]
[-2.30316158e+07 -3.39201163e+07 -5.30519947e+06 -2.40545254e+07
-3.26564367e+07 -2.37674106e+07 -3.17716370e+07 -2.34806897e+07
-3.27503744e+07 -2.37920472e+07 -3.34974396e+07 -2.26433742e+07
-3.33986970e+07 -3.23002988e+07 -3.40681784e+07 -2.31290179e+07
-2.40278387e+07 -3.12585152e+07 -2.41479640e+07 -3.38475969e+07]
[-7.70219397e+05 -1.42724573e+06 -1.60700511e+06 -9.61572951e+05
-1.25393029e+06 -7.55274658e+05 -9.76387178e+05 -7.89077388e+05
-1.12603916e+06 -8.40820038e+05 -1.27705579e+06 -5.20469619e+05
-1.37767929e+06 -1.07729972e+06 -1.61356689e+06 -7.02624452e+05
-9.48130007e+05 -1.46722160e+06 -9.25408003e+05 -1.42427656e+06]
[ 3.51855686e+06 8.44500318e+06 -3.64539055e+06 4.07730646e+06
7.56765461e+06 4.09917014e+06 7.21489250e+06 3.89032832e+06
7.82083297e+06 4.01563869e+06 8.24063995e+06 3.46449339e+06
8.04752392e+06 7.48544540e+06 8.33937023e+06 3.62573890e+06
4.15490292e+06 7.15288067e+06 4.21529230e+06 8.39173238e+06]
[-3.99011959e+05 5.21219852e+06 -6.56670686e+06 3.92191958e+05
3.99032031e+06 2.95248321e+05 3.37950639e+06 5.21825367e+04
4.25190520e+06 2.60035312e+05 4.86447637e+06 -6.48395467e+05
4.69660959e+06 3.79256372e+06 5.18397617e+06 -3.43024624e+05
5.14860042e+05 3.90799719e+06 5.51942485e+05 5.15083048e+06]
[-4.10401772e+06 6.28181813e+04 -7.51615989e+06 -3.45720629e+06
-9.73183520e+05 -3.57378040e+06 -1.53125275e+06 -3.79538734e+06
-7.71230970e+05 -3.56197970e+06 -2.43778867e+05 -4.39594123e+06
-3.41766360e+05 -1.14385686e+06 7.08751649e+04 -4.11203619e+06
-3.34269393e+06 -8.31440220e+05 -3.31599678e+06 2.22683556e+04]
[-5.18111327e+06 -1.96048817e+06 -7.62730261e+06 -4.65875501e+06
-2.82921598e+06 -4.78467359e+06 -3.32128565e+06 -4.97917655e+06
-2.67995755e+06 -4.74936737e+06 -2.23131590e+06 -5.48386868e+06
-2.27848812e+06 -2.96887414e+06 -1.91995649e+06 -5.21708406e+06
-4.57173618e+06 -2.61017690e+06 -4.53543962e+06 -1.99085069e+06]
[-3.59277141e+06 -1.21032012e+06 -6.36857586e+06 -3.20701606e+06
-1.86625666e+06 -3.32318005e+06 -2.24754772e+06 -3.47189525e+06
-1.76848083e+06 -3.28336062e+06 -1.42912340e+06 -3.85182397e+06
-1.43497558e+06 -1.97045180e+06 -1.14695721e+06 -3.62800296e+06
-3.15301487e+06 -1.67656964e+06 -3.11144163e+06 -1.23042963e+06]
[-2.02809870e+06 -4.92243015e+05 -4.47160873e+06 -1.77967980e+06
-9.23864735e+05 -1.86689451e+06 -1.17277923e+06 -1.96233816e+06
-8.68543060e+05 -1.83456112e+06 -6.46931611e+05 -2.21218592e+06
-6.33146029e+05 -9.92989694e+05 -4.29884178e+05 -2.05172785e+06
-1.75190262e+06 -7.89610219e+05 -1.71396315e+06 -5.01286177e+05]
[-1.45623054e+06 -8.48728984e+05 -2.59969902e+06 -1.34553282e+06
-1.05511796e+06 -1.39081027e+06 -1.17031607e+06 -1.43534742e+06
-1.02866153e+06 -1.36966695e+06 -9.26636008e+05 -1.55219080e+06
-9.09743379e+05 -1.08533122e+06 -8.11458974e+05 -1.47151174e+06
-1.33321917e+06 -9.55289921e+05 -1.31084981e+06 -8.48349926e+05]
[-7.39559114e+05 -7.25515109e+05 -8.46243203e+05 -7.33022017e+05
-7.54331599e+05 -7.40201099e+05 -7.68674352e+05 -7.49736699e+05
-7.48488541e+05 -7.30863747e+05 -7.36754133e+05 -7.60635952e+05
-7.26440687e+05 -7.52448520e+05 -7.18942628e+05 -7.46877999e+05
-7.31487239e+05 -7.20553014e+05 -7.25476447e+05 -7.22119256e+05]
[-3.20812736e+05 -4.14470574e+05 -1.44486599e+05 -3.32367619e+05
-4.03364741e+05 -3.29374588e+05 -3.95794824e+05 -3.27743437e+05
-4.03227409e+05 -3.27246935e+05 -4.10671858e+05 -3.19167326e+05
-4.07565062e+05 -3.98471233e+05 -4.17404168e+05 -3.23287698e+05
-3.31731729e+05 -3.91615945e+05 -3.33227707e+05 -4.13186080e+05]
[-4.22496350e+04 -6.09991384e+04 -4.76100603e+04 -4.42724041e+04
-5.85548174e+04 -4.39021571e+04 -5.68277623e+04 -4.29647885e+04
-5.85671754e+04 -4.34265999e+04 -6.03302819e+04 -4.15565361e+04
-5.94297931e+04 -5.80246306e+04 -6.13412689e+04 -4.23359128e+04
-4.41538233e+04 -5.63060404e+04 -4.46392074e+04 -6.04568570e+04]
[-6.76145055e+01 -5.74077915e+01 -1.69207232e+02 -6.56665130e+01
-6.28119737e+01 -6.28544802e+01 -6.69909489e+01 -6.54519748e+01
-6.29881976e+01 -6.40994467e+01 -5.91297841e+01 -6.93984078e+01
-6.07756850e+01 -6.52580897e+01 -5.66072185e+01 -6.87834494e+01
-6.22319397e+01 -5.95276646e+01 -6.39595845e+01 -5.69489719e+01]
[-5.77476878e-02 5.43104333e-01 -9.58727006e-01 -5.44839552e-01
9.67061386e-01 -8.80781909e-01 1.91012089e-01 9.96563423e-01
2.01574393e-01 -8.94732966e-01 -7.50652028e-01 7.90292857e-01
7.36834335e-01 9.75575996e-02 -4.74839546e-01 2.06954418e-02
-4.92452396e-01 3.80268869e-01 2.08248084e-01 5.75963012e-01]
[ 1.84222794e+03 3.68482213e+03 2.11955123e+03 2.12401838e+03
3.37565146e+03 2.03003737e+03 3.18134220e+03 2.00810138e+03
3.40454288e+03 2.02875359e+03 3.58674025e+03 1.76632606e+03
3.56313621e+03 3.28174996e+03 3.71396548e+03 1.85787310e+03
2.16558981e+03 3.30705536e+03 2.12696817e+03 3.66046151e+03]
[ 2.28923715e+04 4.52207213e+04 2.50503777e+04 2.62331405e+04
4.12368312e+04 2.51542273e+04 3.89816433e+04 2.49059428e+04
4.18087768e+04 2.51502810e+04 4.40011788e+04 2.19972975e+04
4.36172873e+04 4.01783037e+04 4.55137161e+04 2.31462614e+04
2.64863166e+04 4.05552700e+04 2.62750894e+04 4.48571852e+04]
[-2.24243946e+04 2.69835715e+04 -5.77632700e+04 -1.22635949e+04
1.31906293e+04 -1.45965005e+04 5.59015131e+03 -1.59817840e+04
1.52091914e+04 -1.45730649e+04 2.23593753e+04 -2.58170667e+04
2.11995235e+04 9.06061132e+03 2.76916455e+04 -2.20706077e+04
-1.00037475e+04 1.76652664e+04 -1.09810672e+04 2.68732029e+04]
[-1.39146310e+05 1.62357539e+05 -7.41911718e+05 -7.91567362e+04
7.09329074e+04 -9.79194004e+04 2.23567737e+04 -1.09520607e+05
8.21058578e+04 -9.44608950e+04 1.27920090e+05 -1.69254542e+05
1.27435212e+05 4.65041945e+04 1.77433484e+05 -1.37255001e+05
-7.12174249e+04 1.04079470e+05 -6.59011810e+04 1.65441278e+05]
[-5.67737549e+05 3.53714551e+05 -2.82344458e+06 -3.81261263e+05
5.69124518e+04 -4.43617946e+05 -1.01414874e+05 -4.87694586e+05
9.13879197e+04 -4.31076757e+05 2.39525497e+05 -6.74302413e+05
2.44117267e+05 -1.85580252e+04 4.11472382e+05 -5.65206916e+05
-3.56413379e+05 1.78000840e+05 -3.31608498e+05 3.66835083e+05]
[-2.40941818e+06 -1.19135202e+06 -5.85698350e+06 -2.13636838e+06
-1.66358005e+06 -2.21916632e+06 -1.91683020e+06 -2.29839269e+06
-1.60133875e+06 -2.19808405e+06 -1.37031379e+06 -2.58263552e+06
-1.36184903e+06 -1.77630539e+06 -1.11134285e+06 -2.41278174e+06
-2.08289639e+06 -1.40883101e+06 -2.05049227e+06 -1.16558843e+06]
[-5.25116592e+06 -4.23254483e+06 -8.99320998e+06 -4.97496005e+06
-4.77960834e+06 -5.04228620e+06 -5.06753294e+06 -5.15013177e+06
-4.69212650e+06 -5.01418190e+06 -4.43343857e+06 -5.45464042e+06
-4.41823672e+06 -4.88966650e+06 -4.16446539e+06 -5.26764369e+06
-4.89219149e+06 -4.38511468e+06 -4.86230748e+06 -4.19758214e+06]
[-9.40139452e+06 -9.61844898e+06 -1.11400769e+07 -9.28164074e+06
-1.00268030e+07 -9.26978134e+06 -1.02128672e+07 -9.38002816e+06
-9.91837421e+06 -9.24256488e+06 -9.75052917e+06 -9.54751044e+06
-9.73169753e+06 -1.00571086e+07 -9.62212690e+06 -9.43659078e+06
-9.17998997e+06 -9.48600325e+06 -9.16742761e+06 -9.58141188e+06]
[-1.20346078e+07 -1.51368943e+07 -9.59505713e+06 -1.23677904e+07
-1.49489937e+07 -1.21874001e+07 -1.47681277e+07 -1.22392421e+07
-1.48603963e+07 -1.21674374e+07 -1.50229651e+07 -1.19605190e+07
-1.49913920e+07 -1.47868849e+07 -1.52802935e+07 -1.20903799e+07
-1.22858810e+07 -1.43988487e+07 -1.23040875e+07 -1.50781071e+07]
[-1.18396460e+07 -1.95380314e+07 -4.27718888e+06 -1.29050446e+07
-1.82855170e+07 -1.24995759e+07 -1.74638052e+07 -1.24114882e+07
-1.82832627e+07 -1.24947552e+07 -1.90202352e+07 -1.13891862e+07
-1.89370972e+07 -1.78446053e+07 -1.98259371e+07 -1.19050451e+07
-1.28880945e+07 -1.78471066e+07 -1.29425385e+07 -1.94208125e+07]
[-1.39835173e+07 -2.71481978e+07 1.28429134e+05 -1.57490557e+07
-2.48518844e+07 -1.51839211e+07 -2.34062274e+07 -1.48963756e+07
-2.49810044e+07 -1.51851183e+07 -2.62800489e+07 -1.32113104e+07
-2.61050324e+07 -2.41855257e+07 -2.74963555e+07 -1.40719629e+07
-1.57912733e+07 -2.42099333e+07 -1.58984337e+07 -2.69667780e+07]
[-2.56266786e+07 -4.34834319e+07 -1.79212755e+06 -2.76568830e+07
-4.08223231e+07 -2.71154869e+07 -3.91484448e+07 -2.66405691e+07
-4.10688321e+07 -2.70958391e+07 -4.25760930e+07 -2.48379244e+07
-4.22948247e+07 -4.01340650e+07 -4.37468277e+07 -2.57797564e+07
-2.76832574e+07 -3.92464521e+07 -2.78665387e+07 -4.32828654e+07]
[-3.90658083e+07 -5.88016130e+07 -8.01776108e+06 -4.09304148e+07
-5.64394762e+07 -4.05252375e+07 -5.49435032e+07 -3.99680659e+07
-5.67338662e+07 -4.04744251e+07 -5.80928547e+07 -3.84968080e+07
-5.77583200e+07 -5.58836334e+07 -5.89326809e+07 -3.92932966e+07
-4.08940748e+07 -5.38595518e+07 -4.11366178e+07 -5.86283729e+07]
[-3.69036369e+07 -5.31589139e+07 -1.06240319e+07 -3.83036290e+07
-5.14525365e+07 -3.80163166e+07 -5.03256966e+07 -3.75543043e+07
-5.16796285e+07 -3.79793674e+07 -5.26879337e+07 -3.65300102e+07
-5.24223761e+07 -5.10501022e+07 -5.32252603e+07 -3.71055777e+07
-3.82469696e+07 -4.90300399e+07 -3.84508292e+07 -5.30386967e+07]
[-1.58438612e+07 -2.33971821e+07 -6.48939479e+06 -1.65718017e+07
-2.25474021e+07 -1.63391296e+07 -2.18875586e+07 -1.61421084e+07
-2.25918039e+07 -1.63731320e+07 -2.31253169e+07 -1.55519822e+07
-2.30609736e+07 -2.22839697e+07 -2.35041306e+07 -1.58940165e+07
-1.65543945e+07 -2.16180307e+07 -1.66114217e+07 -2.33348287e+07]
[ 2.83845288e+06 3.16119739e+06 -1.40469273e+06 2.73896452e+06
3.21913707e+06 2.92087577e+06 3.42497327e+06 2.86749339e+06
3.35444642e+06 2.83160428e+06 3.26661976e+06 3.06021385e+06
3.14585706e+06 3.34560340e+06 3.00120211e+06 2.92389511e+06
2.74166662e+06 2.85140963e+06 2.79746497e+06 3.17992894e+06]
[ 4.29261527e+06 8.16901302e+06 -2.44008621e+06 4.71872041e+06
7.50819178e+06 4.75317021e+06 7.25977150e+06 4.57962596e+06
7.73122985e+06 4.68376627e+06 8.04152885e+06 4.28515002e+06
7.86596574e+06 7.44887079e+06 8.06630026e+06 4.38621384e+06
4.77749128e+06 7.12197383e+06 4.83903525e+06 8.15308750e+06]
[-1.84231194e+06 2.19371061e+06 -5.29226059e+06 -1.23592683e+06
1.25007715e+06 -1.30899010e+06 7.83091635e+05 -1.51140046e+06
1.48143543e+06 -1.32138235e+06 1.95086466e+06 -2.03494780e+06
1.81359509e+06 1.10600574e+06 2.15063563e+06 -1.81371866e+06
-1.12894316e+06 1.27899962e+06 -1.10122307e+06 2.16751765e+06]
[-5.92967796e+06 -2.33241378e+06 -7.33017744e+06 -5.31234068e+06
-3.32037427e+06 -5.44104520e+06 -3.85116205e+06 -5.64877166e+06
-3.11988747e+06 -5.41023046e+06 -2.61754939e+06 -6.22716009e+06
-2.70174970e+06 -3.47870759e+06 -2.32655969e+06 -5.95642531e+06
-5.19972540e+06 -3.05703008e+06 -5.17744461e+06 -2.36298378e+06]
[-6.50438269e+06 -3.92829195e+06 -7.48759136e+06 -6.02972311e+06
-4.72705491e+06 -6.15047356e+06 -5.17540799e+06 -6.32622861e+06
-4.57679984e+06 -6.10312798e+06 -4.16895525e+06 -6.79104322e+06
-4.20689500e+06 -4.84816805e+06 -3.90408151e+06 -6.55339948e+06
-5.94087234e+06 -4.40390722e+06 -5.91493488e+06 -3.94929250e+06]
[-4.54169654e+06 -2.76728019e+06 -5.92762888e+06 -4.21509438e+06
-3.33128801e+06 -4.31679868e+06 -3.65485723e+06 -4.44236919e+06
-3.23542436e+06 -4.26996178e+06 -2.94764000e+06 -4.77046131e+06
-2.95004518e+06 -3.41527942e+06 -2.72810872e+06 -4.58417620e+06
-4.16167366e+06 -3.08350222e+06 -4.13209615e+06 -2.77717056e+06]
[-3.06482724e+06 -2.17386211e+06 -4.39488587e+06 -2.88476960e+06
-2.50930843e+06 -2.95239231e+06 -2.69668546e+06 -3.02343891e+06
-2.45770405e+06 -2.91442543e+06 -2.29320551e+06 -3.21675133e+06
-2.27214625e+06 -2.55654453e+06 -2.13412226e+06 -3.09537803e+06
-2.85655270e+06 -2.31617995e+06 -2.83170282e+06 -2.17399589e+06]
[-1.85212286e+06 -1.71474814e+06 -2.52015925e+06 -1.80293294e+06
-1.83256614e+06 -1.83038907e+06 -1.89385823e+06 -1.85579667e+06
-1.81258836e+06 -1.80573301e+06 -1.76135207e+06 -1.91909718e+06
-1.73638907e+06 -1.84283033e+06 -1.69487044e+06 -1.87110413e+06
-1.79238754e+06 -1.71515584e+06 -1.78001325e+06 -1.70730157e+06]
[-1.37002051e+06 -1.69837706e+06 -1.16931973e+06 -1.39672682e+06
-1.68456331e+06 -1.39442114e+06 -1.67250265e+06 -1.39324192e+06
-1.68155025e+06 -1.38202667e+06 -1.69588073e+06 -1.37881090e+06
-1.67891914e+06 -1.67368506e+06 -1.69978750e+06 -1.38119754e+06
-1.39254309e+06 -1.60843107e+06 -1.39364870e+06 -1.68962466e+06]
[-5.45248736e+05 -7.56073469e+05 -3.26102142e+05 -5.66177973e+05
-7.33362075e+05 -5.61459054e+05 -7.18053471e+05 -5.55977643e+05
-7.34235489e+05 -5.57385229e+05 -7.49360558e+05 -5.41220843e+05
-7.42452640e+05 -7.26667293e+05 -7.59992871e+05 -5.48957376e+05
-5.64589967e+05 -7.02847138e+05 -5.67811758e+05 -7.51936658e+05]
[-9.36200449e+04 -1.39599123e+05 -5.55831728e+04 -9.80910472e+04
-1.34120584e+05 -9.71132017e+04 -1.30406666e+05 -9.54770265e+04
-1.34499268e+05 -9.63578921e+04 -1.38098777e+05 -9.22862505e+04
-1.36562248e+05 -1.33073054e+05 -1.40247343e+05 -9.40641862e+04
-9.76985379e+04 -1.28219870e+05 -9.85130168e+04 -1.38374351e+05]
[-1.23574618e+02 -1.04117451e+02 -3.11673148e+02 -1.20218962e+02
-1.14816557e+02 -1.17657811e+02 -1.24270667e+02 -1.21179819e+02
-1.13261539e+02 -1.18169825e+02 -1.08274393e+02 -1.28001465e+02
-1.09788919e+02 -1.20121950e+02 -1.04308464e+02 -1.24943878e+02
-1.14252243e+02 -1.07892523e+02 -1.16745035e+02 -1.03721818e+02]
[ 9.76732380e-01 2.87071168e-01 1.24507552e-01 -8.27086724e-01
-9.52937112e-02 -8.60552636e-01 -2.56877450e-02 -9.68819347e-01
-7.16946738e-01 2.37858619e-01 3.52303544e-01 2.07449618e-01
-4.98050790e-01 -8.67628455e-01 3.54549848e-01 5.36679257e-01
-7.61449970e-01 4.79122986e-01 5.46376626e-01 -7.80054927e-01]
[-1.62751403e+04 -1.79960841e+04 -1.49288979e+03 -1.58966604e+04
-1.85740000e+04 -1.60983357e+04 -1.89338457e+04 -1.60513312e+04
-1.86406096e+04 -1.60604980e+04 -1.83248380e+04 -1.66030549e+04
-1.82522625e+04 -1.88109337e+04 -1.78130795e+04 -1.63736875e+04
-1.57532960e+04 -1.71944823e+04 -1.58497036e+04 -1.80146105e+04]
[ 3.19266717e+04 7.06457967e+04 3.26232814e+04 3.80407775e+04
6.33880830e+04 3.60387736e+04 5.91793003e+04 3.55174490e+04
6.41469758e+04 3.60732296e+04 6.81872940e+04 3.00701777e+04
6.78134652e+04 6.13246307e+04 7.14574038e+04 3.23248568e+04
3.87085978e+04 6.28765063e+04 3.82311938e+04 7.00716492e+04]
[-1.80737082e+05 -1.64002154e+05 -9.54590793e+04 -1.68839975e+05
-1.79585075e+05 -1.73171068e+05 -1.86808849e+05 -1.72086252e+05
-1.76612691e+05 -1.71323855e+05 -1.69684858e+05 -1.84848633e+05
-1.68416084e+05 -1.84729667e+05 -1.62889636e+05 -1.80851593e+05
-1.65094951e+05 -1.61119793e+05 -1.68150091e+05 -1.62931891e+05]
[-6.75361095e+05 -5.59043467e+05 -9.59390864e+05 -6.17089633e+05
-6.48483023e+05 -6.41348730e+05 -6.90917055e+05 -6.45136999e+05
-6.35816682e+05 -6.30865660e+05 -5.94894758e+05 -7.08583639e+05
-5.86524324e+05 -6.74728854e+05 -5.42156003e+05 -6.77828621e+05
-6.05313329e+05 -5.60329657e+05 -6.03604525e+05 -5.49236506e+05]
[-1.95559325e+06 -1.62770398e+06 -3.30915573e+06 -1.80598989e+06
-1.87511977e+06 -1.86735765e+06 -1.99715982e+06 -1.89276466e+06
-1.83963372e+06 -1.84028657e+06 -1.72509252e+06 -2.05393065e+06
-1.70525498e+06 -1.94198752e+06 -1.57648175e+06 -1.96509736e+06
-1.77670125e+06 -1.64261994e+06 -1.75900998e+06 -1.59776237e+06]
[-4.40287926e+06 -4.52869757e+06 -5.76805144e+06 -4.26351955e+06
-4.81040571e+06 -4.32529672e+06 -4.94203766e+06 -4.36340914e+06
-4.75723707e+06 -4.28105549e+06 -4.63722476e+06 -4.52944172e+06
-4.60385617e+06 -4.87890676e+06 -4.47321879e+06 -4.42941740e+06
-4.21829416e+06 -4.41571803e+06 -4.19201206e+06 -4.47151013e+06]
[-7.44521975e+06 -8.71257454e+06 -7.68265562e+06 -7.45898159e+06
-8.83949281e+06 -7.47122280e+06 -8.87077620e+06 -7.50701917e+06
-8.78419982e+06 -7.41296196e+06 -8.76063136e+06 -7.53830841e+06
-8.69472755e+06 -8.84245211e+06 -8.68760797e+06 -7.49410950e+06
-7.40585306e+06 -8.33365839e+06 -7.38572300e+06 -8.63374287e+06]
[-1.03600689e+07 -1.41234238e+07 -7.77878904e+06 -1.07715794e+07
-1.37503869e+07 -1.06530969e+07 -1.34782249e+07 -1.06442498e+07
-1.37190441e+07 -1.05888583e+07 -1.39789381e+07 -1.02956195e+07
-1.38633499e+07 -1.35810553e+07 -1.41913736e+07 -1.04365549e+07
-1.07321522e+07 -1.32069676e+07 -1.07400548e+07 -1.40259962e+07]
[-1.19149392e+07 -1.98481356e+07 -4.89245945e+06 -1.30115615e+07
-1.85417380e+07 -1.26753941e+07 -1.77095343e+07 -1.25596727e+07
-1.85799198e+07 -1.26167660e+07 -1.93517287e+07 -1.15367496e+07
-1.91706394e+07 -1.80949001e+07 -2.00633197e+07 -1.20177183e+07
-1.30194635e+07 -1.80617148e+07 -1.30687603e+07 -1.97157986e+07]
[-1.36844176e+07 -2.67489966e+07 -7.66709000e+05 -1.55306635e+07
-2.43701101e+07 -1.49886439e+07 -2.28934704e+07 -1.47074739e+07
-2.45197542e+07 -1.49394129e+07 -2.58728861e+07 -1.29592151e+07
-2.56091131e+07 -2.36507424e+07 -2.70748540e+07 -1.38102192e+07
-1.56004434e+07 -2.38441029e+07 -1.56967099e+07 -2.65647306e+07]
[-1.98555000e+07 -3.68712381e+07 -2.83643583e+05 -2.20465579e+07
-3.39887625e+07 -2.14624808e+07 -3.22029467e+07 -2.10228124e+07
-3.42383941e+07 -2.14098669e+07 -3.58697002e+07 -1.90125018e+07
-3.55258588e+07 -3.31903498e+07 -3.71746821e+07 -2.00138457e+07
-2.21253243e+07 -3.29588913e+07 -2.22801875e+07 -3.66610210e+07]
[-3.03615651e+07 -4.88880855e+07 -4.67303537e+06 -3.23719406e+07
-4.62855660e+07 -3.19183404e+07 -4.46547286e+07 -3.13912923e+07
-4.65808542e+07 -3.18459847e+07 -4.80727018e+07 -2.96982954e+07
-4.76859407e+07 -4.56238086e+07 -4.90603782e+07 -3.05663397e+07
-3.23973962e+07 -4.43894711e+07 -3.26035715e+07 -4.86971199e+07]
[-3.91616138e+07 -5.59413788e+07 -1.14733922e+07 -4.05852249e+07
-5.42187788e+07 -4.03468872e+07 -5.30929740e+07 -3.98441376e+07
-5.44840974e+07 -4.02660878e+07 -5.55127212e+07 -3.88492174e+07
-5.51556848e+07 -5.38235238e+07 -5.59507941e+07 -3.93920206e+07
-4.05301603e+07 -5.16241740e+07 -4.07494272e+07 -5.58137967e+07]
[-2.98000689e+07 -4.13597587e+07 -1.13536742e+07 -3.06973285e+07
-4.03362586e+07 -3.05471685e+07 -3.95948098e+07 -3.01935889e+07
-4.05010419e+07 -3.05144338e+07 -4.11456516e+07 -2.96238419e+07
-4.09195321e+07 -4.00910136e+07 -4.13374055e+07 -2.99512029e+07
-3.06501012e+07 -3.83888324e+07 -3.07830829e+07 -4.12849959e+07]
[-9.15262679e+06 -1.34219872e+07 -5.85694999e+06 -9.55174563e+06
-1.30013322e+07 -9.39865431e+06 -1.25818833e+07 -9.28454862e+06
-1.29954269e+07 -9.43836541e+06 -1.32971979e+07 -8.96315274e+06
-1.32726858e+07 -1.28369928e+07 -1.34815188e+07 -9.15719274e+06
-9.54895428e+06 -1.24727294e+07 -9.54405836e+06 -1.33782281e+07]
[ 3.06809788e+06 3.43982771e+06 -1.68729192e+06 3.00980115e+06
3.44944672e+06 3.15802520e+06 3.61480534e+06 3.10048108e+06
3.58097517e+06 3.08911192e+06 3.52207303e+06 3.25051478e+06
3.41184435e+06 3.54985233e+06 3.30599688e+06 3.14010180e+06
3.00820734e+06 3.14688266e+06 3.07809559e+06 3.47302393e+06]
[ 1.83753453e+06 3.64904540e+06 -2.22889230e+06 2.02125900e+06
3.32079526e+06 2.09138145e+06 3.24575233e+06 1.96363374e+06
3.50419341e+06 2.05545677e+06 3.63807674e+06 1.88751540e+06
3.51302026e+06 3.33666995e+06 3.52682359e+06 1.88808303e+06
2.06278051e+06 3.11300891e+06 2.11705403e+06 3.67226495e+06]
[-3.64951861e+06 -1.47704174e+06 -4.44368671e+06 -3.28959657e+06
-2.07467649e+06 -3.32299733e+06 -2.34864269e+06 -3.48006395e+06
-1.88114452e+06 -3.30471419e+06 -1.59620759e+06 -3.77059995e+06
-1.68038570e+06 -2.12792216e+06 -1.54556134e+06 -3.65491264e+06
-3.20961908e+06 -1.94585233e+06 -3.18408696e+06 -1.47126584e+06]
[-7.81995960e+06 -5.71837208e+06 -6.71463401e+06 -7.38395655e+06
-6.45343263e+06 -7.48176362e+06 -6.83051148e+06 -7.64484679e+06
-6.27379214e+06 -7.42861925e+06 -5.91247143e+06 -8.05533199e+06
-5.95497786e+06 -6.54153213e+06 -5.73779995e+06 -7.86631615e+06
-7.28831557e+06 -6.07821807e+06 -7.27391243e+06 -5.72633451e+06]
[-7.77804769e+06 -6.51069730e+06 -6.88508501e+06 -7.45678079e+06
-7.08878694e+06 -7.54519967e+06 -7.39454957e+06 -7.67410846e+06
-6.95245427e+06 -7.48403591e+06 -6.67111592e+06 -7.99670342e+06
-6.68069851e+06 -7.15254066e+06 -6.51433885e+06 -7.83688909e+06
-7.38045400e+06 -6.67396190e+06 -7.36572328e+06 -6.51102066e+06]
[-5.55483224e+06 -4.84023271e+06 -5.24919825e+06 -5.34745342e+06
-5.22608020e+06 -5.41898694e+06 -5.43439905e+06 -5.50168568e+06
-5.14159373e+06 -5.36323246e+06 -4.95637336e+06 -5.72146365e+06
-4.94182083e+06 -5.27248016e+06 -4.82876981e+06 -5.60251873e+06
-5.29941056e+06 -4.90513289e+06 -5.28450405e+06 -4.83020985e+06]
[-3.73119580e+06 -3.74139737e+06 -3.68569292e+06 -3.66370833e+06
-3.90446509e+06 -3.69974791e+06 -3.98486500e+06 -3.73262331e+06
-3.86480420e+06 -3.65695567e+06 -3.79742490e+06 -3.82070571e+06
-3.76346762e+06 -3.91645117e+06 -3.72901853e+06 -3.76341448e+06
-3.64069042e+06 -3.67751869e+06 -3.63129634e+06 -3.72390232e+06]
[-2.77508383e+06 -3.30960277e+06 -2.46819294e+06 -2.79701441e+06
-3.32441894e+06 -2.80359486e+06 -3.32060462e+06 -2.80252169e+06
-3.31136071e+06 -2.77577695e+06 -3.32013586e+06 -2.80518346e+06
-3.28675601e+06 -3.31522469e+06 -3.30732104e+06 -2.79696246e+06
-2.78540802e+06 -3.14935982e+06 -2.78606052e+06 -3.29043252e+06]
[-1.91449630e+06 -2.57989938e+06 -1.28097789e+06 -1.97197634e+06
-2.52352253e+06 -1.96261512e+06 -2.48198561e+06 -1.94733422e+06
-2.52340528e+06 -1.94750927e+06 -2.56461680e+06 -1.90889810e+06
-2.54046093e+06 -2.50540601e+06 -2.58609143e+06 -1.92723705e+06
-1.96649135e+06 -2.40714193e+06 -1.97310731e+06 -2.56397672e+06]
[-8.65476835e+05 -1.20229162e+06 -5.22145274e+05 -8.93707188e+05
-1.17158701e+06 -8.88111046e+05 -1.14926006e+06 -8.78064177e+05
-1.17279317e+06 -8.81986260e+05 -1.19441050e+06 -8.59979155e+05
-1.18358061e+06 -1.16409783e+06 -1.20628863e+06 -8.70406281e+05
-8.90510336e+05 -1.11541996e+06 -8.95457692e+05 -1.19485800e+06]
[-1.45021532e+05 -2.07906182e+05 -7.01563380e+04 -1.50466222e+05
-2.01479706e+05 -1.49393004e+05 -1.97009287e+05 -1.47198707e+05
-2.01947650e+05 -1.48324959e+05 -2.06331645e+05 -1.43683476e+05
-2.04223216e+05 -2.00320692e+05 -2.08611462e+05 -1.45773749e+05
-1.49761321e+05 -1.91968741e+05 -1.50917512e+05 -2.06302598e+05]
[-8.12916120e+03 -1.08916798e+04 -4.85424356e+03 -8.30893413e+03
-1.07095778e+04 -8.28104410e+03 -1.05780599e+04 -8.19214040e+03
-1.07144893e+04 -8.24219705e+03 -1.08564681e+04 -8.09878411e+03
-1.07782857e+04 -1.06787331e+04 -1.08977114e+04 -8.16381482e+03
-8.27489090e+03 -1.01426174e+04 -8.32627033e+03 -1.08410642e+04]
[-1.62983326e+02 1.12507720e+03 -2.28064521e+03 6.08940134e+01
7.93634903e+02 3.61210241e+01 6.25379709e+02 1.89948683e+00
8.74980276e+02 1.57020144e+01 1.03541363e+03 -1.88397929e+02
9.84008138e+02 7.42850636e+02 1.13686072e+03 -1.02737093e+02
6.72626556e+01 8.71275114e+02 9.71534404e+01 1.09468530e+03]
[-1.53603958e+03 -1.47748360e+03 5.57270428e+01 -1.46027588e+03
-1.57985257e+03 -1.49440367e+03 -1.64400152e+03 -1.49178031e+03
-1.58415178e+03 -1.48973279e+03 -1.52620470e+03 -1.58167237e+03
-1.52338280e+03 -1.61720613e+03 -1.45550595e+03 -1.54446308e+03
-1.44012232e+03 -1.44349617e+03 -1.45537333e+03 -1.48439546e+03]
[ 4.64281408e+04 1.06502681e+05 3.25423827e+04 5.58802624e+04
9.50012209e+04 5.29209975e+04 8.84646660e+04 5.19102266e+04
9.62341959e+04 5.29534379e+04 1.02576951e+05 4.34705696e+04
1.01966546e+05 9.18638605e+04 1.07788939e+05 4.70672457e+04
5.68809156e+04 9.43025208e+04 5.63788958e+04 1.05645236e+05]
[-3.19109230e+05 -2.94388355e+05 -8.11975453e+04 -2.98589135e+05
-3.19843104e+05 -3.07240386e+05 -3.30719031e+05 -3.03749102e+05
-3.14587406e+05 -3.03098086e+05 -3.03693566e+05 -3.25701229e+05
-3.00239540e+05 -3.28235982e+05 -2.92397894e+05 -3.19159444e+05
-2.92536830e+05 -2.87367256e+05 -2.98347788e+05 -2.92324526e+05]
[-1.11412106e+06 -1.10110588e+06 -8.99865452e+05 -1.05354142e+06
-1.18963874e+06 -1.08319875e+06 -1.22668680e+06 -1.07829361e+06
-1.17306429e+06 -1.06567365e+06 -1.13656277e+06 -1.14654675e+06
-1.12064910e+06 -1.21786682e+06 -1.08543215e+06 -1.11824853e+06
-1.03761897e+06 -1.06570298e+06 -1.04218301e+06 -1.08539877e+06]
[-2.58903698e+06 -2.70665575e+06 -2.92743624e+06 -2.48119991e+06
-2.88366166e+06 -2.53475956e+06 -2.95907065e+06 -2.54335940e+06
-2.84544217e+06 -2.49677548e+06 -2.77166068e+06 -2.66299500e+06
-2.74786783e+06 -2.93621249e+06 -2.67403167e+06 -2.60527029e+06
-2.45346193e+06 -2.60973597e+06 -2.44125268e+06 -2.66218569e+06]
[-5.01658981e+06 -5.99182955e+06 -4.51753393e+06 -4.97612083e+06
-6.10798397e+06 -5.01268827e+06 -6.13467345e+06 -5.02606591e+06
-6.05391044e+06 -4.95610399e+06 -6.02298301e+06 -5.08245870e+06
-5.99321941e+06 -6.13660084e+06 -5.97452241e+06 -5.05464286e+06
-4.94283119e+06 -5.68424238e+06 -4.91697045e+06 -5.91082350e+06]
[-6.98483201e+06 -9.82696092e+06 -4.62558710e+06 -7.24253217e+06
-9.55838405e+06 -7.19541556e+06 -9.35458783e+06 -7.18008094e+06
-9.52574291e+06 -7.12402410e+06 -9.71074110e+06 -6.94366144e+06
-9.63328451e+06 -9.46241793e+06 -9.85961446e+06 -7.04631196e+06
-7.22767144e+06 -9.11787699e+06 -7.20644727e+06 -9.71244854e+06]
[-8.63824628e+06 -1.49271355e+07 -3.21685441e+06 -9.47556030e+06
-1.38860924e+07 -9.26204528e+06 -1.32230566e+07 -9.16437874e+06
-1.39161581e+07 -9.18104950e+06 -1.45299294e+07 -8.36397940e+06
-1.43618878e+07 -1.35490027e+07 -1.50588086e+07 -8.73130267e+06
-9.50101152e+06 -1.34886591e+07 -9.51279488e+06 -1.47821339e+07]
[-1.19690512e+07 -2.33410229e+07 -1.24961240e+06 -1.35781766e+07
-2.12620506e+07 -1.31460083e+07 -1.99839462e+07 -1.29136839e+07
-2.13886913e+07 -1.30586541e+07 -2.25734551e+07 -1.13842699e+07
-2.23041537e+07 -2.06264583e+07 -2.36038310e+07 -1.21099252e+07
-1.36540237e+07 -2.07912031e+07 -1.37179363e+07 -2.31556220e+07]
[-1.77450304e+07 -3.35506244e+07 -3.56193786e+05 -1.98914497e+07
-3.07385036e+07 -1.93350015e+07 -2.90203030e+07 -1.89554692e+07
-3.09621805e+07 -1.92422612e+07 -3.25527415e+07 -1.69604044e+07
-3.21918723e+07 -2.99213225e+07 -3.38661657e+07 -1.79297377e+07
-1.99915758e+07 -2.99496483e+07 -2.01165504e+07 -3.33404428e+07]
[-2.55796485e+07 -4.28951864e+07 -3.35183165e+06 -2.76479661e+07
-4.02117744e+07 -2.71678416e+07 -3.85568897e+07 -2.67054792e+07
-4.04792190e+07 -2.70663974e+07 -4.20116576e+07 -2.48930717e+07
-4.16089841e+07 -3.94736615e+07 -4.31231527e+07 -2.57955104e+07
-2.77083832e+07 -3.87742648e+07 -2.78850321e+07 -4.27036824e+07]
[-3.34329707e+07 -4.93278040e+07 -8.86024263e+06 -3.49607861e+07
-4.74371913e+07 -3.46828251e+07 -4.62379445e+07 -3.42240799e+07
-4.76844398e+07 -3.45752530e+07 -4.87983366e+07 -3.30576796e+07
-4.84216913e+07 -4.69560725e+07 -4.93997844e+07 -3.36641376e+07
-3.49461129e+07 -4.53175648e+07 -3.51419908e+07 -4.91888463e+07]
[-3.52712055e+07 -4.73530551e+07 -1.36463158e+07 -3.61037020e+07
-4.64552395e+07 -3.60295933e+07 -4.58194419e+07 -3.56575183e+07
-4.66376691e+07 -3.59422788e+07 -4.72179856e+07 -3.52211293e+07
-4.69280126e+07 -4.62542174e+07 -4.72815362e+07 -3.54773902e+07
-3.60323490e+07 -4.41235624e+07 -3.61956280e+07 -4.72839725e+07]
[-2.36033801e+07 -3.05330009e+07 -1.19229928e+07 -2.39686433e+07
-3.02370920e+07 -2.39418144e+07 -2.99175856e+07 -2.37295711e+07
-3.03076792e+07 -2.39160748e+07 -3.05531359e+07 -2.36199960e+07
-3.04116013e+07 -3.01486149e+07 -3.04627641e+07 -2.37110422e+07
-2.39145954e+07 -2.86761046e+07 -2.39796835e+07 -3.05077011e+07]
[-6.66549991e+06 -8.93795902e+06 -5.99497463e+06 -6.82947488e+06
-8.83421706e+06 -6.74198270e+06 -8.60994195e+06 -6.69892345e+06
-8.78496823e+06 -6.77140393e+06 -8.90817937e+06 -6.57358944e+06
-8.91375735e+06 -8.73258638e+06 -8.97575784e+06 -6.66464717e+06
-6.82396898e+06 -8.45130970e+06 -6.78862931e+06 -8.91429724e+06]
[ 1.73947037e+05 -5.86854131e+04 -2.82136672e+06 8.85997488e+04
-3.16182489e+04 2.15559209e+05 1.17313292e+05 1.50882343e+05
9.60475199e+04 1.83819611e+05 3.22071002e+04 3.08975562e+05
-4.77956513e+04 7.97311539e+04 -1.91506388e+05 2.01910039e+05
9.53173544e+04 -1.44911611e+05 1.55155085e+05 -1.85570845e+04]
[-2.87559919e+06 -2.52862380e+06 -3.34397918e+06 -2.82903985e+06
-2.70399838e+06 -2.75470038e+06 -2.71037781e+06 -2.86438741e+06
-2.53565150e+06 -2.74708027e+06 -2.48649025e+06 -2.83693638e+06
-2.55861732e+06 -2.63724792e+06 -2.66305426e+06 -2.87817746e+06
-2.78563264e+06 -2.65427104e+06 -2.74727372e+06 -2.48890081e+06]
[-7.05434954e+06 -6.68629421e+06 -4.78819939e+06 -6.91092819e+06
-7.00594397e+06 -6.90471482e+06 -7.12312029e+06 -7.02467510e+06
-6.83594000e+06 -6.85527964e+06 -6.70505759e+06 -7.12382942e+06
-6.74167649e+06 -6.97839202e+06 -6.78752918e+06 -7.09755373e+06
-6.84337923e+06 -6.70892622e+06 -6.82729241e+06 -6.65382648e+06]
[-8.67299726e+06 -8.13968275e+06 -5.69037975e+06 -8.45402699e+06
-8.56863099e+06 -8.50173788e+06 -8.76283590e+06 -8.61482114e+06
-8.41455436e+06 -8.43480829e+06 -8.22192951e+06 -8.81929810e+06
-8.23103733e+06 -8.57902283e+06 -8.19447251e+06 -8.73172363e+06
-8.37962828e+06 -8.14319785e+06 -8.37270290e+06 -8.12055495e+06]
[-7.77301028e+06 -7.75144909e+06 -5.49900034e+06 -7.61563048e+06
-8.07974344e+06 -7.66353337e+06 -8.22852347e+06 -7.73863307e+06
-7.96734235e+06 -7.59754581e+06 -7.82465438e+06 -7.90524403e+06
-7.81185659e+06 -8.09179926e+06 -7.78191677e+06 -7.83176966e+06
-7.55466550e+06 -7.63647155e+06 -7.55121132e+06 -7.72760383e+06]
[-6.17934529e+06 -6.70603920e+06 -4.17595591e+06 -6.12587810e+06
-6.86270769e+06 -6.15664445e+06 -6.92207608e+06 -6.18554524e+06
-6.79658455e+06 -6.09788114e+06 -6.74214085e+06 -6.26313104e+06
-6.70942013e+06 -6.86189571e+06 -6.72241097e+06 -6.22760269e+06
-6.08741249e+06 -6.49054313e+06 -6.08829895e+06 -6.67326870e+06]
[-4.37279882e+06 -5.34717036e+06 -2.76453887e+06 -4.42093092e+06
-5.33494454e+06 -4.42354415e+06 -5.30294212e+06 -4.41461943e+06
-5.30866378e+06 -4.38029179e+06 -5.34000445e+06 -4.39589752e+06
-5.29702617e+06 -5.31368786e+06 -5.36044181e+06 -4.40560067e+06
-4.40165041e+06 -5.06442623e+06 -4.40803549e+06 -5.31140902e+06]
[-3.41812495e+06 -4.59615681e+06 -1.88125671e+06 -3.51741616e+06
-4.49624371e+06 -3.50140392e+06 -4.42054097e+06 -3.47391915e+06
-4.49261839e+06 -3.47258289e+06 -4.56538798e+06 -3.40670639e+06
-4.52671599e+06 -4.46572015e+06 -4.61202890e+06 -3.44185923e+06
-3.50776218e+06 -4.29001334e+06 -3.51843762e+06 -4.56423774e+06]
[-2.15367599e+06 -2.98090400e+06 -1.10265626e+06 -2.22512685e+06
-2.90277549e+06 -2.21273882e+06 -2.84573442e+06 -2.18793757e+06
-2.90486734e+06 -2.19699535e+06 -2.95938838e+06 -2.13938571e+06
-2.93296779e+06 -2.88305515e+06 -2.98956618e+06 -2.16622009e+06
-2.21917610e+06 -2.76872132e+06 -2.22890989e+06 -2.96101122e+06]
[-7.46426191e+05 -1.04900112e+06 -4.12181668e+05 -7.71315770e+05
-1.02115612e+06 -7.66732728e+05 -1.00105913e+06 -7.57014830e+05
-1.02248094e+06 -7.61358260e+05 -1.04199193e+06 -7.41085195e+05
-1.03227188e+06 -1.01508092e+06 -1.05186749e+06 -7.50319443e+05
-7.68730960e+05 -9.70741480e+05 -7.73052870e+05 -1.04200220e+06]
[-7.73846392e+04 -1.08124329e+05 -3.96961287e+04 -7.97494883e+04
-1.05431708e+05 -7.93686343e+04 -1.03620796e+05 -7.82956859e+04
-1.05653189e+05 -7.88881318e+04 -1.07525978e+05 -7.69305722e+04
-1.06567562e+05 -1.05021742e+05 -1.08331176e+05 -7.77754465e+04
-7.93951318e+04 -1.00076091e+05 -7.99659138e+04 -1.07438274e+05]
[-2.22317593e+04 -2.44821629e+04 -1.42554236e+04 -2.18182037e+04
-2.51303686e+04 -2.21422069e+04 -2.55851427e+04 -2.19309461e+04
-2.52264278e+04 -2.20891358e+04 -2.48955984e+04 -2.26623550e+04
-2.47863123e+04 -2.54529497e+04 -2.41997248e+04 -2.23311495e+04
-2.17057763e+04 -2.34513642e+04 -2.18665533e+04 -2.45614762e+04]
[-7.73969034e-01 -5.67185101e-01 3.41166757e-01 6.90673810e-01
-7.84958030e-01 -8.77825060e-01 -2.31441214e-01 1.36209912e-01
2.73223210e-01 -6.02403440e-01 6.83127711e-01 -7.39577680e-01
8.65828568e-01 7.42136954e-01 8.59595057e-01 -6.85932100e-01
5.11986191e-01 1.25268984e-01 -1.21733788e-01 -3.92253539e-01]
[ 5.06099936e-02 -2.67583302e-01 2.04774108e-01 -9.36850333e-02
4.44910026e-01 -5.00457352e-01 -8.31923094e-01 -5.83552727e-01
7.98054757e-01 2.53274596e-01 8.72626897e-02 8.55818554e-01
7.63886901e-01 4.75665322e-01 -4.77809600e-01 2.07154503e-01
-4.79571991e-03 9.42220547e-01 -8.56856066e-01 4.84093011e-01]
[ 3.83309715e+04 1.11018141e+05 1.72820752e+04 5.00775703e+04
9.65956131e+04 4.66103191e+04 8.83623653e+04 4.50319149e+04
9.82880833e+04 4.68166936e+04 1.06282163e+05 3.45237204e+04
1.05243846e+05 9.26915250e+04 1.12309868e+05 3.89463227e+04
5.13360735e+04 9.64429693e+04 5.09266576e+04 1.10099444e+05]
[-5.22304944e+05 -5.45171602e+05 -1.16480435e+05 -5.00659765e+05
-5.71533340e+05 -5.11262498e+05 -5.81290469e+05 -5.04724286e+05
-5.64943371e+05 -5.04883449e+05 -5.55004459e+05 -5.29489912e+05
-5.48945424e+05 -5.81050259e+05 -5.43241761e+05 -5.22990958e+05
-4.92833900e+05 -5.21746354e+05 -5.01158622e+05 -5.41331825e+05]
[-1.37164033e+06 -1.43335970e+06 -6.93451920e+05 -1.30911774e+06
-1.51759653e+06 -1.34238923e+06 -1.54878381e+06 -1.32994711e+06
-1.49712803e+06 -1.32048353e+06 -1.46529042e+06 -1.40031895e+06
-1.44555922e+06 -1.54617945e+06 -1.42109815e+06 -1.37604545e+06
-1.28981769e+06 -1.37069297e+06 -1.30217381e+06 -1.41493049e+06]
[-2.69417024e+06 -2.89786023e+06 -2.05003390e+06 -2.58853286e+06
-3.05021415e+06 -2.64186417e+06 -3.10882648e+06 -2.64101719e+06
-3.00363196e+06 -2.59963731e+06 -2.94268601e+06 -2.75045537e+06
-2.92617568e+06 -3.09933950e+06 -2.88284262e+06 -2.71087450e+06
-2.55872541e+06 -2.77508898e+06 -2.55712060e+06 -2.84916693e+06]
[-4.58086174e+06 -5.91958288e+06 -2.82538198e+06 -4.59237329e+06
-5.92255305e+06 -4.61010030e+06 -5.88171053e+06 -4.60966857e+06
-5.86279546e+06 -4.54978342e+06 -5.88748430e+06 -4.59348978e+06
-5.87607760e+06 -5.92802235e+06 -5.94000385e+06 -4.62072033e+06
-4.56697525e+06 -5.53805227e+06 -4.54581826e+06 -5.82455175e+06]
[-5.22428716e+06 -9.01486969e+06 -1.35261609e+06 -5.64022998e+06
-8.45722391e+06 -5.54671821e+06 -8.07855148e+06 -5.49779573e+06
-8.43217944e+06 -5.47286352e+06 -8.76455166e+06 -5.06396592e+06
-8.70235957e+06 -8.29558413e+06 -9.10142018e+06 -5.28575991e+06
-5.65495129e+06 -8.12460024e+06 -5.63071768e+06 -8.87159568e+06]
[-7.51491265e+06 -1.53388004e+07 3.71857633e+04 -8.56399314e+06
-1.39294804e+07 -8.30029500e+06 -1.30449227e+07 -8.14948875e+06
-1.39815449e+07 -8.21316987e+06 -1.47847684e+07 -7.10712210e+06
-1.46217152e+07 -1.35145731e+07 -1.55198287e+07 -7.61598394e+06
-8.62463927e+06 -1.35741516e+07 -8.63355665e+06 -1.51547583e+07]
[-1.35551802e+07 -2.63393374e+07 -2.03824725e+05 -1.52725224e+07
-2.40641569e+07 -1.48413080e+07 -2.26655789e+07 -1.45580924e+07
-2.42127912e+07 -1.47353325e+07 -2.54996890e+07 -1.29247398e+07
-2.52190996e+07 -2.34012468e+07 -2.66056501e+07 -1.37188754e+07
-1.53644002e+07 -2.34294726e+07 -1.54301175e+07 -2.61224369e+07]
[-2.33244864e+07 -3.90901947e+07 -3.36323412e+06 -2.52673715e+07
-3.65758457e+07 -2.48087884e+07 -3.50336710e+07 -2.44310710e+07
-3.67831698e+07 -2.46840892e+07 -3.82169156e+07 -2.26860559e+07
-3.78579704e+07 -3.58534043e+07 -3.93502946e+07 -2.35481198e+07
-2.53351693e+07 -3.53679794e+07 -2.54685694e+07 -3.88855885e+07]
[-3.11317168e+07 -4.62170513e+07 -8.43198571e+06 -3.27160098e+07
-4.42642055e+07 -3.23969279e+07 -4.30514344e+07 -3.20138841e+07
-4.44653257e+07 -3.22622791e+07 -4.56076388e+07 -3.07337825e+07
-4.52468039e+07 -4.37148687e+07 -4.63700644e+07 -3.13833206e+07
-3.27183755e+07 -4.24706228e+07 -3.28878874e+07 -4.60658859e+07]
[-3.44239617e+07 -4.59824872e+07 -1.34999285e+07 -3.53114214e+07
-4.50390672e+07 -3.52064691e+07 -4.44104757e+07 -3.48996155e+07
-4.51825224e+07 -3.50837395e+07 -4.57845763e+07 -3.43740998e+07
-4.54912975e+07 -4.47777610e+07 -4.59840648e+07 -3.46623528e+07
-3.52436509e+07 -4.29108314e+07 -3.54000707e+07 -4.59063827e+07]
[-3.16494619e+07 -3.89294788e+07 -1.60102508e+07 -3.18942915e+07
-3.88778436e+07 -3.19473703e+07 -3.87408149e+07 -3.17522576e+07
-3.89395181e+07 -3.18647500e+07 -3.90582957e+07 -3.18401499e+07
-3.88734441e+07 -3.88454442e+07 -3.88243175e+07 -3.18307726e+07
-3.17935356e+07 -3.68267917e+07 -3.18939069e+07 -3.89218949e+07]
[-1.94671252e+07 -2.25968243e+07 -1.24892764e+07 -1.94151797e+07
-2.28894205e+07 -1.94719919e+07 -2.29255959e+07 -1.94074546e+07
-2.28603282e+07 -1.94467054e+07 -2.27790487e+07 -1.96384381e+07
-2.27197621e+07 -2.29044774e+07 -2.25210221e+07 -1.95537068e+07
-1.93458718e+07 -2.16490666e+07 -1.93594911e+07 -2.26153157e+07]
[-8.35613418e+06 -9.12477816e+06 -7.62278583e+06 -8.29005753e+06
-9.37160758e+06 -8.27122514e+06 -9.37946789e+06 -8.31063453e+06
-9.26995772e+06 -8.27620627e+06 -9.19635069e+06 -8.39852116e+06
-9.22224690e+06 -9.32999663e+06 -9.15191756e+06 -8.37959013e+06
-8.25460181e+06 -8.92051645e+06 -8.21475424e+06 -9.12993175e+06]
[-5.10228455e+06 -5.42094762e+06 -4.78151367e+06 -5.10732368e+06
-5.55041298e+06 -5.03159242e+06 -5.52027894e+06 -5.12748523e+06
-5.40058108e+06 -5.02374145e+06 -5.37980031e+06 -5.07049069e+06
-5.43421579e+06 -5.45794639e+06 -5.53837823e+06 -5.12233463e+06
-5.07007393e+06 -5.37417233e+06 -5.03022077e+06 -5.39471824e+06]
[-6.70085852e+06 -7.25150561e+06 -3.85005565e+06 -6.73150843e+06
-7.34133074e+06 -6.65657676e+06 -7.31813540e+06 -6.76422202e+06
-7.17728607e+06 -6.62010516e+06 -7.17174895e+06 -6.67545064e+06
-7.21617745e+06 -7.24100352e+06 -7.39799438e+06 -6.74188084e+06
-6.68248858e+06 -7.11113072e+06 -6.65907788e+06 -7.20567081e+06]
[-8.69013470e+06 -9.79542473e+06 -4.19784831e+06 -8.73438157e+06
-9.85418020e+06 -8.68633834e+06 -9.82108992e+06 -8.76795133e+06
-9.71095503e+06 -8.62628767e+06 -9.72069028e+06 -8.69222789e+06
-9.73003840e+06 -9.76249256e+06 -9.92069401e+06 -8.75112996e+06
-8.68014221e+06 -9.47105718e+06 -8.67317609e+06 -9.74129544e+06]
[-8.27217956e+06 -9.28140359e+06 -4.03014113e+06 -8.26697588e+06
-9.38483821e+06 -8.25905828e+06 -9.38285283e+06 -8.31178925e+06
-9.26703419e+06 -8.19320209e+06 -9.24938259e+06 -8.30902618e+06
-9.23908889e+06 -9.33069013e+06 -9.36563949e+06 -8.33006724e+06
-8.21554274e+06 -8.95110391e+06 -8.21698668e+06 -9.23224981e+06]
[-7.00575738e+06 -8.07820324e+06 -3.60703258e+06 -7.00191431e+06
-8.15673423e+06 -7.01095305e+06 -8.15016998e+06 -7.02855311e+06
-8.07513046e+06 -6.94885732e+06 -8.06756452e+06 -7.04540209e+06
-8.03940909e+06 -8.12792565e+06 -8.12751935e+06 -7.05547790e+06
-6.95816583e+06 -7.73244003e+06 -6.96691791e+06 -8.03042904e+06]
[-5.58539952e+06 -7.00580617e+06 -2.76131779e+06 -5.66220588e+06
-6.95410481e+06 -5.65619117e+06 -6.88691325e+06 -5.63881311e+06
-6.91213137e+06 -5.60371123e+06 -6.97068297e+06 -5.59002203e+06
-6.92887312e+06 -6.91847207e+06 -7.04167587e+06 -5.62601659e+06
-5.63612334e+06 -6.60589017e+06 -5.64948431e+06 -6.95554873e+06]
[-3.99610428e+06 -5.48015526e+06 -1.64624920e+06 -4.12045795e+06
-5.34216811e+06 -4.09970796e+06 -5.23491127e+06 -4.06248606e+06
-5.33077230e+06 -4.06224571e+06 -5.42864750e+06 -3.96937147e+06
-5.38545571e+06 -5.30190721e+06 -5.50906608e+06 -4.02440018e+06
-4.10810730e+06 -5.09595283e+06 -4.12308318e+06 -5.43459102e+06]
[-2.99053920e+06 -4.29011434e+06 -1.29355520e+06 -3.11166921e+06
-4.14793202e+06 -3.08793103e+06 -4.04730761e+06 -3.05004043e+06
-4.15109943e+06 -3.06369430e+06 -4.24469839e+06 -2.95932086e+06
-4.20854902e+06 -4.11333318e+06 -4.31052270e+06 -3.01033262e+06
-3.10508205e+06 -3.96443107e+06 -3.11875491e+06 -4.25614728e+06]
[-1.63994911e+06 -2.33831072e+06 -7.89859800e+05 -1.70111423e+06
-2.26786621e+06 -1.69031467e+06 -2.21740701e+06 -1.66664259e+06
-2.27088992e+06 -1.67767058e+06 -2.31909297e+06 -1.62474251e+06
-2.29700758e+06 -2.25261664e+06 -2.34605949e+06 -1.64919615e+06
-1.69634467e+06 -2.16053904e+06 -1.70569177e+06 -2.32090224e+06]
[-4.94977052e+05 -7.07976334e+05 -2.45633937e+05 -5.12954114e+05
-6.87286155e+05 -5.09795522e+05 -6.72492734e+05 -5.02479768e+05
-6.88448197e+05 -5.06066946e+05 -7.02740145e+05 -4.90734373e+05
-6.95816339e+05 -6.83121346e+05 -7.09972365e+05 -4.97666091e+05
-5.11242435e+05 -6.53319963e+05 -5.14367828e+05 -7.02804997e+05]
[-4.82707438e+04 -6.93117142e+04 -2.34107381e+04 -5.00158575e+04
-6.73039213e+04 -4.96502511e+04 -6.60303279e+04 -4.90230705e+04
-6.74107613e+04 -4.93490356e+04 -6.87706130e+04 -4.78475685e+04
-6.81619318e+04 -6.69479043e+04 -6.95301701e+04 -4.85270169e+04
-4.97932198e+04 -6.38665041e+04 -5.01163451e+04 -6.88039042e+04]
[-1.19332370e+04 -1.26192177e+04 -7.67343749e+03 -1.16239527e+04
-1.30810225e+04 -1.18347269e+04 -1.34033743e+04 -1.17254503e+04
-1.31368748e+04 -1.18125587e+04 -1.28893696e+04 -1.22134525e+04
-1.28428964e+04 -1.32915333e+04 -1.24395303e+04 -1.19870191e+04
-1.15585724e+04 -1.21682508e+04 -1.16488040e+04 -1.26820479e+04]
[ 4.84761636e-01 -8.05497138e-01 -9.39607674e-02 -7.41345636e-01
2.12656013e-01 -1.99045885e-01 -2.28659484e-01 -7.33442745e-01
2.16781952e-02 -3.17417233e-01 -3.55815526e-01 -4.25681527e-01
6.96439919e-01 -8.91493415e-01 8.61868630e-01 8.53129260e-01
1.61833499e-01 6.55780980e-01 3.52497787e-01 -8.64107983e-01]
[ 2.06358939e+03 2.86914485e+03 1.93284934e+03 2.13849496e+03
2.80887076e+03 2.11024707e+03 2.76816080e+03 2.11117285e+03
2.81411100e+03 2.11405527e+03 2.85415783e+03 2.05638565e+03
2.85035705e+03 2.78189271e+03 2.86834919e+03 2.07074887e+03
2.14752217e+03 2.67325029e+03 2.13178473e+03 2.86930175e+03]
[ 1.82921302e+04 8.10024885e+04 3.62306033e+04 2.95389996e+04
6.76790151e+04 2.57786669e+04 6.03661888e+04 2.50856650e+04
6.95763441e+04 2.63471218e+04 7.66910853e+04 1.48993417e+04
7.62695730e+04 6.38968697e+04 8.21914967e+04 1.89327802e+04
3.10108713e+04 6.94648126e+04 2.98743941e+04 8.03732524e+04]
[-5.96667944e+05 -6.08139973e+05 -1.42092397e+05 -5.68430901e+05
-6.42775797e+05 -5.81612012e+05 -6.55865767e+05 -5.74958040e+05
-6.34774829e+05 -5.74653297e+05 -6.20826118e+05 -6.06315651e+05
-6.14718395e+05 -6.54275365e+05 -6.05108405e+05 -5.97338033e+05
-5.59632616e+05 -5.83951113e+05 -5.68510529e+05 -6.04572437e+05]
[-1.61109774e+06 -1.67939949e+06 -6.60753329e+05 -1.53909711e+06
-1.77339730e+06 -1.57576848e+06 -1.80811203e+06 -1.56113272e+06
-1.74981370e+06 -1.55383172e+06 -1.71341325e+06 -1.64090844e+06
-1.69492937e+06 -1.80410446e+06 -1.66776348e+06 -1.61485289e+06
-1.51783756e+06 -1.60730055e+06 -1.53417670e+06 -1.66336681e+06]
[-2.43658098e+06 -2.75596323e+06 -9.56418913e+05 -2.35707732e+06
-2.85275715e+06 -2.40394838e+06 -2.87760551e+06 -2.38981779e+06
-2.80899125e+06 -2.36287319e+06 -2.77616610e+06 -2.46729732e+06
-2.75902454e+06 -2.88885575e+06 -2.75260740e+06 -2.44879034e+06
-2.33126512e+06 -2.60922863e+06 -2.34004566e+06 -2.70944613e+06]
[-3.51440490e+06 -5.15905342e+06 -6.51011315e+05 -3.59244809e+06
-5.02739465e+06 -3.59355899e+06 -4.90398534e+06 -3.56894378e+06
-4.97476450e+06 -3.53493895e+06 -5.06755497e+06 -3.46824375e+06
-5.05604710e+06 -5.00246478e+06 -5.20118753e+06 -3.54623454e+06
-3.58035751e+06 -4.72136778e+06 -3.56983703e+06 -5.05997942e+06]
[-4.03700913e+06 -8.26767133e+06 1.29272237e+06 -4.51660622e+06
-7.56129985e+06 -4.40660982e+06 -7.08982489e+06 -4.33091598e+06
-7.54149701e+06 -4.33646551e+06 -7.94558285e+06 -3.80713586e+06
-7.90031835e+06 -7.37510800e+06 -8.38058984e+06 -4.09243100e+06
-4.54590544e+06 -7.28977885e+06 -4.52708810e+06 -8.11189449e+06]
[-7.27241583e+06 -1.52221275e+07 2.02786968e+06 -8.26846682e+06
-1.38175749e+07 -8.03007838e+06 -1.29320393e+07 -7.86323238e+06
-1.38614143e+07 -7.94275228e+06 -1.46501810e+07 -6.85164668e+06
-1.45282080e+07 -1.34367888e+07 -1.54056030e+07 -7.37237411e+06
-8.33204916e+06 -1.34058867e+07 -8.33688852e+06 -1.50189115e+07]
[-1.49741276e+07 -2.68282139e+07 -3.00925878e+05 -1.64014957e+07
-2.48986558e+07 -1.60735473e+07 -2.36961007e+07 -1.58062958e+07
-2.50115766e+07 -1.59625181e+07 -2.61023395e+07 -1.44504502e+07
-2.58835283e+07 -2.43663279e+07 -2.70434852e+07 -1.51384512e+07
-1.64708737e+07 -2.40498244e+07 -1.65233283e+07 -2.66053386e+07]
[-2.52744779e+07 -3.87142743e+07 -5.36406210e+06 -2.67041333e+07
-3.68914139e+07 -2.64102703e+07 -3.57463699e+07 -2.61018529e+07
-3.70298949e+07 -2.62773419e+07 -3.80834666e+07 -2.48625953e+07
-3.78075872e+07 -3.63769059e+07 -3.88863394e+07 -2.54994892e+07
-2.67286218e+07 -3.54158039e+07 -2.68314214e+07 -3.85267914e+07]
[-3.16543804e+07 -4.29800258e+07 -1.12561826e+07 -3.26045026e+07
-4.19103402e+07 -3.24615314e+07 -4.12082577e+07 -3.22088184e+07
-4.20087827e+07 -3.23243988e+07 -4.26673629e+07 -3.15332327e+07
-4.24138622e+07 -4.15872474e+07 -4.30520046e+07 -3.18992892e+07
-3.25577237e+07 -4.00246351e+07 -3.26786790e+07 -4.28685406e+07]
[-3.06316226e+07 -3.78484079e+07 -1.44828791e+07 -3.09728835e+07
-3.76577498e+07 -3.09879417e+07 -3.74646360e+07 -3.08443436e+07
-3.76862233e+07 -3.08772432e+07 -3.78700423e+07 -3.07816203e+07
-3.76962326e+07 -3.75525721e+07 -3.78184853e+07 -3.08433053e+07
-3.08823039e+07 -3.58002948e+07 -3.09725671e+07 -3.78195209e+07]
[-2.66807876e+07 -3.04057520e+07 -1.54589689e+07 -2.65497798e+07
-3.08692894e+07 -2.66635990e+07 -3.10306593e+07 -2.66229687e+07
-3.08207199e+07 -2.65926513e+07 -3.06488682e+07 -2.69812970e+07
-3.05697396e+07 -3.09112593e+07 -3.03161778e+07 -2.68371899e+07
-2.64417732e+07 -2.91769015e+07 -2.64801459e+07 -3.04366961e+07]
[-1.69439547e+07 -1.78628953e+07 -1.17799340e+07 -1.66656101e+07
-1.84630172e+07 -1.67618359e+07 -1.86932854e+07 -1.68107561e+07
-1.83527537e+07 -1.67315436e+07 -1.80923250e+07 -1.71847264e+07
-1.80945319e+07 -1.85060400e+07 -1.78119482e+07 -1.70268166e+07
-1.65870486e+07 -1.74344130e+07 -1.65719484e+07 -1.79104178e+07]
[-1.00800064e+07 -1.00599926e+07 -7.53987824e+06 -9.88321807e+06
-1.04905608e+07 -9.91054744e+06 -1.06342871e+07 -1.00095992e+07
-1.03470701e+07 -9.89277278e+06 -1.01627607e+07 -1.01985007e+07
-1.02032702e+07 -1.04711261e+07 -1.00890295e+07 -1.01264915e+07
-9.82893461e+06 -9.97106897e+06 -9.79311668e+06 -1.00833639e+07]
[-7.29355224e+06 -7.39978301e+06 -4.62322373e+06 -7.21561152e+06
-7.63872429e+06 -7.18207264e+06 -7.69283969e+06 -7.30237728e+06
-7.47473527e+06 -7.15654236e+06 -7.38507736e+06 -7.31988965e+06
-7.43972494e+06 -7.56849430e+06 -7.49984079e+06 -7.33170791e+06
-7.16795368e+06 -7.32992411e+06 -7.13251662e+06 -7.38506869e+06]
[-6.32975950e+06 -7.42340220e+06 -2.25945673e+06 -6.42503076e+06
-7.38741575e+06 -6.34368193e+06 -7.30207279e+06 -6.43592950e+06
-7.24305794e+06 -6.30698138e+06 -7.29386784e+06 -6.27086473e+06
-7.33568757e+06 -7.26792300e+06 -7.56742480e+06 -6.37480582e+06
-6.38872742e+06 -7.14803431e+06 -6.36555773e+06 -7.36900850e+06]
[-6.42569833e+06 -8.37483936e+06 -1.50161672e+06 -6.61317220e+06
-8.18357018e+06 -6.52772547e+06 -8.01379568e+06 -6.56652356e+06
-8.07606529e+06 -6.48049527e+06 -8.20921015e+06 -6.33761757e+06
-8.21963318e+06 -8.05577063e+06 -8.51425146e+06 -6.47642107e+06
-6.58302296e+06 -7.88874221e+06 -6.57994024e+06 -8.30180776e+06]
[-5.79603828e+06 -7.81220561e+06 -1.52522874e+06 -5.95060282e+06
-7.64344073e+06 -5.89873472e+06 -7.48213811e+06 -5.89604589e+06
-7.56646465e+06 -5.84758550e+06 -7.68902997e+06 -5.72940876e+06
-7.67292266e+06 -7.55087374e+06 -7.90914382e+06 -5.83707600e+06
-5.92412573e+06 -7.28748237e+06 -5.93070948e+06 -7.74044782e+06]
[-5.49290175e+06 -7.43488156e+06 -1.75449815e+06 -5.62635756e+06
-7.28502080e+06 -5.59861626e+06 -7.14225130e+06 -5.56547372e+06
-7.23903857e+06 -5.54892399e+06 -7.35231536e+06 -5.44648686e+06
-7.31318369e+06 -7.22362209e+06 -7.49184886e+06 -5.52756763e+06
-5.60175232e+06 -6.91971544e+06 -5.61870691e+06 -7.36945957e+06]
[-4.26621770e+06 -6.03898789e+06 -1.24748214e+06 -4.41372690e+06
-5.85872886e+06 -4.38591111e+06 -5.71888063e+06 -4.33799731e+06
-5.84049081e+06 -4.34623775e+06 -5.96423371e+06 -4.21634996e+06
-5.92093372e+06 -5.80972195e+06 -6.07980692e+06 -4.29320163e+06
-4.39790462e+06 -5.58399720e+06 -4.41927873e+06 -5.98190174e+06]
[-3.25858354e+06 -4.80716343e+06 -9.62177711e+05 -3.40399045e+06
-4.62617651e+06 -3.37320336e+06 -4.49723666e+06 -3.32690904e+06
-4.62587549e+06 -3.34568204e+06 -4.74297201e+06 -3.21048658e+06
-4.70526440e+06 -4.58355317e+06 -4.83816843e+06 -3.28016239e+06
-3.39524715e+06 -4.42245039e+06 -3.41317147e+06 -4.76324252e+06]
[-2.12747021e+06 -3.21746293e+06 -7.94340164e+05 -2.23619822e+06
-3.08215503e+06 -2.21228645e+06 -2.98868578e+06 -2.17855762e+06
-3.08803195e+06 -2.19499433e+06 -3.17373142e+06 -2.09220491e+06
-3.14501117e+06 -3.05122463e+06 -3.23565225e+06 -2.14095361e+06
-2.23243252e+06 -2.95050290e+06 -2.24390639e+06 -3.18893473e+06]
[-1.10461899e+06 -1.61763487e+06 -4.68858272e+05 -1.15133320e+06
-1.56192231e+06 -1.14246712e+06 -1.52280910e+06 -1.12461998e+06
-1.56514856e+06 -1.13413381e+06 -1.60207547e+06 -1.09175569e+06
-1.58677582e+06 -1.55052369e+06 -1.62375491e+06 -1.11086394e+06
-1.14822074e+06 -1.48878627e+06 -1.15516259e+06 -1.60492345e+06]
[-3.06975693e+05 -4.39772545e+05 -1.43676388e+05 -3.18063481e+05
-4.26914319e+05 -3.16221600e+05 -4.17604592e+05 -3.11524346e+05
-4.27808873e+05 -3.13940601e+05 -4.36661918e+05 -3.04461507e+05
-4.32355180e+05 -4.24485316e+05 -4.40904925e+05 -3.08772606e+05
-3.16900183e+05 -4.05777033e+05 -3.18985621e+05 -4.36571437e+05]
[-4.19997386e+04 -5.57829946e+04 -2.86662328e+04 -4.28230535e+04
-5.50653803e+04 -4.27280276e+04 -5.44944697e+04 -4.23352233e+04
-5.50340620e+04 -4.24595668e+04 -5.56932569e+04 -4.19558310e+04
-5.51973170e+04 -5.49385793e+04 -5.57742206e+04 -4.22016396e+04
-4.26010003e+04 -5.19990794e+04 -4.28192930e+04 -5.54388410e+04]
[-4.13048009e+03 -3.79481236e+03 -2.45783320e+03 -3.94448605e+03
-4.09673165e+03 -3.98016742e+03 -4.27049059e+03 -4.02902951e+03
-4.05962155e+03 -3.98093392e+03 -3.88789206e+03 -4.24042232e+03
-3.95708733e+03 -4.17110654e+03 -3.79860437e+03 -4.15896406e+03
-3.90721482e+03 -3.81083266e+03 -3.89589394e+03 -3.80383087e+03]
[-1.46827810e-01 6.78124281e-01 6.26880429e-01 -8.35135198e-01
-1.36822683e-02 8.37375260e-01 -7.82847309e-01 8.94554346e-01
-2.04831908e-01 -4.88831341e-01 1.85528885e-02 6.98428794e-01
-6.04135992e-01 9.60591856e-01 5.12350417e-01 4.52155035e-01
2.25327750e-01 6.91087079e-01 9.67858403e-03 6.79714071e-01]
[ 8.83817527e+03 7.92434603e+03 1.20117012e+04 8.42060369e+03
8.63667912e+03 8.46887787e+03 9.12181566e+03 8.63013983e+03
8.53900989e+03 8.54024398e+03 8.15699782e+03 9.05021983e+03
8.28337708e+03 8.75367769e+03 7.82074703e+03 8.80246486e+03
8.36069660e+03 7.92736401e+03 8.32263346e+03 8.04492670e+03]
[-5.65752408e+04 -3.32593406e+04 -2.34046274e+03 -4.90947760e+04
-4.23662453e+04 -5.20541835e+04 -4.66775795e+04 -5.16632206e+04
-4.09522328e+04 -5.12919545e+04 -3.65225435e+04 -5.91728122e+04
-3.61343599e+04 -4.49956119e+04 -3.22282554e+04 -5.63885723e+04
-4.76715657e+04 -3.54380042e+04 -4.89305823e+04 -3.33581835e+04]
[-5.23750750e+05 -5.24809683e+05 -1.66744843e+05 -4.97995602e+05
-5.57449659e+05 -5.09825857e+05 -5.70650228e+05 -5.04702508e+05
-5.51067194e+05 -5.04312844e+05 -5.37376075e+05 -5.33561115e+05
-5.32274108e+05 -5.67912350e+05 -5.20899767e+05 -5.24323882e+05
-4.90607518e+05 -5.05830499e+05 -4.97669395e+05 -5.22586842e+05]
[-1.31138312e+06 -1.31471831e+06 -4.03042142e+05 -1.24149428e+06
-1.40360639e+06 -1.27527400e+06 -1.43827763e+06 -1.26341601e+06
-1.38315565e+06 -1.25891764e+06 -1.34621294e+06 -1.33874103e+06
-1.33388185e+06 -1.43161802e+06 -1.30389046e+06 -1.31364296e+06
-1.22353935e+06 -1.26522266e+06 -1.23839500e+06 -1.30494605e+06]
[-2.21088934e+06 -2.56305711e+06 -3.54089914e+05 -2.14628200e+06
-2.63118193e+06 -2.18769339e+06 -2.63969711e+06 -2.16721781e+06
-2.59519876e+06 -2.15486556e+06 -2.57489430e+06 -2.22886399e+06
-2.55819723e+06 -2.65744800e+06 -2.55998963e+06 -2.21809585e+06
-2.12474182e+06 -2.41232600e+06 -2.13909839e+06 -2.52821846e+06]
[-2.42908644e+06 -4.07389529e+06 1.10392687e+06 -2.53261942e+06
-3.87830376e+06 -2.53082279e+06 -3.71945487e+06 -2.48726030e+06
-3.84087093e+06 -2.48264713e+06 -3.96295931e+06 -2.35502140e+06
-3.94429063e+06 -3.83900755e+06 -4.11394544e+06 -2.44847923e+06
-2.52876222e+06 -3.64130895e+06 -2.53366793e+06 -3.99078894e+06]
[-3.10876140e+06 -6.88375447e+06 2.86832145e+06 -3.50641964e+06
-6.24980101e+06 -3.43079914e+06 -5.81755392e+06 -3.34177732e+06
-6.22989817e+06 -3.37023300e+06 -6.58984914e+06 -2.89024449e+06
-6.55133461e+06 -6.09389620e+06 -6.97447412e+06 -3.14684624e+06
-3.53418231e+06 -5.98815258e+06 -3.52999120e+06 -6.74696608e+06]
[-6.01175481e+06 -1.25147974e+07 3.30674947e+06 -6.73455163e+06
-1.14257894e+07 -6.58922464e+06 -1.07236160e+07 -6.43632460e+06
-1.14477022e+07 -6.51441595e+06 -1.20545696e+07 -5.67645768e+06
-1.19752416e+07 -1.11563640e+07 -1.26404047e+07 -6.08763897e+06
-6.78472029e+06 -1.09791594e+07 -6.78837722e+06 -1.23342509e+07]
[-1.23873953e+07 -2.12560256e+07 1.15755033e+06 -1.32928820e+07
-1.99537403e+07 -1.31302504e+07 -1.91128293e+07 -1.29178370e+07
-2.00138561e+07 -1.30384565e+07 -2.07467298e+07 -1.20348246e+07
-2.06157426e+07 -1.96268692e+07 -2.13700797e+07 -1.25113037e+07
-1.33383352e+07 -1.90959978e+07 -1.33655949e+07 -2.10647589e+07]
[-1.95639882e+07 -2.92604856e+07 -2.45215506e+06 -2.04267783e+07
-2.80918908e+07 -2.03009584e+07 -2.73175998e+07 -2.00746602e+07
-2.81633258e+07 -2.01972526e+07 -2.88374956e+07 -1.93066237e+07
-2.86749412e+07 -2.77842356e+07 -2.93314196e+07 -1.97274481e+07
-2.04435993e+07 -2.68029887e+07 -2.04931671e+07 -2.90996003e+07]
[-2.12250273e+07 -2.86695864e+07 -5.82575542e+06 -2.17453904e+07
-2.80372055e+07 -2.17075831e+07 -2.75760227e+07 -2.15551144e+07
-2.80662760e+07 -2.16133046e+07 -2.84555915e+07 -2.11554542e+07
-2.83289842e+07 -2.78394614e+07 -2.86878104e+07 -2.13896651e+07
-2.17282887e+07 -2.66940131e+07 -2.17702492e+07 -2.85751483e+07]
[-1.93991911e+07 -2.37568758e+07 -7.59182462e+06 -1.95303305e+07
-2.37035767e+07 -1.95715051e+07 -2.35723334e+07 -1.95186564e+07
-2.36698614e+07 -1.95039590e+07 -2.37448898e+07 -1.94903802e+07
-2.36889980e+07 -2.36215517e+07 -2.37365537e+07 -1.95356313e+07
-1.94922544e+07 -2.25052987e+07 -1.95007250e+07 -2.37294986e+07]
[-1.58127572e+07 -1.78997590e+07 -7.48869953e+06 -1.56861337e+07
-1.82080806e+07 -1.57691896e+07 -1.82768287e+07 -1.57888842e+07
-1.81248830e+07 -1.57312497e+07 -1.80005537e+07 -1.59743703e+07
-1.80033320e+07 -1.81935091e+07 -1.78589611e+07 -1.59093353e+07
-1.56425145e+07 -1.72003248e+07 -1.56189283e+07 -1.79168365e+07]
[-1.01813470e+07 -1.07743690e+07 -5.17586016e+06 -9.99167231e+06
-1.11274899e+07 -1.00584065e+07 -1.12224451e+07 -1.01250520e+07
-1.10155772e+07 -1.00427004e+07 -1.08564591e+07 -1.02973130e+07
-1.08962598e+07 -1.11085026e+07 -1.07565652e+07 -1.02319500e+07
-9.96323459e+06 -1.04995195e+07 -9.91666860e+06 -1.08005133e+07]
[-6.04080392e+06 -6.03146087e+06 -2.53955467e+06 -5.88473481e+06
-6.29959794e+06 -5.91492030e+06 -6.35985531e+06 -6.00622577e+06
-6.17242752e+06 -5.90777974e+06 -6.04930031e+06 -6.08935688e+06
-6.11031426e+06 -6.26257296e+06 -6.05305086e+06 -6.06580041e+06
-5.86425936e+06 -5.96045851e+06 -5.81301700e+06 -6.03930344e+06]
[-2.63770216e+06 -2.98474560e+06 2.67168820e+05 -2.63525651e+06
-3.00591858e+06 -2.59370989e+06 -2.94370743e+06 -2.68293008e+06
-2.88047490e+06 -2.58926138e+06 -2.88259897e+06 -2.57424200e+06
-2.95285477e+06 -2.91755113e+06 -3.07219458e+06 -2.64966733e+06
-2.62519038e+06 -2.89903019e+06 -2.57867713e+06 -2.95450027e+06]
[-1.18313928e+06 -2.65955687e+06 2.35372125e+06 -1.39028962e+06
-2.36522587e+06 -1.28431977e+06 -2.13816254e+06 -1.32992890e+06
-2.27382091e+06 -1.27626354e+06 -2.43933084e+06 -1.02003678e+06
-2.49645075e+06 -2.22371503e+06 -2.79756578e+06 -1.19764681e+06
-1.39499253e+06 -2.35803253e+06 -1.36399083e+06 -2.59079160e+06]
[-1.75158058e+06 -3.87417509e+06 2.12447987e+06 -2.01290984e+06
-3.49977333e+06 -1.90845188e+06 -3.22598338e+06 -1.90549165e+06
-3.43923185e+06 -1.89293241e+06 -3.65307243e+06 -1.57976955e+06
-3.67664228e+06 -3.36296620e+06 -3.99849988e+06 -1.76719412e+06
-2.01618065e+06 -3.40437411e+06 -2.00590433e+06 -3.79634404e+06]
[-2.69860025e+06 -4.69507079e+06 8.60311687e+05 -2.90209181e+06
-4.40916809e+06 -2.83404958e+06 -4.18757151e+06 -2.80345326e+06
-4.36990470e+06 -2.81062111e+06 -4.54282999e+06 -2.57559316e+06
-4.53624902e+06 -4.31489547e+06 -4.77785108e+06 -2.71287731e+06
-2.89726857e+06 -4.22273717e+06 -2.90150261e+06 -4.62654938e+06]
[-3.21226702e+06 -4.90831956e+06 -3.01095343e+05 -3.36350188e+06
-4.70760005e+06 -3.32176595e+06 -4.54617927e+06 -3.28015241e+06
-4.68346002e+06 -3.29534430e+06 -4.81415623e+06 -3.13304499e+06
-4.79074502e+06 -4.64946648e+06 -4.95897517e+06 -3.22568200e+06
-3.35380658e+06 -4.48978940e+06 -3.36624704e+06 -4.85216831e+06]
[-3.05438512e+06 -4.69280241e+06 -5.15440517e+05 -3.21343858e+06
-4.48482479e+06 -3.17290567e+06 -4.33319692e+06 -3.12481382e+06
-4.47969721e+06 -3.15056181e+06 -4.61176916e+06 -2.98323361e+06
-4.57971858e+06 -4.43329187e+06 -4.73106569e+06 -3.06958926e+06
-3.20527930e+06 -4.29265651e+06 -3.22273190e+06 -4.64605875e+06]
[-2.09756955e+06 -3.39312696e+06 -4.83030418e+05 -2.23464596e+06
-3.21512204e+06 -2.20007935e+06 -3.09424976e+06 -2.16172080e+06
-3.22021219e+06 -2.18318346e+06 -3.32960671e+06 -2.04402837e+06
-3.30184655e+06 -3.17405274e+06 -3.42075982e+06 -2.11117965e+06
-2.23137935e+06 -3.08273086e+06 -2.24426638e+06 -3.35810846e+06]
[-1.34014532e+06 -2.13597676e+06 -4.29797114e+05 -1.42322344e+06
-2.03000040e+06 -1.40314133e+06 -1.95825168e+06 -1.37858881e+06
-2.03550458e+06 -1.39319451e+06 -2.10102359e+06 -1.31014096e+06
-2.08196010e+06 -2.00574145e+06 -2.14976055e+06 -1.34832627e+06
-1.42158672e+06 -1.94414831e+06 -1.42943922e+06 -2.11635497e+06]
[-8.15873369e+05 -1.18098012e+06 -3.19131853e+05 -8.48432221e+05
-1.14236048e+06 -8.41562117e+05 -1.11457502e+06 -8.29868407e+05
-1.14424858e+06 -8.36632733e+05 -1.16974691e+06 -8.06455250e+05
-1.16040345e+06 -1.13392295e+06 -1.18527982e+06 -8.20093045e+05
-8.46319362e+05 -1.08941494e+06 -8.50552639e+05 -1.17254329e+06]
[-2.18681925e+05 -3.02206753e+05 -1.13328237e+05 -2.24716698e+05
-2.95714907e+05 -2.23890854e+05 -2.90765478e+05 -2.21042726e+05
-2.96126405e+05 -2.22534552e+05 -3.00887139e+05 -2.17656665e+05
-2.98269691e+05 -2.94552575e+05 -3.02515651e+05 -2.19906176e+05
-2.23784806e+05 -2.80170415e+05 -2.25197665e+05 -3.00407091e+05]
[-2.64877836e+04 -3.06908545e+04 -2.83586588e+04 -2.58689972e+04
-3.17587771e+04 -2.63566631e+04 -3.22519357e+04 -2.62235823e+04
-3.17296985e+04 -2.62190152e+04 -3.12557978e+04 -2.71464018e+04
-3.10407663e+04 -3.21002081e+04 -3.02074176e+04 -2.66369388e+04
-2.57450188e+04 -2.90188494e+04 -2.57407263e+04 -3.06197311e+04]
[ 7.74013977e-01 5.92559917e-01 6.18303797e-02 6.15249893e-01
3.32195276e-01 4.51710653e-01 9.05100682e-01 3.97101473e-01
-9.31527043e-01 7.19011890e-01 3.61258817e-01 1.36823381e-01
4.22405376e-01 -4.23148768e-03 -4.43519237e-01 -9.45610249e-01
-9.83161968e-01 -3.14812434e-01 -4.16316485e-01 1.03157862e-01]
[-3.14551726e-01 6.02967900e-01 -3.09902558e-01 -9.97615735e-01
7.54103528e-03 -8.19601033e-01 3.11828299e-01 8.98123154e-01
6.98214935e-01 -8.66436465e-01 -5.50020238e-01 3.64491293e-01
-6.31352974e-01 -6.38957247e-01 4.11289356e-01 -7.90000805e-01
-9.28265804e-01 5.52657546e-01 -6.43696225e-03 -8.25658122e-01]
[ 7.54033185e-01 9.88830009e-01 1.38433805e-01 -8.78116682e-01
-4.87615966e-02 -9.26907585e-01 -1.33800042e-01 -4.47010723e-01
5.74972644e-01 -2.17294020e-01 -2.71833537e-01 -5.89163899e-01
-5.40681282e-01 1.73818004e-01 -1.12773568e-02 -6.65650658e-01
6.62959325e-01 -6.01123128e-01 5.54196138e-01 3.33311432e-02]
[-4.05665449e+04 -1.84981297e+04 -1.18584907e+04 -3.47309913e+04
-2.59610208e+04 -3.67672763e+04 -2.99043060e+04 -3.69131094e+04
-2.48231400e+04 -3.64426953e+04 -2.10165034e+04 -4.28019886e+04
-2.13046619e+04 -2.79530251e+04 -1.78458620e+04 -4.03621934e+04
-3.38324456e+04 -2.15810102e+04 -3.44754451e+04 -1.88592559e+04]
[-3.61145968e+05 -3.64581176e+05 -1.40720422e+05 -3.44163980e+05
-3.87271088e+05 -3.51704464e+05 -3.97031256e+05 -3.49083208e+05
-3.83065570e+05 -3.48812117e+05 -3.73278019e+05 -3.68535999e+05
-3.70867375e+05 -3.94068056e+05 -3.61661565e+05 -3.61526195e+05
-3.39646985e+05 -3.51848086e+05 -3.43485395e+05 -3.63801334e+05]
[-8.37031086e+05 -8.16528440e+05 -2.46613204e+05 -7.89697348e+05
-8.77460974e+05 -8.11471991e+05 -9.02732273e+05 -8.05292432e+05
-8.65428742e+05 -8.02714564e+05 -8.38823958e+05 -8.56542113e+05
-8.32480832e+05 -8.96006150e+05 -8.08196927e+05 -8.38342976e+05
-7.78615859e+05 -7.90633728e+05 -7.87311768e+05 -8.12556135e+05]
[-1.09272680e+06 -1.33845359e+06 2.36433707e+05 -1.06399002e+06
-1.35595366e+06 -1.08715548e+06 -1.34571876e+06 -1.07087083e+06
-1.33729453e+06 -1.06959285e+06 -1.33675797e+06 -1.09331196e+06
-1.32459019e+06 -1.36494171e+06 -1.33592873e+06 -1.09428251e+06
-1.05413257e+06 -1.24178559e+06 -1.06496525e+06 -1.31977872e+06]
[-9.86601773e+05 -2.24701919e+06 1.76790322e+06 -1.08697194e+06
-2.05167144e+06 -1.08464024e+06 -1.90463134e+06 -1.04109868e+06
-2.03648257e+06 -1.05540071e+06 -2.15137943e+06 -9.14064160e+05
-2.12650572e+06 -2.00874683e+06 -2.26801248e+06 -9.92135283e+05
-1.09282317e+06 -1.91960083e+06 -1.10271576e+06 -2.19547970e+06]
[-1.82966319e+06 -4.50805273e+06 3.01682696e+06 -2.08800293e+06
-4.05995923e+06 -2.05854486e+06 -3.74872162e+06 -1.97707408e+06
-4.05172893e+06 -2.01680712e+06 -4.30449799e+06 -1.67509282e+06
-4.26520310e+06 -3.95697755e+06 -4.55053844e+06 -1.84708257e+06
-2.11060467e+06 -3.84674717e+06 -2.11861211e+06 -4.41835715e+06]
[-3.90768824e+06 -8.26088219e+06 3.82651018e+06 -4.31528359e+06
-7.57606081e+06 -4.27348945e+06 -7.11467467e+06 -4.14283536e+06
-7.59295036e+06 -4.22365359e+06 -7.97171193e+06 -3.69565498e+06
-7.91294949e+06 -7.42594489e+06 -8.30084905e+06 -3.94787214e+06
-4.35192962e+06 -7.18153690e+06 -4.36148129e+06 -8.14196923e+06]
[-6.54081382e+06 -1.22479085e+07 4.26335402e+06 -7.04356838e+06
-1.14102057e+07 -7.00403913e+06 -1.08457929e+07 -6.83514055e+06
-1.14534400e+07 -6.94995250e+06 -1.19119829e+07 -6.30308914e+06
-1.18392794e+07 -1.12309495e+07 -1.22675897e+07 -6.60139079e+06
-7.09307735e+06 -1.08174676e+07 -7.09926888e+06 -1.21132687e+07]
[-7.67994904e+06 -1.42110906e+07 4.61667634e+06 -8.25895189e+06
-1.32579153e+07 -8.21148035e+06 -1.26033015e+07 -8.02338035e+06
-1.33215268e+07 -8.16517533e+06 -1.38434990e+07 -7.41508580e+06
-1.37593540e+07 -1.30382343e+07 -1.42119957e+07 -7.74850278e+06
-8.32521408e+06 -1.25870105e+07 -8.32122177e+06 -1.40788449e+07]
[-4.49483449e+06 -9.56958708e+06 5.50224192e+06 -4.96094846e+06
-8.76378148e+06 -4.92221783e+06 -8.18472668e+06 -4.78339363e+06
-8.80544896e+06 -4.90203218e+06 -9.24196027e+06 -4.24841674e+06
-9.20078501e+06 -8.55805181e+06 -9.56488695e+06 -4.53753498e+06
-5.04158818e+06 -8.34504581e+06 -5.00673224e+06 -9.46605030e+06]
[-7.60874372e+05 -4.34897130e+06 6.52603674e+06 -1.11215286e+06
-3.70162425e+06 -1.07391206e+06 -3.20460380e+06 -9.86818161e+05
-3.71279450e+06 -1.08145540e+06 -4.05797154e+06 -5.23043534e+05
-4.06369181e+06 -3.50815935e+06 -4.35087583e+06 -7.69988557e+05
-1.20286098e+06 -3.52611711e+06 -1.13956025e+06 -4.27686228e+06]
[ 4.95812860e+05 -1.71863046e+06 5.91793906e+06 3.16078456e+05
-1.32647360e+06 3.28380533e+05 -9.77488230e+05 3.67460704e+05
-1.30502091e+06 3.02508161e+05 -1.50979227e+06 6.77082100e+05
-1.55359066e+06 -1.18280142e+06 -1.70939993e+06 5.07872737e+05
2.37647528e+05 -1.21525630e+06 3.15316964e+05 -1.67841808e+06]
[ 9.81865457e+05 -3.48419473e+05 5.38631940e+06 9.04544189e+05
-1.11206844e+05 9.05932750e+05 1.37724059e+05 9.11902317e+05
-7.13521273e+04 8.74069327e+05 -1.90304891e+05 1.12616536e+06
-2.52284242e+05 -6.21252007e+03 -3.39609813e+05 1.00373258e+06
8.44037131e+05 -4.99803260e+04 9.19431482e+05 -3.20519660e+05]
[ 2.11961905e+06 1.40280129e+06 5.33527684e+06 2.07131640e+06
1.58445232e+06 2.09114718e+06 1.77866023e+06 2.06862481e+06
1.63975914e+06 2.05874505e+06 1.55346964e+06 2.25884715e+06
1.47390447e+06 1.66991362e+06 1.38201775e+06 2.14528893e+06
2.02696216e+06 1.53538052e+06 2.09482259e+06 1.43589075e+06]
[ 3.62513106e+06 2.67586141e+06 5.94836647e+06 3.45559354e+06
3.01756833e+06 3.53912498e+06 3.27656737e+06 3.51702053e+06
3.06841189e+06 3.50661782e+06 2.89871390e+06 3.82937344e+06
2.81663678e+06 3.13786862e+06 2.59350030e+06 3.65296518e+06
3.41368699e+06 2.81014709e+06 3.46555779e+06 2.72899704e+06]
[ 3.10212193e+06 1.47733494e+06 5.54125620e+06 2.81498815e+06
1.95646650e+06 2.94123543e+06 2.28357779e+06 2.94209087e+06
1.98913877e+06 2.91574429e+06 1.74191802e+06 3.34300723e+06
1.68170405e+06 2.10451300e+06 1.36220596e+06 3.12391881e+06
2.77727307e+06 1.75484987e+06 2.81144788e+06 1.54514173e+06]
[ 1.08232320e+06 -6.07594224e+05 3.38274910e+06 8.31258097e+05
-2.14340884e+05 9.36171203e+05 5.89304094e+04 9.53861451e+05
-1.89152122e+05 9.23136921e+05 -4.00718040e+05 1.27305550e+06
-4.33403052e+05 -9.61678733e+04 -7.03324942e+05 1.09460024e+06
8.11523067e+05 -2.75924318e+05 8.25582134e+05 -5.48152598e+05]
[-2.16087108e+05 -1.36512548e+06 1.55637444e+06 -3.63883149e+05
-1.14425680e+06 -3.01902965e+05 -9.77971673e+05 -2.81277768e+05
-1.12298747e+06 -3.05581284e+05 -1.24932520e+06 -1.02048354e+05
-1.26322378e+06 -1.07762048e+06 -1.42396440e+06 -2.06470785e+05
-3.70066521e+05 -1.12504385e+06 -3.66006032e+05 -1.32477355e+06]
[-1.15538673e+06 -2.11902635e+06 3.53074454e+05 -1.25599535e+06
-1.97963025e+06 -1.21756090e+06 -1.86839732e+06 -1.19219941e+06
-1.96519331e+06 -1.21444494e+06 -2.05230483e+06 -1.08456069e+06
-2.04970869e+06 -1.93985382e+06 -2.15502057e+06 -1.15124577e+06
-1.25374924e+06 -1.89795438e+06 -1.25827089e+06 -2.08882849e+06]
[-1.52388162e+06 -2.55752968e+06 -1.73030894e+05 -1.63210663e+06
-2.41501515e+06 -1.59771264e+06 -2.31027205e+06 -1.56798630e+06
-2.41289573e+06 -1.59107759e+06 -2.50151166e+06 -1.46643408e+06
-2.48683510e+06 -2.37830870e+06 -2.58398571e+06 -1.52692079e+06
-1.62895471e+06 -2.31398808e+06 -1.63732648e+06 -2.53066002e+06]
[-1.17621763e+06 -2.04873191e+06 -2.45630120e+05 -1.27435814e+06
-1.91960535e+06 -1.24590944e+06 -1.83323437e+06 -1.22128586e+06
-1.92437710e+06 -1.23880847e+06 -2.00181453e+06 -1.13309602e+06
-1.98608354e+06 -1.88853017e+06 -2.06840712e+06 -1.18206129e+06
-1.27364684e+06 -1.84430168e+06 -1.28104593e+06 -2.02740734e+06]
[-7.28026420e+05 -1.16478916e+06 -2.90700066e+05 -7.73132037e+05
-1.10836426e+06 -7.60952036e+05 -1.07028498e+06 -7.48157695e+05
-1.11067053e+06 -7.56430636e+05 -1.14592410e+06 -7.10913283e+05
-1.13618206e+06 -1.09533846e+06 -1.17264787e+06 -7.31688665e+05
-7.71630118e+05 -1.05917421e+06 -7.76052169e+05 -1.15438885e+06]
[-3.56983640e+05 -5.52767706e+05 -1.64342120e+05 -3.76141691e+05
-5.28980814e+05 -3.71640118e+05 -5.12894262e+05 -3.65497037e+05
-5.30394952e+05 -3.69239590e+05 -5.45558115e+05 -3.50615687e+05
-5.40270901e+05 -5.23698371e+05 -5.55386778e+05 -3.58865572e+05
-3.75235498e+05 -5.04541288e+05 -3.77723125e+05 -5.48300629e+05]
[-1.23864900e+05 -1.72123540e+05 -6.93601404e+04 -1.27549178e+05
-1.68088150e+05 -1.26960729e+05 -1.65094866e+05 -1.25298012e+05
-1.68266152e+05 -1.26198606e+05 -1.71208644e+05 -1.23054688e+05
-1.69678253e+05 -1.67289608e+05 -1.72344288e+05 -1.24471595e+05
-1.27033576e+05 -1.59456349e+05 -1.27898178e+05 -1.71101553e+05]
[-8.70423877e+03 -1.04015042e+04 -8.58297920e+03 -8.59401078e+03
-1.06736500e+04 -8.68445254e+03 -1.07603739e+04 -8.65843492e+03
-1.06129541e+04 -8.62627619e+03 -1.05412293e+04 -8.83893744e+03
-1.04405433e+04 -1.07354688e+04 -1.02936542e+04 -8.74193805e+03
-8.53289686e+03 -9.81248029e+03 -8.53206328e+03 -1.03413374e+04]
[-2.60837131e-01 -5.79095237e-01 -9.93497450e-01 -9.10601194e-01
-5.98398479e-01 -9.38637083e-01 -5.79928077e-02 8.99002524e-01
2.88808739e-01 -9.42106882e-01 5.52094275e-01 5.46927381e-03
5.93953872e-01 1.24612425e-02 2.48758652e-01 -4.75608514e-01
-1.05251708e-01 -9.74708293e-01 -2.36691957e-01 2.58281632e-01]
[ 8.67396518e-01 -6.58283966e-01 -4.74981296e-01 3.49638923e-01
-5.64788930e-02 3.53754217e-01 5.85995359e-01 2.63704955e-01
4.27133681e-01 8.94163581e-01 1.71883733e-01 -1.19375941e-01
-5.81176148e-01 7.96857923e-01 4.27862006e-01 1.60020814e-01
7.86553546e-01 -1.59549188e-01 8.31408549e-01 2.31539128e-03]
[-9.71362688e-01 8.90969444e-01 3.45639940e-01 -2.59171866e-01
-8.33383110e-01 -7.55164056e-01 6.95736810e-01 4.55310386e-01
2.33556808e-02 6.46351591e-01 3.34464015e-01 7.75802066e-01
2.47963414e-01 -3.24011543e-01 -6.28102824e-01 9.22612378e-01
-3.30575843e-01 -6.60345017e-02 6.57111850e-01 8.50108007e-01]
[-1.08431201e+03 5.71209877e+03 1.53360283e+03 2.03352774e+02
4.06391738e+03 -2.05829295e+02 3.13323310e+03 -3.43865687e+02
4.27865908e+03 -1.68622685e+02 5.16951391e+03 -1.62369000e+03
5.04118871e+03 3.62548256e+03 5.86156591e+03 -1.03715047e+03
3.26312714e+02 4.45398758e+03 2.76721771e+02 5.59798287e+03]
[-6.61087174e+04 -2.72068899e+04 -1.27760828e+04 -5.56018973e+04
-4.08035681e+04 -5.92243078e+04 -4.78444924e+04 -5.96752355e+04
-3.86453597e+04 -5.87619236e+04 -3.17158820e+04 -7.00837673e+04
-3.23015757e+04 -4.43965964e+04 -2.58532404e+04 -6.58538533e+04
-5.40132062e+04 -3.22828696e+04 -5.50345762e+04 -2.79005373e+04]
[-2.74647219e+05 -1.66095967e+05 -6.65132818e+04 -2.41203261e+05
-2.09023581e+05 -2.53354666e+05 -2.30327073e+05 -2.53999438e+05
-2.01800170e+05 -2.50994995e+05 -1.80570515e+05 -2.87249251e+05
-1.81545984e+05 -2.20801691e+05 -1.61410953e+05 -2.74228597e+05
-2.35903340e+05 -1.77821656e+05 -2.39215242e+05 -1.67043250e+05]
[-2.27411279e+05 -3.23732236e+05 4.29433441e+05 -2.20653762e+05
-3.18999091e+05 -2.28758598e+05 -3.08245658e+05 -2.21194476e+05
-3.12554295e+05 -2.23165350e+05 -3.17532307e+05 -2.23260094e+05
-3.14433972e+05 -3.19727949e+05 -3.23886178e+05 -2.27065034e+05
-2.19023792e+05 -2.88514156e+05 -2.23720544e+05 -3.17376498e+05]
[-3.31698351e+05 -9.54421552e+05 1.39748191e+06 -3.88099452e+05
-8.40489683e+05 -3.85184732e+05 -7.58850700e+05 -3.61143823e+05
-8.38254381e+05 -3.75275290e+05 -9.01274742e+05 -2.90414500e+05
-8.92134505e+05 -8.15776989e+05 -9.64844949e+05 -3.33537765e+05
-3.94198552e+05 -7.97161529e+05 -4.00645087e+05 -9.33591337e+05]
[-1.45739788e+05 -1.43855160e+06 2.63645491e+06 -2.80990413e+05
-1.18305034e+06 -2.69893532e+05 -1.00777219e+06 -2.22391870e+05
-1.19096397e+06 -2.57350720e+05 -1.32799487e+06 -5.77441173e+04
-1.30923532e+06 -1.12572627e+06 -1.45049757e+06 -1.48188313e+05
-3.02432234e+05 -1.12565578e+06 -3.05617031e+05 -1.40223968e+06]
[-3.72207591e+05 -2.39695961e+06 3.78354151e+06 -5.59393693e+05
-2.03043843e+06 -5.60710326e+05 -1.77718659e+06 -4.82104328e+05
-2.05457039e+06 -5.48329314e+05 -2.24775725e+06 -2.56601026e+05
-2.21999729e+06 -1.95432940e+06 -2.38855207e+06 -3.79603603e+05
-5.97327247e+05 -1.89688072e+06 -5.94947656e+05 -2.35050605e+06]
[-1.34264974e+06 -4.20091005e+06 4.98161717e+06 -1.58066737e+06
-3.72427649e+06 -1.59271167e+06 -3.38665929e+06 -1.48363197e+06
-3.76725916e+06 -1.58425146e+06 -4.01548981e+06 -1.20091999e+06
-3.98221957e+06 -3.62774386e+06 -4.16723882e+06 -1.35544986e+06
-1.63590425e+06 -3.48611848e+06 -1.62375261e+06 -4.14496009e+06]
[ 6.56435685e+05 -2.35914384e+06 7.02031898e+06 3.67759426e+05
-1.76681784e+06 3.66795010e+05 -1.33562977e+06 4.80476287e+05
-1.82174397e+06 3.57812238e+05 -2.12696459e+06 8.49919554e+05
-2.10220632e+06 -1.63347205e+06 -2.31322720e+06 6.57779229e+05
2.80967099e+05 -1.65044905e+06 3.22227675e+05 -2.29894477e+06]
[ 5.20118102e+06 2.24066015e+06 9.81077845e+06 4.81930660e+06
3.00225049e+06 4.86767882e+06 3.55398892e+06 4.97080321e+06
2.94666200e+06 4.83189769e+06 2.55630748e+06 5.49490952e+06
2.55943246e+06 3.19661726e+06 2.26522737e+06 5.23292953e+06
4.69652941e+06 2.85010735e+06 4.77145324e+06 2.30735305e+06]
[ 8.93278481e+06 6.02544048e+06 1.19439312e+07 8.47452031e+06
6.91296920e+06 8.57455821e+06 7.55138403e+06 8.66373560e+06
6.86703975e+06 8.51699241e+06 6.41240972e+06 9.31216809e+06
6.38941832e+06 7.15777868e+06 6.01374966e+06 8.99042987e+06
8.32968320e+06 6.55345013e+06 8.42486074e+06 6.09531293e+06]
[ 8.82015094e+06 6.25074357e+06 1.15924140e+07 8.39771361e+06
7.07596199e+06 8.50396138e+06 7.67214871e+06 8.57921077e+06
7.04108742e+06 8.43864582e+06 6.62115882e+06 9.19337882e+06
6.58074431e+06 7.30867244e+06 6.22795562e+06 8.88522548e+06
8.26147512e+06 6.69727885e+06 8.35309773e+06 6.31001030e+06]
[ 6.41831585e+06 4.37195464e+06 9.34739312e+06 6.10614131e+06
5.00087835e+06 6.19103825e+06 5.46878444e+06 6.24569610e+06
4.97725690e+06 6.12917887e+06 4.66155177e+06 6.71727396e+06
4.61141529e+06 5.17754745e+06 4.35564771e+06 6.47482742e+06
6.00151054e+06 4.73129589e+06 6.07819522e+06 4.41755640e+06]
[ 5.47516384e+06 3.93351137e+06 7.33047707e+06 5.22263586e+06
4.43334944e+06 5.30778862e+06 4.80087551e+06 5.33850715e+06
4.41917823e+06 5.25338027e+06 4.17063387e+06 5.72063087e+06
4.11793975e+06 4.57401873e+06 3.90372300e+06 5.52151495e+06
5.14576074e+06 4.18509346e+06 5.20613288e+06 3.97315945e+06]
[ 5.64432687e+06 4.37856479e+06 6.42462669e+06 5.37012917e+06
4.87103978e+06 5.48493231e+06 5.20758839e+06 5.50214026e+06
4.86383164e+06 5.43387554e+06 4.61789345e+06 5.89160292e+06
4.56384029e+06 5.01091164e+06 4.31029931e+06 5.68927533e+06
5.30878794e+06 4.54318995e+06 5.35410494e+06 4.42054203e+06]
[ 4.66023856e+06 3.70023380e+06 5.06310713e+06 4.42076474e+06
4.10584904e+06 4.53382926e+06 4.37817940e+06 4.54296490e+06
4.10825216e+06 4.49033486e+06 3.90336086e+06 4.87382491e+06
3.85433070e+06 4.22460603e+06 3.62117953e+06 4.70139281e+06
4.37746897e+06 3.80427697e+06 4.40907575e+06 3.73601391e+06]
[ 2.80640735e+06 2.32407865e+06 3.01619612e+06 2.67792593e+06
2.53724376e+06 2.75154741e+06 2.69311531e+06 2.75504446e+06
2.55130559e+06 2.71905487e+06 2.44097726e+06 2.94207000e+06
2.40096762e+06 2.60523904e+06 2.26761096e+06 2.83971558e+06
2.65728827e+06 2.36063352e+06 2.67528346e+06 2.34334697e+06]
[ 1.49313899e+06 1.36150980e+06 1.57440518e+06 1.44512467e+06
1.44247795e+06 1.48585321e+06 1.51504296e+06 1.48646248e+06
1.45933589e+06 1.46383114e+06 1.41538139e+06 1.56900495e+06
1.38639624e+06 1.47268952e+06 1.32797693e+06 1.51960211e+06
1.43772714e+06 1.35046810e+06 1.44767333e+06 1.37017592e+06]
[ 5.81527028e+05 4.67869653e+05 6.13168102e+05 5.56420075e+05
5.05661677e+05 5.81405508e+05 5.45933093e+05 5.83432278e+05
5.18096075e+05 5.68931908e+05 4.94874487e+05 6.25386838e+05
4.78466131e+05 5.21360248e+05 4.46791816e+05 5.97854158e+05
5.55024982e+05 4.72964729e+05 5.59832924e+05 4.73826515e+05]
[-5.76288525e+04 -3.32738472e+05 1.87170705e+05 -9.39073186e+04
-2.84570910e+05 -7.44338410e+04 -2.43471765e+05 -6.65951890e+04
-2.79366460e+05 -7.91849067e+04 -3.09391727e+05 -2.49821893e+04
-3.12834976e+05 -2.68745597e+05 -3.47138892e+05 -4.99917477e+04
-9.49799207e+04 -2.77840333e+05 -9.34687077e+04 -3.25473418e+05]
[-3.20382098e+05 -5.55170774e+05 -8.35746057e+04 -3.46790008e+05
-5.22743500e+05 -3.35889030e+05 -4.97303517e+05 -3.29082170e+05
-5.21020548e+05 -3.36106983e+05 -5.41944123e+05 -3.03950316e+05
-5.40129485e+05 -5.13393071e+05 -5.62815305e+05 -3.18569744e+05
-3.46481436e+05 -5.01896635e+05 -3.47204542e+05 -5.49450767e+05]
[-3.21244250e+05 -4.60511065e+05 -1.15963405e+05 -3.34196221e+05
-4.46217551e+05 -3.29858491e+05 -4.34533444e+05 -3.25917899e+05
-4.45377877e+05 -3.29142187e+05 -4.55307132e+05 -3.15455159e+05
-4.53323430e+05 -4.42147049e+05 -4.63200030e+05 -3.21509595e+05
-3.33435708e+05 -4.26437799e+05 -3.34337599e+05 -4.57388024e+05]
[-3.41468317e+04 -5.73082024e+04 -2.29333172e+04 -3.66046941e+04
-5.42991249e+04 -3.57511210e+04 -5.20203205e+04 -3.50383354e+04
-5.42416155e+04 -3.55936266e+04 -5.62563823e+04 -3.28313322e+04
-5.56822800e+04 -5.34698445e+04 -5.77292915e+04 -3.40388297e+04
-3.65343507e+04 -5.17626022e+04 -3.67478710e+04 -5.67303039e+04]
[-1.22175200e+04 -1.80928054e+04 -7.24826043e+03 -1.27477888e+04
-1.74505430e+04 -1.26220905e+04 -1.69784888e+04 -1.24512993e+04
-1.74747058e+04 -1.25508037e+04 -1.79016142e+04 -1.20319762e+04
-1.77404075e+04 -1.72731962e+04 -1.81369029e+04 -1.22592327e+04
-1.27293712e+04 -1.66041277e+04 -1.27964436e+04 -1.79879702e+04]
[-8.67173116e+03 -1.14531137e+04 -5.35619922e+03 -8.82071745e+03
-1.13275997e+04 -8.79673088e+03 -1.12038886e+04 -8.71710910e+03
-1.13164389e+04 -8.75706412e+03 -1.14312718e+04 -8.65197409e+03
-1.13635158e+04 -1.12954686e+04 -1.14631379e+04 -8.70737347e+03
-8.78296785e+03 -1.06926063e+04 -8.82296450e+03 -1.14048103e+04]
[-8.86794262e-01 -9.37590891e-02 -4.98677515e-01 2.82956840e-02
-9.94416127e-01 -8.08787596e-01 1.01773200e-01 4.92356938e-01
-8.21906297e-01 3.58802324e-01 -8.88810386e-01 -4.10858913e-01
-3.44812640e-01 -5.58328633e-01 -3.94194794e-01 -5.93180656e-01
-3.07041332e-01 -9.95738334e-01 8.07143171e-01 -9.39403141e-01]
[-1.89099875e-01 -5.19297000e-01 -2.79800887e-01 5.62686057e-01
4.52306130e-01 -8.34174088e-01 2.91030383e-02 -4.51180883e-01
-6.48447183e-01 4.87777490e-01 -7.00163042e-01 4.37338535e-01
-8.17474282e-01 3.06032934e-01 3.70554876e-01 -2.72155177e-01
8.75910620e-01 -5.64735897e-01 -4.04157430e-01 -5.06274757e-01]
[ 4.66518924e-01 -7.23873124e-01 -3.22300405e-02 -4.05694035e-01
4.80180218e-02 -7.18949772e-01 6.68084561e-01 8.45052240e-01
1.05689488e-01 9.59999940e-01 9.38096037e-01 4.61239384e-01
-8.40008551e-01 -6.81094824e-01 -5.79154586e-02 8.28105052e-01
-8.28063545e-01 9.12920497e-01 9.04893124e-01 4.35100094e-01]
[-7.60394616e-01 5.61151732e-01 7.77530999e-01 7.85290591e-01
6.02224789e-01 7.15125179e-01 2.78285875e-01 2.89031000e-01
-7.31860962e-01 1.14155053e-01 -1.31642989e-01 -4.81828086e-01
5.32015868e-01 -1.48873707e-01 5.27115746e-01 9.72404432e-01
-8.80628069e-02 -8.72514136e-02 7.24025514e-01 -7.19788338e-01]
[-9.89866545e+03 1.12850479e+04 5.37092193e+03 -5.39657285e+03
5.57252803e+03 -6.88020400e+03 2.48903994e+03 -7.20013607e+03
6.42427954e+03 -6.76623913e+03 9.41572829e+03 -1.14123481e+04
9.14972792e+03 4.05478727e+03 1.18926619e+04 -9.72670976e+03
-4.76825691e+03 7.85753450e+03 -5.16758844e+03 1.09263596e+04]
[-1.53938475e+03 1.19208214e+05 2.96649215e+03 1.85902736e+04
9.34312351e+04 1.22762785e+04 7.89772496e+04 1.00099914e+04
9.69199888e+04 1.27054076e+04 1.10546865e+05 -8.71424362e+03
1.09030531e+05 8.64438637e+04 1.21997016e+05 -5.22549233e+02
2.06392104e+04 9.53774284e+04 1.99548560e+04 1.17724563e+05]
[ 1.41518096e+05 3.04515430e+05 1.99833594e+05 1.67365529e+05
2.74884510e+05 1.58870301e+05 2.60519496e+05 1.56783576e+05
2.80227932e+05 1.59029109e+05 2.95545278e+05 1.35422773e+05
2.93469752e+05 2.67496320e+05 3.08149761e+05 1.44127393e+05
1.68736797e+05 2.70841013e+05 1.68380212e+05 3.02711581e+05]
[ 5.69096950e+05 6.44116292e+05 7.42251649e+05 5.72402565e+05
6.54375652e+05 5.70265263e+05 6.65180883e+05 5.71799260e+05
6.58312700e+05 5.69150739e+05 6.52875197e+05 5.79400949e+05
6.50430833e+05 6.57528208e+05 6.43191730e+05 5.73630739e+05
5.68357788e+05 6.22022808e+05 5.69662159e+05 6.45411987e+05]
[ 1.26720546e+06 1.45118871e+06 1.49967378e+06 1.26661147e+06
1.48298382e+06 1.26463172e+06 1.51428780e+06 1.26722123e+06
1.48676463e+06 1.25923543e+06 1.47130489e+06 1.29224173e+06
1.46468266e+06 1.49443663e+06 1.45119882e+06 1.27805507e+06
1.25233846e+06 1.38707517e+06 1.26172171e+06 1.45233636e+06]
[ 2.89575539e+06 3.15346627e+06 2.78452405e+06 2.87031600e+06
3.24673358e+06 2.87455100e+06 3.32782553e+06 2.88076376e+06
3.24480682e+06 2.86012021e+06 3.19901086e+06 2.95350887e+06
3.18903722e+06 3.27931175e+06 3.15558466e+06 2.91665034e+06
2.83725895e+06 3.03953528e+06 2.86115500e+06 3.15423370e+06]
[ 4.28864924e+06 4.68612514e+06 3.70884250e+06 4.25674483e+06
4.81290098e+06 4.26050855e+06 4.93278195e+06 4.26955036e+06
4.80563426e+06 4.23334092e+06 4.74375274e+06 4.36831582e+06
4.72662158e+06 4.85935822e+06 4.69972589e+06 4.32099724e+06
4.20373354e+06 4.50870520e+06 4.24755766e+06 4.68364283e+06]
[ 6.97837957e+06 7.90061985e+06 4.72944170e+06 6.96217982e+06
8.03213713e+06 6.96970628e+06 8.17914839e+06 6.96938537e+06
8.02570366e+06 6.92340762e+06 7.96291181e+06 7.08423213e+06
7.93258625e+06 8.09187451e+06 7.92359977e+06 7.03534494e+06
6.88514791e+06 7.55074437e+06 6.95770633e+06 7.89038788e+06]
[ 9.40757279e+06 1.04038702e+07 6.00161533e+06 9.35357658e+06
1.06059878e+07 9.39114586e+06 1.08104430e+07 9.38168752e+06
1.06036088e+07 9.32903555e+06 1.05040962e+07 9.56926267e+06
1.04623238e+07 1.06945084e+07 1.04133463e+07 9.48590713e+06
9.26275333e+06 9.99496458e+06 9.35273542e+06 1.03974995e+07]
[ 1.05253409e+07 1.10888431e+07 7.08473288e+06 1.03948088e+07
1.14022005e+07 1.04667447e+07 1.16802844e+07 1.04617151e+07
1.13977011e+07 1.03972170e+07 1.12385444e+07 1.07420292e+07
1.11940259e+07 1.15259327e+07 1.10781960e+07 1.06123831e+07
1.02948353e+07 1.07598370e+07 1.03910714e+07 1.10909214e+07]
[ 9.84521962e+06 9.98174715e+06 7.29177927e+06 9.67043999e+06
1.03531094e+07 9.75447912e+06 1.06646223e+07 9.76106053e+06
1.03471743e+07 9.68685002e+06 1.01550690e+07 1.00810487e+07
1.01139883e+07 1.04918265e+07 9.96345414e+06 9.93115651e+06
9.56884190e+06 9.76057220e+06 9.65942272e+06 9.98841719e+06]
[ 8.33256678e+06 8.53872077e+06 6.19157845e+06 8.19307049e+06
8.84109046e+06 8.26590072e+06 9.09990525e+06 8.26858291e+06
8.83716271e+06 8.20391800e+06 8.68173108e+06 8.53226063e+06
8.64060914e+06 8.95557044e+06 8.52380409e+06 8.40921115e+06
8.10787106e+06 8.32363092e+06 8.18424831e+06 8.54222874e+06]
[ 7.37016675e+06 7.78686969e+06 4.92766557e+06 7.27140431e+06
8.00848024e+06 7.33631706e+06 8.19712469e+06 7.32837809e+06
8.00943436e+06 7.28181706e+06 7.89879874e+06 7.52979022e+06
7.85520260e+06 8.09434536e+06 7.76591178e+06 7.43643429e+06
7.20623438e+06 7.54216075e+06 7.26752291e+06 7.78864895e+06]
[ 6.11573950e+06 6.77204718e+06 3.84799629e+06 6.06445515e+06
6.90024074e+06 6.12116549e+06 7.01601512e+06 6.10496447e+06
6.91363936e+06 6.07145182e+06 6.85174283e+06 6.24140748e+06
6.80141376e+06 6.95796268e+06 6.74196933e+06 6.17605750e+06
6.01948041e+06 6.49369409e+06 6.06634632e+06 6.76934738e+06]
[ 4.31810574e+06 5.20654240e+06 2.53904117e+06 4.34521202e+06
5.19659535e+06 4.37868579e+06 5.22297393e+06 4.35404128e+06
5.22307719e+06 4.33680653e+06 5.23250215e+06 4.38902080e+06
5.17819980e+06 5.21500053e+06 5.18177608e+06 4.37043359e+06
4.32065336e+06 4.91469076e+06 4.35764898e+06 5.19651700e+06]
[ 2.51655167e+06 3.39942796e+06 1.41725379e+06 2.59352052e+06
3.30079853e+06 2.60439658e+06 3.27092459e+06 2.58055586e+06
3.33147062e+06 2.57285224e+06 3.38556867e+06 2.54358594e+06
3.33753900e+06 3.29180708e+06 3.38612425e+06 2.55766845e+06
2.58439305e+06 3.14945888e+06 2.61090240e+06 3.38563052e+06]
[ 1.54324264e+06 2.20357630e+06 6.87833563e+05 1.61134846e+06
2.11063578e+06 1.61597955e+06 2.07651954e+06 1.59807811e+06
2.13432686e+06 1.59393432e+06 2.18406051e+06 1.55562678e+06
2.15031518e+06 2.09817701e+06 2.19638668e+06 1.57269849e+06
1.60856427e+06 2.02503140e+06 1.62594107e+06 2.19231826e+06]
[ 9.78747910e+05 1.43415354e+06 3.45654872e+05 1.03046223e+06
1.36183988e+06 1.03245145e+06 1.33348380e+06 1.02009462e+06
1.37871683e+06 1.01784386e+06 1.41700813e+06 9.84696711e+05
1.39420749e+06 1.35055446e+06 1.42971411e+06 9.99008130e+05
1.03019129e+06 1.31435016e+06 1.04172329e+06 1.42638846e+06]
[ 6.32184361e+05 9.56379255e+05 2.53535231e+05 6.66843265e+05
9.08140645e+05 6.66968755e+05 8.86893374e+05 6.58824138e+05
9.18358965e+05 6.58649748e+05 9.44285344e+05 6.34051817e+05
9.30457065e+05 8.99812042e+05 9.53839941e+05 6.44755059e+05
6.66474823e+05 8.72080866e+05 6.73490595e+05 9.51151449e+05]
[ 1.95071203e+05 3.22714111e+05 5.08709031e+04 2.09998274e+05
3.00628676e+05 2.10028835e+05 2.90940386e+05 2.06884742e+05
3.05312081e+05 2.06704051e+05 3.16754917e+05 1.95202717e+05
3.11226580e+05 2.96632333e+05 3.21615313e+05 2.00323904e+05
2.10271116e+05 2.90230406e+05 2.13051075e+05 3.20640431e+05]
[-2.08387953e+04 2.44645790e+04 -2.46808505e+04 -1.32507614e+04
1.22984466e+04 -1.41889085e+04 6.97476953e+03 -1.52158234e+04
1.44857802e+04 -1.51870869e+04 2.05021422e+04 -2.25814659e+04
1.86316215e+04 9.85950310e+03 2.47798969e+04 -1.92041115e+04
-1.27096405e+04 1.43439597e+04 -1.17024790e+04 2.36821462e+04]
[-2.08292270e+04 -2.08638472e+04 -2.22223847e+04 -2.01482232e+04
-2.22731725e+04 -2.01972626e+04 -2.28469479e+04 -2.01564773e+04
-2.18681846e+04 -2.01901882e+04 -2.13335086e+04 -2.09421767e+04
-2.13593235e+04 -2.25677450e+04 -2.08324775e+04 -2.06376969e+04
-1.99715399e+04 -2.04131406e+04 -1.99566007e+04 -2.07956473e+04]
[-1.83266163e+03 -3.03845677e+03 -1.01536568e+03 -1.96231251e+03
-2.89305750e+03 -1.90403790e+03 -2.78934145e+03 -1.87736936e+03
-2.86881946e+03 -1.89862372e+03 -2.96691901e+03 -1.75372065e+03
-2.97564602e+03 -2.85420443e+03 -3.08346572e+03 -1.83257378e+03
-1.94940166e+03 -2.75511561e+03 -1.96603660e+03 -3.00779904e+03]
[-8.02099773e-01 -1.51718453e-01 4.01792937e-01 1.55921083e-02
-2.19778129e-02 7.78306554e-01 1.81399778e-01 3.22505904e-01
6.97992488e-01 3.26437509e-01 2.48111871e-01 -2.20788944e-01
8.69897246e-01 -3.05559289e-01 -3.64319289e-01 -2.25628802e-01
-2.62978822e-01 -4.62267412e-01 8.99097764e-01 -2.38812723e-01]
[-3.48888944e-01 -9.79132627e-01 -3.16525362e-01 7.03215116e-01
7.86911952e-01 1.49256433e-01 -5.48079252e-01 6.95286950e-01
-1.97740903e-01 -7.33062811e-01 -2.12257711e-01 -5.33401629e-01
-1.59438461e-01 9.90830567e-01 -9.24160244e-01 2.14141122e-01
-1.14664380e-01 -8.21770419e-01 -9.07582075e-02 9.20813553e-02]
[-3.96748104e-01 -9.85622866e-02 -4.35271603e-01 6.20038330e-01
4.20907546e-01 -2.14323979e-01 -5.28435195e-02 9.02779881e-01
4.83967204e-01 1.67646437e-01 -8.44194055e-01 -2.45585822e-01
3.19070050e-01 4.77495029e-01 6.92121646e-02 2.06569092e-02
-4.55270126e-01 9.55641761e-01 3.83556537e-01 8.28455689e-01]
[ 6.26253645e-01 4.53501717e-01 4.52264403e-01 8.45014796e-01
-4.63906405e-01 -4.03645587e-01 6.47602631e-02 2.24697773e-01
-4.82943708e-01 -8.95887799e-01 5.65256340e-01 -5.74481918e-01
-3.00520061e-01 5.98535085e-01 9.09037640e-01 6.25270347e-01
-6.87468001e-01 -8.87802501e-01 9.35184767e-02 -1.85185527e-01]
[ 9.28053624e-01 1.21296500e-01 3.00247676e-01 9.74495966e-01
9.56349719e-01 -2.80692987e-01 -8.96601536e-01 9.85592270e-01
2.69478314e-01 4.60160699e-01 -6.02402172e-01 9.53517549e-01
-6.74068214e-02 4.57637101e-01 9.07484746e-01 -4.32634966e-01
1.47795493e-01 5.13381946e-01 -8.37901675e-01 -7.85961914e-01]
[ 2.46149469e+03 4.21294075e+03 3.69309772e+01 2.72237176e+03
3.88239140e+03 2.63649134e+03 3.72081313e+03 2.60336713e+03
3.91734822e+03 2.63899924e+03 4.08450475e+03 2.37929007e+03
4.09072762e+03 3.80476871e+03 4.28669915e+03 2.48625207e+03
2.73007456e+03 3.84302042e+03 2.74630906e+03 4.19116452e+03]
[ 4.40483960e+04 7.84864070e+04 9.83897391e+03 4.87962989e+04
7.23640855e+04 4.73760866e+04 6.91657076e+04 4.67343753e+04
7.30077251e+04 4.72980883e+04 7.62249068e+04 4.25443748e+04
7.59734791e+04 7.09086304e+04 7.94404409e+04 4.45263584e+04
4.89678413e+04 7.08235436e+04 4.92201060e+04 7.79876653e+04]
[ 2.15823003e+05 3.74783205e+05 7.48157843e+04 2.37169842e+05
3.46531866e+05 2.31371154e+05 3.32348461e+05 2.28391915e+05
3.49913493e+05 2.30282733e+05 3.64645531e+05 2.09774841e+05
3.62485315e+05 3.40336806e+05 3.78530255e+05 2.18428242e+05
2.37511266e+05 3.38130563e+05 2.39363199e+05 3.72185667e+05]
[ 5.73159707e+05 9.54209408e+05 1.41809109e+05 6.21835737e+05
8.90620461e+05 6.08750569e+05 8.59684965e+05 6.01131742e+05
8.98015160e+05 6.05989190e+05 9.31015693e+05 5.59499029e+05
9.26251336e+05 8.77505427e+05 9.63463644e+05 5.79266525e+05
6.21676255e+05 8.63766987e+05 6.27176429e+05 9.48109155e+05]
[ 1.32553628e+06 2.24100393e+06 2.93910316e+05 1.43477904e+06
2.09852439e+06 1.40588946e+06 2.02782039e+06 1.38721151e+06
2.11433897e+06 1.39919288e+06 2.18919243e+06 1.29403391e+06
2.17639033e+06 2.06915991e+06 2.26110308e+06 1.33935221e+06
1.43251781e+06 2.01777761e+06 1.44667386e+06 2.22702457e+06]
[ 2.83202588e+06 4.66394218e+06 4.78776908e+05 3.03476133e+06
4.40037609e+06 2.98356974e+06 4.26924235e+06 2.94509854e+06
4.42791720e+06 2.96915488e+06 4.56785679e+06 2.77437702e+06
4.54148979e+06 4.34704418e+06 4.70006662e+06 2.86059067e+06
3.02601495e+06 4.20612932e+06 3.05769653e+06 4.63677011e+06]
[ 4.86274545e+06 7.82705444e+06 6.06517248e+05 5.18172415e+06
7.41038157e+06 5.10470589e+06 7.20432043e+06 5.04104124e+06
7.45323909e+06 5.07871936e+06 7.67527226e+06 4.77301485e+06
7.63019142e+06 7.32786340e+06 7.88157878e+06 4.91111643e+06
5.16524656e+06 7.07868989e+06 5.21934758e+06 7.78240741e+06]
[ 7.14237994e+06 1.12270471e+07 7.80174746e+05 7.57079944e+06
1.06674534e+07 7.47310543e+06 1.03909180e+07 7.38441346e+06
1.07268102e+07 7.43381653e+06 1.10250968e+07 7.02914624e+06
1.09612924e+07 1.05593550e+07 1.12969684e+07 7.21477162e+06
7.54585813e+06 1.01893659e+07 7.62214896e+06 1.11644532e+07]
[ 8.29260434e+06 1.28361519e+07 9.81391148e+05 8.76937638e+06
1.22118132e+07 8.66498562e+06 1.19057655e+07 8.56715864e+06
1.22810993e+07 8.61852493e+06 1.26130393e+07 8.17516812e+06
1.25403622e+07 1.20932634e+07 1.29114181e+07 8.38017622e+06
8.74102584e+06 1.16836908e+07 8.82703217e+06 1.27649938e+07]
[ 7.82668498e+06 1.22511449e+07 1.00834000e+06 8.30597016e+06
1.16190439e+07 8.20357463e+06 1.13125236e+07 8.10784418e+06
1.16926131e+07 8.15589390e+06 1.20278653e+07 7.71241058e+06
1.19506088e+07 1.14994255e+07 1.23238413e+07 7.91693081e+06
8.27940594e+06 1.11359744e+07 8.36629978e+06 1.21805152e+07]
[ 7.19009238e+06 1.14402593e+07 9.12797006e+05 7.66365803e+06
1.08106523e+07 7.56329486e+06 1.05060006e+07 7.47020077e+06
1.08871419e+07 7.51715869e+06 1.12197259e+07 7.07673282e+06
1.11417692e+07 1.06907065e+07 1.15117208e+07 7.27879224e+06
7.64070642e+06 1.03760477e+07 7.72432871e+06 1.13723551e+07]
[ 6.30274368e+06 9.94262563e+06 6.86296371e+05 6.70400458e+06
9.40690514e+06 6.62001505e+06 9.14627942e+06 6.53962323e+06
9.47108292e+06 6.57946369e+06 9.75457462e+06 6.20459295e+06
9.68638678e+06 9.30461043e+06 1.00037390e+07 6.37837111e+06
6.68368130e+06 9.02671942e+06 6.75553343e+06 9.88457173e+06]
[ 5.12158621e+06 8.05185545e+06 4.93947387e+05 5.44120139e+06
7.62451887e+06 5.37595388e+06 7.41036914e+06 5.30950334e+06
7.67324267e+06 5.34221004e+06 7.90144710e+06 5.04002952e+06
7.84502697e+06 7.54064401e+06 8.09747806e+06 5.18005798e+06
5.42726438e+06 7.31115322e+06 5.48263870e+06 8.00574567e+06]
[ 4.02609803e+06 6.43178368e+06 5.71879744e+05 4.29392735e+06
6.06971604e+06 4.24405141e+06 5.88659184e+06 4.18880586e+06
6.11541588e+06 4.21294535e+06 6.30861380e+06 3.96407071e+06
6.25582195e+06 5.99842723e+06 6.46315672e+06 4.07784480e+06
4.28519637e+06 5.82880385e+06 4.33028905e+06 6.39305506e+06]
[ 2.87576423e+06 4.71496709e+06 6.57330471e+05 3.08985388e+06
4.42119673e+06 3.05352358e+06 4.27643597e+06 3.01164986e+06
4.46230779e+06 3.02707044e+06 4.61861457e+06 2.83252199e+06
4.57209133e+06 4.36425886e+06 4.73465754e+06 2.92054559e+06
3.08408827e+06 4.26004686e+06 3.12010214e+06 4.68358905e+06]
[ 2.02017046e+06 3.34087632e+06 5.85513386e+05 2.17876061e+06
3.12254147e+06 2.15302606e+06 3.01806023e+06 2.12432904e+06
3.15464547e+06 2.13291288e+06 3.27066192e+06 1.99205770e+06
3.23459359e+06 3.08096952e+06 3.35294006e+06 2.05553372e+06
2.17443956e+06 3.01702397e+06 2.20122760e+06 3.31723438e+06]
[ 1.22245138e+06 2.06547290e+06 3.73494477e+05 1.32727235e+06
1.92005857e+06 1.31059640e+06 1.85123831e+06 1.29244653e+06
1.94150004e+06 1.29691635e+06 2.01882002e+06 1.20421754e+06
1.99428325e+06 1.89209900e+06 2.07288979e+06 1.24604917e+06
1.32517351e+06 1.86036532e+06 1.34239091e+06 2.04990044e+06]
[ 7.66715945e+05 1.33187431e+06 2.54677540e+05 8.38723570e+05
1.23185129e+06 8.26812235e+05 1.18413987e+06 8.14898127e+05
1.24623563e+06 8.17798062e+05 1.29922479e+06 7.53605759e+05
1.28345732e+06 1.21217848e+06 1.33737303e+06 7.82590528e+05
8.38157467e+05 1.19578535e+06 8.48900503e+05 1.32131602e+06]
[ 5.01044103e+05 8.69914250e+05 1.75026950e+05 5.46357155e+05
8.07377011e+05 5.38484781e+05 7.76410022e+05 5.30925837e+05
8.16212727e+05 5.33300575e+05 8.49547992e+05 4.92258140e+05
8.39888916e+05 7.94797296e+05 8.73292383e+05 5.10841613e+05
5.45771006e+05 7.80913186e+05 5.52248974e+05 8.63193960e+05]
[ 1.83598925e+05 3.32844070e+05 5.03558992e+04 2.02462312e+05
3.06417151e+05 1.99269150e+05 2.93296549e+05 1.96134558e+05
3.10323367e+05 1.97110887e+05 3.24323202e+05 1.79835939e+05
3.20208189e+05 3.01110564e+05 3.34147573e+05 1.87624158e+05
2.02375282e+05 2.97237034e+05 2.04981696e+05 3.30039320e+05]
[ 6.91751514e+04 1.21195113e+05 3.06367694e+04 7.55137593e+04
1.12223853e+05 7.44573911e+04 1.07804067e+05 7.33667829e+04
1.13378917e+05 7.36346577e+04 1.18231776e+05 6.77505862e+04
1.16718678e+05 1.10340322e+05 1.21539894e+05 7.04378687e+04
7.54397594e+04 1.08464536e+05 7.63942739e+04 1.20223559e+05]
[ 1.17419998e+04 2.05040475e+04 6.75994245e+03 1.28342814e+04
1.89418298e+04 1.26660814e+04 1.81859969e+04 1.24790041e+04
1.91652886e+04 1.25107303e+04 2.00134468e+04 1.15151201e+04
1.97064698e+04 1.86170802e+04 2.05343634e+04 1.19629008e+04
1.28064266e+04 1.83599386e+04 1.29935325e+04 2.03371139e+04]
[ 7.95435542e-01 3.66927426e-01 -7.35564375e-01 2.67462538e-02
-5.56368024e-01 2.46174808e-01 -1.22257981e-02 7.84399119e-02
-2.20342716e-01 2.18654539e-01 8.73876842e-01 9.31141776e-02
-3.36021020e-01 -9.87107513e-01 -7.01504626e-01 -8.79652213e-01
-8.99813294e-01 7.76717502e-01 -2.38715958e-01 -8.34657056e-01]
[-9.38432905e-01 1.00773837e-01 1.54338949e-01 2.37073737e-01
-1.69689071e-01 4.83755273e-01 9.00190348e-01 -7.37110288e-02
-6.70798465e-01 -9.01007059e-01 -1.79700255e-01 9.29154685e-01
2.19112067e-01 -6.96463507e-01 -6.71808983e-01 3.18152630e-01
1.45935032e-01 6.23218977e-01 -8.19527663e-01 -2.24235567e-01]
[ 7.29089927e-01 2.59132726e-01 -8.62876364e-01 9.54327879e-01
1.31797183e-02 -5.89768232e-01 4.14285804e-01 2.49844788e-01
5.12070916e-01 -4.00060069e-01 4.29476101e-01 3.32279549e-01
7.12188445e-01 -6.88917587e-01 -6.38826026e-01 -4.67439385e-01
1.80809746e-01 -8.99343356e-01 6.57881592e-01 7.58598649e-01]
[ 4.28299283e-01 -2.88572558e-01 -7.91460873e-01 -9.74866917e-01
5.06118926e-01 3.09750790e-01 9.01609781e-01 8.84692276e-01
-8.33521479e-01 9.29410442e-01 9.57454914e-04 -8.55746219e-01
9.23611421e-01 -3.15106391e-01 -7.11726352e-01 5.82875430e-01
-5.81634276e-01 -9.95675036e-02 8.74802476e-02 -3.59145210e-01]
[-1.63156745e-01 5.63843539e-01 -9.98715824e-02 -2.03493772e-01
6.00415864e-01 8.61730095e-01 1.12647708e-01 -5.88556255e-01
-5.46894912e-01 3.77413517e-01 -1.98235195e-01 6.38787173e-01
7.89962305e-01 -2.45781383e-01 -4.16216476e-01 9.05707402e-01
6.02552447e-01 -6.84880596e-01 7.90689288e-01 8.41104414e-01]
[-6.09058124e-01 6.06368523e-01 5.53481506e-01 1.25277474e-01
7.54257628e-02 -2.45605485e-01 8.48140604e-01 -6.53820682e-01
-4.96511371e-01 -5.50106981e-01 7.04067481e-01 -3.57817758e-01
4.63119706e-01 -4.76268576e-01 -6.23609600e-01 9.01547086e-01
9.29612305e-01 -9.33405344e-01 2.31445813e-01 6.18405206e-01]
[ 1.20140280e+03 2.62441284e+03 8.12637666e+02 1.40832892e+03
2.33780338e+03 1.36059545e+03 2.20122482e+03 1.33380821e+03
2.36884541e+03 1.34238215e+03 2.52074822e+03 1.14203978e+03
2.48917044e+03 2.27756340e+03 2.64777078e+03 1.23303290e+03
1.41458002e+03 2.29306898e+03 1.43284713e+03 2.59461919e+03]
[ 1.49933337e+04 2.99284805e+04 7.22933166e+03 1.71013625e+04
2.70069686e+04 1.66120166e+04 2.56030088e+04 1.63209874e+04
2.73145606e+04 1.64257714e+04 2.88547576e+04 1.43815423e+04
2.85532857e+04 2.63903095e+04 3.01967201e+04 1.52899384e+04
1.71644022e+04 2.64159981e+04 1.73686106e+04 2.96321147e+04]
[ 4.07050544e+04 8.76562067e+04 -1.40982300e+03 4.82383149e+04
7.71481680e+04 4.61277016e+04 7.22643278e+04 4.51621578e+04
7.84841234e+04 4.57226511e+04 8.37542492e+04 3.82750847e+04
8.29371203e+04 7.50424001e+04 8.92085927e+04 4.13726729e+04
4.84513849e+04 7.70955462e+04 4.92349481e+04 8.67444357e+04]
[ 1.19431694e+05 2.90343407e+05 -2.92102380e+04 1.44030819e+05
2.56510883e+05 1.37069999e+05 2.40816158e+05 1.33463892e+05
2.60597223e+05 1.35694439e+05 2.77633747e+05 1.11289791e+05
2.74975076e+05 2.49959585e+05 2.95737680e+05 1.21712716e+05
1.44039844e+05 2.50111371e+05 1.47313245e+05 2.87291031e+05]
[ 5.03771110e+05 9.53494780e+05 1.89986141e+04 5.54788906e+05
8.86167987e+05 5.40622730e+05 8.53018440e+05 5.31706011e+05
8.93068346e+05 5.37497091e+05 9.27968784e+05 4.87768250e+05
9.22847924e+05 8.72907376e+05 9.64720855e+05 5.10011131e+05
5.52793337e+05 8.41586389e+05 5.60392100e+05 9.46600970e+05]
[ 1.26046249e+06 2.16103670e+06 6.85846433e+04 1.35891172e+06
2.03126610e+06 1.33179678e+06 1.96729927e+06 1.31370188e+06
2.04389759e+06 1.32564222e+06 2.11141044e+06 1.22908514e+06
2.10185952e+06 2.00587238e+06 2.18285862e+06 1.27311445e+06
1.35393041e+06 1.93508919e+06 1.36977561e+06 2.14745286e+06]
[ 2.30682635e+06 3.67662457e+06 5.42605863e+04 2.45125388e+06
3.48685356e+06 2.41235582e+06 3.39152947e+06 2.38398344e+06
3.50435213e+06 2.40293823e+06 3.60369447e+06 2.26020627e+06
3.58991232e+06 3.44955645e+06 3.70800784e+06 2.32639989e+06
2.44271017e+06 3.33082734e+06 2.46716119e+06 3.65617965e+06]
[ 3.15884487e+06 4.92671669e+06 -6.80547121e+04 3.34448698e+06
4.68244497e+06 3.29509953e+06 4.55863280e+06 3.25740495e+06
4.70540485e+06 3.28290563e+06 4.83314368e+06 3.09831859e+06
4.81524715e+06 4.63472517e+06 4.96681359e+06 3.18427886e+06
3.33333718e+06 4.48047240e+06 3.36497696e+06 4.90012785e+06]
[ 3.50280665e+06 5.44283818e+06 -3.47164469e+03 3.70894623e+06
5.17196607e+06 3.65611807e+06 5.03603686e+06 3.61514413e+06
5.19972097e+06 3.64184673e+06 5.34128730e+06 3.44097256e+06
5.31910821e+06 5.12015335e+06 5.48512920e+06 3.53430084e+06
3.69618637e+06 4.95528204e+06 3.73181670e+06 5.41304092e+06]
[ 3.32515980e+06 5.27583138e+06 8.12798803e+04 3.53305502e+06
5.00240110e+06 3.48147547e+06 4.86512655e+06 3.44088787e+06
5.03262834e+06 3.46680699e+06 5.17560161e+06 3.26674413e+06
5.15087715e+06 4.95034999e+06 5.31594510e+06 3.35947996e+06
3.51994589e+06 4.78729295e+06 3.55596349e+06 5.24584189e+06]
[ 2.94961522e+06 4.80301436e+06 4.03674778e+04 3.15437619e+06
4.52962984e+06 3.10366735e+06 4.39385802e+06 3.06488701e+06
4.56176542e+06 3.08987305e+06 4.70351638e+06 2.89142806e+06
4.67893310e+06 4.47754907e+06 4.84236385e+06 2.98278767e+06
3.14323990e+06 4.34328736e+06 3.17773926e+06 4.77413382e+06]
[ 2.68986723e+06 4.42033131e+06 -3.34548391e+04 2.88652987e+06
4.15592762e+06 2.83723590e+06 4.02435982e+06 2.80060932e+06
4.18545375e+06 2.82422672e+06 4.32300969e+06 2.63081388e+06
4.29937243e+06 4.10469346e+06 4.45821646e+06 2.71987081e+06
2.87736743e+06 3.99288904e+06 2.90967255e+06 4.39290250e+06]
[ 2.07172428e+06 3.35144646e+06 -2.69830966e+04 2.21691985e+06
3.15711833e+06 2.18011915e+06 3.05685703e+06 2.15273620e+06
3.17736627e+06 2.17025679e+06 3.27911487e+06 2.02625827e+06
3.26163004e+06 3.11879473e+06 3.37929188e+06 2.09247159e+06
2.21059505e+06 3.03466716e+06 2.23421510e+06 3.33138408e+06]
[ 1.52595148e+06 2.52144767e+06 -1.00334725e+04 1.64253914e+06
2.36338820e+06 1.61496346e+06 2.28142121e+06 1.59327317e+06
2.38275800e+06 1.60590648e+06 2.46470398e+06 1.49283972e+06
2.44889400e+06 2.33284723e+06 2.54181250e+06 1.54392493e+06
1.63853122e+06 2.27819738e+06 1.65729090e+06 2.50517010e+06]
[ 1.04068225e+06 1.79015329e+06 1.05373826e+05 1.12868939e+06
1.66965695e+06 1.10966175e+06 1.60941064e+06 1.09358944e+06
1.68486337e+06 1.10167127e+06 1.74797773e+06 1.01798629e+06
1.73404748e+06 1.64608958e+06 1.80304248e+06 1.05590624e+06
1.12592940e+06 1.60700675e+06 1.14008710e+06 1.77757633e+06]
[ 7.81220707e+05 1.33390356e+06 1.39098472e+05 8.48324721e+05
1.24104874e+06 8.34519586e+05 1.19553911e+06 8.22940762e+05
1.25322368e+06 8.28029000e+05 1.30202112e+06 7.65155883e+05
1.29014742e+06 1.22293399e+06 1.34241181e+06 7.93503086e+05
8.46471698e+05 1.19990926e+06 8.57205874e+05 1.32419012e+06]
[ 5.01123927e+05 8.60093320e+05 1.28326961e+05 5.46210586e+05
7.97569615e+05 5.36781766e+05 7.67410554e+05 5.29494114e+05
8.06172416e+05 5.32467544e+05 8.38942357e+05 4.90741481e+05
8.30639904e+05 7.85477928e+05 8.65671734e+05 5.09248095e+05
5.45005447e+05 7.73886691e+05 5.52160322e+05 8.53555802e+05]
[ 3.13873449e+05 5.41499045e+05 1.16545724e+05 3.42471817e+05
5.02055259e+05 3.36693470e+05 4.82716349e+05 3.32222995e+05
5.07711871e+05 3.33894341e+05 5.28410360e+05 3.07977554e+05
5.23060682e+05 4.94234504e+05 5.44672457e+05 3.19372545e+05
3.41914167e+05 4.87296428e+05 3.46126559e+05 5.37429033e+05]
[ 1.74141612e+05 2.98221751e+05 5.92590803e+04 1.89582506e+05
2.76988159e+05 1.86475143e+05 2.66534783e+05 1.84087866e+05
2.80239700e+05 1.84964392e+05 2.91290552e+05 1.71161092e+05
2.88367813e+05 2.72869394e+05 2.99943793e+05 1.77293046e+05
1.89217211e+05 2.68637729e+05 1.91461675e+05 2.95981010e+05]
[ 7.70686313e+04 1.18919621e+05 3.71600699e+04 8.16181206e+04
1.12864636e+05 8.07062321e+04 1.09925100e+05 7.99605884e+04
1.13586067e+05 8.01603621e+04 1.16857818e+05 7.61905233e+04
1.15963166e+05 1.11661417e+05 1.19390882e+05 7.80620477e+04
8.13505935e+04 1.08401316e+05 8.21403078e+04 1.18199319e+05]
[ 2.00769629e+04 2.83849975e+04 1.14886415e+04 2.08913587e+04
2.73552956e+04 2.07254724e+04 2.69021725e+04 2.05935606e+04
2.74647198e+04 2.05992896e+04 2.80290642e+04 1.99611381e+04
2.78580077e+04 2.71657555e+04 2.84817898e+04 2.02849154e+04
2.07972115e+04 2.62026885e+04 2.09798884e+04 2.82462689e+04]
[ 6.04658682e-01 9.12474780e-01 5.18903936e-01 8.53073651e-01
-8.21428503e-01 7.33713371e-01 9.67953597e-01 8.32444395e-02
6.97239794e-01 -2.36199708e-01 3.60902384e-01 -9.76434463e-02
2.38733166e-01 -8.16488560e-01 8.06915547e-01 -9.69485467e-01
1.10502127e-01 -7.95462389e-01 9.31313040e-01 -1.84270741e-03]
[ 9.69738971e-01 1.67520815e-01 -1.71912507e-03 -2.10249337e-01
7.26366323e-01 -3.25923531e-01 4.57540561e-01 -7.81700319e-01
5.31839463e-01 4.54029200e-01 5.33417022e-01 8.93708968e-01
-7.73344171e-01 -6.02877190e-01 -8.43487217e-01 -2.75690972e-01
-6.08990794e-02 4.40515462e-02 -3.55596888e-01 8.18083195e-01]
[ 2.80220745e-01 5.22893881e-01 -2.07329348e-01 9.58764919e-01
-5.14019080e-01 8.82042125e-01 3.57976836e-01 6.51210548e-02
-9.31384934e-02 -3.34401184e-01 3.02766689e-01 -7.89355737e-01
-4.93219588e-01 8.59582296e-01 -5.87396813e-01 6.34903913e-01
-3.00504352e-01 4.63497068e-01 -9.64828995e-01 3.84823092e-01]
[-2.41618705e-01 5.66671233e-01 6.65282603e-02 8.30098511e-01
-8.03899960e-01 4.61935320e-02 -1.12370122e-01 5.97784792e-01
4.25957179e-01 1.72175369e-01 4.71524924e-01 1.37788579e-01
1.17276882e-01 1.05511931e-01 8.90962843e-01 -3.22809186e-01
-1.48934013e-02 -6.89915533e-01 -9.66437046e-01 7.29574222e-02]
[ 5.23011829e-01 8.60530391e-01 -5.12435590e-01 4.64878342e-01
4.16646953e-01 -7.01402087e-03 -4.01933967e-01 8.26675396e-01
8.66112780e-01 -8.66462505e-01 1.47177351e-01 7.60784152e-01
9.50551613e-01 9.55571494e-01 -2.41345855e-01 8.33726060e-01
-6.44782061e-01 -6.63602830e-01 -2.75727005e-01 -8.05995946e-01]
[ 9.81864274e-01 3.59641892e-01 8.77308144e-02 8.59534303e-01
9.94948517e-01 6.22941747e-01 -7.95335309e-01 -8.37654022e-01
-1.71502373e-01 1.09504856e-01 3.33920708e-01 5.88236670e-01
3.10246379e-01 -3.36584116e-01 5.74452116e-01 -5.51883324e-01
-4.90368432e-01 -2.99479041e-01 -1.08942377e-01 -6.00767293e-02]
[ 8.16457939e-01 -9.57030337e-01 7.56808201e-01 2.99785395e-01
-1.50881848e-01 -4.93406345e-01 7.26128910e-01 9.60166983e-01
-4.42379317e-01 9.21779474e-01 -3.80818148e-01 3.24996155e-01
6.04734749e-01 -1.92417197e-01 9.62344199e-01 -3.14130703e-01
-7.80663487e-01 -6.84924430e-01 -8.35177852e-01 2.33227778e-01]
[ 2.06996650e-01 -3.06854685e-01 -2.24064843e-01 1.91555496e-01
1.79392718e-02 4.38613318e-01 1.33957682e-01 5.32155381e-01
7.35053030e-01 -5.01399610e-01 -6.84124116e-01 -3.74097217e-01
-2.21592107e-01 -5.90510458e-01 1.40519310e-01 2.43059400e-01
-1.85872925e-01 -1.11440433e-01 -9.75153315e-01 -2.66862348e-01]
[-5.25182086e-01 -9.95316194e-01 6.73804898e-01 1.76596803e-01
7.08470879e-01 1.60169864e-01 -9.94964669e-01 1.26533708e-01
7.63531941e-01 -9.44516020e-01 -5.19920044e-01 -8.43138386e-01
-4.06999690e-01 6.97276547e-01 -4.91741139e-01 1.21562989e-01
-2.55829183e-01 7.01575873e-01 3.31003464e-02 -6.88108612e-01]
[-3.72855785e+04 -4.40164652e+04 -1.97804288e+04 -3.63725784e+04
-4.56191815e+04 -3.67360826e+04 -4.59768230e+04 -3.66110765e+04
-4.52540382e+04 -3.67796998e+04 -4.46036093e+04 -3.77598661e+04
-4.48002432e+04 -4.58425837e+04 -4.37645328e+04 -3.74380670e+04
-3.61581149e+04 -4.17466261e+04 -3.61160698e+04 -4.40803611e+04]
[-8.29343991e+04 -8.35369327e+04 -2.88593512e+04 -8.17681690e+04
-8.53593827e+04 -8.22186579e+04 -8.57720169e+04 -8.20928038e+04
-8.49333569e+04 -8.23076577e+04 -8.41601514e+04 -8.33456129e+04
-8.44693530e+04 -8.55936638e+04 -8.32181612e+04 -8.29818519e+04
-8.16877947e+04 -8.30403065e+04 -8.15368206e+04 -8.36471779e+04]
[-6.70120833e+04 -4.56879818e+04 -2.51626007e+04 -6.39381604e+04
-4.98757325e+04 -6.49089406e+04 -5.15214771e+04 -6.51799192e+04
-4.92128386e+04 -6.50962560e+04 -4.71787773e+04 -6.78921252e+04
-4.76757102e+04 -5.05647561e+04 -4.49227785e+04 -6.67482849e+04
-6.40558018e+04 -5.08772556e+04 -6.35535144e+04 -4.60518441e+04]
[ 3.11868445e+04 6.85598045e+04 -1.96401834e+04 3.68009507e+04
6.08688054e+04 3.50575466e+04 5.75532512e+04 3.42936761e+04
6.18191505e+04 3.47959286e+04 6.56178027e+04 2.91763109e+04
6.50549257e+04 5.94872383e+04 6.99939974e+04 3.15714023e+04
3.67113170e+04 5.96958776e+04 3.75478994e+04 6.78844668e+04]
[ 1.10457864e+05 1.66320616e+05 1.69895104e+04 1.16238729e+05
1.58923442e+05 1.14585566e+05 1.55065699e+05 1.13468093e+05
1.59609540e+05 1.14323749e+05 1.63475589e+05 1.08683709e+05
1.63067041e+05 1.57409418e+05 1.67723312e+05 1.11172929e+05
1.15939992e+05 1.52284856e+05 1.16778485e+05 1.65575877e+05]
[ 2.16297663e+05 3.20188931e+05 1.14340555e+04 2.26289149e+05
3.07575889e+05 2.23389544e+05 3.00766294e+05 2.21262899e+05
3.08546736e+05 2.22867920e+05 3.15226642e+05 2.12929873e+05
3.14553617e+05 3.05015153e+05 3.22681771e+05 2.17520235e+05
2.25609774e+05 2.93587735e+05 2.27160377e+05 3.18777636e+05]
[ 3.42402930e+05 5.00152131e+05 5.39818890e+03 3.57102689e+05
4.81668395e+05 3.52806190e+05 4.71764833e+05 3.49542733e+05
4.83036254e+05 3.51997606e+05 4.92813933e+05 3.37322748e+05
4.91850236e+05 4.78042652e+05 5.03903444e+05 3.44253109e+05
3.55837284e+05 4.59401618e+05 3.58375312e+05 4.97993430e+05]
[ 4.22735034e+05 6.29452411e+05 5.06869218e+04 4.43491517e+05
6.02684747e+05 4.37608940e+05 5.88758884e+05 4.33488808e+05
6.05444672e+05 4.36470050e+05 6.19289252e+05 4.16298633e+05
6.17515633e+05 5.97474325e+05 6.34285849e+05 4.25392513e+05
4.42079898e+05 5.77007440e+05 4.45384623e+05 6.26515364e+05]
[ 3.50456206e+05 5.49083616e+05 6.20367108e+04 3.72293511e+05
5.18951228e+05 3.66377074e+05 5.04027865e+05 3.62395177e+05
5.24075840e+05 3.65267535e+05 5.38625690e+05 3.44094738e+05
5.36520846e+05 5.13347902e+05 5.53817543e+05 3.53454236e+05
3.71325780e+05 5.00523746e+05 3.74385969e+05 5.46122261e+05]
[ 3.94827062e+05 6.17324984e+05 3.24698431e+04 4.18933171e+05
5.85148722e+05 4.12582538e+05 5.68532838e+05 4.08046540e+05
5.89256727e+05 4.11330848e+05 6.05580507e+05 3.87441168e+05
6.03258161e+05 5.78869651e+05 6.22454847e+05 3.98588789e+05
4.17692367e+05 5.62374963e+05 4.21380528e+05 6.14052317e+05]
[ 2.66095957e+05 4.21819080e+05 9.47308785e+03 2.83895339e+05
3.98482316e+05 2.79028302e+05 3.84053729e+05 2.75791547e+05
4.01111453e+05 2.78260228e+05 4.13005643e+05 2.60528632e+05
4.11520889e+05 3.94069037e+05 4.25912566e+05 2.68604931e+05
2.83037290e+05 3.84243496e+05 2.85921002e+05 4.19528012e+05]
[ 1.97698729e+05 3.05957315e+05 4.30193770e+03 2.09738655e+05
2.90090241e+05 2.06279751e+05 2.80497737e+05 2.04023339e+05
2.91833833e+05 2.05709015e+05 2.99854936e+05 1.93824463e+05
2.99019000e+05 2.87097795e+05 3.08980698e+05 1.99076324e+05
2.09205330e+05 2.79511793e+05 2.11099950e+05 3.04385886e+05]
[ 1.51643026e+05 2.25374989e+05 4.13121262e+03 1.59055953e+05
2.15839402e+05 1.56920298e+05 2.10969756e+05 1.55427839e+05
2.16706321e+05 1.56501282e+05 2.21625092e+05 1.49223083e+05
2.21161138e+05 2.14055387e+05 2.27268618e+05 1.52617378e+05
1.58542336e+05 2.06606172e+05 1.59794145e+05 2.24287886e+05]
[ 1.13799699e+05 1.70486345e+05 8.95348739e+03 1.19583998e+05
1.62973656e+05 1.18035323e+05 1.59249029e+05 1.16907742e+05
1.63712629e+05 1.17638188e+05 1.67613197e+05 1.12093014e+05
1.67095759e+05 1.61615293e+05 1.71779581e+05 1.14701655e+05
1.19140509e+05 1.56059905e+05 1.20188976e+05 1.69601119e+05]
[ 5.54044141e+04 8.65873198e+04 1.02012374e+04 5.89174044e+04
8.19428123e+04 5.80454593e+04 7.96718390e+04 5.74492731e+04
8.24955820e+04 5.77879038e+04 8.48934331e+04 5.45057002e+04
8.44888392e+04 8.10582680e+04 8.72524211e+04 5.60070345e+04
5.87476835e+04 7.88725293e+04 5.92985084e+04 8.60838501e+04]
[ 3.86412782e+04 6.34266004e+04 3.69041190e+03 4.15761809e+04
5.95040458e+04 4.10094795e+04 5.75473756e+04 4.05228220e+04
6.02139243e+04 4.07724839e+04 6.22121873e+04 3.82072974e+04
6.16840341e+04 5.88036631e+04 6.37857042e+04 3.93474879e+04
4.14491197e+04 5.74974764e+04 4.18980123e+04 6.30148277e+04]
[ 2.25064378e+04 3.98621392e+04 -3.79686780e+03 2.47630385e+04
3.68006756e+04 2.43332168e+04 3.52462248e+04 2.39700816e+04
3.74321549e+04 2.41579558e+04 3.89642615e+04 2.21880932e+04
3.85152544e+04 3.62665503e+04 4.01309473e+04 2.30320219e+04
2.47114033e+04 3.58485686e+04 2.50175042e+04 3.95535956e+04]
[ 1.87880340e+04 3.05568405e+04 5.06973668e+03 2.01606448e+04
2.87160621e+04 1.98708005e+04 2.77791071e+04 1.96428792e+04
2.89520684e+04 1.97423887e+04 2.99430849e+04 1.84861222e+04
2.96733772e+04 2.83438427e+04 3.07189563e+04 1.90526656e+04
2.01085198e+04 2.76744292e+04 2.03180788e+04 3.03550426e+04]
[-6.87044688e-01 -8.12663762e-01 3.53047511e-01 2.80693483e-01
-7.90176046e-01 7.83349247e-01 -2.40204684e-02 -1.11846145e-01
3.20913296e-01 9.59964737e-01 -3.64106928e-01 6.12379249e-01
-5.06158555e-01 -7.53293888e-01 9.60297566e-01 6.71373340e-01
-9.23745506e-01 -9.65584872e-02 7.59261364e-01 -3.67386491e-01]
[ 8.23332671e-01 7.44078097e-01 -1.42307112e-01 -4.47358836e-01
7.14673571e-01 -2.86302047e-01 1.69909519e-01 7.45916402e-01
-9.47396224e-01 6.41746323e-01 -4.59424901e-01 -7.22979121e-01
2.71046470e-01 -4.13747317e-01 9.46464694e-01 3.28865240e-01
4.26095377e-01 -3.62196214e-01 -1.57842463e-01 4.58065993e-01]
[ 9.03157119e-01 -9.96877481e-02 -8.45656752e-01 -1.39808692e-01
-8.65586865e-01 8.08784631e-01 9.99154768e-01 -3.91358553e-01
-9.88870401e-02 -5.49081813e-01 -4.60986166e-01 -9.23433522e-01
-1.13922931e-01 -9.62865025e-01 6.97736874e-01 5.05594361e-02
3.87473368e-02 9.87965486e-01 7.85621416e-01 -5.77261468e-01]
[-5.81980281e-01 7.83670513e-02 2.53857999e-01 7.54588332e-01
-5.66803284e-01 -9.22563764e-01 -9.26792679e-01 1.68927077e-02
-8.57073425e-01 -6.09920458e-01 -9.63252768e-01 -2.92311020e-01
5.12468738e-01 6.88805253e-01 6.30640374e-02 3.05776412e-01
4.78415051e-02 2.16217060e-01 4.11221448e-01 -5.18250119e-01]
[ 8.56916541e-01 -2.14817681e-01 4.96378819e-01 -8.79171373e-01
9.35241247e-01 9.98783683e-01 6.16588694e-01 -4.17286791e-01
-9.89566927e-01 5.14719101e-01 -4.46334201e-01 -9.74906456e-01
5.70653323e-01 3.58499433e-02 8.58079437e-01 -4.39771753e-01
-6.30445294e-01 -4.62434417e-01 -9.14500314e-01 -9.80208001e-02]]
syn1 = [[ 1.55112719e+01 1.12387389e+02 4.81669781e+01 1.20651512e+02
1.01597811e+02 1.06228256e+02 5.82031937e+01 7.78134508e+01
7.95483453e+01 1.48237402e+01 -1.03852040e+01 6.21325504e+01
-3.58200319e+01 5.32740816e+01 5.67019411e+01 8.81379570e+01
2.03293011e+01 5.64640721e+01 3.32105183e+01 8.58347937e+01
5.09350585e+01 -1.65266521e+01 9.80285815e+00 4.04691231e+01
7.00003772e+01 6.27446100e+01]
[ 1.77926112e+01 1.35412888e+02 6.14348396e+01 1.47116963e+02
1.21211149e+02 1.28361593e+02 7.10746009e+01 8.48981340e+01
1.05092584e+02 2.73690705e+01 5.25999931e+00 7.57044456e+01
-3.30854140e+01 6.91705370e+01 6.78252607e+01 1.16570068e+02
4.30180003e+01 6.82559502e+01 5.54695745e+01 1.02920324e+02
5.48152765e+01 -9.11752966e+00 2.64431107e+01 5.13616026e+01
9.20488487e+01 7.47738002e+01]
[-1.89098772e+01 2.21881742e+00 -1.82486334e-01 1.66163206e+00
1.67816141e+00 7.96646339e+00 -7.96847234e-01 -3.23990004e-01
-3.71225507e+00 -2.87912223e+01 -7.23352617e+01 -3.68729647e-01
7.99126534e+01 -1.64122859e+00 -2.73746165e-01 -1.71556284e+00
-8.70169863e+00 -8.12228058e-01 -9.77080870e+00 1.42377092e+00
6.94060634e-02 -8.95599457e+01 -2.36939887e+01 1.73506868e-01
-5.21677228e+00 -1.85558573e+00]
[ 1.52087689e+01 1.10685075e+02 4.83561430e+01 1.21507714e+02
1.01172400e+02 1.05147273e+02 5.75111603e+01 7.43446390e+01
8.15983231e+01 1.58479310e+01 -8.28511982e+00 5.91737150e+01
-3.37524661e+01 5.38045874e+01 5.57068760e+01 8.86209602e+01
2.39950249e+01 5.44772942e+01 3.52251103e+01 8.59208447e+01
4.89898446e+01 -1.61922201e+01 1.10445224e+01 3.96149623e+01
7.06245616e+01 6.19313941e+01]
[ 1.81158710e+01 1.36424707e+02 6.05928526e+01 1.48189157e+02
1.23287525e+02 1.32428906e+02 7.10624028e+01 9.03019784e+01
1.03489783e+02 2.80293456e+01 1.03146581e+00 8.03479608e+01
-3.63770981e+01 6.99744460e+01 6.91439510e+01 1.15624630e+02
3.91002675e+01 6.96213596e+01 5.35540698e+01 1.02511596e+02
6.04024507e+01 -1.11343772e+01 2.25194034e+01 5.33428817e+01
9.16323340e+01 7.72395220e+01]
[ 1.55446043e+01 1.11952598e+02 4.82811534e+01 1.21453876e+02
1.00832949e+02 1.05501928e+02 5.84701670e+01 7.49837122e+01
8.17444183e+01 1.41563115e+01 -8.52881145e+00 5.94832929e+01
-3.45235120e+01 5.40326677e+01 5.73212815e+01 8.86244807e+01
2.28866804e+01 5.58251960e+01 3.44425187e+01 8.60145527e+01
4.97787243e+01 -1.44354500e+01 1.16600654e+01 3.87383192e+01
7.02042655e+01 6.13279257e+01]
[ 1.86223171e+01 1.37827596e+02 5.99475039e+01 1.48721392e+02
1.24226110e+02 1.33148730e+02 7.25350515e+01 9.05669153e+01
1.01598617e+02 2.61745363e+01 -1.25048419e+00 8.06920006e+01
-3.73206505e+01 6.96662791e+01 6.80040866e+01 1.14573277e+02
3.88508157e+01 7.09760330e+01 5.17315070e+01 1.03264673e+02
6.11186123e+01 -1.42154906e+01 2.17160533e+01 5.43333904e+01
9.00241585e+01 7.86046148e+01]
[ 1.66641778e+01 1.11960419e+02 4.85329018e+01 1.20897964e+02
9.99445027e+01 1.05309280e+02 5.73701004e+01 7.42665513e+01
8.05940964e+01 1.44813049e+01 -9.72550402e+00 6.04353709e+01
-3.34886182e+01 5.42232664e+01 5.58410834e+01 8.89359593e+01
2.32710906e+01 5.50227692e+01 3.39600246e+01 8.63530663e+01
4.94842711e+01 -1.62125748e+01 1.02474321e+01 3.89560323e+01
7.02438430e+01 6.27807381e+01]
[ 1.81207068e+01 1.36309298e+02 5.99590811e+01 1.47913067e+02
1.23300139e+02 1.31157290e+02 7.11838075e+01 8.91784440e+01
1.02003982e+02 2.65932702e+01 1.24918767e+00 7.87455260e+01
-3.35028576e+01 7.01878376e+01 6.81708917e+01 1.15447659e+02
3.99744213e+01 7.07695923e+01 5.38059918e+01 1.03812570e+02
5.86972756e+01 -9.12458588e+00 2.40542917e+01 5.44236401e+01
9.08528951e+01 7.56183167e+01]
[ 1.53141732e+01 1.11941999e+02 4.77207413e+01 1.20571862e+02
1.02060279e+02 1.05557808e+02 5.82677310e+01 7.50542345e+01
8.22023999e+01 1.56498825e+01 -8.34673391e+00 6.13690485e+01
-3.49467201e+01 5.30316789e+01 5.58931181e+01 8.74335493e+01
2.31057837e+01 5.48100921e+01 3.42621805e+01 8.66560968e+01
4.92214722e+01 -1.46231147e+01 1.07356822e+01 3.95328211e+01
7.09126967e+01 6.09669103e+01]
[ 1.75131533e+01 1.35177617e+02 6.02386621e+01 1.47880738e+02
1.23176212e+02 1.30225539e+02 7.05208812e+01 8.78348642e+01
1.04134734e+02 2.79739461e+01 3.12722574e+00 7.56768731e+01
-3.26984753e+01 6.97950911e+01 6.81270754e+01 1.15825574e+02
4.09649805e+01 6.95778365e+01 5.44070727e+01 1.02824369e+02
5.83326809e+01 -7.70992297e+00 2.49783137e+01 5.21516051e+01
9.14506336e+01 7.50818359e+01]
[ 1.68967624e+01 1.13820023e+02 4.81760307e+01 1.21720236e+02
1.01727429e+02 1.07925102e+02 5.93734714e+01 7.69317376e+01
8.01880903e+01 1.25563795e+01 -1.15117675e+01 6.24113416e+01
-3.53121853e+01 5.43354891e+01 5.69002663e+01 8.76698679e+01
2.04172002e+01 5.70646162e+01 3.24599581e+01 8.73893553e+01
5.16010071e+01 -1.53261378e+01 7.44623316e+00 4.18030165e+01
6.99940981e+01 6.33502634e+01]
[ 1.83859661e+01 1.35453180e+02 6.06160633e+01 1.47756335e+02
1.23682781e+02 1.29360949e+02 6.98849363e+01 8.75819449e+01
1.04567007e+02 2.73285602e+01 3.66150976e+00 7.73257238e+01
-3.45917894e+01 6.98157781e+01 6.69885345e+01 1.15897945e+02
4.23743511e+01 6.97468904e+01 5.51370780e+01 1.02694181e+02
5.81584976e+01 -9.87009976e+00 2.41367214e+01 5.37173514e+01
9.11877736e+01 7.49158939e+01]
[ 1.90993811e+01 1.36977204e+02 6.08519445e+01 1.47863228e+02
1.24816227e+02 1.32434827e+02 7.21612148e+01 9.04867319e+01
1.02283054e+02 2.69689242e+01 6.85333047e-01 7.92018132e+01
-3.61035000e+01 6.82787048e+01 6.81964848e+01 1.16267413e+02
3.93524854e+01 7.15881836e+01 5.28648847e+01 1.03197500e+02
6.10234913e+01 -1.12381149e+01 2.23727440e+01 5.43436068e+01
9.03745049e+01 7.78430049e+01]
[ 1.83594100e+01 1.34881533e+02 6.07798826e+01 1.47574431e+02
1.21043963e+02 1.28726614e+02 7.02660463e+01 8.36970658e+01
1.05613894e+02 2.95057590e+01 4.15070850e+00 7.49017075e+01
-3.39517210e+01 7.02614285e+01 6.77881136e+01 1.16286262e+02
4.27236877e+01 6.77126677e+01 5.75098972e+01 1.02046897e+02
5.49039392e+01 -9.56225982e+00 2.54179145e+01 5.09898822e+01
9.13000464e+01 7.46455677e+01]
[ 1.61878584e+01 1.12835955e+02 4.90804779e+01 1.22454509e+02
1.01175560e+02 1.07220372e+02 5.91197344e+01 7.73703270e+01
8.05703005e+01 1.42062800e+01 -9.74589202e+00 6.13728930e+01
-3.51376208e+01 5.41228497e+01 5.67272079e+01 8.85926746e+01
2.19229608e+01 5.58279647e+01 3.28780742e+01 8.66542812e+01
5.07836216e+01 -1.61604182e+01 9.50358114e+00 4.07362930e+01
6.94494650e+01 6.30168550e+01]
[ 1.48946366e+01 1.10092214e+02 4.84230134e+01 1.20523110e+02
1.00003447e+02 1.03417396e+02 5.67773033e+01 7.27292952e+01
8.24862431e+01 1.43113259e+01 -9.29130535e+00 5.87113426e+01
-3.37394486e+01 5.40071107e+01 5.69231353e+01 8.85865581e+01
2.38506267e+01 5.38157452e+01 3.60529512e+01 8.58574758e+01
4.92005455e+01 -1.55410197e+01 1.18351868e+01 4.00757371e+01
6.98734223e+01 6.12588690e+01]
[ 1.71048331e+01 1.27420537e+02 5.65824760e+01 1.40790404e+02
1.15737057e+02 1.21617192e+02 6.53048598e+01 8.05588195e+01
9.95780634e+01 2.52622002e+01 1.36823579e+00 7.21921042e+01
-3.37460724e+01 6.46827611e+01 6.35099807e+01 1.07707031e+02
3.69403480e+01 6.26289907e+01 5.08592219e+01 9.65191911e+01
5.42578601e+01 -1.04648379e+01 2.08331449e+01 4.82984919e+01
8.62452224e+01 6.98547007e+01]
[ 1.48684817e+01 1.11202040e+02 4.83832729e+01 1.20484729e+02
1.00576759e+02 1.04728830e+02 5.72821998e+01 7.28700800e+01
8.26250773e+01 1.49017487e+01 -7.44948289e+00 5.93496073e+01
-3.48716000e+01 5.34537404e+01 5.62233131e+01 8.90749593e+01
2.43076912e+01 5.39285033e+01 3.43803074e+01 8.60604090e+01
4.79325196e+01 -1.57036247e+01 1.17998373e+01 3.89319067e+01
6.97969331e+01 5.99648878e+01]
[ 1.68332411e+01 1.35473870e+02 6.03928441e+01 1.47575144e+02
1.21517740e+02 1.27869422e+02 7.07464536e+01 8.57668908e+01
1.05197576e+02 2.90248134e+01 3.83946868e+00 7.55667342e+01
-3.42226090e+01 6.99947736e+01 6.68625205e+01 1.15073440e+02
4.22162034e+01 6.82773982e+01 5.51957558e+01 1.03389153e+02
5.57364062e+01 -8.30813379e+00 2.49961191e+01 5.19157749e+01
9.23180368e+01 7.36442234e+01]]
syn2 = [[-2.04919180e+00 9.69272681e-01 -2.41385567e-01 -3.66637467e+00
-8.49137204e-01 -7.42832830e+00 2.04989303e+00 -3.14783888e+00
3.84159379e+00 -6.37381441e-01]
[ 7.10005922e-01 -2.74885315e+00 1.48511797e+00 -8.80490851e-02
1.40508656e+00 5.80953629e-01 -3.49121922e-01 6.23827801e-01
1.69092490e+00 1.16721855e+00]
[-6.14153355e-01 -4.61750240e-01 1.33665573e+00 -6.77398311e-01
9.68457005e-01 -1.01825750e-01 1.17424221e+00 -4.32690171e-03
9.29964563e-01 -1.18036891e+00]
[ 1.54657158e+00 -2.41422396e+00 -1.18264457e-01 2.46416563e-01
2.04967661e-01 3.44268283e-02 -2.08325802e+00 1.09780605e+00
1.72271260e+00 1.52486412e+00]
[ 6.14621598e-01 -3.39399648e+00 9.51116995e-01 5.41241270e-01
7.46267603e-01 1.14705082e+00 -4.93462553e-01 1.02516950e+00
1.26408347e+00 -4.31887289e-01]
[ 1.55264256e+00 -3.84944459e+00 -1.17910840e+00 2.61961268e-01
-2.48099886e-01 2.25571795e+00 -2.72146526e+00 1.52470460e+00
5.01741662e+00 1.03539423e+00]
[-1.52219979e+00 -1.40390435e+00 7.09053852e-01 -6.27039716e-01
8.99573381e-01 2.82627548e-01 8.70711444e-01 1.61809792e-01
4.53897365e-01 -1.15140904e+00]
[-5.84161051e-02 -7.27507095e-01 1.67496190e-01 -1.79935722e-01
3.12377085e-01 -4.53721234e-01 8.98969309e-01 -3.26631253e-01
7.13657251e-01 -1.12681378e+00]
[ 5.64223429e-01 -1.24352584e+00 -1.92098142e+00 1.45226859e-01
-1.88284196e-01 -2.79600500e-01 -6.21898146e-01 -7.02274481e-01
-4.37490614e+00 1.07036967e+00]
[ 2.45553493e-01 1.50541601e+00 -2.16912507e+00 -1.58900015e+00
-1.36551221e+00 -3.66538417e+00 -2.98548659e-02 7.71852317e-01
-9.52621511e+00 1.54886728e-02]
[-3.94515148e+00 -4.20583332e+00 -7.00577622e+00 -3.41474814e+00
-5.10536899e+00 -3.86828114e+00 -2.89223424e+00 -3.37955264e+00
-8.78671562e+00 -1.24583793e+00]
[-1.20248210e+00 -8.53535003e-03 1.40809495e+00 -1.60528974e-01
9.34208787e-02 -1.41620270e-01 1.43717354e+00 -4.54004404e-01
9.61089988e-01 -1.20093078e+00]
[-4.40013584e+00 -8.11130382e+00 -5.14946951e+00 -1.93300518e+00
-5.25471741e+00 -3.33788495e+00 -6.79302786e+00 -7.94056363e+00
-7.19189277e+00 -2.13818199e+00]
[-9.47521347e-01 -8.93792027e-01 2.70364866e-01 3.92989861e-02
6.33257500e-01 -6.71215771e-02 -7.82802803e-01 -4.29581771e-01
-2.13653780e+00 4.08474308e-01]
[-7.54850155e-01 -6.43977247e-01 -2.55211954e-01 -5.01329920e-01
1.28514328e+00 3.68264359e-01 -6.12898979e-01 -2.47629210e-01
6.46115592e-01 -8.06453591e-01]
[ 7.75865940e-01 -2.44988120e+00 -3.25183354e+00 3.45741537e-01
-8.45333889e-01 -1.30141580e-01 -2.68005262e+00 2.03306473e+00
-2.17618387e+00 5.13369281e-01]
[-9.83143414e-01 -8.13429765e-01 -2.43489488e+00 -5.75401360e-01
-1.80723789e+00 -2.75845465e+00 -6.62049030e-01 -5.48723960e-01
-2.64280100e+00 9.12504296e-01]
[-3.64623282e-01 -1.84833179e+00 3.15286019e-02 -7.84966375e-01
-3.02995250e-01 3.23416082e-01 2.89867710e-01 5.17832703e-01
6.14871715e-01 -6.35168141e-01]
[-7.06371392e-01 7.68528599e-02 -4.34327169e+00 -5.45471125e-01
-2.03525691e+00 -2.31207902e+00 3.67301807e-02 4.21433674e-01
-1.35192948e+00 -3.90802904e-02]
[-1.59571430e-01 -3.32026916e+00 4.38529697e-01 7.47480435e-02
1.16384132e+00 1.64159366e+00 -2.76863506e+00 1.00348646e+00
7.31549360e-01 -3.07719496e-03]
[-1.26867762e+00 -5.21703702e-01 1.24495701e+00 -2.17718446e-01
1.18670773e+00 3.96463602e-02 7.84896661e-01 -6.99585039e-01
7.48424065e-01 -6.21209748e-01]
[-7.42849329e+00 -8.91533459e+00 -1.00684891e+01 -6.19452733e+00
-7.07252556e+00 -4.81947501e+00 -4.63511588e+00 -8.82548231e+00
-9.33801319e+00 -3.46980432e+00]
[-6.58275734e-01 -3.88699147e-01 -2.85204247e+00 -1.21958168e+00
-7.33270211e-01 -3.12953897e+00 1.06135910e+00 7.86928852e-01
-8.60265570e+00 4.71849624e-01]
[ 4.98938238e-01 -8.87926674e-01 4.51144100e-01 -6.32850337e-01
7.81179575e-01 -9.31640115e-03 1.36218641e+00 1.99898365e-02
1.27753438e+00 -1.06170035e+00]
[-6.50311249e-01 -1.10185034e+00 -1.82242854e+00 -5.85310919e-01
3.26045902e-01 9.07004516e-01 -1.52388721e+00 -3.41418864e-01
-6.17050583e+00 -1.50236833e-01]
[-1.18863122e+00 -1.13373225e+00 -1.57991609e+00 2.97607822e-02
-5.99213888e-01 2.73076712e-01 -6.70658231e-01 5.28422398e-01
4.40776800e-01 -8.20199631e-01]]
b0 = [[-1605.17848776 -1917.98356041 -689.82773387 -1601.74740941
-1936.57915581 -1605.08924872 -1934.53810642 -1600.4377953
-1929.36294279 -1604.50202962 -1925.24927875 -1614.3081382
-1926.17204092 -1937.17158195 -1914.21546031 -1612.18299499
-1596.04117227 -1825.00260982 -1595.98569161 -1917.38022247]]
b1 = [[-1.97785607 -3.17461188 -3.32390325 -3.00471211 -3.37630353 -3.28285982
-3.47582616 -3.27004853 -3.43013569 -3.13713948 -2.49317653 -3.29428498
-2.59368375 -3.62957184 -3.39038048 -3.86221078 -2.52043183 -3.40202391
-2.48401463 -3.70230631 -3.33070731 -2.02362061 -2.93135334 -3.17586792
-3.92266563 -3.49992033]]
b2 = [[-0.06619111 0.50520411 0.20854894 -0.72148372 -0.17292749 -0.12212768
-0.63874199 -0.6896814 0.27061332 -0.82917551]]
| [
"246992@student.pwr.edu.pl"
] | 246992@student.pwr.edu.pl |
f25e10e1de6598126c133ce3929fdd51614412ab | 29dea00941a5dedc63821cc025822e2935281875 | /sqlalchemy_example/sqlalchemy_example.py | 11f55253a5010e59520308cdac84edb6c6e07a12 | [] | no_license | joecabezas/flask-learning | 4c271a60b4d3478ae793c9e163c87e00541c7a63 | f6177c6a689aadf09885f6d3541906db08df59df | refs/heads/master | 2020-03-20T19:46:05.137143 | 2018-06-17T12:17:31 | 2018-06-17T12:17:31 | 137,652,832 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,101 | py | import json
from flask import Flask
from flask import redirect
from flask import url_for
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS '] = False
db = SQLAlchemy(app)
class Tasks(db.Model):
name = db.Column('name', db.String(), primary_key = True)
done = db.Column(db.Boolean())
def __init__(self, name, done=False):
self.name = name
self.done = done
@app.route('/list')
def list():
tasks = Tasks.query.all()
return json.dumps([{'name':task.name, 'done':task.done} for task in tasks])
@app.route('/read/<string:name>')
def read(name):
tasks = Tasks.query.filter_by(name=name)
return json.dumps(tasks)
@app.route('/create/<string:name>')
def create(name):
task = Tasks(name=name)
db.session.add(task)
db.session.commit()
return json.dumps({'success':True}), 200, {'ContentType':'application/json'}
if __name__ == '__main__':
db.create_all()
app.run(debug=True) | [
"joe.cabezas@gmail.com"
] | joe.cabezas@gmail.com |
79ad61b8d831f2d9ea69c242acc35367ae774957 | b22fdbd496c6086428a939a2d4c5bdc0b44ecd13 | /shipyard/prepare_table.py | 4f12c3e08ac0231cc941eba448eb65d1bfac2344 | [] | no_license | compmetagen/AIforEarth2020 | 3c080f83eb1bb37759f8b52e8ba827f8a23e0839 | c100207095b2ba105c59776844875ae9f789ed36 | refs/heads/master | 2021-02-05T18:20:35.069762 | 2020-06-19T07:20:27 | 2020-06-19T07:20:27 | 243,814,133 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,293 | py | import sys
import csv
import re
import os
import pandas as pd
from Bio import Entrez
input_fn = sys.argv[1]
output_fn = sys.argv[2]
Entrez.email = "davide.albanese@fmach.it"
input_df = pd.read_csv(input_fn, delimiter='\t', index_col=False, header=0,
dtype=str, na_filter=False)
output_df = pd.DataFrame()
biosample_count, run_count = 0, 0
for _, input_row in input_df.iterrows():
biosample = input_row["NCBI Biosample Accession"]
if biosample != '':
ehandle = Entrez.esearch(db="sra", term=biosample)
erecord = Entrez.read(ehandle)
ehandle.close()
ehandle = Entrez.efetch(db="sra", rettype="runinfo",
id=erecord['IdList'], retmode="text")
runs_df = pd.read_csv(ehandle, index_col=False, header=0, dtype=str)
ehandle.close()
biosample_count += 1
print(biosample_count)
for _, runs_row in runs_df.iterrows():
output_row = input_row.append(runs_row)
output_df = output_df.append(output_row, ignore_index=True,
sort=False)
output_df = output_df.reindex(output_row.index, axis=1)
run_count += 1
output_df.to_csv(output_fn, sep='\t', index=False)
print("Biosamples: {:d}, Runs: {:d}".format(biosample_count, run_count))
| [
"davide.albanese@gmail.com"
] | davide.albanese@gmail.com |
53960c4fdf7b1956a9d83229b2d3c49ab5632689 | 1b388332666b0ab0ff7b8cc67352e6bb0347a180 | /produto/admin.py | 196802e19fb6af8f38a6d57bc6cdbb7432fa532e | [] | no_license | GomesMarcos/calculo_frete_drf | 9c6199a4d11e6d7e7073d9341b49c631281f07d7 | a9c5b30fb9cd0ff3936d6453b2abfaca2b6101e1 | refs/heads/main | 2023-02-25T02:55:31.684749 | 2021-02-01T14:37:43 | 2021-02-01T14:37:43 | 333,989,392 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 85 | py | from django.contrib import admin
from .models import *
admin.site.register(Produto)
| [
"gomes.marcosjf@gmail.com"
] | gomes.marcosjf@gmail.com |
887821cb1d3663aec05aded7090a12fbb0863b88 | d9c95cd0efad0788bf17672f6a4ec3b29cfd2e86 | /disturbance/migrations/0163_apiarysiteonapproval_site_category.py | b2f18b430255810ee5d6bbd518185236c84db914 | [
"Apache-2.0"
] | permissive | Djandwich/disturbance | cb1d25701b23414cd91e3ac5b0207618cd03a7e5 | b1ba1404b9ca7c941891ea42c00b9ff9bcc41237 | refs/heads/master | 2023-05-05T19:52:36.124923 | 2021-06-03T06:37:53 | 2021-06-03T06:37:53 | 259,816,629 | 1 | 1 | NOASSERTION | 2021-06-03T09:46:46 | 2020-04-29T03:39:33 | Python | UTF-8 | Python | false | false | 592 | py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2020-09-17 04:10
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('disturbance', '0162_auto_20200917_1209'),
]
operations = [
migrations.AddField(
model_name='apiarysiteonapproval',
name='site_category',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='disturbance.SiteCategory'),
),
]
| [
"katsufumi.shibata@dbca.wa.gov.au"
] | katsufumi.shibata@dbca.wa.gov.au |
c40bb4138fdd7b48069ab7bc4e9018018446266a | b49248f0454a066940219eadef8d3f14021816c1 | /EcommerceProject/wsgi.py | 39d8df5688950f4b3284af553975406f3e6f76fd | [] | no_license | anilchouhan8480/EcommerceProject | ded6691df6b20950371f1df20642f45e4a2e7305 | b98492a4d184df780a44b1ca0d255108f9303066 | refs/heads/master | 2023-06-05T23:51:04.086020 | 2021-06-12T03:20:10 | 2021-06-12T03:20:10 | 367,442,102 | 1 | 1 | null | null | null | null | UTF-8 | Python | false | false | 409 | py | """
WSGI config for EcommerceProject project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'EcommerceProject.settings')
application = get_wsgi_application()
| [
"chauhananil152@gmail.com"
] | chauhananil152@gmail.com |
caca76cf5670844b8fb9ce1fc6838c91abd6578f | f78cc6b4b816e982313e2e9e49abfd36ff758243 | /0x08-python-more_classes/9-rectangle.py | f94b935694f7a15dc1bf0d3cb0c1ff5354b9e37a | [] | no_license | csoriano2832/holbertonschool-higher_level_programming | 1ff274dcb0782b8c99f359961b234c5f07174a14 | 76e6eb6310c94c5b3ea12299974a9f042e7bfb9c | refs/heads/main | 2023-09-01T22:09:41.698482 | 2021-09-28T20:42:41 | 2021-09-28T20:42:41 | 361,794,684 | 0 | 4 | null | null | null | null | UTF-8 | Python | false | false | 2,846 | py | #!/usr/bin/python3
"""This module contains the class Rectangle"""
class Rectangle:
"""Defines a rectangle"""
number_of_instances = 0
print_symbol = "#"
def __init__(self, width=0, height=0):
"""Instantiation"""
self.width = width
self.height = height
Rectangle.number_of_instances += 1
@property
def width(self):
"""retrieve width"""
return self.__width
@width.setter
def width(self, value):
"""set width"""
if type(value) is int:
if value >= 0:
self.__width = value
else:
raise ValueError("width must be >= 0")
else:
raise TypeError("width must be an integer")
@property
def height(self):
"""retrieve height"""
return self.__height
@height.setter
def height(self, value):
"""set height"""
if type(value) is int:
if value >= 0:
self.__height = value
else:
raise ValueError("height must be >= 0")
else:
raise TypeError("height must be an integer")
def area(self):
"""Returns area of a rectangle"""
return self.width * self.height
def perimeter(self):
"""Returns perimeter of a rectangle"""
if self.width == 0 or self.height == 0:
return 0
return 2 * (self.width + self.height)
def __str__(self):
"""Prints the rectangle using the # character """
str_rectangle = ""
if self.width == 0 or self.height == 0:
return str_rectangle
for col in range(self.height):
for row in range(self.width):
str_rectangle += str(self.print_symbol)
if col != (self.height - 1):
str_rectangle += "\n"
return str_rectangle
def __repr__(self):
"""String representation of the rectangle to be able to recreate a new
instance by using eval()"""
return ("Rectangle({}, {})".format(self.width, self.height))
def __del__(self):
"""Prints message when instance of Rectangle is deleted"""
print("Bye rectangle...")
Rectangle.number_of_instances -= 1
@staticmethod
def bigger_or_equal(rect_1, rect_2):
"""Returns the biggest rectangle base on the area"""
if not isinstance(rect_1, Rectangle):
raise TypeError("rect_1 must be an instance of Rectangle")
if not isinstance(rect_2, Rectangle):
raise TypeError("rect_2 must be an instance of Rectangle")
if rect_1.area() >= rect_2.area():
return rect_1
else:
return rect_2
@classmethod
def square(cls, size=0):
"""returns a new Rectangle instance"""
return cls(size, size)
| [
"2832@holbertonschool.com"
] | 2832@holbertonschool.com |
64724bb718e51f021275096a77275b11b6481ac4 | 4178f2916d2da72cbb45454fbed941dcfe8f6460 | /POM_test/TestCase/Debug2.py | a6a55e7b2f21f479f7cacf5f29ff779122b450fc | [] | no_license | maxcrup007/Selenium_Webdriver_Python | 15196cb04ba5cafdc5b776c26d167f0b48fb0e14 | 6be7f0b9f53df1ba592957029e8a4d22e409d1c4 | refs/heads/main | 2023-03-24T21:04:31.976451 | 2021-03-22T09:16:04 | 2021-03-22T09:16:04 | 349,379,454 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 952 | py |
import os
os.chdir('C:/Users/voraw/Desktop/Working/Gaming & Hobby/Ma11/miKu-Doujin/Chane name')
print(os.getcwd())
COUNT = 1
def change_name():
global COUNT
COUNT = COUNT + 1
for f in os.listdir():
f_name, f_ext = os.path.splitext(f)
if COUNT >= 100:
f_name = str(COUNT)
elif COUNT >= 10 and COUNT < 100:
f_name = "0" + str(COUNT)
else:
f_name = "00" + str(COUNT)
change_name()
new_name = '{} {}'.format(f_name, f_ext)
os.rename(f, new_name)
#### Source Code
# import os
#
# os.chdir('D://Geeksforgeeks')
# print(os.getcwd())
# COUNT = 1
#
#
# # Function to increment count
# # to make the files sorted.
# def increment():
# global COUNT
# COUNT = COUNT + 1
#
#
# for f in os.listdir():
# f_name, f_ext = os.path.splitext(f)
# f_name = "geek" + str(COUNT)
# increment()
#
# new_name = '{} {}'.format(f_name, f_ext)
# os.rename(f, new_name)
| [
"36732487+maxcrup007@users.noreply.github.com"
] | 36732487+maxcrup007@users.noreply.github.com |
29637e7e8fe558e5d7e6148b29ef02ed2d86a8fd | bce7ac4be692d4073ab5e48d111cd976940d5c0e | /systemIntegrityVerifier.py | 93b01c5de50effb8be4c196b5571649db3961584 | [] | no_license | Nasirali-Kovvuru/SystemIntegrityVerifier | 6b07240a7e3684059bf8b8e1d2ee814885075279 | 40248111e86d7ee294ea89f5d8840134e38a9ee2 | refs/heads/master | 2020-03-27T07:15:39.026708 | 2018-08-26T11:53:03 | 2018-08-26T11:53:03 | 146,176,229 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 12,655 | py |
import argparse
import hashlib
import json
import os
import pwd
import sys
import textwrap
from datetime import datetime
from grp import getgrgid
from pprint import pprint
parser = argparse.ArgumentParser(
description=textwrap.dedent('''Initialization --> siv.py -i -D 'dir' -V 'ver_file' -R 'rep_file' -H 'hash'
******************************************************************************
Verification --> siv.py -v -D 'dir' -V 'ver_file' -R 'rep_file' '''))
arg_group = parser.add_mutually_exclusive_group()
arg_group.add_argument("-i", "--initialize", action="store_true", help="Initialization mode")
arg_group.add_argument("-v", "--verify", action="store_true", help="Verification mode")
parser.add_argument("-D", "--monitored_directory", type=str, help="Give a Directory that needs to be monitored")
parser.add_argument("-V", "--verification_file", type=str,
help="Give a Verification File that can store records of each file in the monitored directory")
parser.add_argument("-R", "--report_file", type=str, help="Give a Report File to store final report")
parser.add_argument("-H", "--hash_function", type=str, help="Hash Algorithm supported are 'SHA-1' and 'MD-5' ")
args = parser.parse_args()
mon = args.monitored_directory
ver = args.verification_file
rep = args.report_file
alg = args.hash_function
if args.initialize:
print("Initialization Mode\n")
start = datetime.utcnow()
if os.path.isdir(mon) == 1:
print("Monitored Directory exists\n")
if alg == "SHA-1" or alg == "MD-5":
i = 0
j = 0
det = []
det_dir = {}
det_file = {}
det_hash = {}
if os.path.isfile(ver) == 1 and os.path.isfile(rep) == 1:
print("Verification and Report files exist\n")
if (os.path.commonprefix([mon, ver]) == mon):
print("Verification and Report file must be outside from the monitored directory\n")
sys.exit()
else:
print("Verification and Report files are outside from the monitored directory\n")
else:
os.open(ver, os.O_CREAT, mode=0o777)
os.open(rep, os.O_CREAT, mode=0o0777)
print("Verification or Report file does not exists and is created now\n")
if (os.path.commonprefix([mon, ver]) == mon):
print("Verification and Report file must be outside\n")
sys.exit()
else:
print("Verification and Report files are outside\n")
choice = input("Do you want to overwrite y/n: ")
if choice == "n":
sys.exit()
elif choice == "y":
for subdir, dirs, files in os.walk(mon):
for first in dirs:
i = i+1
path = os.path.join(subdir, first)
alt = os.path.getsize(path)
bol = pwd.getpwuid(os.stat(path).st_uid).pw_name
cal = getgrgid(os.stat(path).st_gid).gr_name
dol = datetime.fromtimestamp(os.stat(path).st_mtime).strftime('%c')
eal = oct(os.stat(path).st_mode & 0o777)
det_dir[path] = {
"size": alt, "user": bol, "group": cal, "recent": dol, "access": eal
}
for file in files:
j = j+1
filepath = os.path.join(subdir, file)
filesize = os.stat(filepath).st_size
fileuser = pwd.getpwuid(os.stat(filepath).st_uid).pw_name
filegroup = getgrgid(os.stat(filepath).st_gid).gr_name
filerecent = datetime.fromtimestamp(os.stat(filepath).st_mtime).strftime('%c')
fileaccess = oct(os.stat(filepath).st_mode & 0o777)
if alg == "MD-5":
htype = "md5"
hashe = hashlib.md5()
with open(filepath, 'rb') as monifile:
buf = monifile.read()
hashe.update(buf)
message = hashe.hexdigest()
else:
htype = "sha1"
hashe = hashlib.sha1()
with open(filepath, 'rb') as hfile:
buf = hfile.read()
hashe.update(buf)
message = hashe.hexdigest()
det_file[filepath] = {"size": filesize, "user": fileuser, "group": filegroup, "recent": filerecent, ############
"access": fileaccess, "hash": message}
det.append(det_dir)
det_hash = {"hash_type": htype}
det.append(det_file)
det.append(det_hash)
json_string = json.dumps(det, indent=2, sort_keys=True)
print("\nVerification File generated")
with open(ver, "w") as verifyfile:
verifyfile.write(json_string)
print("\nReport File generated")
with open(rep, "w") as reportf:
end = datetime.utcnow()
reportf.write(
"Initialization mode complete \n\nMonitored directory = " + mon + "\nVerification file =" + ver + "\nNumber of directories parsed =" + str(
i) + "\nNumber of files parsed = " + str(j) + "\nTime taken = " + str(end - start) + "\n")
else:
print("Invalid choice")
sys.exit()
else:
print("Hash not supported")
sys.exit()
else:
print("Monitored directory does not exist")
sys.exit()
elif args.verify:
start = datetime.utcnow()
print("Verification Mode\n")
if os.path.isfile(ver) == 1:
print("Verification File exists\n")
if (os.path.commonprefix([mon, ver]) == mon):
print("Verification and Report file must be outside\n")
sys.exit()
else:
print("Verification and Report files are outside\n")
else:
print("Verification file doesn't exist")
sys.exit()
i = 0
j = 0
k = 0
with open(ver) as open_file:
sysinverif = json.load(open_file)
with open(rep, "a") as rep_write:
rep_write.write("\nVerification Mode begin\n")
for each_file in sysinverif[2]:
htype = each_file[2]
with open(rep, "a") as rep_write:
for subdir, dirs, files in os.walk(mon):
for fds in dirs:
i = i+1
path = os.path.join(subdir, fds)
size = os.stat(path).st_size
user = pwd.getpwuid(os.stat(path).st_uid).pw_name
group = getgrgid(os.stat(path).st_gid).gr_name
recent = datetime.fromtimestamp(os.stat(path).st_mtime).strftime('%c')
access = oct(os.stat(path).st_mode & 0o777)
print("Dir " + path + "\n")
if path in sysinverif[0]:
if size != sysinverif[0][path]['size']:
rep_write.write("\nWarning directory at the path " + path + " has different size from the previous size\n")
k = k+1
if user != sysinverif[0][path]['user']:
rep_write.write("\nWarning dir at the path" + path + " has different user from the previous user \n")
k = k+1
if group != sysinverif[0][path]['group']:
rep_write.write("\nWarning dir at the path " + path + " has different group from the previous group\n")
k = k+1
if recent != sysinverif[0][path]['recent']:
rep_write.write("\nWarning dir at the path" + path + " has different modification date from the previous date\n")
k =k+1
if access != sysinverif[0][path]['access']:
rep_write.write("\nWarning dir at the path" + path + " has modified access rights\n")
k =k+1
else:
rep_write.write("\nWarning directory " + path + " has been added\n")
k =k+1
for each_prev_dir in sysinverif[0]:
if os.path.isdir(each_prev_dir) == 0:
rep_write.write("\nWarning directory " + each_prev_dir + " has been deleted\n")
k =k+1
for subdir, dirs, files in os.walk(mon):
for file in files:
j =j+1
filepath = os.path.join(subdir, file)
filesize = os.stat(filepath).st_size
fileuser = pwd.getpwuid(os.stat(filepath).st_uid).pw_name
filegroup = getgrgid(os.stat(filepath).st_gid).gr_name
filerecent = datetime.fromtimestamp(os.stat(filepath).st_mtime).strftime('%c')
fileaccess = oct(os.stat(filepath).st_mode & 0o777)
print("File " + filepath + "\n")
if htype == "md5":
h = hashlib.md5()
with open(filepath, 'rb') as mfile:
buf = mfile.read()
h.update(buf)
message = h.hexdigest()
else:
h = hashlib.sha1()
with open(filepath, 'rb') as hfile:
buf = hfile.read()
h.update(buf)
message = h.hexdigest()
if filepath in sysinverif[1]:
if filesize != sysinverif[1][filepath]['size']:
rep_write.write("\nWarning file at the path " + filepath + " has different size from the previous size\n")
k =k+1
if fileuser != sysinverif[1][filepath]['user']:
rep_write.write("\nWarning file at the path " + filepath + " has different user from the previous path\n")
k =k+1
if filegroup != sysinverif[1][filepath]['group']:
rep_write.write("\nWarning file at the path" + filepath + " has different group from the previous group\n")
k =k+1
if filerecent != sysinverif[1][filepath]['recent']:
rep_write.write("\nWarning file at the path" + filepath + " has different modification date from the previous date\n")
k =k+1
if fileaccess != sysinverif[1][filepath]['access']:
rep_write.write("\nWarning file " + filepath + " has modified access rights\n")
k =k+1
if message != sysinverif[1][filepath]['hash']:
rep_write.write("\nWarning file " + filepath + " different message digest\n")
k =k+1
else:
rep_write.write("\nWarning dir " + filepath + " has been added\n")
k =k+1
for each_prev_file in sysinverif[1]:
if os.path.isfile(each_prev_file) == 0:
rep_write.write("\nWarning directory " + each_prev_file + " has been deleted\n")
k =k+1
with open(rep, "a") as rf:
end = datetime.utcnow()
rf.write(
"\nVerification mode complete \n\nMonitored directory = " + mon + "\nVerification file =" + ver + "\nNumber of directories parsed =" + str(
i) + "\nNumber of files parsed = " + str(j) + "\nTotal Warnings = " + str(k) + "\nTime taken = " + str(
end - start) + "\n")
print("Report File generated")
| [
"nasiralikovvuru@yahoo.com"
] | nasiralikovvuru@yahoo.com |
4fab9a75556eef5fd6f1526961dc1d9781aaad35 | 280a40f148b741b1abe6da5c6e13d08d2f8ec1ec | /is-binary-search-tree/main.py | 322c69c7c20ca0d5f6fca541529060cad1462e1b | [
"MIT"
] | permissive | nbrendler/hackerrank-exercises | 83f0d91082aab05007924e585dcc1aa6c24b7953 | 8b9f0944b5ea89b47b1e071965b996a238362757 | refs/heads/master | 2021-01-12T08:07:22.520041 | 2016-12-14T17:11:58 | 2016-12-14T17:11:58 | 76,478,416 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 735 | py | """ Node is defined as
class node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
"""
def check_binary_search_tree_(root, minBound = 0, maxBound = 10000):
if root.left is not None:
if root.left.data >= root.data:
return False
if not minBound <= root.left.data <= maxBound:
return False
if not check_binary_search_tree_(root.left, minBound, root.data - 1):
return False
if root.right is not None:
if root.right.data <= root.data:
return False
if not minBound <= root.right.data <= maxBound:
return False
if not check_binary_search_tree_(root.right, root.data + 1, maxBound):
return False
return True | [
"nbrendler@gmail.com"
] | nbrendler@gmail.com |
986016797e5e1c211ca0e05a473bca03d8fdb54e | 795da8b6463bf4b9553ea6631af0cef36605b88b | /test.py | a12399d9f62fbade08a9951baf0d4bf1bde1d9b2 | [] | no_license | coder-fy/ChineseWordCollection | 0601105efcd586c0254508d010aef918de13b59e | 05e931abb85de5f33c0d01fbed77e2c0ae8655ca | refs/heads/master | 2020-06-23T20:26:47.469765 | 2019-07-25T01:39:34 | 2019-07-25T01:39:34 | 198,743,720 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 95 | py | import re
str = "\n test it \n"
new_str = re.sub(r"\s+", " ", str).strip()
print(new_str) | [
"innovstudio@outlook.com"
] | innovstudio@outlook.com |
782f7ad84a757286a8685de5ded3aa137187a6e8 | f042383cbc9f10837ebdb5b9033a0263f6a43698 | /examples/docs_snippets/docs_snippets/intro_tutorial/basics/e04_quality/custom_types_2.py | 70e3912ca669f3083987bf7f01f0b16146f8993a | [
"Apache-2.0"
] | permissive | helloworld/dagster | 664e6636d68bafa5151418c9d4316a565717f5ee | 779e27faa3e46b7d043cb9624617e655a9ed570c | refs/heads/master | 2022-03-24T12:15:36.626783 | 2022-02-26T01:34:29 | 2022-02-26T01:34:29 | 464,019,094 | 0 | 0 | Apache-2.0 | 2022-03-05T20:23:14 | 2022-02-27T02:38:17 | null | UTF-8 | Python | false | false | 1,116 | py | import requests
from dagster import DagsterType, In, Out, get_dagster_logger, job, op
# start_custom_types_2_marker_0
def is_list_of_dicts(_, value):
return isinstance(value, list) and all(
isinstance(element, dict) for element in value
)
SimpleDataFrame = DagsterType(
name="SimpleDataFrame",
type_check_fn=is_list_of_dicts,
description="A naive representation of a data frame, e.g., as returned by csv.DictReader.",
)
# end_custom_types_2_marker_0
# start_custom_types_2_marker_1
@op(out=Out(SimpleDataFrame))
def bad_download_csv():
response = requests.get("https://docs.dagster.io/assets/cereal.csv")
lines = response.text.split("\n")
get_dagster_logger().info(f"Read {len(lines)} lines")
return ["not_a_dict"]
# end_custom_types_2_marker_1
@op(ins={"cereals": In(SimpleDataFrame)})
def sort_by_calories(cereals):
sorted_cereals = sorted(cereals, key=lambda cereal: cereal["calories"])
get_dagster_logger().info(
f'Most caloric cereal: {sorted_cereals[-1]["name"]}'
)
@job
def custom_type_job():
sort_by_calories(bad_download_csv())
| [
"noreply@github.com"
] | noreply@github.com |
ed4e480144d864d245faccc359b175da7e04c517 | 1809761794a0a4947888f2e268c3dfe3f98061ad | /simulator/simulator.py | f4d672a2986ab74592e0d6765aeca273334f8ad7 | [] | no_license | jacopobr/car-2-smart | e4a5ac86bb53b3f508369eda6bacc748c4b98b49 | 074bd964847dc3cbc73f84c1db679d2abb59c1e0 | refs/heads/master | 2023-05-11T03:55:01.661692 | 2021-06-06T14:59:58 | 2021-06-06T14:59:58 | 374,378,053 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 9,266 | py | import random, requests, mysql.connector
from threading import Timer
from kivymd.app import MDApp
from kivy.core.window import Window
from kivy.uix.screenmanager import ScreenManager, Screen
from kivymd.uix.dialog import MDDialog
from kivymd.uix.list import IconLeftWidget, ThreeLineIconListItem, IconRightWidget
from kivymd.uix.button import MDFlatButton
import os
#MySQL Database credential, hosted on freemysqlhosting.net - valid username and password hidden
config = {
'user': os.environ.get('USER'),
'password': os.environ.get('PASSWORD'),
'host': 'sql11.freemysqlhosting.net',
'database': os.environ.get('DATABASE'),
'raise_on_warnings': True
}
catalog_url = 'http://localhost:9090/'
TELEGRAM_NAME = ''
CARS_LIST = []
Window.size = (375,667)
class Booking(ThreeLineIconListItem):
"""Booking Screen"""
def on_press(self):
dialog_text = "Do you confirm booking this car?"
self.dialog = MDDialog(title = "Book this car", text = dialog_text, size_hint=(0.8, 1),
buttons=[MDFlatButton(text='Close', on_release=self.close_dialog),
MDFlatButton(text='Start Booking', on_release=self.start_booking)]
)
self.dialog.open()
def close_dialog(self,obj):
self.dialog.dismiss()
def start_booking(self,obj):
"""
When a booking starts, the related username and car plate are stored in the Active Booking table.
The car will aviability of the car will change in the car.
"""
global TELEGRAM_NAME
self.dialog.dismiss()
dialog_text = 'Your booking will start as soon as the security test is done!'
self.dialog = MDDialog(title = "Safety first!", text = dialog_text, size_hint=(0.8, 1),
buttons=[MDFlatButton(text='Cancel Booking', on_release=self.cancel_booking)]
)
self.dialog.open()
requests.post(catalog_url + 'booking', json={'plate': self.text}) #set busy the car in the catalogue
try:
conn = mysql.connector.connect(**config)
cursor = conn.cursor()
query = "INSERT INTO ActiveBooking (plate, tg_username) VALUES (%s,%s)"
cursor.execute(query,(self.text,TELEGRAM_NAME))
conn.commit()
conn.close()
timer = Timer(3.0, self.check_booking_validity)
timer.start()
except Exception as e:
print('Error' + str(e))
def cancel_booking(self,obj):
"""
When a booking end, the related record in Active Booking is deleted.
"""
self.dialog.dismiss()
conn = mysql.connector.connect(**config)
cursor = conn.cursor()
query = "DELETE From ActiveBooking where plate = %s and tg_username = %s"
cursor.execute(query,(self.text,TELEGRAM_NAME))
conn.commit()
conn.close()
requests.post(catalog_url + 'deletebooking', json={'plate': self.text}) #make the car available again in the catalogue
def check_booking_validity(self):
"""
Check the booking record in Active Booking untie the 'Validity' fields changes.
- if validity = 0 the booking has not been processed yet;
- if validity = 1 the alcohol test is done with a negative result, user can drive;
- if validity = 2 the alcohol test is done with a positive result, user can't drive;
"""
while True:
conn = mysql.connector.connect(**config)
cursor = conn.cursor()
query = "SELECT * From ActiveBooking where plate = %s and tg_username = %s"
cursor.execute(query,(self.text,TELEGRAM_NAME))
booking_record = cursor.fetchone()
conn.close()
if booking_record[3] == 0:
print('Not valid')
elif booking_record[3] == 1:
timer = Timer(1.0, self.valid_booking)
timer.start()
break
elif booking_record[3] == 2:
timer = Timer(1.0, self.invalid_booking)
timer.start()
break
def valid_booking(self):
"""
Show successful booking dialog
"""
self.dialog.dismiss()
dialog_text = 'Your booking is running, press cancel to stop it!'
self.dialog = MDDialog(title = "Your Booking is running!", text = dialog_text, size_hint=(0.8, 1),
buttons=[MDFlatButton(text='Cancel Booking', on_release=self.cancel_booking)]
)
self.dialog.open()
def invalid_booking(self):
"""
Show unsuccessful booking dialog
"""
self.dialog.dismiss()
dialog_text = 'It seems like you drank too much!'
self.dialog = MDDialog(title = "You are not allowed to drive!", text = dialog_text, size_hint=(0.8, 1),
buttons=[MDFlatButton(text='Cancel Booking', on_release=self.cancel_booking)]
)
self.dialog.open()
class LoginScreen(Screen):
def login(self):
"""
Fetch username and password from input box and compare them with the one stored in the db
for user login.
"""
global TELEGRAM_NAME
email = self.ids.email.text
password = self.ids.password.text
conn = mysql.connector.connect(**config)
cursor = conn.cursor()
cursor.execute(f"SELECT * FROM User where email = '{email}'")
user_record = cursor.fetchone()
if user_record != None and user_record[3] == password:
TELEGRAM_NAME = user_record[1]
self.manager.current = "carlist"
else:
self.show_alert_dialog()
def show_alert_dialog(self):
text_error = "Username or password wrong"
dialog = MDDialog(title = "Error", text = text_error, size_hint=(0.8, 1))
dialog.open()
class RegisterScreen(Screen):
"""Allows user registration"""
def register(self):
"""
Simple registration method. Need to acquire user telegram name.
Fetch data from input box and store them in db.
"""
email = self.ids.email.text
telegram_username = self.ids.telegram.text
password = self.ids.password.text
password_two = self.ids.password_two.text
try:
if password == password_two:
conn = mysql.connector.connect(**config)
cursor = conn.cursor()
cursor.execute(f"SELECT * FROM User where email = '{email}'")
data = cursor.fetchall()
if len(data) == 0:
query = "INSERT INTO User(email,tg_username,password) VALUES (%s,%s,%s)"
cursor.execute(query,(email,telegram_username,password))
conn.commit()
conn.close()
confirm_text = "You have been successfully registered! Now open telegram and start a chat with @Car2SafeBot. Follow the instructions to have your emergency number saved!"
self.dialog = MDDialog(title = "Success" , text = confirm_text,size_hint=(0.8, 1),
buttons=[MDFlatButton(text='Close', on_release=self.close_dialog)])
self.dialog.open()
self.manager.current = "login"
else:
self.dialog = MDDialog(title = "Error" , text = "User already exists!",size_hint=(0.8, 1),
buttons=[MDFlatButton(text='Close', on_release=self.close_dialog)])
self.dialog.open()
else:
self.dialog = MDDialog(title = "Error" , text = "Passwords do not match!",size_hint=(0.8, 1),
buttons=[MDFlatButton(text='Close', on_release=self.close_dialog)])
self.dialog.open()
except Exception as e:
print('problem' + str(e))
def close_dialog(self,obj):
self.dialog.dismiss()
class CarListScreen(Screen):
def on_pre_enter(self):
"""
For each car of the list create a dummy element in the listview
"""
distance = 10
for plate in CARS_LIST:
fuel = random.randint(20,100)
icon = IconLeftWidget(icon = "car")
item = Booking(text = plate,secondary_text = f"Fuel: {fuel}%", tertiary_text= f"Distance: {distance}m")
item.add_widget(icon)
self.ids.container.add_widget(item)
distance += 15
class Simulator(MDApp):
def build(self):
sm = ScreenManager()
sm.add_widget(LoginScreen(name='login'))
sm.add_widget(CarListScreen(name='carlist'))
sm.add_widget(RegisterScreen(name='register'))
return
def on_start(self):
"""
Fetch the list of the available cars from the catalog
"""
global CARS_LIST
CARS_LIST = (requests.get(catalog_url+'carlist')).json()
if __name__ == "__main__":
Simulator().run() | [
"jacopobraccio@yahoo.it"
] | jacopobraccio@yahoo.it |
12d53d4cbd34a1e94bc6658f4ed05dd8b0621b98 | 4868e7990c818dfeb4a06af9bea93e7a7d919015 | /contoh hitungan manual/modulku_/StemNstopW.py | 075cab656f3a03f006cefc69c3036251365ea381 | [] | no_license | lufias69/fraud_sms_detection | 1c762dbbbe2cbe226fcf70cc6654ef1c690653a5 | 1669ce36ae706f82f58c26a31a787f148905063a | refs/heads/master | 2020-07-26T05:22:27.096424 | 2019-10-09T11:04:12 | 2019-10-09T11:04:12 | 208,547,766 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,362 | py | import re
import os
import json
delimiter_ = [" ", ".",",",'?','!','@','#','%','^','*','(',')','<','>','/','\\',"-","_","*",'[',']','{','}',':',"&"]
dir_path = os.path.dirname(os.path.realpath(__file__))
from Sastrawi.StopWordRemover.StopWordRemoverFactory import StopWordRemoverFactory
from Sastrawi.Stemmer.StemmerFactory import StemmerFactory
factory = StemmerFactory()
factoryStop = StopWordRemoverFactory()
stemmer = factory.create_stemmer()
stopword = factoryStop.create_stop_word_remover()
def get_data(name):
with open(dir_path+"/"+str(name), "r") as filename:
return json.load(filename)
def save_data(name, data):
with open(dir_path+"/"+str(name), "w") as filename:
json.dump(data, filename)
las_use = get_data("data_stemmer/last_use.json")
fail_stem = get_data("data_stemmer/fail_stem.json")
kata_dasar = get_data("data_stemmer/kata-dasar.json")
# def stemmer_kata(teks):
# # print(len(last_use_k))
# # print(len(last_use_r))
# teks_s = str(teks).split()
# for i, kt in enumerate(teks_s):
# if i in delimiter_:
# pass
# elif kt in las_use:
# teks_s[i] = las_use[kt]
# # teks_s[i] = last_use_r[last_use_k.index(kt)]
# elif kt in las_use or kt in fail_stem or kt in kata_dasar:
# continue
# else:
# teks_s[i] = stemmer.stem(kt)
# # print("*", end="")
# if teks_s[i] != kt:
# las_use[kt] = teks_s[i]
# # last_use_k.append(kt)
# # last_use_r.append(teks_s[i])
# else:
# if kt not in fail_stem:
# # last_use_aneh.append(kt)
# fail_stem.insert(0,kt)
# try:
# save_data(nama = "data_stemmer/last_use.json", data=las_use)
# save_data(nama = "data_stemmer/fail_stem.json", data=fail_stem)
# except:
# pass
# return " ".join(teks_s)
def stemmer_kata(teks):
teks_s = str(teks).split()
for i, kt in enumerate(teks_s):
# print()
if kt not in delimiter_:
teks_s[i] = stemmer.stem(kt)
return " ".join(teks_s)
def stop_word(kata):
kata = kata.split()
n_kata = list()
for i in kata:
n_kata.append(stopword.remove(i))
a = re.sub(' +', ' '," ".join(n_kata))
a = a.lstrip()
return a | [
"syaifulbachrimustamin@gmail.com"
] | syaifulbachrimustamin@gmail.com |
838c654692872ad206975d3932464f9effb66b5a | ef2b9336b9075c90bd115a0b095815bc26fdc778 | /V21_Optisches_pumpen/scripts/plot.py | 2b8ff42f69063ffef666d430306529b70e059897 | [] | no_license | janleoloewe/FP14 | c7636f0d4cbc893a28774cef9b54963755b53b10 | 2aa6462fcf1b5724ea52d0e4ec0a0fdea879039a | refs/heads/master | 2021-06-05T21:44:00.802570 | 2016-10-07T19:42:14 | 2016-10-07T19:42:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 611 | py | #! /usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
def gauss(x, nu):
return np.exp(-(x - nu) ** 2)
xs = np.linspace(-4, 12, 500)
plt.plot(xs, 1 - (gauss(xs, 0) + 0.7 * gauss(xs, 8)))
plt.xlabel(r'$B_\mathrm{m}$')
plt.ylabel(r'Transparenz')
plt.ylim(0, 1.1)
plt.xticks([0])
plt.yticks([1])
ax = plt.gca()
ax.spines['right'].set_color('none')
ax.spines['bottom'].set_color('none')
ax.spines['top'].set_position('zero')
ax.spines['left'].set_position('zero')
ax.xaxis.labelpad = 0.05
ax.yaxis.labelpad = 0.05
plt.tight_layout()
plt.savefig('build/plots/transmission.pdf')
plt.clf()
| [
"ms_r@hotmail.de"
] | ms_r@hotmail.de |
5c788f4b5e34cc8255582db1bd42ddce5fe7f451 | 3a05f78a45c0f329927a4464f2346de66f927b4f | /features/steps/account_steps.py | a214745ae36b5939bb10d754b4d9870f48538472 | [] | no_license | MarkAufdencamp/cloudonyms | be7dad4530e37b17c5eb0fcbce6f50013e81b916 | 61f1202b5be1dbd0e22fa12d78372fdf3cd2c455 | refs/heads/master | 2016-09-06T00:02:48.856940 | 2013-09-30T23:21:33 | 2013-09-30T23:21:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,913 | py | import unittest2 as unittest
from selenium import webdriver
#############################################
@given(u'I am on the signup page')
def step_impl(context):
assert False
@when(u'I fill in the user signup form')
def step_impl(context):
assert False
@then(u'I should be on the account created page')
def step_impl(context):
assert False
@then(u'I should see "Your account was created."')
def step_impl(context):
assert False
@then(u'I should receive an email')
def step_impl(context):
assert False
@when(u'I open the email')
def step_impl(context):
assert False
@then(u'I should see "confirm_email" in the email')
def step_impl(context):
assert False
@when(u'I follow "confirm_email" in the email')
def step_impl(context):
assert False
@then(u'I should see "Your email address has been confirmed."')
def step_impl(context):
assert False
#############################################
@given(u'I am on the login page')
def step_impl(context):
assert False
@given(u'my account has already been created')
def step_impl(context):
assert False
@when(u'I fill in the user signin form')
def step_impl(context):
assert False
@then(u'I should be on my console page')
def step_impl(context):
assert False
@then(u'I should see "Login successful!"')
def step_impl(context):
assert False
#############################################
@given(u'my account utilizes Google credentials')
def step_impl(context):
assert False
#############################################
@given(u'my account utiilizes Facebook credentials')
def step_impl(context):
assert False
#############################################
@given(u'my account use Twitter credentials')
def step_impl(context):
assert False
#############################################
@given(u'my account use LinkedIn credentials')
def step_impl(context):
assert False
| [
"Mark@Aufdencamp.com"
] | Mark@Aufdencamp.com |
fc296ea91577dd5ee2c036f5147bdaebcdc6dd63 | 50df4ea45867332dedb2678f899ae5c6e0d24ea9 | /public/pytodo/bin/isort | fbd999139578dba4226b2a0f6fab0624ba46b8da | [] | no_license | thisisshub/devel | 7c53e7a0f7fe1ae72cf7dd051f52ba40a552594f | 25edd315ed83ffc5d882735d91acac9c1306bc2a | refs/heads/master | 2020-08-06T13:23:53.837086 | 2019-12-09T03:40:19 | 2019-12-09T03:40:19 | 212,985,811 | 0 | 3 | null | 2019-10-10T14:32:29 | 2019-10-05T11:08:33 | Python | UTF-8 | Python | false | false | 234 | #!/home/shub/devel/public/pytodo/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from isort.main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
| [
"thisisshub@gmail.com"
] | thisisshub@gmail.com | |
a3960ab4e09898eb5608f1131dfcb8255eb67e01 | a8a6b14e8ad9206d15ec52a57f5c85340ff0073e | /PycharmProjects/corpus_building/noun_identify/src/processing.py | 9a69618b685486d7500d67407bd31987205cbe33 | [] | no_license | dbshuai/implicit_corpus_building | 1b236437aa8e0956415daab033090e8d5206e2c4 | 89c8c1999ce2ca349bbb86fe0dc4953553b17414 | refs/heads/master | 2020-04-07T13:01:58.573282 | 2018-11-13T01:30:01 | 2018-11-13T01:30:01 | 158,390,459 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 9,191 | py | import xlrd
import pickle
import argparse
import cmath
import sys
import os
sys.path.append("../../")
from yutils.str_utils import segment_str,postag_str,parse_str
def vvyxhqc_xlsx_read(xlsx_file):
"""
:param xlsx_file:
:return:
"""
read_file = xlrd.open_workbook(xlsx_file)
sheet = read_file.sheet_by_index(0)
cols = sheet.col_values(0)[1:]
norm_contents = {}
polarities = []
sentences = []
proportion = [0.0,0.0]
for col in cols:
if col != "\n":
col_info = col.split("\n")
if len(col_info) == 5:
col_sentence = col_info[0].lower()
col_aspect = col_info[1][len("<aspect>"):len("</aspect>")].lower()
col_polarity_expression = col_info[2][len("<polarity-expression>"):len("</polarity-expression>")].lower()
col_polarity = col_info[3][len("<polarity>"):len("</polarity>")].lower()
if col_polarity == "p":
proportion[0] += 1
else:
proportion[1] += 1
col_other_polarity_word = col[4][len("<other-polarity-word>"):len("</other-polarity-word>")].lower()
if col_sentence not in norm_contents:
norm_contents[col_sentence] = []
elif len(norm_contents[col_sentence])>0:
continue
norm_contents[col_sentence].append(col_aspect)
norm_contents[col_sentence].append(col_polarity_expression)
norm_contents[col_sentence].append(col_polarity)
norm_contents[col_sentence].append(col_other_polarity_word)
polarities.append(col_polarity)
sentences.append(col_sentence)
print("there are " + str(len(sentences)) +" sentences to process..")
return norm_contents,sentences,polarities,proportion
def phone_dir_read(directory):
"""
:param directory:
:return:
"""
sentences = []
polarities = []
proportion = [0.0,0.0]
for file in os.listdir(directory):
file = os.path.join(directory,file)
with open(file,"r") as f:
lines = f.readlines()
print("reading data from "+file)
for line in lines:
line = line.strip().lower()
info = line.split(" ")
if len(info) == 2:
polarity = info[0]
sentence = info[1]
if polarity == "差评":
polarity = "n"
proportion[0] += 1
else:
polarity = "p"
proportion[1] += 1
sentences.append(sentence)
polarities.append(polarity)
print(file,"finished!",len(lines))
return sentences,polarities,proportion
"""
考虑语料不均匀问题
p = proportion[0]/(proportion[0] + proportion[1])
n = proportion[1]/(proportion[0] + proportion[1])
"""
def get_feature(sentences):
"""
:param sentences:[sentence1,sentence2,..]
:return: [[w1,w2,..],..],[[pos1,pos2,..],..],[[parse1,parse2,..],..]
"""
words_list = segment_str(sentences,lexicon=args.lexicon)
pos_list = postag_str(words_list)
parse_list = parse_str(words_list,pos_list)
# print(words_list[4])
# print(parse_list[4])
return words_list,pos_list,parse_list
def determining_candidate(words_list,pos_list,parse_list,polarities):
positive_noun = []
negative_noun = []
statistic_for_words = {}
for (words,poses,parses,polarity) in zip(words_list,pos_list,parse_list,polarities):
for (word,pos) in zip(words,poses):
if pos == "n":
if word not in statistic_for_words:
statistic_for_words[word] = [0.0,0.0]
if polarity == "p":
statistic_for_words[word][0] += 1
if polarity == "n":
statistic_for_words[word][1] += 1
for k,v in statistic_for_words.items():
n = v[0] + v[1]
if n > 10:
if v[0]>v[1]:
p = v[0]/n
p0 = args.p0+0.5
up = p-p0
down = cmath.sqrt(p0*(1-p0)/n)
Z = up/down
Z = Z.real
if Z >= -1.64:
positive_noun.append(k)
else:
p = v[1]/n
p0 = args.p0
up = p - p0
down = cmath.sqrt(p0*(1 - p0)/n)
Z = up/down
Z = Z.real
if Z >= -1.64:
negative_noun.append(k)
return positive_noun,negative_noun
def att_to_end(id,parses):
"""
找到定中结构的尾
:param id:
:param parses:
:return:
"""
dep_id = parses[id][0]-1
dep_typ = parses[id][1]
if dep_typ != "ATT":
return id
else:
return att_to_end(dep_id,parses)
def pruning(positive_noun,negative_noun,words_list,pos_list,parse_list):
"""
对候选词表进行裁剪
:param positive_noun:
:param negative_noun:
:param words_list:
:param pos_list:
:param parse_list:
:return:
"""
after_pruning_positive = []
after_pruning_negative = []
del_words = []
for (words,poses,parses) in zip(words_list,pos_list,parse_list):
for i,word in enumerate(words):
if word in positive_noun or word in negative_noun:
id = att_to_end(i,parses)
if parses[id][1] == "SBV":
SBV_word = words[parses[id][0]-1]
if poses[parses[id][0]-1] == "a":
print("形容词是 "+ SBV_word+" 删除 "+word)
# print(words)
# print(poses)
# print(parses)
del_words.append(word)
elif poses[parses[id][0]-1] == "v" and parses[parses[id][0]-1][1] == "ATT":
adj_id = parses[parses[id][0]-1][0]-1
adj_word = words[parses[parses[id][0]-1][0]-1]
if poses[adj_id] == "a":
print("形容词是 " + adj_word + " 删除 " + word)
# print(words)
# print(poses)
# print(parses)
del_words.append(words)
for noun in positive_noun:
if noun not in del_words:
after_pruning_positive.append(noun)
for noun in negative_noun:
if noun not in del_words:
after_pruning_negative.append(noun)
return after_pruning_positive,after_pruning_negative
def file_write(positive,negative,type="pickle"):
if type == "pickle":
with open("../../data/pickle_data/positive.pkl","wb") as f:
pickle.dump(positive,f)
with open("../../data/pickle_data/negative.pkl", "wb") as f:
pickle.dump(negative,f)
if type == "txt":
with open("../../data/pickle_data/positive.txt","w") as f:
for noun in positive:
f.write(noun+"\n")
with open("../../data/pickle_data/negative.txt", "w") as f:
for noun in negative:
f.write(noun+"\n")
def main():
if args.rf == "../../data/original_data/vvyxhqc.xlsx":
_,sentences,polarities,proportion = vvyxhqc_xlsx_read(args.rf)
if args.rf == "../../data/original_data/phone/":
sentences, polarities,proportion = phone_dir_read(args.rf)
words_list,pos_list,parse_list = get_feature(sentences)
positive_noun,negative_noun = determining_candidate(words_list,pos_list,parse_list,polarities)
positive_noun,negative_noun = pruning(positive_noun,negative_noun,words_list,pos_list,parse_list)
file_write(positive_noun,negative_noun,args.type)
if __name__ == "__main__":
"""
使用已经标注好极性的语料抽取表意名词
规则:
1、候选确定:判断每个名词特征的上下文情感,若一个名词特征更多地处于积极情感,则该名词特征是积极的,反之亦然。统计测试保留可靠的词。
得到候选积极词表以及候选消极词表
2、裁剪规则:如果一个名词在句子中即被积极形容词修饰又被消极形容词修饰,则不可能是表意名词。
"""
parse = argparse.ArgumentParser(description="args for corpus building")
parse.add_argument("--rf",type=str,default="../../data/original_data/vvyxhqc.xlsx",
help="from where to read original corpus")
parse.add_argument("--p0",type=float,default=0.8,
help="hypothesized value")
parse.add_argument("--cf",type=float,default=0.95,
help="statistical confidence level")
parse.add_argument("--type",type=str,default="txt",
help="how to save the lexicon")
parse.add_argument("--lexicon",type=str,default="../../data/seg_lexicon/special_vvyxhqc.txt",
help="the lexicon for segment")
args = parse.parse_args()
main()
| [
"wangshuaidexiang@163.com"
] | wangshuaidexiang@163.com |
959d08c86faa5429545a51552270f33743c50c74 | 3485140792e9bae67499fef138d50d046cccb256 | /datamining/AprioriProject/util/ProgressBar.py | 5858e003c7264ec53dab5ae6a814fc400029c84a | [] | no_license | ALREstevam/TopicosBD-DataMining-IBGE-Apriori | dc14a50ca8f3046b8125a183cdcb4e99d3c4c616 | 5bf8dee35df0f22902f7816b8738e585fdca3410 | refs/heads/master | 2020-03-17T04:38:08.111880 | 2018-06-14T12:14:11 | 2018-06-14T12:14:11 | 133,282,949 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,920 | py | import sys
class ProgressBar(object):
DEFAULT_BAR_LENGTH = 65
DEFAULT_CHAR_ON = '█'
DEFAULT_CHAR_OFF = '░'
def __init__(self, end, start=0):
self.end = end
self.start = start
self._barLength = self.__class__.DEFAULT_BAR_LENGTH
self.setLevel(self.start)
self._plotted = False
def setLevel(self, level):
self._level = level
if level < self.start: self._level = self.start
if level > self.end: self._level = self.end
value = float(self.end - self.start)
if(value == 0): value = 1
self._ratio = float(self._level - self.start) / value
self._levelChars = int(self._ratio * self._barLength)
def plotProgress(self):
sys.stdout.write("\r %3i%% [%s%s]" %(
int(self._ratio * 100.0),
self.__class__.DEFAULT_CHAR_ON * int(self._levelChars),
self.__class__.DEFAULT_CHAR_OFF * int(self._barLength - self._levelChars),
))
sys.stdout.flush()
self._plotted = True
def setAndPlot(self, level):
oldChars = self._levelChars
self.setLevel(level)
if (not self._plotted) or (oldChars != self._levelChars):
self.plotProgress()
def __add__(self, other):
assert type(other) in [float, int], "can only add a number"
self.setAndPlot(self._level + other)
return self
def __sub__(self, other):
return self.__add__(-other)
def __iadd__(self, other):
return self.__add__(other)
def __isub__(self, other):
return self.__add__(-other)
def __del__(self):
sys.stdout.write("\n")
'''
import time
for j in range(5):
count = 1000
pb = ProgressBar(count)
# pb.plotProgress()
for i in range(0, count):
pb += 1
# pb.setAndPlot(i + 1)
time.sleep(0.01)
print('\n\nSTEP {}'.format(j))
'''
| [
"a166348@g.unicamp.com"
] | a166348@g.unicamp.com |
931300b3c495baff8b052bb61df42f03e9e0e772 | 1a758ef862f733d98ddd8ebc8ade5cefd95c24f2 | /customers/migrations/0013_facebookcustomer.py | 3abb34e6d2d0c3b6e1e3df3ca8e899dc7fe394e5 | [] | no_license | ajajul/ReactJS_Python | f116b35394666c5b3f2419eb5d8d7aeb077d4a24 | 08310d56fa88f326ddbfdd4b189f2a3a71f76d99 | refs/heads/master | 2020-03-19T03:16:57.510672 | 2018-06-01T10:36:36 | 2018-06-01T10:36:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,157 | py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('customers', '0012_auto_20160802_1628'),
]
operations = [
migrations.CreateModel(
name='FacebookCustomer',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('facebook_id', models.CharField(max_length=255, verbose_name=b'Facebook ID')),
('first_name', models.CharField(max_length=255, verbose_name=b'First name')),
('last_name', models.CharField(max_length=255, verbose_name=b'Last name')),
('email', models.EmailField(unique=True, max_length=255, verbose_name=b'Email address')),
('gender', models.CharField(max_length=255, verbose_name=b'Gender')),
('customer', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True)),
],
),
]
| [
"web.expert@aol.com"
] | web.expert@aol.com |
2017d05bde739bffc7e152160a95f0a50186b250 | c13553fc611be7559f12c83393ab16bb36c8e4b6 | /words.py | d772618e5bc4b8e2049b5a66f7661d8561ea4c7b | [] | no_license | savvyknee/OOP100 | 6ad8a7f43c23181f560c8e0658f033076fa48091 | 61995ead259c91df4dbd6d9baf8c70d0d942ec39 | refs/heads/master | 2016-08-07T07:25:00.678227 | 2014-03-10T18:25:15 | 2014-03-10T18:25:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,338 | py | # Andrew Savini CST100 21Feb2014
# longestWord.py
# creates a list of words typed, finds the longest word, outputs it
def main():
#getTheInput() takes the input from the user. if the user enters a blank space, it returns a 1, which will reset the program
#otherwise, it returns the input in the form of a list
def getTheInput():
"getTheInput() takes input from the user, and enters each word into a list as a separate tuple. In the \
case of a blank line, it resets the program."
theWords = input("Enter a few words and I will find the longest: \n")
if theWords == "":
return 1
else:
theWords = theWords.lower()
words = theWords.split()
return words
# here, we create a blank new list that will hold the lengths of each tuple in wordList.
# counter is at -1 so we don't have to subtract the one later
# we iterate through each number in legths, looking for a number bigger than the current biggest
# every time biggest is updated, we note the index number of the tuple. this comes into play later.
def find_longest_word(wordList):
"find_longest_word takes one parameter in the form of a list holding strings. It finds the string with the most characters, and \
returns the index of the word with the most characters. In the case of there being two words of equal characters, both being tied \
for the biggest, it returns the first."
lengths = []
index = 0
counter = -1
biggest = 0
current = 0
for word in wordList:
lengths.append(len(word))
for i in lengths:
counter += 1
biggest = i
if biggest > current:
current = biggest
index = counter
return index
# I wanted to handle the case of a blank line. The best way I could think of was to create a list called
# words, to hold the returned list from getTheInput() and reset the program in the case of a blank line
# Otherwise, we print a statement, then we print the list.
# Then we print the next statement.
# Lastly, we implement the find_longest_word function with the parameter being the list "words"
# It returns a number value, referencing the index in the list "words" of the tuple with the most characters
words = getTheInput()
if words ==1:
main()
else:
print("The list of words entered is:")
print(words)
print("The longest word in the list is:")
print(words[find_longest_word(words)])
main()
| [
"savini.andrew@gmail.com"
] | savini.andrew@gmail.com |
c9ed8cae33fb6e394314b860c1f34cfcfa9d10bb | a0ab18317188801d76d00fdbe7b7972aac3b6f0d | /evalml/tests/component_tests/test_drop_null_columns_transformer.py | 763968a5e0501e00fa7735ad57836325a6d04b24 | [
"BSD-3-Clause"
] | permissive | sharshofski/evalml | 04d96f0125075fe9ac01ee4f77ce32c6f3370c16 | f13dcd969e86b72ba01ca520247a16850030dcb0 | refs/heads/main | 2023-02-28T07:59:26.506815 | 2021-02-07T22:43:19 | 2021-02-07T22:43:19 | 337,245,652 | 0 | 0 | BSD-3-Clause | 2021-02-09T00:11:20 | 2021-02-09T00:11:20 | null | UTF-8 | Python | false | false | 5,786 | py | import numpy as np
import pandas as pd
import pytest
from pandas.testing import assert_frame_equal
from evalml.pipelines.components import DropNullColumns
def test_drop_null_transformer_init():
drop_null_transformer = DropNullColumns(pct_null_threshold=0)
assert drop_null_transformer.parameters == {"pct_null_threshold": 0.0}
assert drop_null_transformer._cols_to_drop is None
drop_null_transformer = DropNullColumns()
assert drop_null_transformer.parameters == {"pct_null_threshold": 1.0}
assert drop_null_transformer._cols_to_drop is None
drop_null_transformer = DropNullColumns(pct_null_threshold=0.95)
assert drop_null_transformer.parameters == {"pct_null_threshold": 0.95}
assert drop_null_transformer._cols_to_drop is None
with pytest.raises(ValueError, match="pct_null_threshold must be a float between 0 and 1, inclusive."):
DropNullColumns(pct_null_threshold=-0.95)
with pytest.raises(ValueError, match="pct_null_threshold must be a float between 0 and 1, inclusive."):
DropNullColumns(pct_null_threshold=1.01)
def test_drop_null_transformer_transform_default_pct_null_threshold():
drop_null_transformer = DropNullColumns()
X = pd.DataFrame({'lots_of_null': [None, None, None, None, 5],
'no_null': [1, 2, 3, 4, 5]})
X_expected = X.astype({'lots_of_null': 'float64', 'no_null': 'Int64'})
drop_null_transformer.fit(X)
X_t = drop_null_transformer.transform(X)
assert_frame_equal(X_expected, X_t.to_dataframe())
def test_drop_null_transformer_transform_custom_pct_null_threshold():
X = pd.DataFrame({'lots_of_null': [None, None, None, None, 5],
'all_null': [None, None, None, None, None],
'no_null': [1, 2, 3, 4, 5]})
drop_null_transformer = DropNullColumns(pct_null_threshold=0.5)
X_expected = X.drop(["lots_of_null", "all_null"], axis=1)
X_expected = X_expected.astype({"no_null": "Int64"})
drop_null_transformer.fit(X)
X_t = drop_null_transformer.transform(X)
assert_frame_equal(X_expected, X_t.to_dataframe())
# check that X is untouched
assert X.equals(pd.DataFrame({'lots_of_null': [None, None, None, None, 5],
'all_null': [None, None, None, None, None],
'no_null': [1, 2, 3, 4, 5]}))
def test_drop_null_transformer_transform_boundary_pct_null_threshold():
drop_null_transformer = DropNullColumns(pct_null_threshold=0.0)
X = pd.DataFrame({'all_null': [None, None, None, None, None],
'lots_of_null': [None, None, None, None, 5],
'some_null': [None, 0, 3, 4, 5]})
drop_null_transformer.fit(X)
X_t = drop_null_transformer.transform(X)
assert X_t.to_dataframe().empty
drop_null_transformer = DropNullColumns(pct_null_threshold=1.0)
drop_null_transformer.fit(X)
X_t = drop_null_transformer.transform(X)
assert_frame_equal(X_t.to_dataframe(), X.drop(["all_null"], axis=1))
# check that X is untouched
assert X.equals(pd.DataFrame({'all_null': [None, None, None, None, None],
'lots_of_null': [None, None, None, None, 5],
'some_null': [None, 0, 3, 4, 5]}))
def test_drop_null_transformer_fit_transform():
drop_null_transformer = DropNullColumns()
X = pd.DataFrame({'lots_of_null': [None, None, None, None, 5],
'no_null': [1, 2, 3, 4, 5]})
X_expected = X.astype({'lots_of_null': 'float64', 'no_null': 'Int64'})
X_t = drop_null_transformer.fit_transform(X)
assert_frame_equal(X_expected, X_t.to_dataframe())
X = pd.DataFrame({'lots_of_null': [None, None, None, None, 5],
'all_null': [None, None, None, None, None],
'no_null': [1, 2, 3, 4, 5]})
drop_null_transformer = DropNullColumns(pct_null_threshold=0.5)
X_expected = X.drop(["lots_of_null", "all_null"], axis=1)
X_expected = X_expected.astype({'no_null': 'Int64'})
X_t = drop_null_transformer.fit_transform(X)
assert_frame_equal(X_expected, X_t.to_dataframe())
# check that X is untouched
assert X.equals(pd.DataFrame({'lots_of_null': [None, None, None, None, 5],
'all_null': [None, None, None, None, None],
'no_null': [1, 2, 3, 4, 5]}))
drop_null_transformer = DropNullColumns(pct_null_threshold=0.0)
X = pd.DataFrame({'lots_of_null': [None, None, None, None, 5],
'some_null': [None, 0, 3, 4, 5]})
X_t = drop_null_transformer.fit_transform(X)
assert X_t.to_dataframe().empty
X = pd.DataFrame({'all_null': [None, None, None, None, None],
'lots_of_null': [None, None, None, None, 5],
'some_null': [None, 0, 3, 4, 5]})
drop_null_transformer = DropNullColumns(pct_null_threshold=1.0)
X_t = drop_null_transformer.fit_transform(X)
assert_frame_equal(X.drop(["all_null"], axis=1), X_t.to_dataframe())
def test_drop_null_transformer_np_array():
drop_null_transformer = DropNullColumns(pct_null_threshold=0.5)
X = np.array([[np.nan, 0, 2, 0],
[np.nan, 1, np.nan, 0],
[np.nan, 2, np.nan, 0],
[np.nan, 1, 1, 0]])
X_t = drop_null_transformer.fit_transform(X)
assert_frame_equal(X_t.to_dataframe(), pd.DataFrame(np.delete(X, [0, 2], axis=1), columns=[1, 3]))
# check that X is untouched
np.testing.assert_allclose(X, np.array([[np.nan, 0, 2, 0],
[np.nan, 1, np.nan, 0],
[np.nan, 2, np.nan, 0],
[np.nan, 1, 1, 0]]))
| [
"noreply@github.com"
] | noreply@github.com |
3d6274b08b39fdeba3da7d99bfeba9440fbeeb96 | 6ec7663212ec9955d68543cf9eab5680d259704f | /npc_url_scrape.py | d23c3dafa3c13cd20936ec15f19c70f6c85293cb | [] | no_license | blangwell/souls-wiki-scrape | 682372224500df9e009b3c6f538ce586b2dc923a | 722865be7bea98d5a0d44107beff602e5209474a | refs/heads/main | 2023-03-21T15:46:37.979906 | 2021-03-22T01:14:50 | 2021-03-22T01:14:50 | 349,308,129 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 992 | py | import requests
from bs4 import BeautifulSoup
WIKI_URL = 'http://darksouls.wikidot.com/npcs'
def get_npc_links():
print(f'Making a GET request to {WIKI_URL}')
try:
npc_idx = requests.get(WIKI_URL)
npc_idx.raise_for_status()
except requests.exceptions.RequestException as e:
raise SystemExit(f'##### Error during GET request! #####\n{e}')
soup = BeautifulSoup(npc_idx.text, 'lxml')
try:
td = soup.find('td')
anchor_tags = td.find_all('a')
except AttributeError as e:
raise SystemExit(f'##### Error scaping anchor tags! #####\n{e}')
return anchor_tags
def write_hrefs(tags):
if len(tags) == 0:
raise SystemExit('##### No anchor tags to parse! Exiting ##### ')
print('Writing HREFs to npc-urls.txt')
f = open('npc-urls.txt', 'w')
for tag in tags:
href = tag.get('href')
f.write(f'http://darksouls.wikidot.com{href}\n')
f.close()
links = get_npc_links()
write_hrefs(links) | [
"b.langwell@outlook.com"
] | b.langwell@outlook.com |
13818edfd220a8cbd9a16461d0ed75fc9baea8fc | cd05f9c37f779abc044e6f998f3c06de98d46f0e | /core/dummy/dummy.py | 6894b0e3d9d786491df35492aad6ef20dcc68baf | [] | no_license | lordknight1904/tensorflow | 3ef99dabc9845749c67ea297dec74c799cd37d75 | 7a86b5a4dc40c2ddf2141c7e47a6cfb812ecf69a | refs/heads/master | 2020-04-18T11:19:43.444462 | 2019-02-11T03:06:00 | 2019-02-11T03:06:00 | 166,517,405 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,539 | py | import pickle as cPickle
import gzip
import numpy as np
from tensorflow import layers
import tensorflow as tf
# if __name__ == "__main__":
#
# inputs = tf.keras.Input(shape=(32,)) # Returns a placeholder tensor
# x = layers.Dense(64, activation='relu')(inputs)
# x = layers.Dense(64, activation='relu')(x)
# predictions = layers.Dense(10, activation='softmax')(x)
#
# model = tf.keras.Model(inputs=inputs, outputs=predictions)
#
# model.compile(optimizer=tf.train.GradientDescentOptimizer(learning_rate=3.0),
# loss='categorical_crossentropy',
# metrics=['accuracy'])
# import numpy as np
#
# data = np.random.random((1000, 32))
# labels = np.random.random((1000, 10))
#
# val_data = np.random.random((100, 32))
# val_labels = np.random.random((100, 10))
#
# model.fit(data, labels, epochs=10, batch_size=32,
# validation_data=(val_data, val_labels))
def _parse_function(str):
return str + "_"
if __name__ == "__main__":
f = gzip.open('../data/mnist.pkl.gz', 'rb')
training_data, validation_data, test_data = cPickle.load(f, encoding='latin1')
f.close()
training_label = np.zeros((training_data[1].size, training_data[1].max()+1))
training_label[np.arange(training_data[1].size), training_data[1]] = 1
validation_label = np.zeros((validation_data[1].size, validation_data[1].max()+1))
validation_label[np.arange(validation_data[1].size), validation_data[1]] = 1
data_set = tf.data.Dataset.from_tensor_slices((training_data[0], training_label))
data_set = data_set.batch(30).repeat()
val_data_set = tf.data.Dataset.from_tensor_slices((validation_data[0], validation_label))
val_data_set = val_data_set.batch(30).repeat()
model = tf.keras.Sequential(
[
# layers.Dense(784, activation='sigmoid'),
layers.Dense(30, activation='sigmoid', input_shape=(784,)),
layers.Dense(10, activation='sigmoid')
]
)
# inputs = tf.keras.Input(shape=(784,))
# x = layers.Dense(30, activation='sigmoid')(inputs)
# predictions = layers.Dense(10, activation='sigmoid')(x)
#
# model = tf.keras.Model(inputs=inputs, outputs=predictions)
model.summary()
model.compile(optimizer=tf.train.GradientDescentOptimizer(learning_rate=3.0),
loss='mse',
metrics=['mae', 'accuracy'])
model.fit(data_set, epochs=30, steps_per_epoch=50000, validation_data=val_data_set, validation_steps=3)
| [
"lordknight1904@gmail.com"
] | lordknight1904@gmail.com |
bb25d439cb529a2ca4ddb5a746d9802470effb6d | 4e1358e120e99b60db51caa73d9073719fd5f0cd | /main.py | 279b002c580d1e6ace0f62ad6b572f0c8ba93141 | [] | no_license | asyte/wsissue | b79d357c502d7b7d027face6e02d78bae76180a6 | 4f6f49e3dd88cbb8b732dcb9ddf8b233daac4fd1 | refs/heads/master | 2022-12-02T04:44:00.231852 | 2020-08-19T08:58:15 | 2020-08-19T08:58:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,233 | py | from sanic import Sanic
from sanic import response
from sanic.log import logger
from aiofile import AIOFile
from db import db
import wslib
import secret
app = Sanic("Websocket Issue")
app.config.DB_USE_CONNECTION_FOR_REQUEST = True
app.config.DB_HOST = secret.DB_HOST
app.config.DB_PORT = secret.DB_PORT
app.config.DB_USER = secret.DB_USER
app.config.DB_PASSWORD = secret.DB_PASSWORD
app.config.DB_DATABASE = secret.DB_DATABASE
app.config.DB_POOL_MIN_SIZE = 1
app.config.DB_POOL_MAX_SIZE = 3
db.init_app(app)
@app.route("/")
async def index(request):
index_html = ''
async with AIOFile("./index.html", 'r') as afp:
index_html = await afp.read()
return response.HTTPResponse(index_html, content_type='text/html')
@app.middleware('response')
async def response_middleware(request, response):
logger.debug(f'in response_middleware for {request.url}')
@app.websocket("/feed")
async def feed(request, ws):
feed, is_existing = await wslib.Feed.get('feed')
if not is_existing:
feed.set_app(request.app)
client = await feed.register(wslib.MyWSClient(ws, request))
await client.receiver()
return response.empty()
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8888) | [
"rwlundy82@gmail.com"
] | rwlundy82@gmail.com |
00dac1d7f1170b442a0d17f46be3611f7429cc05 | d3395d2e1a8ec82d224c60ad5247c8a726cf32b9 | /Decision Trees/Applying Decision Trees-143.py | 3ae495cce144f9aa63970de73d8e13cc4f9d7b34 | [] | no_license | smzimran/dataquest-projects | 88300a6ac09b38264d43f862a97695d51a7bc8ab | 7d55a0d4ad7a7004678b18bbb5f2ee668e6e1c91 | refs/heads/master | 2022-12-02T15:01:59.172778 | 2020-08-07T08:58:39 | 2020-08-07T08:58:39 | 112,442,907 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,854 | py | ## 2. Using Decision Trees With scikit-learn ##
from sklearn.tree import DecisionTreeClassifier
# A list of columns to train with
# We've already converted all columns to numeric
columns = ["age", "workclass", "education_num", "marital_status", "occupation", "relationship", "race", "sex", "hours_per_week", "native_country"]
# Instantiate the classifier
# Set random_state to 1 to make sure the results are consistent
clf = DecisionTreeClassifier(random_state=1)
# We've already loaded the variable "income," which contains all of the income data
clf.fit(income[columns], income['high_income'])
## 3. Splitting the Data into Train and Test Sets ##
import numpy
import math
# Set a random seed so the shuffle is the same every time
numpy.random.seed(1)
# Shuffle the rows
# This permutes the index randomly using numpy.random.permutation
# Then, it reindexes the dataframe with the result
# The net effect is to put the rows into random order
income = income.reindex(numpy.random.permutation(income.index))
train_max_row = math.floor(income.shape[0] * .8)
train = income.iloc[0:train_max_row]
test = income.iloc[train_max_row:]
## 4. Evaluating Error With AUC ##
from sklearn.metrics import roc_auc_score
clf = DecisionTreeClassifier(random_state=1)
clf.fit(train[columns], train["high_income"])
predictions = clf.predict(test[columns])
error = roc_auc_score(test['high_income'], predictions)
print(error)
## 5. Computing Error on the Training Set ##
predictions = clf.predict(train[columns])
print(roc_auc_score(train['high_income'], predictions))
## 7. Reducing Overfitting With a Shallower Tree ##
# Decision trees model from the last screen
clf = DecisionTreeClassifier(random_state=1, min_samples_split = 13)
clf.fit(train[columns], train['high_income'])
train_predictions = clf.predict(train[columns])
train_auc = roc_auc_score(train['high_income'], train_predictions)
test_predictions = clf.predict(test[columns])
test_auc = roc_auc_score(test['high_income'], test_predictions)
## 8. Tweaking Parameters to Adjust AUC ##
# The first decision trees model we trained and tested
clf = DecisionTreeClassifier(random_state=1, max_depth=7, min_samples_split=13)
clf.fit(train[columns], train["high_income"])
predictions = clf.predict(test[columns])
test_auc = roc_auc_score(test["high_income"], predictions)
train_predictions = clf.predict(train[columns])
train_auc = roc_auc_score(train["high_income"], train_predictions)
print(test_auc)
print(train_auc)
## 9. Tweaking Tree Depth to Adjust AUC ##
# The first decision tree model we trained and tested
clf = DecisionTreeClassifier(random_state=1, max_depth=2, min_samples_split=100)
clf.fit(train[columns], train["high_income"])
predictions = clf.predict(test[columns])
test_auc = roc_auc_score(test["high_income"], predictions)
train_predictions = clf.predict(train[columns])
train_auc = roc_auc_score(train["high_income"], train_predictions)
print(test_auc)
print(train_auc)
## 12. Exploring Decision Tree Variance ##
numpy.random.seed(1)
# Generate a column containing random numbers from 0 to 4
income["noise"] = numpy.random.randint(4, size=income.shape[0])
# Adjust "columns" to include the noise column
columns = ["noise", "age", "workclass", "education_num", "marital_status", "occupation", "relationship", "race", "sex", "hours_per_week", "native_country"]
# Make new train and test sets
train_max_row = math.floor(income.shape[0] * .8)
train = income.iloc[:train_max_row]
test = income.iloc[train_max_row:]
# Initialize the classifier
clf = DecisionTreeClassifier(random_state=1)
clf.fit(train[columns], train['high_income'])
train_predictions = clf.predict(train[columns])
test_predictions = clf.predict(test[columns])
train_auc = roc_auc_score(train['high_income'], train_predictions)
test_auc = roc_auc_score(test['high_income'], test_predictions) | [
"noreply@github.com"
] | noreply@github.com |
4cd457aae559324c28a76e8ff71688100483e7f2 | f7a48634de139b7f5585c2bf3d3014605130428c | /ebedke/plugins/kompot.py | c41f831fd3d7bba415606e8c90bfa14c14c43220 | [
"Apache-2.0",
"MIT"
] | permissive | ijanos/ebedke | b72dcdef63c575eb4090661bab2e2c7a7864ab76 | 9a0f91cc6536a78d7da9aca1fab22924a56d38e2 | refs/heads/master | 2023-04-20T19:36:03.928669 | 2021-01-24T11:35:15 | 2021-01-24T11:35:15 | 99,848,492 | 35 | 11 | Apache-2.0 | 2023-03-27T22:36:27 | 2017-08-09T20:08:13 | Python | UTF-8 | Python | false | false | 1,742 | py | from datetime import datetime, timedelta
from ebedke.utils.date import days_lower, on_workdays
from ebedke.utils.text import pattern_slice
from ebedke.utils import facebook
from ebedke.pluginmanager import EbedkePlugin
FB_PAGE = "https://www.facebook.com/pg/KompotBisztro/posts/"
FB_ID = "405687736167829"
@on_workdays
def getMenu(today):
day = today.weekday()
is_this_week = lambda date: datetime.strptime(date, '%Y-%m-%dT%H:%M:%S%z').date() > today.date() - timedelta(days=7)
is_today = lambda date: datetime.strptime(date, '%Y-%m-%dT%H:%M:%S%z').date() == today.date()
ignore_hashtags = lambda post: " ".join(word.lower() for word in post.split() if word[0] != "#")
daily_menu_filter = lambda post: is_today(post['created_time']) \
and "menü" in post['message'].lower()
weekly_menu_filter = lambda post: is_this_week(post['created_time']) \
and days_lower[day] in ignore_hashtags(post['message'])
weekly_menu = facebook.get_filtered_post(FB_ID, weekly_menu_filter)
if weekly_menu:
menu = pattern_slice(weekly_menu.splitlines(), [days_lower[day]], days_lower + ["sütiket", "#", "jó étvágyat", "mai menü"])
else:
menu_post = facebook.get_filtered_post(FB_ID, daily_menu_filter).splitlines()
menu = []
for i, line in enumerate(menu_post):
if "A:" in line:
menu = list((menu_post[i - 1], menu_post[i], menu_post[i + 1]))
break
return menu
plugin = EbedkePlugin(
enabled=True,
groups=["corvin"],
name='Kompót',
id='kp',
url=FB_PAGE,
downloader=getMenu,
ttl=timedelta(hours=24),
cards=['szep'],
coord=(47.485753, 19.075932)
)
| [
"ijanos@gmail.com"
] | ijanos@gmail.com |
d3154b550cc9b18879b36bff03549d4bb8f20106 | d14966a1c4a8e8edbf5bb9ec6de83a67e3ad1407 | /seed.py | 9bc78d95fae56693bbadcf45fac5c6dcc50e363d | [
"MIT"
] | permissive | speranskydanil/stock | b14b9b79b2312f21f97cc2e3e7c7b89c40fabe89 | f2e8e88d2fe30f78f0cea4f0a0df7db4165094ea | refs/heads/master | 2020-05-17T06:53:51.862256 | 2015-04-12T06:36:12 | 2015-04-12T06:36:12 | 33,782,760 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 16,609 | py | #!/usr/bin/env python
import os
import sys
from random import randint, choice
from django.utils import timezone
from datetime import datetime
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "stock.settings")
import django
django.setup()
from stock.models import Message
from blog.models import Category, Article, Like
Message.objects.create(subject='Spam', message='spam spam spam')
Message.objects.create(subject='A question #1', message='body of the question #1')
Message.objects.create(subject='A question #2', message='body of the question #2')
def words():
return ['absolute', 'actual (not virtual)', 'addressable', 'advanced CMOS logic', 'advanced Schottky', 'alphabet', 'alphabetic', 'alphabetically', 'alphameric', 'alphanumeric', 'American National Standards Institute', 'amplitude-shift keying', 'analog', 'analog-to-digital', 'Andrew file system', 'ANSI', 'applications engineer', 'asynchronous', 'asynchronous communication interface adapter', 'asynchronous time division multiplexing', 'asynchronous transfer mode', 'a-to-d', 'attenuation', 'automatic level control', 'back end', 'Berkeley standard distribution', 'binary', 'binary coded decimal', 'bips', 'bit', 'bit error rate tester', 'block', 'block check character', 'branchpoint', 'breakpoint', 'bug', 'buoy', 'byte', 'capacity', 'carry lookahead adder', 'cascode emitter-coubled logic', 'center frequency', 'characters per inch', 'characters per line', 'characters per second', 'checkpoint', 'comment', 'committed information rate', 'compatible', 'compatibility', 'complementary binary', 'delsy', 'digital', 'displacement', 'downstream', 'downtime', 'd-to-a', 'dummy', 'dynamic', 'end-of-tape', 'end-of-transmission', 'executive', 'first-in-first-out', 'flip flop', 'floating-point', 'flow', 'formula', 'geek', 'global', 'heuristic', 'Hewlett Packard', 'hexadecimal', 'hierarchy', 'hissy ', 'host', 'housekeeping', 'hypermedia', 'information', 'information technology', 'initial program load', 'interactive', 'kilobyte', 'last-in-first-out', 'lines per inch', 'literal', 'load', 'loop->', 'nested ~', 'Lotus Intel Microsoft expanded memory specification', 'lowercase', 'macro', 'mask', 'megabyte', 'memory', 'million instructions per second', 'mnemonic', 'modeling', 'multi-color graphics array', 'multiplex', 'nested loop', 'noise', 'null', 'numerical symbols', 'object', 'offline', 'one time programmable', 'online', 'output', 'overflow', 'packet', 'password', 'picosecond', 'plastic small outline package', 'pop', 'pop-up', 'processor element', 'proprietary', 'pulse', 'punch', 'punched', 'pushdown', 'queue', 'queuing', 'real time', 'recursive', 'red green blue', 'reentrant', ' reentry', 'relational', 'relocatable', 'research and development', 'resident', 'report program generator', 'reverse Polish notation', 'row address strobe', 'run length limited', 'sag', 'security', 'security accounts manager', 'sensitive', 'serial inline package', 'serial in parallel out', 'serial input and output', 'serial output', 'settings', 'signal ground', 'silicon controller switch', 'single-instruction multiple-data', 'single-instruction single-data', 'small outline package', 'small scale integration', 'spec(s)', 'stack pointer', 'staging', 'stand-alone', 'storage', 'store', 'stream', ' streaming', 'streaming tape unit', 'string', 'subroutine', 'surface mount', 'surface mount device', 'surge', 'synchronous', 'synchronous data link control', 'synchronous time division multiplexing', 'system network architecture', 'systems engineer', 'table', 'terminal (end point)', 'throughput', 'time division multiplexing', 'time domain reflectometry', 'time-share', 'toggle', 'top-down', 'turnaround', 'universal product code (barcode)', 'universal time code', 'uppercase', 'upstream', 'uptime', 'upward compatible', 'vertical sync', 'very long instruction word', 'Video Enhanced Standards Association', 'write-once read-many', 'zero effort channeling', 'zero insertion force', 'align', 'background', 'button', 'data', 'desk-top', 'delete', 'directory', 'document', 'double-click', 'end-of-file', 'end-of-line', 'enter', 'exit', 'extension', 'field', 'file', 'folder', 'font', 'foot', ' footer', 'foreground', 'format', 'header', 'I-beam', 'icon', 'identifier', 'image', 'import', 'input', 'insert', 'keyboarding', 'left-justify', 'link', ' linkage', 'margin', 'maximize screen', 'menu', 'merge', 'minimize screen', 'modular', 'module', 'paste', 'print', 'print merge', 'prompt', 'sort', 'quit', 'record', 'return', 'right-justify', 'save', 'save as', 'screen', 'scroll', 'select', 'shift', 'single-click', 'spacebar', 'spreadsheet', 'stack', 'tab', 'tab over', 'up arrow (etc)', 'video graphics array', 'virtual terminal', 'accumulator', 'analog multimeter', 'analog-to-digital converter', 'Apple', 'arithmetic logic unit', 'assembler', 'bank (data)', 'Basic Input Output System', 'board', 'buffer', 'bus', 'cable', 'card', 'central processing unit', 'ceramic dual inline package', 'chip', 'circuit', 'clock', 'command status register', 'compact disk', 'compact disk - interactive', 'compact disk - read only memory', 'complex instruction set computer', 'content addressable memory', 'control program / monitor (operating system)', 'control read-only memory', 'conversational monitor system', 'counter/timer circuit', 'cyclic redundancy check', 'data acquisition and control', 'device', 'data terminal controller', 'direct access storage device', 'disk', 'diskette', 'disk operating system', 'double density', 'double sided', 'drive', 'dual in line', 'duplex', ' duplexed', 'dynamic random access memory', 'EISA configuration utility', 'electrically alterable read only memory', 'electrically available read-only memory', 'electrically erasable programmable read only memory', 'electrically programmable logic device', 'enhanced industry standard architecture', 'enhanced small device interface', 'extended binary coded decimal interchange code', 'extended graphics array', 'extended memory specification', 'Fairchild advanced Schottky TTL', 'file transfer protocol', 'floppy (disk)', 'fixed disk drive', 'floppy disk controller', 'floppy disk drive', 'front end', 'front end processor', 'gate array', 'gate controller switch', 'generic array logic', 'general purpose interface bus', 'graphical user interface', 'half duplex', 'interface processor', 'hard disk', 'hard disk controller', 'hard disk drive', 'hard drive', 'hardware', 'hardwired array logic', 'Hercules graphics card', 'Hewlett Packard', 'Hewlett Packard interface bus', 'Hewlett Packard interface loop', 'hierarchical file system', 'high density', 'high performance file system', 'high speed CMOS', 'high speed CMOS with TTL thresholds', 'high threshold logic', 'industry standard architecture', 'information systems network', 'input/output processor', 'interface', 'interface message processor', 'laptop', 'local area network', 'logical unit number', 'Mac', 'MacIntosh', 'main processing unit', 'massively parallel processor', 'master boot record', 'mean time between failures', 'mechanism', 'mega bits', 'megabytes', 'memory management unit', 'microuter unit', 'microprocessing unit', 'monitor', 'monochrome display adapter', 'multi-chip module', 'multiplexer', 'multiplying digital to analog converter', 'multiprocessor', 'network file server', 'nick (card)', 'non-volatile random access memory', 'operating system', 'panel', 'permanent virtual circuit', 'personal computer', 'Personal Computer Memory Card International Association', 'pin grid array', 'plastic leaded chip carrier', 'plug', 'plug and play', 'port', 'priority interrupt controller', 'processor', 'programmable logic device', 'program counter', 'programmable interrupt controller', 'programmable logic array', 'programmable logic sequencer', 'programmable read-only memory', 'programmable sound generator', 'random access memory digital to analog converter', 'quad-flatpack', 'quad inline package', 'quad surface mount', 'raster', 'reader', 'read-only memory', 'read-only storage', 'real time clock', 'reduced instruction set computer', 'redundant arrays of inexpensive disks', 'reel', 'register', 'registry', 'repeater', 'resistor transistor logic', 'routing control center', 'sea moss (CMOS)', 'scuzzy (SCSI)', 'sectors', 'sectors per track', 'sequential access memory', 'serial clock', 'shift register', 'shrink small outline package', 'signal processor', 'single board computer', 'single inline memory module', 'single in-line package', 'single inline pinned package', 'single processor unit', 'small outline j-leaded', 'spool', 'static random access memory', 'tape', 'terminal', 'Texas Instruments', 'track', 'tracks per inch', 'translation-lookaside buffer', 'universal asynchronous receiver/transmitter', 'universal synchronous/asynchronous receiver/transmitter', 'upgrade', 'upper memory clock', 'verifier', 'Versa module Eurocard', 'VESA local bus', 'video look up table', 'video random access memory', 'virtual memory', 'watch dog timer', 'wide area network', 'zigzag inline package', 'cap lock', 'center-click', 'click->', 'center-~', 'double-~', 'left-~', 'right-~', 'single-~', 'control (key)', 'create (key)', 'cursor', 'drag', 'justify->', 'left-~', 'right-~', 'key', 'keyboard', 'mouse', 'numeric keypad', 'numerical control', 'abend', 'abort', 'access', 'acknowledge', 'address', 'align', 'assembly', 'authenticate', 'back-up', 'batch', 'batched', 'billions of floating point operations per second', 'bits per inch', 'bits per second', 'bomb', 'boot', 'break-down', 'bump', 'calculate', 'call (a program)', 'carriage return', 'carrier detect', 'catalog', 'cataloged', 'chain/ed/ing', 'chip select', 'clear to send', 'clocks per instruction', 'cold start', 'collate', 'column-address strobe', 'command', 'compilation', 'compile', 'concatenate', 'configuration', 'control strobe', 'conversion', 'convert', 'crash', 'data avaliable', 'data carrier detect (protocol signal)', 'data parity error', 'data set ready', 'data strobe', 'data terminal ready (protcol signal)', 'data valid (logic signal)', 'debug', 'decode', 'defrag', ' defragmentation', 'deress', 'decrement', 'default', 'delete', 'diagnostic', 'disable', 'display', 'distribute', 'distributed', 'double-click', 'download', 'drag', 'dump', 'empty (trash', ' v)', 'enable', 'enabled', 'encode', 'encrypt', 'encryption', 'enter', 'entry', 'erasable', 'erase', 'error checking and correction', 'exec', 'execute', 'exit', 'first in last out', 'format', 'form feed', 'fractionate', 'frequency division multiplexing', 'full-duplex transmission', 'hash', 'implement', 'import', 'increment', 'initialize', 'input', 'input/output', 'inquiry', 'insert', 'install', 'iterate', ' iteration', ' iterative', 'interrupt request', 'justify->', 'left-~', 'right-~', 'keyboarding', 'keypunch', 'kilobits per second', 'least significant bit', 'least significant digit', 'left-justify', 'linear predictive coding', 'link', ' linkage', 'log off', 'log on', 'maintenance', 'mark', 'merge', 'million bytes per second', 'millions of floating point operations per second', 'millions of instructions per second', 'millions of operations per second', 'most significant bit', 'most significant digit', 'multiple-instruction multiple-data', 'multiple-instruction single-data', 'nest', 'nested', 'non-maskable interrupt', 'non return to zero', 'non return to zero invert', 'no operation', 'open systems interconnect', 'operate', 'operation', 'pack', ' packed', 'partition', 'paste', 'phase shift keying', 'ping', 'plug in a board', 'point-to-point protocol', 'postmortem', 'power on self test', 'print', 'print merge', 'program', 'query', 'quit', 'read modify write', 'real time interrupt', 'receive data', 'recover', ' recovery', 'Reed Solomon (error correction)', 'relocate', 'relocation', 'remote procedure call', 'request for comments', 'request to send', 'retrieval', ' retrieve', 'return', 'right-justify', 'run (operate)', 'save', 'save as', 'scan', 'scroll', 'select', 'shift', 'shut down', 'sign off', 'sign on', 'simulate', ' simulation', 'single-click', 'sort', 'terminate and stay resident', 'time division multiplexing', 'time sharing', 'transmission control protocol/internet protocol', 'unpack', 'unpacked', 'update', 'updated', 'upload', 'user datagram protocol', 'verification', 'verify', 'voice operated transmit', 'wait before ackowledge', 'wait state', 'asynchronous digital subscriber line', 'attached unit interface', 'brouter', 'data circuit-terminating equipment', 'data terminating equipment', 'digital subscriber line', 'dots per inch', 'high digital subscriber line', 'line driver', 'line feed', 'lines per minute', 'line printer', 'modem', 'music instrument digital interface', 'peripheral', 'peripheral interface adapter', 'plotter', 'printer', 'router', 'scanner', 'scuzzy', 'serial communication interface', 'serial to parallel interface', 'Shugart Associates standard interface', 'single digital subscriber line', 'small computer system interface', 'small computer system interface fast', 'small computer system interface wide', 'very high digital subscriber line', 'algorithm', 'animation', 'Apple', 'application', 'artificial intelligence', 'browser', 'bulletin board system', 'calculator', 'cam', 'cascade emitter-coupled logic', 'code', 'coding', 'color graphics adapter', 'computer assisted design', 'computer assisted design and analysis', 'computer assisted design and development', 'computer assisted engineering', 'computer assisted instruction', 'computer assisted manufacturing', 'computer assisted software engineering', 'data base', 'data encryption standard', 'data processing', 'data set', 'DESQview', 'device input format', 'direct memory access', 'electronic data processing', 'e-mail', 'enhanced graphics adapter', 'erasable programmable logic device', 'erasable programmable read-only memory', 'expanded memory manager', 'expanded memory specification', 'field-programmable gate array', 'field-programmable logic array', 'field-programmable logic sequencer', 'file allocation table', 'first-in', ' first-out memory', 'flowchart', 'instruction', 'Internet', 'Job Control Language', 'job entry subsystem', 'joint users group', 'journaled file system', 'large scale integration', 'link', ' linkage', 'list serv', ' list server', 'Mac', 'MacIntosh', 'magnetic ink character recognition', 'management information system', 'medium scale integration', 'Microcom network protocol', 'Microsoft', 'Microsoft disk operating system', 'Motorola emitter coupled logic', 'Open Software Foundation', 'Netscape', 'network', 'optical character recognition', 'Pascal', 'positional system', 'program', 'programmable array logic', 'programmer', 'programming', 'Programming Language I', 'real time operating system', 'release (of a product)', 'remote job entry', 'right-click', 'routine', 'serial line internet protocol', 'simulator', 'software', 'structured query language', 'third party applications', 'Unix to Unix copy program', 'utility/utilities', 'view', 'virtual', 'virtual reality', 'volume table of contents', 'walk through', 'word processing', 'zip (disk)']
def text(min_num, max_num):
num = randint(min_num, max_num)
return ' '.join(choice(words()) for i in range(num))
def html(min_num, max_num):
num = randint(min_num, max_num)
return '<p>' + '</p><p>'.join(' '.join(choice(words() + ['<br>'] * 7) for i in range(num)).split('<br>')) + '</p>'
category_titles = [
'Programming',
'Managment',
'Design',
'Hardware',
'Front End',
'Frameworks and CMS',
'API',
'Databases',
'Security',
'Other'
]
for category_title in category_titles:
Category.objects.create(title=category_title, description=text(15, 30))
for category in Category.objects.all():
for i in range(randint(30, 120)):
publication_date = datetime(choice(range(2012, 2015)), choice(range(1, 10)), choice(range(1, 25)), tzinfo=timezone.utc)
category.article_set.create(title=text(2, 4), content=html(300, 1200), publication_date=publication_date, verified=True)
from django.contrib.auth.models import User
editor = User.objects.create_user('Editor', 'editor@mail.ru', 'qq')
Category.objects.first().article_set.create(title='Article about cakes!', content='<h3>Yes, about cakes!</h3><img src="http://t2.gstatic.com/images?q=tbn:ANd9GcQTBgPWUV-AGFsxZ9AYXjhmbxAtULkk-JotH_8AkvJhr3UfjGP6">', author=editor, verified=True)
for i in range(1, 20):
User.objects.create_user('User ' + str(i), 'user@mail.ru', 'qq')
users = User.objects.all()
articles = Article.objects.all()
for article in articles:
n = choice(range(20))
for i in range(n):
article.like_set.create(user=users[i])
| [
"speranskydanil@gmail.com"
] | speranskydanil@gmail.com |
52293113769b3428576112541cfd97055209963b | d90229dfb7b41c58fdeae328e535ebdd6c69243f | /scMVP/dataset/scMVP_dataloader.py | d58c5cc97be621c81c99b4d3158da927a85b9a14 | [
"MIT"
] | permissive | lgyzngc/scMVP-1 | 5674f75b03384e2797693dc8638c4a15311f5cae | 091597da27eac78d5d84353649f23bb386c2eb76 | refs/heads/master | 2023-02-22T04:55:14.234408 | 2021-01-23T14:57:46 | 2021-01-23T14:57:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 21,731 | py | import logging
import os
import urllib
import numpy as np
import pandas as pd
import scipy.io as sp_io
from scipy.sparse import csr_matrix, issparse
from scMVP.dataset.dataset import CellMeasurement, GeneExpressionDataset
logger = logging.getLogger(__name__)
available_specification = ["filtered", "raw"]
class LoadData(GeneExpressionDataset):
"""
Dataset format:
dataset = {
"gene_barcodes": xxx,
"gene_expression": xxx,
"gene_names": xxx,
"atac_barcodes": xxx,
"atac_expression": xxx,
"atac_names": xxx,
}
OR
dataset = {
"gene_expression":xxx,
"atac_expression":xxx,
}
"""
def __init__(self,
dataset: dict = None,
data_path: str = "dataset/",
dense: bool = False,
measurement_names_column: int = 0,
remove_extracted_data: bool = False,
delayed_populating: bool = False,
file_separator: str = "\t",
gzipped: bool = False,
atac_threshold: float = 0.0001, # express in over 0.01%
cell_threshold: int = 1, # filtering cells less than minimum count
cell_meta: pd.DataFrame = None,
):
self.dataset = dataset
self.data_path = data_path
self.barcodes = None
self.dense = dense
self.measurement_names_column = measurement_names_column
self.remove_extracted_data = remove_extracted_data
self.file_separator = file_separator
self.gzip = gzipped
self.atac_thres = atac_threshold
self.cell_thres = cell_threshold
self._minimum_input = ("gene_expression", "atac_expression")
self._allow_input = (
"gene_expression", "atac_expression",
"gene_barcodes", "gene_names",
"atac_barcodes", "atac_names"
)
self.cell_meta = cell_meta
super().__init__()
if not delayed_populating:
self.populate()
def populate(self):
logger.info("Preprocessing joint profiling dataset.")
if not self._input_check():
logger.info("Please reload your dataset.")
return
joint_profiles = {}
if len(self.dataset.keys()) == 2:
# for _key in self.dataset.keys():
if self.gzip:
_tmp = pd.read_csv("{}/{}".format(self.data_path,self.dataset["gene_expression"]), sep=self.file_separator,
header=0, index_col=0)
else:
_tmp = pd.read_csv("{}/{}".format(self.data_path,self.dataset["gene_expression"]), sep=self.file_separator,
header=0, index_col=0, compression="gzip")
joint_profiles["gene_barcodes"] = pd.DataFrame(_tmp.columns.values)
joint_profiles["gene_names"] = pd.DataFrame(_tmp._stat_axis.values)
joint_profiles["gene_expression"] = np.array(_tmp).T
if self.gzip:
_tmp = pd.read_csv("{}/{}".format(self.data_path,self.dataset["atac_expression"]), sep=self.file_separator,
header=0, index_col=0)
else:
_tmp = pd.read_csv("{}/{}".format(self.data_path,self.dataset["atac_expression"]), sep=self.file_separator,
header=0, index_col=0, compression="gzip")
joint_profiles["atac_barcodes"] = pd.DataFrame(_tmp.columns.values)
joint_profiles["atac_names"] = pd.DataFrame(_tmp._stat_axis.values)
joint_profiles["atac_expression"] = np.array(_tmp).T
elif len(self.dataset.keys()) == 6:
for _key in self.dataset.keys():
if _key == "atac_expression" or _key == "gene_expression" and not self.dense:
joint_profiles[_key] = csr_matrix(sp_io.mmread("{}/{}".format(self.data_path,self.dataset[_key])).T)
elif self.gzip:
joint_profiles[_key] = pd.read_csv("{}/{}".format(self.data_path, self.dataset[_key]),
sep=self.file_separator,
compression="gzip", header=None)
else:
joint_profiles[_key] = pd.read_csv("{}/{}".format(self.data_path,self.dataset[_key]),
sep=self.file_separator, header=None)
else:
logger.info("more than 6 inputs.")
## 200920 gene barcode file may include more than 1 column
if joint_profiles["gene_names"].shape[1] > 1:
joint_profiles["gene_names"] = pd.DataFrame(joint_profiles["gene_names"].iloc[:,1])
if joint_profiles["atac_names"].shape[1] > 1:
joint_profiles["atac_names"] = pd.DataFrame(joint_profiles["atac_names"].iloc[:,1])
share_index, gene_barcode_index, atac_barcode_index = np.intersect1d(joint_profiles["gene_barcodes"].values,
joint_profiles["atac_barcodes"].values,
return_indices=True)
if isinstance(self.cell_meta,pd.DataFrame):
if self.cell_meta.shape[1] < 2:
logger.info("Please use cell id in first column and give ata least 2 columns.")
return
meta_cell_id = self.cell_meta.iloc[:,0].values
meta_share, meta_barcode_index, share_barcode_index =\
np.intersect1d(meta_cell_id,
share_index, return_indices=True)
_gene_barcode_index = gene_barcode_index[share_barcode_index]
_atac_barcode_index = atac_barcode_index[share_barcode_index]
if len(_gene_barcode_index) < 2: # no overlaps
logger.info("Inconsistent metadata to expression data.")
return
tmp = joint_profiles["gene_barcodes"]
joint_profiles["gene_barcodes"] = tmp.loc[_gene_barcode_index, :]
temp = joint_profiles["atac_barcodes"]
joint_profiles["atac_barcodes"] = temp.loc[_atac_barcode_index, :]
else:
# reorder rnaseq cell meta
tmp = joint_profiles["gene_barcodes"]
joint_profiles["gene_barcodes"] = tmp.loc[gene_barcode_index,:]
temp = joint_profiles["atac_barcodes"]
joint_profiles["atac_barcodes"] = temp.loc[atac_barcode_index, :]
gene_tab = joint_profiles["gene_expression"]
if issparse(gene_tab):
joint_profiles["gene_expression"] = gene_tab[gene_barcode_index, :].A
else:
joint_profiles["gene_expression"] = gene_tab[gene_barcode_index, :]
temp = joint_profiles["atac_expression"]
reorder_atac_exp = temp[atac_barcode_index, :]
binary_index = reorder_atac_exp > 1
reorder_atac_exp[binary_index] = 1
# remove peaks > 10% of total cells
high_count_atacs = ((reorder_atac_exp > 0).sum(axis=0).ravel() >= self.atac_thres * reorder_atac_exp.shape[0]) \
& ((reorder_atac_exp > 0).sum(axis=0).ravel() <= 0.1 * reorder_atac_exp.shape[0])
if issparse(reorder_atac_exp):
high_count_atacs_index = np.where(high_count_atacs)
_tmp = reorder_atac_exp[:, high_count_atacs_index[1]]
joint_profiles["atac_expression"] = _tmp.A
joint_profiles["atac_names"] = joint_profiles["atac_names"].loc[high_count_atacs_index[1], :]
else:
_tmp = reorder_atac_exp[:, high_count_atacs]
joint_profiles["atac_expression"] = _tmp
joint_profiles["atac_names"] = joint_profiles["atac_names"].loc[high_count_atacs, :]
# RNA-seq as the key
Ys = []
measurement = CellMeasurement(
name="atac_expression",
data=joint_profiles["atac_expression"],
columns_attr_name="atac_names",
columns=joint_profiles["atac_names"].astype(np.str),
)
Ys.append(measurement)
# Add cell metadata
if isinstance(self.cell_meta,pd.DataFrame):
for l_index, label in enumerate(list(self.cell_meta.columns.values)):
if l_index >0:
label_measurement = CellMeasurement(
name="{}_label".format(label),
data=self.cell_meta.iloc[meta_barcode_index,l_index],
columns_attr_name=label,
columns=self.cell_meta.iloc[meta_barcode_index, l_index]
)
Ys.append(label_measurement)
logger.info("Loading {} into dataset.".format(label))
cell_attributes_dict = {
"barcodes": np.squeeze(np.asarray(joint_profiles["gene_barcodes"], dtype=str))
}
logger.info("Finished preprocessing dataset")
self.populate_from_data(
X=joint_profiles["gene_expression"],
batch_indices=None,
gene_names=joint_profiles["gene_names"].astype(np.str),
cell_attributes_dict=cell_attributes_dict,
Ys=Ys,
)
self.filter_cells_by_count(self.cell_thres)
def _input_check(self):
if len(self.dataset.keys()) == 2:
for _key in self.dataset.keys():
if _key not in self._minimum_input:
logger.info("Unknown input data type:{}".format(_key))
return False
# if not self.dataset[_key].split(".")[-1] in ["txt","tsv","csv"]:
# logger.debug("scMVP only support two files input of txt, tsv or csv!")
# return False
elif len(self.dataset.keys()) >= 6:
for _key in self._allow_input:
if not _key in self.dataset.keys():
logger.info("Data type {} missing.".format(_key))
return False
else:
logger.info("Incorrect input file number.")
return False
for _key in self.dataset.keys():
if not os.path.exists(self.data_path):
logger.info("{} do not exist!".format(self.data_path))
if not os.path.exists("{}{}".format(self.data_path, self.dataset[_key])):
logger.info("Cannot find {}{}!".format(self.data_path, self.dataset[_key]))
return False
return True
def _download(self, url: str, save_path: str, filename: str):
"""Writes data from url to file."""
if os.path.exists(os.path.join(save_path, filename)):
logger.info("File %s already downloaded" % (os.path.join(save_path, filename)))
return
r = urllib.request.urlopen(url)
logger.info("Downloading file at %s" % os.path.join(save_path, filename))
def read_iter(file, block_size=1000):
"""Given a file 'file', returns an iterator that returns bytes of
size 'blocksize' from the file, using read()."""
while True:
block = file.read(block_size)
if not block:
break
yield block
def _add_cell_meta(self, cell_meta, filter=False):
cell_ids = cell_meta.iloc[:,1].values
share_index, meta_barcode_index, gene_barcode_index = \
np.intersect1d(cell_ids,self.barcodes,return_indices=True)
if len(share_index) <=1:
logger.info("No consistent cell IDs!")
return
if len(share_index) < len(self.barcodes):
logger.info("{} cells match metadata.".format(len(share_index)))
return
class SnareDemo(LoadData):
def __init__(self, dataset_name: str=None, data_path: str="/dataset", cell_meta: str = None):
url="https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE126074"
available_datasets = {
"CellLineMixture": {
"gene_expression": "GSE126074_CellLineMixture_SNAREseq_cDNA_counts.tsv.gz",
"atac_expression": "GSE126074_CellLineMixture_SNAREseq_chromatin_counts.tsv.gz",
},
"AdBrainCortex": {
"gene_barcodes": "GSE126074_AdBrainCortex_SNAREseq_cDNA.barcodes.tsv.gz",
"gene_expression": "GSE126074_AdBrainCortex_SNAREseq_cDNA.counts.mtx.gz",
"gene_names": "GSE126074_AdBrainCortex_SNAREseq_cDNA.genes.tsv.gz",
"atac_barcodes": "GSE126074_AdBrainCortex_SNAREseq_chromatin.barcodes.tsv.gz",
"atac_expression": "GSE126074_AdBrainCortex_SNAREseq_chromatin.counts.mtx.gz",
"atac_names": "GSE126074_AdBrainCortex_SNAREseq_chromatin.peaks.tsv.gz",
},
"P0_BrainCortex": {
"gene_barcodes": "GSE126074_P0_BrainCortex_SNAREseq_cDNA.barcodes.tsv.gz",
"gene_expression": "GSE126074_P0_BrainCortex_SNAREseq_cDNA.counts.mtx.gz",
"gene_names": "GSE126074_P0_BrainCortex_SNAREseq_cDNA.genes.tsv.gz",
"atac_barcodes": "GSE126074_P0_BrainCortex_SNAREseq_chromatin.barcodes.tsv.gz",
"atac_expression": "GSE126074_P0_BrainCortex_SNAREseq_chromatin.counts.mtx.gz",
"atac_names": "GSE126074_P0_BrainCortex_SNAREseq_chromatin.peaks.tsv.gz",
}
}
if cell_meta:
cell_meta_data = pd.read_csv(cell_meta, sep=",", header=0)
else:
cell_meta_data = None
if dataset_name=="CellLineMixture":
super(SnareDemo, self).__init__(dataset = available_datasets[dataset_name],
data_path= data_path,
dense = False,
measurement_names_column = 1,
cell_meta=cell_meta_data,
remove_extracted_data = False,
delayed_populating = False,
file_separator = "\t",
gzipped = True,
atac_threshold = 0.0005,
cell_threshold = 1
)
elif dataset_name=="AdBrainCortex" or dataset_name=="P0_BrainCortex":
super(SnareDemo, self).__init__(dataset=available_datasets[dataset_name],
data_path=data_path,
dense=False,
measurement_names_column=1,
cell_meta=cell_meta_data,
remove_extracted_data=False,
delayed_populating=False,
gzipped=True,
atac_threshold=0.0005,
cell_threshold=1
)
else:
logger.info('Please select from "CellLineMixture", "AdBrainCortex" or "P0_BrainCortex" dataset.')
class PairedDemo(LoadData):
def __init__(self, dataset_name: str = None, data_path: str = "/dataset"):
urls = [
"https://ftp.ncbi.nlm.nih.gov/geo/series/GSE130nnn/GSE130399/suppl/GSE130399_GSM3737488_GSM3737489_Cell_Mix.tar.gz",
"https://ftp.ncbi.nlm.nih.gov/geo/series/GSE130nnn/GSE130399/suppl/GSE130399_GSM3737490-GSM3737495_Adult_Cerebrail_Cortex.tar.gz",
"https://ftp.ncbi.nlm.nih.gov/geo/series/GSE130nnn/GSE130399/suppl/GSE130399_GSM3737496-GSM3737499_Fetal_Forebrain.tar.gz"
]
available_datasets = {
"CellLineMixture": {
"gene_names": "Cell_Mix_RNA/genes.tsv",
"gene_expression": "Cell_Mix_RNA/matrix.mtx",
"gene_barcodes": "Cell_Mix_RNA/barcodes.tsv",
"atac_names": "Cell_Mix_DNA/genes.tsv",
"atac_expression": "Cell_Mix_DNA/matrix.mtx",
"atac_barcodes":"Cell_Mix_DNA/barcodes.tsv"
},
"Adult_Cerebral": {
"gene_names": "Adult_CTX_RNA/genes.tsv",
"gene_expression": "Adult_CTX_RNA/matrix.mtx",
"gene_barcodes": "Adult_CTX_RNA/barcodes.tsv",
"atac_names": "Adult_CTX_DNA/genes.tsv",
"atac_expression": "Adult_CTX_DNA/matrix.mtx",
"atac_barcodes": "Adult_CTX_DNA/barcodes.tsv"
},
"Fetal_Forebrain": {
"gene_names": "FB_RNA/genes.tsv",
"gene_expression": "FB_RNA/matrix.mtx",
"gene_barcodes": "FB_RNA/barcodes.tsv",
"atac_names": "FB_DNA/genes.tsv",
"atac_expression": "FB_DNA/matrix.mtx",
"atac_barcodes": "FB_DNA/barcodes.tsv"
}
}
if dataset_name=="CellLineMixture" or dataset_name=="Fetal_Forebrain":
if os.path.exists("{}/Cell_embeddings.xls".format(data_path)):
cell_embed = pd.read_csv("{}/Cell_embeddings.xls".format(data_path), sep='\t')
cell_embed_info = cell_embed.iloc[:, 0:2]
cell_embed_info.columns = ["Cell_ID","Cluster"]
else:
logger.info("Cannot find cell embedding files for Paried-seq Demo.")
return
super().__init__(dataset = available_datasets[dataset_name],
data_path= data_path,
dense = False,
measurement_names_column = 1,
remove_extracted_data = False,
delayed_populating = False,
gzipped = False,
atac_threshold = 0.005,
cell_threshold = 100,
cell_meta=cell_embed_info
)
elif dataset_name=="Adult_Cerebral":
if os.path.exists("{}/Cell_embeddings.xls".format(data_path)):
cell_embed = pd.read_csv("{}/Cell_embeddings.xls".format(data_path), sep='\t')
cell_embed_info = cell_embed.iloc[:, ["ID","Cluster"]]
cell_embed_info.columns = ["Cell_ID","Cluster"]
else:
logger.info("Cannot find cell embedding files for Paried-seq Demo.")
return
super().__init__(dataset=available_datasets[dataset_name],
data_path=data_path,
dense=False,
measurement_names_column = 1,
remove_extracted_data=False,
delayed_populating=False,
gzipped=False,
atac_threshold=0.005,
cell_threshold=1,
cell_meta=cell_embed_info
)
else:
logger.info('Please select from {} dataset.'.format("\t".join(available_datasets.keys())))
class SciCarDemo(LoadData):
def __init__(self, dataset_name: str = None, data_path: str = "/dataset", cell_meta: str = None):
urls = "https://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE117089&format=file"
# NOTICE, tsv files are generated from original txt files
available_datasets = {
"CellLineMixture": {
"gene_barcodes": "GSM3271040_RNA_sciCAR_A549_cell.tsv",
"gene_names": "GSM3271040_RNA_sciCAR_A549_gene.tsv",
"gene_expression": "GSM3271040_RNA_sciCAR_A549_gene_count.txt",
"atac_barcodes": "GSM3271041_ATAC_sciCAR_A549_cell.tsv",
"atac_names": "GSM3271041_ATAC_sciCAR_A549_peak.tsv",
"atac_expression": "GSM3271041_ATAC_sciCAR_A549_peak_count.txt"
},
"mouse_kidney": {
"gene_barcodes": "GSM3271044_RNA_mouse_kidney_cell.tsv",
"gene_names": "GSM3271044_RNA_mouse_kidney_gene.tsv",
"gene_expression": "GSM3271044_RNA_mouse_kidney_gene_count.txt",
"atac_barcodes": "GSM3271045_ATAC_mouse_kidney_cell.tsv",
"atac_names": "GSM3271045_ATAC_mouse_kidney_peak.tsv",
"atac_expression": "GSM3271045_ATAC_mouse_kidney_peak_count.txt"
}
}
if dataset_name:
for barcode_file in ["gene_barcodes", "atac_barcodes", "gene_names", "atac_names"]:
# generate gene and atac barcodes from cell metadata.
with open("{}/{}".format(data_path, available_datasets[dataset_name][barcode_file]),"w") as fo:
infile = "{}/{}.txt".format(data_path, available_datasets[dataset_name][barcode_file][:-4])
indata = [i.rstrip().split(",") for i in open(infile)][1:]
for line in indata:
fo.write("{}\n".format(line[0]))
if cell_meta:
cell_meta_data = pd.read_csv(cell_meta, sep=",", header=0)
else:
cell_meta_data = None
super().__init__(dataset=available_datasets[dataset_name],
data_path=data_path,
dense=False,
measurement_names_column=0,
cell_meta=cell_meta_data,
remove_extracted_data=False,
delayed_populating=False,
gzipped=False,
atac_threshold=0.0005,
cell_threshold=1
)
else:
logger.info('Please select from {} dataset.'.format("\t".join(available_datasets.keys())))
| [
"adam.tongji@gmail.com"
] | adam.tongji@gmail.com |
036e3d295763df1c929f8e67dc984431b06d439d | 4ba222b431e3b3fb30ffa829b70ae9d6039ffa9b | /Source_code/Non_successful_models/lstm.py | 930da82469a3eba9218d2361361fdd49112739bc | [] | no_license | violetta-ta/CourseProject | 6a4c27e991d4cad4b6e977f16651a4e36cbb261d | e740aee644326c49045184cea331165a5912579d | refs/heads/main | 2023-02-01T14:06:44.019984 | 2020-12-14T04:47:14 | 2020-12-14T04:47:14 | 307,004,342 | 0 | 1 | null | 2020-10-25T01:44:13 | 2020-10-25T01:44:12 | null | UTF-8 | Python | false | false | 6,103 | py | import json
import tensorflow as tf
import numpy as np
import sklearn.model_selection as sk
from tensorflow.keras.layers.experimental.preprocessing import TextVectorization
import re
import string
from tensorflow.keras import layers
from tensorflow.keras import losses
import nltk
from nltk.stem import PorterStemmer
from nltk.corpus import stopwords
# Download nltk data for tokenization
nltk.download('punkt')
# Download nltk data for stopwords
nltk.download('stopwords')
# Create stemmer object
stemming = PorterStemmer()
# As input data is in english, use english stopwords for removing high frequency words
stops = set(stopwords.words("english"))
# Method called during text vectorization to perform data cleanup
def custom_standardization(input_data):
lowercase = tf.strings.lower(input_data)
stripped_html = tf.strings.regex_replace(lowercase, '<br />', ' ')
return tf.strings.regex_replace(stripped_html, '[%s]' % re.escape(string.punctuation), '')
# Read training or test files
def read_input_file(file_path, training=True):
# Open and read file contents
fin = open(file_path)
data = fin.read()
fin.close()
# Every line in file is a json object.
# Irrespective of file to be read read every json object and extract response, context
tweets = [json.loads(jline) for jline in data.splitlines()]
# I could not figure out how to feed context and response separately in this model, thus concatenating the two
tweet_responses = [clean_input(" ".join([item.get("response"), " ".join(item.get("context"))])) for item in tweets]
# If training file is being read, need to read the labels for each tweet
if training:
# Convert label into numeric values, SARCASM as 0 and NOT_SARCASM as 1
tweet_labels = [0 if item.get("label") == "SARCASM" else 1 for item in tweets]
return tweet_responses, tweet_labels
# if the file type is not training, we will encounter this code path and will parse tweet ids
ids = [item.get("id") for item in tweets]
return ids, tweet_responses
# Method to clean data while parsing from file
def clean_input(seq):
# remove common regex like emojis, symbols, etc
# reference https://stackoverflow.com/questions/33404752/removing-emojis-from-a-string-in-python
regrex_pattern = re.compile(pattern="["
u"\U0001F600-\U0001F64F" # emoticons
u"\U0001F300-\U0001F5FF" # symbols & pictographs
u"\U0001F680-\U0001F6FF" # transport & map symbols
u"\U0001F1E0-\U0001F1FF" # flags (iOS)
"]+", flags=re.UNICODE)
seq = regrex_pattern.sub(r'', seq)
# remove all html tags
words = nltk.word_tokenize(re.sub("<.*?>", " ", seq.lower()))
# remove punctuations
token_words = [w for w in words if w.isalpha()]
# stemming
stemmed_words = [stemming.stem(word) for word in token_words]
# remove stop words
clean_words = [w for w in stemmed_words if not w in stops]
return " ".join(clean_words)
if __name__ == '__main__':
training_file = 'data/train.jsonl'
test_file = 'data/test.jsonl'
# Read training file
training_responses, training_labels = read_input_file(training_file)
# Red test file
tweet_ids, test_tweets = read_input_file(test_file, training=False)
# Split the dataset into training and evaluation datasets
train_responses, eval_responses, train_labels, eval_labels = \
sk.train_test_split(np.array(training_responses), np.array(training_labels), train_size=0.8)
# Start pre-processing
tensor_train_labels = tf.constant(train_labels)
tensor_eval_labels = tf.constant(eval_labels)
max_features = 125000
sequence_length = 500
# Create TextVectorization object to vectorize the text dataset
text_vector = TextVectorization(
standardize=custom_standardization,
max_tokens=max_features,
output_mode='int',
output_sequence_length=sequence_length)
# Adapt the training dataset for model to learn vocabulary
text_vector.adapt(train_responses)
# Vectorize training dataset
train_dataset = text_vector(train_responses)
# Vectorize evaluation dataset
eval_dataset = text_vector(eval_responses)
# Vectorize test dataset
test_data_set = text_vector(test_tweets)
# Build LSTM model
model = tf.keras.Sequential([
# Define input layer taking vocabulary from adapt step above
layers.Embedding(input_dim=len(text_vector.get_vocabulary()),
output_dim=64,
mask_zero=True),
# Define bidirectional LSTM model
tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(64)),
# Add hidden layer with activation tanh
tf.keras.layers.Dense(32, activation='tanh'),
# Add dropout
layers.Dropout(0.2),
# Add output layer which holds the prediction probability
layers.Dense(1)])
# Print the model summary before training
model.summary()
# Compile model with adam optimizer
model.compile(loss=losses.BinaryCrossentropy(from_logits=True),
optimizer='adam',
metrics=tf.metrics.BinaryAccuracy(threshold=0.0))
# In local testing, local_accuracy stops increasing after 4 epochs
epochs = 4
# Train and evaluate the model by asking model to fit to the training datasets
history = model.fit(train_dataset, tensor_train_labels, epochs=epochs,
validation_data=(eval_dataset, tensor_eval_labels),
verbose=2)
# Predict test dataset
results = tf.sigmoid(model.predict(test_data_set))
# Create answer.txt for submission from predictions
fin = open("answer.txt", "w")
idx = 0
for x in np.nditer(results):
fin.write("{},{}{}".format(tweet_ids[idx], "SARCASM" if x < 0.5 else "NOT_SARCASM", "\n" if idx < len(tweet_ids) - 1 else ""))
idx += 1
fin.close()
| [
"manghs@amazon.com"
] | manghs@amazon.com |
c24c342519ec88d4ce0641ea44d71fb9aacfd354 | ffcda8acb3b3e3fa68b28c761b1a36d3ee6576d3 | /node_modules/mongoose/node_modules/mongodb/node_modules/bson/build/config.gypi | 8ce5bce2f2fe7a595ef8e29a18e4b580b9559522 | [
"Apache-2.0",
"MIT"
] | permissive | anupkelkar02/Maths | 9d40efcb42c9d4e9e36905d73234ccfcfd8515f8 | ac68527207b467e1e8740fabda5597ad3baf02d1 | refs/heads/master | 2016-09-05T15:19:21.960940 | 2015-02-28T10:21:54 | 2015-02-28T10:21:54 | 31,459,128 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,245 | gypi | # Do not edit. File was generated by node-gyp's "configure" step
{
"target_defaults": {
"cflags": [],
"default_configuration": "Release",
"defines": [],
"include_dirs": [],
"libraries": []
},
"variables": {
"clang": 0,
"gcc_version": 48,
"host_arch": "x64",
"node_install_npm": "true",
"node_prefix": "",
"node_shared_cares": "false",
"node_shared_http_parser": "false",
"node_shared_libuv": "false",
"node_shared_openssl": "false",
"node_shared_v8": "false",
"node_shared_zlib": "false",
"node_tag": "",
"node_unsafe_optimizations": 0,
"node_use_dtrace": "false",
"node_use_etw": "false",
"node_use_openssl": "true",
"node_use_perfctr": "false",
"node_use_systemtap": "false",
"openssl_no_asm": 0,
"python": "/usr/bin/python",
"target_arch": "x64",
"v8_enable_gdbjit": 0,
"v8_no_strict_aliasing": 1,
"v8_use_snapshot": "true",
"want_separate_host_toolset": 0,
"nodedir": "/home/akelkar/.node-gyp/0.10.36",
"copy_dev_lib": "true",
"standalone_static_library": 1,
"cache_lock_stale": "60000",
"sign_git_tag": "",
"user_agent": "npm/2.4.1 node/v0.10.36 linux x64",
"always_auth": "",
"bin_links": "true",
"key": "",
"description": "true",
"fetch_retries": "2",
"heading": "npm",
"init_version": "1.0.0",
"user": "",
"force": "",
"cache_min": "10",
"init_license": "ISC",
"editor": "vi",
"rollback": "true",
"cache_max": "Infinity",
"userconfig": "/home/akelkar/.npmrc",
"engine_strict": "",
"init_author_name": "",
"init_author_url": "",
"tmp": "/tmp",
"depth": "Infinity",
"save_dev": "",
"usage": "",
"https_proxy": "http://172.31.4.6:8080/",
"cafile": "",
"onload_script": "",
"rebuild_bundle": "true",
"save_bundle": "",
"shell": "/bin/bash",
"prefix": "/usr/local",
"browser": "",
"cache_lock_wait": "10000",
"registry": "https://registry.npmjs.org/",
"save_optional": "",
"scope": "",
"searchopts": "",
"versions": "",
"cache": "/home/akelkar/.npm",
"ignore_scripts": "",
"searchsort": "name",
"version": "",
"local_address": "",
"viewer": "man",
"color": "true",
"fetch_retry_mintimeout": "10000",
"umask": "0002",
"fetch_retry_maxtimeout": "60000",
"message": "%s",
"ca": "",
"cert": "",
"global": "",
"link": "",
"save": "true",
"access": "restricted",
"unicode": "true",
"long": "",
"production": "",
"unsafe_perm": "true",
"node_version": "0.10.36",
"tag": "latest",
"git_tag_version": "true",
"shrinkwrap": "true",
"fetch_retry_factor": "10",
"npat": "",
"proprietary_attribs": "true",
"save_exact": "",
"strict_ssl": "true",
"dev": "",
"globalconfig": "/usr/local/etc/npmrc",
"init_module": "/home/akelkar/.npm-init.js",
"parseable": "",
"globalignorefile": "/usr/local/etc/npmignore",
"cache_lock_retries": "10",
"save_prefix": "^",
"group": "1000",
"init_author_email": "",
"searchexclude": "",
"git": "git",
"optional": "true",
"json": "",
"spin": "true"
}
}
| [
"anupkelkar02@gmail.com"
] | anupkelkar02@gmail.com |
d6d43f7b6a42de881d32d0fdd6f7c873b79ac260 | 5ba006696ba7f79e99c1b08b2c540b4465f22f53 | /aiortc/rtcpeerconnection.py | 345ee3246f1a1b0dfa02b5c64d5897e6b46c494e | [
"BSD-3-Clause"
] | permissive | shaunastarabadi/aiortc | 8305720b3972a142184efb69a7add827161598bb | b19674e4776bced784aab497db2a81af269e9024 | refs/heads/master | 2020-06-11T15:21:42.638437 | 2019-06-27T04:18:27 | 2019-06-27T04:18:27 | 194,009,757 | 0 | 0 | BSD-3-Clause | 2019-06-27T02:35:55 | 2019-06-27T02:35:55 | null | UTF-8 | Python | false | false | 39,141 | py | import asyncio
import copy
import uuid
from collections import OrderedDict
from pyee import EventEmitter
from . import clock, rtp, sdp
from .codecs import CODECS, HEADER_EXTENSIONS, is_rtx
from .events import RTCTrackEvent
from .exceptions import InternalError, InvalidAccessError, InvalidStateError
from .rtcconfiguration import RTCConfiguration
from .rtcdatachannel import RTCDataChannel, RTCDataChannelParameters
from .rtcdtlstransport import RTCCertificate, RTCDtlsTransport
from .rtcicetransport import RTCIceGatherer, RTCIceTransport
from .rtcrtpparameters import (
RTCRtpDecodingParameters,
RTCRtpParameters,
RTCRtpReceiveParameters,
RTCRtpRtxParameters,
)
from .rtcrtpreceiver import RemoteStreamTrack, RTCRtpReceiver
from .rtcrtpsender import RTCRtpSender
from .rtcrtptransceiver import RTCRtpTransceiver
from .rtcsctptransport import RTCSctpTransport
from .rtcsessiondescription import RTCSessionDescription
from .stats import RTCStatsReport
DISCARD_HOST = "0.0.0.0"
DISCARD_PORT = 9
MEDIA_KINDS = ["audio", "video"]
def filter_preferred_codecs(codecs, preferred):
if not preferred:
return codecs
rtx_codecs = list(filter(is_rtx, codecs))
rtx_enabled = next(filter(is_rtx, preferred), None) is not None
filtered = []
for pref in filter(lambda x: not is_rtx(x), preferred):
for codec in codecs:
if (
codec.mimeType.lower() == pref.mimeType.lower()
and codec.parameters == pref.parameters
):
filtered.append(codec)
# add corresponding RTX
if rtx_enabled:
for rtx in rtx_codecs:
if rtx.parameters["apt"] == codec.payloadType:
filtered.append(rtx)
break
break
return filtered
def find_common_codecs(local_codecs, remote_codecs):
common = []
common_base = {}
for c in remote_codecs:
# for RTX, check we accepted the base codec
if is_rtx(c):
if c.parameters.get("apt") in common_base:
base = common_base[c.parameters["apt"]]
if c.clockRate == base.clockRate:
common.append(copy.deepcopy(c))
continue
# handle other codecs
for codec in local_codecs:
if (
codec.mimeType.lower() == c.mimeType.lower()
and codec.clockRate == c.clockRate
):
if codec.mimeType.lower() == "video/h264":
# FIXME: check according to RFC 6184
parameters_compatible = True
for param in ["packetization-mode", "profile-level-id"]:
if c.parameters.get(param) != codec.parameters.get(param):
parameters_compatible = False
if not parameters_compatible:
continue
codec = copy.deepcopy(codec)
if c.payloadType in rtp.DYNAMIC_PAYLOAD_TYPES:
codec.payloadType = c.payloadType
codec.rtcpFeedback = list(
filter(lambda x: x in c.rtcpFeedback, codec.rtcpFeedback)
)
common.append(codec)
common_base[codec.payloadType] = codec
break
return common
def find_common_header_extensions(local_extensions, remote_extensions):
common = []
for rx in remote_extensions:
for lx in local_extensions:
if lx.uri == rx.uri:
common.append(rx)
return common
def add_transport_description(media, dtlsTransport):
# ice
iceTransport = dtlsTransport.transport
iceGatherer = iceTransport.iceGatherer
media.ice_candidates = iceGatherer.getLocalCandidates()
media.ice_candidates_complete = iceGatherer.state == "completed"
media.ice = iceGatherer.getLocalParameters()
if media.ice_candidates:
media.host = media.ice_candidates[0].ip
media.port = media.ice_candidates[0].port
else:
media.host = DISCARD_HOST
media.port = DISCARD_PORT
# dtls
media.dtls = dtlsTransport.getLocalParameters()
if iceTransport.role == "controlling":
media.dtls.role = "auto"
else:
media.dtls.role = "client"
def add_remote_candidates(iceTransport, media):
for candidate in media.ice_candidates:
iceTransport.addRemoteCandidate(candidate)
if media.ice_candidates_complete:
iceTransport.addRemoteCandidate(None)
def allocate_mid(mids):
"""
Allocate a MID which has not been used yet.
"""
i = 0
while True:
mid = str(i)
if mid not in mids:
mids.add(mid)
return mid
i += 1
def create_media_description_for_sctp(sctp, legacy, mid):
if legacy:
media = sdp.MediaDescription(
kind="application", port=DISCARD_PORT, profile="DTLS/SCTP", fmt=[sctp.port]
)
media.sctpmap[sctp.port] = (
"webrtc-datachannel %d" % sctp._outbound_streams_count
)
else:
media = sdp.MediaDescription(
kind="application",
port=DISCARD_PORT,
profile="UDP/DTLS/SCTP",
fmt=["webrtc-datachannel"],
)
media.sctp_port = sctp.port
media.rtp.muxId = mid
media.sctpCapabilities = sctp.getCapabilities()
add_transport_description(media, sctp.transport)
return media
def create_media_description_for_transceiver(transceiver, cname, direction, mid):
media = sdp.MediaDescription(
kind=transceiver.kind,
port=DISCARD_PORT,
profile="UDP/TLS/RTP/SAVPF",
fmt=[c.payloadType for c in transceiver._codecs],
)
media.direction = direction
media.msid = "%s %s" % (transceiver.sender._stream_id, transceiver.sender._track_id)
media.rtp = RTCRtpParameters(
codecs=transceiver._codecs,
headerExtensions=transceiver._headerExtensions,
muxId=mid,
)
media.rtcp_host = DISCARD_HOST
media.rtcp_port = DISCARD_PORT
media.rtcp_mux = True
media.ssrc = [sdp.SsrcDescription(ssrc=transceiver.sender._ssrc, cname=cname)]
# if RTX is enabled, add corresponding SSRC
if next(filter(is_rtx, media.rtp.codecs), None):
media.ssrc.append(
sdp.SsrcDescription(ssrc=transceiver.sender._rtx_ssrc, cname=cname)
)
media.ssrc_group = [
sdp.GroupDescription(
semantic="FID",
items=[transceiver.sender._ssrc, transceiver.sender._rtx_ssrc],
)
]
add_transport_description(media, transceiver._transport)
return media
def and_direction(a, b):
return sdp.DIRECTIONS[sdp.DIRECTIONS.index(a) & sdp.DIRECTIONS.index(b)]
def or_direction(a, b):
return sdp.DIRECTIONS[sdp.DIRECTIONS.index(a) | sdp.DIRECTIONS.index(b)]
def reverse_direction(direction):
if direction == "sendonly":
return "recvonly"
elif direction == "recvonly":
return "sendonly"
return direction
def wrap_session_description(session_description: sdp.SessionDescription):
if session_description is not None:
return RTCSessionDescription(
sdp=str(session_description), type=session_description.type
)
class RTCPeerConnection(EventEmitter):
"""
The :class:`RTCPeerConnection` interface represents a WebRTC connection
between the local computer and a remote peer.
:param: configuration: An optional :class:`RTCConfiguration`.
"""
def __init__(self, configuration=None):
super().__init__()
self.__certificates = [RTCCertificate.generateCertificate()]
self.__cname = "{%s}" % uuid.uuid4()
self.__configuration = configuration or RTCConfiguration()
self.__iceTransports = set()
self.__initialOfferer = None
self.__remoteDtls = {}
self.__remoteIce = {}
self.__seenMids = set()
self.__sctp = None
self.__sctp_mline_index = None
self._sctpLegacySdp = True
self.__sctpRemotePort = None
self.__sctpRemoteCaps = None
self.__stream_id = str(uuid.uuid4())
self.__transceivers = []
self.__iceConnectionState = "new"
self.__iceGatheringState = "new"
self.__isClosed = False
self.__signalingState = "stable"
self.__currentLocalDescription = None # type: sdp.SessionDescription
self.__currentRemoteDescription = None # type: sdp.SessionDescription
self.__pendingLocalDescription = None # type: sdp.SessionDescription
self.__pendingRemoteDescription = None # type: sdp.SessionDescription
@property
def iceConnectionState(self):
return self.__iceConnectionState
@property
def iceGatheringState(self):
return self.__iceGatheringState
@property
def localDescription(self):
"""
An :class:`RTCSessionDescription` describing the session for
the local end of the connection.
"""
return wrap_session_description(self.__localDescription())
@property
def remoteDescription(self):
"""
An :class:`RTCSessionDescription` describing the session for
the remote end of the connection.
"""
return wrap_session_description(self.__remoteDescription())
@property
def sctp(self):
"""
An :class:`RTCSctpTransport` describing the SCTP transport being used
for datachannels or `None`.
"""
return self.__sctp
@property
def signalingState(self):
return self.__signalingState
def addIceCandidate(self, candidate):
"""
Add a new :class:`RTCIceCandidate` received from the remote peer.
The specified candidate must have a value for either `sdpMid` or `sdpMLineIndex`.
"""
if candidate.sdpMid is None and candidate.sdpMLineIndex is None:
raise ValueError("Candidate must have either sdpMid or sdpMLineIndex")
for transceiver in self.__transceivers:
if candidate.sdpMid == transceiver.mid and not transceiver._bundled:
iceTransport = transceiver._transport.transport
iceTransport.addRemoteCandidate(candidate)
return
if (
self.__sctp
and candidate.sdpMid == self.__sctp.mid
and not self.__sctp._bundled
):
iceTransport = self.__sctp.transport.transport
iceTransport.addRemoteCandidate(candidate)
def addTrack(self, track):
"""
Add a :class:`MediaStreamTrack` to the set of media tracks which
will be transmitted to the remote peer.
"""
# check state is valid
self.__assertNotClosed()
if track.kind not in ["audio", "video"]:
raise InternalError('Invalid track kind "%s"' % track.kind)
# don't add track twice
self.__assertTrackHasNoSender(track)
for transceiver in self.__transceivers:
if transceiver.kind == track.kind:
if transceiver.sender.track is None:
transceiver.sender.replaceTrack(track)
transceiver.direction = or_direction(
transceiver.direction, "sendonly"
)
return transceiver.sender
transceiver = self.__createTransceiver(
direction="sendrecv", kind=track.kind, sender_track=track
)
return transceiver.sender
def addTransceiver(self, trackOrKind, direction="sendrecv"):
"""
Add a new :class:`RTCRtpTransceiver`.
"""
self.__assertNotClosed()
# determine track or kind
if hasattr(trackOrKind, "kind"):
kind = trackOrKind.kind
track = trackOrKind
else:
kind = trackOrKind
track = None
if kind not in ["audio", "video"]:
raise InternalError('Invalid track kind "%s"' % kind)
# check direction
if direction not in sdp.DIRECTIONS:
raise InternalError('Invalid direction "%s"' % direction)
# don't add track twice
if track:
self.__assertTrackHasNoSender(track)
return self.__createTransceiver(
direction=direction, kind=kind, sender_track=track
)
async def close(self):
"""
Terminate the ICE agent, ending ICE processing and streams.
"""
if self.__isClosed:
return
self.__isClosed = True
self.__setSignalingState("closed")
# stop senders / receivers
for transceiver in self.__transceivers:
await transceiver.stop()
if self.__sctp:
await self.__sctp.stop()
# stop transports
for transceiver in self.__transceivers:
await transceiver._transport.stop()
await transceiver._transport.transport.stop()
if self.__sctp:
await self.__sctp.transport.stop()
await self.__sctp.transport.transport.stop()
self.__updateIceConnectionState()
# no more events will be emitted, so remove all event listeners
# to facilitate garbage collection.
self.remove_all_listeners()
async def createAnswer(self):
"""
Create an SDP answer to an offer received from a remote peer during
the offer/answer negotiation of a WebRTC connection.
:rtype: :class:`RTCSessionDescription`
"""
# check state is valid
self.__assertNotClosed()
if self.signalingState not in ["have-remote-offer", "have-local-pranswer"]:
raise InvalidStateError(
'Cannot create answer in signaling state "%s"' % self.signalingState
)
# create description
ntp_seconds = clock.current_ntp_time() >> 32
description = sdp.SessionDescription()
description.origin = "- %d %d IN IP4 0.0.0.0" % (ntp_seconds, ntp_seconds)
description.msid_semantic.append(
sdp.GroupDescription(semantic="WMS", items=["*"])
)
description.type = "answer"
for remote_m in self.__remoteDescription().media:
if remote_m.kind in ["audio", "video"]:
transceiver = self.__getTransceiverByMid(remote_m.rtp.muxId)
description.media.append(
create_media_description_for_transceiver(
transceiver,
cname=self.__cname,
direction=and_direction(
transceiver.direction, transceiver._offerDirection
),
mid=transceiver.mid,
)
)
else:
description.media.append(
create_media_description_for_sctp(
self.__sctp, legacy=self._sctpLegacySdp, mid=self.__sctp.mid
)
)
bundle = sdp.GroupDescription(semantic="BUNDLE", items=[])
for media in description.media:
bundle.items.append(media.rtp.muxId)
description.group.append(bundle)
return wrap_session_description(description)
def createDataChannel(
self,
label,
maxPacketLifeTime=None,
maxRetransmits=None,
ordered=True,
protocol="",
negotiated=False,
id=None,
):
"""
Create a data channel with the given label.
:rtype: :class:`RTCDataChannel`
"""
if maxPacketLifeTime is not None and maxRetransmits is not None:
raise ValueError("Cannot specify both maxPacketLifeTime and maxRetransmits")
if not self.__sctp:
self.__createSctpTransport()
parameters = RTCDataChannelParameters(
id=id,
label=label,
maxPacketLifeTime=maxPacketLifeTime,
maxRetransmits=maxRetransmits,
negotiated=negotiated,
ordered=ordered,
protocol=protocol,
)
return RTCDataChannel(self.__sctp, parameters)
async def createOffer(self):
"""
Create an SDP offer for the purpose of starting a new WebRTC
connection to a remote peer.
:rtype: :class:`RTCSessionDescription`
"""
# check state is valid
self.__assertNotClosed()
if not self.__sctp and not self.__transceivers:
raise InternalError(
"Cannot create an offer with no media and no data channels"
)
# offer codecs
for transceiver in self.__transceivers:
transceiver._codecs = filter_preferred_codecs(
CODECS[transceiver.kind][:], transceiver._preferred_codecs
)
transceiver._headerExtensions = HEADER_EXTENSIONS[transceiver.kind][:]
mids = self.__seenMids.copy()
# create description
ntp_seconds = clock.current_ntp_time() >> 32
description = sdp.SessionDescription()
description.origin = "- %d %d IN IP4 0.0.0.0" % (ntp_seconds, ntp_seconds)
description.msid_semantic.append(
sdp.GroupDescription(semantic="WMS", items=["*"])
)
description.type = "offer"
def get_media(description):
return description.media if description else []
def get_media_section(media, i):
return media[i] if i < len(media) else None
# handle existing transceivers / sctp
local_media = get_media(self.__localDescription())
remote_media = get_media(self.__remoteDescription())
for i in range(max(len(local_media), len(remote_media))):
local_m = get_media_section(local_media, i)
remote_m = get_media_section(remote_media, i)
media_kind = local_m.kind if local_m else remote_m.kind
mid = local_m.rtp.muxId if local_m else remote_m.rtp.muxId
if media_kind in ["audio", "video"]:
transceiver = self.__getTransceiverByMid(mid)
transceiver._set_mline_index(i)
description.media.append(
create_media_description_for_transceiver(
transceiver,
cname=self.__cname,
direction=transceiver.direction,
mid=mid,
)
)
elif media_kind == "application":
self.__sctp_mline_index = i
description.media.append(
create_media_description_for_sctp(
self.__sctp, legacy=self._sctpLegacySdp, mid=mid
)
)
# handle new transceivers / sctp
def next_mline_index():
return len(description.media)
for transceiver in filter(
lambda x: x.mid is None and not x.stopped, self.__transceivers
):
transceiver._set_mline_index(next_mline_index())
description.media.append(
create_media_description_for_transceiver(
transceiver,
cname=self.__cname,
direction=transceiver.direction,
mid=allocate_mid(mids),
)
)
if self.__sctp and self.__sctp.mid is None:
self.__sctp_mline_index = next_mline_index()
description.media.append(
create_media_description_for_sctp(
self.__sctp, legacy=self._sctpLegacySdp, mid=allocate_mid(mids)
)
)
bundle = sdp.GroupDescription(semantic="BUNDLE", items=[])
for media in description.media:
bundle.items.append(media.rtp.muxId)
description.group.append(bundle)
return wrap_session_description(description)
def getReceivers(self):
"""
Returns the list of :class:`RTCRtpReceiver` objects that are currently
attached to the connection.
"""
return list(map(lambda x: x.receiver, self.__transceivers))
def getSenders(self):
"""
Returns the list of :class:`RTCRtpSender` objects that are currently
attached to the connection.
"""
return list(map(lambda x: x.sender, self.__transceivers))
async def getStats(self):
"""
Returns statistics for the connection.
:rtype: :class:`RTCStatsReport`
"""
merged = RTCStatsReport()
coros = [x.getStats() for x in (self.getSenders() + self.getReceivers())]
for report in await asyncio.gather(*coros):
merged.update(report)
return merged
def getTransceivers(self):
"""
Returns the list of :class:`RTCRtpTransceiver` objects that are currently
attached to the connection.
"""
return list(self.__transceivers)
async def setLocalDescription(self, sessionDescription):
"""
Change the local description associated with the connection.
:param: sessionDescription: An :class:`RTCSessionDescription` generated
by :meth:`createOffer` or :meth:`createAnswer()`.
"""
# parse and validate description
description = sdp.SessionDescription.parse(sessionDescription.sdp)
description.type = sessionDescription.type
self.__validate_description(description, is_local=True)
# update signaling state
if description.type == "offer":
self.__setSignalingState("have-local-offer")
elif description.type == "answer":
self.__setSignalingState("stable")
# assign MID
for i, media in enumerate(description.media):
mid = media.rtp.muxId
self.__seenMids.add(mid)
if media.kind in ["audio", "video"]:
transceiver = self.__getTransceiverByMLineIndex(i)
transceiver._set_mid(mid)
elif media.kind == "application":
self.__sctp.mid = mid
# set ICE role
if self.__initialOfferer is None:
self.__initialOfferer = description.type == "offer"
for iceTransport in self.__iceTransports:
iceTransport._connection.ice_controlling = self.__initialOfferer
# configure direction
for t in self.__transceivers:
if description.type in ["answer", "pranswer"]:
t._currentDirection = and_direction(t.direction, t._offerDirection)
# gather candidates
await self.__gather()
for i, media in enumerate(description.media):
if media.kind in ["audio", "video"]:
transceiver = self.__getTransceiverByMLineIndex(i)
add_transport_description(media, transceiver._transport)
elif media.kind == "application":
add_transport_description(media, self.__sctp.transport)
# connect
asyncio.ensure_future(self.__connect())
# replace description
if description.type == "answer":
self.__currentLocalDescription = description
self.__pendingLocalDescription = None
else:
self.__pendingLocalDescription = description
async def setRemoteDescription(self, sessionDescription):
"""
Changes the remote description associated with the connection.
:param: sessionDescription: An :class:`RTCSessionDescription` created from
information received over the signaling channel.
"""
# parse and validate description
description = sdp.SessionDescription.parse(sessionDescription.sdp)
description.type = sessionDescription.type
self.__validate_description(description, is_local=False)
# apply description
trackEvents = []
for i, media in enumerate(description.media):
self.__seenMids.add(media.rtp.muxId)
if media.kind in ["audio", "video"]:
# find transceiver
transceiver = None
for t in self.__transceivers:
if t.kind == media.kind and t.mid in [None, media.rtp.muxId]:
transceiver = t
if transceiver is None:
transceiver = self.__createTransceiver(
direction="recvonly", kind=media.kind
)
if transceiver.mid is None:
transceiver._set_mid(media.rtp.muxId)
transceiver._set_mline_index(i)
# negotiate codecs
common = filter_preferred_codecs(
find_common_codecs(CODECS[media.kind], media.rtp.codecs),
transceiver._preferred_codecs,
)
assert len(common)
transceiver._codecs = common
transceiver._headerExtensions = find_common_header_extensions(
HEADER_EXTENSIONS[media.kind], media.rtp.headerExtensions
)
# configure transport
iceTransport = transceiver._transport.transport
add_remote_candidates(iceTransport, media)
self.__remoteDtls[transceiver] = media.dtls
self.__remoteIce[transceiver] = media.ice
# configure direction
direction = reverse_direction(media.direction)
if description.type in ["answer", "pranswer"]:
transceiver._currentDirection = direction
else:
transceiver._offerDirection = direction
# create remote stream track
if (
direction in ["recvonly", "sendrecv"]
and not transceiver.receiver._track
):
transceiver.receiver._track = RemoteStreamTrack(kind=media.kind)
trackEvents.append(
RTCTrackEvent(
receiver=transceiver.receiver,
track=transceiver.receiver._track,
transceiver=transceiver,
)
)
elif media.kind == "application":
if not self.__sctp:
self.__createSctpTransport()
if self.__sctp.mid is None:
self.__sctp.mid = media.rtp.muxId
self.__sctp_mline_index = i
# configure sctp
if media.profile == "DTLS/SCTP":
self._sctpLegacySdp = True
self.__sctpRemotePort = int(media.fmt[0])
else:
self._sctpLegacySdp = False
self.__sctpRemotePort = media.sctp_port
self.__sctpRemoteCaps = media.sctpCapabilities
# configure transport
iceTransport = self.__sctp.transport.transport
add_remote_candidates(iceTransport, media)
self.__remoteDtls[self.__sctp] = media.dtls
self.__remoteIce[self.__sctp] = media.ice
# remove bundled transports
bundle = next((x for x in description.group if x.semantic == "BUNDLE"), None)
if bundle and bundle.items:
# find main media stream
masterMid = bundle.items[0]
masterTransport = None
for transceiver in self.__transceivers:
if transceiver.mid == masterMid:
masterTransport = transceiver._transport
break
if self.__sctp and self.__sctp.mid == masterMid:
masterTransport = self.__sctp.transport
# replace transport for bundled media
oldTransports = set()
slaveMids = bundle.items[1:]
for transceiver in self.__transceivers:
if transceiver.mid in slaveMids and not transceiver._bundled:
oldTransports.add(transceiver._transport)
transceiver.receiver.setTransport(masterTransport)
transceiver.sender.setTransport(masterTransport)
transceiver._bundled = True
transceiver._transport = masterTransport
if self.__sctp and self.__sctp.mid in slaveMids:
oldTransports.add(self.__sctp.transport)
self.__sctp.setTransport(masterTransport)
self.__sctp._bundled = True
# stop and discard old ICE transports
for dtlsTransport in oldTransports:
await dtlsTransport.stop()
await dtlsTransport.transport.stop()
self.__iceTransports.discard(dtlsTransport.transport)
self.__updateIceGatheringState()
self.__updateIceConnectionState()
# FIXME: in aiortc 1.0.0 emit RTCTrackEvent directly
for event in trackEvents:
self.emit("track", event.track)
# connect
asyncio.ensure_future(self.__connect())
# update signaling state
if description.type == "offer":
self.__setSignalingState("have-remote-offer")
elif description.type == "answer":
self.__setSignalingState("stable")
# replace description
if description.type == "answer":
self.__currentRemoteDescription = description
self.__pendingRemoteDescription = None
else:
self.__pendingRemoteDescription = description
async def __connect(self):
for transceiver in self.__transceivers:
dtlsTransport = transceiver._transport
iceTransport = dtlsTransport.transport
if (
iceTransport.iceGatherer.getLocalCandidates()
and transceiver in self.__remoteIce
):
await iceTransport.start(self.__remoteIce[transceiver])
if dtlsTransport.state == "new":
await dtlsTransport.start(self.__remoteDtls[transceiver])
if dtlsTransport.state == "connected":
if transceiver.currentDirection in ["sendonly", "sendrecv"]:
await transceiver.sender.send(self.__localRtp(transceiver))
if transceiver.currentDirection in ["recvonly", "sendrecv"]:
await transceiver.receiver.receive(
self.__remoteRtp(transceiver)
)
if self.__sctp:
dtlsTransport = self.__sctp.transport
iceTransport = dtlsTransport.transport
if (
iceTransport.iceGatherer.getLocalCandidates()
and self.__sctp in self.__remoteIce
):
await iceTransport.start(self.__remoteIce[self.__sctp])
if dtlsTransport.state == "new":
await dtlsTransport.start(self.__remoteDtls[self.__sctp])
if dtlsTransport.state == "connected":
await self.__sctp.start(
self.__sctpRemoteCaps, self.__sctpRemotePort
)
async def __gather(self):
coros = map(lambda t: t.iceGatherer.gather(), self.__iceTransports)
await asyncio.gather(*coros)
def __assertNotClosed(self):
if self.__isClosed:
raise InvalidStateError("RTCPeerConnection is closed")
def __assertTrackHasNoSender(self, track):
for sender in self.getSenders():
if sender.track == track:
raise InvalidAccessError("Track already has a sender")
def __createDtlsTransport(self):
# create ICE transport
iceGatherer = RTCIceGatherer(iceServers=self.__configuration.iceServers)
iceGatherer.on("statechange", self.__updateIceGatheringState)
iceTransport = RTCIceTransport(iceGatherer)
iceTransport.on("statechange", self.__updateIceConnectionState)
self.__iceTransports.add(iceTransport)
# update states
self.__updateIceGatheringState()
self.__updateIceConnectionState()
return RTCDtlsTransport(iceTransport, self.__certificates)
def __createSctpTransport(self):
self.__sctp = RTCSctpTransport(self.__createDtlsTransport())
self.__sctp._bundled = False
self.__sctp.mid = None
@self.__sctp.on("datachannel")
def on_datachannel(channel):
self.emit("datachannel", channel)
def __createTransceiver(self, direction, kind, sender_track=None):
dtlsTransport = self.__createDtlsTransport()
transceiver = RTCRtpTransceiver(
direction=direction,
kind=kind,
sender=RTCRtpSender(sender_track or kind, dtlsTransport),
receiver=RTCRtpReceiver(kind, dtlsTransport),
)
transceiver.receiver._set_rtcp_ssrc(transceiver.sender._ssrc)
transceiver.sender._stream_id = self.__stream_id
transceiver._bundled = False
transceiver._transport = dtlsTransport
self.__transceivers.append(transceiver)
return transceiver
def __getTransceiverByMid(self, mid):
return next(filter(lambda x: x.mid == mid, self.__transceivers), None)
def __getTransceiverByMLineIndex(self, index):
return next(
filter(lambda x: x._get_mline_index() == index, self.__transceivers), None
)
def __localDescription(self):
return self.__pendingLocalDescription or self.__currentLocalDescription
def __localRtp(self, transceiver):
rtp = RTCRtpParameters(
codecs=transceiver._codecs,
headerExtensions=transceiver._headerExtensions,
muxId=transceiver.mid,
)
rtp.rtcp.cname = self.__cname
rtp.rtcp.ssrc = transceiver.sender._ssrc
rtp.rtcp.mux = True
return rtp
def __remoteDescription(self):
return self.__pendingRemoteDescription or self.__currentRemoteDescription
def __remoteRtp(self, transceiver):
media = self.__remoteDescription().media[transceiver._get_mline_index()]
receiveParameters = RTCRtpReceiveParameters(
codecs=transceiver._codecs,
headerExtensions=transceiver._headerExtensions,
muxId=media.rtp.muxId,
rtcp=media.rtp.rtcp,
)
if len(media.ssrc):
encodings = OrderedDict()
for codec in transceiver._codecs:
if is_rtx(codec):
if codec.parameters["apt"] in encodings and len(media.ssrc) == 2:
encodings[codec.parameters["apt"]].rtx = RTCRtpRtxParameters(
ssrc=media.ssrc[1].ssrc
)
continue
encodings[codec.payloadType] = RTCRtpDecodingParameters(
ssrc=media.ssrc[0].ssrc, payloadType=codec.payloadType
)
receiveParameters.encodings = list(encodings.values())
return receiveParameters
def __setSignalingState(self, state):
self.__signalingState = state
self.emit("signalingstatechange")
def __updateIceConnectionState(self):
# compute new state
states = set(map(lambda x: x.state, self.__iceTransports))
if self.__isClosed:
state = "closed"
elif "failed" in states:
state = "failed"
elif states == set(["completed"]):
state = "completed"
elif "checking" in states:
state = "checking"
else:
state = "new"
# update state
if state != self.__iceConnectionState:
self.__iceConnectionState = state
self.emit("iceconnectionstatechange")
def __updateIceGatheringState(self):
# compute new state
states = set(map(lambda x: x.iceGatherer.state, self.__iceTransports))
if states == set(["completed"]):
state = "complete"
elif "gathering" in states:
state = "gathering"
else:
state = "new"
# update state
if state != self.__iceGatheringState:
self.__iceGatheringState = state
self.emit("icegatheringstatechange")
def __validate_description(self, description, is_local):
# check description is compatible with signaling state
if is_local:
if description.type == "offer":
if self.signalingState not in ["stable", "have-local-offer"]:
raise InvalidStateError(
'Cannot handle offer in signaling state "%s"'
% self.signalingState
)
elif description.type == "answer":
if self.signalingState not in [
"have-remote-offer",
"have-local-pranswer",
]:
raise InvalidStateError(
'Cannot handle answer in signaling state "%s"'
% self.signalingState
)
else:
if description.type == "offer":
if self.signalingState not in ["stable", "have-remote-offer"]:
raise InvalidStateError(
'Cannot handle offer in signaling state "%s"'
% self.signalingState
)
elif description.type == "answer":
if self.signalingState not in [
"have-local-offer",
"have-remote-pranswer",
]:
raise InvalidStateError(
'Cannot handle answer in signaling state "%s"'
% self.signalingState
)
for media in description.media:
# check ICE credentials were provided
if not media.ice.usernameFragment or not media.ice.password:
raise ValueError("ICE username fragment or password is missing")
# check RTCP mux is used
if media.kind in ["audio", "video"] and not media.rtcp_mux:
raise ValueError("RTCP mux is not enabled")
# check the number of media section matches
if description.type in ["answer", "pranswer"]:
offer = (
self.__remoteDescription() if is_local else self.__localDescription()
)
offer_media = [(media.kind, media.rtp.muxId) for media in offer.media]
answer_media = [
(media.kind, media.rtp.muxId) for media in description.media
]
if answer_media != offer_media:
raise ValueError("Media sections in answer do not match offer")
| [
"jeremy.laine@m4x.org"
] | jeremy.laine@m4x.org |
19e6ef00e9fe5002e20f0893955cee6ec497bcc0 | a3a3cb9749fa259cd465294cbfac0da1815d747d | /DEP/views.py | 5374620c61c40fbc0572e1854fcbec33a20fa661 | [] | no_license | arcidodo/DEPTool | aae0fcf20cbe41f9ce587b3a5ed2708ea16345af | bdda123005aff9a4406cb62969dd012b1907f2e6 | refs/heads/master | 2022-11-20T09:12:53.454374 | 2019-07-03T07:50:04 | 2019-07-03T07:50:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 11,667 | py | from django.conf import settings
from django.http import *
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.contrib.auth import authenticate, login, logout
from django.views.decorators.cache import never_cache
from django.views.static import serve
from django.views.generic import View
from pathlib import Path
import json
import os
import re
import subprocess
RUN_AS_MUNKIADMIN = settings.RUN_AS_MUNKIADMIN
MDMCTL_JSON = settings.MDMCTL_JSON
SYNC_DEP_DEVICES = settings.SYNC_DEP_DEVICES
@never_cache
def login_method(request):
# If user is already authenticated, user is redirected to root page.
if request.user.is_authenticated:
return HttpResponseRedirect('/')
if request.POST:
# We use next parameter to redirect when user login is successful.
try:
next_page = request.POST['next']
except:
next_page = ''
# Username & password parameters has to be present.
try:
username = request.POST['username']
password = request.POST['password']
except:
return render(request, 'DEP/login.html')
# Authenticating user.
user = authenticate(username=username, password=password)
if user is not None:
if user.is_active:
login(request, user)
if next_page:
return HttpResponseRedirect(next_page)
else:
return HttpResponseRedirect('/')
else:
context = {'first_attempt': False, 'next': next_page}
return render(request, 'DEP/login.html', context)
else:
next = ''
try:
next = request.GET['next']
except:
pass
context = {'first_attempt': True, 'next': next}
return render(request, 'DEP/login.html', context)
@never_cache
@login_required(login_url='/login')
def main_method(request):
# e.g. mdmctl get devices | wc -l
try:
output = subprocess.check_output("ls / | wc -l", stderr=subprocess.STDOUT, shell=True, timeout=3, universal_newlines=True)
search = re.search('\d+', output, re.IGNORECASE) #search number only
if search:
ios_number = int(search.group(0)) #take whole match
else:
ios_number = 0
except subprocess.CalledProcessError as exc:
ios_number = 0
try:
output = subprocess.check_output("ls / | wc -l", stderr=subprocess.STDOUT, shell=True, timeout=3, universal_newlines=True)
search = re.search('\d+', output, re.IGNORECASE) #search number only
if search:
macos_number = int(search.group(0)) #take whole match
else:
macos_number = 0
except subprocess.CalledProcessError as exc:
macos_number = 0
try:
output = subprocess.check_output("ls / | wc -l", stderr=subprocess.STDOUT, shell=True, timeout=3, universal_newlines=True)
search = re.search('\d{4}', output, re.IGNORECASE) #search number only
if search:
blocked = int(search.group(0)) #take whole match
else:
blocked = 0
except subprocess.CalledProcessError as exc:
blocked = 0
context = {'number_of_iOSdevices': ios_number, 'number_of_OSdevices': macos_number, 'number_of_blocked': blocked}
return render(request, 'DEP/main.html', context)
@never_cache
@login_required(login_url='/login')
def add_device_method(request):
return render(request, 'DEP/adddevice.html')
@never_cache
@login_required(login_url='/login')
def remove_device_method(request):
return render(request, 'DEP/removedevice.html')
@never_cache
@login_required(login_url='/login')
def system_journal_method(request):
try:
output = subprocess.check_output(
"{} \"{}\"".format(RUN_AS_MUNKIADMIN, "journalctl -u micromdm.service -f --no-pager"),
stderr=subprocess.STDOUT,
shell=True,
timeout=3,
universal_newlines=True)
search = re.search('level: (debug|inactive) \((?:dead|running)\) since [^;]*; (.+) ago', output, re.IGNORECASE)
if search:
server_name = "microMDM"
service_status = search.group(1)
last_restart = search.group(2)
else:
server_name = "microMDM"
service_status = "error"
last_restart = "error"
except subprocess.CalledProcessError as exc:
server_name = "microMDM"
service_status = "error"
last_restart = "error"
context = {'rows': [{'server_name':server_name, 'service_status':service_status,'last_restart':last_restart}]}
return render(request, 'DEP/systemjournal.html', context)
@never_cache
@login_required(login_url='/login')
def show_devices_method(request):
try:
serial_numbers = []
with open(MDMCTL_JSON, 'r') as json_file:
dep_json = json.load(json_file)
if dep_json.get('devices', ''):
for i in dep_json.get('devices', ''):
serial_numbers.append({"serial_number": i})
context = {'rows': serial_numbers}
except:
context = {'rows': []}
return render(request, 'DEP/showdevices.html', context)
@never_cache
@login_required(login_url='/login')
def api_command_method(request):
if request.POST:
subprocess.call(SYNC_DEP_DEVICES)
return render(request, 'DEP/api.html')
@never_cache
@login_required(login_url='/login')
def manifest_method(request):
return render(request, 'DEP/manifest.html')
@never_cache
@login_required(login_url='/login')
def service_status_method(request):
# context = {'rows': [{'server_name':1, 'service_status':534988,'last_restart':'A'},
# {'server_name': 1, 'service_status': 534988, 'last_restart': 'A'},
# {'server_name': 1, 'service_status': 534988, 'last_restart': 'A'}]}
try:
output = subprocess.check_output(
"{} \"{}\"".format(RUN_AS_MUNKIADMIN, "systemctl status micromdm.service --no-pager"),
stderr=subprocess.STDOUT,
shell=True,
timeout=3,
universal_newlines=True)
search = re.search('Active: (active|inactive) \((?:dead|running)\) since [^;]*; (.+) ago', output, re.IGNORECASE)
if search:
server_name = "microMDMserver"
service_status = search.group(1)
last_restart = search.group(2)
else:
server_name = "microMDMserver"
service_status = "error"
last_restart = "error"
except subprocess.CalledProcessError as exc:
server_name = "microMDMserver"
service_status = "error"
last_restart = "error"
context = {'rows': [{'server_name':server_name, 'service_status':service_status,'last_restart':last_restart}]}
return render(request, 'DEP/servicestatus.html', context)
@never_cache
@login_required(login_url='/login')
def add_method(request):
if request.POST:
try:
with open(MDMCTL_JSON, 'r') as json_file:
dep_json = json.load(json_file)
except:
return JsonResponse({'result': 'Error', 'details': 'Cannot open local json file'})
try:
device_id = ''
device_id = request.POST['id']
except:
pass
if not device_id:
return JsonResponse({'result': 'Error', 'details': 'Blank Device ID filled in'})
if not dep_json.get('devices', ''):
return JsonResponse({'result': 'Error', 'details': 'No devices list in json file'})
if device_id in dep_json['devices']:
return JsonResponse({'result': 'Error', 'details': 'Already in'})
else:
dep_json['devices'].append(device_id)
try:
with open(MDMCTL_JSON, 'w') as json_file:
json.dump(dep_json, json_file)
except:
return JsonResponse({'result': 'Error', 'details': 'Error dumping updated json'})
return JsonResponse({'result': 'Success', 'details': 'Newly added. Please apply.'})
else:
return JsonResponse({'result': 'Error', 'details': 'Use POST method'})
@never_cache
@login_required(login_url='/login')
def remove_method(request):
if not request.user.is_superuser:
return JsonResponse({'result': 'Error', 'details': 'Permission denied - you have to be superuser'})
if request.POST:
try:
with open(MDMCTL_JSON, 'r') as json_file:
dep_json = json.load(json_file)
except:
return JsonResponse({'result': 'Error', 'details': 'Cannot open local json file'})
try:
device_id = ''
device_id = request.POST['id']
except:
pass
if not device_id:
return JsonResponse({'result': 'Error', 'details': 'Blank Device ID filled in'})
if not dep_json.get('devices', ''):
return JsonResponse({'result': 'Error', 'details': 'No devices list in json file'})
if device_id not in dep_json['devices']:
return JsonResponse({'result': 'Questionable', 'details': 'Not present in devices'})
else:
dep_json['devices'].remove(device_id)
try:
with open(MDMCTL_JSON, 'w') as json_file:
json.dump(dep_json, json_file)
except:
return JsonResponse({'result': 'Error', 'details': 'Error dumping updated json to local file'})
return JsonResponse({'result': 'Success', 'details': 'Removed selected Device ID'})
else:
return JsonResponse({'result': 'Error', 'details': 'Use POST method'})
@never_cache
@login_required(login_url='/login')
def apply_method(request):
if request.POST:
try:
output = subprocess.check_output("{} \"mdmctl apply dep-profiles -f {}\"".format(RUN_AS_MUNKIADMIN, MDMCTL_JSON),
stderr=subprocess.STDOUT,
shell=True,
timeout=3,
universal_newlines=True)
except subprocess.CalledProcessError as exc:
output = exc.output
if re.search('Defined DEP Profile with UUID [\dA-Za-z]+', output, re.IGNORECASE):
return JsonResponse({'result': 'Success', 'details': output, 'additional': 'Output looks fine based on '
'standard behaviour'})
else:
return JsonResponse({'result': 'Questionable', 'details': output, 'additional': 'Output doesn\'t look '
'standard'})
else:
return JsonResponse({'result': 'Error', 'details': 'Use POST method'})
@never_cache
@login_required(login_url='/login')
def modular_method(request):
modular_list = [
{"method": "journalctl_micromdm_service",
"command": "journalctl -u micromdm.service -n 100 --no-pager",
"expected_result": "Logs begin at"},
{"method": "systemctl_status_micromdm_service",
"command": "systemctl status micromdm.service --no-pager",
"expected_result": "micromdm.service - MicroMDM MDM Server"},
{"method": "GET APPS",
"command": "mdmctl get apps",
"expected_result": ""},
{"method": "restart_micromdm",
"command": "sudo service micromdm restart --no-pager",
"expected_result": ""},
{"method": "sync_dep_devices",
"command": "sudo ./sync_dep_devices.sh --no-pager",
"expected_result": ""}
]
if not request.user.is_superuser:
return JsonResponse({'result': 'Error', 'details': 'Permission denied - you have to be superuser'})
if request.POST:
try:
method_param = request.POST['method']
except:
return JsonResponse({'result': 'Error', 'details': 'Undefined method.'})
for elem in modular_list:
if elem['method'] == method_param:
command, expected_result = elem['command'], elem['expected_result']
break
else:
return JsonResponse({'result': 'Error', 'details': 'Couldn\'t find selected method.'})
try:
output = subprocess.check_output("{} \"{}\"".format(RUN_AS_MUNKIADMIN, command),
stderr=subprocess.STDOUT,
shell=True,
timeout=3,
universal_newlines=True)
except subprocess.CalledProcessError as exc:
output = exc.output
if re.search(expected_result, output, re.IGNORECASE):
return JsonResponse({'result': 'Success', 'output': output})
else:
return JsonResponse({'result': 'Error', 'details': output})
else:
return JsonResponse({'result': 'Error', 'details': 'Use POST method'})
@never_cache
@login_required(login_url='/login')
def get_json_method(request):
return serve(request, os.path.basename(MDMCTL_JSON), os.path.dirname(MDMCTL_JSON))
@never_cache
@login_required(login_url='/login')
def logout_method(request):
logout(request)
return HttpResponseRedirect('/login')
@never_cache
def not_present_method(request):
return HttpResponse("Not present on the server!", status=404)
| [
"ent_dev_apple_emea@trendmicro.com"
] | ent_dev_apple_emea@trendmicro.com |
76ffed6ea5fce21b63dfbacd0d8a3e79515b811f | 64fa49a9a2c0b157aec3224530d7f61ddf9d24fa | /v6.0.2/log/fortios_log_threat_weight.py | 7911f24d762e0a9373349dcc086d0004d60c504e | [
"Apache-2.0"
] | permissive | chick-tiger/ansible_fgt_modules | 55bee8a41a809b8c5756f6b3f5900721ee7c40e4 | 6106e87199881d1d4c3475a4f275c03d345ec9ad | refs/heads/master | 2020-03-31T11:05:12.659115 | 2018-10-04T10:20:33 | 2018-10-04T10:20:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 24,651 | py | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2018 Fortinet, Inc.
#
# 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 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# the lib use python logging can get it if the following is set in your
# Ansible config.
__metaclass__ = type
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'metadata_version': '1.1'}
DOCUMENTATION = '''
---
module: fortios_log_threat_weight
short_description: Configure threat weight settings.
description:
- This module is able to configure a FortiGate or FortiOS by
allowing the user to configure log feature and threat_weight category.
Examples includes all options and need to be adjusted to datasources before usage.
Tested with FOS v6.0.2
version_added: "2.8"
author:
- Miguel Angel Munoz (@mamunozgonzalez)
- Nicolas Thomas (@thomnico)
notes:
- Requires fortiosapi library developed by Fortinet
- Run as a local_action in your playbook
requirements:
- fortiosapi>=0.9.8
options:
host:
description:
- FortiOS or FortiGate ip adress.
required: true
username:
description:
- FortiOS or FortiGate username.
required: true
password:
description:
- FortiOS or FortiGate password.
default: ""
vdom:
description:
- Virtual domain, among those defined previously. A vdom is a
virtual instance of the FortiGate that can be configured and
used as a different unit.
default: root
https:
description:
- Indicates if the requests towards FortiGate must use HTTPS
protocol
type: bool
default: false
log_threat_weight:
description:
- Configure threat weight settings.
default: null
suboptions:
application:
description:
- Application-control threat weight settings.
suboptions:
category:
description:
- Application category.
id:
description:
- Entry ID.
required: true
level:
description:
- Threat weight score for Application events.
choices:
- disable
- low
- medium
- high
- critical
blocked-connection:
description:
- Threat weight score for blocked connections.
choices:
- disable
- low
- medium
- high
- critical
failed-connection:
description:
- Threat weight score for failed connections.
choices:
- disable
- low
- medium
- high
- critical
geolocation:
description:
- Geolocation-based threat weight settings.
suboptions:
country:
description:
- Country code.
id:
description:
- Entry ID.
required: true
level:
description:
- Threat weight score for Geolocation-based events.
choices:
- disable
- low
- medium
- high
- critical
ips:
description:
- IPS threat weight settings.
suboptions:
critical-severity:
description:
- Threat weight score for IPS critical severity events.
choices:
- disable
- low
- medium
- high
- critical
high-severity:
description:
- Threat weight score for IPS high severity events.
choices:
- disable
- low
- medium
- high
- critical
info-severity:
description:
- Threat weight score for IPS info severity events.
choices:
- disable
- low
- medium
- high
- critical
low-severity:
description:
- Threat weight score for IPS low severity events.
choices:
- disable
- low
- medium
- high
- critical
medium-severity:
description:
- Threat weight score for IPS medium severity events.
choices:
- disable
- low
- medium
- high
- critical
level:
description:
- Score mapping for threat weight levels.
suboptions:
critical:
description:
- Critical level score value (1 - 100).
high:
description:
- High level score value (1 - 100).
low:
description:
- Low level score value (1 - 100).
medium:
description:
- Medium level score value (1 - 100).
malware:
description:
- Anti-virus malware threat weight settings.
suboptions:
botnet-connection:
description:
- Threat weight score for detected botnet connections.
choices:
- disable
- low
- medium
- high
- critical
command-blocked:
description:
- Threat weight score for blocked command detected.
choices:
- disable
- low
- medium
- high
- critical
mimefragmented:
description:
- Threat weight score for mimefragmented detected.
choices:
- disable
- low
- medium
- high
- critical
oversized:
description:
- Threat weight score for oversized file detected.
choices:
- disable
- low
- medium
- high
- critical
switch-proto:
description:
- Threat weight score for switch proto detected.
choices:
- disable
- low
- medium
- high
- critical
virus-blocked:
description:
- Threat weight score for virus (blocked) detected.
choices:
- disable
- low
- medium
- high
- critical
virus-file-type-executable:
description:
- Threat weight score for virus (filetype executable) detected.
choices:
- disable
- low
- medium
- high
- critical
virus-infected:
description:
- Threat weight score for virus (infected) detected.
choices:
- disable
- low
- medium
- high
- critical
virus-outbreak-prevention:
description:
- Threat weight score for virus (outbreak prevention) event.
choices:
- disable
- low
- medium
- high
- critical
virus-scan-error:
description:
- Threat weight score for virus (scan error) detected.
choices:
- disable
- low
- medium
- high
- critical
status:
description:
- Enable/disable the threat weight feature.
choices:
- enable
- disable
url-block-detected:
description:
- Threat weight score for URL blocking.
choices:
- disable
- low
- medium
- high
- critical
web:
description:
- Web filtering threat weight settings.
suboptions:
category:
description:
- Threat weight score for web category filtering matches.
id:
description:
- Entry ID.
required: true
level:
description:
- Threat weight score for web category filtering matches.
choices:
- disable
- low
- medium
- high
- critical
'''
EXAMPLES = '''
- hosts: localhost
vars:
host: "192.168.122.40"
username: "admin"
password: ""
vdom: "root"
tasks:
- name: Configure threat weight settings.
fortios_log_threat_weight:
host: "{{ host }}"
username: "{{ username }}"
password: "{{ password }}"
vdom: "{{ vdom }}"
log_threat_weight:
application:
-
category: "4"
id: "5"
level: "disable"
blocked-connection: "disable"
failed-connection: "disable"
geolocation:
-
country: "<your_own_value>"
id: "11"
level: "disable"
ips:
critical-severity: "disable"
high-severity: "disable"
info-severity: "disable"
low-severity: "disable"
medium-severity: "disable"
level:
critical: "20"
high: "21"
low: "22"
medium: "23"
malware:
botnet-connection: "disable"
command-blocked: "disable"
mimefragmented: "disable"
oversized: "disable"
switch-proto: "disable"
virus-blocked: "disable"
virus-file-type-executable: "disable"
virus-infected: "disable"
virus-outbreak-prevention: "disable"
virus-scan-error: "disable"
status: "enable"
url-block-detected: "disable"
web:
-
category: "38"
id: "39"
level: "disable"
'''
RETURN = '''
build:
description: Build number of the fortigate image
returned: always
type: string
sample: '1547'
http_method:
description: Last method used to provision the content into FortiGate
returned: always
type: string
sample: 'PUT'
http_status:
description: Last result given by FortiGate on last operation applied
returned: always
type: string
sample: "200"
mkey:
description: Master key (id) used in the last call to FortiGate
returned: success
type: string
sample: "key1"
name:
description: Name of the table used to fulfill the request
returned: always
type: string
sample: "urlfilter"
path:
description: Path of the table used to fulfill the request
returned: always
type: string
sample: "webfilter"
revision:
description: Internal revision number
returned: always
type: string
sample: "17.0.2.10658"
serial:
description: Serial number of the unit
returned: always
type: string
sample: "FGVMEVYYQT3AB5352"
status:
description: Indication of the operation's result
returned: always
type: string
sample: "success"
vdom:
description: Virtual domain used
returned: always
type: string
sample: "root"
version:
description: Version of the FortiGate
returned: always
type: string
sample: "v5.6.3"
'''
from ansible.module_utils.basic import AnsibleModule
fos = None
def login(data):
host = data['host']
username = data['username']
password = data['password']
fos.debug('on')
if 'https' in data and not data['https']:
fos.https('off')
else:
fos.https('on')
fos.login(host, username, password)
def filter_log_threat_weight_data(json):
option_list = ['application', 'blocked-connection', 'failed-connection',
'geolocation', 'ips', 'level',
'malware', 'status', 'url-block-detected',
'web']
dictionary = {}
for attribute in option_list:
if attribute in json:
dictionary[attribute] = json[attribute]
return dictionary
def log_threat_weight(data, fos):
vdom = data['vdom']
log_threat_weight_data = data['log_threat_weight']
filtered_data = filter_log_threat_weight_data(log_threat_weight_data)
return fos.set('log',
'threat-weight',
data=filtered_data,
vdom=vdom)
def fortios_log(data, fos):
login(data)
methodlist = ['log_threat_weight']
for method in methodlist:
if data[method]:
resp = eval(method)(data, fos)
break
fos.logout()
return not resp['status'] == "success", resp['status'] == "success", resp
def main():
fields = {
"host": {"required": True, "type": "str"},
"username": {"required": True, "type": "str"},
"password": {"required": False, "type": "str", "no_log": True},
"vdom": {"required": False, "type": "str", "default": "root"},
"https": {"required": False, "type": "bool", "default": "False"},
"log_threat_weight": {
"required": False, "type": "dict",
"options": {
"application": {"required": False, "type": "list",
"options": {
"category": {"required": False, "type": "int"},
"id": {"required": True, "type": "int"},
"level": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]}
}},
"blocked-connection": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]},
"failed-connection": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]},
"geolocation": {"required": False, "type": "list",
"options": {
"country": {"required": False, "type": "str"},
"id": {"required": True, "type": "int"},
"level": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]}
}},
"ips": {"required": False, "type": "dict",
"options": {
"critical-severity": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]},
"high-severity": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]},
"info-severity": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]},
"low-severity": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]},
"medium-severity": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]}
}},
"level": {"required": False, "type": "dict",
"options": {
"critical": {"required": False, "type": "int"},
"high": {"required": False, "type": "int"},
"low": {"required": False, "type": "int"},
"medium": {"required": False, "type": "int"}
}},
"malware": {"required": False, "type": "dict",
"options": {
"botnet-connection": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]},
"command-blocked": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]},
"mimefragmented": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]},
"oversized": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]},
"switch-proto": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]},
"virus-blocked": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]},
"virus-file-type-executable": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]},
"virus-infected": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]},
"virus-outbreak-prevention": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]},
"virus-scan-error": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]}
}},
"status": {"required": False, "type": "str",
"choices": ["enable", "disable"]},
"url-block-detected": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]},
"web": {"required": False, "type": "list",
"options": {
"category": {"required": False, "type": "int"},
"id": {"required": True, "type": "int"},
"level": {"required": False, "type": "str",
"choices": ["disable", "low", "medium",
"high", "critical"]}
}}
}
}
}
module = AnsibleModule(argument_spec=fields,
supports_check_mode=False)
try:
from fortiosapi import FortiOSAPI
except ImportError:
module.fail_json(msg="fortiosapi module is required")
global fos
fos = FortiOSAPI()
is_error, has_changed, result = fortios_log(module.params, fos)
if not is_error:
module.exit_json(changed=has_changed, meta=result)
else:
module.fail_json(msg="Error in repo", meta=result)
if __name__ == '__main__':
main()
| [
"magonzalez@fortinet.com"
] | magonzalez@fortinet.com |
d8382685a5e788393f0482fc6f5105e5495065ab | b270c09e0d28fff4ba188aaaa4ee68bfbde337cb | /todo/migrations/0001_initial.py | 86f83eb4f800d8d16e93f2d6fa48b3af167f2755 | [] | no_license | vbc221/To-Do-App | c40e60afd21befbd9791fa9fe058ca04bad2a33d | 14a67fc745f63f8367d2aff43e5ec22d358a593e | refs/heads/master | 2023-05-02T10:48:50.979316 | 2019-11-07T21:01:36 | 2019-11-07T21:01:36 | 220,106,073 | 0 | 0 | null | 2023-04-21T20:42:53 | 2019-11-06T22:57:33 | Python | UTF-8 | Python | false | false | 549 | py | # Generated by Django 2.2.7 on 2019-11-07 15:22
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Todo',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('text', models.CharField(max_length=40)),
('complete', models.BooleanField(default=False)),
],
),
]
| [
"vbc221@nyu.edu"
] | vbc221@nyu.edu |
12f17cfe1508e172d6bc459308ee4a8935318c12 | 29be7ad12a8463be61ddfad62406f200bbbbeea2 | /bot.py | 6609206f15dce3f76465b97bd623ecc21d669bcd | [] | no_license | allwells/telegram-bot | 10228e79b72b291232ca255a88dc4d35686d81a0 | f50fd104efdc27f6e17686513ece1caabfd5ace6 | refs/heads/master | 2023-01-10T10:43:11.112488 | 2020-11-05T13:58:57 | 2020-11-05T13:58:57 | 310,275,593 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 817 | py | import requests
import json
import configparser as cfg
class telegram_chatbot:
def __init__(self, config):
self.token = self.read_token_from_config_file(config)
self.base = "https://api.telegram.org/bot{}/".format(self.token)
def get_update(self, offset=None):
url = self.base + "/getUpdates?timeout=100"
if offset:
url = url + "&offset={}".format(offset + 1)
r = requests.get(url)
return json.loads(r.content)
def send_message(self, msg, chat_id):
url = self.base + "sendMessage?chat_id={}&text={}".format(chat_id, msg)
if msg is not None:
requests.get(url)
def read_token_from_config_file(config):
parser = cfg.ConfigParser()
parser.read(config)
return parser.get('creds', 'token')
| [
"aleenfestus@gmail.com"
] | aleenfestus@gmail.com |
dd36ec55c9c70679b740fdbabe11923c17e49b2b | 5dbbcd5e1df606adefcb11b798219665ef3c8aab | /examples/python/test_aabb2.py | 1a678a270539337721265623758a844af20a9cb5 | [
"BSL-1.0"
] | permissive | sciencectn/cgal-bindings | f769d75153eac46bf1a4b3773860da031097eb74 | e7a38a7852a50bb107b9be997a10a7e4a3f3c74b | refs/heads/master | 2020-12-24T12:05:14.022263 | 2018-05-20T02:09:04 | 2018-05-20T02:09:04 | 32,248,691 | 37 | 6 | BSL-1.0 | 2018-04-17T18:43:40 | 2015-03-15T06:50:57 | C++ | UTF-8 | Python | false | false | 6,993 | py | '''
Created on Nov 18, 2015
@author: Willie Maddox
Test passing a python sequence directly to aabb trees
and print out some timing info.
Verified with with python lists, tuples, and numpy arrays.
The following results were obtained with
ubuntu 14.04 running on Intel Xeon E5-2620 cpu.
Bindings compiled with CGAL 4.6 gcc 4.8.4
nx = 1000
ny = 1000
gen_vertices_cgal 10.36432
*******************************
gen_triangle_soup 19.83478
gen_triangle_tree 0.45456
Total: 30.65385
*******************************
gen_triangle_soup_Nx9 0.16211
gen_triangle_tree_Nx9 1.94723
Total: 2.10945
*******************************
gen_segment_soup 31.55930
gen_segment_tree 0.63369
Total: 42.55750
*******************************
gen_segment_soup_Nx6 0.50796
gen_segment_tree_Nx6 2.22729
Total: 2.73538
*******************************
'''
from __future__ import print_function
import sys, time
from CGAL.CGAL_Kernel import Point_3, Segment_3, Triangle_3
from CGAL.CGAL_AABB_tree import AABB_tree_Segment_3_soup, AABB_tree_Triangle_3_soup
import numpy as np
# Helper functions
def gen_vertices(nx, ny):
'''
Create a Regular grid of vertices formatted as an (nx*ny,3) numpy array.
'''
xvals = np.linspace(-nx/2, nx/2, nx)
yvals = np.linspace(-ny/2, ny/2, ny)
xy = np.array([[i,j] for i in xvals for j in yvals])
# add some purturbations to z values.
zvals = (np.random.random((nx*ny))-0.5)*0.5
vertices = np.vstack((xy.T,zvals)).T
return vertices
#end
def gen_faces(nx, ny):
'''
Generate a list of faces from an nx by ny regular grid.
'''
a = np.arange(nx*ny).reshape(ny,nx)[:-1,:-1].flatten()
b = a + 1
c = a + nx
d = c + 1
nfaces = 2*(nx-1)*(ny-1)
faces = np.zeros((nfaces, 3)).astype(int)
faces[::2] = np.vstack([a,c,b]).T
faces[1::2] = np.vstack([b,c,d]).T
assert nfaces == len(faces)
return faces
#end
def gen_edges(faces):
'''
Generate the edges corresponding to the faces.
'''
fs = np.sort(faces, axis=1)
F_EP = [[(f[0], f[1]), (f[0], f[2]), (f[1], f[2])] for f in fs]
edges0 = set([E for EP in F_EP for E in EP])
EP_F = {EP:() for EP in edges0}
for F, EP in enumerate(F_EP):
EP_F[EP[0]] += (F,)
EP_F[EP[1]] += (F,)
EP_F[EP[2]] += (F,)
edges = np.array(list(edges0))
return edges
#end
# Testing functions
def gen_vertices_cgal(vertices):
t0 = time.time()
vertices_cgal = [Point_3(x, y, z) for x, y, z in vertices]
print('{:<21} {:>9.5f}'.format('gen_vertices_cgal', time.time()-t0))
return vertices_cgal
#end
def gen_triangle_soup(vertices_cgal, faces):
t0 = time.time()
soup = [Triangle_3(vertices_cgal[f[0]], vertices_cgal[f[1]], vertices_cgal[f[2]]) for f in faces]
print('{:<21} {:>9.5f}'.format('gen_triangle_soup', time.time()-t0))
return soup
#end
def gen_segment_soup(vertices_cgal, edges):
t0 = time.time()
soup = [Segment_3(vertices_cgal[e[0]], vertices_cgal[e[1]]) for e in edges]
print('{:<21} {:>9.5f}'.format('gen_segment_soup', time.time()-t0))
return soup
#end
def gen_triangle_tree(soup):
t0 = time.time()
tree = AABB_tree_Triangle_3_soup(soup)
print('{:<21} {:>9.5f}'.format('gen_triangle_tree', time.time()-t0))
return tree
#end
def gen_segment_tree(soup):
t0 = time.time()
tree = AABB_tree_Segment_3_soup(soup)
print('{:<21} {:>9.5f}'.format('gen_segment_tree', time.time()-t0))
return tree
#end
def gen_triangle_soup_Nx9(vertices, faces):
t0 = time.time()
soup = vertices[faces].reshape(len(faces),9)
print('{:<21} {:>9.5f}'.format('gen_triangle_soup_Nx9', time.time()-t0))
return soup
#end
def gen_segment_soup_Nx6(vertices, edges):
t0 = time.time()
soup = vertices[edges].reshape(len(edges),6)
print('{:<21} {:>9.5f}'.format('gen_segment_soup_Nx6', time.time()-t0))
return soup
#end
def gen_triangle_tree_Nx9(soup):
t0 = time.time()
tree = AABB_tree_Triangle_3_soup()
tree.insert_from_array(soup)
print('{:<21} {:>9.5f}'.format('gen_triangle_tree_Nx9', time.time()-t0))
return tree
#end
def gen_segment_tree_Nx6(soup):
t0 = time.time()
tree = AABB_tree_Segment_3_soup()
tree.insert_from_array(soup)
print('{:<21} {:>9.5f}'.format('gen_segment_tree_Nx6', time.time()-t0))
return tree
#end
# Set sizes.
nx = 100
ny = 100
sepstring = '*'*31
# Set up some testing primitives
p1 = Point_3(-1,-1,-1)
p2 = Point_3(1,1,1)
p3 = Point_3(1,1,-1)
tri0 = Triangle_3(p1, p2, p3)
seg0 = Segment_3(p1, p2)
# Generate an initial set of points, faces, and edges.
verts = gen_vertices(nx, ny)
faces = gen_faces(nx, ny)
edges = gen_edges(faces)
nverts = len(verts)
nfaces = len(faces)
nedges = len(edges)
# Convert points to list of CGAL Point_3 objects.
t0 = time.time()
verts_cgal = gen_vertices_cgal(verts)
tverts = time.time()-t0
assert nverts == len(verts_cgal)
print(sepstring)
# test AABB triangle trees
# Generate CGAL soups on python side and pass to CGAL.
t0 = time.time()
triangle_soup = gen_triangle_soup(verts_cgal, faces)
tfaces = time.time()-t0
assert nfaces == len(triangle_soup)
t0 = time.time()
triangle_tree = gen_triangle_tree(triangle_soup)
ttree = time.time()-t0
assert nfaces == triangle_tree.size()
print('{:<21} {:>9.5f}'.format('Total:', tverts+tfaces+ttree))
print(sepstring)
tsi = []
triangle_tree.all_intersections(seg0, tsi)
tsii = [ip.second for ip in tsi]
# Pass Nx9 list directly to CGAL.
t0 = time.time()
triangle_soup_Nx9 = gen_triangle_soup_Nx9(verts, faces)
tfaces = time.time()-t0
assert nfaces == len(triangle_soup_Nx9)
t0 = time.time()
triangle_tree_Nx9 = gen_triangle_tree_Nx9(triangle_soup_Nx9)
ttree = time.time()-t0
assert nfaces == triangle_tree_Nx9.size()
print('{:<21} {:>9.5f}'.format('Total:', tfaces+ttree))
print(sepstring)
tsi9 = []
triangle_tree_Nx9.all_intersections(seg0, tsi9)
tsi9i = [ip.second for ip in tsi9]
assert tsii == tsi9i
# test AABB segment trees
# Using standard python.
t0 = time.time()
segment_soup = gen_segment_soup(verts_cgal, edges)
tedges = time.time()-t0
assert nedges == len(segment_soup)
t0 = time.time()
segment_tree = gen_segment_tree(segment_soup)
ttree = time.time()-t0
assert nedges == segment_tree.size()
print('{:<21} {:>9.5f}'.format('Total:', tverts+tedges+ttree))
print(sepstring)
sti = []
segment_tree.all_intersections(tri0, sti)
stii = [ip.second for ip in sti]
# Pass Nx6 list directly to CGAL.
t0 = time.time()
segment_soup_Nx6 = gen_segment_soup_Nx6(verts, edges)
tedges = time.time()-t0
assert nedges == len(segment_soup_Nx6)
t0 = time.time()
segment_tree_Nx6 = gen_segment_tree_Nx6(segment_soup_Nx6)
ttree = time.time()-t0
assert nedges == segment_tree_Nx6.size()
print('{:<21} {:>9.5f}'.format('Total:', tedges+ttree))
print(sepstring)
sti6 = []
segment_tree_Nx6.all_intersections(tri0, sti6)
sti6i = [ip.second for ip in sti6]
assert stii == sti6i
print('done')
| [
"willie.maddox@gmail.com"
] | willie.maddox@gmail.com |
0a1e7e1a9dc2bd86b18d26b0da038b8c00a5c661 | 5528290429e3e98be841dc8a8ea504aa657f0187 | /interesesCRUD/apps.py | e0c578d5d3637bd700d7af40be820af09c131c58 | [] | no_license | dillan08/PAT | ac8973c2ccd9efbd8692bce4173dfc3e307e5a5a | 39a75bc2a29bcaf7457c886989f291623dcd465d | refs/heads/development | 2020-09-15T01:44:55.021752 | 2016-10-21T13:29:08 | 2016-10-21T13:29:08 | 67,364,883 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 101 | py | from django.apps import AppConfig
class InteresescrudConfig(AppConfig):
name = 'interesesCRUD'
| [
"d1ll4n08@gmail.com"
] | d1ll4n08@gmail.com |
26e0ecf72b4c3430ad2cf40ab65bb0a2280e1ef3 | c7500549fa5b41508f013f13ba8459a1783be707 | /ownership/manager.py | 0120aa8556dd6aaf4053bccc618c5c52c49f5d16 | [] | no_license | kkthxbye/ownership | e7958016275e3d727b45dae5e26ea752c1147b8a | 62fe3490b8c1118cb8d08a1960b528fc77f4076b | refs/heads/master | 2021-05-04T14:16:44.915775 | 2019-07-15T04:15:40 | 2019-07-15T04:15:40 | 120,196,608 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,727 | py | from typing import Dict, List, Set
from ownership.allocation import Uniform
from ownership.client import Client
from ownership.resource import Resource
class Manager:
"""
Manages "resource: client" assignation.
Attributes:
resources: List[Resource] initialized resources
clients: List[Client] current clients
allocation: Dict[Client, Resource] current client-resource assignations
strategy: AllocationStrategy strategy to be used for allocation
"""
def __init__(self) -> None:
self.resources = []
self.clients = []
self.allocation = {}
self.strategy = Uniform
def add(self, client: Client) -> Dict[Resource, Client]:
"""Add client reallocating resources accordingly."""
self.clients.append(client)
return self.allocate()
def revoke(self, client: Client) -> Dict[Resource, Client]:
"""Revoke client's claims reallocating resources accordingly."""
self.clients.remove(client)
return self.allocate()
def allocate(self) -> Dict[Client, List[Resource]]:
"""Perform allocation based on selected strategy."""
new_allocation = {}
for _ in self.get_claimed_resources():
claims = self.get_open_claims(new_allocation.keys())
served_resource, served_client = self.strategy(
claims, new_allocation).pick_pair()
new_allocation[served_resource] = served_client
return self.reassign(new_allocation)
def reassign(self, new_allocation) -> Dict[Resource, Client]:
"""Perform mutable reassignation on existing allocation."""
diff = (k for k in set(
list(self.allocation.keys()) + list(new_allocation.keys()))
if self.allocation.get(k) != new_allocation.get(k))
for resource in diff:
if resource in self.allocation:
del self.allocation[resource]
if resource in new_allocation:
self.allocation[resource] = new_allocation.get(resource)
return self.allocation
def get_open_claims(self, excluded_resources) -> List[Client, List[Resource]]:
"""Get current claims without "excluded_resources"."""
claims = ((client, [
resource for resource in client.claimed
if resource not in excluded_resources
]) for client in self.clients)
return [(client, resources) for client, resources in claims
if len(resources)]
def get_claimed_resources(self) -> Set[Resource]:
"""Get resources claimed by current clients."""
return set(
resource for client in self.clients for resource in client.claimed)
| [
"tema@klochko.ru"
] | tema@klochko.ru |
cc6ca42fe150c046f0bd7f787c2c723fa62afe64 | c00e650b7e10a59bc4193aa2e9cbd7f01abd24d6 | /service/modules/synthetic-data-module/mwem/mwem.py | 9c7be7e026270139d04096f0ca9240f764e59029 | [] | no_license | sliwhu/whitenoise-system | b4b92c68ea594f9d82014545a2655620c3249a1c | 2c1e6d9102125638d927ed2ef9ac3e86fce18fc1 | refs/heads/master | 2022-04-21T06:42:22.902595 | 2020-04-21T17:44:11 | 2020-04-21T17:44:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 12,333 | py | import sys
import os
import math
import random
import numpy as np
import pandas as pd
from sdgym.synthesizers.base import BaseSynthesizer
class MWEMSynthesizer(BaseSynthesizer):
"""
N-Dimensional numpy implementation of MWEM.
(http://users.cms.caltech.edu/~katrina/papers/mwem-nips.pdf)
From the paper:
"[MWEM is] a broadly applicable, simple, and easy-to-implement algorithm, capable of
substantially improving the performance of linear queries on many realistic datasets...
(circa 2012)...MWEM matches the best known and nearly
optimal theoretical accuracy guarantees for differentially private
data analysis with linear queries."
Linear queries used for sampling in this implementation are
random contiguous slices of the n-dimensional numpy array.
"""
def __init__(self, Q_count=400, epsilon=3.0, iterations=30, mult_weights_iterations=20):
self.Q_count = Q_count
self.epsilon = epsilon
self.iterations = iterations
self.mult_weights_iterations = mult_weights_iterations
self.synthetic_data = None
self.data_bins = None
self.real_data = None
def fit(self, data, categorical_columns=tuple(), ordinal_columns=tuple()):
"""
Creates a synthetic histogram distribution, based on the original data.
Follows sdgym schema to be compatible with their benchmark system.
:param data: Dataset to use as basis for synthetic data
:type data: np.ndarray
:param categorical_columns: TODO: Add support
:type categorical_columns: iterable
:param ordinal_columns: TODO: Add support
:type ordinal_columns: iterable
:return: synthetic data, real data histograms
:rtype: np.ndarray
"""
if isinstance(data, np.ndarray):
self.data = data.copy()
else:
raise ValueError("Data must be a numpy array.")
# NOTE: Limitation of ndarrays given histograms with large dims/many dims
# (>10 dims, dims > 100) or datasets with many samples
# TODO: Dimensional split
# Compose MWEM according to splits in data/dimensions
# Curious to see if this methodology yields similar datasets
# to noraml n-dim compositions
# TODO: Figure out if we need to divide the budget by splits
# to achieve DP
self.histogram, self.dimensions, self.data_bins = self.histogram_from_data_attributes(self.data)
self.Q = self.compose_arbitrary_slices(self.Q_count, self.dimensions)
# TODO: Add special support for categorical+ordinal columns
# Run the algorithm
self.synthetic_data, self.real_data = self.mwem()
def sample(self, samples):
"""
Creates samples from the histogram data.
Follows sdgym schema to be compatible with their benchmark system.
:param samples: Number of samples to generate
:type samples: int
:return: N samples
:rtype: list(np.ndarray)
"""
fake = self.synthetic_data
s = []
fake_indices = np.arange(len(np.ravel(fake)))
fake_distribution = np.ravel(fake)
norm = np.sum(fake)
for _ in range(samples):
s.append(np.random.choice(fake_indices, p=(fake_distribution/norm)))
s_unraveled = []
for ind in s:
s_unraveled.append(np.unravel_index(ind,fake.shape))
return s_unraveled
def mwem(self):
"""
Runner for the mwem algorithm.
Initializes the synthetic histogram, and updates it
for self.iterations using the exponential mechanism and
multiplicative weights. Draws from the initialized query store
for measurements.
:return: A, self.histogram - A is the synthetic data histogram, self.histogram is original histo
:rtype: np.ndarray, np.ndarray
"""
A = self.initialize_A(self.histogram, self.dimensions)
measurements = {}
for i in range(self.iterations):
print("Iteration: " + str(i))
qi = self.exponential_mechanism(self.histogram, A, self.Q, (self.epsilon / (2*self.iterations)))
# Make sure we get a different query to measure:
while(qi in measurements):
qi = self.exponential_mechanism(self.histogram, A, self.Q, (self.epsilon / (2*self.iterations)))
# NOTE: Add laplace noise here with budget
evals = self.evaluate(self.Q[qi], self.histogram)
lap = self.laplace((2*self.iterations)/(self.epsilon*len(self.dimensions)))
measurements[qi] = evals + lap
# Improve approximation with Multiplicative Weights
A = self.multiplicative_weights(A, self.Q, measurements, self.histogram, self.mult_weights_iterations)
return A, self.histogram
def initialize_A(self, histogram, dimensions):
"""
Initializes a uniform distribution histogram from
the given histogram with dimensions
:param histogram: Reference histogram
:type histogram: np.ndarray
:param dimensions: Reference dimensions
:type dimensions: np.ndarray
:return: New histogram, uniformly distributed according to
reference histogram
:rtype: np.ndarray
"""
# NOTE: Could actually use a distribution from real data with some budget,
# as opposed to using this uniform dist (would take epsilon as argument,
# and detract from it)
n = np.sum(histogram)
value = n/np.prod(dimensions)
A = np.zeros_like(histogram)
A += value
return A
def histogram_from_data_attributes(self, data):
"""
Create a histogram from given data
:param data: Reference histogram
:type data: np.ndarray
:return: Histogram over given data, dimensions,
bins created (output of np.histogramdd)
:rtype: np.ndarray, np.shape, np.ndarray
"""
mins_data = []
maxs_data = []
dims_sizes = []
# Transpose for column wise iteration
for column in data.T:
min_c = min(column) ; max_c = max(column)
mins_data.append(min_c)
maxs_data.append(max_c)
# Dimension size (number of bins)
dims_sizes.append(max_c-min_c+1)
# Produce an N,D dimensional histogram, where
# we pre-specify the bin sizes to correspond with
# our ranges above
histogram, bins = np.histogramdd(data, bins=dims_sizes)
# Return histogram, dimensions
return histogram, dims_sizes, bins
def exponential_mechanism(self, hist, A, Q, eps):
"""
Refer to paper for in depth description of
Exponential Mechanism.
Parametrized with epsilon value epsilon/2 * iterations
:param hist: Basis histogram
:type hist: np.ndarray
:param A: Synthetic histogram
:type A: np.ndarray
:param Q: Queries to draw from
:type Q: list
:param eps: Budget
:type eps: float
:return: # of errors
:rtype: int
"""
errors = np.zeros(len(Q))
for i in range(len(errors)):
errors[i] = eps * abs(self.evaluate(Q[i], hist)-self.evaluate(Q[i], A))/2.0
maxi = max(errors)
for i in range(len(errors)):
errors[i] = math.exp(errors[i] - maxi)
uni = np.sum(errors) * random.random()
for i in range(len(errors)):
uni -= errors[i]
if uni <= 0.0:
return i
return len(errors) - 1
def multiplicative_weights(self, A, Q, m, hist, iterate):
"""
Multiplicative weights update algorithm,
used to boost the synthetic data accuracy given measurements m.
Run for iterate times
:param A: Synthetic histogram
:type A: np.ndarray
:param Q: Queries to draw from
:type Q: list
:param m: Measurements taken from real data for each qi query
:type m: dict
:param hist: Basis histogram
:type hist: np.ndarray
:param iterate: Number of iterations to run mult weights
:type iterate: iterate
:return: A
:rtype: np.ndarray
"""
sum_A = np.sum(A)
for _ in range(iterate):
for qi in m:
error = m[qi] - self.evaluate(Q[qi], A)
# Perform the weights update
query_update = self.replace_in_place_slice(np.zeros_like(A.copy()), Q[qi])
# Apply the update
A_multiplier = np.exp(query_update * error/(2.0 * sum_A))
A_multiplier[A_multiplier == 0.0] = 1.0
A = A * A_multiplier
# Normalize again
count_A = np.sum(A)
A = A * (sum_A/count_A)
return A
def compose_arbitrary_slices(self, num_s, dimensions):
"""
Here, dimensions is the shape of the histogram
We want to return a list of length num_s, containing
random slice objects, given the dimensions
These are our linear queries
:param num_s: Number of queries (slices) to generate
:type num_s: int
:param dimensions: Dimensions of histogram to be sliced
:type dimensions: np.shape
:return: Collection of random np.s_ (linear queries) for
a dataset with dimensions
:rtype: list
"""
slices_list = []
# TODO: For analysis, generate a distribution of slice sizes,
# by running the list of slices on a dimensional array
# and plotting the bucket size
slices_list = []
for _ in range(num_s):
inds = []
for _,s in np.ndenumerate(dimensions):
# Random linear sample, within dimensions
a = np.random.randint(s)
b = np.random.randint(s)
l_b = min(a,b) ; u_b = max(a,b) + 1
pre = []
pre.append(l_b)
pre.append(u_b)
inds.append(pre)
# Compose slices
sl = []
for ind in inds:
sl.append(np.s_[ind[0]:ind[1]])
slices_list.append(sl)
return slices_list
def evaluate(self, a_slice, data):
"""
Evaluate a count query i.e. an arbitrary slice
:param a_slice: Random slice within bounds of flattened data length
:type a_slice: np.s_
:param data: Data to evaluate from (synthetic dset)
:type data: np.ndarray
:return: Count from data within slice
:rtype: float
"""
# We want to count the number of objects in an
# arbitrary slice of our collection
# We use np.s_[arbitrary slice] as our queries
e = data.T[a_slice]
if isinstance(e, np.ndarray):
return np.sum(e)
else:
return e
def replace_in_place_slice(self, data, a_slice):
"""
We want to create a binary copy of the data,
so that we can easily perform our error multiplication
in MW. Convenience function.
:param data: Data
:type data: np.ndarray
:param a_slice: Slice
:type a_slice: np.s_
:return: Return data, where the range specified
by a_slice is all 1s.
:rtype: np.ndarray
"""
view = data.copy()
view.T[a_slice] = 1.0
return view
def laplace(self, sigma):
"""
Laplace mechanism
:param sigma: Laplace scale param sigma
:type sigma: float
:return: Random value from laplace distribution [-1,1]
:rtype: float
"""
return sigma * np.log(random.random()) * np.random.choice([-1, 1]) | [
"noreply@github.com"
] | noreply@github.com |
92bde3c61aab38dc2a47c8d79f88291081c5d5f1 | cebe19676bf9cddffefa6acfe5e8c2cfa67b0e29 | /qa/rpc-tests/proxy_test.py | 953d08ca244ff0ff2d1c7230ccd67d5b0eb29cd9 | [
"MIT"
] | permissive | topcryptomob/diversex | d6d65fcf85be51d04060e18422a27c6f1dd1968b | 362f8772e560a4d5ada1b1513be4c7eeaf692749 | refs/heads/master | 2020-04-06T08:02:31.278315 | 2018-11-12T09:02:40 | 2018-11-12T09:02:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 6,084 | py | #!/usr/bin/env python2
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import socket
import traceback, sys
from binascii import hexlify
import time, os
from socks5 import Socks5Configuration, Socks5Command, Socks5Server, AddressType
from test_framework import BitcoinTestFramework
from util import *
'''
Test plan:
- Start bitcoind's with different proxy configurations
- Use addnode to initiate connections
- Verify that proxies are connected to, and the right connection command is given
- Proxy configurations to test on bitcoind side:
- `-proxy` (proxy everything)
- `-onion` (proxy just onions)
- `-proxyrandomize` Circuit randomization
- Proxy configurations to test on proxy side,
- support no authentication (other proxy)
- support no authentication + user/pass authentication (Tor)
- proxy on IPv6
- Create various proxies (as threads)
- Create bitcoinds that connect to them
- Manipulate the bitcoinds using addnode (onetry) an observe effects
addnode connect to IPv4
addnode connect to IPv6
addnode connect to onion
addnode connect to generic DNS name
'''
class ProxyTest(BitcoinTestFramework):
def __init__(self):
# Create two proxies on different ports
# ... one unauthenticated
self.conf1 = Socks5Configuration()
self.conf1.addr = ('127.0.0.1', 13000 + (os.getpid() % 1000))
self.conf1.unauth = True
self.conf1.auth = False
# ... one supporting authenticated and unauthenticated (Tor)
self.conf2 = Socks5Configuration()
self.conf2.addr = ('127.0.0.1', 14000 + (os.getpid() % 1000))
self.conf2.unauth = True
self.conf2.auth = True
# ... one on IPv6 with similar configuration
self.conf3 = Socks5Configuration()
self.conf3.af = socket.AF_INET6
self.conf3.addr = ('::1', 15000 + (os.getpid() % 1000))
self.conf3.unauth = True
self.conf3.auth = True
self.serv1 = Socks5Server(self.conf1)
self.serv1.start()
self.serv2 = Socks5Server(self.conf2)
self.serv2.start()
self.serv3 = Socks5Server(self.conf3)
self.serv3.start()
def setup_nodes(self):
# Note: proxies are not used to connect to local nodes
# this is because the proxy to use is based on CService.GetNetwork(), which return NET_UNROUTABLE for localhost
return start_nodes(4, self.options.tmpdir, extra_args=[
['-listen', '-debug=net', '-debug=proxy', '-proxy=%s:%i' % (self.conf1.addr),'-proxyrandomize=1'],
['-listen', '-debug=net', '-debug=proxy', '-proxy=%s:%i' % (self.conf1.addr),'-onion=%s:%i' % (self.conf2.addr),'-proxyrandomize=0'],
['-listen', '-debug=net', '-debug=proxy', '-proxy=%s:%i' % (self.conf2.addr),'-proxyrandomize=1'],
['-listen', '-debug=net', '-debug=proxy', '-proxy=[%s]:%i' % (self.conf3.addr),'-proxyrandomize=0']
])
def node_test(self, node, proxies, auth):
rv = []
# Test: outgoing IPv4 connection through node
node.addnode("15.61.23.23:1234", "onetry")
cmd = proxies[0].queue.get()
assert(isinstance(cmd, Socks5Command))
# Note: bitcoind's SOCKS5 implementation only sends atyp DOMAINNAME, even if connecting directly to IPv4/IPv6
assert_equal(cmd.atyp, AddressType.DOMAINNAME)
assert_equal(cmd.addr, "15.61.23.23")
assert_equal(cmd.port, 1234)
if not auth:
assert_equal(cmd.username, None)
assert_equal(cmd.password, None)
rv.append(cmd)
# Test: outgoing IPv6 connection through node
node.addnode("[1233:3432:2434:2343:3234:2345:6546:4534]:5443", "onetry")
cmd = proxies[1].queue.get()
assert(isinstance(cmd, Socks5Command))
# Note: bitcoind's SOCKS5 implementation only sends atyp DOMAINNAME, even if connecting directly to IPv4/IPv6
assert_equal(cmd.atyp, AddressType.DOMAINNAME)
assert_equal(cmd.addr, "1233:3432:2434:2343:3234:2345:6546:4534")
assert_equal(cmd.port, 5443)
if not auth:
assert_equal(cmd.username, None)
assert_equal(cmd.password, None)
rv.append(cmd)
# Test: outgoing onion connection through node
node.addnode("youraddress.onion:1981", "onetry")
cmd = proxies[2].queue.get()
assert(isinstance(cmd, Socks5Command))
assert_equal(cmd.atyp, AddressType.DOMAINNAME)
assert_equal(cmd.addr, "youraddress.onion")
assert_equal(cmd.port, 1981)
if not auth:
assert_equal(cmd.username, None)
assert_equal(cmd.password, None)
rv.append(cmd)
# Test: outgoing DNS name connection through node
node.addnode("node.noumenon:8333", "onetry")
cmd = proxies[3].queue.get()
assert(isinstance(cmd, Socks5Command))
assert_equal(cmd.atyp, AddressType.DOMAINNAME)
assert_equal(cmd.addr, "node.noumenon")
assert_equal(cmd.port, 8333)
if not auth:
assert_equal(cmd.username, None)
assert_equal(cmd.password, None)
rv.append(cmd)
return rv
def run_test(self):
# basic -proxy
self.node_test(self.nodes[0], [self.serv1, self.serv1, self.serv1, self.serv1], False)
# -proxy plus -onion
self.node_test(self.nodes[1], [self.serv1, self.serv1, self.serv2, self.serv1], False)
# -proxy plus -onion, -proxyrandomize
rv = self.node_test(self.nodes[2], [self.serv2, self.serv2, self.serv2, self.serv2], True)
# Check that credentials as used for -proxyrandomize connections are unique
credentials = set((x.username,x.password) for x in rv)
assert_equal(len(credentials), 4)
# proxy on IPv6 localhost
self.node_test(self.nodes[3], [self.serv3, self.serv3, self.serv3, self.serv3], False)
if __name__ == '__main__':
ProxyTest().main()
| [
"jackkdev@protonmail.com"
] | jackkdev@protonmail.com |
a4606cf74738347229e2423074a0eab57eddb3ef | acb8e84e3b9c987fcab341f799f41d5a5ec4d587 | /langs/6/ow1.py | ff3594bcc2829e13cbb5c24ef13111ffb291b242 | [] | no_license | G4te-Keep3r/HowdyHackers | 46bfad63eafe5ac515da363e1c75fa6f4b9bca32 | fb6d391aaecb60ab5c4650d4ae2ddd599fd85db2 | refs/heads/master | 2020-08-01T12:08:10.782018 | 2016-11-13T20:45:50 | 2016-11-13T20:45:50 | 73,624,224 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 486 | py | import sys
def printFunction(lineRemaining):
if lineRemaining[0] == '"' and lineRemaining[-1] == '"':
if len(lineRemaining) > 2:
#data to print
lineRemaining = lineRemaining[1:-1]
print ' '.join(lineRemaining)
else:
print
def main(fileName):
with open(fileName) as f:
for line in f:
data = line.split()
if data[0] == 'oW1':
printFunction(data[1:])
else:
print 'ERROR'
return
if __name__ == '__main__':
main(sys.argv[1]) | [
"juliettaylorswift@gmail.com"
] | juliettaylorswift@gmail.com |
6e210328858f6452857a8f09f3486b78b2ddc68c | 51fba32aca3114a6897e11b271ee29d3b038056c | /tests/08_test_patch.py | bc9a507c707597c9dbc29ad814635d12538e8e77 | [] | no_license | lamby/git-buildpackage | b2fbf08b93ed0520c8e5ba0c3eb66f15d7a64a41 | c4bc6561c788f71b5131d0bd8e92478e83808200 | refs/heads/master | 2021-01-02T23:04:26.941635 | 2017-08-05T23:46:58 | 2017-08-06T00:55:37 | 75,486,665 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,450 | py | # vim: set fileencoding=utf-8 :
"""Test L{Patch} class"""
from . import context # noqa: 401
import os
import unittest
from gbp.patch_series import Patch
class TestPatch(unittest.TestCase):
data_dir = os.path.splitext(__file__)[0] + '_data'
def test_filename(self):
"""Get patch information from the filename"""
p = Patch(os.path.join(self.data_dir, "doesnotexist.diff"))
self.assertEqual('doesnotexist', p.subject)
self.assertEqual({}, p.info)
p = Patch(os.path.join(self.data_dir, "doesnotexist.patch"))
self.assertEqual('doesnotexist', p.subject)
p = Patch(os.path.join(self.data_dir, "doesnotexist"))
self.assertEqual('doesnotexist', p.subject)
self.assertEqual(None, p.author)
self.assertEqual(None, p.email)
self.assertEqual(None, p.date)
def test_header(self):
"""Get the patch information from a patch header"""
patchfile = os.path.join(self.data_dir, "patch1.diff")
self.assertTrue(os.path.exists(patchfile))
p = Patch(patchfile)
self.assertEqual('This is patch1', p.subject)
self.assertEqual("foo", p.author)
self.assertEqual("foo@example.com", p.email)
self.assertEqual("This is the long description.\n"
"It can span several lines.\n",
p.long_desc)
self.assertEqual('Sat, 24 Dec 2011 12:05:53 +0100', p.date)
| [
"agx@sigxcpu.org"
] | agx@sigxcpu.org |
87b0dd6e888af9135133eca50579aa63daaeb18a | 27edc5b2c5d3475e119d89ebe8a39ca62ec33376 | /Injection Interface (Python)/ui_mod.py | 693f52cf39b2f4ac8f9d61c19c675ce7cd8ad466 | [] | no_license | Marti-R/Portfolio | c407c4cf90c46877c78c1dcc73cf4d7bdee50392 | 57bb84b242c7fc98b0470f6110c9b196524070b5 | refs/heads/main | 2023-08-28T10:22:55.219520 | 2021-10-19T11:40:37 | 2021-10-19T11:40:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 7,670 | py | from brainrender_gui.ui import UI
from brainrender_gui.style import style, tree_css, update_css
from brainrender_gui_mod.style_mod import additional_styles
from PyQt5.Qt import Qt
from qtpy.QtWidgets import (
QLabel,
QVBoxLayout,
QPushButton,
QWidget,
QHBoxLayout,
QSlider,
QCheckBox,
QSplitter,
)
class UIMod(UI):
hemisphere_names = {1: "right", 2: "left"}
def __init__(self, **kwargs):
# MODIFIED: Hide the top root node, this prevents the user from ever removing all actors,
# and then trying to set properties
self.treeView.setRootIndex(self.treeView.model().index(0, 0))
# ADDED: Fill the status bar with the controls and a button to show the credits
status_bar_splitter = QSplitter(Qt.Horizontal)
self.status_bar_position = QLabel("Welcome to the injection interface prototype!")
self.status_bar_position.setObjectName("PropertyName")
status_bar_splitter.addWidget(self.status_bar_position)
self.status_bar_location = QLabel("Controls: 9/3 = Up/Down, 4/6 = Left/Right, 8/2 = Forward/Backward")
self.status_bar_location.setObjectName("PropertyName")
status_bar_splitter.addWidget(self.status_bar_location)
status_bar_splitter.setSizes([1, 1])
self.statusBar().addWidget(status_bar_splitter)
btn = QPushButton('Credits', self)
btn.setObjectName('CreditsButton')
btn.clicked.connect(self.open_credits_dialog)
self.statusBar().addPermanentWidget(btn)
self.label_checkbox.clicked.connect(self.toggle_label)
self.auto_clip_checkbox.clicked.connect(self.toggle_auto_clip)
# TODO: Have to fix the original style sheet somehow
self.treeView.setStyleSheet(update_css(tree_css, self.palette))
self.statusBar().setStyleSheet(update_css(style + additional_styles, self.palette))
self.actor_menu.setStyleSheet(update_css(style + additional_styles, self.palette))
# Doing this once loads the atlas, and reduces later calls to this and similar functions
self.scene.atlas.structure_from_coords((0, 0, 0))
def initUI(self):
super(UIMod, self).initUI()
# MODIFIED: set the right navbar to a property so it can be toggled
self.actor_menu = self.centralWidget().children()[1].children()[0]
# ADDED: actor menu is hidden by default
self.actor_menu.setHidden(True)
# ADDED: Top menu bar with two buttons, previous widget gets added below the new top menu
def make_central_column(self):
central_column = super().make_central_column()
layout = QVBoxLayout()
hlayout = QHBoxLayout()
btn = QPushButton('Show structures tree', self)
btn.setObjectName('new_show_structures_tree')
self.buttons['new_show_structures_tree'] = btn
hlayout.addWidget(btn)
btn = QPushButton('Show actor menu', self)
btn.setObjectName('show_actor_menu')
self.buttons['show_actor_menu'] = btn
hlayout.addWidget(btn)
widget = QWidget()
widget.setObjectName("Top_buttons")
widget.setLayout(hlayout)
layout.addWidget(widget)
layout.addWidget(central_column)
widget = QWidget()
widget.setObjectName("NewCentralColumn")
widget.setLayout(layout)
return widget
def make_right_navbar(self):
navbar_widget = super().make_right_navbar()
navbar_layout = navbar_widget.layout()
# Delete the last 3 elements, which are the old toggle for the treeview, its label, and the final spacer
# Reverse order, since we take always the last item
spacer = navbar_layout.takeAt(navbar_layout.count() - 1)
structure_tree_button = navbar_layout.takeAt(navbar_layout.count() - 1)
structure_tree_button.widget().setParent(None)
structure_tree_button_label = navbar_layout.takeAt(navbar_layout.count() - 1)
structure_tree_button_label.widget().setParent(None)
del structure_tree_button_label, structure_tree_button, spacer
self.label_checkbox = QCheckBox("Show Label")
self.label_checkbox.setTristate(on=False)
navbar_layout.addWidget(self.label_checkbox)
# Add label
lbl = QLabel("Clipping")
lbl.setObjectName("LabelWithBorder")
navbar_layout.addWidget(lbl)
self.auto_clip_checkbox = QCheckBox("Auto-Clip")
self.auto_clip_checkbox.setTristate(on=False)
self.auto_clip_checkbox.setChecked(True)
navbar_layout.addWidget(self.auto_clip_checkbox)
prop_lbl = QLabel("Reference point")
prop_lbl.setObjectName("PropertyName")
navbar_layout.addWidget(prop_lbl)
# ADDED: Button to change the clipping reference point
btn = QPushButton('Brain', self)
btn.setObjectName('switch_reference_point')
self.buttons['switch_reference_point'] = btn
navbar_layout.addWidget(btn)
# Add label
lbl = QLabel("Injection")
lbl.setObjectName("LabelWithBorder")
navbar_layout.addWidget(lbl)
self.injection_label = QLabel(f"Injection volume: {0 : 3} nl")
self.injection_label.setObjectName("PropertyName")
navbar_layout.addWidget(self.injection_label)
self.injection_slider = QSlider(Qt.Horizontal, self)
self.injection_slider.setRange(0, 500)
self.injection_slider.setFocusPolicy(Qt.NoFocus)
self.injection_slider.setPageStep(5)
navbar_layout.addWidget(self.injection_slider)
# add a stretch
navbar_layout.addStretch()
return navbar_widget
def toggle_label(self):
aname = self.actors_list.currentItem().text()
checked = self.label_checkbox.isChecked()
# Toggle checkbox
if not checked:
self.store[aname]['Label'].VisibilityOff()
else:
self.store[aname]['Label'].VisibilityOn()
# Fake a button press to force canvas update
self.scene.plotter.interactor.MiddleButtonPressEvent()
self.scene.plotter.interactor.MiddleButtonReleaseEvent()
def toggle_auto_clip(self):
self.auto_clip = self.auto_clip_checkbox.isChecked()
if self.auto_clip:
self.update_clippers()
def update_status_bar(self):
# get location of the pipette tip
pipette_tip_position = self.pipette_dict['pipette'].polydata().GetPoint(self.pipette_dict['pipette_tip_id'])
# compare this to bregma
relative_position = [a-b for a, b in zip(pipette_tip_position, self.pipette_dict['bregma'])]
# Write the position to the status bar
self.status_bar_position.setText(f"Bregma: {round(-relative_position[0] / 1000, 2):.2f}, "
f"{'Left' if relative_position[2] < 0 else 'Right'}:"
f"{round(abs(relative_position[2]) / 1000, 2):.2f}, "
f"Depth: {round(relative_position[1] / 1000, 2):.2f} (in mm)")
# Fetch region and hemisphere
try:
region = self.scene.atlas.structure_from_coords(pipette_tip_position, microns=True)
hemisphere = self.scene.atlas.hemisphere_from_coords(pipette_tip_position, microns=True)
self.status_bar_location.setText(f"Region: {self.scene.atlas.structures[region]['acronym']}, "
f"Hemisphere: {self.hemisphere_names[hemisphere]}")
except (IndexError, KeyError):
self.status_bar_location.setText(f"Region and Hemisphere not available")
| [
"84347817+Marti-Ritter@users.noreply.github.com"
] | 84347817+Marti-Ritter@users.noreply.github.com |
9f8cd500280b144936498b1f6ab5a4dfed1edcd6 | c91453e9b4b9e9ce30c493d3cc85407d07495ef6 | /DatesAndDateTime/dateandtime.py | d9f42647077137bd50f4bdadf33e450fd94f6049 | [] | no_license | lopez1941/PythonMasterClassRepo | 9e1f9d75a2c1d1d3c6a888cc31b0c3face6c4f64 | 496b96ffef07f399f28f0befc6b45c4c9b88ad36 | refs/heads/master | 2021-09-05T01:50:51.126805 | 2018-01-23T15:49:45 | 2018-01-23T15:49:45 | 103,982,028 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 717 | py | # import time
#
# print(" the epoch starts at " + time.strftime('%c', time.gmtime(0)))
#
# print("the current time zone is {0} with an offset of {1}".format(time.tzname[0], time.timezone))
#
# if time.daylight != 0:
# print("\tDaylight savings time is in effect for this location.")
# print("\tThe DST timezone is " + time.tzname[1])
#
# print("Local time is " + time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()))
# print("UTC time is " + time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime()))
import datetime
time_local = datetime.datetime.now()
print("local time is {}".format(time_local.strftime('%x %X')))
print(datetime.datetime.today())
print(datetime.datetime.now())
print(datetime.datetime.utcnow())
| [
"guitarlopez33@gmail.com"
] | guitarlopez33@gmail.com |
9f076e5aa69d46acb53e4921041dfcdee801ca2a | 25be67640c1465739dd86dcc15ea731c17bcf649 | /gre/__init__.py | 7cf781d076c0ae70272c9c343c9f1e33234320d1 | [] | no_license | Henry-Ding/DPMPN_pytorch | 47fa08cca0a8083909a009f21b6435a726cdf690 | 5cff58b59c257d004b14d240c5bef08aa942d0ce | refs/heads/master | 2022-03-05T04:58:16.486540 | 2019-11-18T15:07:11 | 2019-11-18T15:07:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 350 | py | from gre.graph_generator import LoadedGraph
from gre.graph_accessor import GraphAccessor
from gre.long_memory import LongMemory, NodeParams, ETypeParams, GlobalParams
from gre.short_memory import ShortMemory, NodeStates, EdgeStates, GlobalStates
from gre.attention_tracker import AttentionTracker, Attention, Transition
from gre.engine import Engine
| [
"seanxu.sophie@gmail.com"
] | seanxu.sophie@gmail.com |
8f92110063549bf47b136000dd1e24bb6f6d7cd6 | 98105e224decb9e699acd74b66872597b3a30731 | /depth_maps/src/solve.py | 616e8038e3e36f4b0ae28b756b2b5b690ef4e212 | [] | no_license | Hackmas/problems | 6c1458eae6b243a65c2a6f3a3b5abdc9113639d6 | 54cd659bfcbd0e975511dc4c721eca8d720582f2 | refs/heads/master | 2021-03-22T02:13:00.965062 | 2018-03-31T12:55:15 | 2018-03-31T12:55:15 | 116,677,612 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 722 | py | #!/bin/python3
import sys
def check_cavity(x,y,grid):
cur_depth = grid[x][y]
up = grid[x][y-1] < cur_depth
down = grid[x][y+1] < cur_depth
left = grid[x+1][y] < cur_depth
right = grid[x-1][y] < cur_depth
return up and down and left and right
n = int(input().strip())
grid = []
cavities = []
grid_i = 0
for grid_i in range(n):
grid_t = str(input().strip())
grid.append(grid_t)
for x in range(1,n-1):
for y in range(1,n-1):
if check_cavity(x,y,grid):
cavities.append((x,y))
for point in cavities:
x,y = point
temp_lst = list(grid[x])
temp_lst[y] = 'X'
grid[x] = ''.join(temp_lst)
for line in grid:
print(line) | [
"Nikolas.papaioannou@gmail.com"
] | Nikolas.papaioannou@gmail.com |
d6b285050d6afe90f5a4158973231257038ce33f | 9657137623c998e5267344fa4ba309be4529bb0e | /pyapinizer/tornado.py | 8f07d3f7152ac13289d3f6befccf2db3fbce0ef6 | [
"MIT"
] | permissive | osoken/pyapinizer | 386a086307cec294053f1634345a86614d405a78 | 785f57ff80be239f91a66dfec3ba9ce4a78a9a50 | refs/heads/master | 2021-01-12T09:22:46.837366 | 2016-12-11T15:05:57 | 2016-12-11T15:05:57 | 76,154,718 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 315 | py | # -*- coding: utf-8 -*-
import json
from tornado.web import RequestHandler
def generate_handler(func):
class Handler(RequestHandler):
def get(self, *args, **kwargs):
argdict = dict(kwargs, **self.request.arguments)
json.dump(func(*args, **argdict), self)
return Handler
| [
"osoken.devel@outlook.jp"
] | osoken.devel@outlook.jp |
e33e0f183ff2a1f715c25c82811542ba69e19bf1 | c9cdd3145189c4655aa5a08f900864e4233bdb3d | /racers/migrations/0005_auto__add_field_racer_team.py | dd1429c1538cb76ce4785127057421cc748283ed | [] | no_license | dougsuriano/checkpoint | 97f5ed88891870059f021d964aa97ea26e04524d | feb10875c0976e0e1583a0cd51e08804194c10d7 | refs/heads/master | 2021-01-01T18:55:36.494132 | 2016-10-18T01:31:31 | 2016-10-18T01:31:31 | 12,650,891 | 1 | 1 | null | null | null | null | UTF-8 | Python | false | false | 1,642 | py | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Racer.team'
db.add_column(u'racers_racer', 'team',
self.gf('django.db.models.fields.CharField')(default='', max_length=100, blank=True),
keep_default=False)
def backwards(self, orm):
# Deleting field 'Racer.team'
db.delete_column(u'racers_racer', 'team')
models = {
u'racers.racer': {
'Meta': {'object_name': 'Racer'},
'category': ('django.db.models.fields.IntegerField', [], {}),
'city': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'gender': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'nick_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'racer_number': ('django.db.models.fields.IntegerField', [], {'unique': 'True'}),
'team': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
}
}
complete_apps = ['racers'] | [
"doug@hoteltonight.com"
] | doug@hoteltonight.com |
71a9861fe82b7b137692a7b04995fd0e65e94386 | cd74536f746d8475da02356a4ad5ee76ac18a55c | /fuzzy.py | ec7ff3e97c29699b62c48f04a406024ab114e07c | [
"MIT"
] | permissive | nmalaguti/python-fuzzyhash | 3330abd33a6a3f5e371f22729ff36620e9027d4b | e7877565e64fb3278bb54c6cdc5f40e9ac3b4bae | refs/heads/master | 2021-01-25T10:39:11.798875 | 2014-07-07T12:52:20 | 2014-07-07T12:52:20 | 21,570,218 | 3 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,527 | py | import random
import zlib
import hashlib
import math
base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
S = 64
def md5hex(arr):
m = hashlib.md5()
m.update(str(bytearray(arr)))
return m.hexdigest()
def sha1hex(arr):
m = hashlib.sha1()
m.update(str(bytearray(arr)))
return m.hexdigest()
def stronghash(arr):
return int(sha1hex(arr), 16)
def tobase64(num):
return base64[num % 64]
def tochar(arr):
return tobase64(stronghash(arr))
def generaterandombuffer(size):
return [random.randint(0, 255) for x in xrange(size)]
def dld(s1, s2, c):
"""damerau-levenshtein distance"""
inf = len(s1) + len(s2)
da = [0] * c
h = [[0 for x in xrange(len(s2) + 2)] for x in xrange(len(s1) + 2)]
h[0][0] = inf
for i in xrange(len(s1) + 1):
h[i+1][0] = inf
h[i+1][1] = i
for i in xrange(len(s2) + 1):
h[0][i+1] = inf
h[1][i+1] = i
for i in xrange(1, len(s1) + 1):
db = 0
for j in xrange(1, len(s2) + 1):
i1 = da[base64.index(s2[j-1])]
j1 = db
if s1[i-1] == s2[j-1]:
d = 0
else:
d = 1
if d == 0:
db = j
m = min([(h[i ][j ] + d, d * 2), # subsitution
(h[i+1][j ] + 1, 0 ), # insertion
(h[i ][j+1] + 1, 0 ), # deletion
(h[i1 ][j1 ] + (i - i1 - 1) + 1 + (j - j1 - 1), 4)])
h[i+1][j+1] = m[0] + m[1]
da[base64.index(s1[i-1])] = i;
e = min([h[len(s1) + 1][len(s2) + 1], (len(s1) + len(s2))])
return 100 - ((100 * e) / (len(s1) + len(s2)))
class ssadler:
def __init__(self, size):
self.x = 0;
self.y = 0;
self.z = 0;
self.c = 0;
self.window = [0] * size
self.size = size
def value(self):
return (self.x + self.y + self.z) & 0xffffffff
def update(self, d):
self.y = self.y - self.x
self.y = self.y + self.size * d
self.x = self.x + d
self.x = self.x - self.window[self.c % self.size]
self.window[self.c % self.size] = d
self.c = self.c + 1
self.z = self.z << 5 & 0xffffffff
self.z = self.z ^ d
def getblocksize(n):
bmin = 3
return int(bmin * 2**math.floor(math.log((n/(S*bmin)),2)))
def fuzzyhash(arr):
a = ssadler(7)
s1 = ''
s2 = ''
blocksize = getblocksize(len(arr))
for x in arr:
a.update(x)
if a.value() % blocksize == (blocksize - 1):
s1 += tochar(a.window)
if a.value() % (blocksize * 2) == ((blocksize * 2) - 1):
s2 += tochar(a.window)
return blocksize, s1, s2
bufsize = random.randint(50000, 150000)
buf = generaterandombuffer(bufsize)
b1, v1, _ = fuzzyhash(buf)
def mutate(arr, num):
for x in xrange(num):
arr[random.randint(0, len(arr) - 1)] = random.randint(0, 255)
return arr
for y in [10**z for z in range(2, int(round(math.log(bufsize, 10))))]:
bm, vm, _ = fuzzyhash(mutate(buf[:], y))
print "%d changes %s- diff: %s/100" % (y, (4 - int(round(math.log(y, 10)))) * ' ', dld(v1, vm, S))
midbuf = generaterandombuffer(40000);
bufdiff = buf[:3 * bufsize / 10]
bufdiff.extend(midbuf)
bufdiff.extend(buf[-3 * bufsize / 10:])
bd, vd, _ = fuzzyhash(bufdiff)
print "new middle - diff: %s/100" % (dld(v1, vd, S))
ba, va, _ = fuzzyhash(generaterandombuffer(bufsize))
print "all new - diff: %s/100" % (dld(v1, va, S))
| [
"nmalaguti@gmail.com"
] | nmalaguti@gmail.com |
6e248c7365a903010c866c0f556d026a124c56af | 9c636aeed2fc0a591507fcf0a8a6124fae710c9b | /insertLL.py | 3d8c20f19faad87ef2b54e0fea3e0ad01926eb92 | [] | no_license | ilkaynazli/challenges | 4b2d1ac847b1761f98183457f8ea5bac6556eeff | f7c165fedbdc9811fb7f1d2a43c797f5b5ac5322 | refs/heads/master | 2020-04-07T01:03:18.625568 | 2019-04-25T19:40:22 | 2019-04-25T19:40:22 | 157,928,932 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,640 | py | """
Given a node from a cyclic linked list which is sorted in ascending order, write a function to insert a value into the list such that it remains a cyclic sorted list. The given node can be a reference to any single node in the list, and may not be necessarily the smallest value in the cyclic list.
If there are multiple suitable places for insertion, you may choose any place to insert the new value. After the insertion, the cyclic list should remain sorted.
If the list is empty (i.e., given node is null), you should create a new single cyclic list and return the reference to that single node. Otherwise, you should return the original given node.
"""
"""
# Definition for a Node.
class Node:
def __init__(self, val, next):
self.val = val
self.next = next
"""
class Solution:
def insert(self, head: 'Node', insertVal: 'int') -> 'Node':
new = Node(insertVal, None)
def insert_node(cur, new):
new.next = cur.next
cur.next = new
if head is None:
head = new
return head
current = head
while current:
if (current.val < new.val and current.next.val >= new.val):
insert_node(current, new)
break
if current.next.val < current.val:
if current.next.val >= new.val or current.val < new.val:
insert_node(current, new)
break
current = current.next
if current.next == head:
insert_node(current, new)
break
return head | [
"ilkayncelik@gmail.com"
] | ilkayncelik@gmail.com |
1549dbbffe60bde02cbe4a4dc8ded721bb9ac421 | f56346f16477de58c5483ddbab63d3bff15801c6 | /python_source/graph-tool/example2.py | a7571e1e5d9faf83e8928fe282b25427d72ff25a | [] | no_license | jerryhan88/py_source | ca6afb6582777a444a19e33c832b638fc9e2fd52 | e1500b1d2d4fa5f30e278422c5b1afa1d777f57f | refs/heads/master | 2020-04-06T13:12:34.814275 | 2016-10-06T09:30:50 | 2016-10-06T09:30:50 | 40,874,811 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,517 | py | #! /usr/bin/env python
# We will need some things from several places
from __future__ import division, absolute_import, print_function
import sys
if sys.version_info < (3,):
range = xrange
import os
from pylab import * # for plotting
from numpy.random import * # for random sampling
seed(42)
# We need to import the graph_tool module itself
from graph_tool.all import *
def price_network():
# let's construct a Price network (the one that existed before Barabasi). It is
# a directed network, with preferential attachment. The algorithm below is
# very naive, and a bit slow, but quite simple.
# We start with an empty, directed graph
g = Graph()
# We want also to keep the age information for each vertex and edge. For that
# let's create some property maps
v_age = g.new_vertex_property("int")
e_age = g.new_edge_property("int")
# The final size of the network
N = 100
# We have to start with one vertex
v = g.add_vertex()
v_age[v] = 0
# we will keep a list of the vertices. The number of times a vertex is in this
# list will give the probability of it being selected.
vlist = [v]
# let's now add the new edges and vertices
for i in range(1, N):
# create our new vertex
v = g.add_vertex()
v_age[v] = i
# we need to sample a new vertex to be the target, based on its in-degree +
# 1. For that, we simply randomly sample it from vlist.
i = randint(0, len(vlist))
target = vlist[i]
# add edge
e = g.add_edge(v, target)
e_age[e] = i
# put v and target in the list
vlist.append(target)
vlist.append(v)
# now we have a graph!
# let's do a random walk on the graph and print the age of the vertices we find,
# just for fun.
v = g.vertex(randint(0, g.num_vertices()))
while True:
print("vertex:", int(v), "in-degree:", v.in_degree(), "out-degree:",
v.out_degree(), "age:", v_age[v])
if v.out_degree() == 0:
print("Nowhere else to go... We found the main hub!")
break
n_list = []
for w in v.out_neighbours():
n_list.append(w)
v = n_list[randint(0, len(n_list))]
# let's save our graph for posterity. We want to save the age properties as
# well... To do this, they must become "internal" properties:
g.vertex_properties["age"] = v_age
g.edge_properties["age"] = e_age
# now we can save it
g.save("price.xml.gz")
# Let's plot its in-degree distribution
in_hist = vertex_hist(g, "in")
y = in_hist[0]
err = sqrt(in_hist[0])
err[err >= y] = y[err >= y] - 1e-2
figure(figsize=(6,4))
errorbar(in_hist[1][:-1], in_hist[0], fmt="o", yerr=err,
label="in")
gca().set_yscale("log")
gca().set_xscale("log")
gca().set_ylim(1e-1, 1e5)
gca().set_xlim(0.8, 1e3)
subplots_adjust(left=0.2, bottom=0.2)
xlabel("$k_{in}$")
ylabel("$NP(k_{in})$")
tight_layout()
savefig("price-deg-dist.pdf")
savefig("price-deg-dist.png")
price_network()
g = load_graph("price.xml.gz")
age = g.vertex_properties["age"]
pos = sfdp_layout(g)
graph_draw(g, pos, output_size=(1000, 1000), vertex_color=[1,1,1,0],
vertex_fill_color=age, vertex_size=1, edge_pen_width=1.2,
vcmap=matplotlib.cm.gist_heat_r, output="price.png")
| [
"jerryhan88@gmail.com"
] | jerryhan88@gmail.com |
a74738b3e2b3569b07ca28e1abd673051590d1c8 | 590649b9abb619a99936f087b9d8bb6a548abe9a | /Gui/Clock/clock.py | 2d943be130820f6458dad2ebd0460f633b443e44 | [] | no_license | sperr0w/PP4E | de627d100f9cf1f7aa050c3a9876682dc1af92fb | 18df3332e8d0b68e8bcd299bbb255591687826da | refs/heads/master | 2020-03-19T03:16:44.370209 | 2018-06-01T12:03:28 | 2018-06-01T12:03:28 | 135,710,332 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 11,867 | py | """
###############################################################################
PyClock 2.1: a clock GUI in Python/tkinter.
With both analog and digital display modes, a pop-up date label, clock face
images, general resizing, etc. May be run both standalone, or embedded
(attached) in other GUIs that need a clock.
New in 2.0: s/m keys set seconds/minutes timer for pop-up msg; window icon.
New in 2.1: updated to run under Python 3.X (2.X no longer supported)
###############################################################################
"""
from tkinter import *
from tkinter.simpledialog import askinteger
import math, time, sys
###############################################################################
# Option configuration classes
###############################################################################
class ClockConfig:
# defaults--override in instance or subclass
size = 200 # width=height
bg, fg = 'beige', 'brown' # face, tick colors
hh, mh, sh, cog = 'black', 'navy', 'blue', 'red' # clock hands, center
picture = None # face photo file
class PhotoClockConfig(ClockConfig):
# sample configuration
size = 320
picture = '../gifs/ora-pp.gif'
bg, hh, mh = 'white', 'blue', 'orange'
###############################################################################
# Digital display object
###############################################################################
class DigitalDisplay(Frame):
def __init__(self, parent, cfg):
Frame.__init__(self, parent)
self.hour = Label(self)
self.mins = Label(self)
self.secs = Label(self)
self.ampm = Label(self)
for label in self.hour, self.mins, self.secs, self.ampm:
label.config(bd=4, relief=SUNKEN, bg=cfg.bg, fg=cfg.fg)
label.pack(side=LEFT) # TBD: could expand, and scale font on resize
def onUpdate(self, hour, mins, secs, ampm, cfg):
mins = str(mins).zfill(2) # or '%02d' % x
self.hour.config(text=str(hour), width=4)
self.mins.config(text=str(mins), width=4)
self.secs.config(text=str(secs), width=4)
self.ampm.config(text=str(ampm), width=4)
def onResize(self, newWidth, newHeight, cfg):
pass # nothing to redraw here
###############################################################################
# Analog display object
###############################################################################
class AnalogDisplay(Canvas):
def __init__(self, parent, cfg):
Canvas.__init__(self, parent,
width=cfg.size, height=cfg.size, bg=cfg.bg)
self.drawClockface(cfg)
self.hourHand = self.minsHand = self.secsHand = self.cog = None
def drawClockface(self, cfg): # on start and resize
if cfg.picture: # draw ovals, picture
try:
self.image = PhotoImage(file=cfg.picture) # bkground
except:
self.image = BitmapImage(file=cfg.picture) # save ref
imgx = (cfg.size - self.image.width()) // 2 # center it
imgy = (cfg.size - self.image.height()) // 2 # 3.x // div
self.create_image(imgx+1, imgy+1, anchor=NW, image=self.image)
originX = originY = radius = cfg.size // 2 # 3.x // div
for i in range(60):
x, y = self.point(i, 60, radius-6, originX, originY)
self.create_rectangle(x-1, y-1, x+1, y+1, fill=cfg.fg) # mins
for i in range(12):
x, y = self.point(i, 12, radius-6, originX, originY)
self.create_rectangle(x-3, y-3, x+3, y+3, fill=cfg.fg) # hours
self.ampm = self.create_text(3, 3, anchor=NW, fill=cfg.fg)
def point(self, tick, units, radius, originX, originY):
angle = tick * (360.0 / units)
radiansPerDegree = math.pi / 180
pointX = int( round( radius * math.sin(angle * radiansPerDegree) ))
pointY = int( round( radius * math.cos(angle * radiansPerDegree) ))
return (pointX + originX+1), (originY+1 - pointY)
def onUpdate(self, hour, mins, secs, ampm, cfg): # on timer callback
if self.cog: # redraw hands, cog
self.delete(self.cog)
self.delete(self.hourHand)
self.delete(self.minsHand)
self.delete(self.secsHand)
originX = originY = radius = cfg.size // 2 # 3.x div
hour = hour + (mins / 60.0)
hx, hy = self.point(hour, 12, (radius * .80), originX, originY)
mx, my = self.point(mins, 60, (radius * .90), originX, originY)
sx, sy = self.point(secs, 60, (radius * .95), originX, originY)
self.hourHand = self.create_line(originX, originY, hx, hy,
width=(cfg.size * .04),
arrow='last', arrowshape=(25,25,15), fill=cfg.hh)
self.minsHand = self.create_line(originX, originY, mx, my,
width=(cfg.size * .03),
arrow='last', arrowshape=(20,20,10), fill=cfg.mh)
self.secsHand = self.create_line(originX, originY, sx, sy,
width=1,
arrow='last', arrowshape=(5,10,5), fill=cfg.sh)
cogsz = cfg.size * .01
self.cog = self.create_oval(originX-cogsz, originY+cogsz,
originX+cogsz, originY-cogsz, fill=cfg.cog)
self.dchars(self.ampm, 0, END)
self.insert(self.ampm, END, ampm)
def onResize(self, newWidth, newHeight, cfg):
newSize = min(newWidth, newHeight)
#print('analog onResize', cfg.size+4, newSize)
if newSize != cfg.size+4:
cfg.size = newSize-4
self.delete('all')
self.drawClockface(cfg) # onUpdate called next
###############################################################################
# Clock composite object
###############################################################################
ChecksPerSec = 10 # second change timer
class Clock(Frame):
def __init__(self, config=ClockConfig, parent=None):
Frame.__init__(self, parent)
self.cfg = config
self.makeWidgets(parent) # children are packed but
self.labelOn = 0 # clients pack or grid me
self.display = self.digitalDisplay
self.lastSec = self.lastMin = -1
self.countdownSeconds = 0
self.onSwitchMode(None)
self.onTimer()
def makeWidgets(self, parent):
self.digitalDisplay = DigitalDisplay(self, self.cfg)
self.analogDisplay = AnalogDisplay(self, self.cfg)
self.dateLabel = Label(self, bd=3, bg='red', fg='blue')
parent.bind('<ButtonPress-1>', self.onSwitchMode)
parent.bind('<ButtonPress-3>', self.onToggleLabel)
parent.bind('<Configure>', self.onResize)
parent.bind('<KeyPress-s>', self.onCountdownSec)
parent.bind('<KeyPress-m>', self.onCountdownMin)
def onSwitchMode(self, event):
self.display.pack_forget()
if self.display == self.analogDisplay:
self.display = self.digitalDisplay
else:
self.display = self.analogDisplay
self.display.pack(side=TOP, expand=YES, fill=BOTH)
def onToggleLabel(self, event):
self.labelOn += 1
if self.labelOn % 2:
self.dateLabel.pack(side=BOTTOM, fill=X)
else:
self.dateLabel.pack_forget()
self.update()
def onResize(self, event):
if event.widget == self.display:
self.display.onResize(event.width, event.height, self.cfg)
def onTimer(self):
secsSinceEpoch = time.time()
timeTuple = time.localtime(secsSinceEpoch)
hour, min, sec = timeTuple[3:6]
if sec != self.lastSec:
self.lastSec = sec
ampm = ((hour >= 12) and 'PM') or 'AM' # 0...23
hour = (hour % 12) or 12 # 12..11
self.display.onUpdate(hour, min, sec, ampm, self.cfg)
self.dateLabel.config(text=time.ctime(secsSinceEpoch))
self.countdownSeconds -= 1
if self.countdownSeconds == 0:
self.onCountdownExpire() # countdown timer
self.after(1000 // ChecksPerSec, self.onTimer) # run N times per second
# 3.x // trunc int div
def onCountdownSec(self, event):
secs = askinteger('Countdown', 'Seconds?')
if secs: self.countdownSeconds = secs
def onCountdownMin(self, event):
secs = askinteger('Countdown', 'Minutes')
if secs: self.countdownSeconds = secs * 60
def onCountdownExpire(self):
# caveat: only one active, no progress indicator
win = Toplevel()
msg = Button(win, text='Timer Expired!', command=win.destroy)
msg.config(font=('courier', 80, 'normal'), fg='white', bg='navy')
msg.config(padx=10, pady=10)
msg.pack(expand=YES, fill=BOTH)
win.lift() # raise above siblings
if sys.platform[:3] == 'win': # full screen on Windows
win.state('zoomed')
###############################################################################
# Standalone clocks
###############################################################################
appname = 'PyClock 2.1'
# use new custom Tk, Toplevel for icons, etc.
from Gui.Tools.windows import PopupWindow, MainWindow
class ClockPopup(PopupWindow):
def __init__(self, config=ClockConfig, name=''):
PopupWindow.__init__(self, appname, name)
clock = Clock(config, self)
clock.pack(expand=YES, fill=BOTH)
class ClockMain(MainWindow):
def __init__(self, config=ClockConfig, name=''):
MainWindow.__init__(self, appname, name)
clock = Clock(config, self)
clock.pack(expand=YES, fill=BOTH)
# b/w compat: manual window borders, passed-in parent
class ClockWindow(Clock):
def __init__(self, config=ClockConfig, parent=None, name=''):
Clock.__init__(self, config, parent)
self.pack(expand=YES, fill=BOTH)
title = appname
if name: title = appname + ' - ' + name
self.master.title(title) # master=parent or default
self.master.protocol('WM_DELETE_WINDOW', self.quit)
###############################################################################
# Program run
###############################################################################
if __name__ == '__main__':
def getOptions(config, argv):
for attr in dir(ClockConfig): # fill default config obj,
try: # from "-attr val" cmd args
ix = argv.index('-' + attr) # will skip __x__ internals
except:
continue
else:
if ix in range(1, len(argv)-1):
if type(getattr(ClockConfig, attr)) == int:
setattr(config, attr, int(argv[ix+1]))
else:
setattr(config, attr, argv[ix+1])
#config = PhotoClockConfig()
config = ClockConfig()
if len(sys.argv) >= 2:
getOptions(config, sys.argv) # clock.py -size n -bg 'blue'...
#myclock = ClockWindow(config, Tk()) # parent is Tk root if standalone
#myclock = ClockPopup(ClockConfig(), 'popup')
myclock = ClockMain(config)
myclock.mainloop()
| [
"sprutskih@gmail.com"
] | sprutskih@gmail.com |
e87acb9a972fbc841b375cd19b7a3397f02cb1d5 | 920bc59a07adc65569ae2d6736388519b43cfa23 | /business_logic/blockly/build.py | 9f732ce12acd96a8f9d521cb445158fd5990988a | [
"MIT"
] | permissive | glafira-ivanova/django-business-logic | e924ccabac6b5219fd87dabe60c6e0ecfaa40303 | 7cc0d0475815082e75a16201daf9865d08d3f281 | refs/heads/master | 2021-01-11T05:35:35.193191 | 2016-10-24T12:59:04 | 2016-10-24T12:59:04 | 71,771,078 | 0 | 0 | null | 2016-10-24T09:03:42 | 2016-10-24T09:03:42 | null | UTF-8 | Python | false | false | 5,305 | py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import inspect
from lxml import etree
from django.db.models import Model
from ..models import *
from .data import OPERATOR_TABLE
from .exceptions import BlocklyXmlBuilderException
def camel_case_to_snake_case(name):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
class BlocklyXmlBuilder(NodeCacheHolder):
def build(self, tree_root):
xml = etree.Element('xml')
self.visit(tree_root, parent_xml=xml)
return etree.tostring(xml, pretty_print=True).decode('utf-8')
def visit(self, node, parent_xml):
content_object = node.content_object
if content_object is None:
last_xml = None
for child in self.get_children(node):
if last_xml is not None:
next = etree.Element('next')
last_xml.append(next)
parent_xml = next
last_xml = self.visit(child, parent_xml)
return
for cls in inspect.getmro(content_object.__class__):
if cls == Model:
break
method_name = 'visit_{}'.format(camel_case_to_snake_case(cls.__name__))
method = getattr(self, method_name, None)
if not method:
continue
node_xml = method(node, parent_xml)
if not getattr(method, 'process_children', None):
for child in self.get_children(node):
self.visit(child, parent_xml)
return node_xml
def visit_constant(self, node, parent_xml):
block_type = {
NumberConstant: 'math_number',
StringConstant: 'text',
BooleanConstant: 'logic_boolean',
}
field_name = {
NumberConstant: 'NUM',
StringConstant: 'TEXT',
BooleanConstant: 'BOOL',
}
content_object = node.content_object
cls = content_object.__class__
block = etree.SubElement(parent_xml, 'block', type=block_type[cls])
field = etree.SubElement(block, 'field', name=field_name[cls])
if isinstance(content_object, BooleanConstant):
field.text = str(content_object).upper()
else:
field.text = str(content_object)
return block
def visit_variable(self, node, parent_xml):
variables_get_block = etree.SubElement(parent_xml, 'block', type='variables_get')
self._visit_variable(node, variables_get_block)
def visit_assignment(self, node, parent_xml):
lhs_node, rhs_node = self.get_children(node)
variables_set = etree.SubElement(parent_xml, 'block', type='variables_set')
self._visit_variable(lhs_node, variables_set)
value = etree.SubElement(variables_set, 'value', name='VALUE')
self.visit(rhs_node, value)
return variables_set
visit_assignment.process_children = True
def _visit_variable(self, node, parent_xml):
variable = node.content_object
field = etree.SubElement(parent_xml, 'field', name='VAR')
field.text = variable.definition.name
def visit_binary_operator(self, node, parent_xml):
# determine block_type
operator = node.content_object.operator
block_type = None
table = None
for block_type, table in OPERATOR_TABLE.items():
if operator in table:
break
else:
raise BlocklyXmlBuilderException('Invalid Operator: {}'.format(operator))
block = etree.SubElement(parent_xml, 'block', type=block_type)
field = etree.SubElement(block, 'field', name='OP')
field.text = table[operator]
lhs_node, rhs_node = self.get_children(node)
for value_name, child_node in (('A', lhs_node), ('B', rhs_node)):
value = etree.SubElement(block, 'value', name=value_name)
self.visit(child_node, value)
return block
visit_binary_operator.process_children = True
def visit_if_statement(self, node, parent_xml):
children = self.get_children(node)
block = etree.SubElement(parent_xml, 'block', type='controls_if')
if len(children) > 2:
mutation = etree.SubElement(block, 'mutation')
if len(children) % 2:
mutation.set('else', '1')
elifs = (len(children) - 2 - len(children) % 2) / 2
if elifs:
mutation.set('elseif', str(int(elifs)))
for i, pair in enumerate(pairs(children)):
# last "else" branch
if len(pair) == 1:
statement = etree.SubElement(block, 'statement', name='ELSE')
self.visit(pair[0], statement)
break
if_condition = pair[0]
if_value = etree.SubElement(block, 'value', name='IF{}'.format(i))
self.visit(if_condition, if_value)
statement = etree.SubElement(block, 'statement', name='DO{}'.format(i))
self.visit(pair[1], statement)
visit_if_statement.process_children = True
def tree_to_blockly_xml(tree_root):
return BlocklyXmlBuilder().build(tree_root)
def blockly_xml_to_tree(xml):
pass
| [
"dgk@dgk.su"
] | dgk@dgk.su |
4405bde8af8fc39580905868d3bbd3e70f95b142 | 774f43f248a9ad4cf08c56e5a5dbf506eb111a9a | /user-password.example.py | 1e951f1dc6697c9199bf598dffa0e43291987e10 | [
"MIT"
] | permissive | NordicMuseum/Wikimedia-Commons-uploads | b3b6524aff64b9a5bd8129d97604485df10ed839 | 57c23ccbe4c3f2f292e863a91fdb855801f3c93e | refs/heads/master | 2022-03-10T19:08:19.626558 | 2019-11-22T09:06:44 | 2019-11-22T09:06:44 | 105,751,960 | 7 | 4 | MIT | 2019-11-22T09:06:46 | 2017-10-04T09:35:18 | Python | UTF-8 | Python | false | false | 74 | py | (u'ExampleUser', BotPassword(u'ExampleBotSuffix', u'ExampleBotPassword'))
| [
"noreply@github.com"
] | noreply@github.com |
12d7d0236d58487ba5f9d74bafeeeaeb487401aa | 3940b4a507789e1fbbaffeb200149aee215f655a | /lc/112.PathSum.py | 14e465def2db1577e4b4e9af3851db0a471c4446 | [] | no_license | akimi-yano/algorithm-practice | 15f52022ec79542d218c6f901a54396a62080445 | 1abc28919abb55b93d3879860ac9c1297d493d09 | refs/heads/master | 2023-06-11T13:17:56.971791 | 2023-06-10T05:17:56 | 2023-06-10T05:17:56 | 239,395,822 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,025 | py | # 112. Path Sum
# Easy
# 2849
# 583
# Add to List
# Share
# Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum.
# A leaf is a node with no children.
# Example 1:
# Input: root = [5,4,8,11,null,13,4,7,2,null,null,null,1], targetSum = 22
# Output: true
# Example 2:
# Input: root = [1,2,3], targetSum = 5
# Output: false
# Example 3:
# Input: root = [1,2], targetSum = 0
# Output: false
# Constraints:
# The number of nodes in the tree is in the range [0, 5000].
# -1000 <= Node.val <= 1000
# -1000 <= targetSum <= 1000
# This solution works!:
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def hasPathSum(self, root: TreeNode, targetSum: int) -> bool:
def helper(cur, total):
nonlocal targetSum
total += cur.val
if not cur.left and not cur.right:
return targetSum == total
if cur.left and helper(cur.left, total):
return True
if cur.right and helper(cur.right, total):
return True
return False
if not root:
return False
return helper(root, 0)
# This solution also works!:
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param root, a tree node
# @param sum, an integer
# @return a boolean
# 1:27
def hasPathSum(self, root, sum):
if not root:
return False
if not root.left and not root.right and root.val == sum:
return True
sum -= root.val
return self.hasPathSum(root.left, sum) or self.hasPathSum(root.right, sum) | [
"akimi.mimi.yano@gmail.com"
] | akimi.mimi.yano@gmail.com |
ee018afa6b9ef93d3c69b4db12cb798f736335a8 | 71c7683331a9037fda7254b3a7b1ffddd6a4c4c8 | /PIDCalib/CalibDataScripts/jobs/Stripping26/Jpsi/ganga_JpsiFit_MagUp.py | bb05b680f884ac4f70a6660d3d10974ebb1174ea | [] | no_license | pseyfert-cern-gitlab-backup/Urania | edc58ba4271089e55900f8bb4a5909e9e9c12d35 | 1b1c353ed5f1b45b3605990f60f49881b9785efd | refs/heads/master | 2021-05-18T13:33:22.732970 | 2017-12-15T14:42:04 | 2017-12-15T14:42:04 | 251,259,622 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 5,402 | py | # set the stripping version
stripVersion = "26"
# magnet 'Up' or 'Down'?
magPol='Up'
# file suffix:
#
# dst_k_and_pi: Kaons and pions from D*
# lam0_p: Protons from Lambda0
# jpsi_mu: Muons from J/psi
# dst_k_and_pi_muonUnBiased: 'MuonUnBiased' kaons + pions from D*
# lam0_p_muonUnBiased: 'MuonUnBiased' protons from Lambda0
fileSuffix='jpsi_mu'
# set the pbs options (e.g. CPU/walltime)
pbsopts = "-l cput=8:59:00,walltime=12:00:00"
# particle type (e.g. DSt, Lam0, Jpsi)
partType="Jpsi"
# the platform to run on
# if this is not set, it will default to the value of CMTCONFIG
platform=''
# the job name (which will be appended with the stripping version, magnet polarity etc)
jobname="JpsiFit_Mu"
# is this a test job?
isTest=False
##########################################################################################################
# The following lines should not need to be changed in most cases, as they are autoconfigured from the
# above options
##########################################################################################################
import os
import re
import sys
# set the platform (if not already specified)
if len(platform)==0:
platform=os.getenv('CMTCONFIG')
# get the Urania version from the script path
abspath = os.path.abspath(os.path.dirname(sys.argv[0]))
rematch = re.search('.Urania_(?P<ver>v\d+r\d+p?\d?).', abspath)
UraniaVersion=rematch.group('ver')
# uncomment to set the Urania version manually
#UraniaVersion="v1r1"
# get the User_release_area (i.e. top-level CMT directory,
# which defaults to $HOME/cmtuser)
User_release_area = os.getenv('User_release_area')
if len(User_release_area)==0:
User_release_area="%s/cmtuser" %os.getenv('HOME')
# uncomment to set the User_release_area manually
#User_release_area="/home/huntp/cmtuser"
# base directory of $CALIBDATASCRIPTSROOT
basedir = '%s/Urania_%s/PIDCalib/CalibDataScripts' %(User_release_area,
UraniaVersion)
# location of the executable
exeFile = '%s/scripts/sh/%sJob_runRange.sh' %(basedir, partType)
# read the configuration script
import imp
gangaJobFuncs=imp.load_source('gangaJobFuncs',
'%s/scripts/python/gangaJobFuncs.py' %basedir)
gangaJobFuncs.updateEnvFromShellScript( ('{bdir}/jobs/Stripping{strp}'
'/configureGangaJobs.sh').format(
bdir=basedir,strp=stripVersion))
jidVar = ''
if magPol=='Down':
jidVar='CALIBDATA_JIDS_DOWN'
elif magPol=='Up':
jidVar='CALIBDATA_JIDS_UP'
else:
raise NameError('Unknown magnet polarity %s' %magPol)
jids_str=os.getenv(jidVar)
if len(jids_str)==0:
raise NameError('Environmental variable %s is not set' %jidVar)
jobIDs=[int(jid) for jid in jids_str.split()]
# uncomment to set the input job IDs manually
#jobIDs=[7,9]
# assume the user's ganga directory is the input directory
gangadir='%s/workspace/%s/%s' %(config['Configuration']['gangadir'],
config['Configuration']['user'],
config['Configuration']['repositorytype'])
# uncomment to use a different input directory
#gangadir='$DATADISK/gangadir_calib/workspace/powell/LocalXML'
# use the PBS backend and set the CPU/walltime etc.
bck = PBS()
bck.extraopts = pbsopts
if isTest:
bck.queue = 'testing'
# Uncomment to use the local backend
#bck = Local()
subIDString="*"
## configure the jobs
if isTest:
jobname='Test'+jobname
for jid in jobIDs:
# configure the job comment
jobcomment='Input from Job ID %d' %jid
if isTest:
jobcomment='TEST - '+jobcomment
# get the number of chopped tree
nChoppedTrees = gangaJobFuncs.getNumChoppedTrees(gangadir, jid,
fileSuffix)
if isTest:
# run over ~10% of all events,
# and only process one "chopped tree" (index 0)
nChoppedTrees = 1
nSubJobs = len(jobs(jid).subjobs)
subIDString = "{"+",".join([str(s) for s in range(nSubJobs/10)])+"}"
# Make the lists of arguments used by the ArgSplitter
#
# Arguments are:
#
# 1) top-level input directory (usually the ganga repository)
# 2) Urania version
# 3) platform (e.g. 'x86_64-slc6-gcc46-opt')
# 4) magnet polarity
# 5) stripping version
# 6) index
# 7) file suffix (e.g. 'dst_k_and_pi')
# 8) verbose flag (0 = no verbose info, 1 = verbose info)
# 9) exit on bad fit flag ( 0 = don't exit, 1 = do exit (
# 10) subjobID string ('*' for all subjobs, '{0,1,2}' for first 3
# subjobs etc.)
argLists = [ [ gangadir,
UraniaVersion,
platform,
magPol,
stripVersion,
str(idx),
fileSuffix,
str(int(isTest)),
'1',
subIDString ] for idx in range(nChoppedTrees) ]
splitter = ArgSplitter(args=argLists)
# configure the application
app= Executable(
exe = File(exeFile),
)
j = Job(
name = '{jname}_S{strp}_Mag{pol}_{suf}'.format(jname=jobname,
strp=stripVersion, pol=magPol, suf=fileSuffix),
comment = jobcomment,
outputfiles = ['*.root', '*.eps'] ,
application=app,
backend=bck,
splitter=splitter
)
j.submit()
| [
"liblhcb@4525493e-7705-40b1-a816-d608a930855b"
] | liblhcb@4525493e-7705-40b1-a816-d608a930855b |
cc8198ee6324093016de729339a2b4b5a521a02d | 5cca58dbb749b388d18ccffe5bc0cc7b0b92d6a6 | /calc-stats.py | 1ef382bdeecd95583f8fd19794f4bc52818e6050 | [] | no_license | samadlotia/rnaseq | ad646af8620b1675a3fcc9f5c930a4bf44a1ef77 | 544a4571d8da4d8233a6fe3a7b3a9dfafd576f86 | refs/heads/master | 2020-05-18T02:19:43.540190 | 2013-01-29T21:50:46 | 2013-01-29T21:50:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,897 | py | import cPickle as pickle
import numpy as np
import re
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
from util import indices_dict, each_replicate
from config import All_samples, Gene_count_matrix_file_path, Gene_indices_file_path
import csv
def load_gene_count_matrix():
gene_count_matrix_file = open(Gene_count_matrix_file_path, 'rb')
gene_count_matrix = np.load(gene_count_matrix_file, )
gene_count_matrix_file.close()
return gene_count_matrix
def load_gene_list():
gene_list_file = open(Gene_indices_file_path , 'rb')
gene_list = pickle.load(gene_list_file)
gene_list_file.close()
return gene_list
# given a row of numbers, returns True if any of its elements are zero
def any_zeros(row):
for i in range(len(row)):
if row[i] == 0:
return True
return False
Ensg_re = re.compile(r'ENSG0+(\d+)')
# simplifies ENSG ids; ex: 'ENSG000000001231' => '1231'
# useful for plotting ENSG ids
def clean_ensg_name(fullname):
return Ensg_re.match(fullname).group(1)
# given a matrix, where columns are replicates and rows are genes,
# return a new matrix with values normalized by column
def normalize_by_replicate(sample_matrix):
_, numcols = sample_matrix.shape
normcols = list()
for x in xrange(numcols):
col = sample_matrix[:,x]
total = float(np.sum(col))
normcol = col / total
normcol = np.atleast_2d(normcol).transpose()
normcols.append(normcol)
norm_matrix = np.hstack(normcols)
return norm_matrix
# given all the gene counts across all conditions and replicates,
# return a dictionary of each condition mapping its normalized
# count values, the means per gene, and the logarithmic mean.
# logarithmic means are increased by 7 to make the range of means
# start at around 0 instead of -7. if the mean is 0, the
# logarithmic mean is mapped to 0.
def calc_stats(samples, replicate_indices, gene_count_matrix):
sample_stats = dict()
for sample, replicates in samples.iteritems():
sample_matrix = np.column_stack((gene_count_matrix[:,replicate_indices[replicate]] for replicate in replicates))
norm_matrix = normalize_by_replicate(sample_matrix)
means = np.mean(norm_matrix, axis=1)
logmeans = np.log10(means)
logmeans += 7.0
logmeans[np.isinf(logmeans)] = 0.0
sample_stats[sample] = (norm_matrix, means, logmeans)
return sample_stats
# writes out csv files for each condition
def output_tables(samples, sample_stats, gene_list):
for sample, (sample_matrix, means, logmeans) in sample_stats.iteritems():
replicates = samples[sample]
with open('%s.csv' % sample, 'w') as output:
writer = csv.writer(output)
header = ['gene']
header.extend(replicates)
header.extend(['mean', 'logmean'])
writer.writerow(header)
for i in range(len(gene_list)):
row = [gene_list[i]]
row.extend(sample_matrix[i,:])
row.append(means[i])
row.append(logmeans[i])
writer.writerow(row)
# generates a plot of the logmeans comparing two conditions
# acceptable values for sampleA and sampleB parameters:
# 'delta-lin41', 'lin41-gran', 'lin41-wc'
def output_matplotlib(sample_stats, gene_list, sampleA, sampleB):
_, _, logmeansA = sample_stats[sampleA]
_, _, logmeansB = sample_stats[sampleB]
plt.xlabel(sampleA)
plt.ylabel(sampleB)
for i in xrange(len(gene_list)):
gene = gene_list[i]
logmeanA = logmeansA[i]
logmeanB = logmeansB[i]
plt.plot(logmeanA, logmeanB, marker='.', label=gene)
#plt.text(logmeanA, logmeanB, gene, fontsize=4, alpha=0.3, va='bottom', ha='left')
plt.show()
def main(samples):
replicate_indices = indices_dict(each_replicate(samples))
gene_count_matrix = load_gene_count_matrix()
gene_list = map(clean_ensg_name, load_gene_list())
sample_stats = calc_stats(samples, replicate_indices, gene_count_matrix)
#output_tables(samples, sample_stats, gene_list)
output_matplotlib(sample_stats, gene_list, 'delta-lin41', 'lin41-gran')
main(All_samples)
| [
"samad.lotia@gladstone.ucsf.edu"
] | samad.lotia@gladstone.ucsf.edu |
040da08f98ffd9b102de0d8c3fb12f826ce7f563 | 523e24bd96d7de004a13e34a58f5c2d79c8222e0 | /plugin.program.indigo/maintool.py | 7517a338760875f088560711b832ad5ef1cff331 | [] | no_license | Bonitillo/Bonitillonew | ec281e5ab9d4fec83d88936e8d8ce32bad6a81c9 | a8099e326dda297f66096480ec93def8a8c124a8 | refs/heads/master | 2022-10-13T05:39:01.126653 | 2017-03-21T16:47:23 | 2017-03-21T16:47:23 | 85,725,652 | 2 | 4 | null | 2022-09-30T21:18:58 | 2017-03-21T16:16:33 | Python | UTF-8 | Python | false | false | 7,349 | py | from urllib2 import Request, urlopen
import urllib2,urllib,re,os, shutil
import sys
import time,datetime
import xbmcplugin,xbmcgui,xbmc, xbmcaddon, downloader, extract, time
from libs import kodi
from libs import viewsetter
addon_id=kodi.addon_id
addon = (addon_id, sys.argv)
artwork = xbmc.translatePath(os.path.join('special://home','addons',addon_id,'art/'))
fanart = artwork+'fanart.jpg'
messages = xbmc.translatePath(os.path.join('special://home','addons',addon_id,'resources','messages/'))
execute = xbmc.executebuiltin
AddonTitle = 'Indigo'
########PATHS###############################################
addonPath=xbmcaddon.Addon(id=addon_id).getAddonInfo('path')
addonPath=xbmc.translatePath(addonPath)
xbmcPath=os.path.join(addonPath,"..","..")
KodiPath=os.path.abspath(xbmcPath)
############################################################
def tool_menu():
kodi.addItem("Clear Cache",'','clearcache',artwork+'clear_cache.png',description="Clear your device cache!")
kodi.addItem("Purge Packages",'','purgepackages',artwork+'purge_packages.png',description="Erase old addon update files!")
kodi.addItem("Wipe Addons",'','wipeaddons',artwork+'wipe_addons.png',description="Erase all your Kodi addons in one shot!")
kodi.addDir("Install Custom Keymaps",'','customkeys',artwork+'custom_keymaps.png',description="Get the best experience out of your device-specific remote control!")
if kodi.get_setting ('automain') == 'true':
kodi.addItem("Disable Auto Maintenance ",'','disablemain',artwork+'disable_AM.png',description="Disable the periodic automated erasing of cache and packages!")
if kodi.get_setting ('automain') == 'false':
kodi.addItem("Enable Auto Maintenance ",'','enablemain',artwork+'enable_AM.png',description="Enable the periodic automated erasing of cache and packages!")
if kodi.get_setting ('scriptblock') == 'true':
kodi.addItem("Disable Malicious Scripts Blocker",'','disableblocker',artwork+'disable_MSB.png',description="Disable protection against malicious scripts!")
if kodi.get_setting ('scriptblock') == 'false':
kodi.addItem("Enable Malicious Scripts Blocker",'','enableblocker',artwork+'enable_MSB.png',description="Enable protection against malicious scripts!")
viewsetter.set_view("sets")
################################
### Clear Cache ###
################################
def clear_cache():
kodi.log('CLEAR CACHE ACTIVATED')
xbmc_cache_path = os.path.join(xbmc.translatePath('special://home'), 'cache')
confirm=xbmcgui.Dialog().yesno("Please Confirm"," Please confirm that you wish to clear "," your Kodi application cache!"," ","Cancel","Clear")
if confirm:
if os.path.exists(xbmc_cache_path)==True:
for root, dirs, files in os.walk(xbmc_cache_path):
file_count = 0
file_count += len(files)
if file_count > 0:
for f in files:
try:
os.unlink(os.path.join(root, f))
except:
pass
for d in dirs:
try:
shutil.rmtree(os.path.join(root, d))
except:
pass
dialog = xbmcgui.Dialog()
dialog.ok(AddonTitle, " Cache Cleared Successfully!")
xbmc.executebuiltin("Container.Refresh()")
################################
### End Clear Cache ###
################################
def purge_packages():
kodi.log('PURGE PACKAGES ACTIVATED')
packages_path = xbmc.translatePath(os.path.join('special://home/addons/packages', ''))
confirm=xbmcgui.Dialog().yesno("Please Confirm"," Please confirm that you wish to delete "," your old addon installation packages!"," ","Cancel","Delete")
if confirm:
try:
for root, dirs, files in os.walk(packages_path,topdown=False):
for name in files :
os.remove(os.path.join(root,name))
dialog = xbmcgui.Dialog()
dialog.ok(AddonTitle, " Packages Folder Wiped Successfully!")
xbmc.executebuiltin("Container.Refresh()")
except:
dialog = xbmcgui.Dialog()
dialog.ok(AddonTitle, "Error Deleting Packages please visit TVADDONS.AG forums")
def wipe_addons():
kodi.logInfo('WIPE ADDONS ACTIVATED')
confirm=xbmcgui.Dialog().yesno("Please Confirm"," Please confirm that you wish to uninstall "," all addons from your device!"," ","Cancel","Uninstall")
if confirm:
addonPath=xbmcaddon.Addon(id=addon_id).getAddonInfo('path')
addonPath=xbmc.translatePath(addonPath)
xbmcPath=os.path.join(addonPath,"..","..")
xbmcPath=os.path.abspath(xbmcPath);
addonpath = xbmcPath+'/addons/'
mediapath = xbmcPath+'/media/'
systempath = xbmcPath+'/system/'
userdatapath = xbmcPath+'/userdata/'
packagepath = xbmcPath+ '/addons/packages/'
try:
for root, dirs, files in os.walk(addonpath,topdown=False):
print root
if root != addonpath :
if 'plugin.program.indigo' not in root:
if 'metadata.album.universal' not in root:
if 'metadata.artists.universal' not in root:
if 'metadata.common.musicbrainz.org' not in root:
if 'service.xbmc.versioncheck' not in root:
shutil.rmtree(root)
dialog = xbmcgui.Dialog()
dialog.ok(AddonTitle, "Addons Wiped Successfully! Click OK to exit Kodi and then restart to complete .")
xbmc.executebuiltin('ShutDown')
except:
dialog = xbmcgui.Dialog()
dialog.ok(AddonTitle, "Error Wiping Addons please visit TVADDONS.AG forums")
def disable_main():
#kodi.log('DISABLE MAIN TOOL')
confirm=xbmcgui.Dialog();
if confirm.yesno('Automatic Maintenance ',"Please confirm that you wish to TURN OFF automatic maintenance! "," "):
kodi.log ("Disabled AUTOMAIN")
kodi.set_setting('automain','false')
dialog = xbmcgui.Dialog()
dialog.ok("Automatic Maintenance", "Settings Changed! Click OK to exit Kodi and then restart to complete .")
xbmc.executebuiltin('ShutDown')
else:
return
def enable_main():
#kodi.log('ENABLE MAIN TOOL')
confirm=xbmcgui.Dialog();
if confirm.yesno('Automatic Maintenance ',"Please confirm that you wish to TURN ON automatic maintenance! "," "):
kodi.log ("enabled AUTOMAIN")
kodi.set_setting('automain','true')
dialog = xbmcgui.Dialog()
dialog.ok("Automatic Maintenance", "Settings Changed! Click OK to exit Kodi and then restart to complete .")
xbmc.executebuiltin('ShutDown')
else:
return
def disable_blocker():
#kodi.log('DISABLE BLOCKER')
confirm=xbmcgui.Dialog();
if confirm.yesno('Malicious Script Blocker',"Please confirm that you wish to TURN OFF Malicious Script Blocker! "," "):
kodi.log ("Disable Script Block")
kodi.set_setting('scriptblock','false')
dialog = xbmcgui.Dialog()
dialog.ok("Script Blocker", "Settings Changed! Click OK to exit Kodi and then restart to complete .")
xbmc.executebuiltin('ShutDown')
else:
return
def enable_blocker():
#kodi.log('ENABLE BLOCKER')
confirm=xbmcgui.Dialog();
if confirm.yesno('Malicious Script Blocker',"Please confirm that you wish to TURN ON Malicious Script Blocker! "," "):
kodi.log ("Enable Script Block")
kodi.set_setting('scriptblock','true')
dialog = xbmcgui.Dialog()
dialog.ok("Script Blocker", "Settings Changed! Click OK to exit Kodi and then restart to complete .")
xbmc.executebuiltin('ShutDown')
else:
return | [
"richellizardo@Djs-MacBook-Pro.local"
] | richellizardo@Djs-MacBook-Pro.local |
bbb76cf5efe9742b0b6907e36684f4e6789d1552 | d5d12507f8e62abd6ad4ae143ed0c30d2ec70a34 | /chapter_10/ch10_text_d.py | 7fb9677cea14ecfb7857eda62e7070ae376772c4 | [] | no_license | JohnHowardRoark/thinkcspy3 | 5ad3add17c4b534f0a1d007c7def1ace72583223 | def8e6615f2bcef367cb747d13a9f3cf23ece83a | refs/heads/master | 2020-09-19T21:35:57.213913 | 2019-12-22T18:25:58 | 2019-12-22T18:25:58 | 224,303,785 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 256 | py | import turtle
turtle.setup(400,500)
wn = turtle.Screen()
wn.title("Using a timer")
wn.bgcolor("lightgreen")
tess = turtle.Turtle()
tess.color("purple")
tess.pensize(3)
def h1():
tess.forward(100)
tess.left(56)
wn.ontimer(h1, 2000)
wn.mainloop() | [
"johnschmidt@engineer.com"
] | johnschmidt@engineer.com |
3eb53c7799362cdc6c41647804734c03d62b2e4e | a3e52fbdfc81da3d17fee3d11b4451b330bfd592 | /JudgeOnline/solution/hrank/algorithm/graph/shrotestReach.py | 69b1ab517d2a6ef79f88316198cd25092699b26d | [] | no_license | chrislucas/python | 79633915dd0aa8724ae3dfc5a3a32053f7a4f1e0 | d3cca374f87e134a7ddfc327a6daea983875ecac | refs/heads/master | 2021-01-17T04:08:25.056580 | 2016-12-26T11:41:31 | 2016-12-26T11:41:31 | 42,319,868 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 144 | py | '''
Created on 11 de dez de 2016
@author: C.Lucas
https://www.hackerrank.com/challenges/bfsshortreach
'''
if __name__ == '__main__':
pass | [
"christoffer.luccas@gmail.com"
] | christoffer.luccas@gmail.com |
e8a19ea67c840dd26b306a01ba11687009a0f5a0 | ee735e11151aef75cf3ea8790f5e86ea285aa55f | /estruturas_repeticao/ciclo_for.py | 360aba6debac67f2268b834c7d46644cde7fdb42 | [] | no_license | Joaovismari/Python | 81dd7b3ab824e27221b1e034d1a2be2b74c17b24 | fc76c956987e3e839b1f993369d9bc28f1e5f722 | refs/heads/master | 2023-06-19T18:59:02.203183 | 2021-07-21T12:17:53 | 2021-07-21T12:17:53 | 371,078,932 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 446 | py | nomes = ['Pedro', 'João', 'Leticia']
for n in nomes: #passa por todos os elementos da lista atribuindo seus valores a variavel n
print(n)#imprime o valor de n em uma linha
else:
print("Todos os nomes foram listados com sucesso")#após todas a posições terem sido utilizadas a cima
print('_____________________________________________')
meses = ['janeiro', 'fevereiro', 'março', 'abril']
for mes in meses:
print('mês de', mes)
| [
"jmvismari@hotmail.com"
] | jmvismari@hotmail.com |
8333aeedd2a428cb35e678bc7d6c6204ecc3b206 | 06220ddebf29c95408af3a6b06b578644f6b9e6f | /passwords/fields.py | 4a36ba5211d6a3784b6724c51372d941b1895461 | [] | no_license | lnxg33k/bugtrack | c2ed9cf32314bad7166156b717fe38de3cbd2eea | 103c7694425bed26a6f89678288b28057def7eeb | refs/heads/master | 2023-03-04T13:02:31.279104 | 2021-02-08T07:38:35 | 2021-02-08T07:38:35 | 40,562,379 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 547 | py | from django.forms import CharField, PasswordInput
from passwords.validators import (validate_length, common_sequences,
dictionary_words, complexity)
class PasswordField(CharField):
default_validators = [
validate_length,
common_sequences,
dictionary_words,
complexity]
def __init__(self, *args, **kwargs):
if 'widget' not in kwargs:
kwargs["widget"] = PasswordInput(render_value=False)
super(PasswordField, self).__init__(*args, **kwargs)
| [
"ahmedelantry@gmail.com"
] | ahmedelantry@gmail.com |
16debb3ed031d44bf817d364a06a0eb527e43618 | d4e927cf18086bfb1dc917df50adbb56e3c04de5 | /tests/test_template_variables.py | 5d38657dcd81b2bd7f145a6a95005565bc6b1782 | [
"MIT"
] | permissive | dafanasiev/yasha | 85d899fded5474ef19f8eda1e4a86fcf9a18cad9 | b4488779647db344d98ee9754022f44e40109e1f | refs/heads/master | 2022-09-30T11:37:24.481077 | 2020-06-01T06:42:48 | 2020-06-01T06:42:48 | 267,877,443 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,433 | py | """
The MIT License (MIT)
Copyright (c) 2015-2017 Kim Blomqvist
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
import os
import pytest
@pytest.fixture()
def t(tmpdir):
return tmpdir.join('template.j2')
def test_string(t, callYasha):
t.write('{{ var is string }}, {{ var }}')
out, _ = callYasha('--var', 'foo', '-o-', str(t))
assert out == 'True, foo'
t.write('{{ var is string }}, {{ var }}')
out, _ = callYasha('--var', "'foo'", '-o-', str(t))
assert out == "True, foo"
def test_boolean(t, callYasha):
t.write('{{ var is sameas false }}, {{ var }}')
out, _ = callYasha('--var', 'False', '-o-', str(t))
assert out == 'True, False'
def test_number(t, callYasha):
t.write('{{ var is number }}, {{ var + 1 }}')
out, _ = callYasha('--var', '1', '-o-', str(t))
assert out == 'True, 2'
def test_list(t, callYasha):
t.write('{{ var is sequence }}, {{ var | join }}')
out, _ = callYasha('--var', "['foo', 'bar', 'baz']", '-o-', str(t))
assert out == 'True, foobarbaz'
def test_tuple(t, callYasha):
t.write('{{ var is sequence }}, {{ var | join }}')
out, _ = callYasha('--var', "('foo', 'bar', 'baz')", '-o-', str(t))
assert out == 'True, foobarbaz'
def test_dictionary(t, callYasha):
t.write("{{ var is mapping }}, {% for k in 'abc' %}{{ var[k] }}{% endfor %}")
out, _ = callYasha('--var', "{'a': 1, 'b': 2, 'c': 3}", '-o-', str(t))
assert out == 'True, 123'
| [
"afanasiev.dmitry@gmail.com"
] | afanasiev.dmitry@gmail.com |
24609c047c4733b47f8db778301c3bfd22eddb0b | 20ba6d00badae6e0be5416628056da5247187eed | /templates/urls.py | e5a53614f5d62bf4aaa7721c2c610f981f41c6f8 | [] | no_license | elaine05/ecommerce | 3a6ad34d160acf0dd0a3866215e7f57a6127ebcf | 2003122cc2b203a383bcf52bb1f5519c4c17fb9b | refs/heads/master | 2022-09-19T13:25:18.786678 | 2018-05-29T08:18:00 | 2018-05-29T08:18:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 256 | py | from django.urls import path
from .views import (ProductListView,
ProductDetailSlugView)
urlpatterns = [
path('', ProductListView.as_view(), name='list'),
path('<slug:slug>/', ProductDetailSlugView.as_view(), name='detail'),
]
| [
"le0nana0888@gmail.com"
] | le0nana0888@gmail.com |
eeb1559f1a0bbc46f5e47f3df99f5f63b293fdc6 | 40771419d17e8862043da434780f67ff56ddf9ae | /activity_27_lambda_s3/src/consolidation.py | 70b8bb8f8ec3efe7a59beff258587b98fecf566e | [] | no_license | HuyBui-ruum/21UCS39AB | 129d5925584f83a4731eff09c34f0d14d75cb2e4 | b7df19e73673cfb7bd70aeb5303f1fcfcd6f4d39 | refs/heads/main | 2023-07-03T05:40:43.803991 | 2021-08-02T19:01:56 | 2021-08-02T19:01:56 | 379,763,752 | 0 | 0 | null | 2021-06-24T00:44:38 | 2021-06-24T00:44:38 | null | UTF-8 | Python | false | false | 1,967 | py | # CS39AB - Cloud Computing - Summer 2021
# Instructor: Thyago Mota
# Description: Activity 26 - Consolidates in/out inventory data
import os
import boto3
# parameters
BUCKET_DESTINATION = os.getenv("BUCKET_DESTINATION")
def lambda_handler(event, context):
s3 = boto3.client('s3')
for record in event['Records']:
if record['eventSource'] == 'aws:s3':
s3_info = record['s3']
bucket = s3_info['bucket']['name']
object_key = s3_info['object']['key']
try:
os.chdir('/tmp')
print('trying to download file...')
print(bucket)
print(object_key)
s3.download_file(bucket, object_key, object_key)
print('trying to delete file...')
s3.delete_object(
Bucket = bucket,
Key = object_key)
with open(object_key, 'rt') as csv:
items = {}
for line in csv:
line = line.strip()
item, in_out = line.split(',')
if item not in items:
items[item] = 0
items[item] += int(in_out)
with open(object_key, 'wt') as csv:
for item in items:
csv.write(item + ',' + str(items[item]) + '\n')
print('trying to upload file...')
s3.upload_file(object_key, BUCKET_DESTINATION, object_key)
except Exception as ex:
print(ex)
return {
'statusCode': 200,
'body': 'unexpected errors happened!'
}
else:
return {
'statusCode': 200,
'body': 'Not an s3 event!'
}
return {
'statusCode': 200,
'body': 'success!'
}
| [
"thyagomota@gmail.com"
] | thyagomota@gmail.com |
4612ab9203cd165e66834e356d3ee6f8bf137430 | 1c46509ec42f7a7194ddbe475c02084d10504d52 | /exercise1.py | 2619e0743f27ba23964e274e345a09b632b50078 | [] | no_license | santoshisubedi/git-test | 304879884962585edae5cb9dc6566fece9b492c3 | ebab3fa6d92ca1d48f16aeaff7ff3981b7f9f0fa | refs/heads/master | 2021-01-23T01:27:03.883594 | 2017-03-26T06:34:55 | 2017-03-26T06:34:55 | 85,911,569 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 392 | py | a = raw_input('enter the marks of C')
b = raw_input('enter the marks of IT')
c = raw_input('enter the marks of DAA')
d = raw_input('enter the marks of DL')
e = raw_input('enter the marks of SAD')
total = float(a) +float(b) + float(c) + float(d) + float(e)
print'total marks,total'
percentage =(total/5) * 100
print 'total = {}' .format(total)
print 'percentage = {:.2f} %'.format(percentage) | [
"santusubedi96@gmail.com"
] | santusubedi96@gmail.com |
ca994935a62ea261c18b09d4bdfc61831b7e7aa7 | e2513458d29e3ec9da59f6edda1fe9fe481c8810 | /total_beginner_projects/virtual_pet/virtual_pet_day_3.py | 86ecaf85f684e968727089cefc3f0de8d6b0dfe6 | [] | no_license | vencabot/intro_to_python | 8678135742ef91a7e5e9f5011287cc0c29dbd0b1 | c43d547fbc97cfbdd66fdf8bcd47cb83f686b356 | refs/heads/master | 2023-03-16T07:50:34.756472 | 2019-04-20T01:13:26 | 2019-04-20T01:13:26 | 149,873,956 | 2 | 3 | null | 2023-03-07T21:18:57 | 2018-09-22T12:16:23 | Python | UTF-8 | Python | false | false | 4,114 | py | def feed_pet(pets_name, pets_happy_level, pets_hunger_level):
pets_food = input("What do you want to feed " + pets_name + "? ")
print()
if pets_food == pets_favorite_food1 or pets_food == pets_favorite_food2:
pets_happy_level += 20
elif pets_food == pets_hated_food:
pets_happy_level -= 40
elif pets_food == "rocks":
print("Don't do that, you meanie!")
print()
return True, pets_happy_level, pets_hunger_level
else:
pets_happy_level -= 10
print(pets_name + " eats the " + pets_food + ".")
if pets_happy_level >= 80:
print(pets_name + " seems ecstatic!!")
elif pets_happy_level >= 50:
print(pets_name + " seems in high spirits.")
elif pets_happy_level >= 25:
print(pets_name + " seems kind of down.")
else:
print(pets_name + " seems mad depressed.")
print()
pets_hunger_level -= 20
return False, pets_happy_level, pets_hunger_level
def play_with_pet(pets_name, pets_happiness, pets_hunger):
if pets_happiness < 50:
print(pets_name + " isn't in the mood to play...")
print()
return pets_happiness, pets_hunger
if pets_hunger > 60:
print(pets_name + " is too hungry to play!")
pets_happiness -= 20
return pets_happiness, pets_hunger
thrown_object = input("What do you want to fetch with? ")
print()
print("You throw the " + thrown_object + ".")
print()
if pets_happiness >= 80:
print(pets_name + " retrieves the " + thrown_object + " with lightning speed!")
elif pets_happiness >= 70:
print(pets_name + " takes their time retrieving the " + thrown_object + " while wagging their tail(?).")
else:
print(pets_name + " watches the " + thrown_object + " fall and looks at you dumbly.")
print()
pets_hunger += 20
return pets_happiness, pets_hunger
pets_favorite_food1 = "french fries"
pets_favorite_food2 = "pie"
pets_hated_food = "orange"
pets_happiness = 50
pets_hunger = 100
poop_on_floor = False
pets_name = input("What is your pet's name? ")
print()
while True:
if not poop_on_floor:
pet_activity = input("Do you want to 'feed' or 'play' with " + pets_name + "? ")
else:
pet_activity = input("Do you want to 'feed' or 'play' with " + pets_name + ", or do you want to 'clean' the room? ")
print()
if pet_activity == "feed":
returned_values = feed_pet(pets_name, pets_happiness, pets_hunger)
fed_pet_rocks = returned_values[0]
pets_happiness = returned_values[1]
pets_hunger = returned_values[2]
if pets_hunger <= 0:
print(pets_name + " takes a massive DUMP.")
print()
poop_on_floor = True
pets_hunger_level = 100
elif pet_activity == "play":
returned_values = play_with_pet(pets_name, pets_happiness, pets_hunger)
pets_happiness = returned_values[0]
pets_hunger = returned_values[1]
elif pet_activity == "quit":
print(pets_name + " goes back to bed. :D")
break
elif pet_activity == "clean":
if poop_on_floor:
print("You clean up " + pets_name + "'s poop.")
print()
poop_on_floor = False
else:
print("There's nothing to clean.")
elif pet_activity == "dagger":
print("Dagger's dat dude! How could " + pets_name + " not love 'im?!")
pets_happiness = 100
else:
print("Please either 'feed' or 'play' with " + pets_name + ". Or 'clean' or 'quit'.")
print()
continue
if pets_hunger > 70:
print(pets_name + " seems kind of hungry...")
print()
pets_happiness -= 10
if poop_on_floor:
pets_happiness -= 10
if pets_happiness <= 0:
print(pets_name + " bites you! And then poops on the dang carpet!")
print("You faint from embarrassment...")
break
print("Game Over")
| [
"noreply@github.com"
] | noreply@github.com |
ab3c1e04097341e3cd191c0c795cfd6366d615b2 | 376040d6ce67354c783d61edeb14c1d7059ed0b4 | /test/python/threading/mtfacfib.py | b38d8805ddd9c5944eb80be9d7672a9b8988921e | [] | no_license | panluo/learn | 8140af4b274ce858637d6b82dc6558957e4a2ba6 | ca03fc00a34d7603909dd80a90e7d72290374485 | refs/heads/master | 2021-01-25T04:58:00.503329 | 2015-03-20T08:28:15 | 2015-03-20T08:28:15 | 23,575,530 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,345 | py | #!/usr/bin/env python
import threading
from time import ctime,sleep
class Mythread(threading.Thread):
def __init__(self,func,args,name=''):
threading.Thread.__init__(self)
self.name = name
self.func = func
self.args = args
def getResult(self):
return self.res
def run(self):
print 'starting',self.name,'at:',ctime()
self.res = apply(self.func,self.args)
print self.name,'finished at:',ctime()
def fib(x):
sleep(0.005)
if x<2:
return 1
return (fib(x-2) + fib(x-1))
def fac(x):
sleep(0.1)
if x<2:
return 1
return (x*fac(x-1))
def sums(x):
sleep(0.1)
if x<2:
return 1
return (x+sums(x-1))
funcs = [fib,fac,sums]
n = 12
def main():
nfuncs = range(len(funcs))
print '*** single thread'
for i in nfuncs:
print 'starting',funcs[i].__name__,'at:',ctime()
print funcs[i](n)
print funcs[i].__name__,'finished at:',ctime()
print '\n*** multiple threads'
threads = []
for i in nfuncs:
t = Mythread(funcs[i],(n,),funcs[i].__name__)
threads.append(t)
for i in nfuncs:
threads[i].start()
for i in nfuncs:
threads[i].join()
print threads[i].getResult()
print 'all DONE'
if __name__ == '__main__':
main()
| [
"pan.luo@bilintechnology.com"
] | pan.luo@bilintechnology.com |
6284f7cad02b6cf3714a1f65b202aa4cc2502691 | 753b29a92b4c3e42a31718883019fb142105932a | /webpersonal/portfolio/models.py | 365e394fb715476d522300fd584ef5a8ed6c28c5 | [] | no_license | l-ejs-l/PythonDjango-Udemy | d1cea5404c44daed3bb7a5df0f6528f18298edf2 | 175ebb83a2c58b1be1178657550edac8e25c341f | refs/heads/master | 2023-03-03T19:36:56.603611 | 2019-01-28T11:42:09 | 2019-01-28T11:42:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 753 | py | from django.db import models
# Create your models here.
class Project(models.Model):
title = models.CharField(max_length = 200, verbose_name = "titulo")
description = models.TextField(verbose_name = "Descripcion")
image = models.ImageField(verbose_name = "Imagen", upload_to = "projects")
link = models.URLField(null = True, blank = True, verbose_name = "Dirección Web")
created = models.DateTimeField(auto_now_add = True, verbose_name = "Fecha de creación")
updated = models.DateTimeField(auto_now = True, verbose_name = "Fecha de edicion")
class Meta:
verbose_name = "proyecto"
verbose_name_plural = "proyectos"
ordering = ["-created"]
def __str__(self):
return self.title
| [
"emilio.jeldes@gmail.com"
] | emilio.jeldes@gmail.com |
ab35e9e283009e6ecf13db879c04cf26b445e562 | 20a5da07103f472a803a72cc6da53253e1630049 | /dbinfo/main.py | a07197bfe48f9483397639e76a92c7d9a00c51a6 | [] | no_license | travishathaway/dbinfo | 209e7e0286616d1efe12f56b6fc96855a429475e | 21df6982ba9d5f6d5361ceb21de571a5128dd3bf | refs/heads/master | 2020-06-06T18:59:15.079351 | 2014-07-28T19:34:39 | 2014-07-28T19:34:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,830 | py | #! /usr/bin/env python
'''
Usage:
dbinfo <report> [-d <dbms> -f <format> -o <outfile>]
Options:
-h --help Show this screen.
-d <dbms>, --dbms <dbms> Database Engine [default: mysql]
-f <format>, --format <format> Database Engine [default: csv]
-o <outfile>, --outfile <outfile> Output filename
'''
import ConfigParser
import os
import sys
from docopt import docopt
def load_config():
config = ConfigParser.RawConfigParser(allow_no_value=True)
db_settings = {}
try:
config.readfp(open('%s/.dbinfo_config' % os.environ['HOME']))
for section in config.sections():
db_settings[section] = {}
for params in config.items(section):
db_settings[section][params[0]] = params[1]
except (IOError):
sys.stdout.write('You have no config file: ~/.dbinfo_config\n')
sys.stdout.write('Please create it\n')
return db_settings
def main():
args = docopt(__doc__, version='dbinfo 0.1')
db_settings = load_config()
if args['--dbms'] == 'mysql':
from .mysql import DbinfoMysql
dbinfo = DbinfoMysql(db_settings['mysql'],
outfile=args.get('--outfile'))
elif args['--dbms'] == 'postgresql':
from .postgresql import DbinfoPostgresql
dbinfo = DbinfoPostgresql(db_settings['postgresql'],
outfile=args.get('--outfile'))
else:
sys.stdout.write(
'Unrecognized DBMS "%s"\n' % args['--dbms']
)
sys.exit(1)
try:
getattr(dbinfo, args['<report>'])(output_format=args['--format'])
except(AttributeError):
sys.stdout.write(
'Report "%s" is not a valid report type\n' % args['<report>']
)
sys.exit(1)
if __name__ == '__main__':
main()
| [
"travis.j.hathaway@gmail.com"
] | travis.j.hathaway@gmail.com |
596c2d341bff67735b22fbdd7402b5b94c2d838d | 40323f76b6685f9c4154ed514a7eec1fd2937c3f | /amr_srvs/catkin_generated/pkg.installspace.context.pc.py | 503d25db3163c83d179cde31004ad7c67f88cb30 | [] | no_license | Kishaan/amr_team07 | f5b53f3f7e271f33c7ce84bcaa13e7241a1ff2df | 956dcf0983a71de246d7a2fb8180bcbdcda9fd8a | refs/heads/master | 2021-04-28T06:05:38.391202 | 2018-02-05T10:09:34 | 2018-02-05T10:09:34 | 122,192,234 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 473 | py | # generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/kishaan/catkin_ws/install/include".split(';') if "/home/kishaan/catkin_ws/install/include" != "" else []
PROJECT_CATKIN_DEPENDS = "geometry_msgs;amr_msgs".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "amr_srvs"
PROJECT_SPACE_DIR = "/home/kishaan/catkin_ws/install"
PROJECT_VERSION = "1.0.0"
| [
"kishaan.kishaan@smail.inf.h-brs.de"
] | kishaan.kishaan@smail.inf.h-brs.de |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.