blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 2 616 | content_id stringlengths 40 40 | detected_licenses listlengths 0 69 | license_type stringclasses 2 values | repo_name stringlengths 5 118 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 63 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 2.91k 686M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 23 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 220 values | src_encoding stringclasses 30 values | language stringclasses 1 value | is_vendor bool 2 classes | is_generated bool 2 classes | length_bytes int64 2 10.3M | extension stringclasses 257 values | content stringlengths 2 10.3M | authors listlengths 1 1 | author_id stringlengths 0 212 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c266c889f792a3b3629b97cb48f01a1e98e7ab09 | 4ca0cb74402be70c63ad8e1c67b529cd7770ba38 | /19_model-view_controller/mvc.py | f0b57f822676e41408bad59aeb0327aba2d02a44 | [] | no_license | alxfed/python-design-patterns | 06af6f8e47925bcafe39a117943dd8287a6fe567 | b1a1ffb02b6e81e44bc7f0491376f9121b325a09 | refs/heads/master | 2020-04-02T04:34:18.060976 | 2019-12-18T16:08:00 | 2019-12-18T16:08:00 | 154,022,815 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 680 | py | """
mvc.py
"""
import sys
class GenericController(object):
def __init__(self):
self.model = GenericModel()
self.view = GenericView()
def handle(self, request):
data = self.model.get_data(request)
self.view.generate_response(data)
class GenericModel(object):
def __init__(self):
pass
def get_data(self, request):
return {'request': request}
class GenericView(object):
def __init__(self):
pass
def generate_response(self, data):
print(data)
def main(name):
request_handler = GenericController()
request_handler.handle(name)
if __name__ == "__main__":
main(sys.argv[1])
| [
"alxfed@gmail.com"
] | alxfed@gmail.com |
250a67bc0c4b54f6ad97213cfde878f64d8c88d8 | 9a5e417572dad9712180d89063d4a4bc0517cc04 | /app/request.py | 2f58ed48bfb409811912f4370687c5412f4db98f | [] | no_license | philipiaeveline/WATCHLIST | 39d91de12e7a515f414853c94e24eca45cd911cb | 1dcd380bf11a5980259ffad373fc23cceaa0f6fe | refs/heads/master | 2023-01-18T23:01:51.688233 | 2020-11-28T08:29:12 | 2020-11-28T08:29:12 | 316,217,530 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,983 | py | import urllib.request,json
from .models import Movie
api_key = None
base_url = None
def configure_request(app):
global api_key,base_url
api_key = app.config['MOVIE_API_KEY']
base_url = app.config['MOVIE_API_BASE_URL']
def get_movies(category):
'''
Function that gets the json response to our url request
'''
get_movies_url = base_url.format(category, api_key)
with urllib.request.urlopen(get_movies_url) as url:
get_movies_data = url.read()
get_movies_response = json.loads(get_movies_data)
movie_results = None
if get_movies_response['results']:
movie_results_list = get_movies_response['results']
movie_results = process_results(movie_results_list)
return movie_results
def process_results(movie_list):
'''
Function that processes the movie result and transform them to a list of Objects
Args:
movie_list: A list of dictionaries that contain movie details
Returns :
movie_results: A list of movie objects
'''
movie_results = []
for movie_item in movie_list:
id = movie_item.get('id')
title = movie_item.get('original_title')
overview = movie_item.get('overview')
poster = movie_item.get('poster_path')
vote_average = movie_item.get('vote_average')
vote_count = movie_item.get('vote_count')
if poster:
movie_object = Movie(id, title, overview,
poster, vote_average, vote_count)
movie_results.append(movie_object)
return movie_results
def get_movie(id):
get_movie_details_url = base_url.format(id, api_key)
with urllib.request.urlopen(get_movie_details_url) as url:
movie_details_data = url.read()
movie_details_response = json.loads(movie_details_data)
movie_object = None
if movie_details_response:
id = movie_details_response.get('id')
title = movie_details_response.get('original_title')
overview = movie_details_response.get('overview')
poster = movie_details_response.get('poster_path')
vote_average = movie_details_response.get('vote_average')
vote_count = movie_details_response.get('vote_count')
movie_object = Movie(id, title, overview,
poster, vote_average, vote_count)
return movie_object
def search_movie(movie_name):
search_movie_url = 'https://api.themoviedb.org/3/search/movie?api_key={}&query={}'.format(
api_key, movie_name)
with urllib.request.urlopen(search_movie_url) as url:
search_movie_data = url.read()
search_movie_response = json.loads(search_movie_data)
search_movie_results = None
if search_movie_response['results']:
search_movie_list = search_movie_response['results']
search_movie_results = process_results(search_movie_list)
return search_movie_results | [
"philipiaeveline13@gmail.com"
] | philipiaeveline13@gmail.com |
291295000c491f1a395e8bb1f95090929391a4c3 | 745844af714c767402011ac0bf50b94bf73dcbb1 | /Exercises/Results/jone2032/crud.py | ad6e316be1e09ccfc2795072e82d67a80af627c7 | [] | no_license | Mark-Seaman/UNC-CS350-2017 | 32584522e55f9678516350380d4ae046c17e712f | 7728e6068acf0732be5555be53fa615b9736ca7b | refs/heads/master | 2021-08-30T11:00:24.429682 | 2017-12-07T20:24:40 | 2017-12-07T20:24:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,311 | py | # crud.py
from os.path import exists
from os.path import exists
from files import read_csv, read_file, write_csv, write_file
from csv import reader, writer
## Pair Programming Guide
# * Work in Pairs (1 keyboard + 2 brains)
# * Switch for every iteration (micro-story)
# * Test - Code - Refactor (Fail, Pass, Beautify)
# * Typer - Talker
# * Check your ego at the door '?> Cooperate
# * Save both product and test code
# * Execute all tests for each micro-story
# * Record a log of your time on each test
# * Use the main script hack to run your code directly
# * Finish with a beautiful module call social_net_crud.py
#=============================================================================
# * CSV file User 'Bill, Bill@Here.com'
# * Add 'Sue' to User table
# * Add list of other names (10 people)
# * Read CSV records
# * Print User email
# * Change email
# * Delete Use
# User CRUD
def create_user_file():
open('user.csv','w')
def user_list():
return read_csv('user.csv')
userList = read_csv('user.csv')
print(userList)
def add_user(userid,name,email):
user = user_list()
user.append([userid,name,email])
write_csv('user.csv', user)
return user
def user_email():
user = user_list()
for i in user:
print(i[2])
def user_email_display(userID):
user = user_list()
for i in user:
if int(i[0]) == userID:
print('User Name: ' + i[1] + '\nEmail: ' +i[2])
def user_email_change(userID, newEmail):
user = user_list()
for i in user:
if int(i[0]) == userID:
i[2] = newEmail
write_csv('user.csv',user)
def delete_user(userID):
user = user_list()
for i in user:
if int(i[0]) == userID:
user.remove(i)
write_csv('user.csv',user)
#=============================================================================
# Test building Article CRUD
def test_user_file():
create_user_file()
assert(exists('user.csv'))
def test_user_add():
#add_user('1','teset1','tester1@hello.com')
add_user('5','teset5','tester5@hello.com')
#add_user('7','teset7','tester7@hello.com')
def test_user_list():
user_list()
def test_user_email_display():
#user_email_display(1)
user_email_display(5)
#user_email_display(7)
def test_user_email_change():
#user_email_change(1, 'emailchanged@hello.com')
user_email_change(5, 'emailchanged@hello.com')
#user_email_change(7, 'emailchanged@hello.com')
def test_delete_user():
add_user(2, 'tester2','tester2@hello.com')
#delete_user(1)
delete_user(5)
#delete_user(7)
#=============================
# 1 test for all tests
def test_user_crud():
test_user_file()
test_user_add()
test_user_list()
test_user_email_display()
test_user_email_change()
test_delete_user()
#=============================================================================
# Run test
#if __name__ == '__main__' :
# test_user_crud()
| [
"noreply@github.com"
] | Mark-Seaman.noreply@github.com |
697728c4d441967b7ee1b41e84a36fbef1213c3f | de77865d79a70c8e5c8f024340c198eea45c6c68 | /src_code/plot_chern.py | 8be92c963a3065dab600760a4c865a8669d02038 | [] | no_license | yunhong111/hashCorrelation | ea265f6204382e81439cf13ce7db3da8c9ccb16a | f82463ee7665aedf9a9e508008a9d7d2ff8e7123 | refs/heads/master | 2021-01-25T12:31:15.403038 | 2018-04-02T16:36:08 | 2018-04-02T16:36:08 | 123,475,284 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,160 | py | import matplotlib.pyplot as plt
import pandas as pd
flow_num = [5000*i for i in range(1, 6)]
df = pd.read_csv('../outputs/chern_values.csv', names=['a'+str(i) for i in range(5)])
print df.iloc[0:5]
# Plot
fig = plt.figure(figsize=(4.3307, 3.346))
ax = plt.subplot(111)
types = ['o-', '^-', '*-', '<-', '>-', '+-']
colors = ['b', 'r', 'g', 'm', 'c', 'k']
for i in range(6):
plt.plot(flow_num, df['a4'].iloc[i*5:(i+1)*5], types[i], color=colors[i])
#plt.plot(flow_num, mark_first_web_acc, '^-', color='red')
#plt.plot(flow_num, mark_first_hadoop_acc, '*-', color='green')
plt.ylabel('Chernoff value (C_b)')
plt.xlabel('The number of flows')
plt.grid(True)
box = ax.get_position()
ax.set_position([box.x0+0.02, box.y0+0.15, box.width * 0.75, box.height*0.75])
plt.xticks(flow_num)
# Put a legend to the right of the current axis
acc_legend = ['Web', '100', '500', '1000', '5%', '10%']
ax.legend(acc_legend, loc='center left', bbox_to_anchor=(0.96, 0.3), numpoints=1)
plt.setp(ax.get_xticklabels(), rotation=30, horizontalalignment='right')
fig.savefig(
'/home/yunhong/Research_4/trunk/figures/chern_values' + '.png', dpi = 300)
plt.show()
| [
"yunhong1110@gmail.com"
] | yunhong1110@gmail.com |
66379b12d4d5befc395446e0bd7e8fd9610fbfe9 | 7626a8371c7a847f93bdae5e1d6e03ee9667c3ba | /func/print_area_kz/venv/bin/sqlformat | 87ba197dbb67cb1b0c1fd9666d91f0b0353cc1f2 | [] | no_license | zzyzx4/sp | 52c815fd115b4605942baa73687838f64cd41864 | 90c7a90b3de27af674422e2c8892bad5ba7891e8 | refs/heads/master | 2020-05-23T21:20:28.166932 | 2019-07-19T11:56:49 | 2019-07-19T11:56:49 | 186,950,380 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 260 | #!/home/user/PycharmProjects/print_area_kz/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from sqlparse.__main__ import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
| [
"dastik0101@gmail.com"
] | dastik0101@gmail.com | |
d656310ee6ebfd2a08f1c9d937689b1dc201bd12 | 969b83ba4110e84434c3f955f132627427f6d305 | /server/message_unreact.py | 75b0e5bd369b6632da2297d4c0594935723ab94e | [] | no_license | emcintire/slackr | d49b3cae6d93ec7b0ee4fee22feb186d2c5db564 | c85a083c4f11ec77aaa67d186f2f59ef69a20eef | refs/heads/master | 2021-06-29T17:35:48.704628 | 2021-06-05T18:44:47 | 2021-06-05T18:44:47 | 230,976,869 | 0 | 0 | null | 2021-01-05T18:47:41 | 2019-12-30T20:39:33 | Python | UTF-8 | Python | false | false | 974 | py | import jwt
from appdata import data, valid_tokens, channels, decodeToken, getMessage, getMessageChannel, isUserChan
from server.error import ValueError, AccessError
def message_unreact(token, message_id, react_id):
global channels
try:
u_id = decodeToken(token)
#check if react_id is valid at the start
if react_id != 1:
raise ValueError("Invalid react ID!")
channel = getMessageChannel(message_id)
message = getMessage(message_id)
isUserChan(u_id, channel) #Will raise error if fails
for react in message["reacts"]:
for react_users in react["u_ids"]: #check that the user hasn't already reacted
if react_users == u_id:
react["u_ids"].remove(u_id)
return {}
raise ValueError("User already has no active react for this message!")
except ValueError as e:
raise e
except AccessError as e:
raise e
| [
"noreply@github.com"
] | emcintire.noreply@github.com |
f0a406207fdc6930328b5b04a850ec7bb4b781ee | 8ba154db185f17257306dcb9929ba67f68aba396 | /Day_3/Day_3 Triangle Quest.py | a8aee3403e8b44e317479884149036ad6c46572d | [] | no_license | GILLA-SAITEJA/Innomatics_Internship | 749d2346bddcd6ad0ce757c956981f9a9a1c0cea | 43a0525aeac0ca213aeb69ad838dfbd371f88ac4 | refs/heads/main | 2023-03-25T07:33:09.768492 | 2021-03-25T15:07:16 | 2021-03-25T15:07:16 | 331,515,911 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 136 | py | for i in range(1,int(input())): #More than 2 lines will result in 0 score. Do not leave a blank line also
print(int((10**i)/9)*i)
| [
"noreply@github.com"
] | GILLA-SAITEJA.noreply@github.com |
7da11b2b6560f70a07cfc5ee79bacf3b82b37c85 | 926f23a55dbe360a67bcda9714e1d28a300501bc | /stylelens_search_vector/api_client.py | e401df529385b97e7649f581d5080a6fcf9ecbad | [] | no_license | bluehackmaster/stylelens-search-vector | 08dd24b38e410b40710a7cbeb2dd4a303c981669 | a45a089039dcfa0fbfbe77ac3c12b39088147303 | refs/heads/master | 2021-05-08T04:27:06.091937 | 2017-10-26T13:08:31 | 2017-10-26T13:08:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 24,215 | py | # coding: utf-8
"""
stylelens-search-vector
This is a API document for Vector search on bl-search-faiss\"
OpenAPI spec version: 0.0.1
Contact: bluehackmaster@bluehack.net
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import re
import json
import mimetypes
import tempfile
import threading
from datetime import date, datetime
# python 2 and python 3 compatibility library
from six import PY3, integer_types, iteritems, text_type
from six.moves.urllib.parse import quote
from . import models
from .configuration import Configuration
from .rest import ApiException, RESTClientObject
class ApiClient(object):
"""
Generic API client for Swagger client library builds.
Swagger generic API client. This client handles the client-
server communication, and is invariant across implementations. Specifics of
the methods and models for each application are generated from the Swagger
templates.
NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Do not edit the class manually.
:param host: The base path for the server to call.
:param header_name: a header to pass when making calls to the API.
:param header_value: a header value to pass when making calls to the API.
"""
PRIMITIVE_TYPES = (float, bool, bytes, text_type) + integer_types
NATIVE_TYPES_MAPPING = {
'int': int,
'long': int if PY3 else long,
'float': float,
'str': str,
'bool': bool,
'date': date,
'datetime': datetime,
'object': object,
}
def __init__(self, host=None, header_name=None, header_value=None, cookie=None):
"""
Constructor of the class.
"""
self.rest_client = RESTClientObject()
self.default_headers = {}
if header_name is not None:
self.default_headers[header_name] = header_value
if host is None:
self.host = Configuration().host
else:
self.host = host
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'Swagger-Codegen/1.0.0/python'
@property
def user_agent(self):
"""
Gets user agent.
"""
return self.default_headers['User-Agent']
@user_agent.setter
def user_agent(self, value):
"""
Sets user agent.
"""
self.default_headers['User-Agent'] = value
def set_default_header(self, header_name, header_value):
self.default_headers[header_name] = header_value
def __call_api(self, resource_path, method,
path_params=None, query_params=None, header_params=None,
body=None, post_params=None, files=None,
response_type=None, auth_settings=None, callback=None,
_return_http_data_only=None, collection_formats=None, _preload_content=True,
_request_timeout=None):
config = Configuration()
# header parameters
header_params = header_params or {}
header_params.update(self.default_headers)
if self.cookie:
header_params['Cookie'] = self.cookie
if header_params:
header_params = self.sanitize_for_serialization(header_params)
header_params = dict(self.parameters_to_tuples(header_params,
collection_formats))
# path parameters
if path_params:
path_params = self.sanitize_for_serialization(path_params)
path_params = self.parameters_to_tuples(path_params,
collection_formats)
for k, v in path_params:
# specified safe chars, encode everything
resource_path = resource_path.replace(
'{%s}' % k, quote(str(v), safe=config.safe_chars_for_path_param))
# query parameters
if query_params:
query_params = self.sanitize_for_serialization(query_params)
query_params = self.parameters_to_tuples(query_params,
collection_formats)
# post parameters
if post_params or files:
post_params = self.prepare_post_parameters(post_params, files)
post_params = self.sanitize_for_serialization(post_params)
post_params = self.parameters_to_tuples(post_params,
collection_formats)
# auth setting
self.update_params_for_auth(header_params, query_params, auth_settings)
# body
if body:
body = self.sanitize_for_serialization(body)
# request url
url = self.host + resource_path
# perform request and return response
response_data = self.request(method, url,
query_params=query_params,
headers=header_params,
post_params=post_params, body=body,
_preload_content=_preload_content,
_request_timeout=_request_timeout)
self.last_response = response_data
return_data = response_data
if _preload_content:
# deserialize response data
if response_type:
return_data = self.deserialize(response_data, response_type)
else:
return_data = None
if callback:
if _return_http_data_only:
callback(return_data)
else:
callback((return_data, response_data.status, response_data.getheaders()))
elif _return_http_data_only:
return (return_data)
else:
return (return_data, response_data.status, response_data.getheaders())
def sanitize_for_serialization(self, obj):
"""
Builds a JSON POST object.
If obj is None, return None.
If obj is str, int, long, float, bool, return directly.
If obj is datetime.datetime, datetime.date
convert to string in iso8601 format.
If obj is list, sanitize each element in the list.
If obj is dict, return the dict.
If obj is swagger model, return the properties dict.
:param obj: The data to serialize.
:return: The serialized form of data.
"""
if obj is None:
return None
elif isinstance(obj, self.PRIMITIVE_TYPES):
return obj
elif isinstance(obj, list):
return [self.sanitize_for_serialization(sub_obj)
for sub_obj in obj]
elif isinstance(obj, tuple):
return tuple(self.sanitize_for_serialization(sub_obj)
for sub_obj in obj)
elif isinstance(obj, (datetime, date)):
return obj.isoformat()
if isinstance(obj, dict):
obj_dict = obj
else:
# Convert model obj to dict except
# attributes `swagger_types`, `attribute_map`
# and attributes which value is not None.
# Convert attribute name to json key in
# model definition for request.
obj_dict = {obj.attribute_map[attr]: getattr(obj, attr)
for attr, _ in iteritems(obj.swagger_types)
if getattr(obj, attr) is not None}
return {key: self.sanitize_for_serialization(val)
for key, val in iteritems(obj_dict)}
def deserialize(self, response, response_type):
"""
Deserializes response into an object.
:param response: RESTResponse object to be deserialized.
:param response_type: class literal for
deserialized object, or string of class name.
:return: deserialized object.
"""
# handle file downloading
# save response body into a tmp file and return the instance
if response_type == "file":
return self.__deserialize_file(response)
# fetch data from response object
try:
data = json.loads(response.data)
except ValueError:
data = response.data
return self.__deserialize(data, response_type)
def __deserialize(self, data, klass):
"""
Deserializes dict, list, str into an object.
:param data: dict, list or str.
:param klass: class literal, or string of class name.
:return: object.
"""
if data is None:
return None
if type(klass) == str:
if klass.startswith('list['):
sub_kls = re.match('list\[(.*)\]', klass).group(1)
return [self.__deserialize(sub_data, sub_kls)
for sub_data in data]
if klass.startswith('dict('):
sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2)
return {k: self.__deserialize(v, sub_kls)
for k, v in iteritems(data)}
# convert str to class
if klass in self.NATIVE_TYPES_MAPPING:
klass = self.NATIVE_TYPES_MAPPING[klass]
else:
klass = getattr(models, klass)
if klass in self.PRIMITIVE_TYPES:
return self.__deserialize_primitive(data, klass)
elif klass == object:
return self.__deserialize_object(data)
elif klass == date:
return self.__deserialize_date(data)
elif klass == datetime:
return self.__deserialize_datatime(data)
else:
return self.__deserialize_model(data, klass)
def call_api(self, resource_path, method,
path_params=None, query_params=None, header_params=None,
body=None, post_params=None, files=None,
response_type=None, auth_settings=None, callback=None,
_return_http_data_only=None, collection_formats=None, _preload_content=True,
_request_timeout=None):
"""
Makes the HTTP request (synchronous) and return the deserialized data.
To make an async request, define a function for callback.
:param resource_path: Path to method endpoint.
:param method: Method to call.
:param path_params: Path parameters in the url.
:param query_params: Query parameters in the url.
:param header_params: Header parameters to be
placed in the request header.
:param body: Request body.
:param post_params dict: Request post form parameters,
for `application/x-www-form-urlencoded`, `multipart/form-data`.
:param auth_settings list: Auth Settings names for the request.
:param response: Response data type.
:param files dict: key -> filename, value -> filepath,
for `multipart/form-data`.
:param callback function: Callback function for asynchronous request.
If provide this parameter,
the request will be called asynchronously.
:param _return_http_data_only: response data without head status code and headers
:param collection_formats: dict of collection formats for path, query,
header, and post parameters.
:param _preload_content: if False, the urllib3.HTTPResponse object will be returned without
reading/decoding response data. Default is True.
:param _request_timeout: timeout setting for this request. If one number provided, it will be total request
timeout. It can also be a pair (tuple) of (connection, read) timeouts.
:return:
If provide parameter callback,
the request will be called asynchronously.
The method will return the request thread.
If parameter callback is None,
then the method will return the response directly.
"""
if callback is None:
return self.__call_api(resource_path, method,
path_params, query_params, header_params,
body, post_params, files,
response_type, auth_settings, callback,
_return_http_data_only, collection_formats, _preload_content, _request_timeout)
else:
thread = threading.Thread(target=self.__call_api,
args=(resource_path, method,
path_params, query_params,
header_params, body,
post_params, files,
response_type, auth_settings,
callback, _return_http_data_only,
collection_formats, _preload_content, _request_timeout))
thread.start()
return thread
def request(self, method, url, query_params=None, headers=None,
post_params=None, body=None, _preload_content=True, _request_timeout=None):
"""
Makes the HTTP request using RESTClient.
"""
if method == "GET":
return self.rest_client.GET(url,
query_params=query_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
headers=headers)
elif method == "HEAD":
return self.rest_client.HEAD(url,
query_params=query_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
headers=headers)
elif method == "OPTIONS":
return self.rest_client.OPTIONS(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "POST":
return self.rest_client.POST(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "PUT":
return self.rest_client.PUT(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "PATCH":
return self.rest_client.PATCH(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "DELETE":
return self.rest_client.DELETE(url,
query_params=query_params,
headers=headers,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
else:
raise ValueError(
"http method must be `GET`, `HEAD`, `OPTIONS`,"
" `POST`, `PATCH`, `PUT` or `DELETE`."
)
def parameters_to_tuples(self, params, collection_formats):
"""
Get parameters as list of tuples, formatting collections.
:param params: Parameters as dict or list of two-tuples
:param dict collection_formats: Parameter collection formats
:return: Parameters as list of tuples, collections formatted
"""
new_params = []
if collection_formats is None:
collection_formats = {}
for k, v in iteritems(params) if isinstance(params, dict) else params:
if k in collection_formats:
collection_format = collection_formats[k]
if collection_format == 'multi':
new_params.extend((k, value) for value in v)
else:
if collection_format == 'ssv':
delimiter = ' '
elif collection_format == 'tsv':
delimiter = '\t'
elif collection_format == 'pipes':
delimiter = '|'
else: # csv is the default
delimiter = ','
new_params.append(
(k, delimiter.join(str(value) for value in v)))
else:
new_params.append((k, v))
return new_params
def prepare_post_parameters(self, post_params=None, files=None):
"""
Builds form parameters.
:param post_params: Normal form parameters.
:param files: File parameters.
:return: Form parameters with files.
"""
params = []
if post_params:
params = post_params
if files:
for k, v in iteritems(files):
if not v:
continue
file_names = v if type(v) is list else [v]
for n in file_names:
with open(n, 'rb') as f:
filename = os.path.basename(f.name)
filedata = f.read()
mimetype = mimetypes.\
guess_type(filename)[0] or 'application/octet-stream'
params.append(tuple([k, tuple([filename, filedata, mimetype])]))
return params
def select_header_accept(self, accepts):
"""
Returns `Accept` based on an array of accepts provided.
:param accepts: List of headers.
:return: Accept (e.g. application/json).
"""
if not accepts:
return
accepts = [x.lower() for x in accepts]
if 'application/json' in accepts:
return 'application/json'
else:
return ', '.join(accepts)
def select_header_content_type(self, content_types):
"""
Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types.
:return: Content-Type (e.g. application/json).
"""
if not content_types:
return 'application/json'
content_types = [x.lower() for x in content_types]
if 'application/json' in content_types or '*/*' in content_types:
return 'application/json'
else:
return content_types[0]
def update_params_for_auth(self, headers, querys, auth_settings):
"""
Updates header and query params based on authentication setting.
:param headers: Header parameters dict to be updated.
:param querys: Query parameters tuple list to be updated.
:param auth_settings: Authentication setting identifiers list.
"""
config = Configuration()
if not auth_settings:
return
for auth in auth_settings:
auth_setting = config.auth_settings().get(auth)
if auth_setting:
if not auth_setting['value']:
continue
elif auth_setting['in'] == 'header':
headers[auth_setting['key']] = auth_setting['value']
elif auth_setting['in'] == 'query':
querys.append((auth_setting['key'], auth_setting['value']))
else:
raise ValueError(
'Authentication token must be in `query` or `header`'
)
def __deserialize_file(self, response):
"""
Saves response body into a file in a temporary folder,
using the filename from the `Content-Disposition` header if provided.
:param response: RESTResponse.
:return: file path.
"""
config = Configuration()
fd, path = tempfile.mkstemp(dir=config.temp_folder_path)
os.close(fd)
os.remove(path)
content_disposition = response.getheader("Content-Disposition")
if content_disposition:
filename = re.\
search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition).\
group(1)
path = os.path.join(os.path.dirname(path), filename)
with open(path, "w") as f:
f.write(response.data)
return path
def __deserialize_primitive(self, data, klass):
"""
Deserializes string to primitive type.
:param data: str.
:param klass: class literal.
:return: int, long, float, str, bool.
"""
try:
return klass(data)
except UnicodeEncodeError:
return unicode(data)
except TypeError:
return data
def __deserialize_object(self, value):
"""
Return a original value.
:return: object.
"""
return value
def __deserialize_date(self, string):
"""
Deserializes string to date.
:param string: str.
:return: date.
"""
try:
from dateutil.parser import parse
return parse(string).date()
except ImportError:
return string
except ValueError:
raise ApiException(
status=0,
reason="Failed to parse `{0}` into a date object".format(string)
)
def __deserialize_datatime(self, string):
"""
Deserializes string to datetime.
The string should be in iso8601 datetime format.
:param string: str.
:return: datetime.
"""
try:
from dateutil.parser import parse
return parse(string)
except ImportError:
return string
except ValueError:
raise ApiException(
status=0,
reason=(
"Failed to parse `{0}` into a datetime object"
.format(string)
)
)
def __deserialize_model(self, data, klass):
"""
Deserializes list or dict to model.
:param data: dict, list.
:param klass: class literal.
:return: model object.
"""
if not klass.swagger_types:
return data
kwargs = {}
for attr, attr_type in iteritems(klass.swagger_types):
if data is not None \
and klass.attribute_map[attr] in data \
and isinstance(data, (list, dict)):
value = data[klass.attribute_map[attr]]
kwargs[attr] = self.__deserialize(value, attr_type)
instance = klass(**kwargs)
return instance
| [
"master@bluehack.net"
] | master@bluehack.net |
76f8173348a5716b3da3222f4654c8d1a1347e29 | 7033686cf027f6f9d25349bdd3cc83e30aa88327 | /main.py | 6812aef93085071f6a353bf7dc8a5fa9b4d05f5a | [] | no_license | Kerni1996/SocialWebGroupProject | ee6f975d54587919b1b0ed7b2836a53f3159666f | 4c3375f017acf60107240b52f18d0c9170e7c77b | refs/heads/master | 2023-01-30T16:46:20.457753 | 2020-12-12T11:19:43 | 2020-12-12T11:19:43 | 320,377,551 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 7,281 | py | # This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import GetOldTweets3 as got
import datetime
import tweepy
import snscrape.modules.twitter as sntwitter
import numpy
import csv
import twitterscraper
import datetime as dt
auth = tweepy.OAuthHandler("LbFtVrIhom3VvxKJvxZ7r7i7R", "ZEyjiU9tVnxhGPjcktdNR3MJPoZWVcB6DHB9CfoQAfSITa1Dqu")
auth.set_access_token("1321890546592501761-QHftta7lerBzMyeAQIRAVF9tgymEpP", "59guj1UkamBCqefaYoCVHCjdZQ9UNbl6JqtkN7Z0vzkP2")
class Tweet:
def __init__(self,id,date,content,username):
self.id = id
self.date = date
self.content = content
self.username = username
#define function to print tweet objects nicely
def __str__(self):
return 'Tweet(id=' + str(self.id) + ', date=' + str(self.date) + ', content='+ self.content+', username='+ self.username+')'
#takes list of twitter IDs as argument and returns a dictionary with the number of tweets in each country
def countCountries(ids):
splittedList = splitList(ids,100)
countriesDict = {}
for list in splittedList:
api = tweepy.API(auth)
tweets = api.statuses_lookup(list)
for tweet in tweets:
#in some very rare cases, the tweet does not have a country entry
if hasattr(tweet.place, 'country'):
countryName = tweet.place.country
if countryName in countriesDict:
countriesDict[countryName] +=1
#if country does not exist in dict create it with initial count value = 1
else:
countriesDict[countryName] = 1
return countriesDict
def getAuthorityData(startDate, endDate, user):
query = "from:" + user + " since:" + startDate + " until:" + endDate
#print (query)
list = []
for i, tweet in enumerate(sntwitter.TwitterSearchScraper(
query).get_items()):
list.append(Tweet(tweet.id, tweet.date, tweet.content,tweet.username))
#print(tweet.id)
return list
def getFirstAppearance(keywords, startDate, endDate, location, printAllTweets):
# build query
counter = 0
hashString = ''
for keyword in keywords:
counter += 1
hashString = hashString + keyword
if counter < len(keywords):
hashString += " OR "
# print(hashString)
query = hashString + " since:" + startDate + " until:" + endDate
if location is not None:
query += ''' near:"''' + location + '''" within:30mi'''
tweets = []
for i, tweet in enumerate(sntwitter.TwitterSearchScraper(
query).get_items()):
t1 = Tweet(tweet.id,tweet.date,tweet.content,tweet.username)
tweets.append(t1)
if printAllTweets:
print(t1)
#frequencycounter+=1
#results.append(Tweet(tweet.id,tweet.date,tweet.content))
#id = tweet.id
if len(tweets)==0:
return "No tweets found between " + str(startDate) + " and "+ str(endDate)
#return last element since it is the earliest
return tweets[len(tweets)-1]
def getEarliestTweets(hashtags, startDate, endDate, location):
#TODO: start ist immer das aktuelle Datum
#convert strings to actual date elements
start = datetime.datetime.strptime(startDate, "%Y-%m-%d")
end = datetime.datetime.strptime(endDate,"%Y-%m-%d")
# build query
counter = 0
hashString = ''
for hashtag in hashtags:
counter += 1
hashString = hashString + hashtag
if counter < len(hashtags):
hashString += " OR "
# print(hashString)
ids = []
results = []
dict = {}
while (start<=end):
query = hashString + " since:" + start.strftime("%Y-%m-%d") + " until:" + (start+datetime.timedelta(days=1)).strftime("%Y-%m-%d")
if location is not None:
query += ''' near:"''' + location+'''" within:50mi'''
#print(query)
frequencycounter = 0
for i, tweet in enumerate(sntwitter.TwitterSearchScraper(
query).get_items()):
frequencycounter+=1
results.append(Tweet(tweet.id,tweet.date,tweet.content,tweet.username))
ids.append(tweet.id)
#print(tweet.id)
#print(tweet.date)
#print(tweet.content+"\n")
dict[start.strftime("%Y-%m-%d")]=frequencycounter
start = start + datetime.timedelta(days=1)
"""for i in reversed(results):
print(i.date)
print(i.id)
print(i.content+"\n")"""
print(dict)
return ids
def getTweets(keyword):
tweetCriteria = got.manager.TweetCriteria().setUsername("barackobama") \
.setTopTweets(True) \
.setMaxTweets(10)
tweet = got.manager.TweetManager.getTweets(tweetCriteria)[0]
print(tweet.text)
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
#function to split a given list (list) into lists of length (length)
def splitList(list,length):
splittedLists= []
counter = 0
tempList = []
while counter<len(list):
tempList.append(list[counter])
counter+=1
if len(tempList) == length or counter == len(list):
splittedLists.append(tempList)
tempList = []
return splittedLists
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
#print(getAuthorityData("2020-10-11","2020-10-12","ORF"))
#print (str(getFirstAppearance(["hurricane","sandy","hurricanesandy"],"2012-10-22","2020-10-28","San Francisco")) + " is the id of the first tweet in the given range at the given location with the given hastags")
#ids = (getEarliestTweets(["hurricane","sandy","hurricanesandy"],"2012-10-22","2020-10-28","San Francisco"))
#print(countCountries(ids))
# hurricane sandy:
#get first post at location with a radius of 30 miles
print(getFirstAppearance(["#hurricanesandy","#sandy","#hurricane","#Sandy", "#HurricaneSandy","#RomneyStormTips","#FrankenStorm","#StaySafe","#ThanksSandy","#FuckYouSandy","#RedCross","#JerseyStrong","#RestoreTheShore","#SandyHelp", "sandy","hurricane","Sandy", "HurricaneSandy"],"2012-10-10","2012-10-30","Nicaragua",True))
#get first post globaly
print(getFirstAppearance(["#hurricanesandy","#sandy","#hurricane","#Sandy", "#HurricaneSandy","#RomneyStormTips","#FrankenStorm","#StaySafe","#ThanksSandy","#FuckYouSandy","#RedCross","#JerseyStrong","#RestoreTheShore","#SandyHelp"],"2012-10-20","2012-10-21",None,True))
#we selected the tweet with the id: 259537544495112192 as initial tweet (relevant for later)
#in order to get a comparable frequency we select 3 hashtags that are for us strongly related to the event and count the frequency of tweets for 24 hours. we cant avoid to count tweets that are not meant to be correlated to the incident
ids = getEarliestTweets(["#hurricanesandy","#sandy","#hurricane"],"2012-10-28","2012-10-29","New York")
#print(countCountries(ids))
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
| [
"alexander@kernreiter.at"
] | alexander@kernreiter.at |
ed9eaf8d898b82c4d3e2949e76cca0402f98f2dd | 708a540af554d48ad8cab6b3406d45e05fb96aa1 | /segmenter/visualizers/LayerOutputVisualizer.py | 972fc882306f74873f2d841e6cd70bd8ce71940b | [
"Unlicense"
] | permissive | brandongk-ubco/segmenter | a10cd2dfb8393639a4d785043b881b1b52a7074f | dbc042d31dc74f1abdc87ae10a6be78ba38ddb91 | refs/heads/master | 2023-07-18T19:28:12.034659 | 2020-12-21T04:54:59 | 2020-12-21T04:54:59 | 236,781,455 | 0 | 0 | Unlicense | 2023-07-06T21:58:36 | 2020-01-28T16:28:36 | Python | UTF-8 | Python | false | false | 2,833 | py | import os
import json
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from segmenter.visualizers.BaseVisualizer import BaseVisualizer
import glob
import numpy as np
class LayerOutputVisualizer(BaseVisualizer):
bins = np.linspace(-10, 10, num=2001)
def execute(self):
csv_file = os.path.join(self.data_dir, "layer-outputs.csv")
clazz = self.data_dir.split("/")[-2]
if not os.path.exists(csv_file):
print("CSV file does not exist {}".format(csv_file))
return
self.results = pd.read_csv(csv_file)
for layer_type in self.results["layer_type"].unique():
layer_type_results = self.results.copy()[self.results["layer_type"]
== layer_type]
layer_type_results.drop("layer_type", axis=1, inplace=True)
layer_type_results.drop("fold", axis=1, inplace=True)
layer_type_results.drop("boost_fold", axis=1, inplace=True)
layer_type_results = layer_type_results.sum(axis=0)
weights = 100 * layer_type_results / np.sum(layer_type_results)
bins = self.bins[:len(weights)]
mean = np.sum(np.multiply(layer_type_results,
bins)) / np.sum(layer_type_results)
std = np.sum(np.multiply(layer_type_results, (bins - mean)**
2)) / np.sum(layer_type_results)
fig = plt.figure()
plt.hist(bins, self.bins, weights=weights)
percentile = np.percentile(weights, 99.9)
plt.ylim([0, percentile])
title = "Output Histogram for {} layers".format(layer_type)
subtitle1 = "{} - Class {}".format(self.label, clazz)
plt.ylabel("Frequency (%): Peak {:1.2f}% at {:1.2f}.".format(
np.max(weights), self.bins[np.argmax(weights)]))
used_bins = weights > 0.01
subtitle2 = "Frequency Concentration: {:1.2f}% in width {:1.2f}.".format(
np.sum(weights[used_bins]),
max(bins[used_bins]) - min(bins[used_bins]))
plt.xlabel("Output Value: Mean {:1.2f}, St. Dev. {:1.2f}".format(
mean, std))
plt.title('')
fig.suptitle(title, y=1.06, fontsize=14)
plt.figtext(.5, 0.99, subtitle1, fontsize=12, ha='center')
plt.figtext(.5, .95, subtitle2, fontsize=12, ha='center')
outfile = os.path.join(self.data_dir,
"layer-output-{}.png".format(layer_type))
print(outfile)
plt.savefig(outfile, dpi=150, bbox_inches='tight', pad_inches=0.5)
plt.close()
def visualize(self, result):
plot = plt.plot([1], [1])
return plot
| [
"brandongk@gmail.com"
] | brandongk@gmail.com |
aaf3e1a0d45c0ae8e0ef320f1f68bb8890160acc | 29b82a48c7373dcbbb7ddc4fc986d80579af94f0 | /src/preprocessing/prepare_warehouse_data.py | f2d5c44a5990eee9c1dee715e00df762d5ff6a0d | [] | no_license | nguyentheimo2011/cs4224-project-mongodb | 585c15f067444b614fa2e50fe8714d6f3f6b2a3e | 84fa69bc80d0c209fe6e0facb39eb1fddaeef219 | refs/heads/master | 2021-01-20T11:44:54.738723 | 2016-11-10T15:01:56 | 2016-11-10T15:01:56 | 72,109,821 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 4,358 | py | import os
import argparse
def prepare_data():
next_delivery_order_ids = prepare_next_delivery_order_id_for_districts()
original_warehouse_file_path = os.path.join(original_data_directory, 'warehouse.csv')
original_district_file_path = os.path.join(original_data_directory, 'district.csv')
prepared_warehouse_file_path = os.path.join(destination_directory, 'warehouse.json')
with open(prepared_warehouse_file_path, 'w') as p_f:
with open(original_warehouse_file_path) as w_f:
for w_line in w_f:
warehouse_obj = {}
warehouse_attributes = w_line.replace('\n', '').split(',')
warehouse_obj['w_num'] = int(warehouse_attributes[0])
warehouse_obj['w_name'] = warehouse_attributes[1]
warehouse_obj['w_street_1'] = warehouse_attributes[2]
warehouse_obj['w_street_2'] = warehouse_attributes[3]
warehouse_obj['w_city'] = warehouse_attributes[4]
warehouse_obj['w_state'] = warehouse_attributes[5]
warehouse_obj['w_zip'] = warehouse_attributes[6]
warehouse_obj['w_tax'] = float(warehouse_attributes[7])
warehouse_obj['w_ytd'] = float(warehouse_attributes[8])
warehouse_obj['w_districts'] = {}
with open(original_district_file_path) as d_f:
for d_line in d_f:
district_attributes = d_line.replace('\n', '').split(',')
if district_attributes[0] != warehouse_attributes[0]:
continue
district_obj = {}
district_number = int(district_attributes[1])
district_obj['d_name'] = district_attributes[2]
district_obj['d_street_1'] = district_attributes[3]
district_obj['d_street_2'] = district_attributes[4]
district_obj['d_city'] = district_attributes[5]
district_obj['d_state'] = district_attributes[6]
district_obj['d_zip'] = district_attributes[7]
district_obj['d_tax'] = float(district_attributes[8])
district_obj['d_ytd'] = float(district_attributes[9])
district_obj['d_next_o_id'] = int(district_attributes[10])
district_obj['d_next_delivery_o_id'] = next_delivery_order_ids[warehouse_obj['w_num']][
district_number
]
warehouse_obj['w_districts'][str(district_number)] = district_obj
p_f.write(str(warehouse_obj) + '\n')
def prepare_next_delivery_order_id_for_districts():
num_warehouses = 0
original_warehouse_file_path = os.path.join(original_data_directory, 'warehouse.csv')
with open(original_warehouse_file_path) as f:
for line in f:
num_warehouses += 1
original_order_file_path = os.path.join(original_data_directory, 'order.csv')
next_delivery_order_ids = {}
for i in range(1, num_warehouses + 1):
next_delivery_order_ids[i] = {}
with open(original_order_file_path) as f:
for line in f:
order_attributes = line.replace('\n', '').split(',')
warehouse_id = int(order_attributes[0])
district_id = int(order_attributes[1])
order_id = int(order_attributes[2])
carrier_id = order_attributes[4]
if carrier_id == 'null':
last_order_id_in_district = next_delivery_order_ids.get(warehouse_id).get(district_id, None)
if last_order_id_in_district is None or last_order_id_in_district > order_id:
next_delivery_order_ids[warehouse_id][district_id] = order_id
return next_delivery_order_ids
if __name__ == '__main__':
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument('-o', '--original', required=True, help="Path to the directory containing original data")
arg_parser.add_argument('-d', '--destination', required=True, help="Path to the directory containing result data")
args = vars(arg_parser.parse_args())
original_data_directory = args['original']
destination_directory = args['destination']
prepare_data()
| [
"nguyentheimo2011@gmail.com"
] | nguyentheimo2011@gmail.com |
45e2ae6c49914c6b0cc75158ca7b01822ea962be | 017ef40dd2ae7611cbd187e6ce64d86547d0abb9 | /rc/Motor_Example.py | 6ba17e19f83c24f20af218ca1dda63264d575979 | [] | no_license | hyfan1116/playground | 70a373151c2b50c9f69a496e8f636696395638ee | fc27f42f39b4c13df0b0fcfe3ee128c4fe8641ed | refs/heads/master | 2021-01-12T15:04:11.832241 | 2019-10-14T04:08:24 | 2019-10-14T04:08:24 | 71,677,437 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,206 | py | #!/usr/bin/python
from Adafruit_PWM_Servo_Driver import PWM
import time
# ===========================================================================
# Example Code
# ===========================================================================
# Initialise the PWM device using the default address
pwm = PWM(0x40)
# Note if you'd like more debug output you can instead run:
#pwm = PWM(0x40, debug=True)
motorZero = 390
motorMin = 290 # Min pulse length out of 4096
motorMax = 415 # Max pulse length out of 4096
def setServoPulse(channel, pulse):
pulseLength = 1000000 # 1,000,000 us per second
pulseLength //= 60 # 60 Hz
print ("%d us per period" % pulseLength)
pulseLength //= 4096 # 12 bits of resolution
print ("%d us per bit" % pulseLength)
pulse *= 1000
pulse /= pulseLength
pwm.setPWM(channel, 0, pulse)
print("start")
pwm.setPWMFreq(60) # Set frequency to 60 Hz
pwm.setPWM(8, 0, motorZero)
input("Press Enter to start")
while (True):
# Change speed of continuous servo on channel O
print("working")
pwm.setPWM(8, 0, motorZero)
time.sleep(2)
pwm.setPWM(8, 0, motorMax)
time.sleep(2) | [
"fanhaoyang1116\"gmail.com"
] | fanhaoyang1116"gmail.com |
984a61dca3d0c585415ca20bbaff11e349e39f16 | 974bebca86a852707b4e2ac3595498cb05654199 | /modin/engines/ray/cudf_on_ray/io/io.py | e0beabc395db44c4b882de95beae046505a1903e | [
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | Longliveping/modin | d7fd4d01e148419165a2f19b4ce2cf53182c2904 | 18dc8f83e2ce4668e44042c56954ba15cc893e4f | refs/heads/master | 2023-04-18T06:30:19.766917 | 2021-05-09T19:39:24 | 2021-05-09T19:39:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,723 | py | # Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific language
# governing permissions and limitations under the License.
from modin.engines.base.io import BaseIO
from modin.engines.ray.cudf_on_ray.io import cuDFCSVDispatcher
from modin.backends.cudf.query_compiler import cuDFQueryCompiler
from modin.engines.ray.cudf_on_ray.frame.data import cuDFOnRayFrame
from modin.engines.ray.cudf_on_ray.frame.partition_manager import (
cuDFOnRayFrameManager,
)
from modin.engines.ray.cudf_on_ray.frame.partition import (
cuDFOnRayFramePartition,
)
from modin.engines.ray.task_wrapper import RayTask
from modin.backends.cudf.parser import cuDFCSVParser
class cuDFOnRayIO(BaseIO):
frame_cls = cuDFOnRayFrame
query_compiler_cls = cuDFQueryCompiler
build_args = dict(
frame_partition_cls=cuDFOnRayFramePartition,
query_compiler_cls=cuDFQueryCompiler,
frame_cls=cuDFOnRayFrame,
frame_partition_mgr_cls=cuDFOnRayFrameManager,
)
read_csv = type("", (RayTask, cuDFCSVParser, cuDFCSVDispatcher), build_args).read
| [
"noreply@github.com"
] | Longliveping.noreply@github.com |
1c59053d7c6f0cc642b0dbe1ecc9f46b90c2c6f1 | 34745a8d54fa7e3d9e4237415eb52e507508ad79 | /Python_Advanced/05_Functions Advanced/Exercise/04_negative_vs_positive.py | db0c4a49d3f9878fa05166a33c9f802e169e1017 | [] | no_license | DilyanTsenkov/SoftUni-Software-Engineering | 50476af0dc88b267d72c56fa87eeb88d841164b2 | fe446e3a50a00bb2e48d71ab8f783e0a4a406094 | refs/heads/main | 2023-08-12T18:18:42.144210 | 2021-09-25T11:10:38 | 2021-09-25T11:10:38 | 317,235,419 | 1 | 2 | null | null | null | null | UTF-8 | Python | false | false | 1,072 | py | def absolute(negative_sum):
return abs(negative_sum)
def compare_negative_positive_sum(negative_sum, positive_sum):
if positive_sum >= negative_sum:
return True
else:
return False
def negative_separator(numbers):
if numbers < 0:
return True
def positive_separator(number):
if number >= 0:
return True
def printer(true_ot_false, positive_sum, negative_sum):
print(negative_sum)
print(positive_sum)
if true_ot_false:
print(f"The positives are stronger than the negatives")
else:
print(f"The negatives are stronger than the positives")
def sum_calc(nums):
return sum(nums)
numbers = [int(el) for el in input().split()]
negative = list(filter(negative_separator, numbers))
positive = list(filter(positive_separator, numbers))
negative_sum = sum_calc(negative)
positive_sum = sum_calc(positive)
negative_abs_sum = absolute(negative_sum)
printer(compare_negative_positive_sum(negative_abs_sum, positive_sum), positive_sum, negative_sum)
| [
"noreply@github.com"
] | DilyanTsenkov.noreply@github.com |
245fefb6b13563caaf367493baeec4fa8694dfee | c7f476a72d485e4eba8c67a28eb0f88cb327a803 | /repeat.py | a0e7a2d9bafe6ecafe23cf294dbe0fb2ec1759af | [] | no_license | KotipalliMadhavi92/GUVI_SampleRepo | 94ec84809d87b8340200f7c2e1f974dfd993e7b4 | 5836d4e11b172ad38639fcd6ac2cd7f2645df37d | refs/heads/master | 2020-04-08T08:33:07.464675 | 2018-11-26T15:19:28 | 2018-11-26T15:19:28 | 159,182,720 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 199 | py | a=int(input())
l=list(input().split())
ans=list()
for i in range(0,a):
if l[i] in l[i+1:]:
ans.append(l[i])
if(len(ans)==0):
print("unique")
else:
for i in ans:
print(i,end=" ")
| [
"noreply@github.com"
] | KotipalliMadhavi92.noreply@github.com |
5c5fe9527304738d1add27c1a72d2139e50b56ea | 882fc389b7082cff9bd8c9a5e39a2177658a6daa | /test.py | 4697471e0b92326df13d5c89831323c973620658 | [] | no_license | changruowang/myRegressionProj | 8fe92d4405141e35186fdf28a35e90f643d120dc | b17060134a1e3357c3bc22882f564163a17ba3e4 | refs/heads/master | 2023-03-31T05:57:47.854099 | 2021-03-31T12:21:39 | 2021-03-31T12:21:39 | 353,340,343 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 18,338 | py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys, glob
import torch.nn as nn
from torch.utils.data import DataLoader
import torchvision
import torch
import numpy as np
import utils
from multiprocessing import freeze_support
import dataset
from dataset import noise_class2idx, NoiseLevelRegDataset, save_csv, noise_class2weight
from model_config import MultiOutputModel
import cv2
from utils import multiple_regression_eval, load_image
from my_transform import get_transform, MySelectedCrop
import argparse
from tqdm import tqdm
import visual
cv2.setNumThreads(0)
cv2.ocl.setUseOpenCL(False)
device = torch.device('cuda:0')
def get_args():
parser = argparse.ArgumentParser(description='My detection code training based on pytorch!')
parser.add_argument('--work_dir', default='/home/arc-crw5713/myRegresionProj/ghostnet_0.001_wt_t', help='save out put dir')
parser.add_argument('--model_name', default='ghostnet', help='se_resnet18')
parser.add_argument('--use_tta', action="store_true", help='se_resnet18')
parser.add_argument('--crop_sel',type=str,default='random',help='sel ynoise_loss, strength,cnoise')
parser.add_argument('--image_dir',type=str,default='/home/arc-crw5713/data/noise_level/',help='')
parser.add_argument('--patch_size',type=int,default=224,help='')
parser.add_argument('--test_mode',type=str,default='loader',help='')
parser.add_argument('--tta_metric',type=str,default='median',help='')
parser.add_argument('--visual_cat',type=str,default='Ynoise',help='')
parser.add_argument('--run_times',type=int,default=1,help='')
args = parser.parse_args()
return args
def load_model_weights(model, opt):
'''加载模型权重
'''
model_path = os.path.join(opt.work_dir, "checkpoints/epoch_best_model.pth")
model.load_state_dict(torch.load(model_path)['model'])
print('Successfully load weights from %s'%model_path)
def load_weights(model, work_dir):
'''加载模型权重
Args:
work_dir: 工作路径
'''
model_path = os.path.join(work_dir, "checkpoints/epoch_best_model.pth")
model.load_state_dict(torch.load(model_path)['model'])
print('Successfully load weights from %s'%model_path)
@torch.no_grad()
class MyClassificationTTA(object):
'''测试专用的类
将 tta测试的 逻辑进行了封装,输入图片,在该类完成对输入图片的patch采样,预测,以及综合
决策输出
'''
def __init__(self, model, device, use_tta=False, opt=None, metric='mean', out_crop_results=True):
'''
Args:
model: 模型字典 {'unet': unet_mode, 'resnet': resnet} (可以同时包含多个需要测试的模型)
这样可以保证每个模型每次测试的是相同的 patch
use_tta: 是否使用 tta 测试,即是是直接对整张图预测 还是 crop多个patch分别预测后综合
opt: 配置结构
metric: 多个结果融合的方法 mean median 取均值或者取中位数
out_crop_results:是否输出 每个crop 的位置和预测值(如果有gt也会存储gt), 存为txt格式
。在visual.py中有解析和可视化结果文件的函数
'''
self.tta_transform = MySelectedCrop(opt.patch_size, mode=opt.crop_sel)
self.post_transform = torchvision.transforms.Compose([
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])])
assert(type(model) == type({}))
self.model = model
self.device = device
self.use_tta = use_tta
self.metric = metric
self.out_crop_results = out_crop_results
def get_crop_mounts(self):
return self.tta_transform.get_crop_mounts()
def __call__(self, image_path):
img = load_image(image_path)
if self.use_tta:
croped_imgs, poses = self.tta_transform.tta_out(img, image_path)
imgs = [self.post_transform(img).unsqueeze(0) for img in croped_imgs]
# imgs = [self.post_transform(img).unsqueeze(0) for img in self.tta_transform.tta_out(img)]
imgs = torch.cat(imgs, dim=0).to(self.device)
else:
imgs = self.post_transform(self.tta_transform(img)).unsqueeze(0).to(self.device)
out_str = {}
for k, m in self.model.items():
ans = {k:v.cpu() for k,v in m(imgs).items()}
if self.metric == 'mean':
re = {k:(torch.sum(v)-torch.min(v)-torch.max(v))/(len(croped_imgs)-2) for k, v in ans.items()}
elif self.metric == 'median':
re = {k:torch.median(v, dim=0)[0] for k, v in ans.items()}
tmp = ['%.3f'%re['Ynoise'], '%.3f'%re['strength']]
if self.use_tta and self.out_crop_results:
y_scores = ans['Ynoise'].numpy().tolist()
str_scores = ans['strength'].numpy().tolist()
tmp += ['%.3f_%.3f_%d_%d'%(sy, ss, pos[0], pos[1]) for sy, ss, pos in
zip(y_scores, str_scores, poses)]
out_str.update({k:tmp})
return re, out_str
@torch.no_grad()
def test_on_loader(models, opt):
'''使用 dataloader 测试, 用于在.h5格式的验证集上计算平均损失,将结果存在 test_loss.txt文件中
Args:
model: 模型字典 {'unet': unet_mode, 'resnet': resnet} (可以同时包含多个需要测试的模型)
opt: 参数
'''
valid_data = NoiseLevelRegDataset(base_path=opt.image_dir, phase='val', class2weight=noise_class2weight,
class2idx=noise_class2idx, transform=get_transform(False, path_size=opt.patch_size, params=opt.crop_sel))
valid_dateloader = torch.utils.data.DataLoader(valid_data, batch_size=32, shuffle=False, num_workers=0, drop_last=True)
# multiple_regression_eval(model, valid_dateloader, device)
all_results = []
loss_labels = ['Ynoise','strength','loss_all']
all_loss = {model_name : {k:0.0 for k in loss_labels} for model_name in models.keys()}
pbar = tqdm(valid_dateloader, total=len(valid_dateloader))
for batch in pbar:
images = batch['img'].to(device)
target_labels = batch['labels']
target_labels = {t: target_labels[t].float().to(device) for t in target_labels}
for m_name, m in models.items():
ans = m(images)
_, loss_ans = m.get_loss(ans, target_labels)
for k in loss_labels:
all_loss[m_name][k] += loss_ans[k]
# out = model(images)
# _, losses_dict = model.get_loss(out, target_labels)
# for k in loss_labels:
# all_loss[k] += losses_dict[k]
# re = torch.stack((out['Ynoise'], out['strength'], target_labels['Ynoise'], target_labels['strength']), dim=1).cpu().numpy().tolist()
# all_results += [[name]+ans for name, ans in zip(batch['name'], re)]
for name, ans in all_loss.items():
all_loss[name] = {k: v/len(valid_dateloader) for k,v in ans.items()}
f = open(os.path.join(opt.work_dir[name], 'test_loss.txt'),'w')
for label in loss_labels:
f.write((label+':%.5f\t')%(all_loss[name][label]))
f.close()
# all_results = np.asarray(all_results)
# fieldnames = ['path', 'Ynoise', 'strength', 'gt_Ynoise', 'gt_strength']
# save_csv(all_results, os.path.join(opt.work_dir, 'loader_pred_results.txt'),fieldnames=fieldnames)
@torch.no_grad()
def test_on_imagedir(models, opt):
'''测试图片文件夹中所有图片,将测试结果存储为 imagedir_pred_results.txt 可以使用 visual.py
中的可视化函数解析
Args:
model: 模型字典
opt.image_dir: 包含路片的路径
'''
model_tta = MyClassificationTTA(models, device, use_tta=opt.use_tta, opt=opt, metric=opt.tta_metric)
all_results = {k:[] for k in models.keys()}
imgs_path = glob.glob(os.path.join(opt.image_dir, '*[bmp,jpg]'))
# ### 每张图测试 多次
imgs_path = [p for p in imgs_path for i in range(opt.run_times)]
pbar = tqdm(imgs_path, total=len(imgs_path))
for img_path in pbar:
(_,file_name) = os.path.split(img_path)
re, res_str = model_tta(img_path)
for k, v in res_str.items():
all_results[k].append([file_name] + v)
p_mounts = model_tta.get_crop_mounts()
fieldnames = ['path', 'Ynoise', 'strength'] + ['p%d'%i for i in range(p_mounts)]
for model_name, res_str in all_results.items():
res_str = np.asarray(res_str)
save_csv(res_str, os.path.join(opt.work_dir[model_name], 'imagedir_pred_results.txt'),
fieldnames=fieldnames)
@torch.no_grad()
def test_on_annotion(models, opt):
'''测试用 txt 文件标注了的数据集。将测试结果存储为 anno_pred_results.txt 可以使用 visual.py
中的可视化函数解析
Args:
model: 模型字典
opt.image_dir: 此时表示 .txt 标注文件的路径
'''
anno_path = opt.image_dir
(base_path, _) = os.path.split(anno_path)
model_tta = MyClassificationTTA(models, device, use_tta=opt.use_tta, opt=opt, metric=opt.tta_metric)
all_results = {k:[] for k in models.keys()}
images_name, gt_Ynoise, gt_strength, _ = dataset.read_noise_level_annotations(opt.image_dir, name_only=True)
### 单张图测试50次
images_name = [p for p in images_name for i in range(opt.run_times)]
gt_Ynoise = [p for p in gt_Ynoise for i in range(opt.run_times)]
gt_strength = [p for p in gt_strength for i in range(opt.run_times)]
pbar = tqdm(images_name, total=len(images_name))
for idx, file_name in enumerate(pbar):
img_path = os.path.join(base_path, 'images', file_name)
# out, crop_results = model_tta(img_path)
re, res_str = model_tta(img_path)
for k, v in res_str.items():
all_results[k].append([file_name, gt_Ynoise[idx], gt_strength[idx]] + v)
p_mounts = model_tta.get_crop_mounts()
fieldnames = ['path', 'gt_Ynoise', 'gt_strength', 'Ynoise', 'strength'] + ['p%d'%i for i in range(p_mounts)]
for model_name, res_str in all_results.items():
res_str = np.asarray(res_str)
save_csv(res_str, os.path.join(opt.work_dir[model_name], 'anno_pred_results.txt'),
fieldnames=fieldnames)
if __name__ == '__main__':
args = get_args()
### 模型初始化 输入可以有多个模型
model_names = [str(name) for name in args.model_name.split(",")]
work_dirs = [args.work_dir%(name) for name in model_names]
args.work_dir = {}
models = {}
for model_name, work_dir in zip(model_names, work_dirs):
model = MultiOutputModel(2, model_name=model_name, weights=False).to(device)
load_weights(model, work_dir)
model.eval()
models.update({model_name:model})
args.work_dir.update({model_name:work_dir})
if args.test_mode == 'dir':
test_on_imagedir(models, args)
elif args.test_mode == 'loader':
test_on_loader(models, args)
elif args.test_mode == 'txt':
test_on_annotion(models, args)
# @torch.no_grad()
# def test_on_loader(opt):
# device = torch.device('cuda:0')
# model = MultiOutputModel(2, model_name=opt.model_name, weights=False).to(device)
# load_model_weights(model, opt)
# model.eval()
# valid_data = NoiseLevelRegDataset(base_path=opt.image_dir, phase='val', class2weight=noise_class2weight,
# class2idx=noise_class2idx, transform=get_transform(False, path_size=64, params=opt.crop_sel))
# valid_dateloader = torch.utils.data.DataLoader(valid_data, batch_size=64, shuffle=False, num_workers=4, drop_last=True)
# # multiple_regression_eval(model, valid_dateloader, device)
# all_results = []
# loss_labels = ['Ynoise','strength','loss_all']
# all_loss = {k:0.0 for k in loss_labels}
# pbar = tqdm(valid_dateloader, total=len(valid_dateloader))
# for batch in pbar:
# images = batch['img'].to(device)
# target_labels = batch['labels']
# target_labels = {t: target_labels[t].float().to(device) for t in target_labels}
# out = model(images)
# _, losses_dict = model.get_loss(out, target_labels, out_sel=[1,1])
# for k in loss_labels:
# all_loss[k] += losses_dict[k]
# re = torch.stack((out['Ynoise'], out['strength'], target_labels['Ynoise'], target_labels['strength']), dim=1).cpu().numpy().tolist()
# all_results += [[name]+ans for name, ans in zip(batch['name'], re)]
# all_loss = {k: v/len(valid_dateloader) for k, v in all_loss.items()}
# all_results = np.asarray(all_results)
# fieldnames = ['path', 'Ynoise', 'strength', 'gt_Ynoise', 'gt_strength']
# save_csv(all_results, os.path.join(opt.work_dir, 'pred_results.txt'),fieldnames=fieldnames)
# f = open(os.path.join(opt.work_dir, 'test_loss.txt'),'w')
# for label in loss_labels:
# f.write((label+':%.5f\t')%(all_loss[label]))
# f.close()
# @torch.no_grad()
# def test_on_imagedir(opt):
# device = torch.device('cuda:0')
# model = MultiOutputModel(2, model_name=opt.model_name, weights=False).to(device)
# load_model_weights(model, opt)
# model.eval()
# model_tta = MyClassificationTTA(model, device, use_tta=opt.use_tta, opt=opt, metric=opt.tta_metric)
# all_results = []
# imgs_path = glob.glob(os.path.join(opt.image_dir, '*[bmp,jpg]'))
# # ### 每张图测试50次
# # imgs_path = [p for p in imgs_path for i in range(50)]
# pbar = tqdm(imgs_path, total=len(imgs_path))
# for img_path in pbar:
# (_,file_name) = os.path.split(img_path)
# out, crop_results = model_tta(img_path)
# tmp = [file_name, out['Ynoise'].item(), out['strength'].item()] + crop_results
# all_results.append(tmp)
# p_mounts = model_tta.get_crop_mounts()
# fieldnames = ['path', 'Ynoise', 'strength'] + ['p%d'%i for i in range(p_mounts)]
# all_results = np.asarray(all_results)
# save_csv(all_results, os.path.join(opt.work_dir, 'imagedir_pred_results.txt'), fieldnames=fieldnames)
# # all_results = np.asarray(all_results)
# # fieldnames = ['path', 'Ynoise', 'strength']
# # save_csv(all_results, os.path.join(opt.work_dir, 'pred_results.txt'), fieldnames=fieldnames)
# class MyClassificationTTA(object):
# def __init__(self, model, device, use_tta=False, opt=None, metric='mean', out_crop_results=True):
# self.tta_transform = MySelectedCrop(opt.patch_size, mode=opt.crop_sel)
# self.post_transform = torchvision.transforms.Compose([
# torchvision.transforms.ToTensor(),
# torchvision.transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])])
# self.model = model
# self.device = device
# self.use_tta = use_tta
# self.metric = metric
# self.out_crop_results = out_crop_results
# def get_crop_mounts(self):
# return self.tta_transform.get_crop_mounts()
# def __call__(self, image_path):
# img = load_image(image_path)
# if self.use_tta:
# croped_imgs, poses = self.tta_transform.tta_out(img)
# imgs = [self.post_transform(img).unsqueeze(0) for img in croped_imgs]
# # imgs = [self.post_transform(img).unsqueeze(0) for img in self.tta_transform.tta_out(img)]
# imgs = torch.cat(imgs, dim=0).to(self.device)
# else:
# imgs = self.post_transform(self.tta_transform(img)).unsqueeze(0).to(self.device)
# out = self.model(imgs)
# out = {k:v.cpu() for k,v in out.items()}
# if self.metric == 'mean':
# re = {k:(torch.sum(v)-torch.min(v)-torch.max(v))/(len(croped_imgs)-2) for k, v in out.items()}
# elif self.metric == 'median':
# re = {k:torch.median(v, dim=0)[0] for k, v in out.items()}
# crop_results = None
# ### 只能输出一个类别的结果
# if self.use_tta and self.out_crop_results:
# y_scores = out['Ynoise'].numpy().tolist()
# str_scores = out['strength'].numpy().tolist()
# crop_results = ['%.3f_%.3f_%d_%d'%(sy, ss, pos[0], pos[1]) for sy, ss, pos in zip(y_scores, str_scores, poses)]
# return re, crop_results
# @torch.no_grad()
# def test_on_annotion(opt):
# anno_path = opt.image_dir
# (base_path, _) = os.path.split(anno_path)
# device = torch.device('cuda:0')
# model = MultiOutputModel(2, model_name=opt.model_name, weights=False).to(device)
# load_model_weights(model, opt)
# model.eval()
# model_tta = MyClassificationTTA(model, device, use_tta=opt.use_tta, opt=opt, metric=opt.tta_metric)
# all_results = []
# images_name, gt_Ynoise, gt_strength, _ = dataset.read_noise_level_annotations(opt.image_dir, name_only=True)
# # ### 单张图测试50次
# # images_name = [p for p in images_name for i in range(50)]
# # gt_Ynoise = [p for p in gt_Ynoise for i in range(50)]
# pbar = tqdm(images_name, total=len(images_name))
# for idx, file_name in enumerate(pbar):
# img_path = os.path.join(base_path, 'images', file_name)
# # img = load_image(img_path, transform=trans)
# out, crop_results = model_tta(img_path)
# tmp = [file_name, out['Ynoise'].item(), out['strength'].item()]
# tmp += [gt_Ynoise[idx], gt_strength[idx]] + crop_results
# all_results.append(tmp)
# p_mounts = model_tta.get_crop_mounts()
# fieldnames = ['path', 'Ynoise', 'strength', 'gt_Ynoise', 'gt_strength'] + ['p%d'%i for i in range(p_mounts)]
# all_results = np.asarray(all_results)
# save_csv(all_results, os.path.join(opt.work_dir, 'anno_pred_results.txt'), fieldnames=fieldnames)
| [
"44989223+changruowang@users.noreply.github.com"
] | 44989223+changruowang@users.noreply.github.com |
e309b3d53e3f10fc4a8a3d3f0777de04aac9a701 | 0c5f0ce665cf8477f3a6c377fb5e329cc6984938 | /apps/interfaces/migrations/0002_interfaces_is_delete.py | c329d994bad75e9c6183e77e1e96aac1c2e58e2a | [] | no_license | rggaoxin/lemon_test_django | 7de61c0c24e5d802a7c986d99c8b2352d7254d56 | 0865302c4c8f095331c20a7631317aaeea395187 | refs/heads/main | 2023-02-21T03:48:02.524567 | 2021-01-15T08:56:01 | 2021-01-15T08:56:01 | 329,553,577 | 5 | 5 | null | null | null | null | UTF-8 | Python | false | false | 441 | py | # Generated by Django 3.1.3 on 2021-01-14 01:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('interfaces', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='interfaces',
name='is_delete',
field=models.BooleanField(default=False, help_text='逻辑删除', verbose_name='逻辑删除'),
),
]
| [
"467126493@qq.com"
] | 467126493@qq.com |
aee62795c6a4a1e4d51b8ae53706a90b13a95bf2 | 9ea6319966cac38a6e77e2a558e2f6a63de7595d | /qwt/math.py | d6eb818eae99df62c93c333137f5b0f5a1662bc3 | [] | no_license | xalton/PokeIA | 85ac5f7e076eba6394fcf7e16c5b66b8364c68fb | 2d1eab1c9a90dd1b7a1f776f1b2955aa35bbe480 | refs/heads/master | 2020-09-29T02:50:50.657169 | 2020-03-14T12:36:46 | 2020-03-14T12:36:46 | 226,931,122 | 3 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,511 | py | # -*- coding: utf-8 -*-
#
# Licensed under the terms of the Qwt License
# Copyright (c) 2002 Uwe Rathmann, for the original C++ code
# Copyright (c) 2015 Pierre Raybaut, for the Python translation/optimization
# (see LICENSE file for more details)
from qwt.qt.QtCore import qFuzzyCompare
import numpy as np
def qwtFuzzyCompare(value1, value2, intervalSize):
eps = abs(1.e-6*intervalSize)
if value2 - value1 > eps:
return -1
elif value1 - value2 > eps:
return 1
else:
return 0
def qwtFuzzyGreaterOrEqual(d1, d2):
return (d1 >= d2) or qFuzzyCompare(d1, d2)
def qwtFuzzyLessOrEqual(d1, d2):
return (d1 <= d2) or qFuzzyCompare(d1, d2)
def qwtSign(x):
if x > 0.:
return 1
elif x < 0.:
return -1
else:
return 0
def qwtSqr(x):
return x**2
def qwtFastAtan(x):
if x < -1.:
return -.5*np.pi - x/(x**2 + .28)
elif x > 1.:
return .5*np.pi - x/(x**2 + .28)
else:
return x/(1. + x**2*.28)
def qwtFastAtan2(y, x):
if x > 0:
return qwtFastAtan(y/x)
elif x < 0:
d = qwtFastAtan(y/x)
if y >= 0:
return d + np.pi
else:
return d - np.pi
elif y < 0.:
return -.5*np.pi
elif y > 0.:
return .5*np.pi
else:
return 0.
def qwtRadians(degrees):
return degrees * np.pi/180.
def qwtDegrees(radians):
return radians * 180./np.pi
| [
"xalton94@gmail.com"
] | xalton94@gmail.com |
a370c978a47bc4b67c07d327141825fd9ce68d99 | b441503bcdb484d098885b19a989932b8d053a71 | /neural_sp/evaluators/wordpiece.py | aae95de11e128601df6e62d74b585a82e86bef85 | [
"Apache-2.0"
] | permissive | entn-at/neural_sp | a266594b357b175b0fea18253433e32adc62810c | 9dbbb4ab3985b825f8e9120a603a6caa141c8bdd | refs/heads/master | 2020-08-28T05:48:28.928667 | 2020-06-22T19:17:53 | 2020-06-22T19:17:53 | 217,611,439 | 0 | 0 | null | 2019-10-25T20:40:18 | 2019-10-25T20:40:18 | null | UTF-8 | Python | false | false | 7,250 | py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2018 Kyoto University (Hirofumi Inaguma)
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""Evaluate the wordpiece-level model by WER."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
from tqdm import tqdm
from neural_sp.evaluators.edit_distance import compute_wer
from neural_sp.utils import mkdir_join
logger = logging.getLogger(__name__)
def eval_wordpiece(models, dataset, recog_params, epoch,
recog_dir=None, streaming=False, progressbar=False,
fine_grained=False):
"""Evaluate the wordpiece-level model by WER.
Args:
models (list): models to evaluate
dataset (Dataset): evaluation dataset
recog_params (dict):
epoch (int):
recog_dir (str):
streaming (bool): streaming decoding for the session-level evaluation
progressbar (bool): visualize the progressbar
fine_grained (bool): calculate fine-grained WER distributions based on input lengths
Returns:
wer (float): Word error rate
cer (float): Character error rate
"""
# Reset data counter
dataset.reset(recog_params['recog_batch_size'])
if recog_dir is None:
recog_dir = 'decode_' + dataset.set + '_ep' + str(epoch) + '_beam' + str(recog_params['recog_beam_width'])
recog_dir += '_lp' + str(recog_params['recog_length_penalty'])
recog_dir += '_cp' + str(recog_params['recog_coverage_penalty'])
recog_dir += '_' + str(recog_params['recog_min_len_ratio']) + '_' + str(recog_params['recog_max_len_ratio'])
recog_dir += '_lm' + str(recog_params['recog_lm_weight'])
ref_trn_save_path = mkdir_join(models[0].save_path, recog_dir, 'ref.trn')
hyp_trn_save_path = mkdir_join(models[0].save_path, recog_dir, 'hyp.trn')
else:
ref_trn_save_path = mkdir_join(recog_dir, 'ref.trn')
hyp_trn_save_path = mkdir_join(recog_dir, 'hyp.trn')
wer, cer = 0, 0
n_sub_w, n_ins_w, n_del_w = 0, 0, 0
n_sub_c, n_ins_c, n_del_c = 0, 0, 0
n_word, n_char = 0, 0
n_streamable, quantity_rate, n_utt = 0, 0, 0
last_success_frame_ratio = 0
if progressbar:
pbar = tqdm(total=len(dataset))
# calculate WER distribution based on input lengths
wer_dist = {}
with open(hyp_trn_save_path, 'w') as f_hyp, open(ref_trn_save_path, 'w') as f_ref:
while True:
batch, is_new_epoch = dataset.next(recog_params['recog_batch_size'])
if streaming or recog_params['recog_chunk_sync']:
best_hyps_id, _ = models[0].decode_streaming(
batch['xs'], recog_params, dataset.idx2token[0],
exclude_eos=True)
else:
best_hyps_id, _ = models[0].decode(
batch['xs'], recog_params,
idx2token=dataset.idx2token[0] if progressbar else None,
exclude_eos=True,
refs_id=batch['ys'],
utt_ids=batch['utt_ids'],
speakers=batch['sessions' if dataset.corpus == 'swbd' else 'speakers'],
ensemble_models=models[1:] if len(models) > 1 else [])
for b in range(len(batch['xs'])):
ref = batch['text'][b]
if ref[0] == '<':
ref = ref.split('>')[1]
hyp = dataset.idx2token[0](best_hyps_id[b])
# Write to trn
speaker = str(batch['speakers'][b]).replace('-', '_')
if streaming:
utt_id = str(batch['utt_ids'][b]) + '_0000000_0000001'
else:
utt_id = str(batch['utt_ids'][b])
f_ref.write(ref + ' (' + speaker + '-' + utt_id + ')\n')
f_hyp.write(hyp + ' (' + speaker + '-' + utt_id + ')\n')
logger.debug('utt-id: %s' % utt_id)
logger.debug('Ref: %s' % ref)
logger.debug('Hyp: %s' % hyp)
logger.debug('-' * 150)
if not streaming:
# Compute WER
wer_b, sub_b, ins_b, del_b = compute_wer(ref=ref.split(' '),
hyp=hyp.split(' '),
normalize=False)
wer += wer_b
n_sub_w += sub_b
n_ins_w += ins_b
n_del_w += del_b
n_word += len(ref.split(' '))
if fine_grained:
xlen_bin = (batch['xlens'][b] // 200 + 1) * 200
if xlen_bin in wer_dist.keys():
wer_dist[xlen_bin] += [wer_b / 100]
else:
wer_dist[xlen_bin] = [wer_b / 100]
# Compute CER
if dataset.corpus == 'csj':
ref = ref.replace(' ', '')
hyp = hyp.replace(' ', '')
cer_b, sub_b, ins_b, del_b = compute_wer(ref=list(ref),
hyp=list(hyp),
normalize=False)
cer += cer_b
n_sub_c += sub_b
n_ins_c += ins_b
n_del_c += del_b
n_char += len(ref)
if models[0].streamable():
n_streamable += 1
else:
last_success_frame_ratio += models[0].last_success_frame_ratio()
quantity_rate += models[0].quantity_rate()
n_utt += 1
if progressbar:
pbar.update(1)
if is_new_epoch:
break
if progressbar:
pbar.close()
# Reset data counters
dataset.reset()
if not streaming:
wer /= n_word
n_sub_w /= n_word
n_ins_w /= n_word
n_del_w /= n_word
cer /= n_char
n_sub_c /= n_char
n_ins_c /= n_char
n_del_c /= n_char
if n_utt - n_streamable > 0:
last_success_frame_ratio /= (n_utt - n_streamable)
n_streamable /= n_utt
quantity_rate /= n_utt
if fine_grained:
for len_bin, wers in sorted(wer_dist.items(), key=lambda x: x[0]):
logger.info(' WER (%s): %.2f %% (%d)' % (dataset.set, sum(wers) / len(wers), len_bin))
logger.debug('WER (%s): %.2f %%' % (dataset.set, wer))
logger.debug('SUB: %.2f / INS: %.2f / DEL: %.2f' % (n_sub_w, n_ins_w, n_del_w))
logger.debug('CER (%s): %.2f %%' % (dataset.set, cer))
logger.debug('SUB: %.2f / INS: %.2f / DEL: %.2f' % (n_sub_c, n_ins_c, n_del_c))
logger.info('Streamablility (%s): %.2f %%' % (dataset.set, n_streamable * 100))
logger.info('Quantity rate (%s): %.2f %%' % (dataset.set, quantity_rate * 100))
logger.info('Last success frame ratio (%s): %.2f %%' % (dataset.set, last_success_frame_ratio))
return wer, cer
| [
"hiro.mhbc@gmail.com"
] | hiro.mhbc@gmail.com |
f69ca1620d84787a070cb87c845699b2c947878a | 5171454307a8ed915ad5c480443f34d4d36abd09 | /person.py | c9b7d0243d65c5ad489ddebe12777e7eeaa13ae7 | [
"MIT"
] | permissive | dpoy/python- | 1eab4a9686314ed09a8b74fe155879e8971e0fd1 | 311217a669bdd9ad70545aba5956381b577a48a5 | refs/heads/main | 2023-01-02T12:46:17.898077 | 2020-10-26T03:23:32 | 2020-10-26T03:23:32 | 302,836,136 | 1 | 0 | MIT | 2020-10-26T03:23:33 | 2020-10-10T06:53:56 | null | UTF-8 | Python | false | false | 244 | py | def build_person(first_name, last_name):
"""返回一个字典,其中包含有关一个人的信息"""
person = {'first': first_name, 'last': last_name}
return person
muscian = build_person('jimi', 'hellion')
print(muscian) | [
"noreply@github.com"
] | dpoy.noreply@github.com |
3d9b0e5df8724e5d2920fb4941c70c8a612e36c8 | 931268a497e866537492263be6fea75cf46b1aee | /GUI/main.py | 6a18b0d28a602df0daf2c7ea9d1f7ea2685a4395 | [] | no_license | Bioinf-homework/Bioinf | e905da3fda40e785008601827ebe7af6fee11294 | 918b2dd51efc3a2dcceb40eaab97e12bd041bf40 | refs/heads/master | 2020-05-29T08:52:00.015672 | 2016-12-02T05:35:27 | 2016-12-02T05:35:27 | 69,361,357 | 1 | 1 | null | 2016-11-12T14:02:17 | 2016-09-27T13:45:47 | Python | UTF-8 | Python | false | false | 1,806 | py | # coding=utf-8
import wx
from Lib import *
# ----------------------------------------------------------------------------
TitleTexts = [u"K操作",
u"Fasta算法",
u"编辑距离",
u"NW&SW算法",
u"ID3决策树"
]
class TestCB(wx.Choicebook):
def __init__(self, parent):
wx.Choicebook.__init__(self, parent, wx.ID_ANY)
# Now make a bunch of panels for the choice book
count = 1
for txt in TitleTexts:
if count == 1:
win = K.Panel1(self)
elif count == 2:
win = Fasta.Panel2(self)
elif count == 3:
win = Editd.Panel3(self)
elif count == 4:
win = NWSW.Panel3(self)
else:
win = DT.Panel4(self)
count += 1
self.AddPage(win, txt)
########################################################################
class DemoFrame(wx.Frame):
"""
Frame that holds all other widgets
"""
# ----------------------------------------------------------------------
def __init__(self):
"""Constructor"""
wx.Frame.__init__(self, None, wx.ID_ANY,
u" 生物信息学I 实验",
size=(650, 640))
panel = wx.Panel(self)
notebook = TestCB(panel)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(notebook, 1, wx.ALL | wx.EXPAND, 5)
panel.SetSizer(sizer)
self.Layout()
self.Show()
# ----------------------------------------------------------------------
if __name__ == "__main__":
app = wx.PySimpleApp()
frame = DemoFrame()
app.MainLoop()
| [
"519043202@qq.com"
] | 519043202@qq.com |
96b6fa8e4536f81f43eca8c0550e402ee9f52784 | 6cbb69762b952bf3708de03b977bb215ebca9653 | /lib/dynamo_sessions.py | 007ef5de62ace494da60ecf989e4af11c5d5bc08 | [
"MIT"
] | permissive | kaellis/sqs-browser-events | 98e913ecc02c3e200285b00ffc39b847d0f9fa1a | 47a74ff3c756dc70f84307453385d0bd399cc659 | refs/heads/master | 2021-01-19T16:42:19.634499 | 2017-04-13T18:11:06 | 2017-04-13T18:11:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 7,604 | py | import os
import time
import decimal
import concurrent.futures
import boto3
from boto3.dynamodb.conditions import Key, Attr
from boto3.dynamodb.types import TypeSerializer
import botocore.exceptions
import logging
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.INFO)
import common
def get_session_table():
dynamodb = boto3.resource('dynamodb')
return dynamodb.Table(os.getenv('SESSION_TABLE'))
def get_history_table():
dynamodb = boto3.resource('dynamodb')
return dynamodb.Table(os.getenv('HISTORY_TABLE'))
def quantize_tstamp(ts):
return ts.quantize(decimal.Decimal('0.000001'),rounding=decimal.ROUND_HALF_UP)
def set_message_read(user_id, msg_id):
try:
r=get_history_table().update_item(
Key={'userId':user_id,
'messageId':msg_id},
UpdateExpression="set is_read = :a",
ExpressionAttributeValues={':a': 1},
ConditionExpression="is_read <> :a")
return True
except botocore.exceptions.ClientError as e:
if e.response['Error']['Code'] == 'ConditionalCheckFailedException':
LOGGER.info("Duplicate is_read setting for user_id={0}, msg_id={1}".format(user_id,msg_id))
return True
else:
LOGGER.exception("Eror updating read setting for user_id={0}, msg_id={1}".format(user_id,msg_id))
return False
def write_user_history(item_batch):
# use a consistent timestamp (tnow) so that any reprocessing results in overwriting if
# items are inserted multiple times
try:
hist_table = os.getenv('HISTORY_TABLE')
session = boto3.session.Session()
c = session.client('dynamodb')
r = c.batch_write_item(RequestItems={ hist_table: item_batch })
unproc = r.get('UnprocessedItems')
if unproc is not None and hist_table in unproc and len(unproc[hist_table])>0:
return unproc[hist_table]
return []
except:
LOGGER.exception("Error inserting user batch")
# assume all failed
return item_batch
def convert_to_dyn_objects(user_msg_list,tnow):
tnow_dec = quantize_tstamp(decimal.Decimal(tnow))
ts = TypeSerializer()
def build_item(user_id,msg):
# hash of message and timestamp
item = msg.copy()
item['userId'] = user_id
item['created'] = tnow_dec
item = common.floats_to_decimals(item)
item_dyn = dict([(k,ts.serialize(v)) for k,v in item.iteritems()])
return {'PutRequest':{'Item':item_dyn}}
return [build_item(user_id,msg) for user_id,msg in user_msg_list]
def batch_add_user_history(user_msg_list,n_workers=25):
try_cnt = 0
tnow = time.time()
user_msg_list = convert_to_dyn_objects(user_msg_list,tnow)
failures = []
while len(user_msg_list)>0 and try_cnt <= 5:
try_cnt += 1
# split into batches of 25
failures = []
batches = [user_msg_list[i:i+25] for i in xrange(0,len(user_msg_list),25)]
with concurrent.futures.ThreadPoolExecutor(max_workers=n_workers) as executor:
future_to_userbatch = {executor.submit(write_user_history, b): b for b in batches}
for future in concurrent.futures.as_completed(future_to_userbatch):
user_batch = future_to_userbatch[future]
failed_items = future.result()
failures.extend(failed_items)
LOGGER.debug("User batch write: {0} failures".format(len(failed_items)))
if len(failures)>0:
time.sleep(try_cnt*5)
user_msg_list = failures
if len(failures)>0:
LOGGER.error("Failure sending user batch writes, dropped {0}".format(len(failures)))
LOGGER.info("Done adding to user history")
def get_user_messages(user_id,start_t=None,end_t=None):
q = {'KeyConditionExpression': Key('userId').eq(user_id)}
if start_t is not None and end_t is not None:
q['FilterExpression'] = Attr('created').gte(start_t) & Attr('created').lte(end_t)
elif start_t is not None:
q['FilterExpression'] = Attr('created').gte(start_t)
elif end_t is not None:
q['FilterExpression'] = Attr('created').lte(end_t)
return collect_results(get_history_table().query,q)
def create(d):
get_session_table().put_item(Item=d)
LOGGER.debug("Created session {0} for account {1}, user {3}, queue={2}".format(d['sessionId'],d['accountId'],d['userId'],d['sqsUrl']))
return
def delete_expired():
# delete ones that expired more than 2 days ago
# put in limit to ensure progress before potential timeout
t = get_session_table()
del_cnt = 0
max_age = int(os.getenv('SESSION_INACTIVE_PURGE_SEC',86400))
while True:
q = {'ProjectionExpression': "userId, sessionId",
'Limit':1000,
'FilterExpression': Attr('expires').lt(int(time.time()-max_age))}
sessions = collect_results(t.scan,q)
for s in sessions:
LOGGER.info("Deleting expired session, userId={0}, sessionId={1}".format(
s['userId'],s['sessionId']))
t.delete_item(Key={'userId':s['userId'],
'sessionId':s['sessionId']})
del_cnt += 1
if len(sessions)<1000:
break
return del_cnt
def destroy(account_id, user_id, session_id):
get_session_table().delete_item(Key={'userId':user_id,
'sessionId':session_id})
def lookup(account_id=None, user_id=None, session_id=None, max_expired_age=None):
q = {'Select': 'ALL_ATTRIBUTES'}
if user_id is not None:
q['KeyConditionExpression'] = Key('userId').eq(user_id)
if session_id is not None:
q['KeyConditionExpression'] = q['KeyConditionExpression'] & Key('sessionId').eq(session_id)
if account_id is not None:
q['FilterExpression'] = Attr('accountId').eq(account_id)
elif account_id is not None:
# use the account GSI
q['KeyConditionExpression'] = Key('accountId').eq(account_id)
q['IndexName'] = os.getenv('SESSION_TABLE_ACCOUNT_GSI')
if session_id is not None:
q['FilterExpression'] = Attr('sessionId').eq(session_id)
elif session_id is not None:
q['FilterExpression'] = Attr('sessionId').eq(session_id)
else:
return get_all_sessions(max_expired_age=max_expired_age)
if max_expired_age is not None:
exp_filter = Attr('expires').gte(int(time.time()-max_expired_age))
if 'FilterExpression' in q:
q['FilterExpression'] = q['FilterExpression'] & exp_filter
else:
q['FilterExpression'] = exp_filter
if 'KeyConditionExpression' in q:
return collect_results(get_session_table().query,q)
else:
return collect_results(get_session_table().scan,q)
def get_all_sessions(max_expired_age=None):
q = {'Select': 'ALL_ATTRIBUTES'}
if max_expired_age is not None:
q['FilterExpression'] = Attr('expires').gte(int(time.time()-max_expired_age))
return collect_results(get_session_table().scan,q)
def get_all_sqs_urls():
q = {'Select': 'SPECIFIC_ATTRIBUTES',
'AttributesToGet': ['sqsUrl']}
items = collect_results(get_session_table().scan,q)
return [x['sqsUrl'] for x in items]
def collect_results(table_f,qp):
items = []
while True:
r = table_f(**qp)
items.extend(r['Items'])
lek = r.get('LastEvaluatedKey')
if lek is None or lek=='':
break
qp['ExclusiveStartKey'] = lek
return items
| [
"kenneth.ellis@thomsonreuters.com"
] | kenneth.ellis@thomsonreuters.com |
254d2a1a7db7f1c6d9ae9a7970f8bfa3bf0f2cb4 | 063d0ab929ff02c3504603399d148f1afae8fa5a | /rainfall.py | 46673d3f2ee3ddac13ff0acebc5a03d538c64891 | [] | no_license | cthurmond/Python-Practice | 2f126ef435df2e979d868897810e5f6b9e7d621f | 8f240e415c2e90487de855bbfa151e3772d4e086 | refs/heads/master | 2021-01-17T17:49:07.399938 | 2016-10-11T23:52:56 | 2016-10-11T23:52:56 | 70,644,816 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 426 | py | rainfall_dict = {}
while True:
city_name = raw_input("Enter the name of a city: ")
if not city_name:
for city in rainfall_dict:
print city + ": " + str(rainfall_dict[city])
break
rainfall = raw_input("Enter the rainfall in mm: ")
if city_name in rainfall_dict:
rainfall_dict[city_name] += int(rainfall)
else:
rainfall_dict[city_name] = int(rainfall)
| [
"noreply@github.com"
] | cthurmond.noreply@github.com |
cab5aafff8e84c21491d9e3b216a7c83dd701455 | 8ec922f6acecd314b7be5397d2bc2f91533bbf1e | /Study/Functions.py | 037fd9e0af0d26c38e04cc45b5e0310d03b71150 | [] | no_license | andrecavalcanti18111983/Python | 18c7f46826b2a299fb6c19553ae1fe864adc31c3 | b00c4c5d24dc7926ebb013f748fde42f54b69b35 | refs/heads/main | 2023-06-26T05:01:22.709861 | 2021-07-28T12:34:59 | 2021-07-28T12:34:59 | 390,345,622 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 772 | py | calculation_to_units = 24
name_of_unit = "hours"
def days_to_unit(num_of_days):
return f"{num_of_days} days are {num_of_days * calculation_to_units} {name_of_unit}"
def validade_and_execute():
try:
user_input_number = int(user_input)
if user_input_number > 0:
calculate_value = days_to_unit(user_input_number)
print(calculate_value)
elif user_input_number == 0:
print ("You entered 0, please enter a valid positive number")
except ValueError:
print("Your input is not a number, don't ruin my program")
user_input = ""
while user_input != "exit":
user_input = input("Hey user, enter the number of days and I will convert days in hours!\n")
validade_and_execute() | [
"68634379+andrelscavalcanti@users.noreply.github.com"
] | 68634379+andrelscavalcanti@users.noreply.github.com |
108110a304955c3ae58137945c8d77744beb6505 | d10ea337036d407411d63aa4d19ec1c6b6210623 | /django_project/genres/migrations/0002_alter_genre_options.py | ff7f2a43b9633f9e5d2eb8a277c29ca69d92ca1f | [] | no_license | Kyrylo-Kotelevets/Django_Book_Reviews | f8f75f5324da1c5d35c8656e9c989b3aae01b30c | 72470f926db9d8f996cf12be0b2910090ba0087e | refs/heads/master | 2023-08-10T22:21:26.507992 | 2021-09-21T12:11:43 | 2021-09-21T12:11:43 | 400,107,393 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 358 | py | # Generated by Django 3.2.6 on 2021-08-31 20:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('genres', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='genre',
options={'ordering': ('name',), 'verbose_name': 'Genre'},
),
]
| [
"kyrylo.kotelevets@nure.ua"
] | kyrylo.kotelevets@nure.ua |
f98a1584a105d194c9e6e6a5e93adcc623f4cfab | cb61ba31b27b232ebc8c802d7ca40c72bcdfe152 | /leetcode/931. Minimum Falling Path Sum/soln.py | 1e4b6c29b5e019be51d4b3abc9a345a86c121f90 | [
"Apache-2.0"
] | permissive | saisankargochhayat/algo_quest | c7c48187c76b5cd7c2ec3f0557432606e9096241 | a24f9a22c019ab31d56bd5a7ca5ba790d54ce5dc | refs/heads/master | 2021-07-04T15:21:33.606174 | 2021-02-07T23:42:43 | 2021-02-07T23:42:43 | 67,831,927 | 5 | 1 | Apache-2.0 | 2019-10-28T03:51:03 | 2016-09-09T20:51:29 | Python | UTF-8 | Python | false | false | 1,022 | py | # So we create a DP and start from the last low and start building up the the upper rows in the dp 2d array
# dp[i][j] represents the minimum path to reach that element with the given constraints.
class Solution:
def minFallingPathSum(self, A: List[List[int]]) -> int:
dp = [[0 for j in range(len(A[0]))] for i in range(len(A))]
# we fill the last row with original values as the min path from last row to last row is its own value
for i in range(len(A)-1, -1, -1):
for j in range(len(A[0])-1, -1, -1):
# Fill last row
if i == len(A)-1:
dp[i][j] = A[i][j]
# left corner
elif j == 0:
dp[i][j] = A[i][j] + min(dp[i+1][j], dp[i+1][j+1])
elif j == len(A[0])-1:
dp[i][j] = A[i][j] + min(dp[i+1][j-1], dp[i+1][j])
else:
dp[i][j] = A[i][j] + min(dp[i+1][j-1], dp[i+1][j], dp[i+1][j+1])
return min(dp[0])
| [
"saisankargochhayat@gmail.com"
] | saisankargochhayat@gmail.com |
15ccd5f52842ed3e6115a9f7d0a4fde211cdd0e8 | 2f4390a25e1bba856c993e1412e935ec6bd57317 | /vanguard/urls.py | 6a3b7e8464774460103381a583ea4b6c27e11844 | [
"MIT"
] | permissive | svalleru/vanguard | af4ab5b0b8404bc28d508bd02be6e926397a6a73 | 5e76eac4bc0d5df329f33a16dd574b0ef763ae4e | refs/heads/master | 2023-08-26T17:50:38.145325 | 2023-08-02T23:02:46 | 2023-08-02T23:02:46 | 61,655,053 | 2 | 0 | MIT | 2023-08-02T23:02:47 | 2016-06-21T17:54:53 | Python | UTF-8 | Python | false | false | 939 | py | """vanguard URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from vanguard import users
urlpatterns = [
url(r'^/?$', users.user_signup),
url(r'^signup/?$', users.user_signup),
url(r'^login/?$', users.user_login),
url(r'^forgotpassword/?$', users.forgot_password),
url(r'^logout/?$', users.user_logout),
]
| [
"shanvalleru@gmail.com"
] | shanvalleru@gmail.com |
b96f2c76b38323327b3fd2cd6fe341d4e3148b74 | ec4ce2cc5e08e032f2bdb7d8e6ba616e80e6f5f7 | /chapter11_test_code/test_cities.py | f669296324136f72db551ae3d88cecb53a02dda6 | [] | no_license | AiZhanghan/python-crash-course-a-hands-on-project-based-introduction-to-programming | 8fc54ef69636c88985df00b546bc49c4a2378e79 | 9d8c9fde7d6ab9fe664fa718e1516d7442eafd00 | refs/heads/master | 2020-09-28T18:28:56.558413 | 2019-12-12T11:05:43 | 2019-12-12T11:05:43 | 226,835,456 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 772 | py | import unittest
from city_functions import get_formated_city_name
class CityTestCase(unittest.TestCase):
'''测试city_functions.py'''
def test_city_country(self):
'''能够正确地处理像Santiago, Chile这样的城市吗?'''
formetted_city_name = get_formated_city_name('santiago', 'chile')
self.assertEqual(formetted_city_name, 'Santiago, Chile')
def test_city_country_population(self):
'''
能够正确地处理像Santiago, Chile - population 5000000这样的城市吗?
'''
formatted_city_name = get_formated_city_name('santiago',
'chile', 5000000)
self.assertEqual(formatted_city_name,
'Santiago, Chile - population 5000000')
unittest.main()
| [
"35103759+AiZhanghan@users.noreply.github.com"
] | 35103759+AiZhanghan@users.noreply.github.com |
86a3bc23436ff8c4eff096a5796e7cd006409c98 | 2caa95bf6977f06b367bdacfe8cddb9898aad5f0 | /intro/avoidObstacles.py | 7a3aeef0462802b921f1632fb9345a7f859e5005 | [] | no_license | michelsmartinez/codefights_exercises | a92ee2ac529cf719eb08104787b7d63beb18d207 | bcdd444f1c059d37570cbe1a08f047c7c457720e | refs/heads/master | 2021-08-31T19:00:56.601653 | 2017-12-22T13:20:17 | 2017-12-22T13:20:17 | 114,759,872 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 953 | py | # You are given an array of integers representing coordinates of obstacles
# situated on a straight line.
#
# Assume that you are jumping from the point with coordinate 0 to the right.
# You are allowed only to make jumps of the same
# length represented by some integer.
#
# Find the minimal length of the jump enough to avoid all the obstacles.
#
# Example
#
# For inputArray = [5, 3, 6, 7, 9], the output should be
# avoidObstacles(inputArray) = 4.
def passatudo(pode, quantos):
aux = 0
while pode[aux] != True:
aux += 1
while aux < len(pode):
if pode[aux] == False:
return False
aux += quantos
return True
def avoidObstacles(inputArray):
tamanho = sorted(inputArray)[-1] + 2
pode = {}
for i in range(0, tamanho):
pode[i] = False if i in inputArray else True
print (pode)
for i in range(1, tamanho):
if passatudo(pode, i):
return i
return 0
| [
"michel.martinez@cwi.com.br"
] | michel.martinez@cwi.com.br |
dcc2d399258f579438cf9daa73f67a2279579a6f | 731a33f8bb92bad31ab233416d8ef6eb3a9f3fe0 | /minlplib_instances/smallinvSNPr1b050-055.py | b776f5ed09f35dcb7ccc13d0d18939f16d47a7d3 | [] | no_license | ChristophNeumann/IPCP | d34c7ec3730a5d0dcf3ec14f023d4b90536c1e31 | 6e3d14cc9ed43f3c4f6c070ebbce21da5a059cb7 | refs/heads/main | 2023-02-22T09:54:39.412086 | 2021-01-27T17:30:50 | 2021-01-27T17:30:50 | 319,694,028 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 167,364 | py | # MINLP written by GAMS Convert at 02/15/18 11:44:28
#
# Equation counts
# Total E G L N X C B
# 4 0 2 2 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc si
# Total cont binary integer sos1 sos2 scont sint
# 101 1 0 100 0 0 0 0
# FX 0 0 0 0 0 0 0 0
#
# Nonzero counts
# Total const NL DLL
# 401 301 100 0
from pyomo.environ import *
model = m = ConcreteModel()
m.i1 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i2 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i3 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i4 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i5 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i6 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i7 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i8 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i9 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i10 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i11 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i12 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i13 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i14 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i15 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i16 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i17 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i18 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i19 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i20 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i21 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i22 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i23 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i24 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i25 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i26 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i27 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i28 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i29 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i30 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i31 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i32 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i33 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i34 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i35 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i36 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i37 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i38 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i39 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i40 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i41 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i42 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i43 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i44 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i45 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i46 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i47 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i48 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i49 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i50 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i51 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i52 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i53 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i54 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i55 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i56 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i57 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i58 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i59 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i60 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i61 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i62 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i63 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i64 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i65 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i66 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i67 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i68 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i69 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i70 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i71 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i72 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i73 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i74 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i75 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i76 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i77 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i78 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i79 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i80 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i81 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i82 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i83 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i84 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i85 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i86 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i87 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i88 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i89 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i90 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i91 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i92 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i93 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i94 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i95 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i96 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i97 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i98 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i99 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.i100 = Var(within=Integers,bounds=(0,1E20),initialize=0)
m.x101 = Var(within=Reals,bounds=(None,None),initialize=0)
m.obj = Objective(expr=m.x101, sense=minimize)
m.c1 = Constraint(expr=0.00841507*m.i1**2 + 0.0222536*m.i2**2 + 0.0056479*m.i3**2 + 0.00333322*m.i4**2 + 0.00490963*m.i5
**2 + 0.0221034*m.i6**2 + 0.00509899*m.i7**2 + 0.049464*m.i8**2 + 0.0171508*m.i9**2 + 0.0064643*
m.i10**2 + 0.0218437*m.i11**2 + 0.00346366*m.i12**2 + 0.0458502*m.i13**2 + 0.0747061*m.i14**2 +
0.0196511*m.i15**2 + 0.014222*m.i16**2 + 0.0147535*m.i17**2 + 0.00398615*m.i18**2 + 0.00644484*
m.i19**2 + 0.0322232*m.i20**2 + 0.00887889*m.i21**2 + 0.0434025*m.i22**2 + 0.00981376*m.i23**2 +
0.0133193*m.i24**2 + 0.00471036*m.i25**2 + 0.00359843*m.i26**2 + 0.0112312*m.i27**2 + 0.00476479*
m.i28**2 + 0.00356255*m.i29**2 + 0.0730121*m.i30**2 + 0.00785721*m.i31**2 + 0.0243787*m.i32**2 +
0.0171188*m.i33**2 + 0.00439547*m.i34**2 + 0.00502594*m.i35**2 + 0.0580619*m.i36**2 + 0.0135984*
m.i37**2 + 0.00254137*m.i38**2 + 0.0153341*m.i39**2 + 0.109758*m.i40**2 + 0.0346065*m.i41**2 +
0.0127589*m.i42**2 + 0.011147*m.i43**2 + 0.0156318*m.i44**2 + 0.00556588*m.i45**2 + 0.00302864*
m.i46**2 + 0.0214898*m.i47**2 + 0.00499587*m.i48**2 + 0.00864393*m.i49**2 + 0.0228248*m.i50**2 +
0.0077726*m.i51**2 + 0.00992767*m.i52**2 + 0.0184506*m.i53**2 + 0.0113481*m.i54**2 + 0.0067583*
m.i55**2 + 0.0150416*m.i56**2 + 0.00324193*m.i57**2 + 0.00478196*m.i58**2 + 0.0132471*m.i59**2 +
0.00273446*m.i60**2 + 0.0282459*m.i61**2 + 0.0230221*m.i62**2 + 0.0240972*m.i63**2 + 0.00829946*
m.i64**2 + 0.00688665*m.i65**2 + 0.00858803*m.i66**2 + 0.00778038*m.i67**2 + 0.0082583*m.i68**2
+ 0.022885*m.i69**2 + 0.00568332*m.i70**2 + 0.0234021*m.i71**2 + 0.00924249*m.i72**2 +
0.00669675*m.i73**2 + 0.0109501*m.i74**2 + 0.00663385*m.i75**2 + 0.00328058*m.i76**2 + 0.0112814*
m.i77**2 + 0.00341076*m.i78**2 + 0.0400653*m.i79**2 + 0.00876827*m.i80**2 + 0.0138276*m.i81**2 +
0.00246987*m.i82**2 + 0.0406516*m.i83**2 + 0.00947194*m.i84**2 + 0.00647449*m.i85**2 + 0.0107715*
m.i86**2 + 0.00803069*m.i87**2 + 0.106502*m.i88**2 + 0.00815263*m.i89**2 + 0.0171707*m.i90**2 +
0.0163522*m.i91**2 + 0.00911726*m.i92**2 + 0.00287317*m.i93**2 + 0.00360309*m.i94**2 + 0.00699161
*m.i95**2 + 0.0340959*m.i96**2 + 0.00958446*m.i97**2 + 0.0147951*m.i98**2 + 0.0177595*m.i99**2 +
0.0208523*m.i100**2 + 0.00692522*m.i1*m.i2 + 0.00066464*m.i1*m.i3 + 0.00388744*m.i1*m.i4 +
0.001108218*m.i1*m.i5 + 0.0046712*m.i1*m.i6 + 0.00771824*m.i1*m.i7 + 0.0020653*m.i1*m.i8 +
0.001524626*m.i1*m.i9 + 0.00484724*m.i1*m.i10 + 0.00733242*m.i1*m.i11 + 0.00556218*m.i1*m.i12 +
0.0052571*m.i1*m.i13 + 0.0218926*m.i1*m.i14 + 0.01352862*m.i1*m.i15 + 0.00549784*m.i1*m.i16 +
0.00235342*m.i1*m.i17 + 0.00448206*m.i1*m.i18 + 0.0072148*m.i1*m.i19 + 0.00958894*m.i1*m.i20 +
0.00376328*m.i1*m.i21 + 0.0117501*m.i1*m.i22 + 0.00575998*m.i1*m.i23 - 0.000109147*m.i1*m.i24 +
0.000604944*m.i1*m.i25 + 0.00473296*m.i1*m.i26 + 0.000356572*m.i1*m.i27 - 0.001552262*m.i1*m.i28
+ 0.00119092*m.i1*m.i29 + 0.01373684*m.i1*m.i30 + 0.0059113*m.i1*m.i31 + 0.00623524*m.i1*m.i32
+ 0.00801204*m.i1*m.i33 + 0.00108736*m.i1*m.i34 + 0.001491474*m.i1*m.i35 + 0.01080356*m.i1*m.i36
+ 0.00559202*m.i1*m.i37 + 7.8057e-6*m.i1*m.i38 + 0.00831004*m.i1*m.i39 + 0.001096208*m.i1*m.i40
+ 0.001136658*m.i1*m.i41 + 0.0073715*m.i1*m.i42 + 0.000726938*m.i1*m.i43 + 0.00621872*m.i1*m.i44
+ 0.00646596*m.i1*m.i45 + 0.00441466*m.i1*m.i46 + 0.001262528*m.i1*m.i47 + 0.00567366*m.i1*m.i48
+ 0.00690472*m.i1*m.i49 + 0.01140754*m.i1*m.i50 + 0.00275514*m.i1*m.i51 + 0.00633434*m.i1*m.i52
+ 0.00842252*m.i1*m.i53 + 0.00674544*m.i1*m.i54 + 0.00577156*m.i1*m.i55 + 0.000723972*m.i1*m.i56
+ 0.00617654*m.i1*m.i57 + 0.00426758*m.i1*m.i58 + 0.00581362*m.i1*m.i59 + 0.00305964*m.i1*m.i60
+ 0.00915838*m.i1*m.i61 + 0.00408204*m.i1*m.i62 + 0.00526036*m.i1*m.i63 + 0.00641708*m.i1*m.i64
+ 0.001311362*m.i1*m.i65 + 0.00589896*m.i1*m.i66 + 0.001450664*m.i1*m.i67 + 0.0054669*m.i1*m.i68
+ 0.00759698*m.i1*m.i69 + 0.0069591*m.i1*m.i70 + 0.0023689*m.i1*m.i71 + 0.0026146*m.i1*m.i72 +
0.00520422*m.i1*m.i73 + 0.00959956*m.i1*m.i74 + 0.00799166*m.i1*m.i75 + 0.00256248*m.i1*m.i76 +
0.01210352*m.i1*m.i77 + 0.00469514*m.i1*m.i78 + 0.00329676*m.i1*m.i79 + 0.0068214*m.i1*m.i80 +
0.00190637*m.i1*m.i81 + 0.00256972*m.i1*m.i82 - 0.00577696*m.i1*m.i83 + 0.00245394*m.i1*m.i84 +
0.00585966*m.i1*m.i85 + 0.00330078*m.i1*m.i86 + 0.00362852*m.i1*m.i87 + 0.0064137*m.i1*m.i88 +
0.00375038*m.i1*m.i89 + 0.00666048*m.i1*m.i90 + 0.00942176*m.i1*m.i91 + 0.00379828*m.i1*m.i92 +
0.00246526*m.i1*m.i93 + 0.0029997*m.i1*m.i94 + 0.00592606*m.i1*m.i95 + 0.0136565*m.i1*m.i96 +
0.00562112*m.i1*m.i97 + 0.0031101*m.i1*m.i98 + 0.00328418*m.i1*m.i99 + 0.00992138*m.i1*m.i100 +
0.01159836*m.i2*m.i3 + 0.00432612*m.i2*m.i4 + 0.01055774*m.i2*m.i5 + 0.0235592*m.i2*m.i6 +
0.0053913*m.i2*m.i7 + 0.01748966*m.i2*m.i8 + 0.01322526*m.i2*m.i9 + 0.01103896*m.i2*m.i10 +
0.001420928*m.i2*m.i11 + 0.00303766*m.i2*m.i12 + 0.0325414*m.i2*m.i13 + 0.0528886*m.i2*m.i14 +
0.0344486*m.i2*m.i15 + 0.01889664*m.i2*m.i16 + 0.01085498*m.i2*m.i17 + 0.01133696*m.i2*m.i18 +
0.0105108*m.i2*m.i19 + 0.041965*m.i2*m.i20 + 0.01908526*m.i2*m.i21 + 0.0438608*m.i2*m.i22 +
0.01760436*m.i2*m.i23 + 0.0177692*m.i2*m.i24 + 0.01401386*m.i2*m.i25 + 0.01130076*m.i2*m.i26 +
0.0201926*m.i2*m.i27 + 0.00893526*m.i2*m.i28 + 0.01013464*m.i2*m.i29 + 0.0522552*m.i2*m.i30 +
0.00674062*m.i2*m.i31 + 0.0386894*m.i2*m.i32 + 0.01840562*m.i2*m.i33 + 0.0079061*m.i2*m.i34 +
0.01050574*m.i2*m.i35 + 0.038882*m.i2*m.i36 + 0.0209782*m.i2*m.i37 + 0.00569346*m.i2*m.i38 +
0.0259324*m.i2*m.i39 + 0.0472088*m.i2*m.i40 + 0.0282636*m.i2*m.i41 + 0.0225892*m.i2*m.i42 +
0.01104052*m.i2*m.i43 + 0.0218496*m.i2*m.i44 + 0.00682534*m.i2*m.i45 + 0.01022898*m.i2*m.i46 +
0.0273094*m.i2*m.i47 + 0.01045064*m.i2*m.i48 + 0.01767338*m.i2*m.i49 + 0.0311902*m.i2*m.i50 +
0.0126455*m.i2*m.i51 + 0.0206168*m.i2*m.i52 + 0.0261894*m.i2*m.i53 + 0.024527*m.i2*m.i54 +
0.01734138*m.i2*m.i55 + 0.01224052*m.i2*m.i56 + 0.01152072*m.i2*m.i57 + 0.01028864*m.i2*m.i58 +
0.01883544*m.i2*m.i59 + 0.00908648*m.i2*m.i60 + 0.0449708*m.i2*m.i61 + 0.0363664*m.i2*m.i62 +
0.01577062*m.i2*m.i63 + 0.01266282*m.i2*m.i64 + 0.01385216*m.i2*m.i65 + 0.00440902*m.i2*m.i66 +
0.01711764*m.i2*m.i67 + 0.0110787*m.i2*m.i68 + 0.0341778*m.i2*m.i69 + 0.0156542*m.i2*m.i70 +
0.01891112*m.i2*m.i71 + 0.0216326*m.i2*m.i72 + 0.01534328*m.i2*m.i73 + 0.01661334*m.i2*m.i74 +
0.01534594*m.i2*m.i75 + 0.01116732*m.i2*m.i76 + 0.01402982*m.i2*m.i77 + 0.00963242*m.i2*m.i78 +
0.0200668*m.i2*m.i79 + 0.01379116*m.i2*m.i80 + 0.01910046*m.i2*m.i81 + 0.0077605*m.i2*m.i82 -
0.000954558*m.i2*m.i83 + 0.01255918*m.i2*m.i84 + 0.0126639*m.i2*m.i85 + 0.0201936*m.i2*m.i86 +
0.017931*m.i2*m.i87 + 0.0389418*m.i2*m.i88 + 0.00845916*m.i2*m.i89 + 0.0267914*m.i2*m.i90 +
0.0193905*m.i2*m.i91 + 0.01261014*m.i2*m.i92 + 0.0069012*m.i2*m.i93 + 0.00876014*m.i2*m.i94 +
0.01829908*m.i2*m.i95 + 0.0373396*m.i2*m.i96 + 0.0211262*m.i2*m.i97 + 0.01549032*m.i2*m.i98 +
0.0247114*m.i2*m.i99 + 0.0324248*m.i2*m.i100 - 0.000720538*m.i3*m.i4 + 0.00453322*m.i3*m.i5 +
0.00638226*m.i3*m.i6 + 0.000938158*m.i3*m.i7 + 0.0035154*m.i3*m.i8 + 0.00681962*m.i3*m.i9 +
0.006345*m.i3*m.i10 + 0.00232904*m.i3*m.i11 - 0.00054599*m.i3*m.i12 + 0.01850556*m.i3*m.i13 +
0.01892336*m.i3*m.i14 + 0.00820906*m.i3*m.i15 + 0.00848796*m.i3*m.i16 + 0.0100743*m.i3*m.i17 +
0.00327798*m.i3*m.i18 + 0.000498452*m.i3*m.i19 + 0.01775572*m.i3*m.i20 + 0.00919688*m.i3*m.i21 +
0.01282772*m.i3*m.i22 + 0.00853066*m.i3*m.i23 + 0.00506148*m.i3*m.i24 + 0.004557*m.i3*m.i25 +
0.001737768*m.i3*m.i26 + 0.00560326*m.i3*m.i27 + 0.00374962*m.i3*m.i28 + 0.000427408*m.i3*m.i29
+ 0.01831098*m.i3*m.i30 + 0.00791496*m.i3*m.i31 + 0.01306*m.i3*m.i32 + 0.0143109*m.i3*m.i33 +
0.00324578*m.i3*m.i34 + 0.00289704*m.i3*m.i35 + 0.01899172*m.i3*m.i36 + 0.00855898*m.i3*m.i37 +
0.000764782*m.i3*m.i38 + 0.01045622*m.i3*m.i39 + 0.0241684*m.i3*m.i40 + 0.01022702*m.i3*m.i41 +
0.0096569*m.i3*m.i42 + 0.00605256*m.i3*m.i43 + 0.0087656*m.i3*m.i44 + 0.00231868*m.i3*m.i45 +
0.003075*m.i3*m.i46 + 0.00904418*m.i3*m.i47 + 0.00346386*m.i3*m.i48 + 0.00970054*m.i3*m.i49 +
0.0107517*m.i3*m.i50 + 0.00833706*m.i3*m.i51 + 0.00601022*m.i3*m.i52 + 0.00885472*m.i3*m.i53 +
0.0087269*m.i3*m.i54 + 0.00799796*m.i3*m.i55 + 0.0077742*m.i3*m.i56 + 0.00233028*m.i3*m.i57 +
0.00392772*m.i3*m.i58 + 0.00960436*m.i3*m.i59 + 0.000506858*m.i3*m.i60 + 0.01485036*m.i3*m.i61 +
0.01172454*m.i3*m.i62 + 0.00763564*m.i3*m.i63 + 0.00510368*m.i3*m.i64 + 0.00739458*m.i3*m.i65 +
0.00321864*m.i3*m.i66 + 0.00506992*m.i3*m.i67 + 0.001582392*m.i3*m.i68 + 0.0133327*m.i3*m.i69 +
0.00346984*m.i3*m.i70 + 0.00591914*m.i3*m.i71 + 0.0050918*m.i3*m.i72 + 0.00762942*m.i3*m.i73 +
0.0072567*m.i3*m.i74 + 0.0028432*m.i3*m.i75 + 0.00258746*m.i3*m.i76 + 0.00665946*m.i3*m.i77 +
0.001559716*m.i3*m.i78 + 0.0114221*m.i3*m.i79 + 0.00359546*m.i3*m.i80 + 0.00675946*m.i3*m.i81 +
0.001328782*m.i3*m.i82 + 0.00450512*m.i3*m.i83 + 0.00859628*m.i3*m.i84 + 0.00541618*m.i3*m.i85 +
0.01126372*m.i3*m.i86 + 0.00604642*m.i3*m.i87 + 0.01802074*m.i3*m.i88 + 0.0056414*m.i3*m.i89 +
0.00952436*m.i3*m.i90 + 0.00568388*m.i3*m.i91 + 0.0086732*m.i3*m.i92 + 0.001482822*m.i3*m.i93 +
0.0026677*m.i3*m.i94 + 0.00675394*m.i3*m.i95 + 0.01169216*m.i3*m.i96 + 0.0076724*m.i3*m.i97 +
0.00761804*m.i3*m.i98 + 0.01192344*m.i3*m.i99 + 0.01326866*m.i3*m.i100 + 0.00169903*m.i4*m.i5 +
0.00300136*m.i4*m.i6 + 0.00385392*m.i4*m.i7 + 0.00382362*m.i4*m.i8 + 0.00575034*m.i4*m.i9 +
0.00125203*m.i4*m.i10 + 0.000828078*m.i4*m.i11 + 0.00404896*m.i4*m.i12 - 0.001180878*m.i4*m.i13
+ 0.00956206*m.i4*m.i14 + 0.00571904*m.i4*m.i15 + 0.0047927*m.i4*m.i16 + 0.001736122*m.i4*m.i17
+ 0.001900434*m.i4*m.i18 + 0.00498296*m.i4*m.i19 + 0.0055112*m.i4*m.i20 + 0.00199047*m.i4*m.i21
+ 0.00302926*m.i4*m.i22 + 0.001107052*m.i4*m.i23 + 0.0032099*m.i4*m.i24 + 0.00202704*m.i4*m.i25
+ 0.0049441*m.i4*m.i26 + 0.00296714*m.i4*m.i27 + 0.001430786*m.i4*m.i28 + 0.00335542*m.i4*m.i29
+ 0.0072271*m.i4*m.i30 + 0.001983328*m.i4*m.i31 + 0.00263338*m.i4*m.i32 + 0.0034098*m.i4*m.i33
+ 0.001978102*m.i4*m.i34 + 0.00248436*m.i4*m.i35 + 0.001037234*m.i4*m.i36 + 0.001931824*m.i4*
m.i37 + 0.00154955*m.i4*m.i38 + 0.00293776*m.i4*m.i39 - 0.01282698*m.i4*m.i40 + 0.001937926*m.i4*
m.i41 + 0.0052959*m.i4*m.i42 + 0.001856036*m.i4*m.i43 + 0.000740384*m.i4*m.i44 + 0.00372246*m.i4*
m.i45 + 0.00362974*m.i4*m.i46 + 0.001687258*m.i4*m.i47 + 0.00297792*m.i4*m.i48 + 0.0024381*m.i4*
m.i49 + 0.00581304*m.i4*m.i50 + 0.000775592*m.i4*m.i51 + 0.00512872*m.i4*m.i52 + 0.00302932*m.i4*
m.i53 + 0.00451004*m.i4*m.i54 + 0.00355054*m.i4*m.i55 + 0.000365898*m.i4*m.i56 + 0.00396452*m.i4*
m.i57 + 0.00218522*m.i4*m.i58 + 0.001602712*m.i4*m.i59 + 0.00378946*m.i4*m.i60 + 0.00528342*m.i4*
m.i61 + 0.00345546*m.i4*m.i62 + 0.0072364*m.i4*m.i63 + 0.00460504*m.i4*m.i64 + 0.00362066*m.i4*
m.i65 + 0.00176825*m.i4*m.i66 + 0.00326082*m.i4*m.i67 + 0.00494324*m.i4*m.i68 + 0.00478058*m.i4*
m.i69 + 0.0047424*m.i4*m.i70 + 0.00406804*m.i4*m.i71 + 0.00356438*m.i4*m.i72 + 0.0039191*m.i4*
m.i73 + 0.00506266*m.i4*m.i74 + 0.005213*m.i4*m.i75 + 0.00334114*m.i4*m.i76 + 0.00410168*m.i4*
m.i77 + 0.00325268*m.i4*m.i78 + 0.000621396*m.i4*m.i79 + 0.00679868*m.i4*m.i80 + 0.001665408*m.i4
*m.i81 + 0.00231708*m.i4*m.i82 - 0.0025243*m.i4*m.i83 + 0.00277762*m.i4*m.i84 + 0.0040202*m.i4*
m.i85 + 0.001500566*m.i4*m.i86 + 0.001680814*m.i4*m.i87 + 0.00640404*m.i4*m.i88 + 0.00397656*m.i4
*m.i89 + 0.000508164*m.i4*m.i90 + 0.00565534*m.i4*m.i91 + 0.0031999*m.i4*m.i92 + 0.0007233*m.i4*
m.i93 + 0.001347788*m.i4*m.i94 + 0.00386662*m.i4*m.i95 + 0.0056032*m.i4*m.i96 + 0.00392786*m.i4*
m.i97 + 0.0032706*m.i4*m.i98 + 0.000716722*m.i4*m.i99 + 0.00200998*m.i4*m.i100 + 0.00725878*m.i5*
m.i6 + 0.000634496*m.i5*m.i7 + 0.0112129*m.i5*m.i8 + 0.006535*m.i5*m.i9 + 0.0076756*m.i5*m.i10 -
0.00455426*m.i5*m.i11 + 0.001111236*m.i5*m.i12 + 0.01473142*m.i5*m.i13 + 0.01556352*m.i5*m.i14 +
0.00889148*m.i5*m.i15 + 0.00833956*m.i5*m.i16 + 0.01155304*m.i5*m.i17 + 0.0044319*m.i5*m.i18 +
0.0061696*m.i5*m.i19 + 0.01660846*m.i5*m.i20 + 0.00921042*m.i5*m.i21 + 0.01240074*m.i5*m.i22 +
0.00930536*m.i5*m.i23 + 0.00636938*m.i5*m.i24 + 0.00582298*m.i5*m.i25 + 0.00314834*m.i5*m.i26 +
0.00569034*m.i5*m.i27 + 0.00513186*m.i5*m.i28 + 0.00443806*m.i5*m.i29 + 0.01398194*m.i5*m.i30 +
0.00649478*m.i5*m.i31 + 0.01579432*m.i5*m.i32 + 0.00734872*m.i5*m.i33 + 0.0056108*m.i5*m.i34 +
0.00623672*m.i5*m.i35 + 0.01544598*m.i5*m.i36 + 0.01144796*m.i5*m.i37 + 0.0024117*m.i5*m.i38 +
0.00970728*m.i5*m.i39 + 0.0182302*m.i5*m.i40 + 0.00790876*m.i5*m.i41 + 0.00731488*m.i5*m.i42 +
0.00543454*m.i5*m.i43 + 0.00647722*m.i5*m.i44 + 0.0035064*m.i5*m.i45 + 0.00307696*m.i5*m.i46 +
0.00716814*m.i5*m.i47 + 0.001828662*m.i5*m.i48 + 0.00846664*m.i5*m.i49 + 0.01292148*m.i5*m.i50 +
0.0081737*m.i5*m.i51 + 0.00647086*m.i5*m.i52 + 0.00609644*m.i5*m.i53 + 0.00842446*m.i5*m.i54 +
0.00619594*m.i5*m.i55 + 0.01114364*m.i5*m.i56 + 0.00464056*m.i5*m.i57 + 0.00294786*m.i5*m.i58 +
0.01085566*m.i5*m.i59 + 0.00324938*m.i5*m.i60 + 0.01321296*m.i5*m.i61 + 0.00956118*m.i5*m.i62 +
0.00799502*m.i5*m.i63 + 0.00255928*m.i5*m.i64 + 0.00635808*m.i5*m.i65 + 0.00425494*m.i5*m.i66 +
0.00743456*m.i5*m.i67 + 0.003997*m.i5*m.i68 + 0.01327542*m.i5*m.i69 + 0.00624764*m.i5*m.i70 +
0.00544782*m.i5*m.i71 + 0.00583882*m.i5*m.i72 + 0.00712322*m.i5*m.i73 + 0.00675538*m.i5*m.i74 +
0.00471928*m.i5*m.i75 + 0.00331686*m.i5*m.i76 + 0.0064726*m.i5*m.i77 + 0.0043073*m.i5*m.i78 +
0.01376458*m.i5*m.i79 + 0.00590054*m.i5*m.i80 + 0.00544478*m.i5*m.i81 + 0.00433406*m.i5*m.i82 +
0.0018936*m.i5*m.i83 + 0.00732892*m.i5*m.i84 + 0.00654804*m.i5*m.i85 + 0.00769986*m.i5*m.i86 +
0.00924248*m.i5*m.i87 + 0.01858866*m.i5*m.i88 + 0.00588762*m.i5*m.i89 + 0.00671372*m.i5*m.i90 +
0.00513832*m.i5*m.i91 + 0.00597632*m.i5*m.i92 + 0.0033572*m.i5*m.i93 + 0.00718978*m.i5*m.i94 +
0.00692006*m.i5*m.i95 + 0.0082357*m.i5*m.i96 + 0.00798976*m.i5*m.i97 + 0.00578018*m.i5*m.i98 +
0.00997244*m.i5*m.i99 + 0.00861536*m.i5*m.i100 + 0.00682146*m.i6*m.i7 + 0.00318158*m.i6*m.i8 +
0.01402384*m.i6*m.i9 + 0.01146794*m.i6*m.i10 + 0.00514562*m.i6*m.i11 + 0.001749894*m.i6*m.i12 +
0.0349226*m.i6*m.i13 + 0.0204032*m.i6*m.i14 + 0.0257432*m.i6*m.i15 + 0.01758104*m.i6*m.i16 +
0.01908054*m.i6*m.i17 + 0.00928378*m.i6*m.i18 + 0.00320468*m.i6*m.i19 + 0.0315536*m.i6*m.i20 +
0.01792788*m.i6*m.i21 + 0.0231518*m.i6*m.i22 + 0.01485588*m.i6*m.i23 + 0.01959078*m.i6*m.i24 +
0.01015748*m.i6*m.i25 + 0.00771848*m.i6*m.i26 + 0.0203708*m.i6*m.i27 + 0.00861336*m.i6*m.i28 +
0.00733064*m.i6*m.i29 + 0.0211284*m.i6*m.i30 + 0.01136376*m.i6*m.i31 + 0.0298052*m.i6*m.i32 +
0.01763386*m.i6*m.i33 + 0.01196962*m.i6*m.i34 + 0.00970124*m.i6*m.i35 + 0.0426536*m.i6*m.i36 +
0.0162704*m.i6*m.i37 + 0.00511032*m.i6*m.i38 + 0.0211034*m.i6*m.i39 + 0.0536216*m.i6*m.i40 +
0.0314338*m.i6*m.i41 + 0.0212846*m.i6*m.i42 + 0.01544516*m.i6*m.i43 + 0.0203852*m.i6*m.i44 +
0.00711214*m.i6*m.i45 + 0.01012528*m.i6*m.i46 + 0.0378006*m.i6*m.i47 + 0.00769828*m.i6*m.i48 +
0.01043538*m.i6*m.i49 + 0.0235092*m.i6*m.i50 + 0.00574084*m.i6*m.i51 + 0.01540822*m.i6*m.i52 +
0.01066192*m.i6*m.i53 + 0.01947344*m.i6*m.i54 + 0.01212224*m.i6*m.i55 + 0.01841288*m.i6*m.i56 +
0.00863178*m.i6*m.i57 + 0.0123986*m.i6*m.i58 + 0.01033934*m.i6*m.i59 + 0.00473636*m.i6*m.i60 +
0.0271978*m.i6*m.i61 + 0.0244978*m.i6*m.i62 + 0.0206042*m.i6*m.i63 + 0.0123061*m.i6*m.i64 +
0.00969592*m.i6*m.i65 + 0.0105285*m.i6*m.i66 + 0.01296694*m.i6*m.i67 + 0.00467684*m.i6*m.i68 +
0.0206522*m.i6*m.i69 + 0.01181216*m.i6*m.i70 + 0.034569*m.i6*m.i71 + 0.01713412*m.i6*m.i72 +
0.00997084*m.i6*m.i73 + 0.00934556*m.i6*m.i74 + 0.00446476*m.i6*m.i75 + 0.00591468*m.i6*m.i76 +
0.00902732*m.i6*m.i77 + 0.00684842*m.i6*m.i78 + 0.000346556*m.i6*m.i79 + 0.01344964*m.i6*m.i80 +
0.028585*m.i6*m.i81 + 0.00365848*m.i6*m.i82 + 0.0233826*m.i6*m.i83 + 0.01097966*m.i6*m.i84 +
0.01159854*m.i6*m.i85 + 0.0132315*m.i6*m.i86 + 0.00973116*m.i6*m.i87 + 0.01749474*m.i6*m.i88 +
0.00153948*m.i6*m.i89 + 0.01386412*m.i6*m.i90 + 0.01199914*m.i6*m.i91 + 0.0141917*m.i6*m.i92 +
0.001321806*m.i6*m.i93 + 0.00438272*m.i6*m.i94 + 0.01131596*m.i6*m.i95 + 0.01535776*m.i6*m.i96 +
0.01709068*m.i6*m.i97 + 0.024088*m.i6*m.i98 + 0.0176488*m.i6*m.i99 + 0.0244376*m.i6*m.i100 +
0.00488516*m.i7*m.i8 + 0.00626372*m.i7*m.i9 + 0.001990118*m.i7*m.i10 + 0.00360408*m.i7*m.i11 +
0.0044488*m.i7*m.i12 + 0.00345036*m.i7*m.i13 + 0.01022598*m.i7*m.i14 + 0.00914736*m.i7*m.i15 +
0.00744612*m.i7*m.i16 + 0.0041386*m.i7*m.i17 + 0.00439536*m.i7*m.i18 + 0.00478826*m.i7*m.i19 +
0.00946126*m.i7*m.i20 + 0.00383118*m.i7*m.i21 + 0.00577738*m.i7*m.i22 + 0.0023517*m.i7*m.i23 +
0.0050588*m.i7*m.i24 + 0.0021953*m.i7*m.i25 + 0.00304582*m.i7*m.i26 + 0.0025687*m.i7*m.i27 +
0.001019412*m.i7*m.i28 + 0.001803492*m.i7*m.i29 + 0.00840076*m.i7*m.i30 + 0.00405006*m.i7*m.i31
+ 0.00330894*m.i7*m.i32 + 0.00379124*m.i7*m.i33 + 0.00297878*m.i7*m.i34 + 0.00257924*m.i7*m.i35
+ 0.00710268*m.i7*m.i36 + 0.00290856*m.i7*m.i37 + 0.00084645*m.i7*m.i38 + 0.00616224*m.i7*m.i39
+ 0.00012188*m.i7*m.i40 + 0.00931498*m.i7*m.i41 + 0.00783*m.i7*m.i42 + 0.00769852*m.i7*m.i43 +
0.00783756*m.i7*m.i44 + 0.0049081*m.i7*m.i45 + 0.00379762*m.i7*m.i46 + 0.00691856*m.i7*m.i47 +
0.00516014*m.i7*m.i48 + 0.00525658*m.i7*m.i49 + 0.00529626*m.i7*m.i50 + 0.00103022*m.i7*m.i51 +
0.00545452*m.i7*m.i52 + 0.00609146*m.i7*m.i53 + 0.0066465*m.i7*m.i54 + 0.0057959*m.i7*m.i55 +
0.00384568*m.i7*m.i56 + 0.00518642*m.i7*m.i57 + 0.0049888*m.i7*m.i58 + 0.00240984*m.i7*m.i59 +
0.001870666*m.i7*m.i60 + 0.00856542*m.i7*m.i61 + 0.00433228*m.i7*m.i62 + 0.00926318*m.i7*m.i63 +
0.00802564*m.i7*m.i64 + 0.002679*m.i7*m.i65 + 0.00656044*m.i7*m.i66 + 0.00189873*m.i7*m.i67 +
0.00559974*m.i7*m.i68 + 0.0059088*m.i7*m.i69 + 0.00502274*m.i7*m.i70 + 0.00714092*m.i7*m.i71 +
0.00451814*m.i7*m.i72 + 0.0055096*m.i7*m.i73 + 0.0054579*m.i7*m.i74 + 0.00428152*m.i7*m.i75 +
0.00201372*m.i7*m.i76 + 0.00763776*m.i7*m.i77 + 0.001767634*m.i7*m.i78 - 0.00404984*m.i7*m.i79 +
0.00693072*m.i7*m.i80 + 0.00453578*m.i7*m.i81 + 0.001431356*m.i7*m.i82 + 0.001000832*m.i7*m.i83
+ 0.00363592*m.i7*m.i84 + 0.00399748*m.i7*m.i85 + 0.00244412*m.i7*m.i86 - 0.00038172*m.i7*m.i87
+ 0.00670104*m.i7*m.i88 + 0.00351634*m.i7*m.i89 + 0.000192176*m.i7*m.i90 + 0.00766242*m.i7*m.i91
+ 0.00431432*m.i7*m.i92 + 0.00099522*m.i7*m.i93 + 0.00215394*m.i7*m.i94 + 0.00467712*m.i7*m.i95
+ 0.00551306*m.i7*m.i96 + 0.00524514*m.i7*m.i97 + 0.00715168*m.i7*m.i98 + 0.00269474*m.i7*m.i99
+ 0.006577*m.i7*m.i100 + 0.01497394*m.i8*m.i9 + 0.0108969*m.i8*m.i10 + 0.00659842*m.i8*m.i11 +
0.00635336*m.i8*m.i12 + 0.0313098*m.i8*m.i13 + 0.0387588*m.i8*m.i14 + 0.01963812*m.i8*m.i15 +
0.00587206*m.i8*m.i16 + 0.0158028*m.i8*m.i17 + 0.00433344*m.i8*m.i18 + 0.01027216*m.i8*m.i19 +
0.0310764*m.i8*m.i20 + 0.01480666*m.i8*m.i21 + 0.0292324*m.i8*m.i22 + 0.01097454*m.i8*m.i23 +
0.01637932*m.i8*m.i24 + 0.0081932*m.i8*m.i25 + 0.00625414*m.i8*m.i26 + 0.01206926*m.i8*m.i27 +
0.00960586*m.i8*m.i28 + 0.00767454*m.i8*m.i29 + 0.0389634*m.i8*m.i30 + 0.01047056*m.i8*m.i31 +
0.0243166*m.i8*m.i32 + 0.01490526*m.i8*m.i33 + 0.0048023*m.i8*m.i34 + 0.00582726*m.i8*m.i35 +
0.0310084*m.i8*m.i36 + 0.01520046*m.i8*m.i37 + 0.00435652*m.i8*m.i38 + 0.01820518*m.i8*m.i39 +
0.028962*m.i8*m.i40 + 0.0236162*m.i8*m.i41 + 0.0089807*m.i8*m.i42 + 0.01679084*m.i8*m.i43 +
0.01575264*m.i8*m.i44 - 0.00596962*m.i8*m.i45 + 0.0045504*m.i8*m.i46 + 0.0135935*m.i8*m.i47 +
0.00528224*m.i8*m.i48 + 0.01215584*m.i8*m.i49 + 0.01116408*m.i8*m.i50 + 0.00976906*m.i8*m.i51 +
0.01011206*m.i8*m.i52 + 0.0224104*m.i8*m.i53 + 0.01007602*m.i8*m.i54 + 0.01583128*m.i8*m.i55 +
0.00761084*m.i8*m.i56 + 0.00804396*m.i8*m.i57 + 0.01038608*m.i8*m.i58 + 0.01602498*m.i8*m.i59 +
0.00380248*m.i8*m.i60 + 0.0227414*m.i8*m.i61 + 0.0208778*m.i8*m.i62 + 0.01278874*m.i8*m.i63 +
0.00882622*m.i8*m.i64 + 0.01253422*m.i8*m.i65 + 0.00938202*m.i8*m.i66 + 0.0132364*m.i8*m.i67 +
0.00341364*m.i8*m.i68 + 0.0217686*m.i8*m.i69 + 0.01082106*m.i8*m.i70 + 0.0109575*m.i8*m.i71 +
0.01032418*m.i8*m.i72 + 0.01203924*m.i8*m.i73 + 0.01820078*m.i8*m.i74 + 0.00454846*m.i8*m.i75 +
0.00699592*m.i8*m.i76 + 0.017175*m.i8*m.i77 + 0.00418326*m.i8*m.i78 + 0.003044*m.i8*m.i79 +
0.00913958*m.i8*m.i80 + 0.01058642*m.i8*m.i81 + 0.00609436*m.i8*m.i82 + 0.00939194*m.i8*m.i83 +
0.01860882*m.i8*m.i84 + 0.00544766*m.i8*m.i85 + 0.00672898*m.i8*m.i86 + 0.00847128*m.i8*m.i87 +
0.0399532*m.i8*m.i88 + 0.00230258*m.i8*m.i89 + 0.00647968*m.i8*m.i90 + 0.00663734*m.i8*m.i91 +
0.00723392*m.i8*m.i92 + 0.0028363*m.i8*m.i93 + 0.01094692*m.i8*m.i94 + 0.01122622*m.i8*m.i95 +
0.01922686*m.i8*m.i96 + 0.0178042*m.i8*m.i97 + 0.00987488*m.i8*m.i98 + 0.0201768*m.i8*m.i99 +
0.00916962*m.i8*m.i100 + 0.00380196*m.i9*m.i10 + 0.000241806*m.i9*m.i11 + 0.00422182*m.i9*m.i12
+ 0.01745366*m.i9*m.i13 + 0.01560378*m.i9*m.i14 + 0.01797116*m.i9*m.i15 + 0.0104377*m.i9*m.i16
+ 0.01789532*m.i9*m.i17 + 0.0058031*m.i9*m.i18 + 0.00524852*m.i9*m.i19 + 0.0217664*m.i9*m.i20 +
0.0137801*m.i9*m.i21 + 0.00556924*m.i9*m.i22 + 0.00707894*m.i9*m.i23 + 0.00383446*m.i9*m.i24 +
0.00797136*m.i9*m.i25 + 0.00671112*m.i9*m.i26 + 0.00962638*m.i9*m.i27 + 0.00548282*m.i9*m.i28 +
0.00537842*m.i9*m.i29 + 0.01125578*m.i9*m.i30 + 0.01033708*m.i9*m.i31 + 0.01741482*m.i9*m.i32 +
0.01282666*m.i9*m.i33 + 0.00490948*m.i9*m.i34 + 0.00344028*m.i9*m.i35 + 0.01643714*m.i9*m.i36 +
0.00871578*m.i9*m.i37 + 0.002884*m.i9*m.i38 + 0.01596496*m.i9*m.i39 + 0.0171071*m.i9*m.i40 +
0.0282184*m.i9*m.i41 + 0.0157083*m.i9*m.i42 + 0.01908622*m.i9*m.i43 + 0.01887462*m.i9*m.i44 +
0.00621506*m.i9*m.i45 + 0.00706654*m.i9*m.i46 + 0.01685764*m.i9*m.i47 + 0.0046064*m.i9*m.i48 +
0.01393082*m.i9*m.i49 + 0.01366172*m.i9*m.i50 + 0.00974224*m.i9*m.i51 + 0.01117786*m.i9*m.i52 +
0.0105042*m.i9*m.i53 + 0.01603942*m.i9*m.i54 + 0.01154502*m.i9*m.i55 + 0.0187017*m.i9*m.i56 +
0.0063051*m.i9*m.i57 + 0.01180982*m.i9*m.i58 + 0.01148738*m.i9*m.i59 + 0.0045111*m.i9*m.i60 +
0.01782442*m.i9*m.i61 + 0.01261594*m.i9*m.i62 + 0.0275116*m.i9*m.i63 + 0.01370986*m.i9*m.i64 +
0.01301448*m.i9*m.i65 + 0.00909146*m.i9*m.i66 + 0.00880956*m.i9*m.i67 + 0.00542126*m.i9*m.i68 +
0.0173699*m.i9*m.i69 + 0.0063573*m.i9*m.i70 + 0.01464082*m.i9*m.i71 + 0.01030184*m.i9*m.i72 +
0.01342364*m.i9*m.i73 + 0.01050302*m.i9*m.i74 + 0.00580926*m.i9*m.i75 + 0.00669824*m.i9*m.i76 +
0.0154461*m.i9*m.i77 + 0.00331996*m.i9*m.i78 - 0.00117976*m.i9*m.i79 + 0.0134427*m.i9*m.i80 +
0.01200946*m.i9*m.i81 + 0.00261992*m.i9*m.i82 + 0.01802554*m.i9*m.i83 + 0.01281546*m.i9*m.i84 +
0.00817562*m.i9*m.i85 + 0.01353278*m.i9*m.i86 + 0.0065419*m.i9*m.i87 + 0.0287756*m.i9*m.i88 +
0.00438656*m.i9*m.i89 + 0.006514*m.i9*m.i90 + 0.00948704*m.i9*m.i91 + 0.01460712*m.i9*m.i92 +
0.00442406*m.i9*m.i93 + 0.00525338*m.i9*m.i94 + 0.01080594*m.i9*m.i95 + 0.007284*m.i9*m.i96 +
0.01145784*m.i9*m.i97 + 0.01167366*m.i9*m.i98 + 0.01306896*m.i9*m.i99 + 0.01230056*m.i9*m.i100 +
0.00390108*m.i10*m.i11 + 0.00306506*m.i10*m.i12 + 0.0266658*m.i10*m.i13 + 0.027667*m.i10*m.i14 +
0.01278752*m.i10*m.i15 + 0.01031474*m.i10*m.i16 + 0.01126594*m.i10*m.i17 + 0.00489102*m.i10*m.i18
+ 0.00513038*m.i10*m.i19 + 0.01899656*m.i10*m.i20 + 0.01116072*m.i10*m.i21 + 0.0218888*m.i10*
m.i22 + 0.01101148*m.i10*m.i23 + 0.00938786*m.i10*m.i24 + 0.00495956*m.i10*m.i25 + 0.00409492*
m.i10*m.i26 + 0.00774196*m.i10*m.i27 + 0.00563678*m.i10*m.i28 + 0.00452506*m.i10*m.i29 +
0.0234496*m.i10*m.i30 + 0.00879878*m.i10*m.i31 + 0.01816086*m.i10*m.i32 + 0.01204676*m.i10*m.i33
+ 0.00474448*m.i10*m.i34 + 0.00478426*m.i10*m.i35 + 0.0297012*m.i10*m.i36 + 0.0151832*m.i10*
m.i37 + 0.00256504*m.i10*m.i38 + 0.01482468*m.i10*m.i39 + 0.0351312*m.i10*m.i40 + 0.00722204*
m.i10*m.i41 + 0.00911442*m.i10*m.i42 + 0.00459148*m.i10*m.i43 + 0.00643892*m.i10*m.i44 +
0.00232242*m.i10*m.i45 + 0.00525016*m.i10*m.i46 + 0.00918898*m.i10*m.i47 + 0.00604914*m.i10*m.i48
+ 0.00855226*m.i10*m.i49 + 0.01758968*m.i10*m.i50 + 0.00905476*m.i10*m.i51 + 0.0076611*m.i10*
m.i52 + 0.01159398*m.i10*m.i53 + 0.00933998*m.i10*m.i54 + 0.00932956*m.i10*m.i55 + 0.0077777*
m.i10*m.i56 + 0.00585234*m.i10*m.i57 + 0.00494612*m.i10*m.i58 + 0.01267098*m.i10*m.i59 +
0.0025072*m.i10*m.i60 + 0.01652258*m.i10*m.i61 + 0.0113132*m.i10*m.i62 + 0.00647572*m.i10*m.i63
+ 0.00509638*m.i10*m.i64 + 0.00796924*m.i10*m.i65 + 0.00671784*m.i10*m.i66 + 0.00876736*m.i10*
m.i67 + 0.00330284*m.i10*m.i68 + 0.0143256*m.i10*m.i69 + 0.00658518*m.i10*m.i70 + 0.00751304*
m.i10*m.i71 + 0.00447272*m.i10*m.i72 + 0.00707326*m.i10*m.i73 + 0.01022514*m.i10*m.i74 +
0.00629098*m.i10*m.i75 + 0.00437386*m.i10*m.i76 + 0.0069722*m.i10*m.i77 + 0.00631338*m.i10*m.i78
+ 0.01475202*m.i10*m.i79 + 0.00722624*m.i10*m.i80 + 0.00973154*m.i10*m.i81 + 0.00371556*m.i10*
m.i82 + 0.00253096*m.i10*m.i83 + 0.008833*m.i10*m.i84 + 0.00871744*m.i10*m.i85 + 0.0101816*m.i10*
m.i86 + 0.01000738*m.i10*m.i87 + 0.01974334*m.i10*m.i88 + 0.00587674*m.i10*m.i89 + 0.0124516*
m.i10*m.i90 + 0.00915752*m.i10*m.i91 + 0.00913708*m.i10*m.i92 + 0.00200378*m.i10*m.i93 +
0.00536928*m.i10*m.i94 + 0.00823672*m.i10*m.i95 + 0.01736144*m.i10*m.i96 + 0.01105742*m.i10*m.i97
+ 0.01023842*m.i10*m.i98 + 0.01685104*m.i10*m.i99 + 0.01457986*m.i10*m.i100 + 0.000833086*m.i11*
m.i12 + 0.00999478*m.i11*m.i13 + 0.01344484*m.i11*m.i14 + 0.0031808*m.i11*m.i15 + 0.01117228*
m.i11*m.i16 + 0.000697152*m.i11*m.i17 + 0.000585828*m.i11*m.i18 + 0.00585952*m.i11*m.i19 +
0.00859976*m.i11*m.i20 + 0.00502902*m.i11*m.i21 + 0.00447154*m.i11*m.i22 + 0.001969568*m.i11*
m.i23 + 0.0049358*m.i11*m.i24 - 0.00029705*m.i11*m.i25 + 0.0008833*m.i11*m.i26 + 0.00788936*m.i11
*m.i27 + 0.00223564*m.i11*m.i28 - 0.001370818*m.i11*m.i29 + 0.0148367*m.i11*m.i30 + 0.01084338*
m.i11*m.i31 + 0.000606756*m.i11*m.i32 + 0.00591896*m.i11*m.i33 - 0.00408456*m.i11*m.i34 -
0.002724*m.i11*m.i35 + 0.01495302*m.i11*m.i36 + 0.0001528802*m.i11*m.i37 + 0.000200858*m.i11*
m.i38 + 0.00843216*m.i11*m.i39 + 0.01341476*m.i11*m.i40 + 0.01160686*m.i11*m.i41 + 0.00464728*
m.i11*m.i42 + 0.00803576*m.i11*m.i43 + 0.00270742*m.i11*m.i44 - 0.00352162*m.i11*m.i45 +
0.000947796*m.i11*m.i46 + 0.00388898*m.i11*m.i47 + 0.00557236*m.i11*m.i48 + 0.00208008*m.i11*
m.i49 + 0.000931698*m.i11*m.i50 + 0.000654446*m.i11*m.i51 + 0.00650504*m.i11*m.i52 + 0.000501194*
m.i11*m.i53 + 0.00681518*m.i11*m.i54 + 0.00601122*m.i11*m.i55 - 0.00507122*m.i11*m.i56 +
0.000483176*m.i11*m.i57 + 0.00482018*m.i11*m.i58 + 0.0064067*m.i11*m.i59 - 0.000166498*m.i11*
m.i60 + 0.00575774*m.i11*m.i61 + 0.00725456*m.i11*m.i62 + 0.00219412*m.i11*m.i63 + 0.0084673*
m.i11*m.i64 + 0.000333436*m.i11*m.i65 + 0.00655332*m.i11*m.i66 - 0.00257168*m.i11*m.i67 +
0.01199786*m.i11*m.i68 + 0.0059299*m.i11*m.i69 + 0.001843394*m.i11*m.i70 + 0.01060724*m.i11*m.i71
+ 0.00647206*m.i11*m.i72 + 0.00231676*m.i11*m.i73 + 0.00580344*m.i11*m.i74 + 0.00620538*m.i11*
m.i75 - 0.000334258*m.i11*m.i76 + 0.00656424*m.i11*m.i77 - 0.001286316*m.i11*m.i78 + 0.00546106*
m.i11*m.i79 - 0.000202642*m.i11*m.i80 + 0.00426114*m.i11*m.i81 - 0.00204892*m.i11*m.i82 +
0.01117602*m.i11*m.i83 + 0.01034244*m.i11*m.i84 + 0.00449542*m.i11*m.i85 + 0.00797378*m.i11*m.i86
- 0.000792844*m.i11*m.i87 + 0.01939124*m.i11*m.i88 + 0.00432784*m.i11*m.i89 + 0.00204578*m.i11*
m.i90 + 0.021152*m.i11*m.i91 + 0.00283286*m.i11*m.i92 - 0.00407532*m.i11*m.i93 - 0.001198622*
m.i11*m.i94 + 0.0056114*m.i11*m.i95 + 0.00560696*m.i11*m.i96 + 0.00867776*m.i11*m.i97 +
0.01208222*m.i11*m.i98 + 0.00209588*m.i11*m.i99 + 0.0061276*m.i11*m.i100 + 0.00580036*m.i12*m.i13
+ 0.01674486*m.i12*m.i14 + 0.00758412*m.i12*m.i15 + 0.0061097*m.i12*m.i16 + 0.00406024*m.i12*
m.i17 + 0.00246134*m.i12*m.i18 + 0.00422294*m.i12*m.i19 + 0.00359302*m.i12*m.i20 + 0.0027503*
m.i12*m.i21 + 0.01042736*m.i12*m.i22 + 0.001094158*m.i12*m.i23 + 0.00410122*m.i12*m.i24 +
0.0025257*m.i12*m.i25 + 0.00319626*m.i12*m.i26 + 0.00241386*m.i12*m.i27 + 0.001365712*m.i12*m.i28
+ 0.00285332*m.i12*m.i29 + 0.01617908*m.i12*m.i30 + 0.00231724*m.i12*m.i31 + 0.00343892*m.i12*
m.i32 + 0.00256516*m.i12*m.i33 + 0.001014308*m.i12*m.i34 + 0.001643396*m.i12*m.i35 + 0.00879946*
m.i12*m.i36 + 0.00422942*m.i12*m.i37 + 0.001108756*m.i12*m.i38 + 0.0068803*m.i12*m.i39 -
0.00375268*m.i12*m.i40 + 0.0029422*m.i12*m.i41 + 0.00429146*m.i12*m.i42 + 0.00277958*m.i12*m.i43
+ 0.00284814*m.i12*m.i44 + 0.001633544*m.i12*m.i45 + 0.00422296*m.i12*m.i46 + 0.000606884*m.i12*
m.i47 + 0.0041981*m.i12*m.i48 + 0.00378962*m.i12*m.i49 + 0.00842602*m.i12*m.i50 + 0.002132*m.i12*
m.i51 + 0.00482062*m.i12*m.i52 + 0.00806126*m.i12*m.i53 + 0.00387284*m.i12*m.i54 + 0.0039366*
m.i12*m.i55 + 0.000612768*m.i12*m.i56 + 0.0044852*m.i12*m.i57 + 0.00284844*m.i12*m.i58 +
0.00336708*m.i12*m.i59 + 0.0030099*m.i12*m.i60 + 0.00693418*m.i12*m.i61 + 0.0046908*m.i12*m.i62
+ 0.00538386*m.i12*m.i63 + 0.00560854*m.i12*m.i64 + 0.00360994*m.i12*m.i65 + 0.00317544*m.i12*
m.i66 + 0.00443286*m.i12*m.i67 + 0.00420074*m.i12*m.i68 + 0.00506986*m.i12*m.i69 + 0.00415464*
m.i12*m.i70 + 0.00220046*m.i12*m.i71 + 0.00230386*m.i12*m.i72 + 0.00311708*m.i12*m.i73 +
0.00731294*m.i12*m.i74 + 0.0048156*m.i12*m.i75 + 0.00332812*m.i12*m.i76 + 0.00439802*m.i12*m.i77
+ 0.00371872*m.i12*m.i78 + 0.00601328*m.i12*m.i79 + 0.00749754*m.i12*m.i80 + 0.00280082*m.i12*
m.i81 + 0.00202854*m.i12*m.i82 + 0.001389608*m.i12*m.i83 + 0.00387764*m.i12*m.i84 + 0.00354982*
m.i12*m.i85 + 0.00265444*m.i12*m.i86 + 0.0022211*m.i12*m.i87 + 0.00666916*m.i12*m.i88 +
0.00412408*m.i12*m.i89 + 0.00421336*m.i12*m.i90 + 0.00306034*m.i12*m.i91 + 0.00210254*m.i12*m.i92
+ 0.001819242*m.i12*m.i93 + 0.0007903*m.i12*m.i94 + 0.00409078*m.i12*m.i95 + 0.00988156*m.i12*
m.i96 + 0.00522182*m.i12*m.i97 + 0.00482098*m.i12*m.i98 + 0.0042136*m.i12*m.i99 + 0.00408986*
m.i12*m.i100 + 0.0674968*m.i13*m.i14 + 0.0344974*m.i13*m.i15 + 0.0330226*m.i13*m.i16 + 0.0319354*
m.i13*m.i17 + 0.01218366*m.i13*m.i18 + 0.00519196*m.i13*m.i19 + 0.044536*m.i13*m.i20 + 0.0277772*
m.i13*m.i21 + 0.0622606*m.i13*m.i22 + 0.0259408*m.i13*m.i23 + 0.0302608*m.i13*m.i24 + 0.0163455*
m.i13*m.i25 + 0.0077583*m.i13*m.i26 + 0.0227636*m.i13*m.i27 + 0.01173702*m.i13*m.i28 + 0.00769116
*m.i13*m.i29 + 0.0709126*m.i13*m.i30 + 0.01974624*m.i13*m.i31 + 0.0471936*m.i13*m.i32 + 0.0320402
*m.i13*m.i33 + 0.0107856*m.i13*m.i34 + 0.00663924*m.i13*m.i35 + 0.0963608*m.i13*m.i36 + 0.0383208
*m.i13*m.i37 + 0.00629602*m.i13*m.i38 + 0.0436584*m.i13*m.i39 + 0.113305*m.i13*m.i40 + 0.030603*
m.i13*m.i41 + 0.0334486*m.i13*m.i42 + 0.0221094*m.i13*m.i43 + 0.0261022*m.i13*m.i44 + 0.00384036*
m.i13*m.i45 + 0.01393368*m.i13*m.i46 + 0.0390862*m.i13*m.i47 + 0.01408516*m.i13*m.i48 + 0.0200136
*m.i13*m.i49 + 0.0473844*m.i13*m.i50 + 0.0233922*m.i13*m.i51 + 0.0267544*m.i13*m.i52 + 0.0382128*
m.i13*m.i53 + 0.026998*m.i13*m.i54 + 0.0232812*m.i13*m.i55 + 0.0210468*m.i13*m.i56 + 0.01155576*
m.i13*m.i57 + 0.01460704*m.i13*m.i58 + 0.0315638*m.i13*m.i59 + 0.00606798*m.i13*m.i60 + 0.048913*
m.i13*m.i61 + 0.0422528*m.i13*m.i62 + 0.0227364*m.i13*m.i63 + 0.0218176*m.i13*m.i64 + 0.020181*
m.i13*m.i65 + 0.0171918*m.i13*m.i66 + 0.0231896*m.i13*m.i67 + 0.00653966*m.i13*m.i68 + 0.0386908*
m.i13*m.i69 + 0.01310368*m.i13*m.i70 + 0.0233574*m.i13*m.i71 + 0.01370986*m.i13*m.i72 +
0.01644046*m.i13*m.i73 + 0.0239108*m.i13*m.i74 + 0.01209114*m.i13*m.i75 + 0.00733894*m.i13*m.i76
+ 0.01831752*m.i13*m.i77 + 0.01361596*m.i13*m.i78 + 0.0349392*m.i13*m.i79 + 0.01738086*m.i13*
m.i80 + 0.0327952*m.i13*m.i81 + 0.00370036*m.i13*m.i82 + 0.0275306*m.i13*m.i83 + 0.0237408*m.i13*
m.i84 + 0.023854*m.i13*m.i85 + 0.0298082*m.i13*m.i86 + 0.01954408*m.i13*m.i87 + 0.0427146*m.i13*
m.i88 + 0.00800344*m.i13*m.i89 + 0.0379614*m.i13*m.i90 + 0.0237386*m.i13*m.i91 + 0.0280402*m.i13*
m.i92 + 0.00539152*m.i13*m.i93 + 0.00878456*m.i13*m.i94 + 0.0258544*m.i13*m.i95 + 0.0525716*m.i13
*m.i96 + 0.0324866*m.i13*m.i97 + 0.03178*m.i13*m.i98 + 0.0440898*m.i13*m.i99 + 0.0425102*m.i13*
m.i100 + 0.0526828*m.i14*m.i15 + 0.037439*m.i14*m.i16 + 0.0256328*m.i14*m.i17 + 0.0100326*m.i14*
m.i18 + 0.02287*m.i14*m.i19 + 0.05764*m.i14*m.i20 + 0.0305304*m.i14*m.i21 + 0.0790588*m.i14*m.i22
+ 0.0273134*m.i14*m.i23 + 0.0226144*m.i14*m.i24 + 0.01919436*m.i14*m.i25 + 0.01634394*m.i14*
m.i26 + 0.0200216*m.i14*m.i27 + 0.01187024*m.i14*m.i28 + 0.0175096*m.i14*m.i29 + 0.1303416*m.i14*
m.i30 + 0.01783484*m.i14*m.i31 + 0.0483706*m.i14*m.i32 + 0.0389666*m.i14*m.i33 + 0.00488422*m.i14
*m.i34 + 0.01045608*m.i14*m.i35 + 0.0811654*m.i14*m.i36 + 0.0367626*m.i14*m.i37 + 0.00522434*
m.i14*m.i38 + 0.05055*m.i14*m.i39 + 0.0849278*m.i14*m.i40 + 0.0341058*m.i14*m.i41 + 0.029549*
m.i14*m.i42 + 0.0119177*m.i14*m.i43 + 0.034956*m.i14*m.i44 + 0.0084943*m.i14*m.i45 + 0.01853266*
m.i14*m.i46 + 0.01893124*m.i14*m.i47 + 0.0205662*m.i14*m.i48 + 0.0326974*m.i14*m.i49 + 0.0610942*
m.i14*m.i50 + 0.0265816*m.i14*m.i51 + 0.0345152*m.i14*m.i52 + 0.0602904*m.i14*m.i53 + 0.0299894*
m.i14*m.i54 + 0.029724*m.i14*m.i55 + 0.00991024*m.i14*m.i56 + 0.0212834*m.i14*m.i57 + 0.01611994*
m.i14*m.i58 + 0.0349608*m.i14*m.i59 + 0.01544524*m.i14*m.i60 + 0.0660828*m.i14*m.i61 + 0.0517844*
m.i14*m.i62 + 0.0288716*m.i14*m.i63 + 0.02065*m.i14*m.i64 + 0.0285834*m.i14*m.i65 + 0.01348302*
m.i14*m.i66 + 0.0306592*m.i14*m.i67 + 0.01828946*m.i14*m.i68 + 0.0537368*m.i14*m.i69 + 0.0271944*
m.i14*m.i70 + 0.01793364*m.i14*m.i71 + 0.0206146*m.i14*m.i72 + 0.0281438*m.i14*m.i73 + 0.038653*
m.i14*m.i74 + 0.0322466*m.i14*m.i75 + 0.0212534*m.i14*m.i76 + 0.0336072*m.i14*m.i77 + 0.01910646*
m.i14*m.i78 + 0.0653414*m.i14*m.i79 + 0.0269972*m.i14*m.i80 + 0.0273492*m.i14*m.i81 + 0.01038358*
m.i14*m.i82 + 0.00619204*m.i14*m.i83 + 0.0273406*m.i14*m.i84 + 0.0211516*m.i14*m.i85 + 0.0382364*
m.i14*m.i86 + 0.0345294*m.i14*m.i87 + 0.1230516*m.i14*m.i88 + 0.032645*m.i14*m.i89 + 0.0494242*
m.i14*m.i90 + 0.030464*m.i14*m.i91 + 0.0229316*m.i14*m.i92 + 0.01328606*m.i14*m.i93 + 0.01219994*
m.i14*m.i94 + 0.0308436*m.i14*m.i95 + 0.0853596*m.i14*m.i96 + 0.0354032*m.i14*m.i97 + 0.0262134*
m.i14*m.i98 + 0.0473304*m.i14*m.i99 + 0.037143*m.i14*m.i100 + 0.01723066*m.i15*m.i16 + 0.0144032*
m.i15*m.i17 + 0.01011568*m.i15*m.i18 + 0.01071386*m.i15*m.i19 + 0.0363128*m.i15*m.i20 + 0.0200062
*m.i15*m.i21 + 0.0429276*m.i15*m.i22 + 0.01550086*m.i15*m.i23 + 0.01336936*m.i15*m.i24 +
0.01153424*m.i15*m.i25 + 0.01291552*m.i15*m.i26 + 0.01571376*m.i15*m.i27 + 0.0057752*m.i15*m.i28
+ 0.01132328*m.i15*m.i29 + 0.04615*m.i15*m.i30 + 0.0095472*m.i15*m.i31 + 0.0348208*m.i15*m.i32
+ 0.01999334*m.i15*m.i33 + 0.00687142*m.i15*m.i34 + 0.00887602*m.i15*m.i35 + 0.0412134*m.i15*
m.i36 + 0.0222294*m.i15*m.i37 + 0.0044452*m.i15*m.i38 + 0.0275012*m.i15*m.i39 + 0.0449902*m.i15*
m.i40 + 0.0316194*m.i15*m.i41 + 0.021335*m.i15*m.i42 + 0.01203424*m.i15*m.i43 + 0.0250958*m.i15*
m.i44 + 0.00747774*m.i15*m.i45 + 0.01208838*m.i15*m.i46 + 0.0258298*m.i15*m.i47 + 0.01217868*
m.i15*m.i48 + 0.0181139*m.i15*m.i49 + 0.0324096*m.i15*m.i50 + 0.01156602*m.i15*m.i51 + 0.01869794
*m.i15*m.i52 + 0.0276488*m.i15*m.i53 + 0.0230496*m.i15*m.i54 + 0.0171536*m.i15*m.i55 + 0.01527606
*m.i15*m.i56 + 0.01288824*m.i15*m.i57 + 0.014014*m.i15*m.i58 + 0.01657292*m.i15*m.i59 + 0.0080112
*m.i15*m.i60 + 0.0380938*m.i15*m.i61 + 0.0298954*m.i15*m.i62 + 0.0218266*m.i15*m.i63 + 0.01580514
*m.i15*m.i64 + 0.01327226*m.i15*m.i65 + 0.01171988*m.i15*m.i66 + 0.01749552*m.i15*m.i67 +
0.00958228*m.i15*m.i68 + 0.02991*m.i15*m.i69 + 0.01687722*m.i15*m.i70 + 0.0214718*m.i15*m.i71 +
0.0177952*m.i15*m.i72 + 0.01429134*m.i15*m.i73 + 0.01835742*m.i15*m.i74 + 0.014413*m.i15*m.i75 +
0.01215492*m.i15*m.i76 + 0.01888264*m.i15*m.i77 + 0.01135654*m.i15*m.i78 + 0.01419354*m.i15*m.i79
+ 0.01589948*m.i15*m.i80 + 0.01996746*m.i15*m.i81 + 0.00616376*m.i15*m.i82 + 0.00905236*m.i15*
m.i83 + 0.01329424*m.i15*m.i84 + 0.01265054*m.i15*m.i85 + 0.01743812*m.i15*m.i86 + 0.01662354*
m.i15*m.i87 + 0.0326642*m.i15*m.i88 + 0.00648876*m.i15*m.i89 + 0.0255582*m.i15*m.i90 + 0.01710528
*m.i15*m.i91 + 0.01530604*m.i15*m.i92 + 0.00729364*m.i15*m.i93 + 0.00786908*m.i15*m.i94 +
0.0169034*m.i15*m.i95 + 0.034265*m.i15*m.i96 + 0.0206426*m.i15*m.i97 + 0.01574576*m.i15*m.i98 +
0.0251768*m.i15*m.i99 + 0.0302234*m.i15*m.i100 + 0.0180502*m.i16*m.i17 + 0.00797572*m.i16*m.i18
+ 0.00993386*m.i16*m.i19 + 0.0236072*m.i16*m.i20 + 0.01425014*m.i16*m.i21 + 0.0269392*m.i16*
m.i22 + 0.01322908*m.i16*m.i23 + 0.01719786*m.i16*m.i24 + 0.00995474*m.i16*m.i25 + 0.00544834*
m.i16*m.i26 + 0.01319632*m.i16*m.i27 + 0.00695148*m.i16*m.i28 + 0.00568042*m.i16*m.i29 + 0.045082
*m.i16*m.i30 + 0.01190474*m.i16*m.i31 + 0.01955462*m.i16*m.i32 + 0.0138212*m.i16*m.i33 +
0.00642106*m.i16*m.i34 + 0.00665524*m.i16*m.i35 + 0.0380492*m.i16*m.i36 + 0.01602708*m.i16*m.i37
+ 0.00369958*m.i16*m.i38 + 0.0220792*m.i16*m.i39 + 0.0304262*m.i16*m.i40 + 0.01843444*m.i16*
m.i41 + 0.021247*m.i16*m.i42 + 0.01518988*m.i16*m.i43 + 0.01406774*m.i16*m.i44 + 0.0051723*m.i16*
m.i45 + 0.0080675*m.i16*m.i46 + 0.0176419*m.i16*m.i47 + 0.0090298*m.i16*m.i48 + 0.0126196*m.i16*
m.i49 + 0.025967*m.i16*m.i50 + 0.01140228*m.i16*m.i51 + 0.01900414*m.i16*m.i52 + 0.01781402*m.i16
*m.i53 + 0.0194748*m.i16*m.i54 + 0.01211848*m.i16*m.i55 + 0.01166912*m.i16*m.i56 + 0.00870972*
m.i16*m.i57 + 0.00719416*m.i16*m.i58 + 0.01574372*m.i16*m.i59 + 0.00725944*m.i16*m.i60 +
0.0294988*m.i16*m.i61 + 0.0260914*m.i16*m.i62 + 0.01974094*m.i16*m.i63 + 0.01434116*m.i16*m.i64
+ 0.00954816*m.i16*m.i65 + 0.0087947*m.i16*m.i66 + 0.01216302*m.i16*m.i67 + 0.01307338*m.i16*
m.i68 + 0.023669*m.i16*m.i69 + 0.01061826*m.i16*m.i70 + 0.01531198*m.i16*m.i71 + 0.01282252*m.i16
*m.i72 + 0.01136194*m.i16*m.i73 + 0.01289612*m.i16*m.i74 + 0.0111961*m.i16*m.i75 + 0.00467394*
m.i16*m.i76 + 0.0120207*m.i16*m.i77 + 0.00634502*m.i16*m.i78 + 0.0272842*m.i16*m.i79 + 0.01354848
*m.i16*m.i80 + 0.01491878*m.i16*m.i81 + 0.00372788*m.i16*m.i82 + 0.01347184*m.i16*m.i83 +
0.01367452*m.i16*m.i84 + 0.01430584*m.i16*m.i85 + 0.01662228*m.i16*m.i86 + 0.01019354*m.i16*m.i87
+ 0.031864*m.i16*m.i88 + 0.01389622*m.i16*m.i89 + 0.01404588*m.i16*m.i90 + 0.01898344*m.i16*
m.i91 + 0.01310136*m.i16*m.i92 + 0.00293122*m.i16*m.i93 + 0.00548746*m.i16*m.i94 + 0.01674526*
m.i16*m.i95 + 0.0263504*m.i16*m.i96 + 0.0187966*m.i16*m.i97 + 0.0198675*m.i16*m.i98 + 0.0160833*
m.i16*m.i99 + 0.01885334*m.i16*m.i100 + 0.00599666*m.i17*m.i18 + 0.0047675*m.i17*m.i19 +
0.0265872*m.i17*m.i20 + 0.01628802*m.i17*m.i21 + 0.01871884*m.i17*m.i22 + 0.01233104*m.i17*m.i23
+ 0.01365522*m.i17*m.i24 + 0.00989432*m.i17*m.i25 + 0.00330258*m.i17*m.i26 + 0.0116841*m.i17*
m.i27 + 0.0079471*m.i17*m.i28 + 0.0045994*m.i17*m.i29 + 0.0254766*m.i17*m.i30 + 0.01659406*m.i17*
m.i31 + 0.0220846*m.i17*m.i32 + 0.01861566*m.i17*m.i33 + 0.00948066*m.i17*m.i34 + 0.0090429*m.i17
*m.i35 + 0.0337978*m.i17*m.i36 + 0.01595384*m.i17*m.i37 + 0.00235078*m.i17*m.i38 + 0.0201494*
m.i17*m.i39 + 0.0342284*m.i17*m.i40 + 0.0277738*m.i17*m.i41 + 0.01731318*m.i17*m.i42 + 0.01753214
*m.i17*m.i43 + 0.01978996*m.i17*m.i44 + 0.00369934*m.i17*m.i45 + 0.00718436*m.i17*m.i46 +
0.01949342*m.i17*m.i47 + 0.00499956*m.i17*m.i48 + 0.01707236*m.i17*m.i49 + 0.0203004*m.i17*m.i50
+ 0.01279548*m.i17*m.i51 + 0.011643*m.i17*m.i52 + 0.01115602*m.i17*m.i53 + 0.01587576*m.i17*
m.i54 + 0.010193*m.i17*m.i55 + 0.0217498*m.i17*m.i56 + 0.0064957*m.i17*m.i57 + 0.00989022*m.i17*
m.i58 + 0.01554654*m.i17*m.i59 + 0.00382894*m.i17*m.i60 + 0.01868378*m.i17*m.i61 + 0.01822302*
m.i17*m.i62 + 0.0270002*m.i17*m.i63 + 0.01054316*m.i17*m.i64 + 0.01114578*m.i17*m.i65 + 0.010706*
m.i17*m.i66 + 0.01057722*m.i17*m.i67 + 0.00541042*m.i17*m.i68 + 0.022045*m.i17*m.i69 + 0.00933892
*m.i17*m.i70 + 0.0217256*m.i17*m.i71 + 0.010527*m.i17*m.i72 + 0.01245986*m.i17*m.i73 + 0.01462496
*m.i17*m.i74 + 0.00471612*m.i17*m.i75 + 0.00385082*m.i17*m.i76 + 0.0150046*m.i17*m.i77 +
0.00469912*m.i17*m.i78 + 0.01570408*m.i17*m.i79 + 0.01238884*m.i17*m.i80 + 0.0167981*m.i17*m.i81
+ 0.00275656*m.i17*m.i82 + 0.0264668*m.i17*m.i83 + 0.01754616*m.i17*m.i84 + 0.0104241*m.i17*
m.i85 + 0.0155118*m.i17*m.i86 + 0.00992204*m.i17*m.i87 + 0.0334656*m.i17*m.i88 + 0.0100102*m.i17*
m.i89 + 0.00830234*m.i17*m.i90 + 0.00830522*m.i17*m.i91 + 0.01347376*m.i17*m.i92 + 0.00371114*
m.i17*m.i93 + 0.00721878*m.i17*m.i94 + 0.01197232*m.i17*m.i95 + 0.01097582*m.i17*m.i96 +
0.0153446*m.i17*m.i97 + 0.01911512*m.i17*m.i98 + 0.0158341*m.i17*m.i99 + 0.01647016*m.i17*m.i100
+ 0.0038501*m.i18*m.i19 + 0.01438424*m.i18*m.i20 + 0.00575166*m.i18*m.i21 + 0.01286738*m.i18*
m.i22 + 0.0072269*m.i18*m.i23 + 0.00577628*m.i18*m.i24 + 0.00353166*m.i18*m.i25 + 0.00406754*
m.i18*m.i26 + 0.00586712*m.i18*m.i27 + 0.00246394*m.i18*m.i28 + 0.00208424*m.i18*m.i29 +
0.00868042*m.i18*m.i30 + 0.00488392*m.i18*m.i31 + 0.01139774*m.i18*m.i32 + 0.00652178*m.i18*m.i33
+ 0.00514824*m.i18*m.i34 + 0.00420068*m.i18*m.i35 + 0.01314078*m.i18*m.i36 + 0.00738678*m.i18*
m.i37 + 0.00212172*m.i18*m.i38 + 0.00767338*m.i18*m.i39 + 0.01491396*m.i18*m.i40 + 0.00689198*
m.i18*m.i41 + 0.00941516*m.i18*m.i42 + 0.00703674*m.i18*m.i43 + 0.00623926*m.i18*m.i44 +
0.0042213*m.i18*m.i45 + 0.00377366*m.i18*m.i46 + 0.01005392*m.i18*m.i47 + 0.00385304*m.i18*m.i48
+ 0.0061538*m.i18*m.i49 + 0.00828744*m.i18*m.i50 + 0.00452496*m.i18*m.i51 + 0.00647618*m.i18*
m.i52 + 0.00595912*m.i18*m.i53 + 0.00909974*m.i18*m.i54 + 0.00683082*m.i18*m.i55 + 0.00696058*
m.i18*m.i56 + 0.00489492*m.i18*m.i57 + 0.00399036*m.i18*m.i58 + 0.0071619*m.i18*m.i59 +
0.00282566*m.i18*m.i60 + 0.01253118*m.i18*m.i61 + 0.01017836*m.i18*m.i62 + 0.0054806*m.i18*m.i63
+ 0.00679494*m.i18*m.i64 + 0.00492774*m.i18*m.i65 + 0.00294036*m.i18*m.i66 + 0.00302154*m.i18*
m.i67 + 0.00492864*m.i18*m.i68 + 0.01002278*m.i18*m.i69 + 0.00498708*m.i18*m.i70 + 0.00467346*
m.i18*m.i71 + 0.00622154*m.i18*m.i72 + 0.0060522*m.i18*m.i73 + 0.00606086*m.i18*m.i74 +
0.00435108*m.i18*m.i75 + 0.00246578*m.i18*m.i76 + 0.00518572*m.i18*m.i77 + 0.00318624*m.i18*m.i78
+ 0.00460288*m.i18*m.i79 + 0.007017*m.i18*m.i80 + 0.00647242*m.i18*m.i81 + 0.00407958*m.i18*
m.i82 - 0.000888864*m.i18*m.i83 + 0.00537106*m.i18*m.i84 + 0.00634694*m.i18*m.i85 + 0.00514234*
m.i18*m.i86 + 0.00350408*m.i18*m.i87 - 0.00202898*m.i18*m.i88 + 0.001751682*m.i18*m.i89 +
0.0065019*m.i18*m.i90 + 0.007451*m.i18*m.i91 + 0.0035437*m.i18*m.i92 + 0.001995674*m.i18*m.i93 +
0.00436006*m.i18*m.i94 + 0.00715274*m.i18*m.i95 + 0.00776482*m.i18*m.i96 + 0.00710082*m.i18*m.i97
+ 0.00609606*m.i18*m.i98 + 0.00652362*m.i18*m.i99 + 0.01247386*m.i18*m.i100 + 0.01204848*m.i19*
m.i20 + 0.00628788*m.i19*m.i21 + 0.00938206*m.i19*m.i22 + 0.00540152*m.i19*m.i23 + 0.00366816*
m.i19*m.i24 + 0.00424804*m.i19*m.i25 + 0.00443146*m.i19*m.i26 + 0.00550836*m.i19*m.i27 +
0.00441186*m.i19*m.i28 + 0.00464964*m.i19*m.i29 + 0.0215394*m.i19*m.i30 + 0.00534434*m.i19*m.i31
+ 0.01089826*m.i19*m.i32 + 0.00384858*m.i19*m.i33 + 0.00271286*m.i19*m.i34 + 0.00459438*m.i19*
m.i35 + 0.00753494*m.i19*m.i36 + 0.00675858*m.i19*m.i37 + 0.00330138*m.i19*m.i38 + 0.01012594*
m.i19*m.i39 + 0.00097236*m.i19*m.i40 + 0.00697634*m.i19*m.i41 + 0.0055734*m.i19*m.i42 +
0.00439042*m.i19*m.i43 + 0.00466626*m.i19*m.i44 + 0.0056599*m.i19*m.i45 + 0.00343664*m.i19*m.i46
+ 0.00191227*m.i19*m.i47 + 0.00409474*m.i19*m.i48 + 0.00728426*m.i19*m.i49 + 0.0118005*m.i19*
m.i50 + 0.00439032*m.i19*m.i51 + 0.00819602*m.i19*m.i52 + 0.00683532*m.i19*m.i53 + 0.00927236*
m.i19*m.i54 + 0.00638082*m.i19*m.i55 + 0.0049778*m.i19*m.i56 + 0.0064092*m.i19*m.i57 + 0.00332368
*m.i19*m.i58 + 0.00797006*m.i19*m.i59 + 0.00515114*m.i19*m.i60 + 0.0140857*m.i19*m.i61 +
0.00824548*m.i19*m.i62 + 0.00645382*m.i19*m.i63 + 0.00492056*m.i19*m.i64 + 0.0040063*m.i19*m.i65
+ 0.00621702*m.i19*m.i66 + 0.00486474*m.i19*m.i67 + 0.01089728*m.i19*m.i68 + 0.01064856*m.i19*
m.i69 + 0.00763898*m.i19*m.i70 + 0.00304924*m.i19*m.i71 + 0.00746516*m.i19*m.i72 + 0.0073895*
m.i19*m.i73 + 0.008372*m.i19*m.i74 + 0.0096269*m.i19*m.i75 + 0.00403824*m.i19*m.i76 + 0.00896868*
m.i19*m.i77 + 0.00369816*m.i19*m.i78 + 0.01338638*m.i19*m.i79 + 0.00702566*m.i19*m.i80 +
0.00204776*m.i19*m.i81 + 0.0040369*m.i19*m.i82 - 0.00617474*m.i19*m.i83 + 0.00664876*m.i19*m.i84
+ 0.00640014*m.i19*m.i85 + 0.00537574*m.i19*m.i86 + 0.00744762*m.i19*m.i87 + 0.0288232*m.i19*
m.i88 + 0.0089059*m.i19*m.i89 + 0.00438344*m.i19*m.i90 + 0.01192674*m.i19*m.i91 + 0.00326376*
m.i19*m.i92 + 0.00330764*m.i19*m.i93 + 0.00649262*m.i19*m.i94 + 0.0076392*m.i19*m.i95 +
0.01075072*m.i19*m.i96 + 0.00749846*m.i19*m.i97 + 0.00563188*m.i19*m.i98 + 0.00430788*m.i19*m.i99
+ 0.00505074*m.i19*m.i100 + 0.026993*m.i20*m.i21 + 0.0407142*m.i20*m.i22 + 0.0262048*m.i20*m.i23
+ 0.0233804*m.i20*m.i24 + 0.01566388*m.i20*m.i25 + 0.01254316*m.i20*m.i26 + 0.0230746*m.i20*
m.i27 + 0.01228074*m.i20*m.i28 + 0.01141404*m.i20*m.i29 + 0.046979*m.i20*m.i30 + 0.01956928*m.i20
*m.i31 + 0.0444886*m.i20*m.i32 + 0.0345924*m.i20*m.i33 + 0.01450852*m.i20*m.i34 + 0.01607032*
m.i20*m.i35 + 0.0534276*m.i20*m.i36 + 0.027915*m.i20*m.i37 + 0.00446976*m.i20*m.i38 + 0.0310128*
m.i20*m.i39 + 0.0617194*m.i20*m.i40 + 0.0418284*m.i20*m.i41 + 0.0284554*m.i20*m.i42 + 0.0202322*
m.i20*m.i43 + 0.0309222*m.i20*m.i44 + 0.00850138*m.i20*m.i45 + 0.01226594*m.i20*m.i46 + 0.0355744
*m.i20*m.i47 + 0.01044628*m.i20*m.i48 + 0.0261968*m.i20*m.i49 + 0.0353182*m.i20*m.i50 +
0.01768812*m.i20*m.i51 + 0.0227266*m.i20*m.i52 + 0.0229416*m.i20*m.i53 + 0.0285392*m.i20*m.i54 +
0.024215*m.i20*m.i55 + 0.0227*m.i20*m.i56 + 0.01349126*m.i20*m.i57 + 0.01576804*m.i20*m.i58 +
0.0251472*m.i20*m.i59 + 0.00678918*m.i20*m.i60 + 0.0460104*m.i20*m.i61 + 0.0362612*m.i20*m.i62 +
0.0246576*m.i20*m.i63 + 0.01897386*m.i20*m.i64 + 0.021042*m.i20*m.i65 + 0.01449872*m.i20*m.i66 +
0.01901978*m.i20*m.i67 + 0.01289314*m.i20*m.i68 + 0.04318*m.i20*m.i69 + 0.0192612*m.i20*m.i70 +
0.0319956*m.i20*m.i71 + 0.0241418*m.i20*m.i72 + 0.0231068*m.i20*m.i73 + 0.0232748*m.i20*m.i74 +
0.01394672*m.i20*m.i75 + 0.01233534*m.i20*m.i76 + 0.0250086*m.i20*m.i77 + 0.01003866*m.i20*m.i78
+ 0.01782134*m.i20*m.i79 + 0.0175231*m.i20*m.i80 + 0.0266842*m.i20*m.i81 + 0.00899148*m.i20*
m.i82 + 0.01916166*m.i20*m.i83 + 0.0237898*m.i20*m.i84 + 0.01674726*m.i20*m.i85 + 0.0243836*m.i20
*m.i86 + 0.0205712*m.i20*m.i87 + 0.0526016*m.i20*m.i88 + 0.01299922*m.i20*m.i89 + 0.0223216*m.i20
*m.i90 + 0.0221722*m.i20*m.i91 + 0.0200512*m.i20*m.i92 + 0.00605128*m.i20*m.i93 + 0.01422172*
m.i20*m.i94 + 0.0209666*m.i20*m.i95 + 0.0316224*m.i20*m.i96 + 0.0278754*m.i20*m.i97 + 0.0266692*
m.i20*m.i98 + 0.032317*m.i20*m.i99 + 0.0372718*m.i20*m.i100 + 0.0225584*m.i21*m.i22 + 0.01330824*
m.i21*m.i23 + 0.01120138*m.i21*m.i24 + 0.00988644*m.i21*m.i25 + 0.0053562*m.i21*m.i26 +
0.01171726*m.i21*m.i27 + 0.0075308*m.i21*m.i28 + 0.0062293*m.i21*m.i29 + 0.028151*m.i21*m.i30 +
0.01116532*m.i21*m.i31 + 0.024731*m.i21*m.i32 + 0.01403094*m.i21*m.i33 + 0.0053378*m.i21*m.i34 +
0.0062169*m.i21*m.i35 + 0.0322338*m.i21*m.i36 + 0.0173092*m.i21*m.i37 + 0.00310282*m.i21*m.i38 +
0.01943686*m.i21*m.i39 + 0.0397312*m.i21*m.i40 + 0.0227668*m.i21*m.i41 + 0.01402322*m.i21*m.i42
+ 0.01184862*m.i21*m.i43 + 0.01574106*m.i21*m.i44 + 0.00351088*m.i21*m.i45 + 0.00692094*m.i21*
m.i46 + 0.01710158*m.i21*m.i47 + 0.00581758*m.i21*m.i48 + 0.013985*m.i21*m.i49 + 0.0205976*m.i21*
m.i50 + 0.01286968*m.i21*m.i51 + 0.01222018*m.i21*m.i52 + 0.01492284*m.i21*m.i53 + 0.01502328*
m.i21*m.i54 + 0.01279528*m.i21*m.i55 + 0.01443928*m.i21*m.i56 + 0.00711002*m.i21*m.i57 +
0.00897148*m.i21*m.i58 + 0.0175601*m.i21*m.i59 + 0.00366562*m.i21*m.i60 + 0.0240206*m.i21*m.i61
+ 0.01871124*m.i21*m.i62 + 0.01471548*m.i21*m.i63 + 0.00910326*m.i21*m.i64 + 0.01121548*m.i21*
m.i65 + 0.0093615*m.i21*m.i66 + 0.0129081*m.i21*m.i67 + 0.0055548*m.i21*m.i68 + 0.0214638*m.i21*
m.i69 + 0.00932128*m.i21*m.i70 + 0.01654162*m.i21*m.i71 + 0.01150414*m.i21*m.i72 + 0.01130758*
m.i21*m.i73 + 0.01195864*m.i21*m.i74 + 0.00685764*m.i21*m.i75 + 0.00673976*m.i21*m.i76 +
0.01092518*m.i21*m.i77 + 0.00610126*m.i21*m.i78 + 0.0166491*m.i21*m.i79 + 0.00973956*m.i21*m.i80
+ 0.01360816*m.i21*m.i81 + 0.00413938*m.i21*m.i82 + 0.01295166*m.i21*m.i83 + 0.01359658*m.i21*
m.i84 + 0.0100056*m.i21*m.i85 + 0.01591198*m.i21*m.i86 + 0.01302584*m.i21*m.i87 + 0.0321888*m.i21
*m.i88 + 0.0069057*m.i21*m.i89 + 0.01467542*m.i21*m.i90 + 0.0104985*m.i21*m.i91 + 0.01203108*
m.i21*m.i92 + 0.00438602*m.i21*m.i93 + 0.0064228*m.i21*m.i94 + 0.0109577*m.i21*m.i95 + 0.01683074
*m.i21*m.i96 + 0.01510662*m.i21*m.i97 + 0.013665*m.i21*m.i98 + 0.01994166*m.i21*m.i99 + 0.0184821
*m.i21*m.i100 + 0.01713984*m.i22*m.i23 + 0.0290628*m.i22*m.i24 + 0.01659484*m.i22*m.i25 +
0.01330504*m.i22*m.i26 + 0.0220338*m.i22*m.i27 + 0.0096401*m.i22*m.i28 + 0.01336178*m.i22*m.i29
+ 0.0794522*m.i22*m.i30 + 0.00912184*m.i22*m.i31 + 0.0466568*m.i22*m.i32 + 0.0203942*m.i22*m.i33
+ 0.00695226*m.i22*m.i34 + 0.0125215*m.i22*m.i35 + 0.0728992*m.i22*m.i36 + 0.0354588*m.i22*m.i37
+ 0.00691112*m.i22*m.i38 + 0.037201*m.i22*m.i39 + 0.0756082*m.i22*m.i40 + 0.0292772*m.i22*m.i41
+ 0.0266054*m.i22*m.i42 + 0.01269282*m.i22*m.i43 + 0.0230306*m.i22*m.i44 + 0.000804368*m.i22*
m.i45 + 0.01545384*m.i22*m.i46 + 0.0296748*m.i22*m.i47 + 0.0193381*m.i22*m.i48 + 0.0200644*m.i22*
m.i49 + 0.0450946*m.i22*m.i50 + 0.01567104*m.i22*m.i51 + 0.0202574*m.i22*m.i52 + 0.0456018*m.i22*
m.i53 + 0.024727*m.i22*m.i54 + 0.01871804*m.i22*m.i55 + 0.01574656*m.i22*m.i56 + 0.01426746*m.i22
*m.i57 + 0.0112117*m.i22*m.i58 + 0.0237092*m.i22*m.i59 + 0.01100176*m.i22*m.i60 + 0.0484136*m.i22
*m.i61 + 0.0477626*m.i22*m.i62 + 0.01715072*m.i22*m.i63 + 0.01569402*m.i22*m.i64 + 0.0163363*
m.i22*m.i65 + 0.00819194*m.i22*m.i66 + 0.0250362*m.i22*m.i67 + 0.01191736*m.i22*m.i68 + 0.0445474
*m.i22*m.i69 + 0.0208408*m.i22*m.i70 + 0.0196514*m.i22*m.i71 + 0.01993902*m.i22*m.i72 +
0.01317816*m.i22*m.i73 + 0.0290184*m.i22*m.i74 + 0.022028*m.i22*m.i75 + 0.01241074*m.i22*m.i76 +
0.01467528*m.i22*m.i77 + 0.0179883*m.i22*m.i78 + 0.040464*m.i22*m.i79 + 0.01646476*m.i22*m.i80 +
0.0251454*m.i22*m.i81 + 0.00665554*m.i22*m.i82 - 0.00094782*m.i22*m.i83 + 0.01809638*m.i22*m.i84
+ 0.01658492*m.i22*m.i85 + 0.0242392*m.i22*m.i86 + 0.0215874*m.i22*m.i87 + 0.0229098*m.i22*m.i88
+ 0.01114584*m.i22*m.i89 + 0.046945*m.i22*m.i90 + 0.0230318*m.i22*m.i91 + 0.01381346*m.i22*m.i92
+ 0.0100301*m.i22*m.i93 + 0.00837496*m.i22*m.i94 + 0.0250054*m.i22*m.i95 + 0.0620424*m.i22*m.i96
+ 0.0302296*m.i22*m.i97 + 0.0248336*m.i22*m.i98 + 0.0372288*m.i22*m.i99 + 0.0441042*m.i22*m.i100
+ 0.00618108*m.i23*m.i24 + 0.00567144*m.i23*m.i25 + 0.0048866*m.i23*m.i26 + 0.00839514*m.i23*
m.i27 + 0.00487436*m.i23*m.i28 + 0.004356*m.i23*m.i29 + 0.024299*m.i23*m.i30 + 0.00996842*m.i23*
m.i31 + 0.0204928*m.i23*m.i32 + 0.01726232*m.i23*m.i33 + 0.00564344*m.i23*m.i34 + 0.00506272*
m.i23*m.i35 + 0.027322*m.i23*m.i36 + 0.01648718*m.i23*m.i37 + 0.001813512*m.i23*m.i38 + 0.0143408
*m.i23*m.i39 + 0.0410642*m.i23*m.i40 + 0.00822668*m.i23*m.i41 + 0.01397884*m.i23*m.i42 +
0.00751294*m.i23*m.i43 + 0.01081252*m.i23*m.i44 + 0.00375058*m.i23*m.i45 + 0.00488444*m.i23*m.i46
+ 0.01210078*m.i23*m.i47 + 0.0050334*m.i23*m.i48 + 0.01042672*m.i23*m.i49 + 0.01834872*m.i23*
m.i50 + 0.0122672*m.i23*m.i51 + 0.01291522*m.i23*m.i52 + 0.01243908*m.i23*m.i53 + 0.01372984*
m.i23*m.i54 + 0.0114482*m.i23*m.i55 + 0.0105593*m.i23*m.i56 + 0.00644542*m.i23*m.i57 + 0.00648944
*m.i23*m.i58 + 0.01543002*m.i23*m.i59 + 0.0037869*m.i23*m.i60 + 0.0214726*m.i23*m.i61 +
0.01495998*m.i23*m.i62 + 0.00692592*m.i23*m.i63 + 0.00648514*m.i23*m.i64 + 0.00794602*m.i23*m.i65
+ 0.00558232*m.i23*m.i66 + 0.0093087*m.i23*m.i67 + 0.000819996*m.i23*m.i68 + 0.01512186*m.i23*
m.i69 + 0.0070338*m.i23*m.i70 + 0.00840292*m.i23*m.i71 + 0.00668858*m.i23*m.i72 + 0.00956292*
m.i23*m.i73 + 0.00972254*m.i23*m.i74 + 0.00409738*m.i23*m.i75 + 0.00544566*m.i23*m.i76 +
0.01207296*m.i23*m.i77 + 0.00561846*m.i23*m.i78 + 0.01639358*m.i23*m.i79 + 0.00769632*m.i23*m.i80
+ 0.01062502*m.i23*m.i81 + 0.0060578*m.i23*m.i82 + 0.00866906*m.i23*m.i83 + 0.00707332*m.i23*
m.i84 + 0.01006612*m.i23*m.i85 + 0.01147664*m.i23*m.i86 + 0.0127172*m.i23*m.i87 + 0.01718458*
m.i23*m.i88 + 0.00499896*m.i23*m.i89 + 0.01300446*m.i23*m.i90 + 0.00824348*m.i23*m.i91 +
0.01100222*m.i23*m.i92 + 0.00359882*m.i23*m.i93 + 0.00760194*m.i23*m.i94 + 0.01026304*m.i23*m.i95
+ 0.01748628*m.i23*m.i96 + 0.01222018*m.i23*m.i97 + 0.00656104*m.i23*m.i98 + 0.01929844*m.i23*
m.i99 + 0.01526792*m.i23*m.i100 + 0.01061256*m.i24*m.i25 + 0.00390748*m.i24*m.i26 + 0.0176534*
m.i24*m.i27 + 0.00973526*m.i24*m.i28 + 0.00580416*m.i24*m.i29 + 0.0308904*m.i24*m.i30 +
0.00564094*m.i24*m.i31 + 0.0202996*m.i24*m.i32 + 0.00846578*m.i24*m.i33 + 0.00878324*m.i24*m.i34
+ 0.0092725*m.i24*m.i35 + 0.0386418*m.i24*m.i36 + 0.01405906*m.i24*m.i37 + 0.0050169*m.i24*m.i38
+ 0.01753958*m.i24*m.i39 + 0.0277342*m.i24*m.i40 + 0.0200538*m.i24*m.i41 + 0.0160148*m.i24*m.i42
+ 0.01157484*m.i24*m.i43 + 0.0097945*m.i24*m.i44 + 0.00047637*m.i24*m.i45 + 0.0074696*m.i24*
m.i46 + 0.0232922*m.i24*m.i47 + 0.0064693*m.i24*m.i48 + 0.0076863*m.i24*m.i49 + 0.01970906*m.i24*
m.i50 + 0.00539232*m.i24*m.i51 + 0.01285448*m.i24*m.i52 + 0.0120141*m.i24*m.i53 + 0.0124346*m.i24
*m.i54 + 0.00898946*m.i24*m.i55 + 0.00726448*m.i24*m.i56 + 0.0065436*m.i24*m.i57 + 0.00501008*
m.i24*m.i58 + 0.01101314*m.i24*m.i59 + 0.00470396*m.i24*m.i60 + 0.0237074*m.i24*m.i61 + 0.0228986
*m.i24*m.i62 + 0.01228188*m.i24*m.i63 + 0.01100376*m.i24*m.i64 + 0.00915078*m.i24*m.i65 +
0.0069269*m.i24*m.i66 + 0.01206108*m.i24*m.i67 + 0.00908652*m.i24*m.i68 + 0.0217466*m.i24*m.i69
+ 0.00887002*m.i24*m.i70 + 0.022452*m.i24*m.i71 + 0.0139555*m.i24*m.i72 + 0.00715706*m.i24*m.i73
+ 0.01096546*m.i24*m.i74 + 0.00744888*m.i24*m.i75 + 0.0028668*m.i24*m.i76 + 0.0036177*m.i24*
m.i77 + 0.00580328*m.i24*m.i78 + 0.0086669*m.i24*m.i79 + 0.00929752*m.i24*m.i80 + 0.01854944*
m.i24*m.i81 + 0.0023229*m.i24*m.i82 + 0.01207648*m.i24*m.i83 + 0.01205652*m.i24*m.i84 + 0.0096674
*m.i24*m.i85 + 0.0108503*m.i24*m.i86 + 0.00597266*m.i24*m.i87 + 0.0190243*m.i24*m.i88 +
0.00640978*m.i24*m.i89 + 0.01034642*m.i24*m.i90 + 0.01193214*m.i24*m.i91 + 0.00822214*m.i24*m.i92
+ 0.00070224*m.i24*m.i93 + 0.00307244*m.i24*m.i94 + 0.01092084*m.i24*m.i95 + 0.0203774*m.i24*
m.i96 + 0.01743418*m.i24*m.i97 + 0.0232524*m.i24*m.i98 + 0.01437366*m.i24*m.i99 + 0.01998814*
m.i24*m.i100 + 0.00270846*m.i25*m.i26 + 0.00878244*m.i25*m.i27 + 0.00564506*m.i25*m.i28 +
0.00404084*m.i25*m.i29 + 0.0227806*m.i25*m.i30 + 0.00477484*m.i25*m.i31 + 0.016725*m.i25*m.i32 +
0.00496432*m.i25*m.i33 + 0.00361518*m.i25*m.i34 + 0.00462338*m.i25*m.i35 + 0.0204146*m.i25*m.i36
+ 0.01087624*m.i25*m.i37 + 0.00256388*m.i25*m.i38 + 0.01236456*m.i25*m.i39 + 0.01769162*m.i25*
m.i40 + 0.01576792*m.i25*m.i41 + 0.00928236*m.i25*m.i42 + 0.00793946*m.i25*m.i43 + 0.00966756*
m.i25*m.i44 + 0.00248138*m.i25*m.i45 + 0.00485932*m.i25*m.i46 + 0.0122764*m.i25*m.i47 + 0.0023089
*m.i25*m.i48 + 0.00859364*m.i25*m.i49 + 0.01421118*m.i25*m.i50 + 0.00733214*m.i25*m.i51 +
0.00816206*m.i25*m.i52 + 0.00960248*m.i25*m.i53 + 0.00866518*m.i25*m.i54 + 0.00692386*m.i25*m.i55
+ 0.00882586*m.i25*m.i56 + 0.00434948*m.i25*m.i57 + 0.0041589*m.i25*m.i58 + 0.01055232*m.i25*
m.i59 + 0.00330494*m.i25*m.i60 + 0.01561392*m.i25*m.i61 + 0.0126551*m.i25*m.i62 + 0.00815092*
m.i25*m.i63 + 0.00612506*m.i25*m.i64 + 0.0070869*m.i25*m.i65 + 0.00424002*m.i25*m.i66 +
0.00879504*m.i25*m.i67 + 0.0058829*m.i25*m.i68 + 0.01439048*m.i25*m.i69 + 0.00610238*m.i25*m.i70
+ 0.01131906*m.i25*m.i71 + 0.00889538*m.i25*m.i72 + 0.00612414*m.i25*m.i73 + 0.00846104*m.i25*
m.i74 + 0.0057198*m.i25*m.i75 + 0.00393476*m.i25*m.i76 + 0.00432972*m.i25*m.i77 + 0.00446968*
m.i25*m.i78 + 0.0141591*m.i25*m.i79 + 0.00681524*m.i25*m.i80 + 0.00839778*m.i25*m.i81 +
0.00242412*m.i25*m.i82 + 0.0061299*m.i25*m.i83 + 0.00821362*m.i25*m.i84 + 0.0059951*m.i25*m.i85
+ 0.01036166*m.i25*m.i86 + 0.0075501*m.i25*m.i87 + 0.0208316*m.i25*m.i88 + 0.00461656*m.i25*
m.i89 + 0.01024232*m.i25*m.i90 + 0.00541446*m.i25*m.i91 + 0.0058998*m.i25*m.i92 + 0.00419408*
m.i25*m.i93 + 0.0034525*m.i25*m.i94 + 0.00742618*m.i25*m.i95 + 0.01117296*m.i25*m.i96 +
0.00976304*m.i25*m.i97 + 0.01005714*m.i25*m.i98 + 0.00997578*m.i25*m.i99 + 0.01119052*m.i25*
m.i100 + 0.0054348*m.i26*m.i27 + 0.00158545*m.i26*m.i28 + 0.00507804*m.i26*m.i29 + 0.01115184*
m.i26*m.i30 + 0.00280118*m.i26*m.i31 + 0.0103351*m.i26*m.i32 + 0.00796856*m.i26*m.i33 +
0.00322344*m.i26*m.i34 + 0.00410686*m.i26*m.i35 + 0.00922294*m.i26*m.i36 + 0.00708292*m.i26*m.i37
+ 0.00218796*m.i26*m.i38 + 0.00667316*m.i26*m.i39 + 0.00604564*m.i26*m.i40 + 0.00774532*m.i26*
m.i41 + 0.00814596*m.i26*m.i42 + 0.0026451*m.i26*m.i43 + 0.00582206*m.i26*m.i44 + 0.00332382*
m.i26*m.i45 + 0.00451686*m.i26*m.i46 + 0.00733916*m.i26*m.i47 + 0.00476946*m.i26*m.i48 +
0.00485772*m.i26*m.i49 + 0.0100103*m.i26*m.i50 + 0.00280844*m.i26*m.i51 + 0.00687248*m.i26*m.i52
+ 0.00732458*m.i26*m.i53 + 0.00815206*m.i26*m.i54 + 0.00612236*m.i26*m.i55 + 0.00307146*m.i26*
m.i56 + 0.0049056*m.i26*m.i57 + 0.00412472*m.i26*m.i58 + 0.0040935*m.i26*m.i59 + 0.0040596*m.i26*
m.i60 + 0.01138906*m.i26*m.i61 + 0.00976836*m.i26*m.i62 + 0.0087752*m.i26*m.i63 + 0.00574374*
m.i26*m.i64 + 0.00539202*m.i26*m.i65 + 0.0020772*m.i26*m.i66 + 0.00535872*m.i26*m.i67 + 0.0041987
*m.i26*m.i68 + 0.00941624*m.i26*m.i69 + 0.00708368*m.i26*m.i70 + 0.00623148*m.i26*m.i71 +
0.0059506*m.i26*m.i72 + 0.00509138*m.i26*m.i73 + 0.00640786*m.i26*m.i74 + 0.00599214*m.i26*m.i75
+ 0.00535234*m.i26*m.i76 + 0.0061449*m.i26*m.i77 + 0.0049639*m.i26*m.i78 + 0.00212662*m.i26*
m.i79 + 0.00709762*m.i26*m.i80 + 0.00556936*m.i26*m.i81 + 0.0033022*m.i26*m.i82 - 0.0001706112*
m.i26*m.i83 + 0.0042184*m.i26*m.i84 + 0.00533878*m.i26*m.i85 + 0.00407216*m.i26*m.i86 + 0.0050287
*m.i26*m.i87 + 0.00492458*m.i26*m.i88 + 0.00236614*m.i26*m.i89 + 0.0069424*m.i26*m.i90 +
0.00767098*m.i26*m.i91 + 0.00534286*m.i26*m.i92 + 0.001624812*m.i26*m.i93 + 0.00309366*m.i26*
m.i94 + 0.00617648*m.i26*m.i95 + 0.01108742*m.i26*m.i96 + 0.0068572*m.i26*m.i97 + 0.00411952*
m.i26*m.i98 + 0.00653102*m.i26*m.i99 + 0.00944332*m.i26*m.i100 + 0.01236278*m.i27*m.i28 +
0.00615174*m.i27*m.i29 + 0.0284656*m.i27*m.i30 + 0.00531366*m.i27*m.i31 + 0.0227234*m.i27*m.i32
+ 0.01239532*m.i27*m.i33 + 0.00873604*m.i27*m.i34 + 0.01006162*m.i27*m.i35 + 0.0244272*m.i27*
m.i36 + 0.01206064*m.i27*m.i37 + 0.00764146*m.i27*m.i38 + 0.01638042*m.i27*m.i39 + 0.0281728*
m.i27*m.i40 + 0.0236864*m.i27*m.i41 + 0.01394576*m.i27*m.i42 + 0.01151236*m.i27*m.i43 +
0.00967762*m.i27*m.i44 + 0.0001345884*m.i27*m.i45 + 0.00656542*m.i27*m.i46 + 0.0226088*m.i27*
m.i47 + 0.00665866*m.i27*m.i48 + 0.00867994*m.i27*m.i49 + 0.01519986*m.i27*m.i50 + 0.00516678*
m.i27*m.i51 + 0.01290734*m.i27*m.i52 + 0.00750112*m.i27*m.i53 + 0.015481*m.i27*m.i54 + 0.00918208
*m.i27*m.i55 + 0.01133662*m.i27*m.i56 + 0.00655584*m.i27*m.i57 + 0.00645326*m.i27*m.i58 +
0.01022706*m.i27*m.i59 + 0.00655942*m.i27*m.i60 + 0.0230718*m.i27*m.i61 + 0.0200196*m.i27*m.i62
+ 0.01214952*m.i27*m.i63 + 0.00996324*m.i27*m.i64 + 0.00982212*m.i27*m.i65 + 0.00606814*m.i27*
m.i66 + 0.00854006*m.i27*m.i67 + 0.00819936*m.i27*m.i68 + 0.01608286*m.i27*m.i69 + 0.00821942*
m.i27*m.i70 + 0.0230626*m.i27*m.i71 + 0.01648106*m.i27*m.i72 + 0.00833058*m.i27*m.i73 + 0.0119455
*m.i27*m.i74 + 0.0073591*m.i27*m.i75 + 0.00553444*m.i27*m.i76 + 0.00629646*m.i27*m.i77 +
0.00406434*m.i27*m.i78 + 0.00760068*m.i27*m.i79 + 0.00662478*m.i27*m.i80 + 0.0198678*m.i27*m.i81
+ 0.0044671*m.i27*m.i82 + 0.01205228*m.i27*m.i83 + 0.0106948*m.i27*m.i84 + 0.00763694*m.i27*
m.i85 + 0.01122432*m.i27*m.i86 + 0.00899094*m.i27*m.i87 + 0.0237458*m.i27*m.i88 + 0.00548044*
m.i27*m.i89 + 0.01135562*m.i27*m.i90 + 0.01131762*m.i27*m.i91 + 0.00767916*m.i27*m.i92 +
0.00281062*m.i27*m.i93 + 0.00450634*m.i27*m.i94 + 0.01029564*m.i27*m.i95 + 0.01573164*m.i27*m.i96
+ 0.01494338*m.i27*m.i97 + 0.01900252*m.i27*m.i98 + 0.01470772*m.i27*m.i99 + 0.01866828*m.i27*
m.i100 + 0.00362518*m.i28*m.i29 + 0.01640256*m.i28*m.i30 + 0.00349192*m.i28*m.i31 + 0.0129237*
m.i28*m.i32 + 0.00538584*m.i28*m.i33 + 0.00533474*m.i28*m.i34 + 0.00643216*m.i28*m.i35 +
0.01292206*m.i28*m.i36 + 0.00798078*m.i28*m.i37 + 0.0054977*m.i28*m.i38 + 0.00885966*m.i28*m.i39
+ 0.016828*m.i28*m.i40 + 0.01167374*m.i28*m.i41 + 0.00549216*m.i28*m.i42 + 0.00692364*m.i28*
m.i43 + 0.00370672*m.i28*m.i44 + 0.000284348*m.i28*m.i45 + 0.00277668*m.i28*m.i46 + 0.00936392*
m.i28*m.i47 + 0.00267238*m.i28*m.i48 + 0.00522892*m.i28*m.i49 + 0.00779258*m.i28*m.i50 +
0.0043462*m.i28*m.i51 + 0.00591302*m.i28*m.i52 + 0.00320368*m.i28*m.i53 + 0.00698682*m.i28*m.i54
+ 0.00560018*m.i28*m.i55 + 0.0075828*m.i28*m.i56 + 0.00361162*m.i28*m.i57 + 0.00229658*m.i28*
m.i58 + 0.00780328*m.i28*m.i59 + 0.0033416*m.i28*m.i60 + 0.01168298*m.i28*m.i61 + 0.0082366*m.i28
*m.i62 + 0.00465746*m.i28*m.i63 + 0.00328332*m.i28*m.i64 + 0.00685966*m.i28*m.i65 + 0.00386632*
m.i28*m.i66 + 0.0053142*m.i28*m.i67 + 0.00432904*m.i28*m.i68 + 0.00791276*m.i28*m.i69 + 0.0040137
*m.i28*m.i70 + 0.01081358*m.i28*m.i71 + 0.00841874*m.i28*m.i72 + 0.00534694*m.i28*m.i73 +
0.00677544*m.i28*m.i74 + 0.00391198*m.i28*m.i75 + 0.00308942*m.i28*m.i76 + 0.00250778*m.i28*m.i77
+ 0.00189916*m.i28*m.i78 + 0.00856184*m.i28*m.i79 + 0.00337182*m.i28*m.i80 + 0.00959416*m.i28*
m.i81 + 0.00329038*m.i28*m.i82 + 0.00388664*m.i28*m.i83 + 0.00685968*m.i28*m.i84 + 0.00406002*
m.i28*m.i85 + 0.00658126*m.i28*m.i86 + 0.00646838*m.i28*m.i87 + 0.0218548*m.i28*m.i88 +
0.00541992*m.i28*m.i89 + 0.00503116*m.i28*m.i90 + 0.00418236*m.i28*m.i91 + 0.0040874*m.i28*m.i92
+ 0.0022624*m.i28*m.i93 + 0.00392254*m.i28*m.i94 + 0.00482686*m.i28*m.i95 + 0.00726382*m.i28*
m.i96 + 0.00767472*m.i28*m.i97 + 0.01066418*m.i28*m.i98 + 0.00883358*m.i28*m.i99 + 0.0070211*
m.i28*m.i100 + 0.0147917*m.i29*m.i30 + 0.001068816*m.i29*m.i31 + 0.0105712*m.i29*m.i32 +
0.00407766*m.i29*m.i33 + 0.00300076*m.i29*m.i34 + 0.00524794*m.i29*m.i35 + 0.01016322*m.i29*m.i36
+ 0.00841674*m.i29*m.i37 + 0.00258632*m.i29*m.i38 + 0.00698836*m.i29*m.i39 + 0.01223674*m.i29*
m.i40 + 0.01128912*m.i29*m.i41 + 0.00481604*m.i29*m.i42 + 0.00316394*m.i29*m.i43 + 0.00690116*
m.i29*m.i44 + 0.00082418*m.i29*m.i45 + 0.00343988*m.i29*m.i46 + 0.00660586*m.i29*m.i47 +
0.00315994*m.i29*m.i48 + 0.004109*m.i29*m.i49 + 0.01072766*m.i29*m.i50 + 0.00295018*m.i29*m.i51
+ 0.00574084*m.i29*m.i52 + 0.00735384*m.i29*m.i53 + 0.00646518*m.i29*m.i54 + 0.00437712*m.i29*
m.i55 + 0.0050201*m.i29*m.i56 + 0.00428602*m.i29*m.i57 + 0.00339284*m.i29*m.i58 + 0.00395186*
m.i29*m.i59 + 0.00369852*m.i29*m.i60 + 0.01069104*m.i29*m.i61 + 0.00877524*m.i29*m.i62 +
0.00780122*m.i29*m.i63 + 0.00319846*m.i29*m.i64 + 0.00522668*m.i29*m.i65 + 0.00318906*m.i29*m.i66
+ 0.00765554*m.i29*m.i67 + 0.00353436*m.i29*m.i68 + 0.0090668*m.i29*m.i69 + 0.0062235*m.i29*
m.i70 + 0.00879038*m.i29*m.i71 + 0.00661754*m.i29*m.i72 + 0.00355728*m.i29*m.i73 + 0.0041974*
m.i29*m.i74 + 0.00530048*m.i29*m.i75 + 0.00543652*m.i29*m.i76 + 0.00436164*m.i29*m.i77 +
0.00450742*m.i29*m.i78 + 0.00725294*m.i29*m.i79 + 0.00491692*m.i29*m.i80 + 0.00689594*m.i29*m.i81
+ 0.00288614*m.i29*m.i82 + 0.005327*m.i29*m.i83 + 0.00356482*m.i29*m.i84 + 0.00320232*m.i29*
m.i85 + 0.00401206*m.i29*m.i86 + 0.00746968*m.i29*m.i87 + 0.01484586*m.i29*m.i88 + 0.00405332*
m.i29*m.i89 + 0.00646554*m.i29*m.i90 + 0.00398186*m.i29*m.i91 + 0.0045419*m.i29*m.i92 +
0.00249602*m.i29*m.i93 + 0.00344506*m.i29*m.i94 + 0.0046313*m.i29*m.i95 + 0.01012898*m.i29*m.i96
+ 0.00666118*m.i29*m.i97 + 0.00510452*m.i29*m.i98 + 0.00865974*m.i29*m.i99 + 0.00556162*m.i29*
m.i100 + 0.01432038*m.i30*m.i31 + 0.048762*m.i30*m.i32 + 0.03246*m.i30*m.i33 + 0.00510162*m.i30*
m.i34 + 0.00990812*m.i30*m.i35 + 0.0782504*m.i30*m.i36 + 0.0336068*m.i30*m.i37 + 0.00740496*m.i30
*m.i38 + 0.0520556*m.i30*m.i39 + 0.0689666*m.i30*m.i40 + 0.0338084*m.i30*m.i41 + 0.0303886*m.i30*
m.i42 + 0.01530392*m.i30*m.i43 + 0.0286584*m.i30*m.i44 + 0.001838718*m.i30*m.i45 + 0.01735792*
m.i30*m.i46 + 0.0257124*m.i30*m.i47 + 0.01952576*m.i30*m.i48 + 0.0285968*m.i30*m.i49 + 0.0597966*
m.i30*m.i50 + 0.0235442*m.i30*m.i51 + 0.0356002*m.i30*m.i52 + 0.056815*m.i30*m.i53 + 0.031993*
m.i30*m.i54 + 0.0256864*m.i30*m.i55 + 0.012682*m.i30*m.i56 + 0.01927838*m.i30*m.i57 + 0.0132181*
m.i30*m.i58 + 0.0308396*m.i30*m.i59 + 0.01646776*m.i30*m.i60 + 0.0691402*m.i30*m.i61 + 0.0539688*
m.i30*m.i62 + 0.0253122*m.i30*m.i63 + 0.0217306*m.i30*m.i64 + 0.0238236*m.i30*m.i65 + 0.01199066*
m.i30*m.i66 + 0.0301278*m.i30*m.i67 + 0.0209952*m.i30*m.i68 + 0.0484514*m.i30*m.i69 + 0.0226726*
m.i30*m.i70 + 0.02153*m.i30*m.i71 + 0.023498*m.i30*m.i72 + 0.0217474*m.i30*m.i73 + 0.0363548*
m.i30*m.i74 + 0.0290864*m.i30*m.i75 + 0.01738014*m.i30*m.i76 + 0.0248066*m.i30*m.i77 + 0.01560782
*m.i30*m.i78 + 0.0735134*m.i30*m.i79 + 0.0216582*m.i30*m.i80 + 0.030706*m.i30*m.i81 + 0.00888388*
m.i30*m.i82 + 0.00819988*m.i30*m.i83 + 0.02421*m.i30*m.i84 + 0.01903928*m.i30*m.i85 + 0.0384208*
m.i30*m.i86 + 0.0308632*m.i30*m.i87 + 0.112101*m.i30*m.i88 + 0.0313082*m.i30*m.i89 + 0.0480838*
m.i30*m.i90 + 0.0265036*m.i30*m.i91 + 0.0219052*m.i30*m.i92 + 0.01243318*m.i30*m.i93 + 0.00866336
*m.i30*m.i94 + 0.0318698*m.i30*m.i95 + 0.0809696*m.i30*m.i96 + 0.0362056*m.i30*m.i97 + 0.0307602*
m.i30*m.i98 + 0.0452826*m.i30*m.i99 + 0.0359652*m.i30*m.i100 + 0.01352968*m.i31*m.i32 +
0.01461656*m.i31*m.i33 + 0.00410226*m.i31*m.i34 + 0.00308616*m.i31*m.i35 + 0.0221942*m.i31*m.i36
+ 0.0095014*m.i31*m.i37 + 0.0001894118*m.i31*m.i38 + 0.01328104*m.i31*m.i39 + 0.0207254*m.i31*
m.i40 + 0.01363894*m.i31*m.i41 + 0.01129202*m.i31*m.i42 + 0.0108266*m.i31*m.i43 + 0.01097008*
m.i31*m.i44 + 0.00461712*m.i31*m.i45 + 0.00463752*m.i31*m.i46 + 0.00929264*m.i31*m.i47 +
0.00473752*m.i31*m.i48 + 0.0114599*m.i31*m.i49 + 0.0117742*m.i31*m.i50 + 0.0088573*m.i31*m.i51 +
0.0075837*m.i31*m.i52 + 0.00658756*m.i31*m.i53 + 0.0113218*m.i31*m.i54 + 0.00930362*m.i31*m.i55
+ 0.01063604*m.i31*m.i56 + 0.00432704*m.i31*m.i57 + 0.00804616*m.i31*m.i58 + 0.01180986*m.i31*
m.i59 + 0.0009047*m.i31*m.i60 + 0.01200762*m.i31*m.i61 + 0.00940268*m.i31*m.i62 + 0.01417994*
m.i31*m.i63 + 0.0076164*m.i31*m.i64 + 0.00575322*m.i31*m.i65 + 0.00834872*m.i31*m.i66 +
0.00454676*m.i31*m.i67 + 0.00544346*m.i31*m.i68 + 0.0132866*m.i31*m.i69 + 0.00553084*m.i31*m.i70
+ 0.01147094*m.i31*m.i71 + 0.00577578*m.i31*m.i72 + 0.00887008*m.i31*m.i73 + 0.01059428*m.i31*
m.i74 + 0.0040723*m.i31*m.i75 + 0.00207936*m.i31*m.i76 + 0.01175316*m.i31*m.i77 + 0.00278464*
m.i31*m.i78 + 0.00880162*m.i31*m.i79 + 0.0087823*m.i31*m.i80 + 0.00669872*m.i31*m.i81 +
0.001695732*m.i31*m.i82 + 0.01128974*m.i31*m.i83 + 0.0131319*m.i31*m.i84 + 0.00861518*m.i31*m.i85
+ 0.01080682*m.i31*m.i86 + 0.00523332*m.i31*m.i87 + 0.0207656*m.i31*m.i88 + 0.00591302*m.i31*
m.i89 + 0.00439716*m.i31*m.i90 + 0.0115743*m.i31*m.i91 + 0.00995262*m.i31*m.i92 + 0.000428388*
m.i31*m.i93 + 0.00464012*m.i31*m.i94 + 0.00813868*m.i31*m.i95 + 0.00570582*m.i31*m.i96 +
0.00954936*m.i31*m.i97 + 0.01038358*m.i31*m.i98 + 0.00920842*m.i31*m.i99 + 0.01146966*m.i31*
m.i100 + 0.0209668*m.i32*m.i33 + 0.0108011*m.i32*m.i34 + 0.01248282*m.i32*m.i35 + 0.0530038*m.i32
*m.i36 + 0.0301486*m.i32*m.i37 + 0.00760388*m.i32*m.i38 + 0.0317898*m.i32*m.i39 + 0.0642986*m.i32
*m.i40 + 0.0332684*m.i32*m.i41 + 0.0235182*m.i32*m.i42 + 0.0143552*m.i32*m.i43 + 0.0235288*m.i32*
m.i44 + 0.00682838*m.i32*m.i45 + 0.01137478*m.i32*m.i46 + 0.0318282*m.i32*m.i47 + 0.00984204*
m.i32*m.i48 + 0.0207836*m.i32*m.i49 + 0.0371082*m.i32*m.i50 + 0.01715818*m.i32*m.i51 + 0.0184894*
m.i32*m.i52 + 0.0241264*m.i32*m.i53 + 0.0254814*m.i32*m.i54 + 0.01913224*m.i32*m.i55 + 0.0212986*
m.i32*m.i56 + 0.01167336*m.i32*m.i57 + 0.01191892*m.i32*m.i58 + 0.0246844*m.i32*m.i59 +
0.00772776*m.i32*m.i60 + 0.0424102*m.i32*m.i61 + 0.0330624*m.i32*m.i62 + 0.0190237*m.i32*m.i63 +
0.01185726*m.i32*m.i64 + 0.01593976*m.i32*m.i65 + 0.00931156*m.i32*m.i66 + 0.01976096*m.i32*m.i67
+ 0.00940704*m.i32*m.i68 + 0.0353824*m.i32*m.i69 + 0.01637874*m.i32*m.i70 + 0.0234414*m.i32*
m.i71 + 0.01981882*m.i32*m.i72 + 0.01518934*m.i32*m.i73 + 0.0206944*m.i32*m.i74 + 0.01368518*
m.i32*m.i75 + 0.01085922*m.i32*m.i76 + 0.0142422*m.i32*m.i77 + 0.01225292*m.i32*m.i78 + 0.025216*
m.i32*m.i79 + 0.01581384*m.i32*m.i80 + 0.0226748*m.i32*m.i81 + 0.0078489*m.i32*m.i82 + 0.00488232
*m.i32*m.i83 + 0.01715432*m.i32*m.i84 + 0.01617784*m.i32*m.i85 + 0.0224728*m.i32*m.i86 +
0.0213528*m.i32*m.i87 + 0.0404024*m.i32*m.i88 + 0.00700416*m.i32*m.i89 + 0.0284686*m.i32*m.i90 +
0.01764584*m.i32*m.i91 + 0.01747106*m.i32*m.i92 + 0.00781272*m.i32*m.i93 + 0.01173676*m.i32*m.i94
+ 0.01901852*m.i32*m.i95 + 0.032411*m.i32*m.i96 + 0.0238232*m.i32*m.i97 + 0.021198*m.i32*m.i98
+ 0.0300116*m.i32*m.i99 + 0.0354006*m.i32*m.i100 + 0.0090127*m.i33*m.i34 + 0.00772724*m.i33*
m.i35 + 0.0313702*m.i33*m.i36 + 0.01413346*m.i33*m.i37 + 0.001835906*m.i33*m.i38 + 0.01789618*
m.i33*m.i39 + 0.0342932*m.i33*m.i40 + 0.0203234*m.i33*m.i41 + 0.01859662*m.i33*m.i42 + 0.00949822
*m.i33*m.i43 + 0.0173394*m.i33*m.i44 + 0.00462026*m.i33*m.i45 + 0.0076766*m.i33*m.i46 + 0.0195887
*m.i33*m.i47 + 0.00677792*m.i33*m.i48 + 0.01593666*m.i33*m.i49 + 0.0205366*m.i33*m.i50 +
0.01028686*m.i33*m.i51 + 0.01380638*m.i33*m.i52 + 0.0139701*m.i33*m.i53 + 0.016589*m.i33*m.i54 +
0.0139115*m.i33*m.i55 + 0.01339328*m.i33*m.i56 + 0.00706492*m.i33*m.i57 + 0.01010916*m.i33*m.i58
+ 0.0112109*m.i33*m.i59 + 0.0038394*m.i33*m.i60 + 0.0232104*m.i33*m.i61 + 0.01960694*m.i33*m.i62
+ 0.01805454*m.i33*m.i63 + 0.01327968*m.i33*m.i64 + 0.0135282*m.i33*m.i65 + 0.0101248*m.i33*
m.i66 + 0.00800254*m.i33*m.i67 + 0.0030849*m.i33*m.i68 + 0.0205056*m.i33*m.i69 + 0.00997944*m.i33
*m.i70 + 0.01867754*m.i33*m.i71 + 0.01023414*m.i33*m.i72 + 0.01414764*m.i33*m.i73 + 0.01623304*
m.i33*m.i74 + 0.00580254*m.i33*m.i75 + 0.00688906*m.i33*m.i76 + 0.01955742*m.i33*m.i77 +
0.0043617*m.i33*m.i78 + 0.0110714*m.i33*m.i79 + 0.00837212*m.i33*m.i80 + 0.0186224*m.i33*m.i81 +
0.0038599*m.i33*m.i82 + 0.01828456*m.i33*m.i83 + 0.01460176*m.i33*m.i84 + 0.00984126*m.i33*m.i85
+ 0.01375926*m.i33*m.i86 + 0.01081848*m.i33*m.i87 + 0.0294078*m.i33*m.i88 + 0.00904426*m.i33*
m.i89 + 0.01335384*m.i33*m.i90 + 0.00944562*m.i33*m.i91 + 0.01586856*m.i33*m.i92 + 0.00253356*
m.i33*m.i93 + 0.00579828*m.i33*m.i94 + 0.01264366*m.i33*m.i95 + 0.0212436*m.i33*m.i96 + 0.014968*
m.i33*m.i97 + 0.01459146*m.i33*m.i98 + 0.01990882*m.i33*m.i99 + 0.020898*m.i33*m.i100 + 0.0078456
*m.i34*m.i35 + 0.01102212*m.i34*m.i36 + 0.00676724*m.i34*m.i37 + 0.00365266*m.i34*m.i38 +
0.00595098*m.i34*m.i39 + 0.01153866*m.i34*m.i40 + 0.01058304*m.i34*m.i41 + 0.00838326*m.i34*m.i42
+ 0.00601354*m.i34*m.i43 + 0.00621002*m.i34*m.i44 + 0.00388646*m.i34*m.i45 + 0.00291464*m.i34*
m.i46 + 0.01279302*m.i34*m.i47 + 0.001590652*m.i34*m.i48 + 0.00546164*m.i34*m.i49 + 0.00756668*
m.i34*m.i50 + 0.00255946*m.i34*m.i51 + 0.00586752*m.i34*m.i52 - 0.0001086844*m.i34*m.i53 +
0.00756758*m.i34*m.i54 + 0.00472132*m.i34*m.i55 + 0.0090114*m.i34*m.i56 + 0.00404276*m.i34*m.i57
+ 0.00259172*m.i34*m.i58 + 0.0043188*m.i34*m.i59 + 0.00265148*m.i34*m.i60 + 0.00988174*m.i34*
m.i61 + 0.00773706*m.i34*m.i62 + 0.00871216*m.i34*m.i63 + 0.0051719*m.i34*m.i64 + 0.005674*m.i34*
m.i65 + 0.0042472*m.i34*m.i66 + 0.0029352*m.i34*m.i67 + 0.00380488*m.i34*m.i68 + 0.00782908*m.i34
*m.i69 + 0.00528678*m.i34*m.i70 + 0.01141144*m.i34*m.i71 + 0.00731358*m.i34*m.i72 + 0.00557996*
m.i34*m.i73 + 0.00428558*m.i34*m.i74 + 0.00214164*m.i34*m.i75 + 0.001888024*m.i34*m.i76 +
0.00450712*m.i34*m.i77 + 0.001974898*m.i34*m.i78 + 0.000555542*m.i34*m.i79 + 0.004826*m.i34*m.i80
+ 0.01009798*m.i34*m.i81 + 0.00342408*m.i34*m.i82 + 0.0066259*m.i34*m.i83 + 0.00557372*m.i34*
m.i84 + 0.00493326*m.i34*m.i85 + 0.0033431*m.i34*m.i86 + 0.00355798*m.i34*m.i87 + 0.0070914*m.i34
*m.i88 + 0.00319452*m.i34*m.i89 + 0.001165088*m.i34*m.i90 + 0.00330168*m.i34*m.i91 + 0.00487072*
m.i34*m.i92 + 0.001039364*m.i34*m.i93 + 0.00462638*m.i34*m.i94 + 0.00474964*m.i34*m.i95 +
0.00307738*m.i34*m.i96 + 0.00634158*m.i34*m.i97 + 0.0093911*m.i34*m.i98 + 0.00479968*m.i34*m.i99
+ 0.00945466*m.i34*m.i100 + 0.00886108*m.i35*m.i36 + 0.008324*m.i35*m.i37 + 0.0042517*m.i35*
m.i38 + 0.0063195*m.i35*m.i39 + 0.00897334*m.i35*m.i40 + 0.01438534*m.i35*m.i41 + 0.00707384*
m.i35*m.i42 + 0.00524994*m.i35*m.i43 + 0.00729354*m.i35*m.i44 + 0.00231104*m.i35*m.i45 +
0.00317018*m.i35*m.i46 + 0.01095322*m.i35*m.i47 + 0.00256082*m.i35*m.i48 + 0.0066693*m.i35*m.i49
+ 0.00896786*m.i35*m.i50 + 0.00243944*m.i35*m.i51 + 0.00542922*m.i35*m.i52 + 0.001853016*m.i35*
m.i53 + 0.0080304*m.i35*m.i54 + 0.004194*m.i35*m.i55 + 0.00944224*m.i35*m.i56 + 0.0044097*m.i35*
m.i57 + 0.00234874*m.i35*m.i58 + 0.0045055*m.i35*m.i59 + 0.00387194*m.i35*m.i60 + 0.01070194*
m.i35*m.i61 + 0.01020854*m.i35*m.i62 + 0.00869604*m.i35*m.i63 + 0.0038381*m.i35*m.i64 +
0.00566828*m.i35*m.i65 + 0.00392276*m.i35*m.i66 + 0.00493806*m.i35*m.i67 + 0.00543634*m.i35*m.i68
+ 0.01090284*m.i35*m.i69 + 0.00744802*m.i35*m.i70 + 0.01323476*m.i35*m.i71 + 0.00994186*m.i35*
m.i72 + 0.00554564*m.i35*m.i73 + 0.00631474*m.i35*m.i74 + 0.00456554*m.i35*m.i75 + 0.00357674*
m.i35*m.i76 + 0.00520436*m.i35*m.i77 + 0.0030095*m.i35*m.i78 + 0.0057729*m.i35*m.i79 + 0.00411204
*m.i35*m.i80 + 0.00953392*m.i35*m.i81 + 0.00378046*m.i35*m.i82 + 0.00572152*m.i35*m.i83 +
0.00613732*m.i35*m.i84 + 0.00382166*m.i35*m.i85 + 0.00356476*m.i35*m.i86 + 0.00634394*m.i35*m.i87
+ 0.0111758*m.i35*m.i88 + 0.00567884*m.i35*m.i89 + 0.00368822*m.i35*m.i90 + 0.00382434*m.i35*
m.i91 + 0.00295216*m.i35*m.i92 + 0.00261056*m.i35*m.i93 + 0.00538486*m.i35*m.i94 + 0.00508518*
m.i35*m.i95 + 0.00571674*m.i35*m.i96 + 0.00749186*m.i35*m.i97 + 0.00986618*m.i35*m.i98 +
0.00565378*m.i35*m.i99 + 0.0094721*m.i35*m.i100 + 0.0440606*m.i36*m.i37 + 0.0069763*m.i36*m.i38
+ 0.0493166*m.i36*m.i39 + 0.121634*m.i36*m.i40 + 0.0358136*m.i36*m.i41 + 0.0380066*m.i36*m.i42
+ 0.0240066*m.i36*m.i43 + 0.0315302*m.i36*m.i44 + 0.00778714*m.i36*m.i45 + 0.01711478*m.i36*
m.i46 + 0.0433014*m.i36*m.i47 + 0.01592312*m.i36*m.i48 + 0.0219624*m.i36*m.i49 + 0.0584382*m.i36*
m.i50 + 0.0237454*m.i36*m.i51 + 0.030079*m.i36*m.i52 + 0.0450814*m.i36*m.i53 + 0.0285826*m.i36*
m.i54 + 0.0266392*m.i36*m.i55 + 0.01830758*m.i36*m.i56 + 0.01364522*m.i36*m.i57 + 0.01568*m.i36*
m.i58 + 0.0359108*m.i36*m.i59 + 0.00643528*m.i36*m.i60 + 0.056249*m.i36*m.i61 + 0.0503568*m.i36*
m.i62 + 0.0221574*m.i36*m.i63 + 0.023432*m.i36*m.i64 + 0.0219264*m.i36*m.i65 + 0.01946022*m.i36*
m.i66 + 0.0301552*m.i36*m.i67 + 0.00986666*m.i36*m.i68 + 0.0496472*m.i36*m.i69 + 0.0177644*m.i36*
m.i70 + 0.0308856*m.i36*m.i71 + 0.01899074*m.i36*m.i72 + 0.01805938*m.i36*m.i73 + 0.0273694*m.i36
*m.i74 + 0.01662774*m.i36*m.i75 + 0.00832596*m.i36*m.i76 + 0.0203852*m.i36*m.i77 + 0.0174271*
m.i36*m.i78 + 0.039217*m.i36*m.i79 + 0.0232082*m.i36*m.i80 + 0.0357644*m.i36*m.i81 + 0.00331724*
m.i36*m.i82 + 0.0276304*m.i36*m.i83 + 0.0267904*m.i36*m.i84 + 0.02756*m.i36*m.i85 + 0.0320374*
m.i36*m.i86 + 0.0222598*m.i36*m.i87 + 0.0496644*m.i36*m.i88 + 0.01118028*m.i36*m.i89 + 0.0432572*
m.i36*m.i90 + 0.027434*m.i36*m.i91 + 0.0293774*m.i36*m.i92 + 0.0055352*m.i36*m.i93 + 0.00852418*
m.i36*m.i94 + 0.028037*m.i36*m.i95 + 0.0642512*m.i36*m.i96 + 0.0386458*m.i36*m.i97 + 0.040981*
m.i36*m.i98 + 0.04604*m.i36*m.i99 + 0.0478424*m.i36*m.i100 + 0.00525362*m.i37*m.i38 + 0.0212576*
m.i37*m.i39 + 0.0543916*m.i37*m.i40 + 0.018282*m.i37*m.i41 + 0.01700698*m.i37*m.i42 + 0.00953368*
m.i37*m.i43 + 0.0147155*m.i37*m.i44 + 0.00425042*m.i37*m.i45 + 0.00777022*m.i37*m.i46 +
0.01646346*m.i37*m.i47 + 0.00740598*m.i37*m.i48 + 0.01274586*m.i37*m.i49 + 0.0282742*m.i37*m.i50
+ 0.01506898*m.i37*m.i51 + 0.01409464*m.i37*m.i52 + 0.01916222*m.i37*m.i53 + 0.01572296*m.i37*
m.i54 + 0.01361714*m.i37*m.i55 + 0.01302042*m.i37*m.i56 + 0.00807862*m.i37*m.i57 + 0.00701644*
m.i37*m.i58 + 0.0201438*m.i37*m.i59 + 0.00497496*m.i37*m.i60 + 0.0259544*m.i37*m.i61 + 0.01982096
*m.i37*m.i62 + 0.01082904*m.i37*m.i63 + 0.00909066*m.i37*m.i64 + 0.0112364*m.i37*m.i65 +
0.0089483*m.i37*m.i66 + 0.01522148*m.i37*m.i67 + 0.00459152*m.i37*m.i68 + 0.0214858*m.i37*m.i69
+ 0.01075074*m.i37*m.i70 + 0.0132224*m.i37*m.i71 + 0.00980738*m.i37*m.i72 + 0.00885252*m.i37*
m.i73 + 0.01427422*m.i37*m.i74 + 0.00903996*m.i37*m.i75 + 0.00768272*m.i37*m.i76 + 0.0103221*
m.i37*m.i77 + 0.01082002*m.i37*m.i78 + 0.0248284*m.i37*m.i79 + 0.01098172*m.i37*m.i80 +
0.01335848*m.i37*m.i81 + 0.00545734*m.i37*m.i82 + 0.00921544*m.i37*m.i83 + 0.0110069*m.i37*m.i84
+ 0.01385998*m.i37*m.i85 + 0.01437348*m.i37*m.i86 + 0.01621552*m.i37*m.i87 + 0.01981332*m.i37*
m.i88 + 0.00549314*m.i37*m.i89 + 0.0210958*m.i37*m.i90 + 0.0116061*m.i37*m.i91 + 0.01444326*m.i37
*m.i92 + 0.00631646*m.i37*m.i93 + 0.00847398*m.i37*m.i94 + 0.0132838*m.i37*m.i95 + 0.0257442*
m.i37*m.i96 + 0.01746728*m.i37*m.i97 + 0.01331586*m.i37*m.i98 + 0.0246618*m.i37*m.i99 + 0.0231186
*m.i37*m.i100 + 0.00427726*m.i38*m.i39 + 0.00960742*m.i38*m.i40 + 0.00588794*m.i38*m.i41 +
0.0040899*m.i38*m.i42 + 0.00370486*m.i38*m.i43 + 0.001581616*m.i38*m.i44 + 0.00157779*m.i38*m.i45
+ 0.001517842*m.i38*m.i46 + 0.00577098*m.i38*m.i47 + 0.00184948*m.i38*m.i48 + 0.001412132*m.i38*
m.i49 + 0.00473326*m.i38*m.i50 + 0.001265572*m.i38*m.i51 + 0.00389392*m.i38*m.i52 + 0.00195541*
m.i38*m.i53 + 0.0045747*m.i38*m.i54 + 0.003024*m.i38*m.i55 + 0.00322834*m.i38*m.i56 + 0.00240162*
m.i38*m.i57 + 0.000494648*m.i38*m.i58 + 0.0035117*m.i38*m.i59 + 0.00302272*m.i38*m.i60 +
0.0067192*m.i38*m.i61 + 0.00576934*m.i38*m.i62 + 0.00236514*m.i38*m.i63 + 0.00208302*m.i38*m.i64
+ 0.00359594*m.i38*m.i65 + 0.001590092*m.i38*m.i66 + 0.00239398*m.i38*m.i67 + 0.00302224*m.i38*
m.i68 + 0.00326928*m.i38*m.i69 + 0.00302294*m.i38*m.i70 + 0.0049377*m.i38*m.i71 + 0.00553496*
m.i38*m.i72 + 0.00229972*m.i38*m.i73 + 0.00318332*m.i38*m.i74 + 0.00325074*m.i38*m.i75 +
0.001803886*m.i38*m.i76 + 0.000902562*m.i38*m.i77 + 0.001651326*m.i38*m.i78 + 0.0039935*m.i38*
m.i79 + 0.00233242*m.i38*m.i80 + 0.00546644*m.i38*m.i81 + 0.00223454*m.i38*m.i82 - 0.001681894*
m.i38*m.i83 + 0.0025273*m.i38*m.i84 + 0.0032781*m.i38*m.i85 + 0.001557044*m.i38*m.i86 +
0.00327138*m.i38*m.i87 + 0.00674346*m.i38*m.i88 + 0.0020784*m.i38*m.i89 + 0.00343958*m.i38*m.i90
+ 0.00324954*m.i38*m.i91 + 0.00206404*m.i38*m.i92 + 0.00161462*m.i38*m.i93 + 0.00247166*m.i38*
m.i94 + 0.00341238*m.i38*m.i95 + 0.00585902*m.i38*m.i96 + 0.00423638*m.i38*m.i97 + 0.00566634*
m.i38*m.i98 + 0.00315378*m.i38*m.i99 + 0.00449598*m.i38*m.i100 + 0.0491892*m.i39*m.i40 +
0.0262408*m.i39*m.i41 + 0.0205234*m.i39*m.i42 + 0.01409356*m.i39*m.i43 + 0.0195666*m.i39*m.i44 +
0.00525174*m.i39*m.i45 + 0.01076856*m.i39*m.i46 + 0.0216478*m.i39*m.i47 + 0.01097136*m.i39*m.i48
+ 0.0178672*m.i39*m.i49 + 0.0324104*m.i39*m.i50 + 0.0147971*m.i39*m.i51 + 0.01855664*m.i39*m.i52
+ 0.0250992*m.i39*m.i53 + 0.0213078*m.i39*m.i54 + 0.01575182*m.i39*m.i55 + 0.01438592*m.i39*
m.i56 + 0.0105253*m.i39*m.i57 + 0.01177712*m.i39*m.i58 + 0.0207946*m.i39*m.i59 + 0.00650454*m.i39
*m.i60 + 0.036126*m.i39*m.i61 + 0.0278076*m.i39*m.i62 + 0.0206546*m.i39*m.i63 + 0.01499036*m.i39*
m.i64 + 0.01276412*m.i39*m.i65 + 0.0125414*m.i39*m.i66 + 0.01617824*m.i39*m.i67 + 0.010394*m.i39*
m.i68 + 0.0290228*m.i39*m.i69 + 0.01190924*m.i39*m.i70 + 0.01824964*m.i39*m.i71 + 0.014012*m.i39*
m.i72 + 0.01408568*m.i39*m.i73 + 0.0192582*m.i39*m.i74 + 0.01283914*m.i39*m.i75 + 0.00757714*
m.i39*m.i76 + 0.0157748*m.i39*m.i77 + 0.00886562*m.i39*m.i78 + 0.0226622*m.i39*m.i79 + 0.01506442
*m.i39*m.i80 + 0.01868878*m.i39*m.i81 + 0.00371016*m.i39*m.i82 + 0.01245306*m.i39*m.i83 +
0.01693888*m.i39*m.i84 + 0.0145704*m.i39*m.i85 + 0.0207926*m.i39*m.i86 + 0.01487822*m.i39*m.i87
+ 0.0465058*m.i39*m.i88 + 0.01052428*m.i39*m.i89 + 0.0220072*m.i39*m.i90 + 0.01887928*m.i39*
m.i91 + 0.01597714*m.i39*m.i92 + 0.00531126*m.i39*m.i93 + 0.00658506*m.i39*m.i94 + 0.01713092*
m.i39*m.i95 + 0.0328166*m.i39*m.i96 + 0.0213542*m.i39*m.i97 + 0.0210286*m.i39*m.i98 + 0.0255336*
m.i39*m.i99 + 0.0274274*m.i39*m.i100 + 0.0504412*m.i40*m.i41 + 0.0336102*m.i40*m.i42 + 0.0294804*
m.i40*m.i43 + 0.0424704*m.i40*m.i44 + 0.0030095*m.i40*m.i45 + 0.01146224*m.i40*m.i46 + 0.0507426*
m.i40*m.i47 + 0.01585054*m.i40*m.i48 + 0.0217164*m.i40*m.i49 + 0.0491478*m.i40*m.i50 + 0.0317926*
m.i40*m.i51 + 0.0284682*m.i40*m.i52 + 0.0468934*m.i40*m.i53 + 0.0309254*m.i40*m.i54 + 0.028626*
m.i40*m.i55 + 0.0309698*m.i40*m.i56 + 0.01062184*m.i40*m.i57 + 0.01987174*m.i40*m.i58 + 0.0429952
*m.i40*m.i59 + 0.00300922*m.i40*m.i60 + 0.0574936*m.i40*m.i61 + 0.0496304*m.i40*m.i62 +
0.01678646*m.i40*m.i63 + 0.0153295*m.i40*m.i64 + 0.0230176*m.i40*m.i65 + 0.0200972*m.i40*m.i66 +
0.0274442*m.i40*m.i67 - 0.00465404*m.i40*m.i68 + 0.0404524*m.i40*m.i69 + 0.01243058*m.i40*m.i70
+ 0.0333654*m.i40*m.i71 + 0.01847532*m.i40*m.i72 + 0.01863464*m.i40*m.i73 + 0.01865328*m.i40*
m.i74 + 0.0086314*m.i40*m.i75 + 0.0107773*m.i40*m.i76 + 0.0203618*m.i40*m.i77 + 0.01445046*m.i40*
m.i78 + 0.0410886*m.i40*m.i79 + 0.01194082*m.i40*m.i80 + 0.044529*m.i40*m.i81 + 0.00528742*m.i40*
m.i82 + 0.0445722*m.i40*m.i83 + 0.0229102*m.i40*m.i84 + 0.0241064*m.i40*m.i85 + 0.0368384*m.i40*
m.i86 + 0.0327072*m.i40*m.i87 + 0.0612044*m.i40*m.i88 + 0.0029601*m.i40*m.i89 + 0.0534994*m.i40*
m.i90 + 0.0258428*m.i40*m.i91 + 0.0317582*m.i40*m.i92 + 0.00965728*m.i40*m.i93 + 0.01437522*m.i40
*m.i94 + 0.0249652*m.i40*m.i95 + 0.0605768*m.i40*m.i96 + 0.0345084*m.i40*m.i97 + 0.0313726*m.i40*
m.i98 + 0.064674*m.i40*m.i99 + 0.0504464*m.i40*m.i100 + 0.0211266*m.i41*m.i42 + 0.0280268*m.i41*
m.i43 + 0.0396958*m.i41*m.i44 + 0.00245084*m.i41*m.i45 + 0.00955952*m.i41*m.i46 + 0.0396834*m.i41
*m.i47 + 0.0061862*m.i41*m.i48 + 0.02227*m.i41*m.i49 + 0.0217142*m.i41*m.i50 + 0.00978418*m.i41*
m.i51 + 0.01479238*m.i41*m.i52 + 0.016171*m.i41*m.i53 + 0.0243916*m.i41*m.i54 + 0.01422356*m.i41*
m.i55 + 0.0283342*m.i41*m.i56 + 0.00801394*m.i41*m.i57 + 0.01783044*m.i41*m.i58 + 0.01283818*
m.i41*m.i59 + 0.00500652*m.i41*m.i60 + 0.0289002*m.i41*m.i61 + 0.0313062*m.i41*m.i62 + 0.0372108*
m.i41*m.i63 + 0.0192516*m.i41*m.i64 + 0.0152555*m.i41*m.i65 + 0.01848886*m.i41*m.i66 + 0.01396382
*m.i41*m.i67 + 0.01323774*m.i41*m.i68 + 0.0319484*m.i41*m.i69 + 0.01505338*m.i41*m.i70 +
0.0464724*m.i41*m.i71 + 0.0275962*m.i41*m.i72 + 0.01531976*m.i41*m.i73 + 0.0159052*m.i41*m.i74 +
0.00897454*m.i41*m.i75 + 0.00931212*m.i41*m.i76 + 0.01958562*m.i41*m.i77 + 0.00344582*m.i41*m.i78
+ 0.00874906*m.i41*m.i79 + 0.01063594*m.i41*m.i80 + 0.02994*m.i41*m.i81 + 0.000668906*m.i41*
m.i82 + 0.0436128*m.i41*m.i83 + 0.0233408*m.i41*m.i84 + 0.00754018*m.i41*m.i85 + 0.01805636*m.i41
*m.i86 + 0.01281402*m.i41*m.i87 + 0.0523726*m.i41*m.i88 + 0.00844562*m.i41*m.i89 + 0.01302218*
m.i41*m.i90 + 0.01396562*m.i41*m.i91 + 0.01458222*m.i41*m.i92 + 0.0072903*m.i41*m.i93 +
0.00709746*m.i41*m.i94 + 0.01473562*m.i41*m.i95 + 0.01085782*m.i41*m.i96 + 0.021406*m.i41*m.i97
+ 0.0295828*m.i41*m.i98 + 0.01994264*m.i41*m.i99 + 0.0263314*m.i41*m.i100 + 0.01525376*m.i42*
m.i43 + 0.01763084*m.i42*m.i44 + 0.00749008*m.i42*m.i45 + 0.00916454*m.i42*m.i46 + 0.0235102*
m.i42*m.i47 + 0.00921988*m.i42*m.i48 + 0.01347394*m.i42*m.i49 + 0.0247352*m.i42*m.i50 +
0.01120346*m.i42*m.i51 + 0.01858118*m.i42*m.i52 + 0.01723882*m.i42*m.i53 + 0.0208142*m.i42*m.i54
+ 0.01360838*m.i42*m.i55 + 0.0118194*m.i42*m.i56 + 0.00860676*m.i42*m.i57 + 0.00935934*m.i42*
m.i58 + 0.01516418*m.i42*m.i59 + 0.0068076*m.i42*m.i60 + 0.028779*m.i42*m.i61 + 0.0258494*m.i42*
m.i62 + 0.0233604*m.i42*m.i63 + 0.01573382*m.i42*m.i64 + 0.01049188*m.i42*m.i65 + 0.00740748*
m.i42*m.i66 + 0.01082116*m.i42*m.i67 + 0.00777482*m.i42*m.i68 + 0.0240088*m.i42*m.i69 +
0.01102072*m.i42*m.i70 + 0.01820862*m.i42*m.i71 + 0.01298112*m.i42*m.i72 + 0.01234456*m.i42*m.i73
+ 0.0141652*m.i42*m.i74 + 0.00934936*m.i42*m.i75 + 0.00505832*m.i42*m.i76 + 0.01458566*m.i42*
m.i77 + 0.00728638*m.i42*m.i78 + 0.0099359*m.i42*m.i79 + 0.01486474*m.i42*m.i80 + 0.01668502*
m.i42*m.i81 + 0.00373442*m.i42*m.i82 + 0.01190258*m.i42*m.i83 + 0.01201006*m.i42*m.i84 +
0.0151776*m.i42*m.i85 + 0.0145938*m.i42*m.i86 + 0.00824462*m.i42*m.i87 + 0.0160982*m.i42*m.i88 +
0.006593*m.i42*m.i89 + 0.01418496*m.i42*m.i90 + 0.01803698*m.i42*m.i91 + 0.0159653*m.i42*m.i92 +
0.00291508*m.i42*m.i93 + 0.00538746*m.i42*m.i94 + 0.01644022*m.i42*m.i95 + 0.0250208*m.i42*m.i96
+ 0.018306*m.i42*m.i97 + 0.01797718*m.i42*m.i98 + 0.01649756*m.i42*m.i99 + 0.025412*m.i42*m.i100
+ 0.01762524*m.i43*m.i44 + 0.0026577*m.i43*m.i45 + 0.00500594*m.i43*m.i46 + 0.01987672*m.i43*
m.i47 + 0.00486026*m.i43*m.i48 + 0.01054502*m.i43*m.i49 + 0.00887754*m.i43*m.i50 + 0.00693606*
m.i43*m.i51 + 0.01006578*m.i43*m.i52 + 0.01002454*m.i43*m.i53 + 0.0138188*m.i43*m.i54 +
0.00975298*m.i43*m.i55 + 0.01686962*m.i43*m.i56 + 0.00490722*m.i43*m.i57 + 0.00949952*m.i43*m.i58
+ 0.01032096*m.i43*m.i59 + 0.00313858*m.i43*m.i60 + 0.01509816*m.i43*m.i61 + 0.0162044*m.i43*
m.i62 + 0.01875628*m.i43*m.i63 + 0.01240346*m.i43*m.i64 + 0.0085184*m.i43*m.i65 + 0.0097536*m.i43
*m.i66 + 0.00601436*m.i43*m.i67 + 0.0069333*m.i43*m.i68 + 0.01534648*m.i43*m.i69 + 0.00585324*
m.i43*m.i70 + 0.01833662*m.i43*m.i71 + 0.01219044*m.i43*m.i72 + 0.00997222*m.i43*m.i73 +
0.00950324*m.i43*m.i74 + 0.00395808*m.i43*m.i75 + 0.00230734*m.i43*m.i76 + 0.01177946*m.i43*m.i77
+ 0.00120913*m.i43*m.i78 + 0.00451336*m.i43*m.i79 + 0.0087064*m.i43*m.i80 + 0.01415418*m.i43*
m.i81 + 0.00158382*m.i43*m.i82 + 0.01934448*m.i43*m.i83 + 0.01332798*m.i43*m.i84 + 0.0073079*
m.i43*m.i85 + 0.01024086*m.i43*m.i86 + 0.00333288*m.i43*m.i87 + 0.01697646*m.i43*m.i88 +
0.00457426*m.i43*m.i89 + 0.00557218*m.i43*m.i90 + 0.0103559*m.i43*m.i91 + 0.00897022*m.i43*m.i92
+ 0.00315402*m.i43*m.i93 + 0.00504118*m.i43*m.i94 + 0.01075858*m.i43*m.i95 + 0.00678594*m.i43*
m.i96 + 0.01260626*m.i43*m.i97 + 0.0163881*m.i43*m.i98 + 0.01009846*m.i43*m.i99 + 0.01154306*
m.i43*m.i100 + 0.00483446*m.i44*m.i45 + 0.00652268*m.i44*m.i46 + 0.0242272*m.i44*m.i47 +
0.00478826*m.i44*m.i48 + 0.01685648*m.i44*m.i49 + 0.020425*m.i44*m.i50 + 0.00923526*m.i44*m.i51
+ 0.01214276*m.i44*m.i52 + 0.01807778*m.i44*m.i53 + 0.01714928*m.i44*m.i54 + 0.0117815*m.i44*
m.i55 + 0.01675568*m.i44*m.i56 + 0.0065756*m.i44*m.i57 + 0.01226174*m.i44*m.i58 + 0.0107529*m.i44
*m.i59 + 0.00316098*m.i44*m.i60 + 0.0237412*m.i44*m.i61 + 0.023095*m.i44*m.i62 + 0.0261176*m.i44*
m.i63 + 0.01217274*m.i44*m.i64 + 0.01008618*m.i44*m.i65 + 0.0100818*m.i44*m.i66 + 0.01058518*
m.i44*m.i67 + 0.00547734*m.i44*m.i68 + 0.0242058*m.i44*m.i69 + 0.01131642*m.i44*m.i70 + 0.0238346
*m.i44*m.i71 + 0.01469328*m.i44*m.i72 + 0.01153818*m.i44*m.i73 + 0.0107527*m.i44*m.i74 +
0.00664436*m.i44*m.i75 + 0.00643936*m.i44*m.i76 + 0.01819866*m.i44*m.i77 + 0.00401038*m.i44*m.i78
+ 0.00860378*m.i44*m.i79 + 0.01052694*m.i44*m.i80 + 0.01791956*m.i44*m.i81 + 0.001302356*m.i44*
m.i82 + 0.024415*m.i44*m.i83 + 0.01318656*m.i44*m.i84 + 0.00691488*m.i44*m.i85 + 0.0134211*m.i44*
m.i86 + 0.01005166*m.i44*m.i87 + 0.036692*m.i44*m.i88 + 0.00614716*m.i44*m.i89 + 0.0120958*m.i44*
m.i90 + 0.00884752*m.i44*m.i91 + 0.01296164*m.i44*m.i92 + 0.00513894*m.i44*m.i93 + 0.00596534*
m.i44*m.i94 + 0.01196692*m.i44*m.i95 + 0.01664976*m.i44*m.i96 + 0.01462126*m.i44*m.i97 +
0.0157382*m.i44*m.i98 + 0.01533824*m.i44*m.i99 + 0.0188597*m.i44*m.i100 + 0.00317774*m.i45*m.i46
+ 0.00420624*m.i45*m.i47 + 0.00199361*m.i45*m.i48 + 0.0050265*m.i45*m.i49 + 0.00894044*m.i45*
m.i50 + 0.00284776*m.i45*m.i51 + 0.00547162*m.i45*m.i52 + 0.00269966*m.i45*m.i53 + 0.0064379*
m.i45*m.i54 + 0.00472118*m.i45*m.i55 + 0.0042126*m.i45*m.i56 + 0.00394074*m.i45*m.i57 +
0.00265196*m.i45*m.i58 + 0.00448504*m.i45*m.i59 + 0.001797504*m.i45*m.i60 + 0.00867806*m.i45*
m.i61 + 0.00322858*m.i45*m.i62 + 0.00607352*m.i45*m.i63 + 0.00436738*m.i45*m.i64 + 0.00237578*
m.i45*m.i65 + 0.0044976*m.i45*m.i66 + 0.00181419*m.i45*m.i67 + 0.00495262*m.i45*m.i68 +
0.00570214*m.i45*m.i69 + 0.00422674*m.i45*m.i70 + 0.001748284*m.i45*m.i71 + 0.00347868*m.i45*
m.i72 + 0.00586478*m.i45*m.i73 + 0.00333902*m.i45*m.i74 + 0.0046385*m.i45*m.i75 + 0.001228842*
m.i45*m.i76 + 0.00595824*m.i45*m.i77 + 0.0027183*m.i45*m.i78 + 0.00108409*m.i45*m.i79 +
0.00761658*m.i45*m.i80 + 0.0005468*m.i45*m.i81 + 0.001647768*m.i45*m.i82 - 0.00572218*m.i45*m.i83
+ 0.00291394*m.i45*m.i84 + 0.00667112*m.i45*m.i85 + 0.00283124*m.i45*m.i86 + 0.00214236*m.i45*
m.i87 + 0.00913532*m.i45*m.i88 + 0.0031579*m.i45*m.i89 + 0.001671266*m.i45*m.i90 + 0.007457*m.i45
*m.i91 + 0.00539294*m.i45*m.i92 + 0.001548892*m.i45*m.i93 + 0.00325768*m.i45*m.i94 + 0.00415906*
m.i45*m.i95 + 0.00472416*m.i45*m.i96 + 0.00257908*m.i45*m.i97 + 0.00311904*m.i45*m.i98 -
0.00028754*m.i45*m.i99 + 0.00641254*m.i45*m.i100 + 0.00936266*m.i46*m.i47 + 0.00551424*m.i46*
m.i48 + 0.00665328*m.i46*m.i49 + 0.01254298*m.i46*m.i50 + 0.00457552*m.i46*m.i51 + 0.00723508*
m.i46*m.i52 + 0.01013924*m.i46*m.i53 + 0.00835722*m.i46*m.i54 + 0.00612552*m.i46*m.i55 +
0.00568528*m.i46*m.i56 + 0.00506602*m.i46*m.i57 + 0.00547684*m.i46*m.i58 + 0.00630834*m.i46*m.i59
+ 0.0034076*m.i46*m.i60 + 0.01269782*m.i46*m.i61 + 0.01056202*m.i46*m.i62 + 0.00905674*m.i46*
m.i63 + 0.00727642*m.i46*m.i64 + 0.0053986*m.i46*m.i65 + 0.00499194*m.i46*m.i66 + 0.00693256*
m.i46*m.i67 + 0.00384534*m.i46*m.i68 + 0.01113952*m.i46*m.i69 + 0.00571676*m.i46*m.i70 +
0.00918194*m.i46*m.i71 + 0.00582038*m.i46*m.i72 + 0.00587208*m.i46*m.i73 + 0.00927628*m.i46*m.i74
+ 0.00540062*m.i46*m.i75 + 0.00399822*m.i46*m.i76 + 0.00599102*m.i46*m.i77 + 0.00478388*m.i46*
m.i78 + 0.0052496*m.i46*m.i79 + 0.0080323*m.i46*m.i80 + 0.00786638*m.i46*m.i81 + 0.001854684*
m.i46*m.i82 + 0.00407872*m.i46*m.i83 + 0.00621788*m.i46*m.i84 + 0.00606418*m.i46*m.i85 +
0.00669516*m.i46*m.i86 + 0.00483036*m.i46*m.i87 + 0.00889994*m.i46*m.i88 + 0.00341184*m.i46*m.i89
+ 0.00883678*m.i46*m.i90 + 0.00699852*m.i46*m.i91 + 0.00577214*m.i46*m.i92 + 0.00238288*m.i46*
m.i93 + 0.001681122*m.i46*m.i94 + 0.00660328*m.i46*m.i95 + 0.0125098*m.i46*m.i96 + 0.00829924*
m.i46*m.i97 + 0.00843732*m.i46*m.i98 + 0.00930502*m.i46*m.i99 + 0.01141018*m.i46*m.i100 +
0.00622806*m.i47*m.i48 + 0.01275134*m.i47*m.i49 + 0.0219686*m.i47*m.i50 + 0.00559252*m.i47*m.i51
+ 0.014742*m.i47*m.i52 + 0.01293552*m.i47*m.i53 + 0.0202408*m.i47*m.i54 + 0.01276622*m.i47*m.i55
+ 0.0211842*m.i47*m.i56 + 0.00751862*m.i47*m.i57 + 0.01167596*m.i47*m.i58 + 0.0096102*m.i47*
m.i59 + 0.00476024*m.i47*m.i60 + 0.0291008*m.i47*m.i61 + 0.0293252*m.i47*m.i62 + 0.0218568*m.i47*
m.i63 + 0.01597818*m.i47*m.i64 + 0.01230724*m.i47*m.i65 + 0.01074494*m.i47*m.i66 + 0.01192482*
m.i47*m.i67 + 0.0072756*m.i47*m.i68 + 0.0259978*m.i47*m.i69 + 0.01196354*m.i47*m.i70 + 0.0346772*
m.i47*m.i71 + 0.01997802*m.i47*m.i72 + 0.0109755*m.i47*m.i73 + 0.01126216*m.i47*m.i74 +
0.00543986*m.i47*m.i75 + 0.00507998*m.i47*m.i76 + 0.01031016*m.i47*m.i77 + 0.0051788*m.i47*m.i78
+ 0.001275304*m.i47*m.i79 + 0.00993436*m.i47*m.i80 + 0.0302174*m.i47*m.i81 + 0.0025327*m.i47*
m.i82 + 0.0227778*m.i47*m.i83 + 0.01358392*m.i47*m.i84 + 0.01015524*m.i47*m.i85 + 0.01402648*
m.i47*m.i86 + 0.00789154*m.i47*m.i87 + 0.0151434*m.i47*m.i88 + 0.001278866*m.i47*m.i89 +
0.0158996*m.i47*m.i90 + 0.01154264*m.i47*m.i91 + 0.01393698*m.i47*m.i92 + 0.00304714*m.i47*m.i93
+ 0.00512466*m.i47*m.i94 + 0.01429612*m.i47*m.i95 + 0.01681572*m.i47*m.i96 + 0.01931984*m.i47*
m.i97 + 0.0267484*m.i47*m.i98 + 0.01797768*m.i47*m.i99 + 0.0282598*m.i47*m.i100 + 0.00546656*
m.i48*m.i49 + 0.01037534*m.i48*m.i50 + 0.00353598*m.i48*m.i51 + 0.00756044*m.i48*m.i52 +
0.01216498*m.i48*m.i53 + 0.00967664*m.i48*m.i54 + 0.00647364*m.i48*m.i55 + 0.00302706*m.i48*m.i56
+ 0.0053717*m.i48*m.i57 + 0.00577622*m.i48*m.i58 + 0.00544272*m.i48*m.i59 + 0.00352554*m.i48*
m.i60 + 0.01442968*m.i48*m.i61 + 0.0109524*m.i48*m.i62 + 0.00913756*m.i48*m.i63 + 0.00640136*
m.i48*m.i64 + 0.00303604*m.i48*m.i65 + 0.00380586*m.i48*m.i66 + 0.00547728*m.i48*m.i67 +
0.00370642*m.i48*m.i68 + 0.00883124*m.i48*m.i69 + 0.00549652*m.i48*m.i70 + 0.00566248*m.i48*m.i71
+ 0.00467596*m.i48*m.i72 + 0.00529964*m.i48*m.i73 + 0.00953518*m.i48*m.i74 + 0.00623786*m.i48*
m.i75 + 0.00402142*m.i48*m.i76 + 0.00662892*m.i48*m.i77 + 0.004711*m.i48*m.i78 + 0.001686804*
m.i48*m.i79 + 0.00761384*m.i48*m.i80 + 0.0057658*m.i48*m.i81 + 0.00181049*m.i48*m.i82 -
0.00054847*m.i48*m.i83 + 0.0048793*m.i48*m.i84 + 0.00598068*m.i48*m.i85 + 0.00652398*m.i48*m.i86
+ 0.0036324*m.i48*m.i87 + 0.00674584*m.i48*m.i88 + 0.00354232*m.i48*m.i89 + 0.00923644*m.i48*
m.i90 + 0.01247554*m.i48*m.i91 + 0.00613734*m.i48*m.i92 + 0.000820814*m.i48*m.i93 + 0.001893008*
m.i48*m.i94 + 0.00690274*m.i48*m.i95 + 0.01623126*m.i48*m.i96 + 0.00810288*m.i48*m.i97 +
0.00702362*m.i48*m.i98 + 0.01027006*m.i48*m.i99 + 0.01224198*m.i48*m.i100 + 0.01829412*m.i49*
m.i50 + 0.0119479*m.i49*m.i51 + 0.01038228*m.i49*m.i52 + 0.01375438*m.i49*m.i53 + 0.01480194*
m.i49*m.i54 + 0.01103368*m.i49*m.i55 + 0.01464938*m.i49*m.i56 + 0.00724638*m.i49*m.i57 +
0.00857364*m.i49*m.i58 + 0.0149174*m.i49*m.i59 + 0.00407556*m.i49*m.i60 + 0.0214208*m.i49*m.i61
+ 0.01655784*m.i49*m.i62 + 0.01832206*m.i49*m.i63 + 0.0099515*m.i49*m.i64 + 0.01025382*m.i49*
m.i65 + 0.00862324*m.i49*m.i66 + 0.00863512*m.i49*m.i67 + 0.0076467*m.i49*m.i68 + 0.0220404*m.i49
*m.i69 + 0.0095053*m.i49*m.i70 + 0.01307838*m.i49*m.i71 + 0.01047408*m.i49*m.i72 + 0.01294838*
m.i49*m.i73 + 0.01471132*m.i49*m.i74 + 0.00851398*m.i49*m.i75 + 0.00575748*m.i49*m.i76 +
0.0145716*m.i49*m.i77 + 0.00460678*m.i49*m.i78 + 0.01570596*m.i49*m.i79 + 0.00985226*m.i49*m.i80
+ 0.01023644*m.i49*m.i81 + 0.00369278*m.i49*m.i82 + 0.00860988*m.i49*m.i83 + 0.01393008*m.i49*
m.i84 + 0.00839504*m.i49*m.i85 + 0.01483048*m.i49*m.i86 + 0.01071222*m.i49*m.i87 + 0.0344974*
m.i49*m.i88 + 0.00962838*m.i49*m.i89 + 0.01169418*m.i49*m.i90 + 0.01045396*m.i49*m.i91 +
0.0095482*m.i49*m.i92 + 0.00539536*m.i49*m.i93 + 0.00663516*m.i49*m.i94 + 0.01120512*m.i49*m.i95
+ 0.01484196*m.i49*m.i96 + 0.0127009*m.i49*m.i97 + 0.01167858*m.i49*m.i98 + 0.01477446*m.i49*
m.i99 + 0.01842494*m.i49*m.i100 + 0.01663076*m.i50*m.i51 + 0.021828*m.i50*m.i52 + 0.029083*m.i50*
m.i53 + 0.0230518*m.i50*m.i54 + 0.01639088*m.i50*m.i55 + 0.01308142*m.i50*m.i56 + 0.01225642*
m.i50*m.i57 + 0.0094199*m.i50*m.i58 + 0.0222192*m.i50*m.i59 + 0.00884396*m.i50*m.i60 + 0.0415716*
m.i50*m.i61 + 0.032076*m.i50*m.i62 + 0.021259*m.i50*m.i63 + 0.01432872*m.i50*m.i64 + 0.01445944*
m.i50*m.i65 + 0.01098896*m.i50*m.i66 + 0.0219658*m.i50*m.i67 + 0.01066588*m.i50*m.i68 + 0.0354768
*m.i50*m.i69 + 0.01575178*m.i50*m.i70 + 0.01775054*m.i50*m.i71 + 0.01436852*m.i50*m.i72 +
0.01353572*m.i50*m.i73 + 0.01936092*m.i50*m.i74 + 0.01665002*m.i50*m.i75 + 0.00971184*m.i50*m.i76
+ 0.01642836*m.i50*m.i77 + 0.01382168*m.i50*m.i78 + 0.0341934*m.i50*m.i79 + 0.01843884*m.i50*
m.i80 + 0.01940942*m.i50*m.i81 + 0.00527464*m.i50*m.i82 + 0.00829608*m.i50*m.i83 + 0.0138699*
m.i50*m.i84 + 0.01840912*m.i50*m.i85 + 0.0210266*m.i50*m.i86 + 0.0205286*m.i50*m.i87 + 0.0451728*
m.i50*m.i88 + 0.01361116*m.i50*m.i89 + 0.0277252*m.i50*m.i90 + 0.01783032*m.i50*m.i91 +
0.01982086*m.i50*m.i92 + 0.00668064*m.i50*m.i93 + 0.00765962*m.i50*m.i94 + 0.01980832*m.i50*m.i95
+ 0.043863*m.i50*m.i96 + 0.0241266*m.i50*m.i97 + 0.0216094*m.i50*m.i98 + 0.0284306*m.i50*m.i99
+ 0.0308476*m.i50*m.i100 + 0.01058872*m.i51*m.i52 + 0.01279448*m.i51*m.i53 + 0.0112444*m.i51*
m.i54 + 0.00990216*m.i51*m.i55 + 0.00896022*m.i51*m.i56 + 0.00513818*m.i51*m.i57 + 0.00543454*
m.i51*m.i58 + 0.01870256*m.i51*m.i59 + 0.00309084*m.i51*m.i60 + 0.01767624*m.i51*m.i61 +
0.01208918*m.i51*m.i62 + 0.01086364*m.i51*m.i63 + 0.00670046*m.i51*m.i64 + 0.00877154*m.i51*m.i65
+ 0.00557174*m.i51*m.i66 + 0.00887856*m.i51*m.i67 + 0.00260902*m.i51*m.i68 + 0.01536338*m.i51*
m.i69 + 0.00483316*m.i51*m.i70 + 0.00448378*m.i51*m.i71 + 0.0043601*m.i51*m.i72 + 0.00929772*
m.i51*m.i73 + 0.00989476*m.i51*m.i74 + 0.00528028*m.i51*m.i75 + 0.00446022*m.i51*m.i76 +
0.00845848*m.i51*m.i77 + 0.00509916*m.i51*m.i78 + 0.0204202*m.i51*m.i79 + 0.00800384*m.i51*m.i80
+ 0.00529538*m.i51*m.i81 + 0.0038846*m.i51*m.i82 + 0.00772216*m.i51*m.i83 + 0.009979*m.i51*m.i84
+ 0.010097*m.i51*m.i85 + 0.0139755*m.i51*m.i86 + 0.01131734*m.i51*m.i87 + 0.02533*m.i51*m.i88 +
0.00621034*m.i51*m.i89 + 0.01160734*m.i51*m.i90 + 0.00843408*m.i51*m.i91 + 0.00995326*m.i51*m.i92
+ 0.00455616*m.i51*m.i93 + 0.00533468*m.i51*m.i94 + 0.00929878*m.i51*m.i95 + 0.0142337*m.i51*
m.i96 + 0.01066822*m.i51*m.i97 + 0.00526832*m.i51*m.i98 + 0.01737382*m.i51*m.i99 + 0.01465192*
m.i51*m.i100 + 0.01484222*m.i52*m.i53 + 0.0171371*m.i52*m.i54 + 0.01181392*m.i52*m.i55 +
0.00600344*m.i52*m.i56 + 0.00840878*m.i52*m.i57 + 0.0071463*m.i52*m.i58 + 0.01536778*m.i52*m.i59
+ 0.0071369*m.i52*m.i60 + 0.0280962*m.i52*m.i61 + 0.0210708*m.i52*m.i62 + 0.01590808*m.i52*m.i63
+ 0.01317442*m.i52*m.i64 + 0.0091774*m.i52*m.i65 + 0.0068045*m.i52*m.i66 + 0.01047574*m.i52*
m.i67 + 0.00882116*m.i52*m.i68 + 0.01759098*m.i52*m.i69 + 0.00927774*m.i52*m.i70 + 0.01307496*
m.i52*m.i71 + 0.0115876*m.i52*m.i72 + 0.01090888*m.i52*m.i73 + 0.0112976*m.i52*m.i74 + 0.00919952
*m.i52*m.i75 + 0.00611904*m.i52*m.i76 + 0.0126521*m.i52*m.i77 + 0.0063454*m.i52*m.i78 +
0.01337936*m.i52*m.i79 + 0.01210696*m.i52*m.i80 + 0.01264942*m.i52*m.i81 + 0.00476554*m.i52*m.i82
+ 0.01346924*m.i52*m.i83 + 0.01007318*m.i52*m.i84 + 0.0127267*m.i52*m.i85 + 0.01394736*m.i52*
m.i86 + 0.0099746*m.i52*m.i87 + 0.0311922*m.i52*m.i88 + 0.0079236*m.i52*m.i89 + 0.01182038*m.i52*
m.i90 + 0.01651678*m.i52*m.i91 + 0.01241554*m.i52*m.i92 + 0.0030009*m.i52*m.i93 + 0.00533038*
m.i52*m.i94 + 0.0132025*m.i52*m.i95 + 0.0243106*m.i52*m.i96 + 0.01594256*m.i52*m.i97 + 0.01260958
*m.i52*m.i98 + 0.0156343*m.i52*m.i99 + 0.01771086*m.i52*m.i100 + 0.0153737*m.i53*m.i54 +
0.01383672*m.i53*m.i55 + 0.00715324*m.i53*m.i56 + 0.00943676*m.i53*m.i57 + 0.00990018*m.i53*m.i58
+ 0.01573366*m.i53*m.i59 + 0.00657884*m.i53*m.i60 + 0.0319944*m.i53*m.i61 + 0.029398*m.i53*m.i62
+ 0.01378922*m.i53*m.i63 + 0.01107682*m.i53*m.i64 + 0.01095454*m.i53*m.i65 + 0.00681218*m.i53*
m.i66 + 0.01767184*m.i53*m.i67 + 0.00360916*m.i53*m.i68 + 0.0271974*m.i53*m.i69 + 0.01108326*
m.i53*m.i70 + 0.00659666*m.i53*m.i71 + 0.00877032*m.i53*m.i72 + 0.01135242*m.i53*m.i73 +
0.01814298*m.i53*m.i74 + 0.01264072*m.i53*m.i75 + 0.00851402*m.i53*m.i76 + 0.01433306*m.i53*m.i77
+ 0.00973382*m.i53*m.i78 + 0.025286*m.i53*m.i79 + 0.01345344*m.i53*m.i80 + 0.01259382*m.i53*
m.i81 + 0.0027805*m.i53*m.i82 + 0.000307752*m.i53*m.i83 + 0.0107134*m.i53*m.i84 + 0.01054482*
m.i53*m.i85 + 0.0158905*m.i53*m.i86 + 0.01354224*m.i53*m.i87 + 0.0304602*m.i53*m.i88 + 0.0090225*
m.i53*m.i89 + 0.0279162*m.i53*m.i90 + 0.01259072*m.i53*m.i91 + 0.01154418*m.i53*m.i92 +
0.00696904*m.i53*m.i93 + 0.0036836*m.i53*m.i94 + 0.01605638*m.i53*m.i95 + 0.0430698*m.i53*m.i96
+ 0.01780592*m.i53*m.i97 + 0.01137144*m.i53*m.i98 + 0.0256234*m.i53*m.i99 + 0.0212362*m.i53*
m.i100 + 0.01304758*m.i54*m.i55 + 0.01398616*m.i54*m.i56 + 0.00915664*m.i54*m.i57 + 0.01070596*
m.i54*m.i58 + 0.01499*m.i54*m.i59 + 0.0070249*m.i54*m.i60 + 0.0302542*m.i54*m.i61 + 0.0244214*
m.i54*m.i62 + 0.0228504*m.i54*m.i63 + 0.01378888*m.i54*m.i64 + 0.00915648*m.i54*m.i65 + 0.0089268
*m.i54*m.i66 + 0.010488*m.i54*m.i67 + 0.00997224*m.i54*m.i68 + 0.0229576*m.i54*m.i69 + 0.01077794
*m.i54*m.i70 + 0.01825372*m.i54*m.i71 + 0.01517784*m.i54*m.i72 + 0.01258444*m.i54*m.i73 +
0.01361126*m.i54*m.i74 + 0.01029832*m.i54*m.i75 + 0.00657472*m.i54*m.i76 + 0.01463254*m.i54*m.i77
+ 0.00613474*m.i54*m.i78 + 0.01201368*m.i54*m.i79 + 0.013126*m.i54*m.i80 + 0.01505614*m.i54*
m.i81 + 0.00467872*m.i54*m.i82 + 0.01050702*m.i54*m.i83 + 0.01265914*m.i54*m.i84 + 0.01318044*
m.i54*m.i85 + 0.01473222*m.i54*m.i86 + 0.01110614*m.i54*m.i87 + 0.0261814*m.i54*m.i88 +
0.00783796*m.i54*m.i89 + 0.01294844*m.i54*m.i90 + 0.0192808*m.i54*m.i91 + 0.0139507*m.i54*m.i92
+ 0.00351228*m.i54*m.i93 + 0.0068612*m.i54*m.i94 + 0.01527036*m.i54*m.i95 + 0.0205052*m.i54*
m.i96 + 0.01688726*m.i54*m.i97 + 0.01524852*m.i54*m.i98 + 0.0174601*m.i54*m.i99 + 0.0244266*m.i54
*m.i100 + 0.00673562*m.i55*m.i56 + 0.00707698*m.i55*m.i57 + 0.00734322*m.i55*m.i58 + 0.01405048*
m.i55*m.i59 + 0.00334038*m.i55*m.i60 + 0.0222096*m.i55*m.i61 + 0.01523028*m.i55*m.i62 + 0.0102055
*m.i55*m.i63 + 0.01002768*m.i55*m.i64 + 0.01048288*m.i55*m.i65 + 0.00635712*m.i55*m.i66 +
0.00874464*m.i55*m.i67 + 0.00593524*m.i55*m.i68 + 0.01648812*m.i55*m.i69 + 0.0080135*m.i55*m.i70
+ 0.00887592*m.i55*m.i71 + 0.00847214*m.i55*m.i72 + 0.01055314*m.i55*m.i73 + 0.01129422*m.i55*
m.i74 + 0.00699156*m.i55*m.i75 + 0.00627446*m.i55*m.i76 + 0.01024268*m.i55*m.i77 + 0.00531432*
m.i55*m.i78 + 0.0098513*m.i55*m.i79 + 0.01065934*m.i55*m.i80 + 0.00967318*m.i55*m.i81 +
0.00462964*m.i55*m.i82 + 0.00334858*m.i55*m.i83 + 0.01100528*m.i55*m.i84 + 0.00975296*m.i55*m.i85
+ 0.01214742*m.i55*m.i86 + 0.00846042*m.i55*m.i87 + 0.0242638*m.i55*m.i88 + 0.0054702*m.i55*
m.i89 + 0.01124098*m.i55*m.i90 + 0.0118002*m.i55*m.i91 + 0.01077996*m.i55*m.i92 + 0.00250778*
m.i55*m.i93 + 0.00555816*m.i55*m.i94 + 0.01037364*m.i55*m.i95 + 0.0175302*m.i55*m.i96 +
0.01283314*m.i55*m.i97 + 0.01054116*m.i55*m.i98 + 0.01565736*m.i55*m.i99 + 0.01643682*m.i55*
m.i100 + 0.00563824*m.i56*m.i57 + 0.00909602*m.i56*m.i58 + 0.0103611*m.i56*m.i59 + 0.00370386*
m.i56*m.i60 + 0.01345496*m.i56*m.i61 + 0.01240364*m.i56*m.i62 + 0.01894134*m.i56*m.i63 +
0.00842246*m.i56*m.i64 + 0.00913306*m.i56*m.i65 + 0.0128603*m.i56*m.i66 + 0.00789202*m.i56*m.i67
+ 0.0049437*m.i56*m.i68 + 0.0172921*m.i56*m.i69 + 0.00742364*m.i56*m.i70 + 0.0201228*m.i56*m.i71
+ 0.0118952*m.i56*m.i72 + 0.01088666*m.i56*m.i73 + 0.0107701*m.i56*m.i74 + 0.00409754*m.i56*
m.i75 + 0.00366002*m.i56*m.i76 + 0.01236854*m.i56*m.i77 + 0.00300872*m.i56*m.i78 + 0.0135613*
m.i56*m.i79 + 0.00480806*m.i56*m.i80 + 0.01596128*m.i56*m.i81 + 0.00309564*m.i56*m.i82 +
0.01777436*m.i56*m.i83 + 0.01193038*m.i56*m.i84 + 0.00565974*m.i56*m.i85 + 0.01170688*m.i56*m.i86
+ 0.01022376*m.i56*m.i87 + 0.0163427*m.i56*m.i88 + 0.00612568*m.i56*m.i89 + 0.01115784*m.i56*
m.i90 + 0.00381802*m.i56*m.i91 + 0.0089326*m.i56*m.i92 + 0.0075443*m.i56*m.i93 + 0.00818402*m.i56
*m.i94 + 0.00966992*m.i56*m.i95 + 0.00265106*m.i56*m.i96 + 0.01019204*m.i56*m.i97 + 0.01329902*
m.i56*m.i98 + 0.01411634*m.i56*m.i99 + 0.0138779*m.i56*m.i100 + 0.00474894*m.i57*m.i58 +
0.00767974*m.i57*m.i59 + 0.0043561*m.i57*m.i60 + 0.01478228*m.i57*m.i61 + 0.00989558*m.i57*m.i62
+ 0.00895424*m.i57*m.i63 + 0.0066828*m.i57*m.i64 + 0.00578744*m.i57*m.i65 + 0.00498864*m.i57*
m.i66 + 0.00614268*m.i57*m.i67 + 0.0054738*m.i57*m.i68 + 0.01078148*m.i57*m.i69 + 0.00688352*
m.i57*m.i70 + 0.0068114*m.i57*m.i71 + 0.00628102*m.i57*m.i72 + 0.00701898*m.i57*m.i73 +
0.00848154*m.i57*m.i74 + 0.0066742*m.i57*m.i75 + 0.00450208*m.i57*m.i76 + 0.0074907*m.i57*m.i77
+ 0.00457588*m.i57*m.i78 + 0.00668368*m.i57*m.i79 + 0.00806954*m.i57*m.i80 + 0.00702352*m.i57*
m.i81 + 0.0038917*m.i57*m.i82 + 0.000255196*m.i57*m.i83 + 0.00565464*m.i57*m.i84 + 0.00629044*
m.i57*m.i85 + 0.00649918*m.i57*m.i86 + 0.00619514*m.i57*m.i87 + 0.01578988*m.i57*m.i88 +
0.00523946*m.i57*m.i89 + 0.00717944*m.i57*m.i90 + 0.0080494*m.i57*m.i91 + 0.00534064*m.i57*m.i92
+ 0.00276512*m.i57*m.i93 + 0.00412012*m.i57*m.i94 + 0.00715034*m.i57*m.i95 + 0.01300638*m.i57*
m.i96 + 0.00826382*m.i57*m.i97 + 0.0068466*m.i57*m.i98 + 0.00897648*m.i57*m.i99 + 0.01037138*
m.i57*m.i100 + 0.00646004*m.i58*m.i59 + 0.00186599*m.i58*m.i60 + 0.01246886*m.i58*m.i61 +
0.00999352*m.i58*m.i62 + 0.01381952*m.i58*m.i63 + 0.00855014*m.i58*m.i64 + 0.00465434*m.i58*m.i65
+ 0.00825376*m.i58*m.i66 + 0.00576402*m.i58*m.i67 + 0.00273548*m.i58*m.i68 + 0.01035762*m.i58*
m.i69 + 0.004824*m.i58*m.i70 + 0.01355144*m.i58*m.i71 + 0.00700278*m.i58*m.i72 + 0.00707718*m.i58
*m.i73 + 0.00851974*m.i58*m.i74 + 0.00330912*m.i58*m.i75 + 0.00401842*m.i58*m.i76 + 0.00999942*
m.i58*m.i77 + 0.00277578*m.i58*m.i78 - 0.000989722*m.i58*m.i79 + 0.00742188*m.i58*m.i80 +
0.00901096*m.i58*m.i81 + 0.000981242*m.i58*m.i82 + 0.01290728*m.i58*m.i83 + 0.0083181*m.i58*m.i84
+ 0.00517936*m.i58*m.i85 + 0.00723458*m.i58*m.i86 + 0.0044253*m.i58*m.i87 + 0.0137847*m.i58*
m.i88 + 0.001547694*m.i58*m.i89 + 0.00582604*m.i58*m.i90 + 0.00844516*m.i58*m.i91 + 0.00776542*
m.i58*m.i92 + 0.00182761*m.i58*m.i93 + 0.0023829*m.i58*m.i94 + 0.00628056*m.i58*m.i95 +
0.00690478*m.i58*m.i96 + 0.00802988*m.i58*m.i97 + 0.0076502*m.i58*m.i98 + 0.01085276*m.i58*m.i99
+ 0.0112764*m.i58*m.i100 + 0.00476864*m.i59*m.i60 + 0.025812*m.i59*m.i61 + 0.01805478*m.i59*
m.i62 + 0.0109551*m.i59*m.i63 + 0.00938908*m.i59*m.i64 + 0.01178962*m.i59*m.i65 + 0.0076335*m.i59
*m.i66 + 0.01177666*m.i59*m.i67 + 0.0070214*m.i59*m.i68 + 0.0221478*m.i59*m.i69 + 0.007972*m.i59*
m.i70 + 0.0074733*m.i59*m.i71 + 0.0088486*m.i59*m.i72 + 0.01271666*m.i59*m.i73 + 0.0141508*m.i59*
m.i74 + 0.00914726*m.i59*m.i75 + 0.00537448*m.i59*m.i76 + 0.01084216*m.i59*m.i77 + 0.0073258*
m.i59*m.i78 + 0.0246694*m.i59*m.i79 + 0.01112936*m.i59*m.i80 + 0.00816652*m.i59*m.i81 +
0.00597972*m.i59*m.i82 + 0.00662172*m.i59*m.i83 + 0.01458364*m.i59*m.i84 + 0.01429256*m.i59*m.i85
+ 0.01882618*m.i59*m.i86 + 0.01439702*m.i59*m.i87 + 0.034478*m.i59*m.i88 + 0.0080275*m.i59*m.i89
+ 0.01623632*m.i59*m.i90 + 0.01482176*m.i59*m.i91 + 0.01127396*m.i59*m.i92 + 0.00550568*m.i59*
m.i93 + 0.00798042*m.i59*m.i94 + 0.01294416*m.i59*m.i95 + 0.0212862*m.i59*m.i96 + 0.01627426*
m.i59*m.i97 + 0.0106876*m.i59*m.i98 + 0.021021*m.i59*m.i99 + 0.0210024*m.i59*m.i100 + 0.01016558*
m.i60*m.i61 + 0.00950624*m.i60*m.i62 + 0.00759926*m.i60*m.i63 + 0.00405624*m.i60*m.i64 +
0.00408766*m.i60*m.i65 + 0.001012866*m.i60*m.i66 + 0.00434698*m.i60*m.i67 + 0.00457798*m.i60*
m.i68 + 0.0080193*m.i60*m.i69 + 0.0054101*m.i60*m.i70 + 0.0046192*m.i60*m.i71 + 0.00570946*m.i60*
m.i72 + 0.00452172*m.i60*m.i73 + 0.00634618*m.i60*m.i74 + 0.00624388*m.i60*m.i75 + 0.0033187*
m.i60*m.i76 + 0.00483228*m.i60*m.i77 + 0.00344686*m.i60*m.i78 + 0.0083673*m.i60*m.i79 +
0.00518592*m.i60*m.i80 + 0.00542166*m.i60*m.i81 + 0.0031059*m.i60*m.i82 - 0.001025068*m.i60*m.i83
+ 0.0028835*m.i60*m.i84 + 0.00445296*m.i60*m.i85 + 0.00423572*m.i60*m.i86 + 0.0051822*m.i60*
m.i87 + 0.01112192*m.i60*m.i88 + 0.00500464*m.i60*m.i89 + 0.0062184*m.i60*m.i90 + 0.00602*m.i60*
m.i91 + 0.00246398*m.i60*m.i92 + 0.00288384*m.i60*m.i93 + 0.00278724*m.i60*m.i94 + 0.00626372*
m.i60*m.i95 + 0.01170704*m.i60*m.i96 + 0.00615192*m.i60*m.i97 + 0.00462302*m.i60*m.i98 +
0.00471294*m.i60*m.i99 + 0.00588256*m.i60*m.i100 + 0.0418718*m.i61*m.i62 + 0.0230598*m.i61*m.i63
+ 0.01842282*m.i61*m.i64 + 0.01721234*m.i61*m.i65 + 0.00990124*m.i61*m.i66 + 0.0216044*m.i61*
m.i67 + 0.01473812*m.i61*m.i68 + 0.0394464*m.i61*m.i69 + 0.01716988*m.i61*m.i70 + 0.0195513*m.i61
*m.i71 + 0.0219932*m.i61*m.i72 + 0.01943214*m.i61*m.i73 + 0.020134*m.i61*m.i74 + 0.0174732*m.i61*
m.i75 + 0.01174406*m.i61*m.i76 + 0.01834496*m.i61*m.i77 + 0.01109086*m.i61*m.i78 + 0.0264464*
m.i61*m.i79 + 0.01965936*m.i61*m.i80 + 0.0227546*m.i61*m.i81 + 0.00831452*m.i61*m.i82 +
0.00631004*m.i61*m.i83 + 0.01801602*m.i61*m.i84 + 0.01882322*m.i61*m.i85 + 0.026381*m.i61*m.i86
+ 0.0201168*m.i61*m.i87 + 0.0582994*m.i61*m.i88 + 0.01420784*m.i61*m.i89 + 0.0279352*m.i61*m.i90
+ 0.0260044*m.i61*m.i91 + 0.01994278*m.i61*m.i92 + 0.00558188*m.i61*m.i93 + 0.0100806*m.i61*
m.i94 + 0.0228614*m.i61*m.i95 + 0.0472894*m.i61*m.i96 + 0.0277624*m.i61*m.i97 + 0.0233414*m.i61*
m.i98 + 0.0320998*m.i61*m.i99 + 0.037788*m.i61*m.i100 + 0.0226754*m.i62*m.i63 + 0.01497022*m.i62*
m.i64 + 0.0138219*m.i62*m.i65 + 0.00559668*m.i62*m.i66 + 0.01850946*m.i62*m.i67 + 0.01131414*
m.i62*m.i68 + 0.0392412*m.i62*m.i69 + 0.01609634*m.i62*m.i70 + 0.0216048*m.i62*m.i71 + 0.0216526*
m.i62*m.i72 + 0.0150155*m.i62*m.i73 + 0.01738604*m.i62*m.i74 + 0.01374744*m.i62*m.i75 +
0.00779326*m.i62*m.i76 + 0.01429558*m.i62*m.i77 + 0.0081994*m.i62*m.i78 + 0.024889*m.i62*m.i79 +
0.01494124*m.i62*m.i80 + 0.0229898*m.i62*m.i81 + 0.00445144*m.i62*m.i82 + 0.01114552*m.i62*m.i83
+ 0.01793036*m.i62*m.i84 + 0.01444614*m.i62*m.i85 + 0.01879448*m.i62*m.i86 + 0.01466504*m.i62*
m.i87 + 0.0326604*m.i62*m.i88 + 0.01169144*m.i62*m.i89 + 0.0254028*m.i62*m.i90 + 0.01965996*m.i62
*m.i91 + 0.01132102*m.i62*m.i92 + 0.0046546*m.i62*m.i93 + 0.00635342*m.i62*m.i94 + 0.0209304*
m.i62*m.i95 + 0.040751*m.i62*m.i96 + 0.0251822*m.i62*m.i97 + 0.0238578*m.i62*m.i98 + 0.0225858*
m.i62*m.i99 + 0.0313134*m.i62*m.i100 + 0.01545704*m.i63*m.i64 + 0.01086358*m.i63*m.i65 +
0.00996396*m.i63*m.i66 + 0.00982328*m.i63*m.i67 + 0.00892944*m.i63*m.i68 + 0.024956*m.i63*m.i69
+ 0.0125295*m.i63*m.i70 + 0.0274234*m.i63*m.i71 + 0.0136346*m.i63*m.i72 + 0.0143589*m.i63*m.i73
+ 0.01281966*m.i63*m.i74 + 0.009889*m.i63*m.i75 + 0.00617316*m.i63*m.i76 + 0.0195622*m.i63*m.i77
+ 0.00502572*m.i63*m.i78 + 0.00153262*m.i63*m.i79 + 0.01706792*m.i63*m.i80 + 0.01790944*m.i63*
m.i81 + 0.001490592*m.i63*m.i82 + 0.0267338*m.i63*m.i83 + 0.01586496*m.i63*m.i84 + 0.01166282*
m.i63*m.i85 + 0.01568614*m.i63*m.i86 + 0.00753188*m.i63*m.i87 + 0.0417782*m.i63*m.i88 + 0.0112216
*m.i63*m.i89 + 0.00371206*m.i63*m.i90 + 0.01829192*m.i63*m.i91 + 0.01841964*m.i63*m.i92 +
0.00206622*m.i63*m.i93 + 0.00505172*m.i63*m.i94 + 0.01487174*m.i63*m.i95 + 0.01414348*m.i63*m.i96
+ 0.0156802*m.i63*m.i97 + 0.01823426*m.i63*m.i98 + 0.01258764*m.i63*m.i99 + 0.01994098*m.i63*
m.i100 + 0.00854654*m.i64*m.i65 + 0.01079866*m.i64*m.i66 + 0.00602732*m.i64*m.i67 + 0.00921276*
m.i64*m.i68 + 0.01464414*m.i64*m.i69 + 0.00664932*m.i64*m.i70 + 0.0144736*m.i64*m.i71 +
0.00978338*m.i64*m.i72 + 0.00959208*m.i64*m.i73 + 0.0112566*m.i64*m.i74 + 0.00671142*m.i64*m.i75
+ 0.00408206*m.i64*m.i76 + 0.01167568*m.i64*m.i77 + 0.00375274*m.i64*m.i78 + 0.00404336*m.i64*
m.i79 + 0.00963238*m.i64*m.i80 + 0.0122908*m.i64*m.i81 + 0.001806772*m.i64*m.i82 + 0.01577266*
m.i64*m.i83 + 0.01128074*m.i64*m.i84 + 0.0095111*m.i64*m.i85 + 0.0097723*m.i64*m.i86 + 0.00346618
*m.i64*m.i87 + 0.01289324*m.i64*m.i88 + 0.00453186*m.i64*m.i89 + 0.0078486*m.i64*m.i90 +
0.01310134*m.i64*m.i91 + 0.00985686*m.i64*m.i92 + 0.00257788*m.i64*m.i93 + 0.00260324*m.i64*m.i94
+ 0.0108877*m.i64*m.i95 + 0.01349616*m.i64*m.i96 + 0.01306042*m.i64*m.i97 + 0.01405114*m.i64*
m.i98 + 0.0115142*m.i64*m.i99 + 0.01728302*m.i64*m.i100 + 0.0048225*m.i65*m.i66 + 0.00871696*
m.i65*m.i67 + 0.00504014*m.i65*m.i68 + 0.01673796*m.i65*m.i69 + 0.00728674*m.i65*m.i70 +
0.00969202*m.i65*m.i71 + 0.0082057*m.i65*m.i72 + 0.0103704*m.i65*m.i73 + 0.00998004*m.i65*m.i74
+ 0.00672722*m.i65*m.i75 + 0.00633346*m.i65*m.i76 + 0.00774852*m.i65*m.i77 + 0.00440922*m.i65*
m.i78 + 0.01343946*m.i65*m.i79 + 0.00798994*m.i65*m.i80 + 0.01225132*m.i65*m.i81 + 0.00444398*
m.i65*m.i82 + 0.00673302*m.i65*m.i83 + 0.0109598*m.i65*m.i84 + 0.00683186*m.i65*m.i85 +
0.01183874*m.i65*m.i86 + 0.0090907*m.i65*m.i87 + 0.0283952*m.i65*m.i88 + 0.00785096*m.i65*m.i89
+ 0.01125058*m.i65*m.i90 + 0.00510526*m.i65*m.i91 + 0.00837574*m.i65*m.i92 + 0.00385798*m.i65*
m.i93 + 0.00464904*m.i65*m.i94 + 0.00896456*m.i65*m.i95 + 0.0160694*m.i65*m.i96 + 0.0113557*m.i65
*m.i97 + 0.01155766*m.i65*m.i98 + 0.01443876*m.i65*m.i99 + 0.01238186*m.i65*m.i100 + 0.00548536*
m.i66*m.i67 + 0.00630564*m.i66*m.i68 + 0.00939978*m.i66*m.i69 + 0.00431468*m.i66*m.i70 +
0.01542742*m.i66*m.i71 + 0.0071665*m.i66*m.i72 + 0.00755022*m.i66*m.i73 + 0.00838922*m.i66*m.i74
+ 0.00386922*m.i66*m.i75 + 0.001951058*m.i66*m.i76 + 0.01146338*m.i66*m.i77 + 0.001980078*m.i66*
m.i78 + 0.00444902*m.i66*m.i79 + 0.00356762*m.i66*m.i80 + 0.00956806*m.i66*m.i81 - 0.00023183*
m.i66*m.i82 + 0.01703884*m.i66*m.i83 + 0.01002452*m.i66*m.i84 + 0.0062546*m.i66*m.i85 +
0.00563304*m.i66*m.i86 + 0.00514984*m.i66*m.i87 + 0.01908326*m.i66*m.i88 + 0.00457928*m.i66*m.i89
+ 0.003995*m.i66*m.i90 + 0.0080501*m.i66*m.i91 + 0.00810108*m.i66*m.i92 + 0.00328186*m.i66*m.i93
+ 0.00369064*m.i66*m.i94 + 0.0058103*m.i66*m.i95 + 0.00438208*m.i66*m.i96 + 0.00867896*m.i66*
m.i97 + 0.0114927*m.i66*m.i98 + 0.01103938*m.i66*m.i99 + 0.00981454*m.i66*m.i100 + 0.00310364*
m.i67*m.i68 + 0.0195756*m.i67*m.i69 + 0.00833924*m.i67*m.i70 + 0.01122*m.i67*m.i71 + 0.00862168*
m.i67*m.i72 + 0.00711248*m.i67*m.i73 + 0.00958304*m.i67*m.i74 + 0.00671208*m.i67*m.i75 +
0.00667666*m.i67*m.i76 + 0.00639998*m.i67*m.i77 + 0.00746068*m.i67*m.i78 + 0.0164696*m.i67*m.i79
+ 0.00952472*m.i67*m.i80 + 0.01054908*m.i67*m.i81 + 0.00295206*m.i67*m.i82 + 0.00786538*m.i67*
m.i83 + 0.00812566*m.i67*m.i84 + 0.00774908*m.i67*m.i85 + 0.01084866*m.i67*m.i86 + 0.01179554*
m.i67*m.i87 + 0.022894*m.i67*m.i88 + 0.00619526*m.i67*m.i89 + 0.01517056*m.i67*m.i90 + 0.00567344
*m.i67*m.i91 + 0.00901318*m.i67*m.i92 + 0.00388018*m.i67*m.i93 + 0.0036956*m.i67*m.i94 + 0.008896
*m.i67*m.i95 + 0.021896*m.i67*m.i96 + 0.01327636*m.i67*m.i97 + 0.0109*m.i67*m.i98 + 0.0178563*
m.i67*m.i99 + 0.01328366*m.i67*m.i100 + 0.01361686*m.i68*m.i69 + 0.00764086*m.i68*m.i70 +
0.00794036*m.i68*m.i71 + 0.01077146*m.i68*m.i72 + 0.00701056*m.i68*m.i73 + 0.00764336*m.i68*m.i74
+ 0.01085638*m.i68*m.i75 + 0.00267198*m.i68*m.i76 + 0.00622086*m.i68*m.i77 + 0.0026961*m.i68*
m.i78 + 0.01283914*m.i68*m.i79 + 0.00651186*m.i68*m.i80 + 0.00444824*m.i68*m.i81 + 0.00245108*
m.i68*m.i82 - 0.000724804*m.i68*m.i83 + 0.01001432*m.i68*m.i84 + 0.00659112*m.i68*m.i85 +
0.00798872*m.i68*m.i86 + 0.00378278*m.i68*m.i87 + 0.0249894*m.i68*m.i88 + 0.00935338*m.i68*m.i89
+ 0.00406214*m.i68*m.i90 + 0.01547864*m.i68*m.i91 + 0.0026383*m.i68*m.i92 + 0.001956366*m.i68*
m.i93 + 0.00433104*m.i68*m.i94 + 0.0086862*m.i68*m.i95 + 0.00871594*m.i68*m.i96 + 0.00917804*
m.i68*m.i97 + 0.01147728*m.i68*m.i98 + 0.000904318*m.i68*m.i99 + 0.0095902*m.i68*m.i100 +
0.01716134*m.i69*m.i70 + 0.0210128*m.i69*m.i71 + 0.01970512*m.i69*m.i72 + 0.01824406*m.i69*m.i73
+ 0.0202038*m.i69*m.i74 + 0.0166321*m.i69*m.i75 + 0.0080034*m.i69*m.i76 + 0.01785698*m.i69*m.i77
+ 0.00956708*m.i69*m.i78 + 0.0273938*m.i69*m.i79 + 0.01578286*m.i69*m.i80 + 0.01986548*m.i69*
m.i81 + 0.00472512*m.i69*m.i82 + 0.0064477*m.i69*m.i83 + 0.0205866*m.i69*m.i84 + 0.01485404*m.i69
*m.i85 + 0.0219926*m.i69*m.i86 + 0.01726592*m.i69*m.i87 + 0.044296*m.i69*m.i88 + 0.01519388*m.i69
*m.i89 + 0.0245318*m.i69*m.i90 + 0.019668*m.i69*m.i91 + 0.01322886*m.i69*m.i92 + 0.00622812*m.i69
*m.i93 + 0.00886068*m.i69*m.i94 + 0.0207946*m.i69*m.i95 + 0.0369544*m.i69*m.i96 + 0.0252064*m.i69
*m.i97 + 0.0246794*m.i69*m.i98 + 0.0240826*m.i69*m.i99 + 0.0322226*m.i69*m.i100 + 0.01122678*
m.i70*m.i71 + 0.00985708*m.i70*m.i72 + 0.00817346*m.i70*m.i73 + 0.01042594*m.i70*m.i74 +
0.0087512*m.i70*m.i75 + 0.00587552*m.i70*m.i76 + 0.00956692*m.i70*m.i77 + 0.00604702*m.i70*m.i78
+ 0.01012786*m.i70*m.i79 + 0.00894572*m.i70*m.i80 + 0.00937532*m.i70*m.i81 + 0.0040741*m.i70*
m.i82 + 0.001290572*m.i70*m.i83 + 0.00820512*m.i70*m.i84 + 0.00683756*m.i70*m.i85 + 0.00768078*
m.i70*m.i86 + 0.00827048*m.i70*m.i87 + 0.01990564*m.i70*m.i88 + 0.007123*m.i70*m.i89 + 0.00998564
*m.i70*m.i90 + 0.00953688*m.i70*m.i91 + 0.00558782*m.i70*m.i92 + 0.00342686*m.i70*m.i93 +
0.00568486*m.i70*m.i94 + 0.00914938*m.i70*m.i95 + 0.01630104*m.i70*m.i96 + 0.01110616*m.i70*m.i97
+ 0.010247*m.i70*m.i98 + 0.00833958*m.i70*m.i99 + 0.01265252*m.i70*m.i100 + 0.0220254*m.i71*
m.i72 + 0.0095213*m.i71*m.i73 + 0.01209936*m.i71*m.i74 + 0.00527094*m.i71*m.i75 + 0.00557218*
m.i71*m.i76 + 0.01262004*m.i71*m.i77 + 0.0037353*m.i71*m.i78 - 0.000223588*m.i71*m.i79 +
0.00801532*m.i71*m.i80 + 0.0286786*m.i71*m.i81 + 0.000788336*m.i71*m.i82 + 0.0387752*m.i71*m.i83
+ 0.01552284*m.i71*m.i84 + 0.00720994*m.i71*m.i85 + 0.01148132*m.i71*m.i86 + 0.00870698*m.i71*
m.i87 + 0.028675*m.i71*m.i88 + 0.00544718*m.i71*m.i89 + 0.00673884*m.i71*m.i90 + 0.01008984*m.i71
*m.i91 + 0.01241834*m.i71*m.i92 + 0.0025495*m.i71*m.i93 + 0.00280272*m.i71*m.i94 + 0.00947552*
m.i71*m.i95 + 0.0070495*m.i71*m.i96 + 0.0170916*m.i71*m.i97 + 0.0269036*m.i71*m.i98 + 0.01506306*
m.i71*m.i99 + 0.0206782*m.i71*m.i100 + 0.00925426*m.i72*m.i73 + 0.00967792*m.i72*m.i74 +
0.00847338*m.i72*m.i75 + 0.005213*m.i72*m.i76 + 0.00908662*m.i72*m.i77 + 0.00316872*m.i72*m.i78
+ 0.00898138*m.i72*m.i79 + 0.0069179*m.i72*m.i80 + 0.0151281*m.i72*m.i81 + 0.00348424*m.i72*
m.i82 + 0.01111986*m.i72*m.i83 + 0.01165966*m.i72*m.i84 + 0.0064802*m.i72*m.i85 + 0.00959246*
m.i72*m.i86 + 0.0084611*m.i72*m.i87 + 0.0240956*m.i72*m.i88 + 0.00687054*m.i72*m.i89 + 0.0094553*
m.i72*m.i90 + 0.0110757*m.i72*m.i91 + 0.00543508*m.i72*m.i92 + 0.0037306*m.i72*m.i93 + 0.00500972
*m.i72*m.i94 + 0.01005818*m.i72*m.i95 + 0.01294332*m.i72*m.i96 + 0.01344022*m.i72*m.i97 +
0.01593132*m.i72*m.i98 + 0.0093216*m.i72*m.i99 + 0.01640118*m.i72*m.i100 + 0.01198598*m.i73*m.i74
+ 0.00750544*m.i73*m.i75 + 0.0050216*m.i73*m.i76 + 0.01285904*m.i73*m.i77 + 0.00339452*m.i73*
m.i78 + 0.00891788*m.i73*m.i79 + 0.00948614*m.i73*m.i80 + 0.00944098*m.i73*m.i81 + 0.00409826*
m.i73*m.i82 + 0.00488372*m.i73*m.i83 + 0.01210326*m.i73*m.i84 + 0.00827726*m.i73*m.i85 +
0.0117403*m.i73*m.i86 + 0.00812428*m.i73*m.i87 + 0.031499*m.i73*m.i88 + 0.00909586*m.i73*m.i89 +
0.00829156*m.i73*m.i90 + 0.0112196*m.i73*m.i91 + 0.00781298*m.i73*m.i92 + 0.00380884*m.i73*m.i93
+ 0.00624296*m.i73*m.i94 + 0.01005016*m.i73*m.i95 + 0.01437472*m.i73*m.i96 + 0.011277*m.i73*
m.i97 + 0.01058622*m.i73*m.i98 + 0.0121454*m.i73*m.i99 + 0.01373088*m.i73*m.i100 + 0.01080198*
m.i74*m.i75 + 0.00656182*m.i74*m.i76 + 0.01437682*m.i74*m.i77 + 0.00746976*m.i74*m.i78 +
0.0158128*m.i74*m.i79 + 0.01161714*m.i74*m.i80 + 0.01098286*m.i74*m.i81 + 0.00409892*m.i74*m.i82
+ 0.00263806*m.i74*m.i83 + 0.01368742*m.i74*m.i84 + 0.00966578*m.i74*m.i85 + 0.0126469*m.i74*
m.i86 + 0.0097362*m.i74*m.i87 + 0.0236752*m.i74*m.i88 + 0.0087263*m.i74*m.i89 + 0.01653132*m.i74*
m.i90 + 0.01259886*m.i74*m.i91 + 0.0074886*m.i74*m.i92 + 0.00612882*m.i74*m.i93 + 0.00553384*
m.i74*m.i94 + 0.01256076*m.i74*m.i95 + 0.022837*m.i74*m.i96 + 0.01489052*m.i74*m.i97 + 0.0138654*
m.i74*m.i98 + 0.01608016*m.i74*m.i99 + 0.0185439*m.i74*m.i100 + 0.00483222*m.i75*m.i76 +
0.0084646*m.i75*m.i77 + 0.00605234*m.i75*m.i78 + 0.01627408*m.i75*m.i79 + 0.00784142*m.i75*m.i80
+ 0.00564276*m.i75*m.i81 + 0.00324588*m.i75*m.i82 - 0.00767236*m.i75*m.i83 + 0.00699372*m.i75*
m.i84 + 0.00737608*m.i75*m.i85 + 0.00954642*m.i75*m.i86 + 0.00823136*m.i75*m.i87 + 0.0262748*
m.i75*m.i88 + 0.00948902*m.i75*m.i89 + 0.01252876*m.i75*m.i90 + 0.01423104*m.i75*m.i91 +
0.00521492*m.i75*m.i92 + 0.00397698*m.i75*m.i93 + 0.00422896*m.i75*m.i94 + 0.01025216*m.i75*m.i95
+ 0.021456*m.i75*m.i96 + 0.01000128*m.i75*m.i97 + 0.00860654*m.i75*m.i98 + 0.0079023*m.i75*m.i99
+ 0.01223272*m.i75*m.i100 + 0.00508036*m.i76*m.i77 + 0.00440326*m.i76*m.i78 + 0.00722936*m.i76*
m.i79 + 0.00592748*m.i76*m.i80 + 0.00543106*m.i76*m.i81 + 0.00352072*m.i76*m.i82 + 0.00282876*
m.i76*m.i83 + 0.00421804*m.i76*m.i84 + 0.00327576*m.i76*m.i85 + 0.00605002*m.i76*m.i86 +
0.00724932*m.i76*m.i87 + 0.01581762*m.i76*m.i88 + 0.00366428*m.i76*m.i89 + 0.00812736*m.i76*m.i90
+ 0.00388382*m.i76*m.i91 + 0.0047062*m.i76*m.i92 + 0.00287772*m.i76*m.i93 + 0.00297876*m.i76*
m.i94 + 0.00459654*m.i76*m.i95 + 0.01070758*m.i76*m.i96 + 0.0061617*m.i76*m.i97 + 0.00324936*
m.i76*m.i98 + 0.00970994*m.i76*m.i99 + 0.00690694*m.i76*m.i100 + 0.00393188*m.i77*m.i78 +
0.00648912*m.i77*m.i79 + 0.00880144*m.i77*m.i80 + 0.00990674*m.i77*m.i81 + 0.00277832*m.i77*m.i82
+ 0.01369158*m.i77*m.i83 + 0.01108874*m.i77*m.i84 + 0.00804488*m.i77*m.i85 + 0.0100624*m.i77*
m.i86 + 0.00868852*m.i77*m.i87 + 0.0320896*m.i77*m.i88 + 0.00865688*m.i77*m.i89 + 0.00846622*
m.i77*m.i90 + 0.01262084*m.i77*m.i91 + 0.01111726*m.i77*m.i92 + 0.00462154*m.i77*m.i93 +
0.00718072*m.i77*m.i94 + 0.01147082*m.i77*m.i95 + 0.0176254*m.i77*m.i96 + 0.01224072*m.i77*m.i97
+ 0.00939734*m.i77*m.i98 + 0.012534*m.i77*m.i99 + 0.01295098*m.i77*m.i100 + 0.00907912*m.i78*
m.i79 + 0.00720642*m.i78*m.i80 + 0.00426806*m.i78*m.i81 + 0.0028332*m.i78*m.i82 - 0.001354666*
m.i78*m.i83 + 0.00318608*m.i78*m.i84 + 0.00627032*m.i78*m.i85 + 0.00574778*m.i78*m.i86 +
0.00663794*m.i78*m.i87 + 0.00493084*m.i78*m.i88 + 0.00225816*m.i78*m.i89 + 0.01063042*m.i78*m.i90
+ 0.0063342*m.i78*m.i91 + 0.00541402*m.i78*m.i92 + 0.00268782*m.i78*m.i93 + 0.00290288*m.i78*
m.i94 + 0.00588184*m.i78*m.i95 + 0.01436716*m.i78*m.i96 + 0.00728756*m.i78*m.i97 + 0.00442972*
m.i78*m.i98 + 0.00924454*m.i78*m.i99 + 0.00979098*m.i78*m.i100 + 0.0060581*m.i79*m.i80 +
0.00755126*m.i79*m.i81 + 0.00637932*m.i79*m.i82 - 0.00105651*m.i79*m.i83 + 0.01349704*m.i79*m.i84
+ 0.01178354*m.i79*m.i85 + 0.0220208*m.i79*m.i86 + 0.0245836*m.i79*m.i87 + 0.0524002*m.i79*m.i88
+ 0.0230428*m.i79*m.i89 + 0.0314514*m.i79*m.i90 + 0.00636018*m.i79*m.i91 + 0.0061917*m.i79*m.i92
+ 0.01207768*m.i79*m.i93 + 0.00753416*m.i79*m.i94 + 0.01719794*m.i79*m.i95 + 0.0367202*m.i79*
m.i96 + 0.01636496*m.i79*m.i97 + 0.01053626*m.i79*m.i98 + 0.0223148*m.i79*m.i99 + 0.0125583*m.i79
*m.i100 + 0.00731124*m.i80*m.i81 + 0.0043053*m.i80*m.i82 + 0.00250064*m.i80*m.i83 + 0.00942746*
m.i80*m.i84 + 0.01109824*m.i80*m.i85 + 0.0094077*m.i80*m.i86 + 0.00584688*m.i80*m.i87 +
0.01773876*m.i80*m.i88 + 0.00587054*m.i80*m.i89 + 0.0073899*m.i80*m.i90 + 0.01217556*m.i80*m.i91
+ 0.0092825*m.i80*m.i92 + 0.001672258*m.i80*m.i93 + 0.00403362*m.i80*m.i94 + 0.01001412*m.i80*
m.i95 + 0.01641906*m.i80*m.i96 + 0.01159292*m.i80*m.i97 + 0.01062798*m.i80*m.i98 + 0.00967468*
m.i80*m.i99 + 0.0140493*m.i80*m.i100 + 0.00288116*m.i81*m.i82 + 0.022981*m.i81*m.i83 + 0.01105584
*m.i81*m.i84 + 0.00722284*m.i81*m.i85 + 0.01178602*m.i81*m.i86 + 0.00945868*m.i81*m.i87 +
0.024973*m.i81*m.i88 + 0.00575624*m.i81*m.i89 + 0.01415098*m.i81*m.i90 + 0.0066048*m.i81*m.i91 +
0.01072344*m.i81*m.i92 + 0.00322326*m.i81*m.i93 + 0.00351188*m.i81*m.i94 + 0.01127788*m.i81*m.i95
+ 0.01956074*m.i81*m.i96 + 0.01617428*m.i81*m.i97 + 0.0227228*m.i81*m.i98 + 0.01855842*m.i81*
m.i99 + 0.01991896*m.i81*m.i100 - 0.00333172*m.i82*m.i83 + 0.00228114*m.i82*m.i84 + 0.00336158*
m.i82*m.i85 + 0.00354748*m.i82*m.i86 + 0.00514572*m.i82*m.i87 + 0.00636398*m.i82*m.i88 +
0.00276272*m.i82*m.i89 + 0.00394504*m.i82*m.i90 + 0.00242814*m.i82*m.i91 + 0.00151634*m.i82*m.i92
+ 0.00205258*m.i82*m.i93 + 0.00416174*m.i82*m.i94 + 0.0036601*m.i82*m.i95 + 0.00573294*m.i82*
m.i96 + 0.0040347*m.i82*m.i97 + 0.001040396*m.i82*m.i98 + 0.00519918*m.i82*m.i99 + 0.00479088*
m.i82*m.i100 + 0.01497528*m.i83*m.i84 + 0.0032291*m.i83*m.i85 + 0.01011148*m.i83*m.i86 +
0.00471364*m.i83*m.i87 + 0.0246434*m.i83*m.i88 + 0.000996878*m.i83*m.i89 - 0.00262512*m.i83*m.i90
- 0.000789784*m.i83*m.i91 + 0.01304756*m.i83*m.i92 + 0.000531142*m.i83*m.i93 - 0.000443948*m.i83
*m.i94 + 0.00279848*m.i83*m.i95 - 0.0065326*m.i83*m.i96 + 0.01221224*m.i83*m.i97 + 0.01799712*
m.i83*m.i98 + 0.0158385*m.i83*m.i99 + 0.0071337*m.i83*m.i100 + 0.00892568*m.i84*m.i85 +
0.01364388*m.i84*m.i86 + 0.0072533*m.i84*m.i87 + 0.0326884*m.i84*m.i88 + 0.00896504*m.i84*m.i89
+ 0.00823562*m.i84*m.i90 + 0.0125821*m.i84*m.i91 + 0.00787816*m.i84*m.i92 + 0.00249586*m.i84*
m.i93 + 0.00519262*m.i84*m.i94 + 0.01044988*m.i84*m.i95 + 0.01107886*m.i84*m.i96 + 0.0139867*
m.i84*m.i97 + 0.01596046*m.i84*m.i98 + 0.01218826*m.i84*m.i99 + 0.01543212*m.i84*m.i100 +
0.00990954*m.i85*m.i86 + 0.00725662*m.i85*m.i87 + 0.0133432*m.i85*m.i88 + 0.00507396*m.i85*m.i89
+ 0.00930526*m.i85*m.i90 + 0.01462284*m.i85*m.i91 + 0.01055408*m.i85*m.i92 + 0.00190258*m.i85*
m.i93 + 0.00468802*m.i85*m.i94 + 0.0107648*m.i85*m.i95 + 0.01646608*m.i85*m.i96 + 0.01215728*
m.i85*m.i97 + 0.01028698*m.i85*m.i98 + 0.01183266*m.i85*m.i99 + 0.01660366*m.i85*m.i100 +
0.0120373*m.i86*m.i87 + 0.0422718*m.i86*m.i88 + 0.00969238*m.i86*m.i89 + 0.01765146*m.i86*m.i90
+ 0.01429788*m.i86*m.i91 + 0.0124585*m.i86*m.i92 + 0.0040945*m.i86*m.i93 + 0.0046898*m.i86*m.i94
+ 0.01232074*m.i86*m.i95 + 0.0222548*m.i86*m.i96 + 0.0145479*m.i86*m.i97 + 0.0128277*m.i86*m.i98
+ 0.0192244*m.i86*m.i99 + 0.01947568*m.i86*m.i100 + 0.032904*m.i87*m.i88 + 0.0084843*m.i87*m.i89
+ 0.01591916*m.i87*m.i90 + 0.0059879*m.i87*m.i91 + 0.00789644*m.i87*m.i92 + 0.00607862*m.i87*
m.i93 + 0.00667478*m.i87*m.i94 + 0.0088746*m.i87*m.i95 + 0.01963916*m.i87*m.i96 + 0.01115822*
m.i87*m.i97 + 0.0065973*m.i87*m.i98 + 0.01821046*m.i87*m.i99 + 0.01269924*m.i87*m.i100 + 0.04164*
m.i88*m.i89 + 0.01700894*m.i88*m.i90 + 0.0282218*m.i88*m.i91 + 0.0247666*m.i88*m.i92 + 0.00860626
*m.i88*m.i93 + 0.0146832*m.i88*m.i94 + 0.0207292*m.i88*m.i95 + 0.0482992*m.i88*m.i96 + 0.026772*
m.i88*m.i97 + 0.0300758*m.i88*m.i98 + 0.0329128*m.i88*m.i99 + 0.01375988*m.i88*m.i100 +
0.00594302*m.i89*m.i90 + 0.00801468*m.i89*m.i91 + 0.00437824*m.i89*m.i92 + 0.00302882*m.i89*m.i93
+ 0.0041304*m.i89*m.i94 + 0.00803522*m.i89*m.i95 + 0.01620516*m.i89*m.i96 + 0.00836644*m.i89*
m.i97 + 0.01022328*m.i89*m.i98 + 0.0069101*m.i89*m.i99 + 0.00464412*m.i89*m.i100 + 0.01014268*
m.i90*m.i91 + 0.00890216*m.i90*m.i92 + 0.00857494*m.i90*m.i93 + 0.00416286*m.i90*m.i94 +
0.01435266*m.i90*m.i95 + 0.038709*m.i90*m.i96 + 0.01593092*m.i90*m.i97 + 0.0108455*m.i90*m.i98 +
0.0247362*m.i90*m.i99 + 0.0239224*m.i90*m.i100 + 0.01172504*m.i91*m.i92 - 3.25928e-5*m.i91*m.i93
+ 0.00582154*m.i91*m.i94 + 0.01455814*m.i91*m.i95 + 0.0217724*m.i91*m.i96 + 0.01520358*m.i91*
m.i97 + 0.01361584*m.i91*m.i98 + 0.01107608*m.i91*m.i99 + 0.0218082*m.i91*m.i100 + 0.000834202*
m.i92*m.i93 + 0.00361846*m.i92*m.i94 + 0.00964536*m.i92*m.i95 + 0.01621624*m.i92*m.i96 +
0.01139352*m.i92*m.i97 + 0.01032652*m.i92*m.i98 + 0.01663626*m.i92*m.i99 + 0.01551254*m.i92*
m.i100 + 0.00302326*m.i93*m.i94 + 0.0039602*m.i93*m.i95 + 0.0070366*m.i93*m.i96 + 0.0035814*m.i93
*m.i97 + 0.00156313*m.i93*m.i98 + 0.00599576*m.i93*m.i99 + 0.00427812*m.i93*m.i100 + 0.00550244*
m.i94*m.i95 + 0.00558508*m.i94*m.i96 + 0.0059384*m.i94*m.i97 + 0.00357124*m.i94*m.i98 + 0.0064057
*m.i94*m.i99 + 0.00623724*m.i94*m.i100 + 0.0227304*m.i95*m.i96 + 0.01445112*m.i95*m.i97 +
0.01257804*m.i95*m.i98 + 0.01368382*m.i95*m.i99 + 0.01773414*m.i95*m.i100 + 0.0257114*m.i96*m.i97
+ 0.01933344*m.i96*m.i98 + 0.0317874*m.i96*m.i99 + 0.0306278*m.i96*m.i100 + 0.01873902*m.i97*
m.i98 + 0.01912542*m.i97*m.i99 + 0.0219022*m.i97*m.i100 + 0.01388668*m.i98*m.i99 + 0.0207524*
m.i98*m.i100 + 0.0256994*m.i99*m.i100 - m.x101 <= 0)
m.c2 = Constraint(expr= 0.00411438*m.i1 - 0.0186628*m.i2 - 0.0124176*m.i3 - 0.00587102*m.i4 - 0.0137519*m.i5
- 0.0174501*m.i6 - 0.0143449*m.i7 - 0.135908*m.i8 + 0.0183991*m.i9 - 0.00059102*m.i10
- 0.0458625*m.i11 + 0.00263166*m.i12 - 0.00331355*m.i13 - 0.0367972*m.i14 - 0.0139845*m.i15
- 0.0094868*m.i16 + 0.0248532*m.i17 - 0.0094023*m.i18 + 0.0023017*m.i19 - 0.0464684*m.i20
- 0.00593531*m.i21 - 0.00567252*m.i22 - 0.0053525*m.i23 - 0.0195131*m.i24 - 0.00539281*m.i25
+ 0.00014069*m.i26 - 0.0192418*m.i27 - 0.0094094*m.i28 - 0.00628791*m.i29 - 0.0640481*m.i30
+ 0.00479685*m.i31 - 0.00773524*m.i32 - 0.0181879*m.i33 - 0.0252863*m.i34 - 0.0138439*m.i35
- 0.0175713*m.i36 - 0.0087821*m.i37 - 0.0159321*m.i38 - 0.0116042*m.i39 + 0.0157787*m.i40
- 0.0202007*m.i41 - 0.0126018*m.i42 - 0.00304129*m.i43 - 0.00993*m.i44 - 0.0128447*m.i45
- 0.00181865*m.i46 - 0.0158853*m.i47 - 0.00510726*m.i48 - 0.00213898*m.i49 - 0.030707*m.i50
+ 0.00148868*m.i51 - 0.0125947*m.i52 - 0.00471196*m.i53 - 0.0148213*m.i54 - 0.00451418*m.i55
+ 0.00107459*m.i56 - 0.00272748*m.i57 + 0.00192127*m.i58 - 0.00643836*m.i59 + 0.00659625*m.i60
- 0.0160773*m.i61 - 0.0311089*m.i62 - 0.0220835*m.i63 - 0.0123205*m.i64 - 0.00688571*m.i65
- 0.0329356*m.i66 + 0.00327885*m.i67 - 0.009863*m.i68 - 0.0161333*m.i69 - 0.00415196*m.i70
- 0.0234616*m.i71 - 0.00105996*m.i72 + 0.00381383*m.i73 - 0.00073674*m.i74 - 0.0169568*m.i75
- 0.00559808*m.i76 - 0.0098104*m.i77 - 0.00457398*m.i78 - 0.0417583*m.i79 + 0.00283802*m.i80
- 0.0168204*m.i81 - 0.00228309*m.i82 - 0.0197823*m.i83 - 0.0100875*m.i84 - 0.0118258*m.i85
- 0.00342073*m.i86 - 0.00803049*m.i87 + 0.0213439*m.i88 - 0.0213604*m.i89 - 0.0139007*m.i90
- 0.0183623*m.i91 - 0.012037*m.i92 - 0.00197365*m.i93 - 0.0102456*m.i94 - 0.00369496*m.i95
- 0.00582019*m.i96 - 0.00227006*m.i97 - 0.0248562*m.i98 - 0.0205847*m.i99 - 0.0221142*m.i100
>= 0)
m.c3 = Constraint(expr= 52.59*m.i1 + 28.87*m.i2 + 29.19*m.i3 + 46.55*m.i4 + 24.26*m.i5 + 42.53*m.i6 + 40.53*m.i7
+ 79.56*m.i8 + 108.9*m.i9 + 79.06*m.i10 + 20.15*m.i11 + 35.64*m.i12 + 39.55*m.i13 + 14.32*m.i14
+ 26.41*m.i15 + 62.48*m.i16 + 254.3*m.i17 + 32.42*m.i18 + 24.84*m.i19 + 10.1*m.i20 + 21.2*m.i21
+ 40.25*m.i22 + 17.32*m.i23 + 60.92*m.i24 + 54.73*m.i25 + 78.62*m.i26 + 49.24*m.i27
+ 68.19*m.i28 + 50.3*m.i29 + 3.83*m.i30 + 18.27*m.i31 + 59.67*m.i32 + 12.21*m.i33 + 38.09*m.i34
+ 71.72*m.i35 + 23.6*m.i36 + 70.71*m.i37 + 56.98*m.i38 + 34.47*m.i39 + 10.23*m.i40 + 59.19*m.i41
+ 58.61*m.i42 + 445.29*m.i43 + 131.69*m.i44 + 34.24*m.i45 + 43.11*m.i46 + 25.18*m.i47 + 28*m.i48
+ 19.43*m.i49 + 14.33*m.i50 + 28.41*m.i51 + 74.5*m.i52 + 36.54*m.i53 + 38.99*m.i54 + 43.15*m.i55
+ 199.55*m.i56 + 59.07*m.i57 + 123.55*m.i58 + 20.55*m.i59 + 66.72*m.i60 + 37.95*m.i61
+ 27.62*m.i62 + 23.21*m.i63 + 36.09*m.i64 + 23.09*m.i65 + 46.54*m.i66 + 67.89*m.i67
+ 34.83*m.i68 + 11.96*m.i69 + 45.77*m.i70 + 32.91*m.i71 + 77.37*m.i72 + 21.46*m.i73
+ 53.11*m.i74 + 14.29*m.i75 + 61.13*m.i76 + 32.79*m.i77 + 59.84*m.i78 + 6.59*m.i79 + 14.06*m.i80
+ 55.29*m.i81 + 33.33*m.i82 + 4.24*m.i83 + 23.21*m.i84 + 47.85*m.i85 + 48.99*m.i86 + 57.46*m.i87
+ 28.87*m.i88 + 24.6*m.i89 + 22.26*m.i90 + 28.31*m.i91 + 26.67*m.i92 + 48.1*m.i93 + 28.01*m.i94
+ 64.85*m.i95 + 25.54*m.i96 + 31.47*m.i97 + 18.31*m.i98 + 35.06*m.i99 + 8.06*m.i100 >= 5000)
m.c4 = Constraint(expr= 52.59*m.i1 + 28.87*m.i2 + 29.19*m.i3 + 46.55*m.i4 + 24.26*m.i5 + 42.53*m.i6 + 40.53*m.i7
+ 79.56*m.i8 + 108.9*m.i9 + 79.06*m.i10 + 20.15*m.i11 + 35.64*m.i12 + 39.55*m.i13 + 14.32*m.i14
+ 26.41*m.i15 + 62.48*m.i16 + 254.3*m.i17 + 32.42*m.i18 + 24.84*m.i19 + 10.1*m.i20 + 21.2*m.i21
+ 40.25*m.i22 + 17.32*m.i23 + 60.92*m.i24 + 54.73*m.i25 + 78.62*m.i26 + 49.24*m.i27
+ 68.19*m.i28 + 50.3*m.i29 + 3.83*m.i30 + 18.27*m.i31 + 59.67*m.i32 + 12.21*m.i33 + 38.09*m.i34
+ 71.72*m.i35 + 23.6*m.i36 + 70.71*m.i37 + 56.98*m.i38 + 34.47*m.i39 + 10.23*m.i40 + 59.19*m.i41
+ 58.61*m.i42 + 445.29*m.i43 + 131.69*m.i44 + 34.24*m.i45 + 43.11*m.i46 + 25.18*m.i47 + 28*m.i48
+ 19.43*m.i49 + 14.33*m.i50 + 28.41*m.i51 + 74.5*m.i52 + 36.54*m.i53 + 38.99*m.i54 + 43.15*m.i55
+ 199.55*m.i56 + 59.07*m.i57 + 123.55*m.i58 + 20.55*m.i59 + 66.72*m.i60 + 37.95*m.i61
+ 27.62*m.i62 + 23.21*m.i63 + 36.09*m.i64 + 23.09*m.i65 + 46.54*m.i66 + 67.89*m.i67
+ 34.83*m.i68 + 11.96*m.i69 + 45.77*m.i70 + 32.91*m.i71 + 77.37*m.i72 + 21.46*m.i73
+ 53.11*m.i74 + 14.29*m.i75 + 61.13*m.i76 + 32.79*m.i77 + 59.84*m.i78 + 6.59*m.i79 + 14.06*m.i80
+ 55.29*m.i81 + 33.33*m.i82 + 4.24*m.i83 + 23.21*m.i84 + 47.85*m.i85 + 48.99*m.i86 + 57.46*m.i87
+ 28.87*m.i88 + 24.6*m.i89 + 22.26*m.i90 + 28.31*m.i91 + 26.67*m.i92 + 48.1*m.i93 + 28.01*m.i94
+ 64.85*m.i95 + 25.54*m.i96 + 31.47*m.i97 + 18.31*m.i98 + 35.06*m.i99 + 8.06*m.i100 <= 5500)
| [
"christoph.neumann@kit.edu"
] | christoph.neumann@kit.edu |
8ce9919b642c2bd392dc743194f4ed17aaf8bcc5 | 592c1602789ccc632492e55120e21cd5e67ea2fd | /lib/dataTypes/Summoner.py | 40ffbd41d2f60285f2ba9934c9002f78a67d3a02 | [] | no_license | wcrwcr/py_sh_tray | 9db4c0323b08cde7d723ea7c6b1d649f36195ede | b5b45d6fb8f286ba5f531c95ccadc3641799dc4d | refs/heads/main | 2023-01-05T21:21:51.857241 | 2020-11-05T10:39:45 | 2020-11-05T10:39:45 | 310,266,824 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 507 | py | ''''data type summoner'''
from lib.dataTypes.jsonDefinedData import jsonDefinedData
class Summoner(jsonDefinedData):
id = None
name = None
icon = None
puuid = None
def __init__(self, data):
super(Summoner, self).__init__(data)
self.id = self._json['summonerId'] #unique id for user IN region
self.name = self._json['displayName']
self.icon = self._json['profileIconId']
self.puuid = self._json['puuid'] #unique id for user\region
| [
"tsstsstosser@gmail.com"
] | tsstsstosser@gmail.com |
fadf1813c6bf7b19b811a7796e12fd098027bd47 | 6cf256f10838b23bb1a451551ad511816a3dbb88 | /omaha_server/sparkle/forms.py | 7f01efbd12300d78ac786d24ed0a8dd1d0ef73f3 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | initialjk/omaha-server | 2ab8ba3d54e53c92b4bec512f7ac79dddb74c102 | 92bbb93a84c3d827262f2cfec7976cda7f41f1a2 | refs/heads/master | 2021-01-15T21:10:14.940483 | 2015-04-02T15:19:33 | 2015-04-02T15:19:33 | 32,273,452 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,529 | py | # coding: utf8
"""
This software is licensed under the Apache 2 license, quoted below.
Copyright 2014 Crystalnix Limited
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
"""
from django import forms
from django.forms import widgets
from django.core.files.uploadedfile import UploadedFile
from suit.widgets import LinkedSelect
from suit_redactor.widgets import RedactorWidget
from models import SparkleVersion
__all__ = ['SparkleVersionAdminForm']
class SparkleVersionAdminForm(forms.ModelForm):
class Meta:
model = SparkleVersion
exclude = []
widgets = {
'app': LinkedSelect,
'release_notes': RedactorWidget(editor_options={'lang': 'en',
'minHeight': 150}),
'file_size': widgets.TextInput(attrs=dict(disabled='disabled')),
}
def clean_file_size(self):
file = self.cleaned_data["file"]
if isinstance(file, UploadedFile):
return file.size
return self.initial["file_size"]
| [
"yurtaev.egor@gmail.com"
] | yurtaev.egor@gmail.com |
8d6d28f03e7dba2a24a1999e76fb628096a9fb19 | 486173e490129cec10b15c36903af3d13cfb0950 | /FP-growth/fpGrowthTest.py | 96ee73f6f17be8d5471447071182a3d3d5beda46 | [] | no_license | Hsingmin/MLinAction_on_Python2 | ce3592297cbddf4e7a5c6525b6491b1b37b87ca5 | ac5c5f8a167d3b4a5f7c7ee9e3409136db423ac0 | refs/heads/master | 2021-07-25T10:06:02.933608 | 2017-11-04T08:55:08 | 2017-11-04T08:55:08 | 103,387,222 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,117 | py |
# fpGrowthTest.py
import fpGrowth
from numpy import *
'''
# FP-Tree node create test
rootNode = fpGrowth.treeNode('pyramid', 9, None)
rootNode.children['eye'] = fpGrowth.treeNode('eye', 13, None)
rootNode.children['phoenix'] = fpGrowth.treeNode('phoenix', 3, None)
rootNode.disp()
'''
simData = fpGrowth.loadSimpleData()
print('simData : ' , simData)
initSet = fpGrowth.createInitSet(simData)
print('initSet : ', initSet)
simFPTree, simHeaderTable = fpGrowth.createTree(initSet, 3)
simFPTree.disp()
freqItems = []
fpGrowth.mineTree(simFPTree, simHeaderTable, 3, set([]), freqItems)
print '============ news clicks digging =========== '
parseData = [line.split() for line in open('kosarak.dat').readlines()]
initSet = fpGrowth.createInitSet(parseData)
newFPTree, newFPHeaderTable = fpGrowth.createTree(initSet, 100000)
newFreqList = []
fpGrowth.mineTree(newFPTree, newFPHeaderTable, 100000, set([]), newFreqList)
print 'len(newFreqList = )', len(newFreqList)
print '--------- newFreqList --------'
print newFreqList
| [
"alfred_bit@sina.cn"
] | alfred_bit@sina.cn |
41706151fef1d1cd9a44b39dd33883328f4d028f | e6dab5aa1754ff13755a1f74a28a201681ab7e1c | /.parts/lib/django-1.4/tests/regressiontests/queryset_pickle/__init__.py | 65c7eab6fc54959a02377165342999a088249224 | [] | no_license | ronkagan/Euler_1 | 67679203a9510147320f7c6513eefd391630703e | 022633cc298475c4f3fd0c6e2bde4f4728713995 | refs/heads/master | 2021-01-06T20:45:52.901025 | 2014-09-06T22:34:16 | 2014-09-06T22:34:16 | 23,744,842 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 115 | py | /home/action/.parts/packages/googleappengine/1.9.4/lib/django-1.4/tests/regressiontests/queryset_pickle/__init__.py | [
"ron.y.kagan@gmail.com"
] | ron.y.kagan@gmail.com |
d11cc39e33656680af6cca1dabb70e63e4f5e87c | 1fd59f9fb1331cbb77b8ff14b7ab64e9aadd1db6 | /unittesting/test_crawler/test_get_body.py | 029a0a406d59774592572c0174cea8b90c56ab06 | [] | no_license | saeedghx68/crawler | fccfa19494cd6e631948085c0dfe9949e4f3fecc | a2853f8acfbb1f3a3d19dc4df14db250d19b6d87 | refs/heads/master | 2023-08-04T08:49:39.625588 | 2021-10-31T15:58:18 | 2021-10-31T15:58:18 | 168,580,167 | 10 | 0 | null | 2022-07-06T19:59:11 | 2019-01-31T19:05:22 | Python | UTF-8 | Python | false | false | 761 | py | import unittest
import asyncio
from crawl import Crawler
class TestGetBody(unittest.TestCase):
def setUp(self):
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(None)
def test_valid_url(self):
async def valid_url():
url = 'http://yoyowallet.com'
crawler = Crawler('')
result = await crawler.get_body(url)
self.assertTrue(result)
self.loop.run_until_complete(valid_url())
def test_invalid_url(self):
async def invalid_url():
url = 'http://yoyowalletxxxx.com'
crawler = Crawler('')
result = await crawler.get_body(url)
self.assertEqual(result, '')
self.loop.run_until_complete(invalid_url())
| [
"saeed.ghx68@gmail.com"
] | saeed.ghx68@gmail.com |
edb0c0132192cd46eb1316baeae7a2da78a0f89f | 2312db84a76baf32a918ed9d354dc324c842c3cb | /http/sse/hello-sse/server.py | 56e250a5cc475b1742a82ea0b0e0cf132f53d7f0 | [] | no_license | justdoit0823/notes | a6ec61c2429a76f7d9ac52d8535a97abfa96ee10 | 25da05f9fdd961949c56bcb11711934d53d50c9a | refs/heads/master | 2023-06-22T23:17:17.548741 | 2022-10-19T15:15:15 | 2022-10-19T15:15:15 | 18,003,252 | 13 | 1 | null | 2023-06-14T22:29:39 | 2014-03-22T06:01:28 | Jupyter Notebook | UTF-8 | Python | false | false | 2,283 | py |
"""Hello server send event module."""
import asyncio
import random
import string
import aiohttp
from aiohttp import web
import aiohttp_jinja2
from aiohttp_sse import sse_response
import click
import jinja2
_c_queue_mapping = {}
_shutdown_event = asyncio.Event()
def get_random_string(length):
"""Return fixed length string."""
return ''.join(random.choice(string.ascii_letters) for idx in range(length))
async def _shutdown(*args):
"""Shutdown cleaner."""
print('shutdown...')
_shutdown_event.set()
@aiohttp_jinja2.template('index.html')
async def index_handler(request):
token = get_random_string(32)
return {'token': token}
async def sse_handler(request):
try:
token = request.query['token']
except KeyError:
return web.HTTPBadRequest()
loop = request.app.loop
try:
c_queue = _c_queue_mapping[token]
except KeyError:
c_queue = asyncio.Queue()
_c_queue_mapping[token] = c_queue
async with sse_response(request) as resp:
while not _shutdown_event.is_set():
try:
msg = c_queue.get_nowait()
except asyncio.QueueEmpty:
await asyncio.sleep(0.2)
else:
await resp.send(msg)
return resp
async def push_message_handler(request):
"""Push message to sse client."""
token = request.query['token']
body = request.query['body']
try:
c_queue = _c_queue_mapping[token]
except KeyError:
c_queue = asyncio.Queue()
_c_queue_mapping[token] = c_queue
await c_queue.put(body)
return web.Response(text='ok')
@click.group()
def main():
pass
@main.command('run', help='start websocket server.')
@click.argument('host', type=str, default='127.0.0.1')
@click.argument('port', type=str, default=8989)
def run(**kwargs):
host = kwargs['host']
port = kwargs['port']
app = web.Application()
app.add_routes([
web.get('/', index_handler),
web.get('/sse', sse_handler),
web.get('/pub', push_message_handler)
])
app.on_shutdown.append(_shutdown)
aiohttp_jinja2.setup(app, loader=jinja2.FileSystemLoader('.'))
web.run_app(app, host=host, port=port)
if __name__ == '__main__':
main()
| [
"justdoit920823@gmail.com"
] | justdoit920823@gmail.com |
7ea66eada5f6c4acd8152bcd1f465d7d6d83e9bf | 2e4c7e3706030405cbe0d348b70a8f1df261bbf3 | /aula36.py | 82b165eeb8244e46209a46db2ee7ec116c01c60a | [] | no_license | squintal73/Python | 93b3c8dca2123999aac9c42a58936cb920966746 | e5f3dc91cdf696d146e5f763cbaf1b880533cb1c | refs/heads/master | 2022-11-14T10:23:29.137986 | 2020-07-09T04:10:23 | 2020-07-09T04:10:23 | 276,403,624 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 416 | py | # PRACTICE - PYTHON 036"
# Json
import json
carros_json='{"marca":"Honda","modelo":"HRV","cor":"Prata"}'
carros=json.loads(carros_json)
# for x in carros.values(): imprimi os valores "Honda"
# for x in carros.items(): imprimi os a linha tota ou o item "{"marca":"Honda"}"
# for x in carros(): imprimi a chave "marca"
# for x in carros.items():
# print(x)
for k,v in carros.items():
print(k,v)
| [
"sidnei_quintal@yahoo.com.br"
] | sidnei_quintal@yahoo.com.br |
38070280f5ab47224ff46500b9977e4b3c3b3cf9 | 12df91d7339562c11b572e7d8a4a6ca25f177357 | /二叉树/104.二叉树的最大深度.py | 02cd11b17e1b9b19f4f100e331100684d4f7518c | [] | no_license | snsunlee/LeetCode | a1827132fed8199e638da4d3afb68c222a7ffc57 | a38df8b102081f988c8dcc6deda8caaec575df82 | refs/heads/master | 2021-06-10T10:47:21.226583 | 2021-05-25T11:54:53 | 2021-05-25T11:54:53 | 185,298,882 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 431 | py | #
# @lc app=leetcode.cn id=104 lang=python3
#
# [104] 二叉树的最大深度
#
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def maxDepth(self, root: TreeNode) -> int:
if not root:
return 0
return max(self.maxDepth(root.left),self.maxDepth(root.right))+1
| [
"snsunlee123@gmail.com"
] | snsunlee123@gmail.com |
7a1d94f0c89d9af6c453aaafa6cff4c74c4de9f7 | cb5595fbf1520e1b8ab17836050956fd319e4dee | /hog/hog.py | 9ac9307bee2ba5c316697005baca613b7a6e1de1 | [] | no_license | davidlin0241/SICP-Projects | 3da529abd792e011d7d02f8d305798efa16f74aa | 97d3729aaa3f0b598e501823337c49ba0d543257 | refs/heads/master | 2020-07-23T20:54:25.733657 | 2020-02-17T02:34:23 | 2020-02-17T02:34:23 | 207,703,625 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 12,643 | py | """CS 61A Presents The Game of Hog."""
from dice import six_sided, four_sided, make_test_dice
from ucb import main, trace, interact
GOAL_SCORE = 100 # The goal of Hog is to score 100 points.
######################
# Phase 1: Simulator #
######################
def roll_dice(num_rolls, dice=six_sided):
"""Simulate rolling the DICE exactly NUM_ROLLS > 0 times. Return the sum of
the outcomes unless any of the outcomes is 1. In that case, return 1.
num_rolls: The number of dice rolls that will be made.
dice: A function that simulates a single dice roll outcome.
"""
# These assert statements ensure that num_rolls is a positive integer.
assert type(num_rolls) == int, 'num_rolls must be an integer.'
assert num_rolls > 0, 'Must roll at least once.'
# BEGIN PROBLEM 1
total, pig_out = 0, False
while num_rolls:
roll = dice()
if roll == 1:
pig_out = True
else:
total+=roll
num_rolls-=1
if not pig_out:
return total
else:
return 1
# END PROBLEM 1
def free_bacon(score):
"""Return the points scored from rolling 0 dice (Free Bacon).
score: The opponent's current score.
"""
assert score < 100, 'The game should be over.'
# BEGIN PROBLEM 2
first_digit = score//10
last_digit = score%10
product = first_digit*last_digit
free_bacon_score = product%10 + 1
return free_bacon_score
# END PROBLEM 2
def take_turn(num_rolls, opponent_score, dice=six_sided):
"""Simulate a turn rolling NUM_ROLLS dice, which may be 0 (Free Bacon).
Return the points scored for the turn by the current player.
num_rolls: The number of dice rolls that will be made.
opponent_score: The total score of the opponent.
dice: A function that simulates a single dice roll outcome.
"""
# Leave these assert statements here; they help check for errors.
assert type(num_rolls) == int, 'num_rolls must be an integer.'
assert num_rolls >= 0, 'Cannot roll a negative number of dice in take_turn.'
assert num_rolls <= 10, 'Cannot roll more than 10 dice.'
assert opponent_score < 100, 'The game should be over.'
# BEGIN PROBLEM 3
if num_rolls == 0:
return free_bacon(opponent_score)
else:
return roll_dice(num_rolls, dice)
# END PROBLEM 3
def is_swap(score0, score1):
"""Return whether the current player's score has a ones digit
equal to the opponent's score's tens digit."""
# BEGIN PROBLEM 4
if score0%10 == score1//10:
return True
else:
return False
# END PROBLEM 4
def other(player):
"""Return the other player, for a player PLAYER numbered 0 or 1.
>>> other(0)
1
>>> other(1)
0
"""
return 1 - player
def silence(score0, score1):
"""Announce nothing (see Phase 2)."""
return silence
def play(strategy0, strategy1, score0=0, score1=0, dice=six_sided,
goal=GOAL_SCORE, say=silence):
"""Simulate a game and return the final scores of both players, with Player
0's score first, and Player 1's score second.
A strategy is a function that takes two total scores as arguments (the
current player's score, and the opponent's score), and returns a number of
dice that the current player will roll this turn.
strategy0: The strategy function for Player 0, who plays first.
strategy1: The strategy function for Player 1, who plays second.
score0: Starting score for Player 0
score1: Starting score for Player 1
dice: A function of zero arguments that simulates a dice roll.
goal: The game ends and someone wins when this score is reached.
say: The commentary function to call at the end of the first turn.
"""
player = 0 # Which player is about to take a turn, 0 (first) or 1 (second)
# BEGIN PROBLEM 5
while score0 < goal and score1 < goal:
if player == 0:
num_rolls = strategy0(score0, score1)
score0 += take_turn(num_rolls, score1, dice)
else:
num_rolls = strategy1(score1, score0)
score1 += take_turn(num_rolls, score0, dice)
if player == 0 and is_swap(score0, score1) or player == 1 and is_swap(score1, score0):
score0, score1 = score1, score0
player = other(player)
# END PROBLEM 5
# BEGIN PROBLEM 6
say = say(score0, score1)
# END PROBLEM 6
return score0, score1
#######################
# Phase 2: Commentary #
#######################
def say_scores(score0, score1):
"""A commentary function that announces the score for each player."""
print("Player 0 now has", score0, "and Player 1 now has", score1)
return say_scores
def announce_lead_changes(previous_leader=None):
"""Return a commentary function that announces lead changes.
>>> f0 = announce_lead_changes()
>>> f1 = f0(5, 0)
Player 0 takes the lead by 5
>>> f2 = f1(5, 12)
Player 1 takes the lead by 7
>>> f3 = f2(8, 12)
>>> f4 = f3(8, 13)
>>> f5 = f4(15, 13)
Player 0 takes the lead by 2
"""
def say(score0, score1):
if score0 > score1:
leader = 0
elif score1 > score0:
leader = 1
else:
leader = None
if leader != None and leader != previous_leader:
print('Player', leader, 'takes the lead by', abs(score0 - score1))
return announce_lead_changes(leader)
return say
def both(f, g):
"""Return a commentary function that says what f says, then what g says.
>>> h0 = both(say_scores, announce_lead_changes())
>>> h1 = h0(10, 0)
Player 0 now has 10 and Player 1 now has 0
Player 0 takes the lead by 10
>>> h2 = h1(10, 6)
Player 0 now has 10 and Player 1 now has 6
>>> h3 = h2(6, 18) # Player 0 gets 8 points, then Swine Swap applies
Player 0 now has 6 and Player 1 now has 18
Player 1 takes the lead by 12
"""
def say(score0, score1):
return both(f(score0, score1), g(score0, score1))
return say
def announce_highest(who, previous_high=0, previous_score=0):
"""Return a commentary function that announces when WHO's score
increases by more than ever before in the game.
>>> f0 = announce_highest(1) # Only announce Player 1 score gains
>>> f1 = f0(11, 0)
>>> f2 = f1(11, 9)
9 point(s)! That's the biggest gain yet for Player 1
>>> f3 = f2(20, 9)
>>> f4 = f3(12, 20) # Player 1 gets 3 points, then Swine Swap applies
11 point(s)! That's the biggest gain yet for Player 1
>>> f5 = f4(20, 32) # Player 0 gets 20 points, then Swine Swap applies
12 point(s)! That's the biggest gain yet for Player 1
>>> f6 = f5(20, 42) # Player 1 gets 10 points; not enough for a new high
"""
assert who == 0 or who == 1, 'The who argument should indicate a player.'
# BEGIN PROBLEM 7
def say(score, opponent_score): #passed in order doesn't matter
if who == 1: #with this
score = opponent_score #do not need to update oppoennt_score, not used
turn_score = score - previous_score
if turn_score > previous_high:
high = turn_score
print(turn_score, "point(s)! That's the biggest gain yet for Player", who)
else:
high = previous_high
return announce_highest(who, high, score)
return say
# END PROBLEM 7
#######################
# Phase 3: Strategies #
#######################
def always_roll(n):
"""Return a strategy that always rolls N dice.
A strategy is a function that takes two total scores as arguments (the
current player's score, and the opponent's score), and returns a number of
dice that the current player will roll this turn.
>>> strategy = always_roll(5)
>>> strategy(0, 0)
5
>>> strategy(99, 99)
5
"""
def strategy(score, opponent_score):
return n
return strategy
def make_averaged(fn, num_samples=1000):
"""Return a function that returns the average value of FN when called.
To implement this function, you will have to use *args syntax, a new Python
feature introduced in this project. See the project description.
>>> dice = make_test_dice(4, 2, 5, 1)
>>> averaged_dice = make_averaged(dice, 1000)
>>> averaged_dice()
3.0
"""
# BEGIN PROBLEM 8
def helper(*args):
i = num_samples
result = 0
while i>0:
result += fn(*args)
i-=1
average = result / num_samples
return average
return helper
# END PROBLEM 8
def max_scoring_num_rolls(dice=six_sided, num_samples=1000):
"""Return the number of dice (1 to 10) that gives the highest average turn
score by calling roll_dice with the provided DICE over NUM_SAMPLES times.
Assume that the dice always return positive outcomes.
>>> dice = make_test_dice(1, 6)
>>> max_scoring_num_rolls(dice)
1
"""
# BEGIN PROBLEM 9
rolls, highest_average, make_averager = 1, 0, make_averaged(roll_dice, num_samples)
while rolls<=10:
average = make_averager(rolls, dice)
if average > highest_average:
highest_average = average
highest_roll = rolls
rolls += 1
return highest_roll
# END PROBLEM 9
def winner(strategy0, strategy1):
"""Return 0 if strategy0 wins against strategy1, and 1 otherwise."""
score0, score1 = play(strategy0, strategy1)
if score0 > score1:
return 0
else:
return 1
def average_win_rate(strategy, baseline=always_roll(4)):
"""Return the average win rate of STRATEGY against BASELINE. Averages the
winrate when starting the game as player 0 and as player 1.
"""
win_rate_as_player_0 = 1 - make_averaged(winner)(strategy, baseline)
win_rate_as_player_1 = make_averaged(winner)(baseline, strategy)
return (win_rate_as_player_0 + win_rate_as_player_1) / 2
def run_experiments():
"""Run a series of strategy experiments and report results."""
if True: # Change to False when done finding max_scoring_num_rolls
six_sided_max = max_scoring_num_rolls(six_sided)
print('Max scoring num rolls for six-sided dice:', six_sided_max)
if False: # Change to True to test always_roll(8)
print('always_roll(8) win rate:', average_win_rate(always_roll(8)))
if False: # Change to True to test bacon_strategy
print('bacon_strategy win rate:', average_win_rate(bacon_strategy))
if False: # Change to True to test swap_strategy
print('swap_strategy win rate:', average_win_rate(swap_strategy))
if False: # Change to True to test final_strategy
print('final_strategy win rate:', average_win_rate(final_strategy))
"*** You may add additional experiments as you wish ***"
def bacon_strategy(score, opponent_score, margin=8, num_rolls=4):
"""This strategy rolls 0 dice if that gives at least MARGIN points, and
rolls NUM_ROLLS otherwise.
"""
# BEGIN PROBLEM 10
if free_bacon(opponent_score) >= margin:
return 0
else:
return num_rolls
# END PROBLEM 10
def swap_strategy(score, opponent_score, margin=8, num_rolls=4):
"""This strategy rolls 0 dice when it triggers a beneficial swap. It also
rolls 0 dice if it gives at least MARGIN points. Otherwise, it rolls
NUM_ROLLS.
"""
# BEGIN PROBLEM 11
free_bacon_score = free_bacon(opponent_score)
total_bacon = score + free_bacon_score
if free_bacon_score >= margin or is_swap(total_bacon, opponent_score):
return 0
else:
return num_rolls
# END PROBLEM 11
def final_strategy(score, opponent_score):
"""Write a brief description of your final strategy.
*** YOUR DESCRIPTION HERE ***
"""
# BEGIN PROBLEM 12
return 4 # Replace this statement
# END PROBLEM 12
##########################
# Command Line Interface #
##########################
# NOTE: Functions in this section do not need to be changed. They use features
# of Python not yet covered in the course.
@main
def run(*args):
"""Read in the command-line argument and calls corresponding functions.
This function uses Python syntax/techniques not yet covered in this course.
"""
import argparse
parser = argparse.ArgumentParser(description="Play Hog")
parser.add_argument('--run_experiments', '-r', action='store_true',
help='Runs strategy experiments')
args = parser.parse_args()
if args.run_experiments:
run_experiments()
| [
"davidlin0241@gmail.com"
] | davidlin0241@gmail.com |
c0814e43f0e2e81f7a2ea1755c40e656f739b742 | 38c10c01007624cd2056884f25e0d6ab85442194 | /third_party/skia/gyp/tools.gyp | a4f8cfd62ab9ccea85060ad32dc63ec9fff9cb5e | [
"BSD-3-Clause",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-public-domain"
] | permissive | zenoalbisser/chromium | 6ecf37b6c030c84f1b26282bc4ef95769c62a9b2 | e71f21b9b4b9b839f5093301974a45545dad2691 | refs/heads/master | 2022-12-25T14:23:18.568575 | 2016-07-14T21:49:52 | 2016-07-23T08:02:51 | 63,980,627 | 0 | 2 | BSD-3-Clause | 2022-12-12T12:43:41 | 2016-07-22T20:14:04 | null | UTF-8 | Python | false | false | 19,668 | gyp | # Copyright 2015 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# GYP file to build various tools.
#
# To build on Linux:
# ./gyp_skia tools.gyp && make tools
#
{
'includes': [
'apptype_console.gypi',
],
'targets': [
{
# Build all executable targets defined below.
'target_name': 'tools',
'type': 'none',
'dependencies': [
'bitmap_region_decoder',
'chrome_fuzz',
'filter',
'gpuveto',
'imgblur',
'imgconv',
'imgslice',
'lua_app',
'lua_pictures',
'pinspect',
'render_pdfs',
'skdiff',
'skhello',
'skpdiff',
'skpinfo',
'skpmaker',
'test_image_decoder',
'test_public_includes',
'whitelist_typefaces',
],
'conditions': [
['skia_shared_lib',
{
'dependencies': [
'sklua', # This can only be built if skia is built as a shared library
],
},
],
],
},
{
'target_name': 'bitmap_region_decoder',
'type': 'static_library',
'sources': [
'../tools/SkBitmapRegionCanvas.cpp',
'../tools/SkBitmapRegionCodec.cpp',
'../tools/SkBitmapRegionDecoderInterface.cpp',
'../tools/SkBitmapRegionSampler.cpp',
],
'include_dirs': [
'../include/private',
'../src/codec',
],
'dependencies': [
'skia_lib.gyp:skia_lib',
],
},
{
'target_name': 'chrome_fuzz',
'type': 'executable',
'sources': [
'../tools/chrome_fuzz.cpp',
],
'dependencies': [
'skia_lib.gyp:skia_lib',
],
},
{
'target_name': 'crash_handler',
'type': 'static_library',
'sources': [ '../tools/CrashHandler.cpp' ],
'dependencies': [ 'skia_lib.gyp:skia_lib' ],
'direct_dependent_settings': {
'include_dirs': [ '../tools' ],
},
'conditions': [
[ 'skia_is_bot', {
'defines': [ 'SK_CRASH_HANDLER' ],
}],
],
'all_dependent_settings': {
'msvs_settings': {
'VCLinkerTool': {
'AdditionalDependencies': [ 'Dbghelp.lib' ],
}
},
}
},
{
'target_name': 'resources',
'type': 'static_library',
'sources': [ '../tools/Resources.cpp' ],
'dependencies': [
'flags.gyp:flags',
'skia_lib.gyp:skia_lib',
],
'direct_dependent_settings': {
'include_dirs': [ '../tools', ],
},
},
{
'target_name': 'sk_tool_utils',
'type': 'static_library',
'sources': [
'../tools/sk_tool_utils.cpp',
'../tools/sk_tool_utils_font.cpp',
],
'include_dirs': [
'../include/private',
'../src/fonts',
'../src/core',
],
'dependencies': [
'resources',
'flags.gyp:flags',
'skia_lib.gyp:skia_lib',
],
'direct_dependent_settings': {
'include_dirs': [ '../tools', ],
},
},
{
'target_name' : 'timer',
'type': 'static_library',
'sources': [ '../tools/timer/Timer.cpp' ],
'direct_dependent_settings': {
'include_dirs': ['../tools/timer'],
},
'dependencies': [ 'skia_lib.gyp:skia_lib' ],
},
{
'target_name': 'skdiff',
'type': 'executable',
'sources': [
'../tools/skdiff.cpp',
'../tools/skdiff.h',
'../tools/skdiff_html.cpp',
'../tools/skdiff_html.h',
'../tools/skdiff_main.cpp',
'../tools/skdiff_utils.cpp',
'../tools/skdiff_utils.h',
],
'dependencies': [
'skia_lib.gyp:skia_lib',
],
'xcode_settings': {
'conditions': [
[ 'skia_osx_deployment_target==""', {
'MACOSX_DEPLOYMENT_TARGET': '10.7', # -mmacos-version-min, passed in env to ld.
}, {
'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
}],
],
'CLANG_CXX_LIBRARY': 'libc++',
},
},
{
'target_name': 'skpdiff',
'type': 'executable',
'sources': [
'../tools/skpdiff/skpdiff_main.cpp',
'../tools/skpdiff/SkDiffContext.cpp',
'../tools/skpdiff/SkImageDiffer.cpp',
'../tools/skpdiff/SkPMetric.cpp',
'../tools/skpdiff/skpdiff_util.cpp',
],
'include_dirs': [
'../include/private',
'../src/core/', # needed for SkTLList.h
'../tools/', # needed for picture_utils::replace_char
],
'dependencies': [
'flags.gyp:flags',
'skia_lib.gyp:skia_lib',
'tools.gyp:picture_utils',
],
'cflags': [
'-O3',
],
'conditions': [
[ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "chromeos"]', {
'link_settings': {
'libraries': [
'-lrt',
'-pthread',
],
},
}],
['skia_opencl', {
'sources': [
'../tools/skpdiff/SkCLImageDiffer.cpp',
'../tools/skpdiff/SkDifferentPixelsMetric_opencl.cpp',
],
'conditions': [
[ 'skia_os == "mac"', {
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/OpenCL.framework',
]
}
}, {
'link_settings': {
'libraries': [
'-lOpenCL',
],
},
}],
],
}, { # !skia_opencl
'sources': [
'../tools/skpdiff/SkDifferentPixelsMetric_cpu.cpp',
],
}],
],
},
{
'target_name': 'skpmaker',
'type': 'executable',
'sources': [
'../tools/skpmaker.cpp',
],
'include_dirs': [
'../include/private',
'../src/core',
],
'dependencies': [
'flags.gyp:flags',
'skia_lib.gyp:skia_lib',
],
},
{
'target_name': 'skimagediff',
'type': 'executable',
'sources': [
'../tools/skdiff.cpp',
'../tools/skdiff.h',
'../tools/skdiff_html.cpp',
'../tools/skdiff_html.h',
'../tools/skdiff_image.cpp',
'../tools/skdiff_utils.cpp',
'../tools/skdiff_utils.h',
],
'dependencies': [
'skia_lib.gyp:skia_lib',
],
},
{
'target_name': 'skhello',
'type': 'executable',
'dependencies': [
'flags.gyp:flags',
'pdf.gyp:pdf',
'skia_lib.gyp:skia_lib',
],
'sources': [
'../tools/skhello.cpp',
],
},
{
'target_name': 'skpinfo',
'type': 'executable',
'sources': [
'../tools/skpinfo.cpp',
],
'include_dirs': [
'../include/private',
'../src/core/',
],
'dependencies': [
'flags.gyp:flags',
'skia_lib.gyp:skia_lib',
],
},
{
'target_name': 'imgblur',
'type': 'executable',
'sources': [
'../tools/imgblur.cpp',
],
'include_dirs': [
'../include/core',
],
'dependencies': [
'flags.gyp:flags',
'flags.gyp:flags_common',
'skia_lib.gyp:skia_lib',
'tools.gyp:sk_tool_utils',
],
},
{
'target_name': 'imgslice',
'type': 'executable',
'sources': [
'../tools/imgslice.cpp',
],
'include_dirs': [
'../include/core',
],
'dependencies': [
'flags.gyp:flags',
'skia_lib.gyp:skia_lib',
],
},
{
'target_name': 'lazy_decode_bitmap',
'type': 'static_library',
'sources': [ '../tools/LazyDecodeBitmap.cpp' ],
'include_dirs': [
'../include/private',
'../src/core',
'../src/lazy',
],
'dependencies': [
'flags.gyp:flags',
'skia_lib.gyp:skia_lib'
],
},
{
'target_name': 'gpuveto',
'type': 'executable',
'sources': [
'../tools/gpuveto.cpp',
],
'include_dirs': [
'../include/private',
'../src/core/',
'../src/images',
],
'dependencies': [
'lazy_decode_bitmap',
'flags.gyp:flags',
'skia_lib.gyp:skia_lib',
],
},
{
'target_name': 'lua_app',
'type': 'executable',
'sources': [
'../tools/lua/lua_app.cpp',
'../src/utils/SkLua.cpp',
],
'include_dirs': [
'../include/private',
# Lua exposes GrReduceClip which in turn requires src/core for SkTLList
'../src/gpu/',
'../src/core/',
],
'dependencies': [
'effects.gyp:effects',
'images.gyp:images',
'lua.gyp:lua',
'pdf.gyp:pdf',
'ports.gyp:ports',
'skia_lib.gyp:skia_lib',
],
},
{
'target_name': 'lua_pictures',
'type': 'executable',
'sources': [
'../tools/lua/lua_pictures.cpp',
'../src/utils/SkLuaCanvas.cpp',
'../src/utils/SkLua.cpp',
],
'include_dirs': [
'../include/private',
# Lua exposes GrReduceClip which in turn requires src/core for SkTLList
'../src/gpu/',
'../src/core/',
],
'dependencies': [
'lazy_decode_bitmap',
'effects.gyp:effects',
'flags.gyp:flags',
'images.gyp:images',
'lua.gyp:lua',
'tools.gyp:picture_utils',
'pdf.gyp:pdf',
'ports.gyp:ports',
'skia_lib.gyp:skia_lib',
],
},
{
'target_name': 'picture_renderer',
'type': 'static_library',
'sources': [
'../tools/PictureRenderer.h',
'../tools/PictureRenderer.cpp',
],
'include_dirs': [
'../include/private',
'../src/core',
'../src/images',
'../src/lazy',
'../src/pipe/utils/',
'../src/utils/',
],
'dependencies': [
'lazy_decode_bitmap',
'flags.gyp:flags',
'jsoncpp.gyp:jsoncpp',
'skia_lib.gyp:skia_lib',
'tools.gyp:picture_utils',
],
'conditions': [
['skia_gpu == 1',
{
'include_dirs' : [
'../src/gpu',
],
'dependencies': [
'gputest.gyp:skgputest',
],
'export_dependent_settings': [
'gputest.gyp:skgputest',
],
},
],
],
},
{
'target_name': 'render_pdfs',
'type': 'executable',
'sources': [
'../tools/render_pdfs_main.cpp',
],
'include_dirs': [
'../include/private',
'../src/core',
'../src/pipe/utils/',
'../src/utils/',
],
'dependencies': [
'flags.gyp:flags',
'pdf.gyp:pdf',
'skia_lib.gyp:skia_lib',
'tools.gyp:picture_utils',
'tools.gyp:proc_stats',
],
'conditions': [
['skia_win_debuggers_path and skia_os == "win"',
{
'dependencies': [
'tools.gyp:win_dbghelp',
],
},
],
# VS static libraries don't have a linker option. We must set a global
# project linker option, or add it to each executable.
['skia_win_debuggers_path and skia_os == "win" and '
'skia_arch_type == "x86_64"',
{
'msvs_settings': {
'VCLinkerTool': {
'AdditionalDependencies': [
'<(skia_win_debuggers_path)/x64/DbgHelp.lib',
],
},
},
},
],
['skia_win_debuggers_path and skia_os == "win" and '
'skia_arch_type == "x86"',
{
'msvs_settings': {
'VCLinkerTool': {
'AdditionalDependencies': [
'<(skia_win_debuggers_path)/DbgHelp.lib',
],
},
},
},
],
],
},
{
'target_name': 'picture_utils',
'type': 'static_library',
'sources': [
'../tools/picture_utils.cpp',
'../tools/picture_utils.h',
],
'dependencies': [
'skia_lib.gyp:skia_lib',
],
'direct_dependent_settings': {
'include_dirs': [
'../tools/',
],
},
},
{
'target_name': 'pinspect',
'type': 'executable',
'sources': [
'../tools/pinspect.cpp',
],
'dependencies': [
'lazy_decode_bitmap',
'flags.gyp:flags',
'skia_lib.gyp:skia_lib',
],
},
{
'target_name': 'imgconv',
'type': 'executable',
'sources': [
'../tools/imgconv.cpp',
],
'dependencies': [
'flags.gyp:flags',
'skia_lib.gyp:skia_lib',
],
},
{
'target_name': 'filter',
'type': 'executable',
'include_dirs' : [
'../include/private',
'../src/core',
'../src/utils/debugger',
],
'sources': [
'../tools/filtermain.cpp',
'../src/utils/debugger/SkDrawCommand.h',
'../src/utils/debugger/SkDrawCommand.cpp',
'../src/utils/debugger/SkDebugCanvas.h',
'../src/utils/debugger/SkDebugCanvas.cpp',
'../src/utils/debugger/SkObjectParser.h',
'../src/utils/debugger/SkObjectParser.cpp',
],
'dependencies': [
'skia_lib.gyp:skia_lib',
'tools.gyp:picture_utils',
],
},
{
'target_name': 'test_image_decoder',
'type': 'executable',
'sources': [
'../tools/test_image_decoder.cpp',
],
'dependencies': [
'skia_lib.gyp:skia_lib',
],
},
{
'target_name': 'proc_stats',
'type': 'static_library',
'sources': [
'../tools/ProcStats.h',
'../tools/ProcStats.cpp',
],
'direct_dependent_settings': {
'include_dirs': [ '../tools', ],
},
},
{
'target_name': 'whitelist_typefaces',
'type': 'executable',
'sources': [
'../tools/whitelist_typefaces.cpp',
],
'dependencies': [
'skia_lib.gyp:skia_lib',
],
},
{
'target_name': 'test_public_includes',
'type': 'static_library',
# Ensure that our public headers don't have unused params so that clients
# (e.g. Android) that include us can build with these warnings enabled
'cflags!': [ '-Wno-unused-parameter' ],
'variables': {
'includes_to_test': [
'<(skia_include_path)/animator',
'<(skia_include_path)/c',
'<(skia_include_path)/config',
'<(skia_include_path)/core',
'<(skia_include_path)/effects',
'<(skia_include_path)/gpu',
'<(skia_include_path)/images',
'<(skia_include_path)/pathops',
'<(skia_include_path)/pipe',
'<(skia_include_path)/ports',
'<(skia_include_path)/svg/parser',
'<(skia_include_path)/utils',
'<(skia_include_path)/views',
'<(skia_include_path)/xml',
],
'paths_to_ignore': [
'<(skia_include_path)/gpu/gl/GrGLConfig_chrome.h',
'<(skia_include_path)/ports/SkAtomics_std.h',
'<(skia_include_path)/ports/SkAtomics_atomic.h',
'<(skia_include_path)/ports/SkAtomics_sync.h',
'<(skia_include_path)/ports/SkFontMgr_fontconfig.h',
'<(skia_include_path)/ports/SkTypeface_mac.h',
'<(skia_include_path)/ports/SkTypeface_win.h',
'<(skia_include_path)/utils/ios',
'<(skia_include_path)/utils/mac',
'<(skia_include_path)/utils/win',
'<(skia_include_path)/utils/SkDebugUtils.h',
'<(skia_include_path)/utils/SkJSONCPP.h',
'<(skia_include_path)/views/animated',
'<(skia_include_path)/views/SkOSWindow_Android.h',
'<(skia_include_path)/views/SkOSWindow_iOS.h',
'<(skia_include_path)/views/SkOSWindow_Mac.h',
'<(skia_include_path)/views/SkOSWindow_SDL.h',
'<(skia_include_path)/views/SkOSWindow_Unix.h',
'<(skia_include_path)/views/SkOSWindow_Win.h',
'<(skia_include_path)/views/SkWindow.h',
],
},
'include_dirs': [
'<@(includes_to_test)',
],
'sources': [
# unused_param_test.cpp is generated by the action below.
'<(INTERMEDIATE_DIR)/test_public_includes.cpp',
],
'actions': [
{
'action_name': 'generate_includes_cpp',
'inputs': [
'../tools/generate_includes_cpp.py',
'<@(includes_to_test)',
# This causes the gyp generator on mac to fail
#'<@(paths_to_ignore)',
],
'outputs': [
'<(INTERMEDIATE_DIR)/test_public_includes.cpp',
],
'action': ['python', '../tools/generate_includes_cpp.py',
'--ignore', '<(paths_to_ignore)',
'<@(_outputs)', '<@(includes_to_test)'],
},
],
},
],
'conditions': [
['skia_shared_lib',
{
'targets': [
{
'target_name': 'sklua',
'product_name': 'skia',
'product_prefix': '',
'product_dir': '<(PRODUCT_DIR)/',
'type': 'shared_library',
'sources': [
'../src/utils/SkLuaCanvas.cpp',
'../src/utils/SkLua.cpp',
],
'include_dirs': [
'../include/private',
# Lua exposes GrReduceClip which in turn requires src/core for SkTLList
'../src/gpu/',
'../src/core/',
'../third_party/lua/src/',
],
'dependencies': [
'lua.gyp:lua',
'pdf.gyp:pdf',
'skia_lib.gyp:skia_lib',
],
'conditions': [
['skia_os != "win"',
{
'ldflags': [
'-Wl,-rpath,\$$ORIGIN,--enable-new-dtags',
],
},
],
],
},
],
},
],
['skia_win_debuggers_path and skia_os == "win"',
{
'targets': [
{
'target_name': 'win_dbghelp',
'type': 'static_library',
'defines': [
'SK_CDB_PATH="<(skia_win_debuggers_path)"',
],
'sources': [
'../tools/win_dbghelp.h',
'../tools/win_dbghelp.cpp',
],
},
],
},
],
['skia_os == "win"',
{
'targets': [
{
'target_name': 'win_lcid',
'type': 'executable',
'sources': [
'../tools/win_lcid.cpp',
],
},
],
},
],
['skia_os == "mac"',
{
'targets': [
{
'target_name': 'create_test_font',
'type': 'executable',
'sources': [
'../tools/create_test_font.cpp',
],
'include_dirs': [
'../include/private',
'../src/core',
],
'dependencies': [
'flags.gyp:flags',
'skia_lib.gyp:skia_lib',
'resources',
],
},
],
},
],
],
}
| [
"zeno.albisser@hemispherian.com"
] | zeno.albisser@hemispherian.com |
873e6ba1c033baa76178ee1abf218c693f385f53 | bd390260329556fcd81f008e9f0d67ab25ab9ec8 | /CatchDownload.py | f0dbecc8e6726f7842d96ee23785768a72bbce9a | [] | no_license | VLSMB/Millia-The-Ending-CHS-Patch | 3449bff5ac560dc7dec4b3dc32ebddbc59b1d10d | 12f2b447e04883d9cbc2c1eba5c824d9fadd29b1 | refs/heads/main | 2023-07-03T21:00:06.368701 | 2021-08-09T02:59:14 | 2021-08-09T02:59:14 | 393,949,173 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,478 | py | from bs4 import BeautifulSoup
import requests,re
#获取ys168网盘根目录信息
headersA = {"Accept":"*/*","Accept-Encoding":"gzip, deflate","Accept-Language":"zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2","Connection":"keep-alive","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8","Cookie":"__yjs_duid=1_e53c16f308d9b8131bdc5b429c95189d1627049806932; ASP.NET_SessionId=f3safvppika35va5qrk0tvew","Host":"cb.ys168.com","Referer":"http://cb.ys168.com/f_ht/ajcx/000ht.html?bbh=1139","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0"}
responseA = requests.get("http://cb.ys168.com/f_ht/ajcx/ml.aspx?cz=ml_dq&_dlmc=vlsmb&_dlmm=",headers=headersA)
soupA = BeautifulSoup(responseA.text,features="lxml")
#获取二级目录
headersB = {"Accept":"*/*","Accept-Encoding":"gzip, deflate","Accept-Language":"zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2","Connection":"keep-alive","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8","Cookie":"__yjs_duid=1_e53c16f308d9b8131bdc5b429c95189d1627049806932; ASP.NET_SessionId=3jgr5biwyp4sbyeaoiel55vt","Host":"cb.ys168.com","Referer":"http://cb.ys168.com/f_ht/ajcx/000ht.html?bbh=1139","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0"}
responseB = requests.get("http://cb.ys168.com/f_ht/ajcx/wj.aspx?cz=dq&jsq=0&mlbh=2182217&wjpx=1&_dlmc=vlsmb&_dlmm=",headers=headersB)
soupB = BeautifulSoup(responseB.text,features="lxml")
#找到所有所需要的文件(包括文件夹)
#提取名称,0位游戏相关介绍V1.5.pdf,1位AllCode.zip,2位MTE_PatchCHSV2.0.part3.cjxpak,
# 3位MTE_PatchCHSV2.0.part2.cjxpak,4位MTE_PatchCHSV2.0.part1.cjxpak
DLnames=[]
DLlinksA=[]
DLlinks=[]
for tempsoup in soupB.findAll("a"):
DLnames.append(tempsoup.text.replace(" ","").replace("\n",""))
if re.findall(r'<a\shref=".*"\stitle',str(tempsoup),re.I)==[]:
DLlinksA.extend(re.findall(r'<a\sclass="new"\shref=".*"\stitle',str(tempsoup),re.I))
else:
DLlinksA.extend(re.findall(r'<a\shref=".*"\stitle',str(tempsoup),re.I))
Vertemp = DLnames.pop(0)
#进行链接处理
for link in DLlinksA:
linkA = link.replace(' class="new"','')[9:][:-7]
DLlinks.append(linkA)
print(linkA)
#检查版本信息
VersionOn =int(Vertemp[-4:-1])/100
print(VersionOn)
print(DLlinks)
input()
#.replace(" class=\"new\"","")
| [
"noreply@github.com"
] | VLSMB.noreply@github.com |
b68b5150216302b06ba998298347b7a50375061f | ece9a0b9c2c3285f8ff68376ad3311a8cd6c5f3b | /99-LargestExponential.py | e5d157cc45a9587bb3938efcebc40a99755b8220 | [] | no_license | helani04/EulerProjects | a9908912b39a0c36605ddd2798da8fe86108b90b | 719b9b2f8f9cb6d6bd3dcccfba9423c5a6f3b1b6 | refs/heads/master | 2022-04-19T07:17:24.201244 | 2020-04-18T06:19:09 | 2020-04-18T06:19:09 | 256,530,063 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 14,602 | py |
numbers=[519432,525806,632382,518061,78864,613712,466580,530130,780495,510032,525895,525320,15991,714883,960290,502358,760018,511029,166800,575487,210884,564478,555151,523163,681146,515199,563395,522587,738250,512126,923525,503780,595148,520429,177108,572629,750923,511482,440902,532446,881418,505504,422489,534197,979858,501616,685893,514935,747477,511661,167214,575367,234140,559696,940238,503122,728969,512609,232083,560102,900971,504694,688801,514772,189664,569402,891022,505104,445689,531996,119570,591871,821453,508118,371084,539600,911745,504251,623655,518600,
144361,582486,
352442,541775,
420726,534367,
295298,549387,
6530,787777,
468397,529976,
672336,515696,
431861,533289,
84228,610150,
805376,508857,
444409,532117,
33833,663511,
381850,538396,
402931,536157,
92901,604930,
304825,548004,
731917,512452,
753734,511344,
51894,637373,
151578,580103,
295075,549421,
303590,548183,
333594,544123,
683952,515042,
60090,628880,
951420,502692,
28335,674991,
714940,513349,
343858,542826,
549279,523586,
804571,508887,
260653,554881,
291399,549966,
402342,536213,
408889,535550,
40328,652524,
375856,539061,
768907,510590,
165993,575715,
976327,501755,
898500,504795,
360404,540830,
478714,529095,
694144,514472,
488726,528258,
841380,507226,
328012,544839,
22389,690868,
604053,519852,
329514,544641,
772965,510390,
492798,527927,
30125,670983,
895603,504906,
450785,531539,
840237,507276,
380711,538522,
63577,625673,
76801,615157,
502694,527123,
597706,520257,
310484,547206,
944468,502959,
121283,591152,
451131,531507,
566499,522367,
425373,533918,
40240,652665,
39130,654392,
714926,513355,
469219,529903,
806929,508783,
287970,550487,
92189,605332,
103841,599094,
671839,515725,
452048,531421,
987837,501323,
935192,503321,
88585,607450,
613883,519216,
144551,582413,
647359,517155,
213902,563816,
184120,570789,
258126,555322,
502546,527130,
407655,535678,
401528,536306,
477490,529193,
841085,507237,
732831,512408,
833000,507595,
904694,504542,
581435,521348,
455545,531110,
873558,505829,
94916,603796,
720176,513068,
545034,523891,
246348,557409,
556452,523079,
832015,507634,
173663,573564,
502634,527125,
250732,556611,
569786,522139,
216919,563178,
521815,525623,
92304,605270,
164446,576167,
753413,511364,
11410,740712,
448845,531712,
925072,503725,
564888,522477,
7062,780812,
641155,517535,
738878,512100,
636204,517828,
372540,539436,
443162,532237,
571192,522042,
655350,516680,
299741,548735,
581914,521307,
965471,502156,
513441,526277,
808682,508700,
237589,559034,
543300,524025,
804712,508889,
247511,557192,
543486,524008,
504383,526992,
326529,545039,
792493,509458,
86033,609017,
126554,589005,
579379,521481,
948026,502823,
404777,535969,
265767,554022,
266876,553840,
46631,643714,
492397,527958,
856106,506581,
795757,509305,
748946,511584,
294694,549480,
409781,535463,
775887,510253,
543747,523991,
210592,564536,
517119,525990,
520253,525751,
247926,557124,
592141,520626,
346580,542492,
544969,523902,
506501,526817,
244520,557738,
144745,582349,
69274,620858,
292620,549784,
926027,503687,
736320,512225,
515528,526113,
407549,535688,
848089,506927,
24141,685711,
9224,757964,
980684,501586,
175259,573121,
489160,528216,
878970,505604,
969546,502002,
525207,525365,
690461,514675,
156510,578551,
659778,516426,
468739,529945,
765252,510770,
76703,615230,
165151,575959,
29779,671736,
928865,503569,
577538,521605,
927555,503618,
185377,570477,
974756,501809,
800130,509093,
217016,563153,
365709,540216,
774508,510320,
588716,520851,
631673,518104,
954076,502590,
777828,510161,
990659,501222,
597799,520254,
786905,509727,
512547,526348,
756449,511212,
869787,505988,
653747,516779,
84623,609900,
839698,507295,
30159,670909,
797275,509234,
678136,515373,
897144,504851,
989554,501263,
413292,535106,
55297,633667,
788650,509637,
486748,528417,
150724,580377,
56434,632490,
77207,614869,
588631,520859,
611619,519367,
100006,601055,
528924,525093,
190225,569257,
851155,506789,
682593,515114,
613043,519275,
514673,526183,
877634,505655,
878905,505602,
1926,914951,
613245,519259,
152481,579816,
841774,507203,
71060,619442,
865335,506175,
90244,606469,
302156,548388,
399059,536557,
478465,529113,
558601,522925,
69132,620966,
267663,553700,
988276,501310,
378354,538787,
529909,525014,
161733,576968,
758541,511109,
823425,508024,
149821,580667,
269258,553438,
481152,528891,
120871,591322,
972322,501901,
981350,501567,
676129,515483,
950860,502717,
119000,592114,
392252,537272,
191618,568919,
946699,502874,
289555,550247,
799322,509139,
703886,513942,
194812,568143,
261823,554685,
203052,566221,
217330,563093,
734748,512313,
391759,537328,
807052,508777,
564467,522510,
59186,629748,
113447,594545,
518063,525916,
905944,504492,
613922,519213,
439093,532607,
445946,531981,
230530,560399,
297887,549007,
459029,530797,
403692,536075,
855118,506616,
963127,502245,
841711,507208,
407411,535699,
924729,503735,
914823,504132,
333725,544101,
176345,572832,
912507,504225,
411273,535308,
259774,555036,
632853,518038,
119723,591801,
163902,576321,
22691,689944,
402427,536212,
175769,572988,
837260,507402,
603432,519893,
313679,546767,
538165,524394,
549026,523608,
61083,627945,
898345,504798,
992556,501153,
369999,539727,
32847,665404,
891292,505088,
152715,579732,
824104,507997,
234057,559711,
730507,512532,
960529,502340,
388395,537687,
958170,502437,
57105,631806,
186025,570311,
993043,501133,
576770,521664,
215319,563513,
927342,503628,
521353,525666,
39563,653705,
752516,511408,
110755,595770,
309749,547305,
374379,539224,
919184,503952,
990652,501226,
647780,517135,
187177,570017,
168938,574877,
649558,517023,
278126,552016,
162039,576868,
658512,516499,
498115,527486,
896583,504868,
561170,522740,
747772,511647,
775093,510294,
652081,516882,
724905,512824,
499707,527365,
47388,642755,
646668,517204,
571700,522007,
180430,571747,
710015,513617,
435522,532941,
98137,602041,
759176,511070,
486124,528467,
526942,525236,
878921,505604,
408313,535602,
926980,503640,
882353,505459,
566887,522345,
3326,853312,
911981,504248,
416309,534800,
392991,537199,
622829,518651,
148647,581055,
496483,527624,
666314,516044,
48562,641293,
672618,515684,
443676,532187,
274065,552661,
265386,554079,
347668,542358,
31816,667448,
181575,571446,
961289,502320,
365689,540214,
987950,501317,
932299,503440,
27388,677243,
746701,511701,
492258,527969,
147823,581323,
57918,630985,
838849,507333,
678038,515375,
27852,676130,
850241,506828,
818403,508253,
131717,587014,
850216,506834,
904848,504529,
189758,569380,
392845,537217,
470876,529761,
925353,503711,
285431,550877,
454098,531234,
823910,508003,
318493,546112,
766067,510730,
261277,554775,
421530,534289,
694130,514478,
120439,591498,
213308,563949,
854063,506662,
365255,540263,
165437,575872,
662240,516281,
289970,550181,
847977,506933,
546083,523816,
413252,535113,
975829,501767,
361540,540701,
235522,559435,
224643,561577,
736350,512229,
328303,544808,
35022,661330,
307838,547578,
474366,529458,
873755,505819,
73978,617220,
827387,507845,
670830,515791,
326511,545034,
309909,547285,
400970,536363,
884827,505352,
718307,513175,
28462,674699,
599384,520150,
253565,556111,
284009,551093,
343403,542876,
446557,531921,
992372,501160,
961601,502308,
696629,514342,
919537,503945,
894709,504944,
892201,505051,
358160,541097,
448503,531745,
832156,507636,
920045,503924,
926137,503675,
416754,534757,
254422,555966,
92498,605151,
826833,507873,
660716,516371,
689335,514746,
160045,577467,
814642,508425,
969939,501993,
242856,558047,
76302,615517,
472083,529653,
587101,520964,
99066,601543,
498005,527503,
709800,513624,
708000,513716,
20171,698134,
285020,550936,
266564,553891,
981563,501557,
846502,506991,
334,1190800,
209268,564829,
9844,752610,
996519,501007,
410059,535426,
432931,533188,
848012,506929,
966803,502110,
983434,501486,
160700,577267,
504374,526989,
832061,507640,
392825,537214,
443842,532165,
440352,532492,
745125,511776,
13718,726392,
661753,516312,
70500,619875,
436952,532814,
424724,533973,
21954,692224,
262490,554567,
716622,513264,
907584,504425,
60086,628882,
837123,507412,
971345,501940,
947162,502855,
139920,584021,
68330,621624,
666452,516038,
731446,512481,
953350,502619,
183157,571042,
845400,507045,
651548,516910,
20399,697344,
861779,506331,
629771,518229,
801706,509026,
189207,569512,
737501,512168,
719272,513115,
479285,529045,
136046,585401,
896746,504860,
891735,505067,
684771,514999,
865309,506184,
379066,538702,
503117,527090,
621780,518717,
209518,564775,
677135,515423,
987500,501340,
197049,567613,
329315,544673,
236756,559196,
357092,541226,
520440,525733,
213471,563911,
956852,502490,
702223,514032,
404943,535955,
178880,572152,
689477,514734,
691351,514630,
866669,506128,
370561,539656,
739805,512051,
71060,619441,
624861,518534,
261660,554714,
366137,540160,
166054,575698,
601878,519990,
153445,579501,
279899,551729,
379166,538691,
423209,534125,
675310,515526,
145641,582050,
691353,514627,
917468,504026,
284778,550976,
81040,612235,
161699,576978,
616394,519057,
767490,510661,
156896,578431,
427408,533714,
254849,555884,
737217,512182,
897133,504851,
203815,566051,
270822,553189,
135854,585475,
778805,510111,
784373,509847,
305426,547921,
733418,512375,
732087,512448,
540668,524215,
702898,513996,
628057,518328,640280,517587,422405,534204,
10604,746569,746038,511733,839808,507293,457417,530938,479030,529064,341758,543090,620223,518824,251661,556451,561790,522696,497733,527521,724201,512863,489217,528217,415623,534867,624610,518548,847541,506953,432295,533249,400391,536421,961158,502319,139173,584284,421225,534315,579083,521501,74274,617000,701142,514087,374465,539219,217814,562985,358972,540995,88629,607424,288597,550389,285819,550812,538400,524385,809930,508645,738326,512126,955461,502535,163829,576343,826475,507891,376488,538987,102234,599905,114650,594002,52815,6363417,434037,533082,804744,508880,98385,601905,856620,506559,220057,562517,844734,507078,150677,580387,558697,522917,621751,518719,207067,5653217,135297,585677,932968,503404,604456,519822,579728,521462,244138,557813,706487,513800,711627,513523,853833,506674,497220,527562,59428,629511,564845,522486,623621,518603,242689,558077,125091,589591,363819,540432,686453,514901,656813,516594,489901,528155,386380,537905,542819,524052,243987,557841,693412,514514,488484,528271,896331,504881,336730,543721,728298,512647,604215,519840,153729,579413,595687,520398,540360,524240,245779,557511,924873,503730,509628,526577,528523,525122,3509,847707,522756,525555,895447,504922,44840,646067,45860,644715,463487,530404,398164,536654,894483,504959,619415,518874,966306,502129,990922,501212,835756,507474,548881,523618,453578,531282,474993,529410,80085,612879,737091,512193,50789,638638,979768,501620,792018,509483,665001,516122,86552,608694,462772,530469,589233,520821,891694,505072,592605,520594,209645,564741,42531,649269,554376,523226,803814,508929,334157,544042,175836,572970,868379,506051,658166,516520,278203,551995,966198,502126,627162,518387,296774,549165,311803,547027,843797,507118,702304,514032,563875,522553,33103,664910,191932,568841,543514,524006,506835,526794,868368,506052,847025,506971,678623,515342,876139,505726,571997,521984,598632,520198,213590,563892,625404,518497,726508,512738,689426,514738,332495,544264,411366,535302,242546,558110,315209,546555,797544,509219,93889,604371,858879,506454,124906,589666,449072,531693,235960,559345,642403,517454,720567,513047,705534,513858,603692,519870,488137,528302,157370,578285,63515,625730,666326,516041,619226,518883,443613,532186,597717,520257,96225,603069,86940,608450,40725,651929,460976,530625,268875,553508,270671,553214,363254,540500,384248,538137,762889,510892,377941,538833,278878,551890,176615,572755,860008,506412,944392,502967,608395,519571,7225283,561450,45095,645728,333798,544090,625733,518476,995584,501037,506135,526853,238050,558952,557943,522972,530978,524938,634244,517949,177168,572616,85200,609541,953043,502630,523661,525484,999295,500902,840803,507246,961490,502312,471747,529685,380705,538523,911180,504275,334149,544046,478992,529065,325789,545133,335884,543826,426976,533760,749007,511582,667067,516000,607586,519623,674054,515599,188534,569675,565185,522464,172090,573988,87592,608052,907432,504424,8912,760841,928318,503590,757917,511138,718693,513153,315141,546566,728326,512645,353492,541647,638429,517695,628892,518280,877286,505672,620895,518778,385878,537959,423311,534113,633501,517997,884833,505360,883402,505416,999665,500894,708395,513697,548142,523667,756491,511205,987352,501340,766520,510705,591775,520647,833758,507563,843890,507108,925551,503698,74816,616598,646942,517187,354923,541481,256291,555638,634470,517942,930904,503494,134221,586071,282663,551304,986070,501394,123636,590176,123678,590164,481717,528841,423076,534137,866246,506145,93313,604697,783632,509880,317066,546304,502977,527103,141272,583545,71708,618938,617748,518975,581190,521362,193824,568382,682368,515131,352956,541712,351375,541905,505362,526909,905165,504518,128645,588188,267143,553787,158409,577965,482776,528754,628896,518282,485233,528547,563606,522574,111001,595655,115920,593445,365510,540237,959724,502374,938763,503184,930044,503520,970959,501956,913658,504176,68117,621790,989729,501253,567697,522288,820427,508163,54236,634794,291557,549938,124961,589646,403177,536130,405421,535899,410233,535417,815111,508403,213176,563974,83099,610879,998588,500934,513640,526263,129817,587733,1820,921851,287584,550539,299160,548820,860621,506386,529258,525059,586297,521017,953406,502616,441234,532410,986217,501386,781938,509957,461247,530595,735424,512277,146623,581722,839838,507288,510667,526494,935085,503327,737523,512167,303455,548204,992779,501145,60240,628739,939095,503174,794368,509370,501825,527189,459028,530798,884641,505363,512287,526364,835165,507499,307723,547590,160587,577304,735043,512300,493289,527887,110717,595785,306480,547772,318593,546089,179810,571911,200531,566799,314999,546580,197020,567622,301465,548487,237808,559000,131944,586923,882527,505449,468117,530003,711319,513541156240,578628,965452,502162,992756,501148,437959,532715,739938,512046,614249,519196,391496,537356,62746,626418,688215,514806,75501,616091,883573,505412,558824,522910,759371,511061,173913,573489,891351,505089,727464,512693,164833,576051,812317,508529,540320,524243,698061,514257,69149,620952,471673,529694,159092,577753,428134,533653,89997,606608,711061,513557,779403,510081,203327,566155,798176,509187,667688,515963,636120,517833,137410,584913,217615,563034,556887,523038,667229,515991,672276,515708,325361,545187,172115,573985,13846,725685]
power=[]
for i in range(0,len(numbers),2):
power.append(pow(numbers[i],numbers[i+1]))
print(power.index(max(power)))
| [
"helanikumarawadu@gmail.com"
] | helanikumarawadu@gmail.com |
c6540befb02546360fde8697d9ad6f1187176976 | 6a999066cbdec2cdc1d20d068840ad7fcb0de19d | /p122_cnn_image_recognition.py | d344cd9e00c5d4b075b645724ab64799408d1dfa | [] | no_license | chrisjune/tensorflow_project | 4a4594ff800b7c84757121bba7a0c80be85789ff | 8d461ad6fd3e17ed7c7ad1a37253abe900c7f521 | refs/heads/master | 2021-04-03T08:14:18.716342 | 2018-05-19T08:06:23 | 2018-05-19T08:06:23 | 125,016,298 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,112 | py | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("./mnist/data/",one_hot=True)
import matplotlib.pyplot as plt
import numpy as np
#Data variabel
X = tf.placeholder(tf.float32 , [None, 28, 28, 1])
Y = tf.placeholder(tf.float32, [None, 10])
keep_prob = tf.placeholder(tf.float32)
#1st CNN Layer
#Convolution layer
W1 = tf.Variable(tf.random_normal([3,3,1,32],stddev=0.01))
print(X)
print(Y)
print(W1)
L1 = tf.nn.conv2d(X, W1, strides=[1,1,1,1], padding = 'SAME')
L1 = tf.nn.relu(L1)
print(L1)
#Pooling layer
L1 = tf.nn.max_pool(L1, ksize = [1,2,2,1], strides=[1,2,2,1], padding="SAME")
print(L1)
#2nd CNN Layer
#Convolution layer
W2 = tf.Variable(tf.random_normal([3,3,32,64],stddev=0.01))
print(W2)
L2 = tf.nn.conv2d(L1,W2, strides=[1,1,1,1],padding="SAME")
print(L2)
L2 = tf.nn.relu(L2)
#Pooling Layer
L2 = tf.nn.max_pool(L2, ksize=[1,2,2,1], strides = [1,2,2,1], padding="SAME")
print(L2)
#Final CNN Layer
#Convolution Layer
# W3 = tf.Variable(tf.random_normal(3,3,64,10),stddev=0.01)
# L3 = tf.nn.conv2d(L2, W3, strides=[1,1,1,1], padding ="SAME")
# #Pooling layer
# L3 = tf.nn.max_pool(L3, ksize=[1,2,2,1], strides=[1,2,2,1], padding="SAME")
W3 = tf.Variable(tf.random_normal([7*7*64, 256],stddev=0.01))
print(W3)
L3 = tf.reshape(L2, [-1, 7*7*64]) #L2 pooling data -> 1-D data
print(L3)
L3 = tf.matmul(L3, W3)
L3 = tf.nn.relu(L3)
L3 = tf.nn.dropout(L3, keep_prob)
#Output Layer
W4 = tf.Variable(tf.random_normal([256,10],stddev=0.01))
model = tf.matmul(L3, W4)
#Cost function & optimizer
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=model, labels=Y))
optimizer= tf.train.AdamOptimizer(0.001).minimize(cost)
#alternative optimizer = tf.train.RMSPropOptimizer(0.001,0.9).minimize(cost)
# batch_xs.reshape(-1, 28, 28, 1)
# mnist.test.images.reshape(-1,28,28,1)
init = tf.global_variables_initializer()
sess = tf.Session()
sess.run(init)
batch_size = 100
total_batch = int(mnist.train.num_examples / batch_size)
for epoch in range(15):
total_cost = 0
for i in range(total_batch):
batch_xs, batch_ys = mnist.train.next_batch(batch_size)
batch_xs = batch_xs.reshape(-1,28,28,1)
_, cost_val = sess.run([optimizer, cost], feed_dict={X:batch_xs, Y:batch_ys, keep_prob:0.7})
total_cost += cost_val
print('Epoch:','%04d' % (epoch +1), 'Avg cost:','{:.3f}'.format(total_cost / total_batch))
print("최적화 완료")
#Result
is_correct = tf.equal(tf.argmax(model,1),tf.argmax(Y,1))
accuracy = tf.reduce_mean(tf.cast(is_correct,tf.float32))
print("정확도:",sess.run(accuracy, feed_dict={X:mnist.test.images.reshape(-1,28,28,1), Y:mnist.test.labels, keep_prob:1}))
#Plotting of result
labels = sess.run(model,feed_dict={X:mnist.test.images.reshape(-1,28,28,1), Y:mnist.test.labels, keep_prob:1})
fig = plt.figure()
for i in range(10):
subplot = fig.add_subplot(2,5,i+1)
subplot.set_xticks([])
subplot.set_yticks([])
subplot.set_title('%d' % np.argmax(labels[i]))
subplot.imshow(mnist.test.images[i].reshape((28,28)),cmap=plt.cm.gray_r)
plt.show() | [
"CJY@CJYui-MacBook-Air.local"
] | CJY@CJYui-MacBook-Air.local |
cf258f0e1d1a474ab2979b9f003106f8014ed209 | 0a5a22c5cf15b56e17df6f45bc92ea3414c45ada | /app.py | 429abe272f03f6b634142aa45ac5d95fd6f62085 | [] | no_license | nidhi988/predicting-salary-of-employees | 65cb0f1b4525af1838b2c8c67f382bbb4ae789a0 | f8666ac17814dc48378095eade1c11c341fce004 | refs/heads/master | 2022-11-18T04:15:48.091687 | 2020-07-17T07:58:42 | 2020-07-17T07:58:42 | 280,363,699 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,028 | py | import numpy as np
from flask import Flask, request, jsonify, render_template
import pickle
app = Flask(__name__)
model = pickle.load(open('C:\\Users\\LOHANI\\Desktop\\predicting salary of employees\\model.pkl', 'rb'))
@app.route('/')
def home():
return render_template('index.html')
@app.route('/predict',methods=['POST'])
def predict():
'''
For rendering results on HTML GUI
'''
int_features = [int(x) for x in request.form.values()]
final_features = [np.array(int_features)]
prediction = model.predict(final_features)
output = round(prediction[0], 2)
return render_template('index.html', prediction_text='Employee Salary should be $ {}'.format(output))
@app.route('/predict_api',methods=['POST'])
def predict_api():
'''
For direct API calls trought request
'''
data = request.get_json(force=True)
prediction = model.predict([np.array(list(data.values()))])
output = prediction[0]
return jsonify(output)
if __name__ == "__main__":
app.run(debug=True) | [
"noreply@github.com"
] | nidhi988.noreply@github.com |
9bfc406bd5d3388d37ef44d357529cc09bffcda6 | 73c3d76f451b1b12e4e83026306fd3f688a96709 | /venv/bin/flask | 042c0d88b83d728104a5b23288334c1300cc88f2 | [] | no_license | everett-yates/learning-flask | 562479567059250279b9a1070bab1ce37d15d4a8 | 3596529a62bfc43c360e2c0f6f997cc183bf6a0d | refs/heads/master | 2021-01-02T22:46:58.837859 | 2017-08-04T23:53:10 | 2017-08-04T23:53:10 | 99,387,321 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 238 | #!/home/bobby/learning-flask/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from flask.cli import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
| [
"everett.yates@atlapps.net"
] | everett.yates@atlapps.net | |
f9198d9eb339474258efaac2ded39e65e899ec24 | b8e249f2bf0aa175899090128f7a77fb34aa2c1b | /apps/users/migrations/0002_auto_20190523_2209.py | ad3a4736f1152245525812b35261e78189162d03 | [] | no_license | dojo-ninja-gold/ng-server | 80d8568fa960e882df9e1a6fff7e020e93ff2990 | fcd69744a2ebf99f0c24b3136ba7a2d8a4c683e1 | refs/heads/master | 2023-05-03T21:05:54.026847 | 2019-05-24T22:29:51 | 2019-05-24T22:29:51 | 187,918,381 | 0 | 0 | null | 2023-04-21T20:32:36 | 2019-05-21T21:49:40 | Python | UTF-8 | Python | false | false | 830 | py | # Generated by Django 2.2.1 on 2019-05-23 22:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='user',
name='first_name',
field=models.CharField(default='', max_length=255),
preserve_default=False,
),
migrations.AddField(
model_name='user',
name='last_name',
field=models.CharField(default='', max_length=255),
preserve_default=False,
),
migrations.AddField(
model_name='user',
name='pw_hash',
field=models.CharField(default='password', max_length=500),
preserve_default=False,
),
]
| [
"wes@tao.team"
] | wes@tao.team |
1d35b0c6b7a5c4252763588c948c81d9b77ad15b | b458b2cf3011a73def66605b296144049909cd48 | /tests/my_trade.py | e749520a049723eff15fa850405a79187d1d6f1f | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | shihliu/python-binance | 8c5607a78a4794f9b42fe90092a149f4050d4710 | c44f8a315df32c8b5d54750c27703060ec9060aa | refs/heads/master | 2021-08-22T02:47:10.423523 | 2017-11-29T04:34:30 | 2017-11-29T04:34:30 | 111,865,384 | 0 | 0 | null | 2017-11-24T01:57:33 | 2017-11-24T01:57:33 | null | UTF-8 | Python | false | false | 1,044 | py | from binance.client import Client
import json
client = Client('yq67cDjrCxGl6eeKMyTeiK1zkeArFpu8v4uB4b6TWDQdgjDlH0KjmXfHBZ1NjvJj', 'DxE7Wugo75EK8mLmybY76dbZW6tROpyNjBRd9NHsEOXqBaKq6Awgul4390xwRUdc')
my_trade = client.get_my_trades(symbol='QSPETH')
all_buy_price = all_buy_amount= 0.0
all_sell_price = all_sell_amount= 0.0
for i in my_trade:
if i["isBuyer"] is True:
all_buy_price = all_buy_price + float(i["price"]) * float(i["qty"])
all_buy_amount = all_buy_amount + float(i["qty"])
else:
all_sell_price = all_buy_price + float(i["price"]) * float(i["qty"])
all_sell_amount = all_buy_amount + float(i["qty"])
avg_buy_price = all_buy_price / all_buy_amount
print "my total buy price is %f" %all_buy_price
print "my total buy amount is %f" %all_buy_amount
print "average buy price is %f" %avg_buy_price
avg_sell_price = all_sell_price / all_sell_amount
print "my total sell price is %f" %all_sell_price
print "my total sell amount is %f" %all_sell_amount
print "average sell price is %f" %avg_sell_price | [
"root@dhcp-129-210.nay.redhat.com"
] | root@dhcp-129-210.nay.redhat.com |
12f77883df8917200b77ed652bec018debcd2f8c | 280040bde598205e3bb93112695d3f0adf161093 | /data/test_fvcom.py | 5f6c849c10824fca381ea2e1c1ee7283918bd101 | [] | no_license | geoffholden/ocean-navigator | 24965f8e90222c4b9f2a3ca56cb10df523dd87f1 | 2ae745d475744bcf4770982f1de55c05b3b29238 | refs/heads/master | 2021-01-21T06:42:02.957677 | 2017-05-18T16:49:35 | 2017-05-18T16:49:35 | 91,581,750 | 3 | 4 | null | null | null | null | UTF-8 | Python | false | false | 2,599 | py | import unittest
import fvcom
import datetime
import pytz
class TestFvcom(unittest.TestCase):
def test_init(self):
fvcom.Fvcom(None)
def test_open(self):
with fvcom.Fvcom('data/testdata/fvcom_test.nc'):
pass
def test_depths(self):
with fvcom.Fvcom('data/testdata/fvcom_test.nc') as n:
depths = n.depths
self.assertEqual(len(depths), 1)
self.assertEqual(depths[0], 0)
def test_variables(self):
with fvcom.Fvcom('data/testdata/fvcom_test.nc') as n:
variables = n.variables
self.assertEqual(len(variables), 3)
self.assertTrue('h' in variables)
self.assertEqual(variables['h'].name, 'Bathymetry')
self.assertEqual(variables['h'].unit, 'm')
def test_get_point(self):
with fvcom.Fvcom('data/testdata/fvcom_test.nc') as n:
data, depth = n.get_point(45.3, -64.0, 0, 0, 'temp',
return_depth=True)
self.assertAlmostEqual(data, 6.76, places=2)
self.assertAlmostEqual(depth, 6.50, places=2)
def test_get_raw_point(self):
with fvcom.Fvcom('data/testdata/fvcom_test.nc') as n:
lat, lon, data = n.get_raw_point(
45.3, -64.0, 0, 0, 'temp'
)
self.assertEqual(len(lat.ravel()), 156)
self.assertEqual(len(lon.ravel()), 156)
self.assertEqual(len(data.ravel()), 156)
self.assertAlmostEqual(data[75], 6.90, places=1)
def test_get_profile(self):
with fvcom.Fvcom('data/testdata/fvcom_test.nc') as n:
p, d = n.get_profile(45.3, -64.0, 0, 'temp')
self.assertAlmostEqual(p[0], 6.76, places=2)
self.assertAlmostEqual(p[10], 6.76, places=2)
def test_bottom_point(self):
with fvcom.Fvcom('data/testdata/fvcom_test.nc') as n:
self.assertAlmostEqual(
n.get_point(45.3, -64.0, 'bottom', 0, 'temp'),
6.76, places=2
)
def test_timestamps(self):
with fvcom.Fvcom('data/testdata/fvcom_test.nc') as n:
self.assertEqual(len(n.timestamps), 2)
self.assertEqual(n.timestamps[0],
datetime.datetime(2015, 7, 6, 0, 0, 0, 0,
pytz.UTC))
# Property is read-only
with self.assertRaises(AttributeError):
n.timestamps = []
# List is immutable
with self.assertRaises(ValueError):
n.timestamps[0] = 0
| [
"geoff@geoffholden.com"
] | geoff@geoffholden.com |
1e0bc44fa3fba1c10f72ce9d61c6daa1c68bdcab | 888179fc56042fd50f283d8eaace04bec87ce582 | /PolicyGradient/pol_grad_unfrozen.py | e5654023e00655f4cdec72a35378fdaa87311454 | [] | no_license | stickzman/honors_thesis | c178c25b5cf6fa2d923d9f7f1ce519f28913b3a6 | 078ad97e9c7f7e07d343d16a25e5c3f7d32cbb53 | refs/heads/master | 2021-08-30T05:15:25.643928 | 2017-12-16T05:02:02 | 2017-12-16T05:02:02 | 103,351,320 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,414 | py | import tensorflow as tf
import tensorflow.contrib.slim as slim
import numpy as np
import gym
import matplotlib.pyplot as plt
from tutorial.tut_policy_gradient_agent import agent
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from thawedLakeEngine import Env
try:
xrange = xrange
except:
xrange = range
env = Env()
gamma = 0.99
def discount_rewards(r):
""" take 1D float array of rewards and compute discounted reward """
discounted_r = np.zeros_like(r)
running_add = 0
for t in reversed(xrange(0, r.size)):
running_add = running_add * gamma + r[t]
discounted_r[t] = running_add
return discounted_r
tf.reset_default_graph() #Clear the Tensorflow graph.
myAgent = agent(lr=1e-2,s_size=1,a_size=4,h_size=10) #Load the agent.
total_episodes = 2000 #Set total number of episodes to train agent on.
max_ep = 201
update_frequency = 5
doTrain = True
init = tf.global_variables_initializer()
rList = []
avgList = []
saver = tf.train.Saver()
# Launch the tensorflow graph
with tf.Session() as sess:
sess.run(init)
print("Restore session?")
restore = input("Y/N (No): ").lower()
if len(restore) > 0 and restore[0] == 'y':
saver.restore(sess, "tmp/model.ckpt")
print("Model restored.")
print("Continue training?")
train = input("Y/N (Yes): ").lower()
if len(train) > 0 and train[0] == 'n':
doTrain = False
print("Model will not be updated.")
i = 0
total_reward = []
total_length = []
gradBuffer = sess.run(tf.trainable_variables())
for ix,grad in enumerate(gradBuffer):
gradBuffer[ix] = grad * 0
while i < total_episodes:
s = env.reset()
running_reward = 0
ep_history = []
for j in range(max_ep):
#Probabilistically pick an action given our network outputs.
a_dist = sess.run(myAgent.output,feed_dict={myAgent.state_in:[[s]]})
a = np.random.choice(a_dist[0],p=a_dist[0])
a = np.argmax(a_dist == a)
s1,r,d = env.step(a) #Get our reward for taking an action given a bandit.
ep_history.append([s,a,r,s1])
s = s1
running_reward += r
#if i%500==0: env.render()
if d == True:
#Update the network.
if doTrain:
ep_history = np.array(ep_history)
ep_history[:,2] = discount_rewards(ep_history[:,2])
feed_dict={myAgent.reward_holder:ep_history[:,2],
myAgent.action_holder:ep_history[:,1],myAgent.state_in:np.vstack(ep_history[:,0])}
grads = sess.run(myAgent.gradients, feed_dict=feed_dict)
for idx,grad in enumerate(grads):
gradBuffer[idx] += grad
if i % update_frequency == 0 and i != 0:
feed_dict= dictionary = dict(zip(myAgent.gradient_holders, gradBuffer))
_ = sess.run(myAgent.update_batch, feed_dict=feed_dict)
for ix,grad in enumerate(gradBuffer):
gradBuffer[ix] = grad * 0
total_reward.append(running_reward)
total_length.append(j)
rList.append(running_reward)
break
#Update our running tally of scores.
if i % 100 == 0:
avgList.append(np.mean(total_reward[-100:]))
print(str((i/total_episodes)*100) + "%")
#print(running_reward)
i += 1
avgX = np.linspace(0, len(rList), len(avgList))
plt.plot(rList)
plt.plot(avgX, avgList)
plt.show()
print("Save model?");
save = input("Y/N (No): ").lower()
if len(save) > 0 and save[0] == 'y':
save_path = saver.save(sess, "tmp/model.ckpt")
print("Model saved in file: %s" % save_path)
| [
"Daniel.ahl1@marist.edu"
] | Daniel.ahl1@marist.edu |
e9d2fba53b75ecd2755d17c5468771018d927055 | 3d48adfc1a49a618aea10bfbc04228435e958f41 | /Synchronization_ST/TimingRecovery_ST.py | dc11310b0c6bf2f5866475244fd4076621ff4ca4 | [] | no_license | Camcore95/MetodykiProjektowTeleinf | dc691deecc595d44e4e99235f37ddd4ef65d383e | 7773f24bac4e2b14c5e3c6f63a0384c4c565724e | refs/heads/master | 2020-12-01T23:02:08.486233 | 2019-12-23T14:54:49 | 2019-12-23T14:54:49 | 230,803,413 | 0 | 0 | null | 2019-12-29T21:06:43 | 2019-12-29T21:06:42 | null | UTF-8 | Python | false | false | 2,638 | py | from Synchronization.TimingRecovery import TimingRecovery
from QPSK.Modulator import Modulator
from QPSK.Demodulator import Demodulator
from RadioTransmission_ST.RadioChannel import RadioChannel
import numpy as np
########################################################################################################################
# CONSTANTS
########################################################################################################################
__SEED = np.random.seed(238923)
__BITS = np.random.randint(2, size=2070).tolist()
__SYMBOL_LENGTH_IN_BITS = 32
__CARRIER_FREQ = 20000
__NUM_OF_PERIODS_IN_SYMBOL = 2
__FI = 0
__SAMPLING_RATE = __CARRIER_FREQ * __SYMBOL_LENGTH_IN_BITS / __NUM_OF_PERIODS_IN_SYMBOL
########################################################################################################################
# FUNCTIONS
########################################################################################################################
def __transmitSignalWithTimingSynchronization(samplingErr):
modulator = Modulator(__CARRIER_FREQ, __SYMBOL_LENGTH_IN_BITS, __FI, __SAMPLING_RATE)
demodulator = Demodulator(__CARRIER_FREQ, __SYMBOL_LENGTH_IN_BITS, __FI, __SAMPLING_RATE)
timeRecover = TimingRecovery(__SYMBOL_LENGTH_IN_BITS)
channel = RadioChannel(__SAMPLING_RATE)
signal = modulator.modulate(__BITS)
transmittedSignal = channel.transmit(signal, adcSamplingErr=samplingErr, snr=10)
transmittedSignal = timeRecover.synchronizeTiming(transmittedSignal)
demodulatedBits = demodulator.demodulate(transmittedSignal)
return demodulatedBits
########################################################################################################################
# TEST CASES
########################################################################################################################
def shouldProperlyDemodulateBitsWithLittleTooHighSampling():
demodulatedBits = __transmitSignalWithTimingSynchronization(0.001)
assert(demodulatedBits == __BITS)
def shouldProperlyDemodulateBitsWithLittleTooLowSampling():
demodulatedBits = __transmitSignalWithTimingSynchronization(-0.001)
assert(demodulatedBits == __BITS)
########################################################################################################################
# RUN ALL TESTS
########################################################################################################################
def run():
shouldProperlyDemodulateBitsWithLittleTooHighSampling()
shouldProperlyDemodulateBitsWithLittleTooLowSampling()
| [
"kamilsternal20@wp.pl"
] | kamilsternal20@wp.pl |
c364bf86337f174f6c159d3984b287408e5a58e9 | 572c9dd60e56a58987a3c2551daab0f80a607d35 | /src/train/sample/text_sample_embedded.py | e42e1b2c1e1f91b33f65d64bdc8a15fb9b29e721 | [] | no_license | yogurtco/learning_framework | 07777ee3a8febdde70e0230bfd930dbee415f578 | efa786c60a3904c2d3afa1a08b821a09bec7ae2c | refs/heads/master | 2022-11-21T10:27:10.908735 | 2020-07-11T08:30:13 | 2020-07-11T08:30:13 | 278,622,072 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,732 | py | from typing import List
import torch
from learning_framework.src.train.sample.base_sample import BaseSample
import numpy as np
class TextSampleEmbedded(BaseSample):
padding_size = 400
def __init__(self, text_data: np.ndarray, text_gt: np.ndarray):
assert isinstance(text_data, np.ndarray), "{} is not supported, only str".format(type(text_data))
assert isinstance(text_gt, np.ndarray), "{} is not supported, only str".format(type(text_gt))
super().__init__({'text_data': text_data, 'text_gt': text_gt})
@property
def text_data(self):
return self['text_data']
@text_data.setter
def text_data(self, value):
self['text_data'] = value
@property
def text_gt(self):
return self['text_gt']
@text_gt.setter
def text_gt(self, value):
self['text_gt'] = value
@staticmethod
def _pad(data: np.ndarray, padding_size: int):
if padding_size < data.shape[0]:
print("warning: data size larger than padding. Data size: {}, padding: {}".format(data.shape[0], padding_size))
final_size = padding_size
else:
final_size = data.shape[0]
data_padded = np.zeros((padding_size, data.shape[1]))
data_padded[0:final_size, :] = data[0:final_size, :]
return data_padded
def add_padding(self):
self.text_data = self._pad(self.text_data, self.padding_size)
self.text_gt = self._pad(self.text_gt, self.padding_size)
def convert_to_torch(self):
self.text_data = torch.from_numpy(self.text_data).float()
self.text_gt = torch.from_numpy(self.text_gt).float()
def __iter__(self):
return iter((self.text_data, self.text_gt))
| [
"yogurt.co@gmail.com"
] | yogurt.co@gmail.com |
05073c0c21276b72ee5fdccd7d1ae12855c27c0c | 212770b9868cbab6c016cd6acdfb3c117bbf7ab6 | /polls/views.py | 097805857e14fc9f7433e60c48c0209e293a5930 | [] | no_license | Derstilon/SQLProject | a75cd2774a6c2c72df3a926b45d01159de336336 | fc0e70b8b738cdbc3e144340f7be3b9894bb6872 | refs/heads/master | 2022-07-07T19:32:02.346957 | 2020-06-06T18:56:09 | 2020-06-06T18:56:09 | 250,903,453 | 0 | 0 | null | 2022-06-22T01:56:46 | 2020-03-28T22:09:53 | HTML | UTF-8 | Python | false | false | 1,508 | py | from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.template import loader
from django.urls import reverse
from django.views import generic
from .models import Question, Choice
class IndexView(generic.ListView):
template_name = 'polls/index.html'
context_object_name = 'latest_question_list'
def get_queryset(self):
"""Return the last five published questions."""
return Question.objects.order_by('-pub_date')[:5]
class DetailView(generic.DetailView):
model = Question
template_name = 'polls/detail.html'
class ResultsView(generic.DetailView):
model = Question
template_name = 'polls/results.html'
def vote(request, question_id):
question = get_object_or_404(Question, pk=question_id)
try:
selected_choice = question.choice_set.get(pk=request.POST['choice'])
except (KeyError, Choice.DoesNotExist):
# Redisplay the question voting form.
return render(request, 'polls/detail.html', {
'question': question,
'error_message': "You didn't select a choice.",
})
else:
selected_choice.votes += 1
selected_choice.save()
# Always return an HttpResponseRedirect after successfully dealing
# with POST data. This prevents data from being posted twice if a
# user hits the Back button.
return HttpResponseRedirect(reverse('polls:results', args=(question.id,)))
| [
"ostatni5@o2.pl"
] | ostatni5@o2.pl |
c209ff085368ec5de726e07ca1298dcd1d6c77be | 35463a0e00e2a1e90171e646eaeaadaa61d3b867 | /Part 6 - Reinforcement Learning/Section 33 - Thompson Sampling/thompson_sampling.py | 0fe5e9f6682649c01bc92218cb60f2ee5c3305d8 | [] | no_license | Redwa/Machine-Learning-A-Z | 3ef4f905a71ba2ce9eb2371869b61d820bc78bfe | 14bc93491dd3d7a940d743d71a71f286c0a7fcf1 | refs/heads/master | 2021-01-25T05:09:34.071676 | 2017-05-11T13:03:20 | 2017-05-11T13:03:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,132 | py | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 17 21:49:14 2017
@author: Nott
"""
#Thompson Sampling
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Ads_CTR_Optimisation.csv')
#Implementing Thompson Sampling
import random
N = 10000
d = 10
ads_selected = []
numbers_of_rewards_1 = [0] * d
numbers_of_rewards_0 = [0] * d
total_reward = 0
for n in range(0, N):
ad = 0
max_random = 0
for i in range(0, d):
random_beta = random.betavariate(numbers_of_rewards_1[i] + 1,numbers_of_rewards_0[i] + 1)
if random_beta > max_random:
max_random = random_beta
ad = i
ads_selected.append(ad)
reward = dataset.values[n, ad]
if reward == 1:
numbers_of_rewards_1[ad] = numbers_of_rewards_1[ad] + 1
else:
numbers_of_rewards_0[ad] = numbers_of_rewards_0[ad] + 1
total_reward = total_reward + reward
#Visualizing the results
plt.hist(ads_selected)
plt.title('Histogram of Ads selections')
plt.xlabel('Ads')
plt.ylabel('Number of times each Ad was selected')
plt.plot()
| [
"sawatdeekrab@gmail.com"
] | sawatdeekrab@gmail.com |
ce216ce47e0e2a40bf167808914a09f67706c10b | ac83e924105295a6dac6682c830ede44884e1437 | /Computer Vision course - Msc BGU/Exercise 1/task/dense_SIFT_example_new.py | b918b014924449c6b04f5c772ac0af081fbc395e | [] | no_license | Hengrinberg/Data-Science-Projects | 973f51307b45a03a1aa0ead8e44f234d59e839f9 | 139f3cb8c90a6d2bd12ec0ae94aa66378f745c7f | refs/heads/master | 2021-06-03T11:49:17.979701 | 2021-04-13T10:08:20 | 2021-04-13T10:08:20 | 102,189,366 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 547 | py | import skimage.data as skid
import cv2
import pylab as plt
import scipy.misc
img = scipy.misc.face()
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
plt.figure(figsize=(20,10))
plt.imshow(img)
plt.show()
sift = cv2.xfeatures2d.SIFT_create()
step_size = 5
size = 5
kp = [cv2.KeyPoint(x, y, size) for y in range(0, gray.shape[0], step_size)
for x in range(0, gray.shape[1], step_size)]
img=cv2.drawKeypoints(gray, kp, img)
plt.figure(figsize=(20,10))
plt.imshow(img)
plt.show()
dense_feat = sift.compute(gray, kp) | [
"heng@youtiligent.com"
] | heng@youtiligent.com |
6117f3c8eb4a8b3c838875fb81981e1cd8764c57 | 7cb811ca5578e92b9efa1159b2d2a8972d89c030 | /general/flutterwave_helpers.py | bfd71d17b4071624a33c1e5249351ac97f5ab5d1 | [] | no_license | isaiahiyede/izzyUzo | 251d95a8d3921c491d7caf14cbd77c48732c7675 | 4bf2f024bcad837215cd022765aeb94090e7fa52 | refs/heads/master | 2022-11-30T08:06:03.153990 | 2019-06-07T18:55:07 | 2019-06-07T18:55:07 | 190,793,404 | 0 | 0 | null | 2022-11-22T00:34:18 | 2019-06-07T18:47:02 | CSS | UTF-8 | Python | false | false | 14,772 | py | try:
from flutterwave import Flutterwave
except Exception as e:
print 'e: ',e
pass
from django.conf import settings
import random
from django.shortcuts import render, redirect
import ast
from django.contrib import messages
from django.core.urlresolvers import reverse
from sokopay.models import SokoPay, MarketerPayment
from general.custom_functions import marketingmember_costcalc
from general.encryption import value_decryption
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
def keep_values(request, keys_list, data_dict):
for key in keys_list:
request.session[key] = data_dict[key]
def clear_values_from_session(request, keys_list):
for key in keys_list:
if request.session.has_key(key):
del request.session[key]
api_key = settings.FLUTTERWAVE_API_KEY
merchant_key = settings.FLUTTERWAVE_MERCHANT_KEY
def initialize_flw(api_key, merchant_key):
try:
debug = settings.DEBUG
options = {"debug": debug}
if debug:
flw = Flutterwave(api_key, merchant_key, options)
else:
options.update({'baseUrl': 'https://prod1flutterwave.co:8181'})
flw = Flutterwave(api_key, merchant_key, options)
return flw
except Exception as e:
print 'initialize_flw error: ',initialize_flw
flw = initialize_flw(api_key, merchant_key)
def generate_ref_no():
ref_no = ''
digits = '1234567890'
ref_no_length = 9
for x in range(ref_no_length):
ref_no += digits[random.randint(0, len(digits) - 1)]
return ref_no
def return_data(data_dict):
dataList = []
for key, val in data_dict.iteritems():
dataList.append({'code': key, 'name': val['name']})
return dataList
def get_countries():
data_dict = flw.util.countryList()
return return_data(data_dict)
def get_currencies():
data_dict = flw.util.currencyList()
return return_data(data_dict)
def months_list():
months = []
for i in range(1, 13):
months.append(str(i).zfill(2))
return months
def years_list():
years = []
for i in range(6):
years.append(str(2016+i))
return years
local_markup_percentage = round(1.4 / 100.00, 4)
intl_markup_percentage = round(3 / 100.00, 4)
def get_markup_charge(request, cardNumber):
cardBin6 = cardNumber[:6] #first 6 digits
#print 'cardBin6: ',cardBin6
country = '' #optional
verify = flw.bin.check(cardBin6, country)
lb_country = request.session.get('lb_country')
response_data = verify.json()['data']
responseMessage = str(response_data['responseMessage']).lower()
markup_percentage = markup_min_charge = 0
is_nigerian_card = False
if 'success' in responseMessage:
is_nigerian_card = response_data['nigeriancard']
#print 'is_nigerian_card: ',is_nigerian_card
if is_nigerian_card:
markup_percentage = local_markup_percentage
markup_min_charge = 0.2 #(Dollar)50#(Naira)
else:
markup_percentage = intl_markup_percentage
markup_min_charge = 1
# Minimum equivalent of $1
# if request.session.has_key('lb_country'):
# lb_country = request.session.get('lb_country')
# markup_min_charge = marketingmember_costcalc(request,lb_country).dollar_exchange_rate
# else:
# lb_country = request.user.useraccount.country
# if lb_country == "United States":
# markup_min_charge = 1
# else:
# markup_min_charge = marketingmember_costcalc(request,lb_country).dollar_exchange_rate
return markup_percentage, markup_min_charge, is_nigerian_card
#def initiate_charge_card(request, amount_N, txn_desc, txn_ref):
#@login_required
def initiate_charge_card(request, **kwargs):
if request.method == "POST":
txn_desc = kwargs['txn_desc']
txn_ref = kwargs['txn_ref']
#lb_country = kwargs['lb_country']
payload = request.POST.copy()
print "payload",payload
payload.pop('csrfmiddlewaretoken')
print "kwargs", kwargs
actual_amount_D = round(kwargs.get('actual_amount', 0), 2)
cardNumber = request.POST.get('cardNumber')
markup_percentage, markup_min_charge, is_nigerian_card = get_markup_charge(request, cardNumber)
print 'markup_percentage, markup_min_charge: ',markup_percentage, markup_min_charge
markup_charge_D = round((float(actual_amount_D) * markup_percentage) + markup_min_charge, 2)
#if markup_percentage == local_markup_percentage:
if is_nigerian_card:
max_markup_charge_D = 5
if markup_charge_D > max_markup_charge_D:
markup_charge_D = max_markup_charge_D
#payload.update({'bvn': '12345678901'})
#bvn = value_decryption(request.user.useraccount.bvn_no)
#payload.update({'bvn': bvn})
'''Adding default values'''
payload.update({'country': 'NG'})
payload.update({'currency': 'NGN'})
payload.update({'authModel': 'VBVSECURECODE'})
#payload.update({'responseUrl': request.build_absolute_uri(reverse('soko_pay:user_transactions'))})
# if 'lb_country' in kwargs:
# amount_D = round(actual_amount_D + markup_charge_D, 2)
# cost_calc = marketingmember_costcalc(request, lb_country)
# amount_N = round(amount_D * float(cost_calc.dollar_exchange_rate), 2)
# else:
amount_D = round(actual_amount_D + markup_charge_D, 2)
cost_calc = marketingmember_costcalc(request, 'Nigeria')
amount_N = format(amount_D * float(cost_calc.dollar_exchange_rate), '.2f')
payload.update({'responseUrl': request.build_absolute_uri(reverse('soko_pay:complete_intl_card'))+'?jejepay_ref='+txn_ref+'&actual_amount_D='+str(actual_amount_D)+'&amount_N='+str(amount_N)})
#amount_N = round(actual_amount_N + markup_charge_N, 2)
payload.update({'amount': str(amount_N)})
request.session['NGN_card'] = True
else:
if kwargs.has_key('lb_country'):
cost_calc = marketingmember_costcalc(request, lb_country)
'''Adding default values'''
payload.update({'country': 'NG'})
payload.update({'currency': 'USD'})
payload.update({'authModel': 'VBVSECURECODE'})
#payload.update({'responseUrl': request.build_absolute_uri(reverse('soko_pay:user_transactions'))})
if kwargs.has_key('lb_country'):
amount_D = format(actual_amount_D + markup_charge_D, '.2f')
amount_N = round(amount_D * float(cost_calc.dollar_exchange_rate), 2)
else:
amount_D = round(actual_amount_D + markup_charge_D, 2)
cost_calc = marketingmember_costcalc(request, request.user.useraccount.country)
amount_N = format(amount_D * float(cost_calc.dollar_exchange_rate), '.2f')
payload.update({'amount': format(amount_D, '.2f')})
payload.update({'responseUrl': request.build_absolute_uri(reverse('soko_pay:complete_intl_card'))+'?jejepay_ref='+txn_ref+'&actual_amount_D='+str(actual_amount_D)+'&amount_N='+str(amount_N)})
request.session['intl_card'] = True
payload.update({'narration': txn_desc})
#print 'payload: ',payload
#payload.update({'responseUrl': ''})
#payload.update({'responseUrl': request.build_absolute_uri(reverse('soko_pay:initiate_charge_card'))})
print 'going to flutterwave to charge card'
verify = flw.card.charge(payload)
#print "verify:", verify
# print "{}".format(verify.text)
verify_json = verify.json()
response_data = verify_json['data']
#print "verify_json:", verify_json
#print 'response_data: ',response_data
response_dict = {'responsecode': response_data['responsecode'], 'responseMessage': response_data['responsemessage'], 'jejepay_ref': txn_ref,
'otptransactionidentifier': response_data['otptransactionidentifier'],
'transactionreference': response_data['transactionreference'], 'total_N': amount_N,
'actual_amount_D': actual_amount_D, 'markup_charge_D': markup_charge_D}
'''Intl cards'''
if response_data.has_key('responsehtml') and payload['authModel'] == 'VBVSECURECODE':
if response_data['responsehtml'] != None:
responsehtml = response_data['responsehtml']
decoded_responsehtml = flw.util.decryptData(responsehtml)
request.session['decoded_responsehtml'] = decoded_responsehtml
#return render(request, )
response_dict.update({'decoded_responsehtml': True,
'intl_card_verification_url': request.build_absolute_uri(reverse('soko_pay:intl_card_verification')),
})
#return response_dict
#return HttpResponse(decoded_responsehtml)
#if response_data.has_key('responsemessage'):
#print 'response_dict: ',response_dict
return response_dict
def update_jejepay_obj(jejepay_ref, tranx_id, status):
try:
jejepay = SokoPay.objects.get(ref_no = jejepay_ref)
except:
jejepay = MarketerPayment.objects.get(ref_no = jejepay_ref)
jejepay.status = status
if tranx_id != None:
jejepay.payment_gateway_tranx_id = tranx_id
jejepay.save()
return jejepay
#@login_required
def verify_otp(request):
rp = request.POST
jejepay_ref = rp['jejepay_ref']
payload = {'country': 'NG', 'otpTransactionIdentifier': rp['otpTransactionIdentifier'],
'otp': rp['otp']}
#print 'going to flutterwave to verify otp'
response = flw.card.validate(payload).json()
#print 'response: ',response
response_data = response['data']
response_data.update({'jejepay_ref': jejepay_ref})
response_msg = response_data['responsemessage'].lower()
#if 'success' in response_msg or 'approved' in response_msg:
'''Update jejepay record status'''
# jejepay = SokoPay.objects.get(ref_no = jejepay_ref)
# jejepay.status = 'Approved'
# jejepay.payment_gateway_tranx_id = response_data['transactionreference']
# jejepay.save()
tranx_id = response_data['transactionreference']
update_jejepay_obj(jejepay_ref, tranx_id, response_msg)
return response_data
@login_required
def intl_card_verification(request):
decoded_html = request.session['decoded_responsehtml']
return HttpResponse(decoded_html)
#resp={"batchno":"20161015","merchtransactionreference":"SOKO/PT-FLW00982294","orderinfo":"OPT-FLW00982294","receiptno":"628902385186","transactionno":"475","responsetoken":"PdiWi85Ljt05TNg0943","responsecode":"0","responsemessage":"Approved","responsehtml":""}
@login_required
def complete_intl_card(request):
rG = request.GET
#amt = rG.get('amount_D')
#print "rG:"
respo = rG.get('resp')
#print type(resp)
resp = ast.literal_eval(respo)
print resp['responsemessage']
# resp_val_split = rG.get('amount_D').split('?')[1]
# resp = ast.literal_eval(resp_val_split.split('=')[1])
tranx_id = resp["merchtransactionreference"]
jejepay_ref = rG.get('jejepay_ref')
amount_D = rG.get('actual_amount_D')
amount_N = rG.get('amount_N')
try:
jejepay = update_jejepay_obj(jejepay_ref, tranx_id, resp['responsemessage'])
jejepay.amount = amount_D
jejepay.save()
except:
request.session['tranx_id']= tranx_id
pass
if request.session.has_key('intl_card') or request.session.has_key('NGN_card'):
if request.session.has_key('intl_card'):
del request.session['intl_card']
else:
del request.session['NGN_card']
go_to_url = request.session['dest_namespace_1']
if go_to_url == None:
go_to_url = request.session['dest_namespace_2']
del request.session['dest_namespace_2']
print "go url:", go_to_url
del request.session['dest_namespace_1']
messages.info(request, resp['responsemessage'])
if go_to_url == 'soko_pay:buy_jejepay_credit_card':
return redirect(request.build_absolute_uri(reverse(go_to_url)))
#print "url:", request.build_absolute_uri(reverse(go_to_url)+'?jejepay_ref='+jejepay_ref+'&actual_amount_D='+str(amount_D)+'&amount_N='+str(amount_N)+'&resp='+respo)
return redirect(request.build_absolute_uri(reverse(go_to_url)+'?jejepay_ref='+jejepay_ref+'&actual_amount_D='+str(amount_D)+'&amount_N='+str(amount_N)+'&resp='+respo))
#return redirect(reverse('soko_pay:user_transactions'))
msg_info = "You have successfully paid $%s" %(str(amount_D))
messages.info(request, msg_info)
return redirect(reverse('soko_pay:user_transactions'))
'''For authModel=PIN'''
# def initiate_charge_card(request, **kwargs):
# if request.method == "POST":
# amount_N = kwargs['actual_amount']
# txn_desc = kwargs['txn_desc']
# txn_ref = kwargs['txn_ref']
#
# payload = request.POST.copy()
# payload.pop('csrfmiddlewaretoken')
# payload.update({'amount': str(amount_N)})
#
# '''Adding default values'''
# payload.update({'country': 'NG'})
# payload.update({'currency': 'NGN'})
# payload.update({'authModel': 'PIN'})
# payload.update({'narration': txn_desc})
#
# print 'going to flutterwave charge card'
# verify = flw.card.charge(payload)
#
# verify_json = verify.json()
# response_data = verify_json['data']
#
# if response_data.has_key('responsemessage'):
# responseMessage = response_data['responsemessage']
#
# if 'success' in responseMessage.lower():
# '''Update jejepay record status'''
# jejepay = SokoPay.objects.get(ref_no = txn_ref)
# jejepay.status = 'Approved'
# jejepay.save()
#
# return {'responseMessage': responseMessage, 'jejepay_ref': txn_ref}
| [
"isaiahiyede.ca@gmail.com"
] | isaiahiyede.ca@gmail.com |
4b9785d208ec7bfd695f67a1c0ae0ae14af5c025 | d3e4b3e0d30dabe9714429109d2ff7b9141a6b22 | /Visualization/LagrangeInterpolationVisualization.py | 88ab36a87c9cd16c736d839ffcb9ba3d3157994f | [
"MIT"
] | permissive | SymmetricChaos/NumberTheory | 184e41bc7893f1891fa7fd074610b0c1520fa7dd | 65258e06b7f04ce15223c1bc0c2384ef5e9cec1a | refs/heads/master | 2021-06-11T17:37:34.576906 | 2021-04-19T15:39:05 | 2021-04-19T15:39:05 | 175,703,757 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 699 | py | from Polynomials import lagrange_interpolation
import matplotlib.pyplot as plt
import numpy as np
points = [1,3,5,7]
function = lambda x: np.sin(x)
print("""Lagrange interpolation takes a set of n points and finds the "best" polynomial that describes them. Given n points on a plane there is a polynomial of degree n-1 that passes through all of them.""")
print(f"In this example we use {len(points)} points taken from the sine function.")
fig = plt.figure()
ax=fig.add_axes([0,0,1,1])
lp = lagrange_interpolation(points,function)
print(lp)
x = np.linspace(min(points),max(points),50)
y0 = function(x)
y1 = lp.evaluate(x)
plt.plot(x,y0)
plt.plot(x,y1)
plt.scatter(points,function(points)) | [
"ajfraebel@gmail.com"
] | ajfraebel@gmail.com |
0b1900e0a13d5588aa349822a427ad816264765e | 287fcd6bc49381d5b116dd541a97c0ff37141214 | /app/section/sections/hero_section.py | c5960e017024cdfa7d8610c48d487ea424d32899 | [] | no_license | elcolono/wagtail-cms | 95812323768b90e3630c5f90e59a9f0074157ab5 | b3acb2e5c8f985202da919aaa99ea9db2f6b4d51 | refs/heads/master | 2023-05-26T05:24:42.362695 | 2020-10-08T17:23:22 | 2020-10-08T17:23:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,839 | py | from django.db import models
from wagtail.snippets.models import register_snippet
from wagtail.admin.edit_handlers import (
MultiFieldPanel, FieldPanel, StreamFieldPanel, FieldRowPanel)
from wagtail.admin.edit_handlers import ObjectList, TabbedInterface
from wagtail.images.edit_handlers import ImageChooserPanel
from section.blocks import ButtonAction, SectionTitleBlock
from . import SectionBase
from wagtail.core.fields import StreamField
from section.blocks import ActionButton, PrimaryButton
from wagtail.core.models import Page
from section.settings import cr_settings
@register_snippet
class HeroSection(SectionBase, SectionTitleBlock, ButtonAction, Page):
hero_layout = models.CharField(
blank=True,
max_length=100,
verbose_name='Layout',
choices=[
('simple_centered', 'Simple centered'),
('image_right', 'Image on right')
],
default='simple_centered',
)
hero_first_button_text = models.CharField(
blank=True,
max_length=100,
verbose_name='Hero button text',
default='Subscribe',
help_text="Leave field empty to hide.",
)
hero_second_button_text = models.CharField(
blank=True,
max_length=100,
verbose_name='Hero button text',
default='Subscribe',
help_text="Leave field empty to hide.",
)
hero_image = models.ForeignKey(
'wagtailimages.Image',
blank=True,
null=True,
on_delete=models.SET_NULL,
verbose_name='Image',
related_name='+',
)
hero_image_size = models.CharField(
max_length=50,
choices=cr_settings['HERO_IMAGE_SIZE_CHOICES'],
default=cr_settings['HERO_IMAGE_SIZE_CHOICES_DEFAULT'],
verbose_name=('Image size'),
)
hero_action_type_1 = models.CharField(
max_length=50,
choices=cr_settings['HERO_ACTION_TYPE_CHOICES'],
default=cr_settings['HERO_ACTION_TYPE_CHOICES_DEFAULT'],
verbose_name=('Action type (First)'),
)
hero_action_type_2 = models.CharField(
max_length=50,
choices=cr_settings['HERO_ACTION_TYPE_CHOICES'],
default=cr_settings['HERO_ACTION_TYPE_CHOICES_DEFAULT'],
verbose_name=('Action type (Second)'),
)
hero_buttons = StreamField(
[
('action_button', ActionButton()),
('primary_button', PrimaryButton())
],
null=True,
verbose_name="Buttons",
help_text="Please choose Buttons"
)
# basic tab panels
basic_panels = Page.content_panels + [
FieldPanel('hero_layout', heading='Layout', classname="title full"),
MultiFieldPanel(
[
FieldRowPanel([
FieldPanel('hero_layout', classname="col6"),
FieldPanel('hero_image_size', classname="col6"),
]),
FieldRowPanel([
FieldPanel('section_heading',
heading='Heading', classname="col6"),
FieldPanel('section_subheading',
heading='Subheading', classname="col6"),
]),
FieldRowPanel([
FieldPanel('section_description',
heading='Description', classname="col6"),
]),
FieldPanel('hero_first_button_text'),
FieldPanel('hero_second_button_text'),
ImageChooserPanel('hero_image'),
],
heading='Content',
),
SectionBase.section_layout_panels,
SectionBase.section_design_panels,
]
# advanced tab panels
advanced_panels = (
SectionTitleBlock.title_basic_panels,
) + ButtonAction.button_action_panels
# Register Tabs
edit_handler = TabbedInterface(
[
ObjectList(basic_panels, heading="Basic"),
ObjectList(advanced_panels, heading="Plus+"),
]
)
# Page settings
template = 'sections/hero_section_preview.html'
parent_page_types = ['home.HomePage']
subpage_types = []
# Overring methods
def set_url_path(self, parent):
"""
Populate the url_path field based on this page's slug and the specified parent page.
(We pass a parent in here, rather than retrieving it via get_parent, so that we can give
new unsaved pages a meaningful URL when previewing them; at that point the page has not
been assigned a position in the tree, as far as treebeard is concerned.
"""
if parent:
self.url_path = ''
else:
# a page without a parent is the tree root, which always has a url_path of '/'
self.url_path = '/'
return self.url_path
| [
"andreas.siedler@gmail.com"
] | andreas.siedler@gmail.com |
c845118f231d95af60dcd0e8f2f185057bc62db9 | e77912fd6681f487fdd45b61908b39990c7b413d | /ppo_ddt/agents/baseline_agent.py | 293be0562eb7dbff5bb6b53bd39eebccd2c97567 | [] | no_license | chrisyrniu/ppo_ddt | a55e7cc4c0740c0619a9fd9c048aa66eff592e10 | 913e54cdf484f0f0193cc30af934ae9d5b68c89d | refs/heads/main | 2023-06-11T20:36:12.370061 | 2021-06-29T07:13:27 | 2021-06-29T07:13:27 | 379,434,911 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 7,032 | py | import torch
import torch.nn as nn
from torch.distributions import Categorical
from ppo_ddt.rl_helpers.mlp import MLP
import copy
from ppo_ddt.agents import CartPoleHeuristic, LunarHeuristic, \
StarCraftMacroHeuristic, StarCraftMicroHeuristic
from ppo_ddt.agents import DeepProLoNet
class BaselineFCNet(nn.Module):
def __init__(self, input_dim, is_value=False, output_dim=2, hidden_layers=1):
super(BaselineFCNet, self).__init__()
self.lin1 = nn.Linear(input_dim, input_dim)
self.lin2 = None
self.lin3 = nn.Linear(input_dim, output_dim)
self.sig = nn.ReLU()
self.input_dim = input_dim
modules = []
for h in range(hidden_layers):
modules.append(nn.Linear(input_dim, input_dim))
if len(modules) > 0:
self.lin2 = nn.Sequential(*modules)
self.softmax = nn.Softmax(dim=1)
self.is_value = is_value
def forward(self, input_data):
if self.lin2 is not None:
act_out = self.lin3(self.sig(self.lin2(self.sig(self.lin1(input_data)))))
else:
act_out = self.lin3(self.sig(self.lin1(input_data)))
if self.is_value:
return act_out
else:
return self.softmax(act_out)
class FCNet:
def __init__(self,
bot_name='FCNet',
input_dim=4,
output_dim=2,
sl_init=False,
num_hidden=1
):
self.bot_name = bot_name + str(num_hidden) + '_hid'
self.sl_init = sl_init
self.input_dim = input_dim
self.output_dim = output_dim
self.num_hidden = num_hidden
self.replay_buffer = replay_buffer.ReplayBufferSingleAgent()
self.action_network = MLP(input_dim=input_dim,
output_dim=output_dim,
softmax_out=True,
hidden_layers=[num_hidden, num_hidden])
self.value_network = MLP(input_dim=input_dim,
output_dim=output_dim,
softmax_out=False,
hidden_layers=[num_hidden, num_hidden])
self.ppo = ppo_update.PPO([self.action_network, self.value_network], two_nets=True)
self.actor_opt = torch.optim.RMSprop(self.action_network.parameters(), lr=5e-3)
self.value_opt = torch.optim.RMSprop(self.value_network.parameters(), lr=5e-3)
# self.ppo.actor_opt = self.actor_opt
# self.ppo.critic_opt = self.value_opt
self.last_state = [0, 0, 0, 0]
self.last_action = 0
self.last_action_probs = torch.Tensor([0])
self.last_value_pred = torch.Tensor([[0, 0]])
self.last_deep_action_probs = torch.Tensor([0])
self.last_deep_value_pred = torch.Tensor([[0, 0]])
self.full_probs = None
self.reward_history = []
self.num_steps = 0
def get_action(self, observation):
with torch.no_grad():
obs = torch.Tensor(observation)
obs = obs.view(1, -1)
self.last_state = obs
probs = self.action_network(obs)
value_pred = self.value_network(obs)
probs = probs.view(-1)
self.full_probs = probs
if self.action_network.input_dim > 30:
probs, inds = torch.topk(probs, 3)
m = Categorical(probs)
action = m.sample()
log_probs = m.log_prob(action)
self.last_action_probs = log_probs
self.last_value_pred = value_pred.view(-1).cpu()
if self.action_network.input_dim > 30:
self.last_action = inds[action]
else:
self.last_action = action
if self.action_network.input_dim > 30:
action = inds[action].item()
else:
action = action.item()
return action
def save_reward(self, reward):
self.replay_buffer.insert(obs=[self.last_state],
action_log_probs=self.last_action_probs,
value_preds=self.last_value_pred[self.last_action.item()],
last_action=self.last_action,
full_probs_vector=self.full_probs,
rewards=reward)
return True
def end_episode(self, timesteps, num_processes=1):
self.reward_history.append(timesteps)
if self.sl_init and self.num_steps < self.action_loss_threshold:
action_loss = self.ppo.sl_updates(self.replay_buffer, self, self.teacher)
else:
value_loss, action_loss = self.ppo.batch_updates(self.replay_buffer, self)
bot_name = '../txts/' + self.bot_name + str(num_processes) + '_processes'
self.num_steps += 1
with open(bot_name + '_rewards.txt', 'a') as myfile:
myfile.write(str(timesteps) + '\n')
def lower_lr(self):
for param_group in self.ppo.actor_opt.param_groups:
param_group['lr'] = param_group['lr'] * 0.5
for param_group in self.ppo.critic_opt.param_groups:
param_group['lr'] = param_group['lr'] * 0.5
def reset(self):
self.replay_buffer.clear()
def deepen_networks(self):
pass
def save(self, fn='last'):
checkpoint = dict()
checkpoint['actor'] = self.action_network.state_dict()
checkpoint['value'] = self.value_network.state_dict()
torch.save(checkpoint, fn+self.bot_name+'.pth.tar')
def load(self, fn='last'):
# fn = fn + self.bot_name + '.pth.tar'
model_checkpoint = torch.load(fn, map_location='cpu')
actor_data = model_checkpoint['actor']
value_data = model_checkpoint['value']
self.action_network.load_state_dict(actor_data)
self.value_network.load_state_dict(value_data)
def __getstate__(self):
return {
# 'replay_buffer': self.replay_buffer,
'action_network': self.action_network,
'value_network': self.value_network,
'ppo': self.ppo,
'actor_opt': self.actor_opt,
'value_opt': self.value_opt,
'num_hidden': self.num_hidden
}
def __setstate__(self, state):
self.action_network = copy.deepcopy(state['action_network'])
self.value_network = copy.deepcopy(state['value_network'])
self.ppo = copy.deepcopy(state['ppo'])
self.actor_opt = copy.deepcopy(state['actor_opt'])
self.value_opt = copy.deepcopy(state['value_opt'])
self.num_hidden = copy.deepcopy(state['num_hidden'])
def duplicate(self):
new_agent = FCNet(
bot_name=self.bot_name,
input_dim=self.input_dim,
output_dim=self.output_dim,
sl_init=self.sl_init,
num_hidden=self.num_hidden
)
new_agent.__setstate__(self.__getstate__())
return new_agent
| [
"noreply@github.com"
] | chrisyrniu.noreply@github.com |
b1ff28e00fcaf827759d3315508259d5c02fe49a | 912cb61eaa768716d30844990ebbdd80ab2c2f4e | /ex070.py | aad48d4aa3286cd92534b1c397274d2ac7ddf5ea | [] | no_license | luizaacampos/exerciciosCursoEmVideoPython | 5fc9bed736300916e1c26d115eb2e703ba1dd4ca | 398bfa5243adae00fb58056d1672cc20ff4a31d6 | refs/heads/main | 2023-01-06T21:48:17.068478 | 2020-11-11T12:29:10 | 2020-11-11T12:29:10 | 311,964,179 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 644 | py | total = tk = menor = soma = 0
print('--------------Loja Sallus-----------------')
while True:
prod = input('Nome do produto: ')
valor = float(input('Preço: R$'))
soma += 1
cont = str(input('Quer continuar? [S/N] ')).upper().strip()[0]
total += valor
if valor > 1000.00:
tk += 1
if soma == 1 or valor < menor:
menor = valor
barato = prod
if cont == 'N':
break
print('---------FIM DO PROGRAMA-------------')
print(f'O total da compra foi R${total:.2f}')
print(f'Temos {tk} produtos custando mais de R$1000.00')
print(f'O produto mais barato foi {barato} que custa R${menor:.2f}')
| [
"luiza.almcampos@gmail.com"
] | luiza.almcampos@gmail.com |
30197700259a9549341c49c7bd19ffeca986744d | fb0e99751068fa293312f60fedf8b6d0b9eae293 | /slepé_cesty_vývoje/iskušitel/najdu_testovací_soubory.py | 452504d722f35dd929333e4039ac4e9dc3d416ee | [] | no_license | BGCX261/zora-na-pruzi-hg-to-git | d9628a07e3effa6eeb15b9b5ff6d75932a6deaff | 34a331e17ba87c0de34e7f0c5b43642d5b175215 | refs/heads/master | 2021-01-19T16:52:06.478359 | 2013-08-07T19:58:42 | 2013-08-07T19:58:42 | 41,600,435 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,598 | py | #!/usr/bin/env python3
# Copyright (c) 2012 Домоглед <domogled@domogled.eu>
# @author Петр Болф <petr.bolf@domogled.eu>
import os, fnmatch
MASKA_TESTOVACÍCH_SOUBORŮ = 'testuji_*.py'
def najdu_testovací_soubory(cesta):
počet_nalezených_testů = 0
if os.path.isdir(cesta):
for cesta_do_adresáře, nalezené_adresáře, nalezené_soubory in os.walk(cesta):
for jméno_nalezeného_souboru in nalezené_soubory:
if fnmatch.fnmatch(jméno_nalezeného_souboru, MASKA_TESTOVACÍCH_SOUBORŮ):
# if jméno_nalezeného_souboru.endswith('.py') and not jméno_nalezeného_souboru.startswith('__init__'):
cesta_k_nalezenému_souboru = os.path.join(cesta_do_adresáře, jméno_nalezeného_souboru)
počet_nalezených_testů = počet_nalezených_testů + 1
yield cesta_k_nalezenému_souboru
else:
if os.path.isfile(cesta):
if fnmatch.fnmatch(os.path.basename(cesta), MASKA_TESTOVACÍCH_SOUBORŮ):
počet_nalezených_testů = počet_nalezených_testů + 1
yield cesta
else:
raise IOError('Soubor testu "{}" neodpovídá masce {}'.format(cesta, MASKA_TESTOVACÍCH_SOUBORŮ))
else:
raise IOError('Soubor testu "{}" nejestvuje'.format(cesta))
if počet_nalezených_testů == 0:
raise IOError('Nenašel jsem žádný testovací soubor v cestě "{}" za pomocí masky "{}"'.format(cesta, MASKA_TESTOVACÍCH_SOUBORŮ))
| [
"petr.bolf@domogled.eu"
] | petr.bolf@domogled.eu |
fb12a92b52212e89e2cadcc438e0da54af195126 | 60b10ea16030b487bf17642e193f42f806d4b05f | /videocapture.py | 89324137a13dbfdf43df5468eba75fe29162ee67 | [] | no_license | utkarsh-srivastav/VideoCapture | 48d1238cc1d96750ce28abe2445ac16dc9dd0870 | 2668de171e9e66587918558271175ac655738516 | refs/heads/master | 2022-12-14T11:45:30.555531 | 2020-09-10T06:11:22 | 2020-09-10T06:11:22 | 294,319,171 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 313 | py | import cv2
video = cv2.VideoCapture(0)
a = 1
while True:
a = a+1
check, frame = video.read()
print(frame)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow("Capture", gray)
key = cv2.waitKey(1)
if key == ord('q'):
break
print(a)
video.release()
cv2.destroyAllWindows()
| [
"utkarshsrivastav233@gmail.com"
] | utkarshsrivastav233@gmail.com |
6a7e5845d8d77668de1a676f33da668cf725b5a0 | 25bc51b25262698f32554b327f2fe786fcb9ab70 | /src/api2.py | 6b856b22a5f2c9a810bb3c16293801e7769bb15d | [
"MIT"
] | permissive | classabbyamp/rtex | d8088abce0fabea9844e6e4a9de74857263e2d0c | f9d86ecbf1ab1b59668bee8af6c3709daa26c481 | refs/heads/master | 2022-10-16T02:49:28.299001 | 2020-06-02T22:49:26 | 2020-06-02T22:49:26 | 268,661,159 | 0 | 0 | MIT | 2020-06-02T00:15:44 | 2020-06-02T00:15:44 | null | UTF-8 | Python | false | false | 1,888 | py | import os
import json
import string
import re
import aiohttp
import logs
import stats
import jobs
from random_string import random_string
async def post(request):
# print(await request.text())
req = (await request.post()) or (await request.json())
code = req.get('code')
output_format = req.get('format').lower()
client_name = req.get('client_name', 'unnamed')
density = req.get('density', 200)
quality = req.get('quality', 85)
if False \
or not isinstance(code, str) \
or not isinstance(output_format, str) \
or not isinstance(density, int) \
or not isinstance(quality, int) \
or not (1 <= density <= 2000) \
or not (1 <= quality <= 100):
raise aiohttp.web.json_response({'error': 'bad input formats'})
if output_format not in ('pdf', 'png', 'jpg'):
return aiohttp.web.json_response({'error': 'invalid output format'})
job_id = random_string(64)
logs.info('Job {} started'.format(job_id))
reply = await jobs.render_latex(job_id, output_format, code, density, quality)
if reply['status'] == 'success':
reply['filename'] = job_id + '.' + output_format
logs.info('Job success : {}'.format(job_id))
stats.track_event('api2', 'success', client=client_name)
else:
logs.info('Job failed : {}'.format(job_id))
stats.track_event('api2', 'failure', client=client_name)
return aiohttp.web.json_response(reply)
async def get(request):
filename = request.match_info['filename']
if not re.match(r'^[A-Za-z0-9]{64}\.(pdf|png|pdf)$', filename):
logs.info('{} not found'.format(filename))
raise aiohttp.web.HTTPBadRequest
path = './temp/' + filename.replace('.', '/a.')
if not os.path.isfile(path):
raise aiohttp.web.HTTPNotFound
return aiohttp.web.FileResponse(path)
| [
"dxsmiley@hotmail.com"
] | dxsmiley@hotmail.com |
1ab9aeeaa915aa465fa60013804a1786e46f06ac | e8c22556d1c3da2118220b10a38950598619abfd | /TunisianLeague.py | 362581df3d8f071909014d7b19d591f295f9b7d8 | [] | no_license | mmouhib/Football-Leagues-Standings | 97542e864516d3e6d154cd5f1f46e8fca1f2a33f | a8e85659e46bd42f07e3275b38090f5e25c8bce3 | refs/heads/main | 2023-04-23T15:23:06.014620 | 2021-05-12T06:21:56 | 2021-05-12T06:21:56 | 366,610,621 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,359 | py | from bs4 import BeautifulSoup
import os
import requests
class Team:
def __init__(self, pos, team_name, matches_played, wins, draws,
losses, goals_for, goals_against, goal_diff, pts, last_five):
self.pos = pos
self.team_name = team_name
self.matches_played = matches_played
self.wins = wins
self.draws = draws
self.losses = losses
self.goals_for = goals_for
self.goals_against = goals_against
self.goal_diff = goal_diff
self.pts = pts
self.last_five = last_five
# gets a lists and adds spaces to all elements to make them equal in len
def list_formatter(content):
# convert the list elements to string
for list_index in range(len(content)):
content[list_index] = str(content[list_index])
max_str = len(content[0])
# find the longest str in the list
for list_index in range(1, len(content)):
if len(content[list_index]) > max_str:
max_str = len(content[list_index])
# add spaces to all the list elements to make them all equal in len
for list_index in range(0, len(content)):
if len(content[list_index]) < max_str:
content[list_index] += ' ' * (max_str - len(content[list_index]))
def main():
os.system('cls')
link = 'https://www.lequipe.fr/Football/championnat-de' \
'-tunisie/page-classement-equipes/general'
page = requests.get(link)
source = page.content
soup = BeautifulSoup(source, 'lxml')
table = soup.find('tbody')
tr = table.find_all('tr')
standings = []
for info in tr:
standings.append(info.find_all('td', class_='table__col'))
for i in range(len(standings)):
for x in range(len(standings[i]) - 1):
standings[i][x] = standings[i][x].text.strip()
for i in range(len(standings)):
div = standings[i][-1].find_all('div')
res = ''
for x in div:
content = str(x)
if content.find('red') != -1:
res += 'L'
elif content.find('green') != -1:
res += 'W'
else:
res += 'D'
del standings[i][-1]
standings[i].append(res)
for ind in range(len(standings)):
del standings[ind][2]
print(standings)
info = ['#', 'Pts', 'Pl', 'W', 'D', 'L', 'GF', 'GA', 'GD', 'Team', 'Last 6']
pos = []
team_name = []
matches_played = []
wins = []
draws = []
losses = []
goals_for = []
goals_against = []
goal_diff = []
pts = []
last_five = []
# converting the 'standings' list to multiple lists
for index in standings:
pos.append(index[0])
team_name.append(index[1])
matches_played.append(index[2])
wins.append(index[3])
draws.append(index[4])
losses.append(index[5])
goals_for.append(index[6])
goals_against.append(index[7])
goal_diff.append(index[8])
pts.append(index[9])
last_five.append(index[10])
list_formatter(info)
list_formatter(pos)
list_formatter(team_name)
list_formatter(matches_played)
list_formatter(wins)
list_formatter(draws)
list_formatter(losses)
list_formatter(goals_for)
list_formatter(goals_against)
list_formatter(goal_diff)
list_formatter(pts)
print(*info, sep='/')
final_output = ''
output_len = 0 # init made to avoid pycharm warning
for ind in range(len(pos)):
output = f"| {pos[ind]} ) {team_name[ind]} | {matches_played[ind]} | {wins[ind]} | {draws[ind]} | " \
f"{losses[ind]} | {goals_for[ind]} | {goals_against[ind]} | {goal_diff[ind]} | {pts[ind]}" \
f" | {last_five[ind]} |"
output_len = len(output)
final_output += '\n' + ('-' * output_len)
final_output += '\n' + output
final_output += '\n' + ('-' * output_len)
print(final_output)
# storing the data in a class to manipulate them easier in case we needed them in the future
data = []
ind = 0
for index in standings:
team = Team(index[0], index[1], index[2], index[3], index[4], index[5], index[6], index[7], index[8],
index[9], index[10])
data.append(team)
ind += 1
# print(data[8].team_name)
main() | [
"mouhibouni321@gmail.com"
] | mouhibouni321@gmail.com |
bbca1de8f3365de6962acd80b69471036e33422e | 68c4805ad01edd612fa714b1e0d210115e28bb7d | /venv/Lib/site-packages/numba/tests/test_config.py | de8371b8b2d4ac9757452a6d5a24a1954ff13f8d | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Happy-Egg/redesigned-happiness | ac17a11aecc7459f4ebf0afd7d43de16fb37ae2c | 08b705e3569f3daf31e44254ebd11dd8b4e6fbb3 | refs/heads/master | 2022-12-28T02:40:21.713456 | 2020-03-03T09:04:30 | 2020-03-03T09:04:30 | 204,904,444 | 2 | 1 | Apache-2.0 | 2022-12-08T06:19:04 | 2019-08-28T10:18:05 | Python | UTF-8 | Python | false | false | 3,444 | py | import os
import tempfile
import unittest
from .support import TestCase, temp_directory, override_env_config
from numba import config
try:
import yaml
_HAVE_YAML = True
except ImportError:
_HAVE_YAML = False
_skip_msg = "pyyaml needed for configuration file tests"
needs_yaml = unittest.skipIf(not _HAVE_YAML, _skip_msg)
@needs_yaml
class TestConfig(TestCase):
# Disable parallel testing due to envvars modification
_numba_parallel_test_ = False
def setUp(self):
# use support.temp_directory, it can do the clean up
self.tmppath = temp_directory('config_tmp')
super(TestConfig, self).setUp()
def mock_cfg_location(self):
"""
Creates a mock launch location.
Returns the location path.
"""
return tempfile.mkdtemp(dir=self.tmppath)
def inject_mock_cfg(self, location, cfg):
"""
Injects a mock configuration at 'location'
"""
tmpcfg = os.path.join(location, config._config_fname)
with open(tmpcfg, 'wt') as f:
yaml.dump(cfg, f, default_flow_style=False)
def get_settings(self):
"""
Gets the current numba config settings
"""
store = dict()
for x in dir(config):
if x.isupper():
store[x] = getattr(config, x)
return store
def create_config_effect(self, cfg):
"""
Returns a config "original" from a location with no config file
and then the impact of applying the supplied cfg dictionary as
a config file at a location in the returned "current".
"""
# store original cwd
original_cwd = os.getcwd()
# create mock launch location
launch_dir = self.mock_cfg_location()
# switch cwd to the mock launch location, get and store settings
os.chdir(launch_dir)
# use override to ensure that the config is zero'd out with respect
# to any existing settings
with override_env_config('_', '_'):
original = self.get_settings()
# inject new config into a file in the mock launch location
self.inject_mock_cfg(launch_dir, cfg)
try:
# override something but don't change the value, this is to refresh
# the config and make sure the injected config file is read
with override_env_config('_', '_'):
current = self.get_settings()
finally:
# switch back to original dir with no new config
os.chdir(original_cwd)
return original, current
def test_config(self):
# ensure a non empty settings file does impact config and that the
# case of the key makes no difference
key = 'COLOR_SCHEME'
for case in [str.upper, str.lower]:
orig, curr = self.create_config_effect({case(key): 'light_bg'})
self.assertTrue(orig != curr)
self.assertTrue(orig[key] != curr[key])
self.assertEqual(curr[key], 'light_bg')
# check that just the color scheme is the cause of difference
orig.pop(key)
curr.pop(key)
self.assertEqual(orig, curr)
def test_empty_config(self):
# ensure an empty settings file does not impact config
orig, curr = self.create_config_effect({})
self.assertEqual(orig, curr)
if __name__ == '__main__':
unittest.main()
| [
"yangyang4910709@163.com"
] | yangyang4910709@163.com |
e0f22fd71048326d2bb4e2124f6e7ddf8ca591cf | a28292ebdda00ff8eb362a83d0f70bce8133258c | /logistic/views.py | a69aef397373a7316af24139daedd638c51b6f7f | [] | no_license | maratkanov-a/logistic | 7681f537c6dc21c2dfbdc89b7af1a3910897af2c | 2fa85f1bcea266f195467e9396ec86e270ca8666 | refs/heads/master | 2021-01-17T08:33:17.395073 | 2016-08-04T09:12:23 | 2016-08-04T09:12:23 | 60,477,657 | 0 | 2 | null | 2016-06-13T15:58:08 | 2016-06-05T19:44:56 | Python | UTF-8 | Python | false | false | 712 | py | from django.core import urlresolvers
from django.views import generic
from logistic import forms
from logistic import models
class Index(generic.CreateView):
template_name = 'logistic/index.html'
form_class = forms.SimpleRequestForm
model = models.SimpleRequestModel
def get_success_url(self):
return urlresolvers.reverse('logistic:message')
class MessageView(generic.TemplateView):
template_name = 'logistic/message.html'
timeout = 0
message = None
def get_context_data(self, **kwargs):
context = super(MessageView, self).get_context_data(**kwargs)
context['timeout'] = self.timeout
context['message'] = self.message
return context
| [
"maratkanov@yandex-team.ru"
] | maratkanov@yandex-team.ru |
ecaddca74190decf179e750f4b15682975147252 | 4fee5cf517f9853cf1a33c3d1bf16247f4ecc34c | /server/log/printout.py | c389144c83c0df2ef4594a811e3d4c64102582c8 | [] | no_license | hoanduy27/GardBot | 8708030fca24bb3787959bb558b615f98fddd4d6 | dd9a87ab1b5c8bf149542c22bbc57c46aec600ba | refs/heads/master | 2023-06-06T10:14:54.886986 | 2021-06-24T15:15:49 | 2021-06-24T15:15:49 | 366,006,154 | 0 | 0 | null | 2021-06-20T03:51:20 | 2021-05-10T10:36:44 | Kotlin | UTF-8 | Python | false | false | 435 | py | class Printout:
INFO_STYLE = '\033[0;37m[INFO]'
ERROR_STYLE = '\033[1;31m[ERROR]'
WARNING_STYLE = '\033[0;33m[WARNING]'
@staticmethod
def i(key, message):
print(f'{Printout.INFO_STYLE} {key}: {message}')
@staticmethod
def e(key, message):
print(f'{Printout.ERROR_STYLE} {key}: {message}')
@staticmethod
def w(key, message):
print(f'{Printout.WARNING_STYLE} {key}: {message}') | [
"hoanduy27@gmail.com"
] | hoanduy27@gmail.com |
f31f612131930929e78310b8e8f88d8b51ffea52 | 5a72c3b3adff4ae034f207268af358161a5f5c4b | /historic_hebrew_dates/values/dict.py | 595216ebb08b6a05ee04e39f0f3e28180920d248 | [
"BSD-3-Clause"
] | permissive | UUDigitalHumanitieslab/historic-hebrew-dates | 3212e437a47a73abc3594dd43d35b1997cf8e418 | 5ace44d9b1315a96a96ea296383f0b618d994212 | refs/heads/develop | 2023-01-24T13:27:44.021311 | 2020-06-24T12:05:30 | 2020-06-24T12:05:30 | 176,713,362 | 1 | 0 | BSD-3-Clause | 2023-01-07T09:13:04 | 2019-03-20T10:53:28 | Python | UTF-8 | Python | false | false | 198 | py | #!/usr/bin/env python3
import yaml
from typing import Dict
def dict_value(expression: str) -> Dict:
values: Dict[str, str] = yaml.safe_load('{' + expression[1:-1] + '}')
return values
| [
"s.j.j.spoel@uu.nl"
] | s.j.j.spoel@uu.nl |
835c27431d3a140adf6503dcd77cb46bc75158db | 27522b219cf00fd702a101cb8192c77bde93f1c6 | /Motorbike Cost - Home Learning Task.py | 3ec7f69e7a5adef9f3813406095e9ae53fd69343 | [] | no_license | Rajan-95/TTA-Home-Learning | 66b9fedb95b2399e6d9daebf1ecdaef1c690e767 | 2a772209c73a9fda526a60954f20df1ccffe7479 | refs/heads/main | 2023-05-26T06:28:03.531230 | 2021-06-15T11:41:56 | 2021-06-15T11:41:56 | 377,140,699 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,444 | py | # Task: Motorcycle costs £2000, print the value of the motorcycle every year until its value drops below £1000.
motorbike = 2000
year2021 = motorbike * 0.9
print("Value of bike in 2021: £" + str(year2021))
year2022 = year2021 * 0.9
print("Value of bike in 2022: £" + str(year2022))
year2023 = year2022 * 0.9
print("Value of bike in 2023: £" + str(year2023))
year2024 = year2023 * 0.9
print("Value of bike in 2024: £" + str(year2024))
year2025 = year2024 * 0.9
print("Value of bike in 2025: £" + str(year2025))
year2026 = year2025 * 0.9
print("Value of bike in 2026: £" + str(year2026))
year2027 = year2026 * 0.9
print("Value of bike in 2027: £" + str(year2027))
print("It will take 7 years for the value of the motorbike to drop below £1000.")
# A condensed version of working out the above is programmed below using the 'while' loop.
motorbike = 2000
year = 2020
# while True: <-- also works as a while statement for this program
# but only if you include "if motorbike >= 1000 \n break"
while(motorbike > 1000):
print("Value of bike in year " + str(year) + ": £" + str(motorbike))
motorbike = motorbike * 0.9
year += 1
print("In the year " + str(year) + ", the value will depreciate below £1000")
# ^ the str(year) will display 2027 in the print statement
# this is because the last year value would be 2026 - this is the last year where the motorbike's value is above £1000
| [
"noreply@github.com"
] | Rajan-95.noreply@github.com |
946c2cf07550b349ae7705ea34918564c9a275a7 | eacdc4bda210386d4773399c3ee46c4f028cca10 | /Parser/Task_3_Handler.py | 21df8c85c3736b41b0e374d1dde47e7cb9e1d0b4 | [] | no_license | 406410672/p_dtb_f | 9d32e333c6b8822d607ee42c75a26eabed896e87 | d04b693c21bd7be8ab8f4ff5add0384b71563017 | refs/heads/master | 2020-03-11T17:42:47.931249 | 2018-05-22T03:35:48 | 2018-05-22T03:35:48 | 130,155,004 | 3 | 2 | null | null | null | null | UTF-8 | Python | false | false | 3,719 | py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/5/9 15:15
# @Author : HT
# @Site :
# @File : Task_3_Handler.py
# @Software: PyCharm Community Edition
# @Describe: Desc
# @Issues : Issues
import functools
import re
from BaseModule.HTMLParser import HTMLParser as hp
from BaseModule.HTTPRequest import user_agent
import asyncio
def config_call_back(config_list, task_info, nid, url, fn):
result = fn.result()
result = result.decode(encoding='gb18030')
parser_data = hp.parser(content=result, task_info=task_info)
data = {
'data': parser_data,
'nid': nid,
'_id': nid,
'url': url
}
config_list.append(data)
def get_other_info_task(config, session):
def call_back(key, fn):
result = fn.result()
result = result.decode(encoding='gb18030')
config['data'][key] = result
descUrl = config.get('data').get('descUrl')
sibUrl = config.get('data').get('sibUrl')
counterApi = config.get('data').get('counterApi')
rateCounterApi = config.get('data').get('rateCounterApi')
nid = config.get('nid')
headers = {
'cache-control': "no-cache",
# 'Cookie': "enc=LbDhv2gVz58iGzjeNvtg0fU9IybnoGvjQHE2B/19d9Qy0xExqp8kQIc0glRxRLs9O+Dcm4D41l0T/azCrIu0iQ==",
'Referer': "https://item.taobao.com/",
'User-Agent': user_agent(),
}
c_headers = {
'cache-control': "no-cache",
'Cookie': "enc=LbDhv2gVz58iGzjeNvtg0fU9IybnoGvjQHE2B/19d9Qy0xExqp8kQIc0glRxRLs9O+Dcm4D41l0T/azCrIu0iQ==",
'Referer': "https://item.taobao.com/",
'User-Agent': user_agent(),
}
task_list = list()
if descUrl == '':
pass
else:
try:
descUrl = re.findall(u"(//.*)'\s", descUrl)[0]
descUrl = 'http:' + descUrl
task = asyncio.ensure_future(session.get_url(url=descUrl, headers=headers))
task.add_done_callback(functools.partial(call_back, 'desc_content'))
task_list.append(task)
except Exception as error:
print('getdescUrl error:{}'.format(error))
if sibUrl == '':
pass
else:
# print(sibUrl)
sibUrl = 'https:' + sibUrl + '&callback=onSibRequestSuccess'
task = asyncio.ensure_future(session.get_url(url=sibUrl, headers=headers))
task.add_done_callback(functools.partial(call_back, 'sib_content'))
task_list.append(task)
if counterApi == '':
pass
else:
# print(counterApi)
counterApi = 'https:' + counterApi + '&callback=jsonp144'
task = asyncio.ensure_future(session.get_url(url=counterApi, headers=headers))
task.add_done_callback(functools.partial(call_back, 'counter_content'))
task_list.append(task)
if rateCounterApi == '':
pass
else:
# print(rateCounterApi)
rateCounterApi = 'https:' + rateCounterApi
task = asyncio.ensure_future(session.get_url(url=rateCounterApi, headers=headers))
task.add_done_callback(functools.partial(call_back, 'rate_content'))
task_list.append(task)
return task_list
# loop.run_until_complete(asyncio.wait(task_list))
if __name__ == '__main__':
info = "location.protocol==='http:' ? '//dsc.taobaocdn.com/i7/560/301/560308936365/TB1Sb.fXFkoBKNjSZFE8qvrEVla.desc%7Cvar%5Edesc%3Bsign%5E2c641960957aac7c3ef991ea5b774075%3Blang%5Egbk%3Bt%5E1519732615' : '//desc.alicdn.com/i7/560/301/560308936365/TB1Sb.fXFkoBKNjSZFE8qvrEVla.desc%7Cvar%5Edesc%3Bsign%5E2c641960957aac7c3ef991ea5b774075%3Blang%5Egbk%3Bt%5E1519732615"
print(re.findall(u"(//.*)'\s", info))
r = {'r':'r'}
print(id(r))
d = r
print(id(d))
print(id(r.copy())) | [
"18316551437@163.com"
] | 18316551437@163.com |
8b6ae75cd27c32f78ea740595757c1a84a66c477 | 6e43937c521b841595fbe7f59268ffc72dfefa9d | /GSP_WEB/views/index/view.py | 8abba08ca5d578311be5a2e72cc36170dcf80929 | [] | no_license | MiscCoding/gsp_web | a5e50ce7591157510021cae49c6b2994f4eaabbe | a24e319974021ba668c5f8b4000ce96d81d1483e | refs/heads/master | 2020-03-28T15:11:30.301700 | 2019-08-12T04:47:42 | 2019-08-12T04:47:42 | 148,565,440 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 19,123 | py | #-*- coding: utf-8 -*-
import datetime
from collections import OrderedDict
from dateutil import parser
from elasticsearch import Elasticsearch
from flask import request, render_template, Blueprint, json
from GSP_WEB import login_required, db_session, app
from GSP_WEB.common.encoder.decimalEncoder import DecimalEncoder
from GSP_WEB.common.util.date_util import Local2UTC
from GSP_WEB.models.CommonCode import CommonCode
from GSP_WEB.models.Nations import nations
from GSP_WEB.models.Rules_BlackList import Rules_BlackList
from GSP_WEB.models.Rules_CNC import Rules_CNC
from GSP_WEB.query import dashboard
from GSP_WEB.query.dashboard import *
blueprint_page = Blueprint('bp_index_page', __name__, url_prefix='/index')
@blueprint_page.route('', methods=['GET'])
@login_required
# def getIndex():
# timenow = datetime.datetime.now().strftime("%Y-%m-%d")
# return render_template('index/dashboard.html', timenow = timenow)
def getIndex():
uri = CommonCode.query.filter_by(GroupCode='dashboard_link').filter_by(Code ='001').first()
return render_template('index/dashboard_kibana.html', kibana_link = uri.EXT1)
@blueprint_page.route('/DashboardLink', methods=['PUT'])
def setDashboardLink():
uri = CommonCode.query.filter_by(GroupCode='dashboard_link').filter_by(Code='001').first()
uri.EXT1 = request.form.get('link')
db_session.commit()
return ''
def todayUrlAnalysis(request, query_type = "uri"):
per_page = 1
start_idx = 0
end_dt = "now/d"
str_dt = "now-1d/d"
# "now-1d/d", "now/d"
query = {
"size": per_page,
"from": start_idx,
"query": {
"bool": {
"must": [
{
"range": {"@timestamp": {"gte": str_dt, "lte": end_dt}}
}, {
"term": {"analysis_type": query_type}
}
]
}
}
}
return query
def todayFileAnalysis(request, query_type = "file"):
per_page = 1
start_idx = 0
end_dt = "now/d"
str_dt = "now-1d/d"
# "now-1d/d", "now/d"
query = {
"size": per_page,
"from": start_idx,
"query": {
"bool": {
"must": [
{
"range": {"@timestamp": {"gte": str_dt, "lte": end_dt}}
}, {
"term": {"analysis_type": query_type}
}
]
}
}
}
return query
def totalMaliciousUrlQuery(request, query_type = "uri"):
per_page = 1
start_idx = 0
end_dt = "now/d"
str_dt = "now-1d/d"
# "now-1d/d", "now/d"
# timebefore = (datetime.datetime.now() - datetime.timedelta(minutes=5)).strftime("%Y-%m-%d %H:%M")
# before = parser.parse(timebefore).isoformat()
# timeNow = datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
# now = parser.parse(timeNow).isoformat()
query = {
"size": per_page,
"from": start_idx,
"query": {
"bool": {
"must": [
{
"term": {"analysis_type": query_type}
}
# {
# "range":
# {
# "security_level": {"gte": "4"}
# }
# }
]
}
}
}
secQuery = {"range": {"security_level": {"gte": int(app.config['ANALYSIS_RESULTS_SECURITY_LEVEL_MIN'])}}}
query["query"]["bool"]["must"].append(secQuery)
return query
def totalMaliciousQuery(request, query_type):
per_page = 1
start_idx = 0
end_dt = "now/d"
str_dt = "now-1d/d"
# "now-1d/d", "now/d"
# timebefore = (datetime.datetime.now() - datetime.timedelta(minutes=5)).strftime("%Y-%m-%d %H:%M")
# before = parser.parse(timebefore).isoformat()
# timeNow = datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
# now = parser.parse(timeNow).isoformat()
query = {
"size": per_page,
"from": start_idx,
"query": {
"bool": {
"must": [
# {
# "range": {"@timestamp": {"gte": str_dt, "lte": end_dt}}
# }
# {
# "range":
# {
# "security_level": {"gte": "4"}
# }
# }
]
}
}
}
secQuery = {"range": {"security_level": {"gte": int(app.config['ANALYSIS_RESULTS_SECURITY_LEVEL_MIN'])}}}
query["query"]["bool"]["must"].append(secQuery)
return query
def todayURLFileCount(type, device):
end_dt = "now/d"
str_dt = "now-1d/d"
query = {
"query": {
"bool": {
"must": [
# {
# "range": {"@timestamp": {"gt": str_dt, "lte": end_dt}}
# }
]
}
}
}
dataFrom = {"match" : {"data_from" : {"query":device, "type":"phrase"}}}
analysisType = {"match": {"analysis_type": {"query": type, "type": "phrase"}}}
range = { "range": {"@timestamp": {"gt": str_dt, "lte": end_dt}}}
# secQuery = {"range": {"security_level": {"gte": int(app.config['ANALYSIS_RESULTS_SECURITY_LEVEL_MIN'])}}}
query["query"]["bool"]["must"].append(dataFrom)
query["query"]["bool"]["must"].append(analysisType)
query["query"]["bool"]["must"].append(range)
return query
@blueprint_page.route('/getTopBoard')
def getTopBoard():
query = dashboard.topboardQuery
results = db_session.execute(query)
total = 0
before_total = 0
totalMaliciousCodeCount = 0
totalTodayUriAnalysisCount = 0
totalTodayUriAnalysisCountNPC = 0
totalTodayUriAnalysisCountIMAS = 0
totalTodayMaliciousFileCount = 0
totalTodayMaliciousFileCountIMAS = 0
totalTodayMaliciousFileCountNPC = 0
totalTodayMaliciousFileCountZombieZero = 0
totalMaliciousUrlCount = 0
totalMaliciousUrlCountRDBMS = 0
totalMaliciousFileCountRDBMS = 0
totalYesterdayMaliciousUrlCount = 0
totalYesterdayMaliciousFileCount = 0
#blackList count query to MySQL
blackListQueryResult = Rules_BlackList.query
blackListQueryResult = blackListQueryResult.filter_by(source = 750)
blackListQueryResult = blackListQueryResult.count()
totalMaliciousFileCountRDBMS = blackListQueryResult
#CNC url count by RDBMS
cncRuleQueryResult = Rules_CNC.query
cncRuleQueryResult = cncRuleQueryResult.count()
totalMaliciousUrlCountRDBMS = cncRuleQueryResult
es = Elasticsearch([{'host': app.config['ELASTICSEARCH_URI'], 'port': app.config['ELASTICSEARCH_PORT']}])
##total Malicious code count
# query_type = ""
# doc = totalMaliciousQuery(request, query_type)
# res = es.search(index="gsp*" + "", doc_type="analysis_results", body=doc)
# totalMaliciousCodeCount = int(res['hits']['total']) #Total malicious code count
##total malicious url count
# MFdoc = totalMaliciousUrlQuery(request, "uri")
# res = es.search(index="gsp*" + "", doc_type="analysis_results", body=MFdoc)
# totalMaliciousUrlCount = int(res['hits']['total'])
##total tody uri analysis count NPC
MUdoc = todayURLFileCount("uri", "NPC")
res = es.count(index="gsp*" + "", doc_type="analysis_results", body=MUdoc)
totalTodayUriAnalySisCountNPC = res['count']
##total tody uri analysis count NPC
MUdoc = todayURLFileCount("uri", "IMAS")
res = es.count(index="gsp*" + "", doc_type="analysis_results", body=MUdoc)
totalTodayUriAnalySisCountIMAS = res['count']
##total today file analysis count NPC
MFdoc = todayURLFileCount("file", "NPC")
res = es.count(index="gsp*" + "", doc_type="analysis_results", body=MFdoc)
totalTodayMaliciousFileCountNPC = res['count']
##total today file analysis count IMAS
MFdoc = todayURLFileCount("file", "IMAS")
res = es.count(index="gsp*" + "", doc_type="analysis_results", body=MFdoc)
totalTodayMaliciousFileCountIMAS = res['count']
##total today file analysis count ZombieZero
MFdoc = todayURLFileCount("file", "zombie zero")
res = es.count(index="gsp*" + "", doc_type="analysis_results", body=MFdoc)
totalTodayMaliciousFileCountZombieZero = res['count']
# MFdoc = todayFileAnalysis(request, "file")
# res = es.search(index="gsp*" + "", doc_type="analysis_results", body=MFdoc)
# totalTodayMaliciousFileCount = int(res['hits']['total'])
##total yesterday malicious url count
MFdoc = dashboard.yesterdayUrlFileAnalysis(request, "uri")
res = es.search(index="gsp*" + "", doc_type="analysis_results", body=MFdoc)
totalYesterdayMaliciousUrlCount= int(res['hits']['total'])
##total yesterday malicious file count
MFdoc = dashboard.yesterdayUrlFileAnalysis(request, "file")
res = es.search(index="gsp*" + "", doc_type="analysis_results", body=MFdoc)
totalYesterdayMaliciousFileCount = int(res['hits']['total'])
result = dict()
result['spread'] = 0
result['cnc'] = 0
result['bcode'] = 0
result['before_spread'] = 0
result['before_cnc'] = 0
result['before_bcode'] = 0
result['link'] = 0
result['before_link'] = 0
result['uri'] = 0
result['before_uri'] = 0
result['file'] = 0
result['before_file'] = 0
result['totalTodayUriAnalysisCount'] = 0
result['totalTodayUriAnalysisCountNPC'] = 0
result['totalTodayUriAnalysisCountIMAS'] = 0
result['totalTodayMaliciousFileCount'] = 0
result['totalTodayMaliciousFileCountNPC'] = 0
result['totalTodayMaliciousFileCountIMAS'] = 0
result['totalTodayMaliciousFileCountZombieZero'] = 0
result['totalMaliciousUrlQuery'] = 0
result['totalYesterdayMaliciousUrlCount'] = 0
result['totalYesterdayMaliciousFileCount'] = 0
#region db 쿼리
for _row in results :
if _row['date'] == datetime.datetime.now().strftime("%Y-%m-%d"):
if _row['Code'] == "003":
result['spread'] = _row['count']
elif _row['Code'] == "001":
result['cnc'] = _row['count']
elif _row['Code'] == "-":
result['bcode'] = _row['count']
total += _row['count']
else:
if _row['Code'] == "003":
result['before_spread'] = _row['count']
elif _row['Code'] == "001":
result['before_cnc'] = _row['count']
elif _row['Code'] == "-":
result['before_bcode'] = _row['count']
before_total += _row['count']
#endregion eb 쿼리
index = app.config['ELASTICSEARCH_INDEX_HEAD'] + datetime.datetime.now().strftime('%Y.%m.%d')
#region es 쿼리
query = dashboard.topboardEsQuery("now-1d/d", "now/d")
es = Elasticsearch([{'host': app.config['ELASTICSEARCH_URI'], 'port': int(app.config['ELASTICSEARCH_PORT'])}])
res = es.search(index="gsp*", body=query, request_timeout=30) #url_crawlds 인덱스 문제로 임시 해결책 18-03-06
for _row in res['aggregations']['types']['buckets']:
if _row['key'] == "link_dna_tuple5":
result['link'] = _row['doc_count']
total += _row['doc_count']
elif _row['key'] == "url_jobs":
result['uri'] = _row['doc_count']
total += _row['doc_count']
elif _row['key'] == "url_crawleds":
result['file'] = _row['doc_count']
total += _row['doc_count']
index = app.config['ELASTICSEARCH_INDEX_HEAD'] + datetime.datetime.now().strftime('%Y.%m.%d')
query = dashboard.topboardEsQuery("now-2d/d", "now-1d/d")
es = Elasticsearch([{'host': app.config['ELASTICSEARCH_URI'], 'port': int(app.config['ELASTICSEARCH_PORT'])}])
res = es.search(index="gsp*", body=query, request_timeout=30) #url_crawlds 인덱스 문제로 임시 해결책 18-03-06
for _row in res['aggregations']['types']['buckets']:
if _row['key'] == "link_dna_tuple5":
result['before_link'] = _row['doc_count']
before_total += _row['doc_count']
elif _row['key'] == "url_jobs":
result['before_uri'] = _row['doc_count']
before_total += _row['doc_count']
elif _row['key'] == "url_crawleds":
result['before_file'] = _row['doc_count']
before_total += _row['doc_count']
#endregion es 쿼리
# result['bcode'] = 34
# result['before_bcode'] = 11
# result['spread'] = 35
# result['before_spread'] = 21
# result['before_cnc'] = 7
# result['file'] = 1752
# result['before_file'] = 1127
result['totalTodayUriAnalysisCount'] = totalTodayUriAnalysisCount
result['totalTodayMaliciousFileCount'] = totalTodayMaliciousFileCount
result['totalMaliciousUrlCount']= totalMaliciousUrlCountRDBMS
result['totalYesterdayMaliciousUrlCount'] = totalYesterdayMaliciousUrlCount
result['totalYesterdayMaliciousFileCount'] = totalYesterdayMaliciousFileCount
result['totalTodayUriAnalysisCountNPC'] = totalTodayUriAnalySisCountNPC
result['totalTodayUriAnalysisCountIMAS'] = totalTodayUriAnalySisCountIMAS
result['totalTodayMaliciousFileCountNPC'] = totalTodayMaliciousFileCountNPC
result['totalTodayMaliciousFileCountIMAS'] = totalTodayMaliciousFileCountIMAS
result['totalTodayMaliciousFileCountZombieZero'] = totalTodayMaliciousFileCountZombieZero
result['cnc'] = totalMaliciousFileCountRDBMS
result['cnc_before'] = 13
result['total'] = total
result['before_total'] = before_total
return json.dumps(result)
@blueprint_page.route('/getLineChart')
def getLineChartData():
query = dashboard.linechartQuery
results = db_session.execute(query)
results_list = []
for _row in results:
results_list.append(_row)
now = datetime.datetime.now()
timetable = []
chartdata = OrderedDict()
series = []
for _dd in range(0,10):
_now = datetime.datetime.now() - datetime.timedelta(days=9) + datetime.timedelta(days=_dd)
_series = dict()
_series['xaxis'] = _now.strftime('%Y-%m-%d')
_series['date'] = _now.strftime('%m월%d일')
isCncExists = False
isSpreadExists = False
isCode = False
for row in results_list:
if row['date'] == _series['xaxis']:
if row is not None:
if row['Code'] == '001':
isCncExists = True
_series['CNC'] = row['count']
elif row['Code'] == '003':
isSpreadExists = True
_series['spread'] = row['count']
elif row['Code'] == "-":
isCode = True
_series['bcode'] = row['count']
if isCncExists != True:
_series['CNC'] = 0
if isSpreadExists != True:
_series['spread'] = 0
if isCode != True:
_series['bcode'] = 0
series.append(_series)
chartdata['data'] = series
result = chartdata
return json.dumps(result)
@blueprint_page.route('/getBarChart')
def getBarChartData():
query = dashboard.barchartQuery
results = db_session.execute(query)
results_list = []
for _row in results:
results_list.append(_row)
now = datetime.datetime.now()
timetable = []
chartdata = OrderedDict()
series = []
for _dd in range(0,10):
_now = datetime.datetime.now() - datetime.timedelta(days=9) + datetime.timedelta(days=_dd)
_series = dict()
_series['xaxis'] = _now.strftime('%Y-%m-%d')
_series['date'] = _now.strftime('%m월%d일')
isExists = False
for row in results_list:
if row['date'] == _series['xaxis']:
if row is not None:
isExists = True
count = row['count']
_series['value'] = int(count)
if isExists != True:
_series['value'] = 0
series.append(_series)
chartdata['data'] = series
result = chartdata
return json.dumps(result)
@blueprint_page.route('/getGrid')
def getGrid():
query = dashboard.gridQuery
results = db_session.execute(query)
results_list = []
for _row in results:
dict_row = dict()
dict_row['date'] = _row[0]
dict_row['cnc'] = _row[1]
dict_row['spread'] = _row[2]
dict_row['bcode'] = _row[3]
dict_row['total'] = _row[1] + _row[2] + _row[3]
results_list.append(dict_row)
return json.dumps(results_list,cls=DecimalEncoder)
# for _item in res['aggregations']['topn']['hits']['hits']:
# _series = dict()
# _series['xaxis'] = _item['_source']['cl_ip']
# _series['yaxis'] = _item['_source']['cnt']
# _series['avg'] = res['aggregations']['avg']['value']
# _series['std_dev'] = res['aggregations']['ex_stats']['std_deviation_bounds']['upper']
@blueprint_page.route('/getWorldChart')
def getWorldChart():
es = Elasticsearch([{'host': app.config['ELASTICSEARCH_URI'], 'port': int(app.config['ELASTICSEARCH_PORT'])}])
timeSetting = request.args['timeSetting']
edTime = parser.parse(timeSetting) + datetime.timedelta(days=1)
str_dt = Local2UTC(parser.parse(timeSetting)).isoformat()
end_dt = Local2UTC(edTime).isoformat()
body = getWorldChartQuery(str_dt,end_dt, app.config['ANALYSIS_RESULTS_SECURITY_LEVEL_MIN'])
res = es.search(index=app.config['ELASTICSEARCH_INDEX'], doc_type="analysis_results", body=body, request_timeout=30)
mapData = []
latlong = dict()
i = 0
for doc in res['aggregations']['group_by_country2']['buckets']:
if doc['key'] == '':
continue
_nation = (_nation for _nation in nations if _nation["code"] == doc['key']).next()
mapData.append({"code": doc['key'], "name": _nation['nation'], 'value': doc['doc_count'], 'color': colorlist[i]})
if i >= colorlist.__len__()-1:
i = 0
else:
i = i +1
latlong[doc['key']] = { "latitude" : _nation['latitude'], "longitude" : _nation['longitude']}
# mapData = []
# latlong = dict()
# mapData.append({"code": 'KR', "name": "korea", 'value': 6, 'color': colorlist[0]})
# mapData.append({"code" : 'CN', "name" : "china", 'value' : 21, 'color' : colorlist[1] } )
# mapData.append({"code": 'US', "name": "us", 'value': 7, 'color': colorlist[2]})
# latlong['KR'] = { "latitude" : 37.00, "longitude" : 127.30 }
# latlong['CN'] = {"latitude": 35.00, "longitude": 105.00}
# latlong['US'] = {"latitude": 38.00, "longitude": -97.00}
chartdata = OrderedDict()
chartdata['latlong'] = latlong
chartdata['mapData'] = mapData
return json.dumps(chartdata)
colorlist = [
'#eea638',
'#d8854f',
'#de4c4f',
'#86a965',
'#d8854f',
'#8aabb0',
'#eea638'
] | [
"neogeo-s@hanmail.net"
] | neogeo-s@hanmail.net |
5309bdadded82baf1d63c7d55531b2e1182bd445 | 33513f18f4ee7db581a9ccca0d15e04d3dca0e2d | /detector/YOLOv3/detector.py | 4bacdb526423c9e1f55ae6639029ba7a3ba5eab0 | [
"MIT"
] | permissive | xuarehere/yolo_series_deepsort_pytorch | 0dd73774497dadcea499b511543f3b75e29d53e1 | 691e6eb94260874de29a65702269806fc447cf8c | refs/heads/master | 2023-05-23T18:32:00.991714 | 2023-02-01T10:58:18 | 2023-02-01T10:58:18 | 513,482,826 | 36 | 6 | null | null | null | null | UTF-8 | Python | false | false | 4,001 | py | import torch
import logging
import numpy as np
import cv2
try:
from .darknet import Darknet
from .yolo_utils import get_all_boxes, nms, post_process, xywh_to_xyxy, xyxy_to_xywh
from .nms import boxes_nms
except:
from darknet import Darknet
from yolo_utils import get_all_boxes, nms, post_process, xywh_to_xyxy, xyxy_to_xywh
from nms import boxes_nms
# from vizer.draw import draw_boxes
class YOLOv3(object):
def __init__(self, cfgfile, weightfile, namesfile, score_thresh=0.7, conf_thresh=0.01, nms_thresh=0.45,
is_xywh=False, use_cuda=True):
# net definition
self.net = Darknet(cfgfile)
self.net.load_weights(weightfile)
logger = logging.getLogger("root.detector")
logger.info('Loading weights from %s... Done!' % (weightfile))
self.device = "cuda" if use_cuda else "cpu"
self.net.eval()
self.net.to(self.device)
# constants
self.size = self.net.width, self.net.height
self.score_thresh = score_thresh
self.conf_thresh = conf_thresh
self.nms_thresh = nms_thresh
self.use_cuda = use_cuda
self.is_xywh = is_xywh
self.num_classes = self.net.num_classes
self.class_names = self.load_class_names(namesfile)
def __call__(self, ori_img):
# img to tensor
assert isinstance(ori_img, np.ndarray), "input must be a numpy array!"
img = ori_img.astype(np.float32) / 255.
img = cv2.resize(img, self.size)
img = torch.from_numpy(img).float().permute(2, 0, 1).unsqueeze(0)
# forward
with torch.no_grad():
img = img.to(self.device)
out_boxes = self.net(img)
boxes = get_all_boxes(out_boxes, self.conf_thresh, self.num_classes,
use_cuda=self.use_cuda) # batch size is 1
# boxes = nms(boxes, self.nms_thresh)
boxes = post_process(boxes, self.net.num_classes, self.conf_thresh, self.nms_thresh)[0].cpu()
boxes = boxes[boxes[:, -2] > self.score_thresh, :] # bbox xmin ymin xmax ymax; Detections matrix nx6 (xyxy, conf, cls)
if len(boxes) == 0:
bbox = torch.FloatTensor([]).reshape([0, 4])
cls_conf = torch.FloatTensor([])
cls_ids = torch.LongTensor([])
else:
height, width = ori_img.shape[:2]
bbox = boxes[:, :4]
if self.is_xywh:
# bbox x y w h
bbox = xyxy_to_xywh(bbox)
bbox *= torch.FloatTensor([[width, height, width, height]]) # bbox 比例 ==》 实际的像素位置
cls_conf = boxes[:, 5]
cls_ids = boxes[:, 6].long()
return bbox.numpy(), cls_conf.numpy(), cls_ids.numpy()
def load_class_names(self, namesfile):
with open(namesfile, 'r', encoding='utf8') as fp:
class_names = [line.strip() for line in fp.readlines()]
return class_names
def demo():
import os
from vizer.draw import draw_boxes
yolo = YOLOv3("cfg/yolo_v3.cfg", "weight/yolov3.weights", "cfg/coco.names")
print("yolo.size =", yolo.size)
root = "./demo"
resdir = os.path.join(root, "results")
os.makedirs(resdir, exist_ok=True)
files = [os.path.join(root, file) for file in os.listdir(root) if file.endswith('.jpg')]
files.sort()
for filename in files:
img = cv2.imread(filename)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
bbox, cls_conf, cls_ids = yolo(img)
if bbox is not None:
img = draw_boxes(img, bbox, cls_ids, cls_conf, class_name_map=yolo.class_names)
# save results
cv2.imwrite(os.path.join(resdir, os.path.basename(filename)), img[:, :, (2, 1, 0)])
# imshow
# cv2.namedWindow("yolo", cv2.WINDOW_NORMAL)
# cv2.resizeWindow("yolo", 600,600)
# cv2.imshow("yolo",res[:,:,(2,1,0)])
# cv2.waitKey(0)
if __name__ == "__main__":
demo()
| [
"xuarehere@foxmail.com"
] | xuarehere@foxmail.com |
164b19c6ae1bd8b400a1296c2b5d3a93cddf328d | 9b9a02657812ea0cb47db0ae411196f0e81c5152 | /repoData/RobSpectre-Call-Your-Family/allPythonContent.py | dfea466529f966662dd2984fc56f28256ffdd134 | [] | no_license | aCoffeeYin/pyreco | cb42db94a3a5fc134356c9a2a738a063d0898572 | 0ac6653219c2701c13c508c5c4fc9bc3437eea06 | refs/heads/master | 2020-12-14T14:10:05.763693 | 2016-06-27T05:15:15 | 2016-06-27T05:15:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 39,193 | py | __FILENAME__ = app
import os
import signal
from flask import Flask
from flask import render_template
from flask import url_for
from flask import request
from twilio import twiml
# Declare and configure application
app = Flask(__name__, static_url_path='/static')
app.config.from_pyfile('local_settings.py')
@app.route('/', methods=['GET', 'POST'])
def index():
# Make sure we have this host configured properly.
config_errors = []
for option in ['TWILIO_ACCOUNT_SID', 'TWILIO_AUTH_TOKEN']:
if not app.config[option]:
config_errors.append("%s is not configured for this host."
% option)
# Define important links
params = {
'sms_request_url': url_for('.sms', _external=True),
'config_errors': config_errors}
return render_template('thankyou.html', params=params)
@app.route('/voice', methods=['POST'])
def voice():
response = twiml.Response()
with response.dial(callerId=app.config['TWILIO_CALLER_ID'],
timeLimit="600") as dial:
dial.number(request.form['PhoneNumber'])
return str(response)
@app.route('/inbound', methods=['POST'])
def inbound():
response = twiml.Response()
response.play('/static/sounds/inbound.mp3')
return str(response)
@app.route('/sms', methods=['GET', 'POST'])
def sms():
# Respond to any text inbound text message with a link to the app!
response = twiml.Response()
response.sms("This number belongs to the Twilio Call Your Family app " \
"for Boston. Please visit " \
"http://callyourfamily.twilio.ly for more info.")
return str(response)
# Handles SIGTERM so that we don't get an error when Heroku wants or needs to
# restart the dyno
def graceful_shutdown(signum, frame):
exit()
signal.signal(signal.SIGTERM, graceful_shutdown)
if __name__ == '__main__':
port = int(os.environ.get("PORT", 5000))
if port == 5000:
app.debug = True
app.run(host='0.0.0.0', port=port)
########NEW FILE########
__FILENAME__ = configure
'''
Hackpack Configure
A script to configure your TwiML apps and Twilio phone numbers to use your
hackpack's Heroku app.
Usage:
Auto-configure using your local_settings.py:
python configure.py
Deploy to new Twilio number and App Sid:
python configure.py --new
Deploy to specific App Sid:
python configure.py --app APxxxxxxxxxxxxxx
Deploy to specific Twilio number:
python configure.py --number +15556667777
Deploy to custom domain:
python configure.py --domain example.com
'''
from optparse import OptionParser
import sys
import subprocess
import logging
from twilio.rest import TwilioRestClient
from twilio import TwilioRestException
import local_settings
class Configure(object):
def __init__(self, account_sid=local_settings.TWILIO_ACCOUNT_SID,
auth_token=local_settings.TWILIO_AUTH_TOKEN,
app_sid=local_settings.TWILIO_APP_SID,
phone_number=local_settings.TWILIO_CALLER_ID,
voice_url='/voice',
sms_url='/sms',
host=None):
self.account_sid = account_sid
self.auth_token = auth_token
self.app_sid = app_sid
self.phone_number = phone_number
self.host = host
self.voice_url = voice_url
self.sms_url = sms_url
self.friendly_phone_number = None
def start(self):
logging.info("Configuring your Twilio hackpack...")
logging.debug("Checking if credentials are set...")
if not self.account_sid:
raise ConfigurationError("ACCOUNT_SID is not set in " \
"local_settings.")
if not self.auth_token:
raise ConfigurationError("AUTH_TOKEN is not set in " \
"local_settings.")
logging.debug("Creating Twilio client...")
self.client = TwilioRestClient(self.account_sid, self.auth_token)
logging.debug("Checking if host is set.")
if not self.host:
logging.debug("Hostname is not set...")
self.host = self.getHerokuHostname()
# Check if urls are set.
logging.debug("Checking if all urls are set.")
if "http://" not in self.voice_url:
self.voice_url = self.host + self.voice_url
logging.debug("Setting voice_url with host: %s" % self.voice_url)
if "http://" not in self.sms_url:
self.sms_url = self.host + self.sms_url
logging.debug("Setting sms_url with host: %s" % self.sms_url)
if self.configureHackpack(self.voice_url, self.sms_url,
self.app_sid, self.phone_number):
# Configure Heroku environment variables.
self.setHerokuEnvironmentVariables(
TWILIO_ACCOUNT_SID=self.account_sid,
TWILIO_AUTH_TOKEN=self.auth_token,
TWILIO_APP_SID=self.app_sid,
TWILIO_CALLER_ID=self.phone_number)
# Ensure local environment variables are set.
self.printLocalEnvironmentVariableCommands(
TWILIO_ACCOUNT_SID=self.account_sid,
TWILIO_AUTH_TOKEN=self.auth_token,
TWILIO_APP_SID=self.app_sid,
TWILIO_CALLER_ID=self.phone_number)
logging.info("Hackpack is now configured. Call %s to test!"
% self.friendly_phone_number)
else:
logging.error("There was an error configuring your hackpack. " \
"Weak sauce.")
def configureHackpack(self, voice_url, sms_url, app_sid,
phone_number, *args):
# Check if app sid is configured and available.
if not app_sid:
app = self.createNewTwiMLApp(voice_url, sms_url)
else:
app = self.setAppRequestUrls(app_sid, voice_url, sms_url)
# Check if phone_number is set.
if not phone_number:
number = self.purchasePhoneNumber()
else:
number = self.retrievePhoneNumber(phone_number)
# Configure phone number to use App Sid.
logging.info("Setting %s to use application sid: %s" %
(number.friendly_name, app.sid))
try:
self.client.phone_numbers.update(number.sid,
voice_application_sid=app.sid,
sms_application_sid=app.sid)
logging.debug("Number set.")
except TwilioRestException, e:
raise ConfigurationError("An error occurred setting the " \
"application sid for %s: %s" % (number.friendly_name,
e))
# We're done!
if number:
return number
else:
raise ConfigurationError("An unknown error occurred configuring " \
"request urls for this hackpack.")
def createNewTwiMLApp(self, voice_url, sms_url):
logging.debug("Asking user to create new app sid...")
i = 0
while True:
i = i + 1
choice = raw_input("Your APP_SID is not configured in your " \
"local_settings. Create a new one? [y/n]").lower()
if choice == "y":
try:
logging.info("Creating new application...")
app = self.client.applications.create(voice_url=voice_url,
sms_url=sms_url,
friendly_name="Hackpack for Heroku and Flask")
break
except TwilioRestException, e:
raise ConfigurationError("Your Twilio app couldn't " \
"be created: %s" % e)
elif choice == "n" or i >= 3:
raise ConfigurationError("Your APP_SID setting must be " \
"set in local_settings.")
else:
logging.error("Please choose yes or no with a 'y' or 'n'")
if app:
logging.info("Application created: %s" % app.sid)
self.app_sid = app.sid
return app
else:
raise ConfigurationError("There was an unknown error " \
"creating your TwiML application.")
def setAppRequestUrls(self, app_sid, voice_url, sms_url):
logging.info("Setting request urls for application sid: %s" \
% app_sid)
try:
app = self.client.applications.update(app_sid, voice_url=voice_url,
sms_url=sms_url,
friendly_name="Hackpack for Heroku and Flask")
except TwilioRestException, e:
if "HTTP ERROR 404" in str(e):
raise ConfigurationError("This application sid was not " \
"found: %s" % app_sid)
else:
raise ConfigurationError("An error setting the request URLs " \
"occured: %s" % e)
if app:
logging.debug("Updated application sid: %s " % app.sid)
return app
else:
raise ConfigurationError("An unknown error occuring "\
"configuring request URLs for app sid.")
def retrievePhoneNumber(self, phone_number):
logging.debug("Retrieving phone number: %s" % phone_number)
try:
logging.debug("Getting sid for phone number: %s" % phone_number)
number = self.client.phone_numbers.list(
phone_number=phone_number)
except TwilioRestException, e:
raise ConfigurationError("An error setting the request URLs " \
"occured: %s" % e)
if number:
logging.debug("Retrieved sid: %s" % number[0].sid)
self.friendly_phone_number = number[0].friendly_name
return number[0]
else:
raise ConfigurationError("An unknown error occurred retrieving " \
"number: %s" % phone_number)
def purchasePhoneNumber(self):
logging.debug("Asking user to purchase phone number...")
i = 0
while True:
i = i + 1
# Find number to purchase
choice = raw_input("Your CALLER_ID is not configured in your " \
"local_settings. Purchase a new one? [y/n]").lower()
if choice == "y":
break
elif choice == "n" or i >= 3:
raise ConfigurationError("To configure this " \
"hackpack CALLER_ID must set in local_settings or " \
"a phone number must be purchased.")
else:
logging.error("Please choose yes or no with a 'y' or 'n'")
logging.debug("Confirming purchase...")
i = 0
while True:
i = i + 1
# Confirm phone number purchase.
choice = raw_input("Are you sure you want to purchase? " \
"Your Twilio account will be charged $1. [y/n]").lower()
if choice == "y":
try:
logging.debug("Purchasing phone number...")
number = self.client.phone_numbers.purchase(
area_code="646")
logging.debug("Phone number purchased: %s" %
number.friendly_name)
break
except TwilioRestException, e:
raise ConfigurationError("Your Twilio app couldn't " \
"be created: %s" % e)
elif choice == "n" or i >= 3:
raise ConfigurationError("To configure this " \
"hackpack CALLER_ID must set in local_settings or " \
"a phone number must be purchased.")
else:
logging.error("Please choose yes or no with a 'y' or 'n'")
# Return number or error out.
if number:
logging.debug("Returning phone number: %s " % number.friendly_name)
self.phone_number = number.phone_number
self.friendly_phone_number = number.friendly_name
return number
else:
raise ConfigurationError("There was an unknown error purchasing " \
"your phone number.")
def getHerokuHostname(self, git_config_path='./.git/config'):
logging.debug("Getting hostname from git configuration file: %s" \
% git_config_path)
# Load git configuration
try:
logging.debug("Loading git config...")
git_config = file(git_config_path).readlines()
except IOError, e:
raise ConfigurationError("Could not find .git config. Does it " \
"still exist? Failed path: %s" % e)
logging.debug("Finding Heroku remote in git configuration...")
subdomain = None
for line in git_config:
if "git@heroku.com" in line:
s = line.split(":")
subdomain = s[1].replace('.git', '')
logging.debug("Heroku remote found: %s" % subdomain)
if subdomain:
host = "http://%s.herokuapp.com" % subdomain.strip()
logging.debug("Returning full host: %s" % host)
return host
else:
raise ConfigurationError("Could not find Heroku remote in " \
"your .git config. Have you created the Heroku app?")
def printLocalEnvironmentVariableCommands(self, **kwargs):
logging.info("Copy/paste these commands to set your local " \
"environment to use this hackpack...")
print "\n"
for k, v in kwargs.iteritems():
if v:
print "export %s=%s" % (k, v)
print "\n"
def setHerokuEnvironmentVariables(self, **kwargs):
logging.info("Setting Heroku environment variables...")
envvars = ["%s=%s" % (k, v) for k, v in kwargs.iteritems() if v]
envvars.insert(0, "heroku")
envvars.insert(1, "config:add")
return subprocess.call(envvars)
class ConfigurationError(Exception):
def __init__(self, message):
#Exception.__init__(self, message)
logging.error(message)
# Logging configuration
logging.basicConfig(level=logging.INFO, format='%(message)s')
# Parser configuration
usage = "Twilio Hackpack Configurator - an easy way to configure " \
"configure your hackpack!\n%prog [options] arg1 arg2"
parser = OptionParser(usage=usage, version="Twilio Hackpack Configurator 1.0")
parser.add_option("-S", "--account_sid", default=None,
help="Use a specific Twilio ACCOUNT_SID.")
parser.add_option("-K", "--auth_token", default=None,
help="Use a specific Twilio AUTH_TOKEN.")
parser.add_option("-n", "--new", default=False, action="store_true",
help="Purchase new Twilio phone number and configure app to use " \
"your hackpack.")
parser.add_option("-N", "--new_app", default=False, action="store_true",
help="Create a new TwiML application sid to use for your " \
"hackpack.")
parser.add_option("-a", "--app_sid", default=None,
help="Configure specific AppSid to use your hackpack.")
parser.add_option("-#", "--phone-number", default=None,
help="Configure specific Twilio number to use your hackpack.")
parser.add_option("-v", "--voice_url", default=None,
help="Set the route for your Voice Request URL: (e.g. '/voice').")
parser.add_option("-s", "--sms_url", default=None,
help="Set the route for your SMS Request URL: (e.g. '/sms').")
parser.add_option("-d", "--domain", default=None,
help="Set a custom domain.")
parser.add_option("-D", "--debug", default=False,
action="store_true", help="Turn on debug output.")
def main():
(options, args) = parser.parse_args()
# Configurator configuration :)
configure = Configure()
# Options tree
if options.account_sid:
configure.account_sid = options.account_sid
if options.auth_token:
configure.auth_token = options.auth_token
if options.new:
configure.phone_number = None
if options.new_app:
configure.app_sid = None
if options.app_sid:
configure.app_sid = options.app_sid
if options.phone_number:
configure.phone_number = options.phone_number
if options.voice_url:
configure.voice_url = options.voice_url
if options.sms_url:
configure.sms_url = options.sms_url
if options.domain:
configure.host = options.domain
if options.debug:
logging.basicConfig(level=logging.DEBUG,
format='%(levelname)s - %(message)s')
configure.start()
if __name__ == "__main__":
main()
########NEW FILE########
__FILENAME__ = local_settings
'''
Configuration Settings
'''
''' Uncomment to configure using the file.
WARNING: Be careful not to post your account credentials on GitHub.
TWILIO_ACCOUNT_SID = "ACxxxxxxxxxxxxx"
TWILIO_AUTH_TOKEN = "yyyyyyyyyyyyyyyy"
TWILIO_APP_SID = "APzzzzzzzzz"
TWILIO_CALLER_ID = "+17778889999"
IOS_URI = "http://phobos.apple.com/whatever"
ANDROID_URI = "http://market.google.com/somethingsomething"
'''
# Begin Heroku configuration - configured through environment variables.
import os
TWILIO_ACCOUNT_SID = os.environ.get('TWILIO_ACCOUNT_SID', None)
TWILIO_AUTH_TOKEN = os.environ.get('TWILIO_AUTH_TOKEN', None)
TWILIO_CALLER_ID = os.environ.get('TWILIO_CALLER_ID', None)
TWILIO_APP_SID = os.environ.get('TWILIO_APP_SID', None)
IOS_URI = os.environ.get('IOS_URI',
'http://itunes.apple.com/us/app/plants-vs.-zombies/id350642635?mt=8&uo=4')
ANDROID_URI = os.environ.get('ANDROID_URI',
'http://market.android.com/details?id=com.popcap.pvz_row')
WEB_URI = os.environ.get('WEB_URI',
'http://www.popcap.com/games/plants-vs-zombies/pc')
########NEW FILE########
__FILENAME__ = context
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import configure
from app import app
########NEW FILE########
__FILENAME__ = test_configure
import unittest
from mock import Mock
from mock import patch
import subprocess
from twilio.rest import TwilioRestClient
from .context import configure
class ConfigureTest(unittest.TestCase):
def setUp(self):
self.configure = configure.Configure(
account_sid="ACxxxxx",
auth_token="yyyyyyyy",
phone_number="+15555555555",
app_sid="APzzzzzzzzz")
self.configure.client = TwilioRestClient(self.configure.account_sid,
self.configure.auth_token)
class TwilioTest(ConfigureTest):
@patch('twilio.rest.resources.Applications')
@patch('twilio.rest.resources.Application')
def test_createNewTwiMLApp(self, MockApp, MockApps):
# Mock the Applications resource and its create method.
self.configure.client.applications = MockApps.return_value
self.configure.client.applications.create.return_value = \
MockApp.return_value
# Mock our input.
configure.raw_input = lambda _: 'y'
# Test
self.configure.createNewTwiMLApp(self.configure.voice_url,
self.configure.sms_url)
# Assert
self.configure.client.applications.create.assert_called_once_with(
voice_url=self.configure.voice_url,
sms_url=self.configure.sms_url,
friendly_name="Hackpack for Heroku and Flask")
@patch('twilio.rest.resources.Applications')
@patch('twilio.rest.resources.Application')
def test_createNewTwiMLAppNegativeInput(self, MockApp, MockApps):
# Mock the Applications resource and its create method.
self.configure.client.applications = MockApps.return_value
self.configure.client.applications.create.return_value = \
MockApp.return_value
# Mock our input .
configure.raw_input = lambda _: 'n'
# Test / Assert
self.assertRaises(configure.ConfigurationError,
self.configure.createNewTwiMLApp,
self.configure.voice_url, self.configure.sms_url)
@patch('twilio.rest.resources.Applications')
@patch('twilio.rest.resources.Application')
def test_setAppSidRequestUrls(self, MockApp, MockApps):
# Mock the Applications resource and its update method.
self.configure.client.applications = MockApps.return_value
self.configure.client.applications.update.return_value = \
MockApp.return_value
# Test
self.configure.setAppRequestUrls(self.configure.app_sid,
self.configure.voice_url,
self.configure.sms_url)
# Assert
self.configure.client.applications.update.assert_called_once_with(
self.configure.app_sid,
voice_url=self.configure.voice_url,
sms_url=self.configure.sms_url,
friendly_name='Hackpack for Heroku and Flask')
@patch('twilio.rest.resources.PhoneNumbers')
@patch('twilio.rest.resources.PhoneNumber')
def test_retrievePhoneNumber(self, MockPhoneNumber, MockPhoneNumbers):
# Mock the PhoneNumbers resource and its list method.
mock_phone_number = MockPhoneNumber.return_value
mock_phone_number.phone_number = self.configure.phone_number
self.configure.client.phone_numbers = MockPhoneNumbers.return_value
self.configure.client.phone_numbers.list.return_value = \
[mock_phone_number]
# Test
self.configure.retrievePhoneNumber(self.configure.phone_number)
# Assert
self.configure.client.phone_numbers.list.assert_called_once_with(
phone_number=self.configure.phone_number)
@patch('twilio.rest.resources.PhoneNumbers')
@patch('twilio.rest.resources.PhoneNumber')
def test_purchasePhoneNumber(self, MockPhoneNumber, MockPhoneNumbers):
# Mock the PhoneNumbers resource and its search and purchase methods
mock_phone_number = MockPhoneNumber.return_value
mock_phone_number.phone_number = self.configure.phone_number
self.configure.client.phone_numbers = MockPhoneNumbers.return_value
self.configure.client.phone_numbers.purchase = \
mock_phone_number
# Mock our input.
configure.raw_input = lambda _: 'y'
# Test
self.configure.purchasePhoneNumber()
# Assert
self.configure.client.phone_numbers.purchase.assert_called_once_with(
area_code="646")
@patch('twilio.rest.resources.PhoneNumbers')
@patch('twilio.rest.resources.PhoneNumber')
def test_purchasePhoneNumberNegativeInput(self, MockPhoneNumbers,
MockPhoneNumber):
# Mock the PhoneNumbers resource and its search and purchase methods
mock_phone_number = MockPhoneNumber.return_value
mock_phone_number.phone_number = self.configure.phone_number
self.configure.client.phone_numbers = MockPhoneNumbers.return_value
self.configure.client.phone_numbers.purchase = \
mock_phone_number
# Mock our input.
configure.raw_input = lambda _: 'n'
# Test / Assert
self.assertRaises(configure.ConfigurationError,
self.configure.purchasePhoneNumber)
@patch('twilio.rest.resources.Applications')
@patch('twilio.rest.resources.Application')
@patch('twilio.rest.resources.PhoneNumbers')
@patch('twilio.rest.resources.PhoneNumber')
def test_configure(self, MockPhoneNumber, MockPhoneNumbers, MockApp,
MockApps):
# Mock the Applications resource and its update method.
mock_app = MockApp.return_value
mock_app.sid = self.configure.app_sid
self.configure.client.applications = MockApps.return_value
self.configure.client.applications.update.return_value = \
mock_app
# Mock the PhoneNumbers resource and its list method.
mock_phone_number = MockPhoneNumber.return_value
mock_phone_number.sid = "PN123"
mock_phone_number.friendly_name = "(555) 555-5555"
mock_phone_number.phone_number = self.configure.phone_number
self.configure.client.phone_numbers = MockPhoneNumbers.return_value
self.configure.client.phone_numbers.list.return_value = \
[mock_phone_number]
# Test
self.configure.configureHackpack(self.configure.voice_url,
self.configure.sms_url,
self.configure.app_sid,
self.configure.phone_number)
# Assert
self.configure.client.applications.update.assert_called_once_with(
self.configure.app_sid,
voice_url=self.configure.voice_url,
sms_url=self.configure.sms_url,
friendly_name='Hackpack for Heroku and Flask')
self.configure.client.phone_numbers.update.assert_called_once_with(
"PN123",
voice_application_sid=self.configure.app_sid,
sms_application_sid=self.configure.app_sid)
@patch('twilio.rest.resources.Applications')
@patch('twilio.rest.resources.Application')
@patch('twilio.rest.resources.PhoneNumbers')
@patch('twilio.rest.resources.PhoneNumber')
def test_configureNoApp(self, MockPhoneNumber, MockPhoneNumbers, MockApp,
MockApps):
# Mock the Applications resource and its update method.
mock_app = MockApp.return_value
mock_app.sid = self.configure.app_sid
self.configure.client.applications = MockApps.return_value
self.configure.client.applications.create.return_value = \
mock_app
# Mock the PhoneNumbers resource and its list method.
mock_phone_number = MockPhoneNumber.return_value
mock_phone_number.sid = "PN123"
mock_phone_number.friendly_name = "(555) 555-5555"
mock_phone_number.phone_number = self.configure.phone_number
self.configure.client.phone_numbers = MockPhoneNumbers.return_value
self.configure.client.phone_numbers.list.return_value = \
[mock_phone_number]
# Set AppSid to None
self.configure.app_sid = None
# Mock our input.
configure.raw_input = lambda _: 'y'
# Test
self.configure.configureHackpack(self.configure.voice_url,
self.configure.sms_url,
self.configure.app_sid,
self.configure.phone_number)
# Assert
self.configure.client.applications.create.assert_called_once_with(
voice_url=self.configure.voice_url,
sms_url=self.configure.sms_url,
friendly_name="Hackpack for Heroku and Flask")
self.configure.client.phone_numbers.update.assert_called_once_with(
"PN123",
voice_application_sid=mock_app.sid,
sms_application_sid=mock_app.sid)
@patch('twilio.rest.resources.Applications')
@patch('twilio.rest.resources.Application')
@patch('twilio.rest.resources.PhoneNumbers')
@patch('twilio.rest.resources.PhoneNumber')
def test_configureNoPhoneNumber(self, MockPhoneNumber, MockPhoneNumbers,
MockApp, MockApps):
# Mock the Applications resource and its update method.
mock_app = MockApp.return_value
mock_app.sid = self.configure.app_sid
self.configure.client.applications = MockApps.return_value
self.configure.client.applications.update.return_value = \
mock_app
# Mock the PhoneNumbers resource and its list method.
mock_phone_number = MockPhoneNumber.return_value
mock_phone_number.sid = "PN123"
mock_phone_number.friendly_name = "(555) 555-5555"
mock_phone_number.phone_number = self.configure.phone_number
self.configure.client.phone_numbers = MockPhoneNumbers.return_value
self.configure.client.phone_numbers.purchase.return_value = \
mock_phone_number
# Set AppSid to None
self.configure.phone_number = None
# Mock our input.
configure.raw_input = lambda _: 'y'
# Test
self.configure.configureHackpack(self.configure.voice_url,
self.configure.sms_url,
self.configure.app_sid,
self.configure.phone_number)
# Assert
self.configure.client.applications.update.assert_called_once_with(
self.configure.app_sid,
voice_url=self.configure.voice_url,
sms_url=self.configure.sms_url,
friendly_name='Hackpack for Heroku and Flask')
self.configure.client.phone_numbers.update.assert_called_once_with(
"PN123",
voice_application_sid=self.configure.app_sid,
sms_application_sid=self.configure.app_sid)
@patch.object(subprocess, 'call')
@patch.object(configure.Configure, 'configureHackpack')
def test_start(self, mock_configureHackpack, mock_call):
mock_call.return_value = None
self.configure.host = 'http://look-here-snacky-11211.herokuapp.com'
self.configure.start()
mock_configureHackpack.assert_called_once_with(
'http://look-here-snacky-11211.herokuapp.com/voice',
'http://look-here-snacky-11211.herokuapp.com/sms',
self.configure.app_sid,
self.configure.phone_number)
@patch.object(subprocess, 'call')
@patch.object(configure.Configure, 'configureHackpack')
@patch.object(configure.Configure, 'getHerokuHostname')
def test_startWithoutHostname(self, mock_getHerokuHostname,
mock_configureHackpack, mock_call):
mock_call.return_value = None
mock_getHerokuHostname.return_value = \
'http://look-here-snacky-11211.herokuapp.com'
self.configure.start()
mock_configureHackpack.assert_called_once_with(
'http://look-here-snacky-11211.herokuapp.com/voice',
'http://look-here-snacky-11211.herokuapp.com/sms',
self.configure.app_sid,
self.configure.phone_number)
class HerokuTest(ConfigureTest):
def test_getHerokuHostname(self):
test = self.configure.getHerokuHostname(
git_config_path='./tests/test_assets/good_git_config')
self.assertEquals(test, 'http://look-here-snacky-11211.herokuapp.com')
def test_getHerokuHostnameNoSuchFile(self):
self.assertRaises(configure.ConfigurationError,
self.configure.getHerokuHostname,
git_config_path='/tmp')
def test_getHerokuHostnameNoHerokuRemote(self):
self.assertRaises(configure.ConfigurationError,
self.configure.getHerokuHostname,
git_config_path='./tests/test_assets/bad_git_config')
@patch.object(subprocess, 'call')
def test_setHerokuEnvironmentVariables(self, mock_call):
mock_call.return_value = None
self.configure.setHerokuEnvironmentVariables(
TWILIO_ACCOUNT_SID=self.configure.account_sid,
TWILIO_AUTH_TOKEN=self.configure.auth_token,
TWILIO_APP_SID=self.configure.app_sid,
TWILIO_CALLER_ID=self.configure.phone_number)
mock_call.assert_called_once_with(["heroku", "config:add",
'%s=%s' % ('TWILIO_ACCOUNT_SID', self.configure.account_sid),
'%s=%s' % ('TWILIO_CALLER_ID', self.configure.phone_number),
'%s=%s' % ('TWILIO_AUTH_TOKEN', self.configure.auth_token),
'%s=%s' % ('TWILIO_APP_SID', self.configure.app_sid)])
class MiscellaneousTest(unittest.TestCase):
def test_configureWithoutAccountSid(self):
test = configure.Configure(account_sid=None, auth_token=None,
phone_number=None, app_sid=None)
self.assertRaises(configure.ConfigurationError,
test.start)
def test_configureWithoutAuthToken(self):
test = configure.Configure(account_sid='ACxxxxxxx', auth_token=None,
phone_number=None, app_sid=None)
self.assertRaises(configure.ConfigurationError,
test.start)
class InputTest(ConfigureTest):
@patch('twilio.rest.resources.Applications')
@patch('twilio.rest.resources.Application')
def test_createNewTwiMLAppWtfInput(self, MockApp, MockApps):
# Mock the Applications resource and its create method.
self.configure.client.applications = MockApps.return_value
self.configure.client.applications.create.return_value = \
MockApp.return_value
# Mock our input
configure.raw_input = Mock()
configure.raw_input.return_value = 'wtf'
# Test / Assert
self.assertRaises(configure.ConfigurationError,
self.configure.createNewTwiMLApp, self.configure.voice_url,
self.configure.sms_url)
self.assertTrue(configure.raw_input.call_count == 3, "Prompt did " \
"not appear three times, instead: %i" %
configure.raw_input.call_count)
self.assertFalse(self.configure.client.applications.create.called,
"Unexpected request to create AppSid made.")
@patch('twilio.rest.resources.PhoneNumbers')
@patch('twilio.rest.resources.PhoneNumber')
def test_purchasePhoneNumberWtfInput(self, MockPhoneNumbers,
MockPhoneNumber):
# Mock the PhoneNumbers resource and its search and purchase methods
mock_phone_number = MockPhoneNumber.return_value
mock_phone_number.phone_number = self.configure.phone_number
self.configure.client.phone_numbers = MockPhoneNumbers.return_value
self.configure.client.phone_numbers.purchase = \
mock_phone_number
# Mock our input.
configure.raw_input = Mock()
configure.raw_input.return_value = 'wtf'
# Test / Assert
self.assertRaises(configure.ConfigurationError,
self.configure.purchasePhoneNumber)
self.assertTrue(configure.raw_input.call_count == 3, "Prompt did " \
"not appear three times, instead: %i" %
configure.raw_input.call_count)
self.assertFalse(self.configure.client.phone_numbers.purchase.called,
"Unexpected request to create AppSid made.")
@patch('twilio.rest.resources.PhoneNumbers')
@patch('twilio.rest.resources.PhoneNumber')
def test_purchasePhoneNumberWtfInputConfirm(self,
MockPhoneNumbers, MockPhoneNumber):
# Mock the PhoneNumbers resource and its search and purchase methods
mock_phone_number = MockPhoneNumber.return_value
mock_phone_number.phone_number = self.configure.phone_number
self.configure.client.phone_numbers = MockPhoneNumbers.return_value
self.configure.client.phone_numbers.purchase = \
mock_phone_number
# Mock our input.
configure.raw_input = Mock()
configure.raw_input.side_effect = ['y', 'wtf', 'wtf', 'wtf']
# Test / Assert
self.assertRaises(configure.ConfigurationError,
self.configure.purchasePhoneNumber)
self.assertTrue(configure.raw_input.call_count == 4, "Prompt did " \
"not appear three times, instead: %i" %
configure.raw_input.call_count)
self.assertFalse(self.configure.client.phone_numbers.purchase.called,
"Unexpectedly requested phone number purchase.")
########NEW FILE########
__FILENAME__ = test_twilio
import unittest
from .context import app
class TwiMLTest(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
def assertTwiML(self, response):
self.assertTrue("<Response>" in response.data, "Did not find " \
"<Response>: %s" % response.data)
self.assertTrue("</Response>" in response.data, "Did not find " \
"</Response>: %s" % response.data)
self.assertEqual("200 OK", response.status)
def sms(self, body, path='/sms', number='+15555555555'):
params = {
'SmsSid': 'SMtesting',
'AccountSid': 'ACtesting',
'From': number,
'To': '+16666666666',
'Body': body,
'ApiVersion': '2010-04-01',
'Direction': 'inbound'}
return self.app.post(path, data=params)
def call(self, path='/voice', caller_id='+15555555555', digits=None,
phone_number=None):
params = {
'CallSid': 'CAtesting',
'AccountSid': 'ACtesting',
'From': caller_id,
'To': '+16666666666',
'CallStatus': 'ringing',
'ApiVersion': '2010-04-01',
'Direction': 'inbound'}
if digits:
params['Digits'] = digits
if phone_number:
params['PhoneNumber'] = phone_number
return self.app.post(path, data=params)
class TwilioTests(TwiMLTest):
def test_voice(self):
response = self.call(phone_number="+15557778888")
self.assertTwiML(response)
def test_inbound(self):
response = self.call(path='/inbound')
self.assertTwiML(response)
def test_sms(self):
response = self.sms("Test")
self.assertTwiML(response)
########NEW FILE########
__FILENAME__ = test_web
import unittest
from .context import app
app.config['TWILIO_ACCOUNT_SID'] = 'ACxxxxxx'
app.config['TWILIO_AUTH_TOKEN'] = 'yyyyyyyyy'
app.config['TWILIO_CALLER_ID'] = '+15558675309'
app.config['IOS_URI'] = \
'http://itunes.apple.com/us/app/plants-vs.-zombies/id350642635?mt=8&uo=4'
app.config['ANDROID_URI'] = \
'http://market.android.com/details?id=com.popcap.pvz_row'
app.config['WEB_URI'] = 'http://www.popcap.com/games/plants-vs-zombies/pc'
class WebTest(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
class IndexTests(WebTest):
def test_index(self):
response = self.app.get('/')
self.assertEqual("200 OK", response.status)
########NEW FILE########
| [
"dyangUCI@github.com"
] | dyangUCI@github.com |
19377378073d0491068a8850c5ec1a202b416b4e | e514bbdf8e0abe5ef0b58b94fe5f7d2afb38ea6b | /test_suite/shared_data/frame_order/cam/rotor/perm_pseudo_ellipse_z_le_x_le_y_alt/pseudo-ellipse.py | b1dec4d76ae1ec4b73e2fd5cf18f201d538cd854 | [] | no_license | edward-dauvergne/relax | 98ad63703e68a4535bfef3d6c0529e07cc84ff29 | 9710dc0f2dfe797f413756272d4bec83cf6ca1c9 | refs/heads/master | 2020-04-07T04:25:25.382027 | 2017-01-04T15:38:09 | 2017-01-04T15:38:09 | 46,500,334 | 1 | 1 | null | null | null | null | UTF-8 | Python | false | false | 3,967 | py | # Optimise all 3 pseudo-ellipse permutations for the CaM rotor synthetic frame order data.
# These 3 solutions should mimic the rotor solution.
# Python module imports.
from numpy import array, cross, float64, transpose, zeros
from numpy.linalg import norm
import sys
# relax module imports.
from lib.geometry.coord_transform import spherical_to_cartesian
from lib.geometry.rotations import R_to_euler_zyz
from lib.text.sectioning import section
# The real rotor parameter values.
AVE_POS_X, AVE_POS_Y, AVE_POS_Z = [ -21.269217407269576, -3.122610661328414, -2.400652421655998]
AVE_POS_ALPHA, AVE_POS_BETA, AVE_POS_GAMMA = [5.623469076122531, 0.435439405668396, 5.081265529106499]
AXIS_THETA = 0.9600799785953431
AXIS_PHI = 4.0322755062196229
CONE_SIGMA_MAX = 30.0 / 360.0 * 2.0 * pi
# Reconstruct the rotation axis.
AXIS = zeros(3, float64)
spherical_to_cartesian([1, AXIS_THETA, AXIS_PHI], AXIS)
# Create a full normalised axis system.
x = array([1, 0, 0], float64)
y = cross(AXIS, x)
y /= norm(y)
x = cross(y, AXIS)
x /= norm(x)
AXES = transpose(array([x, y, AXIS], float64))
# The Euler angles.
eigen_alpha, eigen_beta, eigen_gamma = R_to_euler_zyz(AXES)
# Printout.
print("Torsion angle: %s" % CONE_SIGMA_MAX)
print("Rotation axis: %s" % AXIS)
print("Full axis system:\n%s" % AXES)
print("cross(x, y) = z:\n %s = %s" % (cross(AXES[:, 0], AXES[:, 1]), AXES[:, 2]))
print("cross(x, z) = -y:\n %s = %s" % (cross(AXES[:, 0], AXES[:, 2]), -AXES[:, 1]))
print("cross(y, z) = x:\n %s = %s" % (cross(AXES[:, 1], AXES[:, 2]), AXES[:, 0]))
print("Euler angles (alpha, beta, gamma): (%.15f, %.15f, %.15f)" % (eigen_alpha, eigen_beta, eigen_gamma))
# Load the optimised rotor state for creating the pseudo-ellipse data pipes.
state.load(state='frame_order_true', dir='..')
# Set up the dynamic system.
value.set(param='ave_pos_x', val=AVE_POS_X)
value.set(param='ave_pos_y', val=AVE_POS_Y)
value.set(param='ave_pos_z', val=AVE_POS_Z)
value.set(param='ave_pos_alpha', val=AVE_POS_ALPHA)
value.set(param='ave_pos_beta', val=AVE_POS_BETA)
value.set(param='ave_pos_gamma', val=AVE_POS_GAMMA)
value.set(param='eigen_alpha', val=eigen_alpha)
value.set(param='eigen_beta', val=eigen_beta)
value.set(param='eigen_gamma', val=eigen_gamma)
# Set the torsion angle to the rotor opening half-angle.
value.set(param='cone_sigma_max', val=0.1)
# Set the cone opening angles.
value.set(param='cone_theta_x', val=0.3)
value.set(param='cone_theta_y', val=0.6)
# Fix the true pivot point.
frame_order.pivot([ 37.254, 0.5, 16.7465], fix=True)
# Change the model.
frame_order.select_model('pseudo-ellipse')
# Loop over the 3 permutations.
pipe_name = 'pseudo-ellipse'
tag = ''
for perm in [None, 'A', 'B']:
# The original permutation.
if perm == None:
# Title printout.
section(file=sys.stdout, text="Pseudo-ellipse original permutation")
# Create a new data base data pipe for the pseudo-ellipse.
pipe.copy(pipe_from='frame order', pipe_to='pseudo-ellipse')
pipe.switch(pipe_name='pseudo-ellipse')
# Operations for the 'A' and 'B' permutations.
else:
# Title printout.
section(file=sys.stdout, text="Pseudo-ellipse permutation %s" % perm)
# The pipe name and tag.
pipe_name = 'pseudo-ellipse perm %s' % perm
tag = '_perm_%s' % perm
# Create a new data pipe.
pipe.copy(pipe_from='frame order', pipe_to=pipe_name)
pipe.switch(pipe_name=pipe_name)
# Permute the axes.
frame_order.permute_axes(permutation=perm)
# Create a pre-optimisation PDB representation.
frame_order.pdb_model(ave_pos=None, rep='fo_orig'+tag, compress_type=2, force=True)
# High precision optimisation.
frame_order.num_int_pts(num=10000)
minimise.execute('simplex', func_tol=1e-4)
# Create the PDB representation.
frame_order.pdb_model(ave_pos=None, rep='fo'+tag, compress_type=2, force=True)
# Sanity check.
pipe.display()
| [
"bugman@b7916896-f9f9-0310-9fe5-b3996d8957d5"
] | bugman@b7916896-f9f9-0310-9fe5-b3996d8957d5 |
d00b15b51af9b80c644dd6ea97b30104695d30ea | 127524f1e0b3675ba9660d0f531cfd7bd62935f0 | /quickai/yolo/utils.py | 0a1a51c24ab6b2bf55afff234575111a724bb849 | [
"MIT"
] | permissive | bryan2022/quickai | 779fc153bd98d7efc48879a37abdd18831eefe87 | 2c84bce9751131eef75e91803eb6bf6ea25c0b89 | refs/heads/main | 2023-06-15T00:56:45.188599 | 2021-07-11T14:43:59 | 2021-07-11T14:43:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 12,713 | py | import cv2
import random
import colorsys
import numpy as np
import tensorflow as tf
from .config import cfg
YOLO_CLASSES = "./coco.names"
def load_freeze_layer(model='yolov4', tiny=False):
if tiny:
if model == 'yolov3':
freeze_layouts = ['conv2d_9', 'conv2d_12']
else:
freeze_layouts = ['conv2d_17', 'conv2d_20']
else:
if model == 'yolov3':
freeze_layouts = ['conv2d_58', 'conv2d_66', 'conv2d_74']
else:
freeze_layouts = ['conv2d_93', 'conv2d_101', 'conv2d_109']
return freeze_layouts
def load_weights(model, weights_file, model_name='yolov4', is_tiny=False):
if is_tiny:
if model_name == 'yolov3':
layer_size = 13
output_pos = [9, 12]
else:
layer_size = 21
output_pos = [17, 20]
else:
if model_name == 'yolov3':
layer_size = 75
output_pos = [58, 66, 74]
else:
layer_size = 110
output_pos = [93, 101, 109]
wf = open(weights_file, 'rb')
major, minor, revision, seen, _ = np.fromfile(wf, dtype=np.int32, count=5)
j = 0
for i in range(layer_size):
conv_layer_name = 'conv2d_%d' % i if i > 0 else 'conv2d'
bn_layer_name = 'batch_normalization_%d' % j if j > 0 else 'batch_normalization'
conv_layer = model.get_layer(conv_layer_name)
filters = conv_layer.filters
k_size = conv_layer.kernel_size[0]
in_dim = conv_layer.input_shape[-1]
if i not in output_pos:
# darknet weights: [beta, gamma, mean, variance]
bn_weights = np.fromfile(wf, dtype=np.float32, count=4 * filters)
# tf weights: [gamma, beta, mean, variance]
bn_weights = bn_weights.reshape((4, filters))[[1, 0, 2, 3]]
bn_layer = model.get_layer(bn_layer_name)
j += 1
else:
conv_bias = np.fromfile(wf, dtype=np.float32, count=filters)
# darknet shape (out_dim, in_dim, height, width)
conv_shape = (filters, in_dim, k_size, k_size)
conv_weights = np.fromfile(wf, dtype=np.float32, count=np.product(conv_shape))
# tf shape (height, width, in_dim, out_dim)
conv_weights = conv_weights.reshape(conv_shape).transpose([2, 3, 1, 0])
if i not in output_pos:
conv_layer.set_weights([conv_weights])
bn_layer.set_weights(bn_weights)
else:
conv_layer.set_weights([conv_weights, conv_bias])
# assert len(wf.read()) == 0, 'failed to read all data'
wf.close()
def read_class_names(class_file_name):
names = {}
with open(class_file_name, 'r') as data:
for ID, name in enumerate(data):
names[ID] = name.strip('\n')
return names
def load_config(FLAGS):
if FLAGS.tiny:
STRIDES = np.array(cfg.YOLO.STRIDES_TINY)
ANCHORS = get_anchors(cfg.YOLO.ANCHORS_TINY, FLAGS.tiny)
XYSCALE = cfg.YOLO.XYSCALE_TINY if FLAGS.model == 'yolov4' else [1, 1]
else:
STRIDES = np.array(cfg.YOLO.STRIDES)
if FLAGS.model == 'yolov4':
ANCHORS = get_anchors(cfg.YOLO.ANCHORS, FLAGS.tiny)
elif FLAGS.model == 'yolov3':
ANCHORS = get_anchors(cfg.YOLO.ANCHORS_V3, FLAGS.tiny)
XYSCALE = cfg.YOLO.XYSCALE if FLAGS.model == 'yolov4' else [1, 1, 1]
NUM_CLASS = len(read_class_names(YOLO_CLASSES))
return STRIDES, ANCHORS, NUM_CLASS, XYSCALE
def get_anchors(anchors_path, tiny=False):
anchors = np.array(anchors_path)
if tiny:
return anchors.reshape(2, 3, 2)
else:
return anchors.reshape(3, 3, 2)
def image_preprocess(image, target_size, gt_boxes=None):
ih, iw = target_size
h, w, _ = image.shape
scale = min(iw / w, ih / h)
nw, nh = int(scale * w), int(scale * h)
image_resized = cv2.resize(image, (nw, nh))
image_paded = np.full(shape=[ih, iw, 3], fill_value=128.0)
dw, dh = (iw - nw) // 2, (ih - nh) // 2
image_paded[dh:nh + dh, dw:nw + dw, :] = image_resized
image_paded = image_paded / 255.
if gt_boxes is None:
return image_paded
else:
gt_boxes[:, [0, 2]] = gt_boxes[:, [0, 2]] * scale + dw
gt_boxes[:, [1, 3]] = gt_boxes[:, [1, 3]] * scale + dh
return image_paded, gt_boxes
def draw_bbox(image, bboxes, classes=read_class_names(YOLO_CLASSES),
allowed_classes=list(read_class_names(YOLO_CLASSES).values()), show_label=True):
num_classes = len(classes)
image_h, image_w, _ = image.shape
hsv_tuples = [(1.0 * x / num_classes, 1., 1.) for x in range(num_classes)]
colors = list(map(lambda x: colorsys.hsv_to_rgb(*x), hsv_tuples))
colors = list(map(lambda x: (int(x[0] * 255), int(x[1] * 255), int(x[2] * 255)), colors))
random.seed(0)
random.shuffle(colors)
random.seed(None)
out_boxes, out_scores, out_classes, num_boxes = bboxes
for i in range(num_boxes[0]):
if int(out_classes[0][i]) < 0 or int(out_classes[0][i]) > num_classes: continue
coor = out_boxes[0][i]
coor[0] = int(coor[0] * image_h)
coor[2] = int(coor[2] * image_h)
coor[1] = int(coor[1] * image_w)
coor[3] = int(coor[3] * image_w)
fontScale = 0.5
score = out_scores[0][i]
class_ind = int(out_classes[0][i])
class_name = classes[class_ind]
# check if class is in allowed classes
if class_name not in allowed_classes:
continue
else:
bbox_color = colors[class_ind]
bbox_thick = int(0.6 * (image_h + image_w) / 600)
c1, c2 = (coor[1], coor[0]), (coor[3], coor[2])
cv2.rectangle(image, c1, c2, bbox_color, bbox_thick)
if show_label:
bbox_mess = '%s: %.2f' % (classes[class_ind], score)
t_size = cv2.getTextSize(bbox_mess, 0, fontScale, thickness=bbox_thick // 2)[0]
c3 = (c1[0] + t_size[0], c1[1] - t_size[1] - 3)
cv2.rectangle(image, c1, (np.float32(c3[0]), np.float32(c3[1])), bbox_color, -1) # filled
cv2.putText(image, bbox_mess, (c1[0], np.float32(c1[1] - 2)), cv2.FONT_HERSHEY_SIMPLEX,
fontScale, (0, 0, 0), bbox_thick // 2, lineType=cv2.LINE_AA)
return image
def bbox_iou(bboxes1, bboxes2):
"""
@param bboxes1: (a, b, ..., 4)
@param bboxes2: (A, B, ..., 4)
x:X is 1:n or n:n or n:1
@return (max(a,A), max(b,B), ...)
ex) (4,):(3,4) -> (3,)
(2,1,4):(2,3,4) -> (2,3)
"""
bboxes1_area = bboxes1[..., 2] * bboxes1[..., 3]
bboxes2_area = bboxes2[..., 2] * bboxes2[..., 3]
bboxes1_coor = tf.concat(
[
bboxes1[..., :2] - bboxes1[..., 2:] * 0.5,
bboxes1[..., :2] + bboxes1[..., 2:] * 0.5,
],
axis=-1,
)
bboxes2_coor = tf.concat(
[
bboxes2[..., :2] - bboxes2[..., 2:] * 0.5,
bboxes2[..., :2] + bboxes2[..., 2:] * 0.5,
],
axis=-1,
)
left_up = tf.maximum(bboxes1_coor[..., :2], bboxes2_coor[..., :2])
right_down = tf.minimum(bboxes1_coor[..., 2:], bboxes2_coor[..., 2:])
inter_section = tf.maximum(right_down - left_up, 0.0)
inter_area = inter_section[..., 0] * inter_section[..., 1]
union_area = bboxes1_area + bboxes2_area - inter_area
iou = tf.math.divide_no_nan(inter_area, union_area)
return iou
def bbox_giou(bboxes1, bboxes2):
"""
Generalized IoU
@param bboxes1: (a, b, ..., 4)
@param bboxes2: (A, B, ..., 4)
x:X is 1:n or n:n or n:1
@return (max(a,A), max(b,B), ...)
ex) (4,):(3,4) -> (3,)
(2,1,4):(2,3,4) -> (2,3)
"""
bboxes1_area = bboxes1[..., 2] * bboxes1[..., 3]
bboxes2_area = bboxes2[..., 2] * bboxes2[..., 3]
bboxes1_coor = tf.concat(
[
bboxes1[..., :2] - bboxes1[..., 2:] * 0.5,
bboxes1[..., :2] + bboxes1[..., 2:] * 0.5,
],
axis=-1,
)
bboxes2_coor = tf.concat(
[
bboxes2[..., :2] - bboxes2[..., 2:] * 0.5,
bboxes2[..., :2] + bboxes2[..., 2:] * 0.5,
],
axis=-1,
)
left_up = tf.maximum(bboxes1_coor[..., :2], bboxes2_coor[..., :2])
right_down = tf.minimum(bboxes1_coor[..., 2:], bboxes2_coor[..., 2:])
inter_section = tf.maximum(right_down - left_up, 0.0)
inter_area = inter_section[..., 0] * inter_section[..., 1]
union_area = bboxes1_area + bboxes2_area - inter_area
iou = tf.math.divide_no_nan(inter_area, union_area)
enclose_left_up = tf.minimum(bboxes1_coor[..., :2], bboxes2_coor[..., :2])
enclose_right_down = tf.maximum(
bboxes1_coor[..., 2:], bboxes2_coor[..., 2:]
)
enclose_section = enclose_right_down - enclose_left_up
enclose_area = enclose_section[..., 0] * enclose_section[..., 1]
giou = iou - tf.math.divide_no_nan(enclose_area - union_area, enclose_area)
return giou
def bbox_ciou(bboxes1, bboxes2):
"""
Complete IoU
@param bboxes1: (a, b, ..., 4)
@param bboxes2: (A, B, ..., 4)
x:X is 1:n or n:n or n:1
@return (max(a,A), max(b,B), ...)
ex) (4,):(3,4) -> (3,)
(2,1,4):(2,3,4) -> (2,3)
"""
bboxes1_area = bboxes1[..., 2] * bboxes1[..., 3]
bboxes2_area = bboxes2[..., 2] * bboxes2[..., 3]
bboxes1_coor = tf.concat(
[
bboxes1[..., :2] - bboxes1[..., 2:] * 0.5,
bboxes1[..., :2] + bboxes1[..., 2:] * 0.5,
],
axis=-1,
)
bboxes2_coor = tf.concat(
[
bboxes2[..., :2] - bboxes2[..., 2:] * 0.5,
bboxes2[..., :2] + bboxes2[..., 2:] * 0.5,
],
axis=-1,
)
left_up = tf.maximum(bboxes1_coor[..., :2], bboxes2_coor[..., :2])
right_down = tf.minimum(bboxes1_coor[..., 2:], bboxes2_coor[..., 2:])
inter_section = tf.maximum(right_down - left_up, 0.0)
inter_area = inter_section[..., 0] * inter_section[..., 1]
union_area = bboxes1_area + bboxes2_area - inter_area
iou = tf.math.divide_no_nan(inter_area, union_area)
enclose_left_up = tf.minimum(bboxes1_coor[..., :2], bboxes2_coor[..., :2])
enclose_right_down = tf.maximum(
bboxes1_coor[..., 2:], bboxes2_coor[..., 2:]
)
enclose_section = enclose_right_down - enclose_left_up
c_2 = enclose_section[..., 0] ** 2 + enclose_section[..., 1] ** 2
center_diagonal = bboxes2[..., :2] - bboxes1[..., :2]
rho_2 = center_diagonal[..., 0] ** 2 + center_diagonal[..., 1] ** 2
diou = iou - tf.math.divide_no_nan(rho_2, c_2)
v = (
(
tf.math.atan(
tf.math.divide_no_nan(bboxes1[..., 2], bboxes1[..., 3])
)
- tf.math.atan(
tf.math.divide_no_nan(bboxes2[..., 2], bboxes2[..., 3])
)
)
* 2
/ np.pi
) ** 2
alpha = tf.math.divide_no_nan(v, 1 - iou + v)
ciou = diou - alpha * v
return ciou
def nms(bboxes, iou_threshold, sigma=0.3, method='nms'):
"""
:param bboxes: (xmin, ymin, xmax, ymax, score, class)
Note: soft-nms, https://arxiv.org/pdf/1704.04503.pdf
https://github.com/bharatsingh430/soft-nms
"""
classes_in_img = list(set(bboxes[:, 5]))
best_bboxes = []
for cls in classes_in_img:
cls_mask = (bboxes[:, 5] == cls)
cls_bboxes = bboxes[cls_mask]
while len(cls_bboxes) > 0:
max_ind = np.argmax(cls_bboxes[:, 4])
best_bbox = cls_bboxes[max_ind]
best_bboxes.append(best_bbox)
cls_bboxes = np.concatenate([cls_bboxes[: max_ind], cls_bboxes[max_ind + 1:]])
iou = bbox_iou(best_bbox[np.newaxis, :4], cls_bboxes[:, :4])
weight = np.ones((len(iou),), dtype=np.float32)
assert method in ['nms', 'soft-nms']
if method == 'nms':
iou_mask = iou > iou_threshold
weight[iou_mask] = 0.0
if method == 'soft-nms':
weight = np.exp(-(1.0 * iou ** 2 / sigma))
cls_bboxes[:, 4] = cls_bboxes[:, 4] * weight
score_mask = cls_bboxes[:, 4] > 0.
cls_bboxes = cls_bboxes[score_mask]
return best_bboxes
def freeze_all(model, frozen=True):
model.trainable = not frozen
if isinstance(model, tf.keras.Model):
for l in model.layers:
freeze_all(l, frozen)
def unfreeze_all(model, frozen=False):
model.trainable = not frozen
if isinstance(model, tf.keras.Model):
for l in model.layers:
unfreeze_all(l, frozen)
| [
"iamapythongeek@gmail.com"
] | iamapythongeek@gmail.com |
c3f6f7d8fc443d77d3e3e9e3fcc2804ef70cb098 | e4a565b09a8d3fd9dc46cc38c5e42fbcb94c1b05 | /nm.py | dc62e8a2fb7744f9a60632e986b66c229ef4b099 | [] | no_license | mystblue/PyTools | ca91d0a1a8850bc749adb9d05c3fd49166f58831 | 5eab64345d0ae5614f6cdabe3005b515f078a744 | refs/heads/master | 2023-09-01T19:55:37.190349 | 2023-08-31T00:55:25 | 2023-08-31T00:55:25 | 1,466,599 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 313 | py | # encoding: utf-8
import re
ubuf = ""
with open("test.html", "r") as frp:
buf = frp.read()
ubuf = buf.decode("utf-8")
ubuf = re.sub(">", ">", ubuf)
ubuf = re.sub("[ ]+$", "", ubuf)
ubuf = re.sub("<[^>]+>", "", ubuf)
with open("test.html", "w") as frp:
frp.write(ubuf.encode("utf-8"))
| [
"k-kayama@finos.hakata.fukuoka.jp"
] | k-kayama@finos.hakata.fukuoka.jp |
413cdca73ad398e6965d4f8c713960a58e72b596 | 922a58fa02ed0427e6697da54f19bc84e83f4d29 | /lyricsloader/load.py | e00562638f626b93b50868ac4bfce4788147a1d3 | [
"MIT"
] | permissive | afcarl/LyricsLoader | 560e66c48ecbc8ce95a8f41004abfa175ba496c5 | 795bc8838177fe4659df64da230b4348aed23db7 | refs/heads/master | 2020-12-04T05:18:51.204027 | 2019-08-03T16:30:42 | 2019-08-03T16:30:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,080 | py | from typing import Dict, List, Optional, Union
import requests
from bs4 import BeautifulSoup
class LyricsLoader:
def __init__(self, artist: str, suppress_err: bool = False) -> None:
"""
:param artist: name of artist
:param suppress_err: whether to suppress LyricsLoaderError if artist/album/track not found
"""
self.artist = artist
self.suppress_err = suppress_err
self._artist = self.artist.replace(' ', '_') # formatted for query
self._album_to_tracks = self._query_artist()
def __repr__(self):
"""
Printing instance shows artist
"""
return f'{self.__class__.__name__} ({self.artist})'
@property
def albums(self) -> List[str]:
"""
Return list of album names
"""
# no need to check results since _query_artist would have raised
return list(self._album_to_tracks.keys())
def get_tracks(self, album: str) -> List[str]:
"""
Return list of tracks on album
:param album: name of album
"""
tracks = self._album_to_tracks.get(album, [])
self._check_result(tracks, 'album', album)
return tracks
def get_lyrics(self, track: str) -> Optional[str]:
"""
Return track lyrics
:param track: name of track
"""
_track = track.replace(' ', '_')
url = f'http://lyrics.wikia.com/{self._artist}:{_track}'
resp = requests.get(url)
soup = BeautifulSoup(resp.text, 'html.parser')
lyrics = soup.find('div', {'class': 'lyricbox'})
if lyrics is None:
return self._check_result(lyrics, 'track', track)
return lyrics.get_text(separator='\n').strip()
def _query_artist(self) -> Dict[str, List[str]]:
"""
Get artist's albums and tracks from lyrics.wikia.com API
"""
url = f'http://lyrics.wikia.com/api.php?action=lyrics&artist={self._artist}&fmt=json'
resp = requests.get(url)
jresp = resp.json()
self._check_result(jresp.get('albums'), 'artist', self.artist)
return {album['album']: album['songs'] for album in jresp['albums']}
def _check_result(self, result: Union[List[str], str], category: str, name: str) -> None:
"""
Raise exception on empty result
:param result: data structure to check if empty
:param category: category of object that is potentially empty (artist/album/track)
:param name: specific name that was not found if empty
"""
if self.suppress_err:
return
if not result:
raise LyricsLoaderError(category, name)
class LyricsLoaderError(Exception):
def __init__(self, category: str, name: str):
"""
:param category: category of object not found (artist/album/track)
:param name: specific name of object not found
"""
self.category = category
self.name = name
def __str__(self):
return f'{self.category} \"{self.name}\" not found'
| [
"dkaslovsky@gmail.com"
] | dkaslovsky@gmail.com |
662d357b17d5dcce4a11b0cc48958b54cbe77680 | 2f135256cf8c2939a92e7b2e13e5c56c69abd569 | /_constants.py | 141d72ae38aa785b38f4ddeec30d0236e52e601f | [] | no_license | mislam5285/SOA | 94fa1722d54112c301951b43361b9a612ead87d4 | f9c74ef8a153a67ce392447c47077825cfbd2b63 | refs/heads/master | 2023-04-29T23:10:15.473153 | 2021-05-18T15:09:30 | 2021-05-18T15:09:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 331 | py |
# samples ratios
SAMPLES_RATIO_01 = '5:1'
SAMPLES_RATIO_02 = "39:1"
SAMPLES_RATIO_03 = '50:1'
# sampling strategy
SS_ADASYN = 'ada_syn'
SS_SMOTE = 'smote'
SS_TOMEK = 'tomek'
SS_ENN = 'smote_enn'
SS_ROS = 'ros'
SS_NONE = 'none'
# base classifiers
CLF_SVC = 'SVC'
CLF_RF = 'RF'
CLF_AB = 'AB'
CLF_KNN = 'KNN'
CLF_RUSBOOST = 'RUSB'
| [
"peter.gnip@student.tuke.sk"
] | peter.gnip@student.tuke.sk |
8282401112b1b4d464f5eb4541b0d79ec6a226e1 | af67d7d0f56da5d8ac9a6fbd4b0aedcebf5a6434 | /buglab/models/evaluate.py | 6451f664c2e61472f2c8c46d28d3d1c9e7e5661b | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | microsoft/neurips21-self-supervised-bug-detection-and-repair | 23ef751829dc90d83571cd68c8703e2c985e4521 | 4e51184a63aecd19174ee40fc6433260ab73d56e | refs/heads/main | 2023-05-23T12:23:41.870343 | 2022-01-19T12:16:19 | 2022-01-19T12:16:19 | 417,330,374 | 90 | 23 | MIT | 2022-08-30T11:54:55 | 2021-10-15T01:14:33 | Python | UTF-8 | Python | false | false | 11,936 | py | #!/usr/bin/env python
"""
Usage:
evaluate.py [options] MODEL_FILENAME TEST_DATA_PATH
Options:
--aml Run this in Azure ML
--azure-info=<path> Azure authentication information file (JSON). Used to load data from Azure storage.
--minibatch-size=<size> The minibatch size. [default: 300]
--assume-buggy Never predict NO_BUG
--eval-only-no-bug Evaluate only NO_BUG samples.
--restore-path=<path> The path to previous model file for starting from previous checkpoint.
--limit-num-elements=<num> Limit the number of elements to evaluate on.
--sequential Do not parallelize data loading. Makes debugging easier.
--quiet Do not show progress bar.
-h --help Show this screen.
--debug Enable debug routines. [default: False]
"""
import math
from collections import defaultdict
from pathlib import Path
from typing import List, Tuple
import numpy as np
import torch
from docopt import docopt
from dpu_utils.utils import RichPath, run_and_debug
from buglab.models.gnn import GnnBugLabModel
from buglab.utils.msgpackutils import load_all_msgpack_l_gz
def run(arguments):
azure_info_path = arguments.get("--azure-info", None)
data_path = RichPath.create(arguments["TEST_DATA_PATH"], azure_info_path)
lim = None if arguments["--limit-num-elements"] is None else int(arguments["--limit-num-elements"])
data = load_all_msgpack_l_gz(data_path, shuffle=True, limit_num_yielded_elements=lim)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model_path = Path(arguments["MODEL_FILENAME"])
model, nn = GnnBugLabModel.restore_model(model_path, device)
predictions = model.predict(data, nn, device, parallelize=not arguments["--sequential"])
num_samples, num_location_correct = 0, 0
num_buggy_samples, num_repaired_correct, num_repaired_given_location_correct = 0, 0, 0
# Count warnings correct if a bug is reported, irrespectively if it's localized correctly
num_buggy_and_raised_warning, num_non_buggy_and_no_warning = 0, 0
localization_data_per_scout = defaultdict(lambda: np.array([0, 0], dtype=np.int32))
repair_data_per_scout = defaultdict(lambda: np.array([0, 0], dtype=np.int32))
bug_detection_logprobs: List[
Tuple[float, bool, bool, bool, bool]
] = [] # prediction_prob, has_bug, predicted_no_bug, location_correct, rewrite_given_location_is_correct
for datapoint, location_logprobs, rewrite_probs in predictions:
if arguments.get("--assume-buggy", False):
del location_logprobs[-1]
norm = float(torch.logsumexp(torch.tensor(list(location_logprobs.values())), dim=-1))
location_logprobs = {p: v - norm for p, v in location_logprobs.items()}
target_fix_action_idx = datapoint["target_fix_action_idx"]
sample_has_bug = target_fix_action_idx is not None
if sample_has_bug and arguments.get("--eval-only-no-bug", False):
continue
num_samples += 1
# Compute the predicted rewrite:
predicted_node_idx = max(location_logprobs, key=lambda k: location_logprobs[k])
prediction_logprob = location_logprobs[predicted_node_idx]
predicted_rewrite_idx, predicted_rewrite_logprob = None, -math.inf
for rewrite_idx, (rewrite_node_idx, rewrite_logprob) in enumerate(
zip(datapoint["graph"]["reference_nodes"], rewrite_probs)
):
if rewrite_node_idx == predicted_node_idx and rewrite_logprob > predicted_rewrite_logprob:
predicted_rewrite_idx = rewrite_idx
predicted_rewrite_logprob = rewrite_logprob
# Compute the predicted rewrite given the correct target location:
if not sample_has_bug:
assert not arguments.get("--assume-buggy", False)
ground_node_idx = -1
target_rewrite_scout = "NoBug"
rewrite_given_location_is_correct = None
else:
ground_node_idx = datapoint["graph"]["reference_nodes"][target_fix_action_idx]
target_rewrite_scout = datapoint["candidate_rewrite_metadata"][target_fix_action_idx][0]
predicted_rewrite_idx_given_location = None
predicted_rewrite_logprob_given_location = -math.inf
for rewrite_idx, (rewrite_node_idx, rewrite_logprob) in enumerate(
zip(datapoint["graph"]["reference_nodes"], rewrite_probs)
):
if rewrite_node_idx == ground_node_idx and rewrite_logprob > predicted_rewrite_logprob_given_location:
predicted_rewrite_idx_given_location = rewrite_idx
predicted_rewrite_logprob_given_location = rewrite_logprob
rewrite_given_location_is_correct = predicted_rewrite_idx_given_location == target_fix_action_idx
if rewrite_given_location_is_correct:
num_repaired_given_location_correct += 1
repair_data_per_scout[target_rewrite_scout] += [1, 1]
else:
repair_data_per_scout[target_rewrite_scout] += [0, 1]
num_buggy_samples += 1
location_is_correct = predicted_node_idx == ground_node_idx
if location_is_correct:
num_location_correct += 1
localization_data_per_scout[target_rewrite_scout] += [1, 1]
else:
localization_data_per_scout[target_rewrite_scout] += [0, 1]
if sample_has_bug and predicted_node_idx != -1:
num_buggy_and_raised_warning += 1
elif not sample_has_bug and predicted_node_idx == -1:
num_non_buggy_and_no_warning += 1
if location_is_correct and predicted_rewrite_idx == target_fix_action_idx:
num_repaired_correct += 1
bug_detection_logprobs.append(
(
prediction_logprob,
sample_has_bug,
predicted_node_idx != -1,
location_is_correct,
rewrite_given_location_is_correct,
)
)
print("==================================")
print(
f"Accuracy (Localization & Repair) {num_repaired_correct/num_samples:.2%} ({num_repaired_correct}/{num_samples})"
)
print(
f"Bug Detection Accuracy (no Localization or Repair) {(num_buggy_and_raised_warning + num_non_buggy_and_no_warning)/num_samples:.2%} ({num_buggy_and_raised_warning + num_non_buggy_and_no_warning}/{num_samples})"
)
if num_buggy_samples > 0:
print(
f"Bug Detection (no Localization or Repair) False Negatives: {1 - num_buggy_and_raised_warning/num_buggy_samples:.2%}"
)
else:
print("Bug Detection (no Localization or Repair) False Negatives: NaN (0/0)")
if num_samples - num_buggy_samples > 0:
print(
f"Bug Detection (no Localization or Repair) False Positives: {1 - num_non_buggy_and_no_warning / (num_samples - num_buggy_samples):.2%}"
)
else:
print("Bug Detection (no Localization or Repair) False Positives: NaN (0/0)")
print("==================================")
print(f"Localization Accuracy {num_location_correct/num_samples:.2%} ({num_location_correct}/{num_samples})")
for scout_name, (num_correct, total) in sorted(localization_data_per_scout.items(), key=lambda item: item[0]):
print(f"\t{scout_name}: {num_correct/total:.1%} ({num_correct}/{total})")
print("=========================================")
if num_buggy_samples == 0:
print("--eval-only-no-bug is True. Repair Accuracy Given Location cannot be computed.")
else:
print(
f"Repair Accuracy Given Location {num_repaired_given_location_correct/num_buggy_samples:.2%} ({num_repaired_given_location_correct}/{num_buggy_samples})"
)
for scout_name, (num_correct, total) in sorted(repair_data_per_scout.items(), key=lambda item: item[0]):
print(f"\t{scout_name}: {num_correct/total:.1%} ({num_correct}/{total})")
bug_detection_logprobs = sorted(bug_detection_logprobs, reverse=True)
detection_true_warnings = np.array(
[has_bug and correct_location for _, has_bug, _, correct_location, _ in bug_detection_logprobs]
)
true_warnings = np.array(
[
has_bug and correct_location and correct_rewrite_at_location
for _, has_bug, _, correct_location, correct_rewrite_at_location in bug_detection_logprobs
]
)
detection_false_warnings = np.array(
[
predicted_is_buggy and not predicted_correct_location
for _, has_bug, predicted_is_buggy, predicted_correct_location, _ in bug_detection_logprobs
]
)
false_warnings = np.array(
[
(predicted_is_buggy and not predicted_correct_location)
or (predicted_is_buggy and not predicted_correct_rewrite_at_location)
for _, has_bug, predicted_is_buggy, predicted_correct_location, predicted_correct_rewrite_at_location in bug_detection_logprobs
]
)
detection_true_warnings_up_to_threshold = np.cumsum(detection_true_warnings)
detection_false_warnings_up_to_threshold = np.cumsum(detection_false_warnings)
false_discovery_rate = detection_false_warnings_up_to_threshold / (
detection_true_warnings_up_to_threshold + detection_false_warnings_up_to_threshold
)
detection_precision = detection_true_warnings_up_to_threshold / (
detection_true_warnings_up_to_threshold + detection_false_warnings_up_to_threshold
)
detection_recall = detection_true_warnings_up_to_threshold / sum(
1 for _, has_bug, _, _, _ in bug_detection_logprobs if has_bug
)
detection_false_no_bug_warnings = np.array(
[
predicted_is_buggy and not has_bug
for _, has_bug, predicted_is_buggy, predicted_correct_location, _ in bug_detection_logprobs
]
)
no_bug_precision = 1 - np.cumsum(detection_false_no_bug_warnings) / (
sum(1 for _, has_bug, _, _, _ in bug_detection_logprobs if has_bug) + 1e-10
)
threshold_x = np.linspace(0, 1, num=100)
thresholds = np.exp(np.array([b[0] for b in bug_detection_logprobs]))
print("x = np." + repr(threshold_x))
print("### False Detection Rate ###")
fdr = np.interp(threshold_x, thresholds[::-1], false_discovery_rate[::-1], right=0)
print("fdr = np." + repr(fdr))
print("### Detection Precision ###")
detection_precision = np.interp(threshold_x, thresholds[::-1], detection_precision[::-1], right=0)
print("detection_precision = np." + repr(detection_precision))
print("### Detection Recall ###")
detection_recall = np.interp(threshold_x, thresholds[::-1], detection_recall[::-1], right=0)
print("detection_recall = np." + repr(detection_recall))
print("### Detection NO_BUG Precision ###")
no_bug_precision = np.interp(threshold_x, thresholds[::-1], no_bug_precision[::-1], right=0)
print("no_bug_precision = np." + repr(no_bug_precision))
true_warnings_up_to_threshold = np.cumsum(true_warnings)
false_warnings_up_to_threshold = np.cumsum(false_warnings)
precision = true_warnings_up_to_threshold / (true_warnings_up_to_threshold + false_warnings_up_to_threshold)
recall = true_warnings_up_to_threshold / sum(1 for _, has_bug, _, _, _ in bug_detection_logprobs if has_bug)
print("### Precision (Detect and Repair) ###")
precision = np.interp(threshold_x, thresholds[::-1], precision[::-1], right=0)
print("precision = np." + repr(precision))
print("### Recall (Detect and Repair) ###")
recall = np.interp(threshold_x, thresholds[::-1], recall[::-1], right=0)
print("recall = np." + repr(recall))
if __name__ == "__main__":
args = docopt(__doc__)
run_and_debug(lambda: run(args), args.get("--debug", False))
| [
"miallama@microsoft.com"
] | miallama@microsoft.com |
c253644311d7fe2b49eac8dac03132f4f1cdd8ba | de24f83a5e3768a2638ebcf13cbe717e75740168 | /moodledata/vpl_data/303/usersdata/302/66800/submittedfiles/testes.py | 7c56144edfa042834f7911ced03a33c1d0ca5381 | [] | no_license | rafaelperazzo/programacao-web | 95643423a35c44613b0f64bed05bd34780fe2436 | 170dd5440afb9ee68a973f3de13a99aa4c735d79 | refs/heads/master | 2021-01-12T14:06:25.773146 | 2017-12-22T16:05:45 | 2017-12-22T16:05:45 | 69,566,344 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 188 | py | # -*- coding: utf-8 -*-
#COMECE AQUI ABAIXO
idade = int(input('Digite sua idade'))
if idade => 18:
print ("maior de idade")
else:
print ('menor de idade')
| [
"rafael.mota@ufca.edu.br"
] | rafael.mota@ufca.edu.br |
fad7a7a03740888784aae9c82773ae506f9a7d84 | 3cc30d0b48b38e10d82cad2a142d697c79c7f308 | /src/collatinus_words/common.py | 618aef1baae39d01159544037cbac155f97a66b8 | [] | no_license | mcorne/collatinus-words | 0bf6b1c8635eebc8512f735e771642f455863d27 | da5b08bb017535037ba0c315ef51428f40b3f062 | refs/heads/master | 2023-08-17T14:21:25.335134 | 2021-09-25T18:18:53 | 2021-09-25T18:18:53 | 407,914,618 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 287 | py | import unicodedata
from pathlib import Path
class Common:
def read_model(self, file):
path = Path(__file__).parent.joinpath(file)
with path.open(encoding="utf-8") as f:
lines = unicodedata.normalize("NFC", f.read()).split("\n")
return lines
| [
"michel.corne@dgfip.finances.gouv.fr"
] | michel.corne@dgfip.finances.gouv.fr |
72f1a1f05e457a9f11bdee1d6b7442f9a3fe8ee7 | e436e729b0a78c7062311e0f48c55dd25d13faef | /tests/core/test_utils.py | b2bc8e17e86be01fde91a5b6c1f2ba12e3fdf488 | [
"MIT"
] | permissive | cad106uk/market-access-public-frontend | 71ff602f4817666ed2837432b912f108010a30a1 | 092149105b5ddb1307c613123e94750b0b8b39ac | refs/heads/master | 2023-02-03T18:48:45.838135 | 2020-12-24T09:38:56 | 2020-12-24T09:38:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 741 | py | import datetime
from unittest import TestCase
from apps.core.utils import convert_to_snake_case, chain, get_future_date
class UtilsTestCase(TestCase):
def test_get_future_date(self):
now = datetime.datetime.now()
future_date_str = get_future_date(60)
extra_days = datetime.datetime.strptime(future_date_str, "%a, %d-%b-%Y %H:%M:%S GMT") - now
# +- 1 day is acceptable here
assert extra_days.days in range(59, 60)
def test_convert_to_snake_case(self):
test_string = "Some Test String"
assert "some_test_string" == convert_to_snake_case(test_string)
def test_chain(self):
l1 = (1, 2, 3)
l2 = [4, 5, 6]
assert [*l1, *l2] == list(chain(l1, l2))
| [
"noreply@github.com"
] | cad106uk.noreply@github.com |
d242fc244edeb09b0c77a69cefb7db4c2ecc9864 | b228d361a1256d0d168fc45f973b90ae4afe5737 | /deprecated/scratch_B120_B122.py | 110283de7ee9b942a8319b964126d99d02e506df | [] | no_license | mjstarke/globe-QA | 0c69d3c50a697401ac2e257276d2080c6dfcfbd6 | 8e8ab5c0db3fe0b96180ed98b8889ef01b148401 | refs/heads/master | 2022-07-07T14:49:17.150402 | 2019-08-09T16:02:32 | 2019-08-09T16:02:32 | 192,923,326 | 1 | 0 | null | 2022-06-21T22:27:49 | 2019-06-20T13:17:44 | Python | UTF-8 | Python | false | false | 5,563 | py | # DEPRECATED: This script is superseded partially by figure_S017.
from figure_common import *
globe_categories = [None, "none", "few", "isolated", "scattered", "broken", "overcast", "obscured"]
globe_labels = ["null", "none", "few", "isolated", "scattered", "broken", "overcast", "obscured"]
geos_categories = ["none", "few", "isolated", "scattered", "broken", "overcast"]
geos_labels = ["none", "few", "isolated", "scattered", "broken", "overcast"]
obs = tools.parse_csv(fp_obs_with_satellite_matches_2018)
########################################################################################################################
cdf_jan = Dataset(fp_GEOS_Jan)
obs_jan = tools.filter_by_datetime(obs,
earliest=tools.get_cdf_datetime(cdf_jan, 0) - timedelta(minutes=30),
latest=tools.get_cdf_datetime(cdf_jan, -1) + timedelta(minutes=30))
for ob in tqdm(obs_jan, desc="Gathering coincident GEOS output"):
ob.tcc_geos = cdf_jan["CLDTOT"][tools.find_closest_gridbox(cdf_jan, ob.measured_dt, ob.lat, ob.lon)]
ob.tcc_geos_category = tools.bin_cloud_fraction(ob.tcc_geos, True)
########################################################################################################################
absolute_jan = np.zeros((6, 8))
for ob in obs_jan:
x = geos_categories.index(ob.tcc_geos_category)
y = globe_categories.index(ob.tcc)
absolute_jan[x, y] += 1
rowwise_jan = absolute_jan / absolute_jan.sum(axis=0, keepdims=True)
columnwise_jan = absolute_jan / absolute_jan.sum(axis=1, keepdims=True)
########################################################################################################################
fig = plt.figure(figsize=(14, 7))
ax1 = fig.add_subplot(131)
ax2 = fig.add_subplot(132)
ax3 = fig.add_subplot(133)
plotters.plot_annotated_heatmap(absolute_jan, geos_labels, globe_labels, text_color_threshold=1000, ax=ax1)
ax1.set_xlabel("GEOS total cloud cover")
ax1.set_ylabel("GLOBE total cloud cover")
plt.tight_layout()
plotters.plot_annotated_heatmap(columnwise_jan, geos_labels, ["" for _ in globe_labels], text_color_threshold=0.4, text_formatter="{:.2%}", ax=ax2)
ax2.set_xlabel("GEOS total cloud cover")
ax2.yaxis.set_ticks_position("none")
plt.tight_layout()
plotters.plot_annotated_heatmap(rowwise_jan, geos_labels, globe_labels, text_color_threshold=0.4, text_formatter="{:.2%}", ax=ax3)
ax3.set_xlabel("GEOS total cloud cover")
ax3.yaxis.set_ticks_position("right")
plt.tight_layout()
########################################################################################################################
cdf_jul = Dataset(fp_GEOS_Jul)
obs_jul = tools.filter_by_datetime(obs,
earliest=tools.get_cdf_datetime(cdf_jul, 0) - timedelta(minutes=30),
latest=tools.get_cdf_datetime(cdf_jul, -1) + timedelta(minutes=30))
for ob in tqdm(obs_jul, desc="Gathering coincident GEOS output"):
ob.tcc_geos = cdf_jul["CLDTOT"][tools.find_closest_gridbox(cdf_jul, ob.measured_dt, ob.lat, ob.lon)]
ob.tcc_geos_category = tools.bin_cloud_fraction(ob.tcc_geos, True)
########################################################################################################################
absolute_jul = np.zeros((6, 8))
for ob in obs_jul:
x = geos_categories.index(ob.tcc_geos_category)
y = globe_categories.index(ob.tcc)
absolute_jul[x, y] += 1
rowwise_jul = absolute_jul / absolute_jul.sum(axis=0, keepdims=True)
columnwise_jul = absolute_jul / absolute_jul.sum(axis=1, keepdims=True)
########################################################################################################################
fig = plt.figure(figsize=(14, 7))
ax1 = fig.add_subplot(131)
ax2 = fig.add_subplot(132)
ax3 = fig.add_subplot(133)
plotters.plot_annotated_heatmap(absolute_jul, geos_labels, globe_labels, text_color_threshold=800, ax=ax1)
ax1.set_xlabel("GEOS total cloud cover")
ax1.set_ylabel("GLOBE total cloud cover")
plt.tight_layout()
plotters.plot_annotated_heatmap(columnwise_jul, geos_labels, ["" for _ in globe_labels], text_color_threshold=0.4, text_formatter="{:.2%}", ax=ax2)
ax2.set_xlabel("GEOS total cloud cover")
ax2.yaxis.set_ticks_position("none")
plt.tight_layout()
plotters.plot_annotated_heatmap(rowwise_jul, geos_labels, globe_labels, text_color_threshold=0.4, text_formatter="{:.2%}", ax=ax3)
ax3.set_xlabel("GEOS total cloud cover")
ax3.yaxis.set_ticks_position("right")
plt.tight_layout()
########################################################################################################################
fig = plt.figure(figsize=(14, 7))
ax1 = fig.add_subplot(131)
ax2 = fig.add_subplot(132)
ax3 = fig.add_subplot(133)
plotters.plot_annotated_heatmap(absolute_jul - absolute_jan, geos_labels, globe_labels, text_color_threshold=-600, ax=ax1, cmap="bwr")
ax1.set_xlabel("GEOS total cloud cover")
ax1.set_ylabel("GLOBE total cloud cover")
plt.tight_layout()
plotters.plot_annotated_heatmap(columnwise_jul - columnwise_jan, geos_labels, ["" for _ in globe_labels], text_color_threshold=-5, text_formatter="{:.2%}", ax=ax2, cmap="bwr", vmin=-.3, vmax=.3)
ax2.set_xlabel("GEOS total cloud cover")
ax2.yaxis.set_ticks_position("none")
plt.tight_layout()
plotters.plot_annotated_heatmap(rowwise_jul - rowwise_jan, geos_labels, globe_labels, text_color_threshold=-0.2, text_formatter="{:.2%}", ax=ax3, cmap="bwr", vmin=-.3, vmax=.3)
ax3.set_xlabel("GEOS total cloud cover")
ax3.yaxis.set_ticks_position("right")
plt.tight_layout()
| [
"matthew.j.starke@nasa.gov"
] | matthew.j.starke@nasa.gov |
1808c14f89677eda21489c6ca86615cddc39f671 | 762db71e9bb66ab5821bd91eff7e0fa813f795a0 | /code/python/echomesh/util/math/LargestInvertible.py | d29937b39ff5a64bf2a144c83e74a0f9632c2172 | [
"MIT"
] | permissive | huochaip/echomesh | 0954d5bca14d58c0d762a5d3db4e6dcd246bf765 | be668971a687b141660fd2e5635d2fd598992a01 | refs/heads/master | 2020-06-17T20:21:47.216434 | 2016-08-16T16:49:56 | 2016-08-16T16:49:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,014 | py | from __future__ import absolute_import, division, print_function, unicode_literals
import fractions
import math
from six.moves import xrange
# http://stackoverflow.com/questions/4798654/modular-multiplicative-inverse-function-in-python
# from https://en.wikibooks.org/wiki/Algorithm_Implementation/Mathematics/Extended_Euclidean_algorithm
def egcd(a, b):
x, y, u, v = 0, 1, 1, 0
while a:
q, r = b // a, b % a
m, n = x - u*q, y - v*q
b, a, x, y, u, v = a, r, u, v, m, n
return b, x, y
def modinv(a, m):
g, x, y = egcd(a, m)
if g == 1:
return x % m
raise Exception('modular inverse does not exist')
def largest_invertible(x):
"""In the ring Mod(x), returns the invertible number nearest to x / 2, and
its inverse."""
if x >= 5:
for i in xrange(int(x / 2), 1, -1):
try:
ii = (i if i < (x / 2) else x - i)
return ii, modinv(ii, x)
except:
pass
return 1, 1
| [
"tom@swirly.com"
] | tom@swirly.com |
598f8a61b3087b0fcb7b6c6a253d5aee52cc0047 | 57cf467be3ac28d778c61d81e67895c59092ec36 | /pylogview/__main__.py | d74949329d265c9e54f8bb4bbefe4dd916662630 | [
"MIT"
] | permissive | CrazyIvan359/logview | 19c780c6ff3d7b3ade805e3af5573894a212bb71 | 4fb145843315dd03ff4ba414a5a617775d9d2af1 | refs/heads/master | 2023-02-12T17:52:51.366410 | 2021-01-16T21:46:23 | 2021-01-16T21:46:23 | 308,994,421 | 0 | 0 | MIT | 2020-11-02T01:21:49 | 2020-11-01T00:10:12 | Python | UTF-8 | Python | false | false | 194 | py | import os
import sys
def main():
from pylogview import logview
logview()
if __name__ == "__main__":
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
main()
| [
"6764025+CrazyIvan359@users.noreply.github.com"
] | 6764025+CrazyIvan359@users.noreply.github.com |
ae0d5043c4b6f21d284546b7af2d4fae2c9de60d | 8aa656ad1ccedbc26a7944ac3d4a6a3407cb8f9e | /reversestr.py | 117c90244858ea6b74fd443335701e19ed600e57 | [] | no_license | Ramyasree3010/ramyasree | 50cbf71d06ef836c9fc2bfc3b1a79386cbfce135 | 3903fd5017b5b9ee92cfcfeb0480415ac54e3c24 | refs/heads/master | 2020-03-18T14:27:52.748880 | 2018-07-07T11:19:38 | 2018-07-07T11:19:38 | 134,849,354 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 38 | py | a=str(input())
print()
print(a[::-1])
| [
"noreply@github.com"
] | Ramyasree3010.noreply@github.com |
3e788e30fcf2f685d56dbf028eb1b93f22e164be | 6a07912090214567f77e9cd941fb92f1f3137ae6 | /cs212/Problem Set 1/2.py | 97b6cb647b9c05d52c0f4bd57cf754e82586bf20 | [] | no_license | rrampage/udacity-code | 4ab042b591fa3e9adab0183d669a8df80265ed81 | bbe968cd27da7cc453eada5b2aa29176b0121c13 | refs/heads/master | 2020-04-18T08:46:00.580903 | 2012-08-25T08:44:24 | 2012-08-25T08:44:24 | 5,352,942 | 3 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,333 | py | # cs212 ; Problem Set 1 ; 2
# CS 212, hw1-2: Jokers Wild
#
# -----------------
# User Instructions
#
# Write a function best_wild_hand(hand) that takes as
# input a 7-card hand and returns the best 5 card hand.
# In this problem, it is possible for a hand to include
# jokers. Jokers will be treated as 'wild cards' which
# can take any rank or suit of the same color. The
# black joker, '?B', can be used as any spade or club
# and the red joker, '?R', can be used as any heart
# or diamond.
#
# The itertools library may be helpful. Feel free to
# define multiple functions if it helps you solve the
# problem.
#
# -----------------
# Grading Notes
#
# Muliple correct answers will be accepted in cases
# where the best hand is ambiguous (for example, if
# you have 4 kings and 3 queens, there are three best
# hands: 4 kings along with any of the three queens).
import itertools
def best_wild_hand(hand):
"Try all values for jokers in all 5-card selections."
# Your code here
def test_best_wild_hand():
assert (sorted(best_wild_hand("6C 7C 8C 9C TC 5C ?B".split()))
== ['7C', '8C', '9C', 'JC', 'TC'])
assert (sorted(best_wild_hand("TD TC 5H 5C 7C ?R ?B".split()))
== ['7C', 'TC', 'TD', 'TH', 'TS'])
assert (sorted(best_wild_hand("JD TC TH 7C 7D 7S 7H".split()))
== ['7C', '7D', '7H', '7S', 'JD'])
return 'test_best_wild_hand passes'
# ------------------
# Provided Functions
#
# You may want to use some of the functions which
# you have already defined in the unit to write
# your best_hand function.
def hand_rank(hand):
"Return a value indicating the ranking of a hand."
ranks = card_ranks(hand)
if straight(ranks) and flush(hand):
return (8, max(ranks))
elif kind(4, ranks):
return (7, kind(4, ranks), kind(1, ranks))
elif kind(3, ranks) and kind(2, ranks):
return (6, kind(3, ranks), kind(2, ranks))
elif flush(hand):
return (5, ranks)
elif straight(ranks):
return (4, max(ranks))
elif kind(3, ranks):
return (3, kind(3, ranks), ranks)
elif two_pair(ranks):
return (2, two_pair(ranks), ranks)
elif kind(2, ranks):
return (1, kind(2, ranks), ranks)
else:
return (0, ranks)
def card_ranks(hand):
"Return a list of the ranks, sorted with higher first."
ranks = ['--23456789TJQKA'.index(r) for r, s in hand]
ranks.sort(reverse = True)
return [5, 4, 3, 2, 1] if (ranks == [14, 5, 4, 3, 2]) else ranks
def flush(hand):
"Return True if all the cards have the same suit."
suits = [s for r,s in hand]
return len(set(suits)) == 1
def straight(ranks):
"""Return True if the ordered
ranks form a 5-card straight."""
return (max(ranks)-min(ranks) == 4) and len(set(ranks)) == 5
def kind(n, ranks):
"""Return the first rank that this hand has
exactly n-of-a-kind of. Return None if there
is no n-of-a-kind in the hand."""
for r in ranks:
if ranks.count(r) == n: return r
return None
def two_pair(ranks):
"""If there are two pair here, return the two
ranks of the two pairs, else None."""
pair = kind(2, ranks)
lowpair = kind(2, list(reversed(ranks)))
if pair and lowpair != pair:
return (pair, lowpair)
else:
return None
| [
"raunak1001@gmail.com"
] | raunak1001@gmail.com |
695c0b2d7954fd1051f0035d72fe20162555f864 | cfb27653926a6dec6867eeff9920462e42bf50aa | /udacity_cs101.py | b22c916b92c1b1690567199c1c263fe2c15f57b8 | [] | no_license | oscarjo89/Udacity_cs101 | 257e3df654c9b147b28c212fe08275f33b2db539 | 20306d4268f04bc5c8ea8bdda342c5e7954103c1 | refs/heads/master | 2021-01-11T15:31:17.157086 | 2017-02-04T13:14:43 | 2017-02-04T13:14:43 | 80,366,505 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,398 | py | # Intro to Computer Science
# Build a Search Engine & a Social Network
# https://www.udacity.com/course/intro-to-computer-science--cs101
#Lesson 1 Write your first computer program
# Sergey Brin's advice on learning to program.
# Get started on your first Python program.
# How to create and use variables in Python.
#Lesson 2 Write programs to do repeating work
# Introducing procedures.
# Sum procedure with a return statement.
# Equality comparisons and more.
#Lesson 3 How ot manage data
# Nested lists.
# A list of strings.
# Aliasing and more.
#Lesson 4 Responding to queries
# Data structures.
# Lookup.
# Building the Web Index and more.
#Lesson 5 How programs run
# Measuring speed.
# Spin loop.
# Index size vs. time and more.
#Lesson 6 How to have infinite power
# Infinite power.
# Counter.
# Recursive definitions and more.
#####################################################
# Lesson 1 Write your first computer program
# This course will introduce you to the fundemental ideas of computing, and teach you to read and write your own programs. We are going to do this in the context of building a web search engine.
# Computer science is about how to solve problems by breaking them up into smaller pieces. And then preciely and mechanically describing a sequence of steps to execute in order to solve these pieces. And these steps can be preformed by a computer.
# Build a search engine
# - Find data (web crawler) Units- 1-3
# - Building an index (respond to search quieries) - Units 4-5
# - Rank pages (to get best result) - Units 6
# Unit 1 Getting started - extracting the first link
# Web crawler, start with one page (seed?) follow links, get many pages
# A webpage is a text, a link is a special sequence of text
print 3
print 2+3
# Bakus Naur Form, derivation: Non-terminal -> replacement
# Grace Hopper and Augusta Ada King
s = 'audacity'
print "U" + s[2:]
# Write Python code that assigns to the
# variable url a string that is the value
# of the first URL that appears in a link
# tag in the string page.
# Your code should print http://udacity.com
# Make sure that if page were changed to
# page = '<a href="http://udacity.com">Hello world</a>'
# that your code still assigns the same value to the variable 'url',
# and therefore still prints the same thing.
# page = contents of a web page
page =('<div id="top_bin"><div id="top_content" class="width960">'
'<div class="udacity float-left"><a href="http://udacity.com">')
start_link = page.find('<a href=')
print start_link
end_link = page.find('"', start_link+9)
print end_link
url = page[(start_link+9):end_link]
print url
###############################################
# Exercise by Websten from forums #
###############################################
# To minimize errors when writing long texts with
# complicated expressions you could replace
# the tricky parts with a marker.
# Write a program that takes a line of text and
# finds the first occurrence of a certain marker
# and replaces it with a replacement text.
# The resulting line of text should be stored in a variable.
# All input data will be given as variables.
#
# Replace the first occurrence of marker in the line below.
# There will be at least one occurrence of the marker in the
# line of text. Put the answer in the variable 'replaced'.
# Hint: You can find out the length of a string by command
# len(string). We might test your code with different markers!
# Example 1
marker = "AFK"
replacement = "away from keyboard"
line = "I will now go to sleep and be AFK until lunch time tomorrow."
marker_start = line.find(marker)
marker_end = line.find(marker) + len(marker)
replaced = line[:marker_start] + replacement + line[marker_end:]
print replaced
# Example 2 # uncomment this to test with different input
marker = "EY"
replacement = "Eyjafjallajokull"
line = "The eruption of the volcano EY in 2010 disrupted air travel in Europe for 6 days."
###
# YOUR CODE BELOW. DO NOT DELETE THIS LINE
###
marker_start = line.find(marker)
marker_end = line.find(marker) + len(marker)
replaced = line[:marker_start] + replacement + line[marker_end:]
print replaced
# Example 1 output should be:
#>>> I will now go to sleep and be away from keyboard until lunch time tomorrow.
# Example 2 output should be:
#>>> The eruption of the volcano Eyjafjallajokull in 2010 disrupted air travel in Europe for 6 days.
#####################################################
# Lesson 2 Write programs to do repeating work
# Procedures, like functions in R. Inputs -> Procedure -> Outputs
# Control
page =('<div id="top_bin"><div id="top_content" class="width960">'
'<div class="udacity float-left"><a href="http://udacity.com">')
start_link = page.find('<a href=')
print start_link
end_link = page.find('"', start_link+9)
print end_link
url = page[(start_link+9):end_link]
print url
# Procedures
#####################################################
# Lesson 3 How ot manage data
#####################################################
# Lesson 4 Responding to queries
#####################################################
# Lesson 5 How programs run
#####################################################
# Lesson 6 How to have infinite power
| [
"noreply@github.com"
] | oscarjo89.noreply@github.com |
33791d780f140caa7af658d364f82aa0c8a86f28 | aa1972e6978d5f983c48578bdf3b51e311cb4396 | /nitro-python-1.0/nssrc/com/citrix/netscaler/nitro/resource/config/cluster/clusternodegroup_streamidentifier_binding.py | e684932798111ad39584954df57a8ca7c17454bc | [
"Python-2.0",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | MayankTahil/nitro-ide | 3d7ddfd13ff6510d6709bdeaef37c187b9f22f38 | 50054929214a35a7bb19ed10c4905fffa37c3451 | refs/heads/master | 2020-12-03T02:27:03.672953 | 2017-07-05T18:09:09 | 2017-07-05T18:09:09 | 95,933,896 | 2 | 5 | null | 2017-07-05T16:51:29 | 2017-07-01T01:03:20 | HTML | UTF-8 | Python | false | false | 6,873 | py | #
# Copyright (c) 2008-2016 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_exception
from nssrc.com.citrix.netscaler.nitro.util.nitro_util import nitro_util
class clusternodegroup_streamidentifier_binding(base_resource) :
""" Binding class showing the streamidentifier that can be bound to clusternodegroup.
"""
def __init__(self) :
self._identifiername = None
self._name = None
self.___count = 0
@property
def name(self) :
r"""Name of the nodegroup to which you want to bind a cluster node or an entity.<br/>Minimum length = 1.
"""
try :
return self._name
except Exception as e:
raise e
@name.setter
def name(self, name) :
r"""Name of the nodegroup to which you want to bind a cluster node or an entity.<br/>Minimum length = 1
"""
try :
self._name = name
except Exception as e:
raise e
@property
def identifiername(self) :
r"""stream identifier and rate limit identifier that need to be bound to this nodegroup.
"""
try :
return self._identifiername
except Exception as e:
raise e
@identifiername.setter
def identifiername(self, identifiername) :
r"""stream identifier and rate limit identifier that need to be bound to this nodegroup.
"""
try :
self._identifiername = identifiername
except Exception as e:
raise e
def _get_nitro_response(self, service, response) :
r""" converts nitro response into object and returns the object array in case of get request.
"""
try :
result = service.payload_formatter.string_to_resource(clusternodegroup_streamidentifier_binding_response, response, self.__class__.__name__)
if(result.errorcode != 0) :
if (result.errorcode == 444) :
service.clear_session(self)
if result.severity :
if (result.severity == "ERROR") :
raise nitro_exception(result.errorcode, str(result.message), str(result.severity))
else :
raise nitro_exception(result.errorcode, str(result.message), str(result.severity))
return result.clusternodegroup_streamidentifier_binding
except Exception as e :
raise e
def _get_object_name(self) :
r""" Returns the value of object identifier argument
"""
try :
if self.name is not None :
return str(self.name)
return None
except Exception as e :
raise e
@classmethod
def add(cls, client, resource) :
try :
if resource and type(resource) is not list :
updateresource = clusternodegroup_streamidentifier_binding()
updateresource.name = resource.name
updateresource.identifiername = resource.identifiername
return updateresource.update_resource(client)
else :
if resource and len(resource) > 0 :
updateresources = [clusternodegroup_streamidentifier_binding() for _ in range(len(resource))]
for i in range(len(resource)) :
updateresources[i].name = resource[i].name
updateresources[i].identifiername = resource[i].identifiername
return cls.update_bulk_request(client, updateresources)
except Exception as e :
raise e
@classmethod
def delete(cls, client, resource) :
try :
if resource and type(resource) is not list :
deleteresource = clusternodegroup_streamidentifier_binding()
deleteresource.name = resource.name
deleteresource.identifiername = resource.identifiername
return deleteresource.delete_resource(client)
else :
if resource and len(resource) > 0 :
deleteresources = [clusternodegroup_streamidentifier_binding() for _ in range(len(resource))]
for i in range(len(resource)) :
deleteresources[i].name = resource[i].name
deleteresources[i].identifiername = resource[i].identifiername
return cls.delete_bulk_request(client, deleteresources)
except Exception as e :
raise e
@classmethod
def get(cls, service, name="", option_="") :
r""" Use this API to fetch clusternodegroup_streamidentifier_binding resources.
"""
try :
if not name :
obj = clusternodegroup_streamidentifier_binding()
response = obj.get_resources(service, option_)
else :
obj = clusternodegroup_streamidentifier_binding()
obj.name = name
response = obj.get_resources(service)
return response
except Exception as e:
raise e
@classmethod
def get_filtered(cls, service, name, filter_) :
r""" Use this API to fetch filtered set of clusternodegroup_streamidentifier_binding resources.
Filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
"""
try :
obj = clusternodegroup_streamidentifier_binding()
obj.name = name
option_ = options()
option_.filter = filter_
response = obj.getfiltered(service, option_)
return response
except Exception as e:
raise e
@classmethod
def count(cls, service, name) :
r""" Use this API to count clusternodegroup_streamidentifier_binding resources configued on NetScaler.
"""
try :
obj = clusternodegroup_streamidentifier_binding()
obj.name = name
option_ = options()
option_.count = True
response = obj.get_resources(service, option_)
if response :
return response[0].__dict__['___count']
return 0
except Exception as e:
raise e
@classmethod
def count_filtered(cls, service, name, filter_) :
r""" Use this API to count the filtered set of clusternodegroup_streamidentifier_binding resources.
Filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
"""
try :
obj = clusternodegroup_streamidentifier_binding()
obj.name = name
option_ = options()
option_.count = True
option_.filter = filter_
response = obj.getfiltered(service, option_)
if response :
return response[0].__dict__['___count']
return 0
except Exception as e:
raise e
class clusternodegroup_streamidentifier_binding_response(base_response) :
def __init__(self, length=1) :
self.clusternodegroup_streamidentifier_binding = []
self.errorcode = 0
self.message = ""
self.severity = ""
self.sessionid = ""
self.clusternodegroup_streamidentifier_binding = [clusternodegroup_streamidentifier_binding() for _ in range(length)]
| [
"Mayank@Mandelbrot.local"
] | Mayank@Mandelbrot.local |
55d29e8a29c50328f21cb3ebad13224f1f616e71 | 4e7f16f67b52155b21c7eeb023f2f60f5b3d5c0d | /pynexradml/trainer.py | cb658b868954d8f459f71cce5609b8126b5a6dd0 | [] | no_license | DailyActie/AI_APP_HYD-py-nexrad-ml | 26b3d6202ae90bbe16e5c520d18ac07d2cd49778 | bdee8f72cbcf6728deec796e41a70c254b327e75 | refs/heads/master | 2020-12-12T02:04:26.811108 | 2012-11-28T02:22:08 | 2012-11-28T02:22:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 6,242 | py | from __future__ import division
import random
import numpy as np
import ffnn
import preprocessor
import datastore
import cache
from config import NexradConfig
def printStats(tp, tn, fp, fn, mse):
accuracy = (tp + tn) / (tp + tn + fp + fn)
precision = 0.0 if (tp + fp) == 0 else tp / (tp + fp)
recall = 0.0 if (tp + fn) == 0 else tp / (tp + fn)
f1 = 0.0 if (precision + recall) == 0 else 2 * (precision * recall) / (precision + recall)
print "---------------------------------"
print "Classifier Performance:"
print ""
print " Confusion Matrix"
print " TP | FP "
print " +---------------------+"
print " |%10d|%10d|" % (tp, fp)
print " |%10d|%10d|" % (fn, tn)
print " +---------------------+"
print " FN | TN "
print ""
print " - Accuracy = %.3f" % accuracy
print " - Precision = %.3f" % precision
print " - Recall = %.3f" % recall
print " - F1 = %.3f" % f1
print " - MSE = %.3f" % mse
print "---------------------------------"
if __name__ == "__main__":
import argparse, os
parser = argparse.ArgumentParser(description='Build and validate classifiers')
parser.add_argument('-a', '--arch', help="Network Architecture e.g. 3,2,1 for 3 inputs, 2 hidden nodes and 1 output")
parser.add_argument('--cache', action='store_true', help='Cache data to disk to allow for more data than can fit in memory.')
parser.add_argument('-d', '--data_dir', help='Directory containing datastore')
parser.add_argument('--epochs', type=int, help='Number of epochs for training a neural network')
parser.add_argument('-f', '--config_file', default='pynexrad.cfg', help='override default pynexrad.cfg config file')
parser.add_argument('--features', nargs='*', help='Features to include (e.g. ref, vel, sw)')
parser.add_argument('--filters', nargs='*', help='Filters to include (e.g. min_range_20km, no_bad_ref, su)')
parser.add_argument('--norm', nargs='*', help='Normalizers to use (e.g. SymmetricNormalizer(0,1,2))')
parser.add_argument('-t', '--training_data', nargs='*', help='Datasets to use for training data (e.g. rd1 rd2)')
parser.add_argument('-o', '--output', help='Save classifier to an output file (e.g. nn.ml)')
parser.add_argument('-v', '--verbose', action='store_true', help='Show verbose output')
args = parser.parse_args()
config = NexradConfig(args.config_file, "trainer")
dataDir = config.getOverrideOrConfig(args, 'data_dir')
ds = datastore.Datastore(dataDir)
#Get Data
sweeps = []
for dataset in config.getOverrideOrConfigAsList(args, 'training_data'):
sweeps += [(dataset, x[0], x[1]) for x in ds.getManifest(dataset)]
processor = preprocessor.Preprocessor()
for f in config.getOverrideOrConfigAsList(args, 'features'):
print "Adding Feature %s to Preprocessor" % f
processor.createAndAddFeature(f)
for f in config.getOverrideOrConfigAsList(args, 'filters'):
print "Adding Filter %s to Preprocessor" % f
processor.createAndAddFilter(f)
for n in config.getOverrideOrConfigAsList(args, 'norm'):
print "Adding Normalizer %s to Preprocessor" % n
processor.createAndAddNormalizer(n)
useCache = config.getOverrideOrConfigAsBool(args, 'cache')
if useCache:
cache = cache.Cache(dataDir)
instances = cache.createDiskArray("temp_data", len(processor.featureKeys) + 1)
else:
instances = []
print "Loading Data..."
for sweep in sweeps:
print "Constructing Data for %s, Class = %s" % (sweep[1], sweep[2])
instance = processor.processData(ds.getData(sweep[0], sweep[1]))
instances.append(np.hstack([instance, np.ones((instance.shape[0], 1)) * float(sweep[2])]))
if useCache:
composite = instances
else:
composite = np.vstack(instances)
print "Normalizing Data..."
data = processor.normalizeData(composite)
def shuffle(index):
global data
for x in xrange(0, index):
i = (index - 1 - x)
j = random.randint(0, i)
tmp = np.array(data[i, :])
data[i, :] = data[j, :]
data[j, :] = tmp
#np.random.shuffle(data)
shuffle(len(data))
validationIndex = int(len(data) * 0.9)
archConfig = config.getOverrideOrConfig(args, 'arch')
if archConfig != None:
arch = [int(x) for x in archConfig.split(',')]
else:
nodes = len(data[0]) - 1
arch = [nodes, nodes // 2, 1]
network = ffnn.FeedForwardNeuralNet(layers=arch)
def customLearningGen():
if network.shuffle:
shuffle(validationIndex)
for i in xrange(0,validationIndex):
yield(data[i, :-1], data[i, -1])
def customValidationGen():
for i in xrange(validationIndex, len(data)):
yield(data[i, :-1], data[i, -1])
network.learningGen = customLearningGen
network.validationGen = customValidationGen
network.shuffle = True
network.momentum = 0.1
network.verbose = config.getOverrideOrConfigAsBool(args, 'verbose')
print "Learning Network, Architecture = %s..." % arch
network.learn(0.03, config.getOverrideOrConfigAsInt(args, 'epochs'))
tp, tn, fp, fn, count = (0, 0, 0, 0, 0)
def callback(inputs, target, output):
global tp
global tn
global fp
global fn
global count
if output > 0:
output = 1
elif output <= 0:
output = -1
target = int(target)
if target == 1 and output == 1:
tp += 1
elif target == 1 and output != 1:
fn += 1
elif target == -1 and output == -1:
tn += 1
elif target == -1 and output != -1:
fp += 1
count += 1
mse = network.validate(callback)
printStats(tp, tn, fp, fn, mse)
output = config.getOverrideOrConfig(args, 'output')
if output != None:
print "Saving Network to %s" % (output + ".net")
network.save(output + ".net")
print "Saving Preprocessor to %s" % (output + ".proc")
processor.save(output + ".proc")
if useCache:
cache.close()
| [
"reggiemead@gmail.com"
] | reggiemead@gmail.com |
7455f475a50afc7b088e3d342375944c71fa5075 | f6d63fa5321e9fdca9d5d76b8d1598dc61a5c164 | /app/migrations/0006_usermanager_img.py | d564433d3af175fd8cfca47cb41fd471e27229aa | [] | no_license | ake698/django_music | 8d6431bc7fda3a507c2de95212a40b371f40b24f | dabf5e787bb1404edf44ea4631261cde5a8a2632 | refs/heads/master | 2021-07-12T22:37:18.898816 | 2021-03-28T08:35:30 | 2021-03-28T08:35:30 | 243,263,599 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 466 | py | # Generated by Django 2.1 on 2020-02-25 09:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0005_auto_20200225_1615'),
]
operations = [
migrations.AddField(
model_name='usermanager',
name='img',
field=models.ImageField(blank=True, default='users/default.jpg', null=True, upload_to='users', verbose_name='用户头像'),
),
]
| [
"shiqing.feng@shareworks.cn"
] | shiqing.feng@shareworks.cn |
bcbcb90c7cf3f44d39c8b7ada7255ad68f25b3f9 | a20be0bd31e0ba46806d605cd4b852008b6a7141 | /New Fancy PWM motor/PWM with AND enable/desperation.py | ebc72d5b7795ac273868779d161f1dcc627b768c | [] | no_license | systemetric/hr-brain-2018 | 7dd367baf1bc348a735ec4ed1e604cabb38813af | 5a209e43ae03efd48f28d93571ddc0333fbeac0e | refs/heads/master | 2021-09-07T23:41:59.379209 | 2018-03-03T10:52:42 | 2018-03-03T10:52:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 190 | py | import time
from sr.robot import *
robot = Robot()
robot.motors[0].m0.power = 50
robot.motors[0].m1.power = -50
time.sleep(1)
robot.motors[0].m0.power = 20
robot.motors[0].m1.power = -20 | [
"jacklarkin241@gmail.com"
] | jacklarkin241@gmail.com |
95fd505de6e612fe4910474599f2a8c9473be8bd | b31c0f0d1e8a3bf575e6b86591ec1071cd9a8a3d | /mlonmcu/platform/espidf/__init__.py | 511bc4c5d06b1e9b61f42c245b0d3c14dfe8b50d | [
"Apache-2.0"
] | permissive | tum-ei-eda/mlonmcu | e75238cd7134771217153c740301a8327a7b93b1 | f1b934d5bd42b5471d21bcf257bf88c055698918 | refs/heads/main | 2023-08-07T15:12:13.466944 | 2023-07-15T13:26:21 | 2023-07-15T13:26:21 | 448,808,394 | 22 | 4 | Apache-2.0 | 2023-06-09T23:00:19 | 2022-01-17T08:20:05 | Python | UTF-8 | Python | false | false | 877 | py | #
# Copyright (c) 2022 TUM Department of Electrical and Computer Engineering.
#
# This file is part of MLonMCU.
# See https://github.com/tum-ei-eda/mlonmcu.git for further info.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""MLonMCU ESP-IDF platform"""
# pylint: disable=wildcard-import, redefined-builtin
from .espidf import EspIdfPlatform
__all__ = ["EspIdfPlatform"]
| [
"philipp.van-kempen@tum.de"
] | philipp.van-kempen@tum.de |
238766efb621c4ea8ebfbc76bee09febb405c98b | 7b1420324360f79a2763a13b9f56b18e6dd45e0a | /Legacy/LG_surface_fitting.py | 8034eeed0dcaeefe231c5852da00da2fc85b1d4c | [] | no_license | Eflom/LG_Fitting | 37cc8aa45988046630fcbdcd7995a0bc6b3d5dbc | 9138261ee7b17c943ee05091114b35021fb4d009 | refs/heads/master | 2021-05-07T20:38:36.425940 | 2017-12-13T20:28:31 | 2017-12-13T20:28:31 | 108,931,984 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 32,876 | py | import numpy as np
from numpy import mean, sqrt, square, average
import numpy.ma as ma
import pylab
import matplotlib.pyplot as plt
import scipy
from scipy import special
from mpl_toolkits.mplot3d.axes3d import Axes3D
import cmath
import pandas as pd
import scipy.optimize as opt
from scipy.odr import ODR, odr, Model, Data, RealData, Output
np.set_printoptions(threshold=np.nan)
#specify crop vallues for the data -- IMPORTANT!! the data must be a square
xmin = 225
xmax = 825
ymin = 325
ymax = 925
x0 = (xmin + xmax)/2
y0 = (ymin + ymax)/2
ranges = [15, 50, 100, 200, 400, 600, 800, 1000]
#debug use only, used for making simulated LG data 'noisy'
xerr = scipy.random.random(200)
yerr = scipy.random.random(200)
zerr = scipy.random.random(200)*10.0 -5.0
#read in data from file, cropping it using the values above
data1_1 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_1_0001.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data1_2 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_1_0002.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data1_3 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_1_0003.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data1_4 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_1_0004.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data1_5 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_1_0005.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data1_6 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_1_0006.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data1_7 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_1_0007.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data1_8 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_1_0008.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data1_9 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_1_0009.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data1_10 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_1_0010.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data2_1 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_2_0001.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data2_2 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_2_0002.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data2_3 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_2_0003.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data2_4 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_2_0004.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data2_5 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_2_0005.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data2_6 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_2_0006.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data2_7 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_2_0007.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data2_8 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_2_0008.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data2_9 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_2_0009.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data2_10 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_2_0010.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data3_1 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_3_0001.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data3_2 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_3_0002.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data3_3 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_3_0003.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data3_4 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_3_0004.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data3_5 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_3_0005.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data3_6 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_3_0006.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data3_7 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_3_0007.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data3_8 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_3_0008.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data3_9 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_3_0009.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data3_10 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_3_0010.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data4_1 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_4_0001.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data4_2 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_4_0002.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data4_3 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_4_0003.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data4_4 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_4_0004.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data4_5 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_4_0005.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data4_6 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_4_0006.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data4_7 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_4_0007.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data4_8 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_4_0008.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data4_9 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_4_0009.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data4_10 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_4_0010.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data5_1 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_5_0001.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data5_2 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_5_0002.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data5_3 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_5_0003.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data5_4 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_5_0004.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data5_5 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_5_0005.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data5_6 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_5_0006.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data5_7 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_5_0007.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data5_8 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_5_0008.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data5_9 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_5_0009.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data5_10 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_5_0010.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data6_1 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_6_0001.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data6_2 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_6_0002.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data6_3 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_6_0003.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data6_4 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_6_0004.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data6_5 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_6_0005.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data6_6 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_6_0006.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data6_7 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_6_0007.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data6_8 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_6_0008.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data6_9 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_6_0009.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data6_10 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_6_0010.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data7_1 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_7_0001.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data7_2 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_7_0002.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data7_3 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_7_0003.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data7_4 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_7_0004.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data7_5 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_7_0005.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data7_6 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_7_0006.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data7_7 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_7_0007.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data7_8 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_7_0008.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data7_9 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_7_0009.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data7_10 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_7_0010.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data8_1 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_8_0001.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data8_2 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_8_0002.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data8_3 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_8_0003.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data8_4 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_8_0004.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data8_5 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_8_0005.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data8_6 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_8_0006.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data8_7 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_8_0007.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data8_8 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_8_0008.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data8_9 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_8_0009.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data8_10 = np.array(pd.read_table('/home/flom/Desktop/REU/Data/July_5/Post_8_0010.asc', skiprows = xmin - 1, nrows = xmax - xmin, usecols = range(ymin, ymax, 1), dtype = np.float64))
data1 = (data1_1 + data1_2 + data1_3 + data1_4 + data1_5 + data1_6 + data1_7 + data1_8 + data1_9 + data1_10)/10.
data2 = (data2_1 + data2_2 + data2_3 + data2_4 + data2_5 + data2_6 + data2_7 + data2_8 + data2_9 + data2_10)/10.
data3 = (data3_1 + data3_2 + data3_3 + data3_4 + data3_5 + data3_6 + data3_7 + data3_8 + data3_9 + data3_10)/10.
data4 = (data4_1 + data4_2 + data4_3 + data4_4 + data4_5 + data4_6 + data4_7 + data4_8 + data4_9 + data4_10)/10.
data5 = (data5_1 + data5_2 + data5_3 + data5_4 + data5_5 + data5_6 + data5_7 + data5_8 + data5_9 + data5_10)/10.
data6 = (data6_1 + data6_2 + data6_3 + data6_4 + data6_5 + data6_6 + data6_7 + data6_8 + data6_9 + data6_10)/10.
data7 = (data7_1 + data7_2 + data7_3 + data7_4 + data7_5 + data7_6 + data7_7 + data7_8 + data7_9 + data7_10)/10.
data8 = (data8_1 + data8_2 + data8_3 + data8_4 + data8_5 + data8_6 + data8_7 + data8_8 + data8_9 + data8_10)/10.
data1_sd = np.std([data1_1, data1_2, data1_3, data1_4, data1_5, data1_6, data1_7, data1_8, data1_9, data1_10], axis = 0)
data2_sd = np.std([data2_1, data2_2, data2_3, data2_4, data2_5, data2_6, data2_7, data2_8, data2_9, data2_10], axis = 0)
data3_sd = np.std([data3_1, data3_2, data3_3, data3_4, data3_5, data3_6, data3_7, data3_8, data3_9, data3_10], axis = 0)
data4_sd = np.std([data4_1, data4_2, data4_3, data4_4, data4_5, data4_6, data4_7, data4_8, data4_9, data4_10], axis = 0)
data5_sd = np.std([data5_1, data5_2, data5_3, data5_4, data5_5, data5_6, data5_7, data5_8, data5_9, data5_10], axis = 0)
data6_sd = np.std([data6_1, data6_2, data6_3, data6_4, data6_5, data6_6, data6_7, data6_8, data6_9, data6_10], axis = 0)
data7_sd = np.std([data7_1, data7_2, data7_3, data7_4, data7_5, data7_6, data7_7, data7_8, data7_9, data7_10], axis = 0)
data8_sd = np.std([data8_1, data8_2, data8_3, data8_4, data8_5, data8_6, data8_7, data8_8, data8_9, data8_10], axis = 0)
#generate a regular x-y space as independent variables
x = np.arange(xmin, xmax, 1)
y = np.arange(ymin, ymax, 1)
#specify radial and azimuthal modes of the LG Beam
l=1.
p=0.
#generate the 2D grid for plotting
X, Y = np.meshgrid(x - x0, y -y0)
#define these terms b/c I'm lazy and don't want to keep typing them
Q = x - x0
W = y - y0
#Debug use only, used for generating simulated LG cross-sections
A = 100.
w = 30.
B = 1
#Here's the fit function, broken into three terms for the sake of debugging. Used both for generating simulated cross-sections
Z1 = np.sqrt(A)*(2.*(X**2. + Y**2.)/(w**2.))**l
Z2 = (3. - ((2.*(X**2. + Y**2.))/w**2.))**2. ##use Mathematica LaguerreL [bottom, top, function] to generate this term
Z3 = np.exp((-2.)*((X**2. + Y**2.)/w**2.))
Z4 = Z1*Z2*Z3 + B
#routine to mask data to remove bottom fraction of values
Crop_range = 0.3
zmin1 = np.max(np.max(data1))*Crop_range
zmin2 = np.max(np.max(data2))*Crop_range
zmin3 = np.max(np.max(data3))*Crop_range
zmin4 = np.max(np.max(data4))*Crop_range
zmin5 = np.max(np.max(data5))*Crop_range
zmin6 = np.max(np.max(data6))*Crop_range
zmin7 = np.max(np.max(data7))*Crop_range
zmin8 = np.max(np.max(data8))*Crop_range
maskeddata1 = np.where(data1 > zmin1, data1, 0.0)
maskedfitdata1 = np.where(data1 > zmin1, data1, 0.0)
maskeddata2 = np.where(data2 > zmin2, data2, 0.0)
maskedfitdata2 = np.where(data2 > zmin2, data2, 0.0)
maskeddata3 = np.where(data3 > zmin3, data3, 0.0)
maskedfitdata3 = np.where(data3 > zmin3, data3, 0.0)
maskeddata4 = np.where(data4 > zmin4, data4, 0.0)
maskedfitdata4 = np.where(data4 > zmin4, data4, 0.0)
maskeddata4 = np.where(data4 > zmin4, data4, 0.0)
maskedfitdata4 = np.where(data4 > zmin4, data4, 0.0)
maskeddata5 = np.where(data5 > zmin5, data5, 0.0)
maskedfitdata5 = np.where(data5 > zmin5, data5, 0.0)
maskeddata6 = np.where(data6 > zmin6, data6, 0.0)
maskedfitdata6 = np.where(data6 > zmin6, data6, 0.0)
maskeddata7 = np.where(data7 > zmin7, data7, 0.0)
maskedfitdata7 = np.where(data7 > zmin7, data7, 0.0)
maskeddata8 = np.where(data8 > zmin8, data8, 0.0)
maskedfitdata8 = np.where(data8 > zmin8, data8, 0.0)
N1 = np.count_nonzero(maskeddata1)
N2 = np.count_nonzero(maskeddata2)
N3 = np.count_nonzero(maskeddata3)
N4 = np.count_nonzero(maskeddata4)
N5 = np.count_nonzero(maskeddata5)
N6 = np.count_nonzero(maskeddata6)
N7 = np.count_nonzero(maskeddata7)
N8 = np.count_nonzero(maskeddata8)
#define the funciton in terms of the 5 paramters, so that the ODR can process them
def function(params, maskedfitdata1):
scale = params[0] #= 9000
baseline = params[2] #= 850
width = params[1] #= 30
y_0 = params[3] #=0
x_0 = params[4] #=20
return ((((scale)*((2.)*((X - x_0)**2. + (Y - y_0)**2.)/(width)**2.)))**l)*(np.exp((-2.)*(((X - x_0)**2. + (Y - y_0)**2.)/(width)**2.))) + baseline
#The meat of the ODR program. set "guesses" to a rough initial guess for the data <-- IMPORTANT
myData1 = Data([Q, W], data1)
myModel = Model(function)
guesses1 = [25000, 20, 150, 00, 00] #guesses are [Scale, width, baseline, x0, y0] for some reason, the ODR program is most sensitive to x0 and y0 guesses. The scale and width values do not need to be especially close, but inaccurate x0 and y0 lead to excessive computation times
odr1 = ODR(myData1, myModel, guesses1, maxit=1000)
odr1.set_job(fit_type=2)
output1 = odr1.run()
#output1.pprint()
Fit_out1 = (((((output1.beta[0]))*(2.*((X - output1.beta[4])**2. + (Y - output1.beta[3])**2.)/(output1.beta[1])**2.)))**l)*(np.exp((-2.)*(((X - output1.beta[4])**2. + (Y - output1.beta[3])**2.)/(output1.beta[1])**2.))) + output1.beta[2]
print 'done1'
myData2 = Data([Q, W], data2)
myModel = Model(function)
guesses2 = [25000, 20, 400, 07, -77] #guesses are [Scale, width, baseline, x0, y0] for some reason, the ODR program is most sensitive to x0 and y0 guesses. The scale and width values do not need to be especially close, but inaccurate x0 and y0 lead to excessive computation times
odr2 = ODR(myData2, myModel, guesses1, maxit=100)
odr2.set_job(fit_type=2)
output2 = odr2.run()
#output2.pprint()
Fit_out2 = (((((output2.beta[0]))*(2.*((X - output2.beta[4])**2. + (Y - output2.beta[3])**2.)/(output2.beta[1])**2.)))**l)*(np.exp((-2.)*(((X - output2.beta[4])**2. + (Y - output2.beta[3])**2.)/(output2.beta[1])**2.))) + output2.beta[2]
print 'done2'
myData3 = Data([Q, W], data3)
myModel = Model(function)
guesses3 = [25000, 20, 250, 0, 0] #guesses are [Scale, width, baseline, x0, y0] for some reason, the ODR program is most sensitive to x0 and y0 guesses. The scale and width values do not need to be especially close, but inaccurate x0 and y0 lead to excessive computation times
odr3 = ODR(myData3, myModel, guesses3, maxit=100)
odr3.set_job(fit_type=2)
output3 = odr3.run()
#output3.pprint()
Fit_out3 = (((((output3.beta[0]))*(2.*((X - output3.beta[4])**2. + (Y - output3.beta[3])**2.)/(output3.beta[1])**2.)))**l)*(np.exp((-2.)*(((X - output3.beta[4])**2. + (Y - output3.beta[3])**2.)/(output3.beta[1])**2.))) + output3.beta[2]
print 'done3'
myData4 = Data([Q, W], data4)
myModel = Model(function)
guesses4 = [25000, 40, 850, 0, 0] #guesses are [Scale, width, baseline, x0, y0] for some reason, the ODR program is most sensitive to x0 and y0 guesses. The scale and width values do not need to be especially close, but inaccurate x0 and y0 lead to excessive computation times
odr4 = ODR(myData4, myModel, guesses4, maxit=100)
odr4.set_job(fit_type=2)
output4 = odr4.run()
#output4.pprint()
Fit_out4 = (((((output4.beta[0]))*(2.*((X - output4.beta[4])**2. + (Y - output4.beta[3])**2.)/(output4.beta[1])**2.)))**l)*(np.exp((-2.)*(((X - output4.beta[4])**2. + (Y - output4.beta[3])**2.)/(output4.beta[1])**2.))) + output4.beta[2]
print 'done4'
myData5 = Data([Q, W], data5)
myModel = Model(function)
guesses5 = [25000, 40, 850, 0, 0] #guesses are [Scale, width, baseline, x0, y0] for some reason, the ODR program is most sensitive to x0 and y0 guesses. The scale and width values do not need to be especially close, but inaccurate x0 and y0 lead to excessive computation times
odr5 = ODR(myData5, myModel, guesses5, maxit=100)
odr5.set_job(fit_type=2)
output5 = odr5.run()
#output5.pprint()
Fit_out5 = (((((output5.beta[0]))*(2.*((X - output5.beta[4])**2. + (Y - output5.beta[3])**2.)/(output5.beta[1])**2.)))**l)*(np.exp((-2.)*(((X - output5.beta[4])**2. + (Y - output5.beta[3])**2.)/(output5.beta[1])**2.))) + output5.beta[2]
print 'done5'
myData6 = Data([Q, W], data6)
myModel = Model(function)
guesses6 = [25000, 60, 850, 0, 0] #guesses are [Scale, width, baseline, x0, y0] for some reason, the ODR program is most sensitive to x0 and y0 guesses. The scale and width values do not need to be especially close, but inaccurate x0 and y0 lead to excessive computation times
odr6 = ODR(myData6, myModel, guesses6, maxit=100)
odr6.set_job(fit_type=2)
output6 = odr6.run()
#output6.pprint()
Fit_out6 = (((((output6.beta[0]))*(2.*((X - output6.beta[4])**2. + (Y - output6.beta[3])**2.)/(output6.beta[1])**2.)))**l)*(np.exp((-2.)*(((X - output6.beta[4])**2. + (Y - output6.beta[3])**2.)/(output6.beta[1])**2.))) + output6.beta[2]
print 'done6'
myData7 = Data([Q, W], data7)
myModel = Model(function)
guesses7 = [25000, 150, 850, 0, 0] #guesses are [Scale, width, baseline, x0, y0] for some reason, the ODR program is most sensitive to x0 and y0 guesses. The scale and width values do not need to be especially close, but inaccurate x0 and y0 lead to excessive computation times
odr7 = ODR(myData7, myModel, guesses7, maxit=100)
odr7.set_job(fit_type=2)
output7 = odr7.run()
#output7.pprint()
Fit_out7 = (((((output7.beta[0]))*(2.*((X - output7.beta[4])**2. + (Y - output7.beta[3])**2.)/(output7.beta[1])**2.)))**l)*(np.exp((-2.)*(((X - output7.beta[4])**2. + (Y - output7.beta[3])**2.)/(output7.beta[1])**2.))) + output7.beta[2]
print 'done7'
myData8 = Data([Q, W], data8)
myModel = Model(function)
guesses8 = [25000, 150, 850, 0, 0] #guesses are [Scale, width, baseline, x0, y0] for some reason, the ODR program is most sensitive to x0 and y0 guesses. The scale and width values do not need to be especially close, but inaccurate x0 and y0 lead to excessive computation times
odr8 = ODR(myData8, myModel, guesses8, maxit=100)
odr8.set_job(fit_type=2)
output8 = odr8.run()
#output8.pprint()
Fit_out8 = (((((output8.beta[0]))*(2.*((X - output8.beta[4])**2. + (Y - output8.beta[3])**2.)/(output8.beta[1])**2.)))**l)*(np.exp((-2.)*(((X - output8.beta[4])**2. + (Y - output8.beta[3])**2.)/(output8.beta[1])**2.))) + output8.beta[2]
print 'done8'
maskedfit1 = np.where(Fit_out1 > zmin1, Fit_out1, 0)
maskedfit2 = np.where(Fit_out2 > zmin2, Fit_out2, 0)
maskedfit3 = np.where(Fit_out3 > zmin3, Fit_out3, 0)
maskedfit4 = np.where(Fit_out4 > zmin4, Fit_out4, 0)
maskedfit5 = np.where(Fit_out5 > zmin5, Fit_out5, 0)
maskedfit6 = np.where(Fit_out6 > zmin6, Fit_out6, 0)
maskedfit7 = np.where(Fit_out7 > zmin7, Fit_out7, 0)
maskedfit8 = np.where(Fit_out8 > zmin8, Fit_out8, 0)
Chisq1 = np.sum(np.sum((((maskeddata1 - maskedfit1))**2)/(maskedfit1+.01)))
Chisq2 = np.sum(np.sum((((maskeddata2 - maskedfit2))**2)/(maskedfit2+.01)))
Chisq3 = np.sum(np.sum((((maskeddata3 - maskedfit3))**2)/(maskedfit3+.01)))
Chisq4 = np.sum(np.sum((((maskeddata4 - maskedfit4))**2)/(maskedfit4+.01)))
Chisq5 = np.sum(np.sum((((maskeddata5 - maskedfit5))**2)/(maskedfit5+.01)))
Chisq6 = np.sum(np.sum((((maskeddata6 - maskedfit6))**2)/(maskedfit6+.01)))
Chisq7 = np.sum(np.sum((((maskeddata7 - maskedfit7))**2)/(maskedfit7+.01)))
Chisq8 = np.sum(np.sum((((maskeddata8 - maskedfit8))**2)/(maskedfit8+.01)))
scale1 = output1.beta[0]
scale2 = output2.beta[0]
scale3 = output3.beta[0]
scale4 = output4.beta[0]
scale5 = output5.beta[0]
scale6 = output6.beta[0]
scale7 = output7.beta[0]
scale8 = output8.beta[0]
Chi_values = [Chisq1, Chisq2, Chisq3, Chisq4, Chisq5, Chisq6, Chisq7, Chisq8]
N_values = [N1, N2, N3, N4, N5, N6, N7, N8]
adj_chi1 = [Chisq1/N1, Chisq2/N2, Chisq3/N3, Chisq4/N4, Chisq5/N5, Chisq6/N6, Chisq7/N7, Chisq8/N8]
adj_chi2 = np.array([Chisq1/N1/scale1, Chisq2/N2/scale2, Chisq3/N3/scale3, Chisq4/N4/scale4, Chisq5/N5/scale5, Chisq6/N6/scale6, Chisq7/N7/scale7, Chisq8/N8/scale8])
adj_chi3 = [Chisq1/scale1, Chisq2/scale2, Chisq3/scale3, Chisq4/scale4, Chisq5/scale5, Chisq6/scale6, Chisq7/scale7, Chisq8/scale8]
#Set up the display window for the plots and the plots themselves
fig1 = plt.figure()
fig2 = plt.figure()
fig3 = plt.figure()
fig4 = plt.figure()
fig5 = plt.figure()
fig6 = plt.figure()
fig7 = plt.figure()
fig8 = plt.figure()
fig9 = plt.figure()
fig10 = plt.figure()
plot1_1=fig1.add_subplot(121, projection='3d')
plot1_2=fig1.add_subplot(122, projection='3d')
plot2_1=fig2.add_subplot(121, projection='3d')
plot2_2=fig2.add_subplot(122, projection='3d')
plot3_1=fig3.add_subplot(121, projection='3d')
plot3_2=fig3.add_subplot(122, projection='3d')
plot4_1=fig4.add_subplot(121, projection='3d')
plot4_2=fig4.add_subplot(122, projection='3d')
plot5_1=fig5.add_subplot(121, projection='3d')
plot5_2=fig5.add_subplot(122, projection='3d')
plot6_1=fig6.add_subplot(121, projection='3d')
plot6_2=fig6.add_subplot(122, projection='3d')
plot7_1=fig7.add_subplot(121, projection='3d')
plot7_2=fig7.add_subplot(122, projection='3d')
plot8_1=fig8.add_subplot(121, projection='3d')
plot8_2=fig8.add_subplot(122, projection='3d')
plot9=fig9.add_subplot(111)
plot10=fig10.add_subplot(111)
plot1_1.set_title('Plane Fit 15mm')
plot1_2.set_title('Data 15 mm')
plot2_1.set_title('Plane Fit 50mm')
plot2_2.set_title('Data 50mm')
plot3_1.set_title('Plane Fit 100mm')
plot3_2.set_title('Data 100mm')
plot4_1.set_title('Plane Fit 200mm')
plot4_2.set_title('Data 200mm')
plot5_1.set_title('Plane Fit 400mm')
plot5_2.set_title('Data 400mm')
plot6_1.set_title('Plane Fit 600mm')
plot6_2.set_title('Data 600mm')
plot7_1.set_title('Plane Fit 800mm')
plot7_2.set_title('Data 800mm')
plot8_1.set_title('Plane Fit 1000mm')
plot8_2.set_title('Data 1000mm')
plot9.set_title('Chi Sq./N vs. Distance, adjusted')
plot10.set_title('Chi Sq. vs. Distance, adjusted')
plot1_1.plot_surface(Y, X, maskedfit1, rstride = 2, cstride = 2, linewidth = 0.05, cmap = 'cool')
plot1_2.plot_surface(Y, X, maskeddata1, rstride = 2, cstride = 2, cmap = 'hot', linewidth = 0.05)
plot2_1.plot_surface(Y, X, maskedfit2, rstride = 10, cstride = 10, linewidth = 0.05, cmap = 'cool')
plot2_2.plot_surface(Y, X, maskeddata2, rstride = 1, cstride = 1, cmap = 'hot', linewidth = 0.05)
plot3_1.plot_surface(Y, X, maskedfit3, rstride = 20, cstride = 20, linewidth = 0.05, cmap = 'cool')
plot3_2.plot_surface(Y, X, maskeddata3, rstride = 20, cstride = 20, cmap = 'hot', linewidth = 0.05)
plot4_1.plot_surface(Y, X, maskedfit4, rstride = 20, cstride = 20, linewidth = 0.05, cmap = 'cool')
plot4_2.plot_surface(Y, X, maskeddata4, rstride = 20, cstride = 20, cmap = 'hot', linewidth = 0.05)
plot5_1.plot_surface(Y, X, maskedfit5, rstride = 20, cstride = 20, linewidth = 0.05, cmap = 'cool')
plot5_2.plot_surface(Y, X, maskeddata5, rstride = 20, cstride = 20, cmap = 'hot', linewidth = 0.05)
plot6_1.plot_surface(Y, X, maskedfit6, rstride = 20, cstride = 20, linewidth = 0.05, cmap = 'cool')
plot6_2.plot_surface(Y, X, maskeddata6, rstride = 20, cstride = 20, cmap = 'hot', linewidth = 0.05)
plot7_1.plot_surface(Y, X, maskedfit7, rstride = 20, cstride = 20, linewidth = 0.05, cmap = 'cool')
plot7_2.plot_surface(Y, X, maskeddata7, rstride = 20, cstride = 20, cmap = 'hot', linewidth = 0.05)
plot8_1.plot_surface(Y, X, maskedfit8, rstride = 20, cstride = 20, linewidth = 0.05, cmap = 'cool')
plot8_2.plot_surface(Y, X, maskeddata8, rstride = 20, cstride = 20, cmap = 'hot', linewidth = 0.05)
plot9.scatter(ranges, adj_chi1)
plot10.scatter(ranges, adj_chi1)
plot2_2.set_xlim(-50, 50)
plot2_2.set_ylim(-50, 50)
plot2_1.set_zlim(10, 1400)
plot2_2.set_zlim(10, 1400)
plot3_1.set_zlim(10, 1400)
plot3_2.set_zlim(10, 1400)
plot4_1.set_zlim(10, 1400)
plot4_2.set_zlim(10, 1400)
plot5_1.set_zlim(10, 1400)
plot5_2.set_zlim(10, 1400)
plot6_1.set_zlim(10, 1400)
plot6_2.set_zlim(10, 1400)
plot7_1.set_zlim(10, 1400)
plot7_2.set_zlim(10, 1400)
plot8_1.set_zlim(10, 1400)
plot8_2.set_zlim(10, 1400)
def function2(params2, ranges):
constant = params2[0]
linear = params2[1]
return (constant + linear*ranges)
def function3(params4, ranges):
constant = params4[0]
linear = params4[1]
quadratic = params4[2]
return (params4[0] + params4[1]*(ranges) + params4[2]*(ranges**2.0))
xfit = np.arange(1, 1000, 0.5)
myData9 = RealData(ranges, adj_chi1, sx = 5, sy = 1)
myModel2 = Model(function2)
guesses9 = [0.001, .00020]
odr9 = ODR(myData9, myModel2, guesses9, maxit=1)
odr9.set_job(fit_type=0)
output9 = odr9.run()
#output9.pprint()
Fit_out9 = output9.beta[1]*xfit + output9.beta[0]
myData10 = RealData(ranges, adj_chi1, sx = 5, sy = 0.00000005)
myModel3 = Model(function3)
guesses10 = [0., .000005, .00000000000005]
odr10 = ODR(myData10, myModel3, guesses10, maxit=1)
odr10.set_job(fit_type=0)
output10 = odr10.run()
#output10.pprint()
Fit_out10 = output10.beta[1]*(xfit) + output10.beta[0] + output10.beta[2]*(xfit**2)
#plot9.plot(xfit, Fit_out9)
#plot10.plot(xfit, Fit_out10)
#prints and labels all five parameters in the terminal, generates the plot in a new window.
print N1
print N2
print N3
print N4
print N5
print N6
print N7
print N8
print Chisq1
print Chisq2
print Chisq3
print Chisq4
print Chisq5
print Chisq6
print Chisq7
print Chisq8
plt.show()
####Library of Laguerre Polynomials for substitution in Z2
## 1, 0 1
## 1, 1 (2 - ((2*(X**2 + Y**2))/w**2))**2
## 2, 1 (3 - ((2*(X**2 + Y**2))/w**2))**2
## 5, 0 1
##
| [
"erikflom86@gmail.com"
] | erikflom86@gmail.com |
125671ac083b8ab5d77142fb5411d4afa74e234c | 7673df8dec063e83aa01187d5a02ca8b4ac3761d | /Basic/functions.py | 8f1badb2bde7f5c4aa358988eb3330bc69a6532a | [] | no_license | jedthompson99/Python_Course | cc905b42a26a2aaf008ce5cb8aaaa6b3b66df61e | 618368390f8a7825459a20b4bc28e80c22da5dda | refs/heads/master | 2023-07-01T08:39:11.309175 | 2021-08-09T17:28:32 | 2021-08-09T17:28:32 | 361,793,964 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 460 | py |
def full_name(first, last):
print(f'{first} {last}')
full_name('Kristine', 'Hudgens')
def auth(email, password):
if email == 'kristine@hudgens.com' and password == 'secret':
print('You are authorized')
else:
print('You are not authorized')
auth('kristine@hudgens.com', 'asdf')
def hundred():
for num in range(1, 101):
print(num)
hundred()
def counter(max_value):
for num in range(1, max_value):
print(num)
counter(501) | [
"jedthompson@gmail.com"
] | jedthompson@gmail.com |
b8a88b113dc2f9df1412f3ceecd57bcfb7d140af | a87a7a4bce23ee1ade177b8ceb7fe82d4737f837 | /month04/django/day04/mysite4/bookstore/models.py | 97cfdd1568219b76f704b8ac6182b2d0c72e3761 | [] | no_license | ywzq87bzx/code | 3d9f9579f842216bb2afbaaf52e9678c25bcfd92 | e77cf592b1dd1239daa0f1cba1591e9a03fb550d | refs/heads/main | 2023-02-18T10:27:21.132762 | 2021-01-22T09:58:35 | 2021-01-22T09:58:35 | 326,974,212 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 340 | py | from django.db import models
# Create your models here.
class Book(models.Model):
title=models.CharField('书名',max_length=30)
price=models.DecimalField('定价',max_digits=5,decimal_places=2)
market_price=models.DecimalField('零售价',max_digits=5,decimal_places=2)
pub=models.CharField('出版社',max_length=30)
| [
"1070727987@qq.com"
] | 1070727987@qq.com |
7a9b228e8caa02c9bc3ce97346fd6555707087a2 | a0f882cf010a3517f074c50e3e00d1656c2d310a | /data/bank_note/note.py | c44bf0398a9913e964ed016466a25cd4a629552d | [] | no_license | bartzleby/mllib | b30973709de7f38688a5ef1031ed31879c820093 | 56c67027ef903a09bbe1936a986e4043801b8a4e | refs/heads/main | 2023-04-22T13:36:36.713401 | 2021-05-07T15:47:47 | 2021-05-07T15:47:47 | 335,476,969 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 529 | py | #!/usr/bin/env python3
#
# CS5350
# Danny Bartz
# March, 2021
#
# bank-note meta data in python
#
dtype = 'float'
features = ['variance', 'skewness', 'curtosis', 'entropy']
def labels_to_pmone(labels):
'''map labels in {0, 1} to {-1,1} respectively.
'''
# TODO: probably a better way..
for l in range(len(labels)):
if labels[l]*1 < 0.1:
labels[l] = -1
elif labels[l]-1 < 1e-6:
labels[l] = 1
else:
print('unexpected label!')
print("label: ", labels[l])
return
return labels
| [
"bartzleby@gmail.com"
] | bartzleby@gmail.com |
d988a6b608ee1eb7cde14577d066fcf8baae9be4 | da816f085b8ff6a8a93c7c00090540f82d313cab | /posneg.py | 0499fb6e8cb47afd020dad8629d6d9db3f6d9eb6 | [] | no_license | Mehareethaa/meha | 75cc75b4f06242292ec1ec36149930890a3ea18a | 5201a962070fcbd50278774d82f20b1a45d53db3 | refs/heads/master | 2021-07-18T06:48:36.295913 | 2020-08-02T11:54:48 | 2020-08-02T11:54:48 | 198,787,618 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 143 | py | n=int(input())
if n>1:
print("Positive")
elseif n>1:
print("Negative")
elseif n==0:
print("Zero")
else:
print("Invalid input")
| [
"noreply@github.com"
] | Mehareethaa.noreply@github.com |
5f6883e8c0e6b0a1c622e7cab2a1c38ef0de001a | 785c66f17fb44a43582f3af5291f5e46d7d76f6b | /main.py | 2ecae00dec131e26e408e380ccb196e9ba8f9f83 | [] | no_license | jamcmich/python-ftp-client | b77c200299dfff7468140eba282f4485704dae0b | 432adb1bd1a96c5bc28aaa6c8bf9c48354b5a9ea | refs/heads/main | 2023-07-31T03:15:44.115569 | 2021-09-23T21:00:21 | 2021-09-23T21:00:21 | 406,514,055 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,444 | py | # ----- Connecting to an FTP Server -----
# We will connect anonymously to Port 21 - Default FTP Port
# Anonymous FTP Connection
# Use an anonymous login to the FTP server.
from ftplib import FTP
try:
print("\nAttempting anonymous login...")
with FTP("ftp.dlptest.com") as ftp:
print(f"\t{ftp.getwelcome()}")
# A "with" statement will automatically close the connection when it reaches the end of the code block.
except Exception as e:
print(f"\tException... {e}")
else:
print("\tSuccess!")
# Authenticated Login
# Use an authenticated login to the FTP server using two different methods.
# Method #1: Passing in the 'user' and 'passwd' parameters to the 'FTP()' constructor.
# Note: I've intentionally passed in the wrong credentials for this example.
try:
print("\nMethod #1\n\tAttempting authenticated connection with login details...")
with FTP(host="ftp.dlptest.com", user="user", passwd="password") as ftp:
print(f"\t{ftp.getwelcome()}")
except Exception as e:
print(f"\tException... {e}")
else:
print("\tSuccess!")
# Method #2: Calling 'connect()' and 'login()'.
try:
print("\nMethod #2\n\tAttempting authenticated connection with login details...")
ftp = FTP()
ftp.connect("ftp.dlptest.com")
ftp.login("dlpuser", "rNrKYTX9g7z3RgJRmxWuGHbeu")
print(f"\t{ftp.getwelcome()}")
ftp.close()
except Exception as e:
print(f"\tException... {e}")
else:
print("\tSuccess!")
# Connection with SSL/TLS Over Default Port 21
from ftplib import FTP_TLS
try:
print(
"\nConnection with SSL/TLS\n\tAttempting authenticated connection with login details..."
)
with FTP_TLS("ftp.dlptest.com", "dlpuser", "rNrKYTX9g7z3RgJRmxWuGHbeu") as ftp:
print(f"\t{ftp.getwelcome()}")
except Exception as e:
print(f"\tException... {e}")
else:
print("\tSuccess!")
# ----- Working with Directories -----
# Printing the current working directory.
try:
print(
"\nConnection with SSL/TLS\n\tAttempting authenticated connection with login details..."
)
with FTP_TLS("ftp.dlptest.com", "dlpuser", "rNrKYTX9g7z3RgJRmxWuGHbeu") as ftp:
print(f"\t{ftp.pwd()}") # Usually the default is /
try:
ftp.mkd("my_dir") # Make a directory
print("\tMade a new directory.")
except Exception as e:
print(f"\tException... {e}")
try:
ftp.rmd("my_dir") # Remove a directory
print("\tRemoved the directory.")
except Exception as e:
print(f"\tException... {e}")
try:
ftp.cwd("other_dir") # Change current working directory
print("\tChanged the current working directory.")
except Exception as e:
print(f"\tException... {e}")
try:
# Listing directory files
# files = []
# ftp.dir(files.append) # Takes a callback for each file
# for file in files:
# print(f"\tfile")
for name in ftp.nlst():
print(f"\t{name}")
except Exception as e:
print(f"\tException... {e}")
except Exception as e:
print(f"\tException... {e}")
# ----- Working with Files -----
try:
print(
"\nConnection with SSL/TLS\n\tAttempting authenticated connection with login details..."
)
with FTP_TLS("ftp.dlptest.com", "dlpuser", "rNrKYTX9g7z3RgJRmxWuGHbeu") as ftp:
print(f"\tAttempting to upload test files.")
# Upload a test file.
# For text or binary file, always use `rb`
print(f"\nUploading text file...")
with open("text.txt", "rb") as text_file:
ftp.storlines(
"STOR text.txt", text_file
) # 'storlines()' should not be used to transfer binary files
print(f"\tUploading image file...")
with open("cat_image.jpg", "rb") as image_file:
ftp.storbinary("STOR cat_image.jpg", image_file)
print(f"\tSuccessfully uploaded test files.")
print(f"\tGetting a list of new files...")
for name in ftp.nlst():
print(f"\t{name}")
# Get the size of a file.
print(f"\nGetting file size...")
try:
ftp.sendcmd('TYPE I') # 'TYPE I' denotes an image or binary data
print(ftp.size('\tImage size in bytes:' + 'cat_image.jpg'))
except Exception as e:
print(f"\tError checking image size: {e}")
# Rename a file.
print(f"\nRenaming file...")
try:
ftp.rename('cat_image.jpg', 'cat.jpg') # Change 'cat_image.jpg' to 'cat.jpg'
print('\tSuccessfully renamed file!')
except Exception as e:
print(f"\tError renaming file: {e}")
# Download a file.
print(f"\nDownloading file...")
with open("local_text.txt", "w") as local_file: # Open local file for writing
response = ftp.retrlines('RETR text.txt', local_file.write)
# Check the response code
print(f"\tChecking response code...")
# https://en.wikipedia.org/wiki/List_of_FTP_server_return_codes
if response.startswith('226'): # Transfer complete
print('\tTransfer complete.')
else:
print('\tError transferring. Local file may be incomplete or corrupt.')
except Exception as e:
print(f"\tException... {e}")
| [
"jacobmcmichael@gmail.com"
] | jacobmcmichael@gmail.com |
ac399da5ab334b48a8e2a061255f77861963d61b | 6c24847c1134bcf02c570e10321036a8e60df27f | /dataloader/SecenFlowLoader.py | acd7afebfc0732bf1f364367101d79eced81a987 | [] | no_license | JumpXing/MABNet | d59640d56f65207f187825e353694481a44924ea | 1b250002bc92129edb21d22140c285dc0879c0f5 | refs/heads/master | 2021-03-14T14:27:36.457481 | 2020-03-12T07:42:38 | 2020-03-12T07:42:38 | 246,771,164 | 6 | 1 | null | null | null | null | UTF-8 | Python | false | false | 2,397 | py | import os
import torch
import torch.utils.data as data
import torch
import torchvision.transforms as transforms
import random
from PIL import Image, ImageOps
from utils import preprocess
from dataloader import listflowfile as lt
from utils import readpfm as rp
import numpy as np
IMG_EXTENSIONS = [
'.jpg', '.JPG', '.jpeg', '.JPEG',
'.png', '.PNG', '.ppm', '.PPM', '.bmp', '.BMP',
]
def is_image_file(filename):
return any(filename.endswith(extension) for extension in IMG_EXTENSIONS)
def default_loader(path):
return Image.open(path).convert('RGB')
def disparity_loader(path):
return rp.readPFM(path)
class myImageFloder(data.Dataset):
def __init__(self, left, right, left_disparity, training, loader=default_loader, dploader= disparity_loader):
self.left = left
self.right = right
self.disp_L = left_disparity
self.loader = loader
self.dploader = dploader
self.training = training
def __getitem__(self, index):
left = self.left[index]
right = self.right[index]
disp_L= self.disp_L[index]
left_img = self.loader(left)
right_img = self.loader(right)
dataL, scaleL = self.dploader(disp_L)
dataL = np.ascontiguousarray(dataL,dtype=np.float32)
if self.training:
w, h = left_img.size
th, tw = 256, 512
x1 = random.randint(0, w - tw)
y1 = random.randint(0, h - th)
left_img = left_img.crop((x1, y1, x1 + tw, y1 + th))
right_img = right_img.crop((x1, y1, x1 + tw, y1 + th))
dataL = dataL[y1:y1 + th, x1:x1 + tw]
processed = preprocess.get_transform(augment=False)
left_img = processed(left_img)
right_img = processed(right_img)
return left_img, right_img, dataL
else:
w, h = left_img.size
left_img = left_img.crop((w-960, h-544, w, h))
right_img = right_img.crop((w-960, h-544, w, h))
processed = preprocess.get_transform(augment=False)
left_img = processed(left_img)
right_img = processed(right_img)
return left_img, right_img, dataL
def __len__(self):
return len(self.left)
| [
"842612690@qq.com"
] | 842612690@qq.com |
08bbe1fdcae8344e3d977489fc712f7cf859d99f | a9cb09fbd39f3dba971bff7188a7643d1cb1b744 | /loader_functions/data_loaders.py | 7dc0291454c00ca2b7b4be86b19d56392874ad36 | [] | no_license | FatBunny13/DynastyRL | 150ac0c5edfb1b8f75a33931b8d218b6f308a99d | 6b3c2e0ea04416a86181d6a5787c9bdda4371316 | refs/heads/master | 2020-04-20T18:05:07.340122 | 2019-04-22T19:30:13 | 2019-04-22T19:30:13 | 169,008,149 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,899 | py | import os
import shelve
def save_level(player,game_map,dungeon_level):
with shelve.open('level{0}{1}'.format(player.name,dungeon_level), 'n') as data_file:
data_file['game_map'] = game_map
def save_entities(player,entities,dungeon_level):
with shelve.open('entities{0}{1}'.format(player.name,dungeon_level), 'n') as data_file:
entities.remove(player)
data_file['entities'] = entities
entities.append(player)
def load_level(player,dungeon_level):
if not os.path.isfile('level{0}{1}.dat'.format(player.name,dungeon_level)):
raise FileNotFoundError
with shelve.open('level{0}{1}'.format(player.name, dungeon_level), 'r') as data_file:
game_map = data_file['game_map']
return game_map
def load_entities(player,dungeon_level):
if not os.path.isfile('entities{0}{1}.dat'.format(player.name,dungeon_level)):
raise FileNotFoundError
with shelve.open('entities{0}{1}'.format(player.name, dungeon_level), 'r') as data_file:
entities = data_file['entities']
return entities
def save_game(player, entities, game_map, message_log, game_state):
with shelve.open('savegame.dat', 'n') as data_file:
data_file['player_index'] = entities.index(player)
data_file['entities'] = entities
data_file['game_map'] = game_map
data_file['message_log'] = message_log
data_file['game_state'] = game_state
def load_game():
if not os.path.isfile('savegame.dat'):
raise FileNotFoundError
with shelve.open('savegame.dat', 'r') as data_file:
player_index = data_file['player_index']
entities = data_file['entities']
game_map = data_file['game_map']
message_log = data_file['message_log']
game_state = data_file['game_state']
player = entities[player_index]
return player, entities, game_map, message_log, game_state
| [
"noreply@github.com"
] | FatBunny13.noreply@github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.