content stringlengths 1 1.05M | input_ids listlengths 1 883k | ratio_char_token float64 1 22.9 | token_count int64 1 883k |
|---|---|---|---|
import copy
import errno
import os
import signal
import time
from psutil import STATUS_ZOMBIE, STATUS_DEAD, NoSuchProcess
from zmq.utils.jsonapi import jsonmod as json
from circus.process import Process, DEAD_OR_ZOMBIE, UNEXISTING
from circus import logger
from circus import util
from circus.stream import get_pipe_redirector, get_stream
from circus.util import parse_env
def notify_event(self, topic, msg):
"""Publish a message on the event publisher channel"""
json_msg = json.dumps(msg)
if isinstance(json_msg, unicode):
json_msg = json_msg.encode('utf8')
if isinstance(self.res_name, unicode):
name = self.res_name.encode('utf8')
else:
name = self.res_name
multipart_msg = ["watcher.%s.%s" % (name, topic), json.dumps(msg)]
if not self.evpub_socket.closed:
self.evpub_socket.send_multipart(multipart_msg)
def _get_sockets_fds(self):
# XXX should be cached
fds = {}
for name, sock in self.sockets.items():
fds[name] = sock.fileno()
return fds
def spawn_process(self):
"""Spawn process.
"""
if self.stopped:
return
cmd = util.replace_gnu_args(self.cmd, sockets=self._get_sockets_fds())
self._process_counter += 1
nb_tries = 0
while nb_tries < self.max_retry:
process = None
try:
process = Process(self._process_counter, cmd,
args=self.args, working_dir=self.working_dir,
shell=self.shell, uid=self.uid, gid=self.gid,
env=self.env, rlimits=self.rlimits,
executable=self.executable, use_fds=self.use_sockets,
watcher=self)
# stream stderr/stdout if configured
if self.stdout_redirector is not None:
self.stdout_redirector.add_redirection('stdout',
process,
process.stdout)
if self.stderr_redirector is not None:
self.stderr_redirector.add_redirection('stderr',
process,
process.stderr)
self.processes[process.pid] = process
logger.debug('running %s process [pid %d]', self.name,
process.pid)
except OSError, e:
logger.warning('error in %r: %s', self.name, str(e))
if process is None:
nb_tries += 1
continue
else:
self.notify_event("spawn", {"process_pid": process.pid,
"time": time.time()})
time.sleep(self.warmup_delay)
return
self.stop()
def kill_process(self, process, sig=signal.SIGTERM):
"""Kill process.
"""
# remove redirections
if self.stdout_redirector is not None:
self.stdout_redirector.remove_redirection('stdout', process)
if self.stderr_redirector is not None:
self.stderr_redirector.remove_redirection('stderr', process)
try:
self.send_signal(process.pid, sig)
self.notify_event("kill", {"process_pid": process.pid,
"time": time.time()})
except NoSuchProcess:
# already dead !
return
process.stop()
def send_signal_processes(self, signum):
for pid in self.processes:
try:
self.send_signal(pid, signum)
except OSError as e:
if e.errno != errno.ESRCH:
raise
def get_active_processes(self):
"""return a list of pids of active processes (not already stopped)"""
return [p for p in self.processes.values()
if p.status not in (DEAD_OR_ZOMBIE, UNEXISTING)]
def set_opt(self, key, val):
"""Set a watcher option.
This function set the watcher options. unknown keys are ignored.
This function return an action number:
- 0: trigger the process management
- 1: trigger a graceful reload of the processes;
"""
action = 0
if key in self._options:
self._options[key] = val
action = -1 # XXX for now does not trigger a reload
elif key == "numprocesses":
val = int(val)
if self.singleton and val > 1:
raise ValueError('Singleton watcher has a single process')
self.numprocesses = val
elif key == "warmup_delay":
self.warmup_delay = float(val)
elif key == "working_dir":
self.working_dir = val
action = 1
elif key == "uid":
self.uid = util.to_uid(val)
action = 1
elif key == "gid":
self.gid = util.to_gid(val)
action = 1
elif key == "send_hup":
self.send_hup = val
elif key == "shell":
self.shell = val
action = 1
elif key == "env":
self.env = val
action = 1
elif key == "cmd":
self.cmd = val
action = 1
elif key == "graceful_timeout":
self.graceful_timeout = float(val)
action = -1
# send update event
self.notify_event("updated", {"time": time.time()})
return action
def do_action(self, num):
# trigger needed action
self.stopped = False
if num == 1:
for i in range(self.numprocesses):
self.spawn_process()
self.manage_processes()
else:
self.reap_and_manage_processes()
| [
11748,
4866,
198,
11748,
11454,
3919,
198,
11748,
28686,
198,
11748,
6737,
198,
11748,
640,
198,
198,
6738,
26692,
22602,
1330,
15486,
2937,
62,
57,
2662,
3483,
36,
11,
15486,
2937,
62,
7206,
2885,
11,
1400,
16678,
18709,
198,
6738,
197... | 1.902571 | 3,151 |
# Faa um programa em Python que abra e reproduza o udio de um arquivo MP3.
from pygame import mixer
mixer.init()
mixer.music.load('ex021.mp3')
mixer.music.play()
input('Agora vc escuta?')
| [
2,
376,
7252,
23781,
1430,
64,
795,
11361,
8358,
450,
430,
304,
8186,
4496,
267,
334,
67,
952,
390,
23781,
610,
421,
23593,
4904,
18,
13,
198,
198,
6738,
12972,
6057,
1330,
33938,
198,
19816,
263,
13,
15003,
3419,
198,
19816,
263,
1... | 2.567568 | 74 |
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response
from django.core.context_processors import csrf
from admin_forms import *
from django.template import loader,RequestContext
from django.contrib.admin.views.decorators import staff_member_required
from Human.models import *
from Drosophila.models import *
from Mouse.models import *
#######UCSC Tables########
###For UCSC gene, SNP and Alu#####
##########################
#from models import *
from os import system
##############################################
########Thoughts for implementation##########
#Current state of update########
pth = "/home/DATA/Anmol/DARNED/uploaded_data/"#"/home/common_share/DARNED/uploaded_data"
dbpth= "/home/DATA/Anmol/DARNED/"#"/home/common_share/DARNED"
# Try to add information about assembly. And make it auto updatable
######Human update start########
#######Human update End######
########Drosophila Update Start#######
######Drosophila update End#####
########Mouse Update Start#######
#####Mouse Update End ##################
# return render_to_response('/home/manu/Desktop/DARNED/templates/admin/uploadfile.html',{'form':form})
upload_file = staff_member_required(upload_file)# This is make function acceible only to administers
sync = staff_member_required(sync)
# Remove delete options from default admin page. It may create trouble, If you don't remove.
| [
6738,
42625,
14208,
13,
4023,
1330,
367,
29281,
31077,
7738,
1060,
11,
367,
29281,
31077,
198,
6738,
42625,
14208,
13,
19509,
23779,
1330,
8543,
62,
1462,
62,
26209,
198,
6738,
42625,
14208,
13,
7295,
13,
22866,
62,
14681,
669,
1330,
26... | 3.420048 | 419 |
import urllib, json
baseurl = 'https://query.yahooapis.com/v1/public/yql?'
yql_query = "select item.condition from weather.forecast where woeid=9807"
yql_url = baseurl + urllib.urlencode({'q':yql_query}) + "&format=json"
result = urllib.urlopen(yql_url).read()
data = json.loads(result)
print data['query']['results']
| [
11748,
2956,
297,
571,
11,
33918,
198,
198,
8692,
6371,
796,
705,
5450,
1378,
22766,
13,
40774,
499,
271,
13,
785,
14,
85,
16,
14,
11377,
14,
88,
13976,
8348,
198,
198,
88,
13976,
62,
22766,
796,
366,
19738,
2378,
13,
31448,
422,
... | 2.580645 | 124 |
"""This module provides mechanisms to use signal handlers in Python.
Functions:
alarm() -- cause SIGALRM after a specified time [Unix only]
setitimer() -- cause a signal (described below) after a specified
float time and the timer may restart then [Unix only]
getitimer() -- get current value of timer [Unix only]
signal() -- set the action for a given signal
getsignal() -- get the signal action for a given signal
pause() -- wait until a signal arrives [Unix only]
default_int_handler() -- default SIGINT handler
signal constants:
SIG_DFL -- used to refer to the system default handler
SIG_IGN -- used to ignore the signal
NSIG -- number of defined signals
SIGINT, SIGTERM, etc. -- signal numbers
itimer constants:
ITIMER_REAL -- decrements in real time, and delivers SIGALRM upon
expiration
ITIMER_VIRTUAL -- decrements only when the process is executing,
and delivers SIGVTALRM upon expiration
ITIMER_PROF -- decrements both when the process is executing and
when the system is executing on behalf of the process.
Coupled with ITIMER_VIRTUAL, this timer is usually
used to profile the time spent by the application
in user and kernel space. SIGPROF is delivered upon
expiration.
*** IMPORTANT NOTICE ***
A signal handler function is called with two arguments:
the first is the signal number, the second is the interrupted stack frame."""
CTRL_BREAK_EVENT=1
CTRL_C_EVENT=0
NSIG=23
SIGABRT=22
SIGBREAK=21
SIGFPE=8
SIGILL=4
SIGINT=2
SIGSEGV=11
SIGTERM=15
SIG_DFL=0
SIG_IGN=1
| [
37811,
1212,
8265,
3769,
11701,
284,
779,
6737,
32847,
287,
11361,
13,
201,
198,
201,
198,
24629,
2733,
25,
201,
198,
201,
198,
282,
1670,
3419,
1377,
2728,
33993,
1847,
29138,
706,
257,
7368,
640,
685,
47000,
691,
60,
201,
198,
2617,... | 2.765494 | 597 |
# flake8: noqa
"""Module implementing the clients for services."""
from npc_engine.service_clients.text_generation_client import TextGenerationClient
from npc_engine.service_clients.control_client import ControlClient
from npc_engine.service_clients.sequence_classifier_client import (
SequenceClassifierClient,
)
from npc_engine.service_clients.similarity_client import SimilarityClient
| [
2,
781,
539,
23,
25,
645,
20402,
201,
198,
37811,
26796,
15427,
262,
7534,
329,
2594,
526,
15931,
201,
198,
6738,
299,
14751,
62,
18392,
13,
15271,
62,
565,
2334,
13,
5239,
62,
20158,
62,
16366,
1330,
8255,
8645,
341,
11792,
201,
19... | 3.418803 | 117 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'A program does that is a DJ by using feedback provided by the dancers.',
'author': 'Thomas Schaper',
'url': 'https://gitlab.com/SilentDiscoAsAService/DJFeet',
'download_url': 'https://gitlab.com/SilentDiscoAsAService/DJFeet',
'author_email': 'thomas@libremail.nl',
'version': '0.0',
'install_requires': ['nose'],
'packages': ['dj_feet'],
'scripts': [],
'entry_points': {
'console_scripts': [
'server = dj_feet.cli:main'
]
},
'name': 'dj_feet'
}
setup(**config)
| [
28311,
25,
198,
220,
220,
220,
422,
900,
37623,
10141,
1330,
9058,
198,
16341,
17267,
12331,
25,
198,
220,
220,
220,
422,
1233,
26791,
13,
7295,
1330,
9058,
198,
198,
11250,
796,
1391,
198,
220,
220,
220,
705,
11213,
10354,
705,
32,
... | 2.386282 | 277 |
km = float(input('Digite qual a distncia da sua viagem em km: '))
if km <= 200:
preo = km * 0.50
print('O valor da sua viagem de {:.2f}R$'.format(preo))
else:
preo = km * 0.45
print('O valor da sua viagem de {:.2f}R$'.format(preo))
| [
13276,
796,
12178,
7,
15414,
10786,
19511,
578,
4140,
257,
1233,
10782,
544,
12379,
424,
64,
25357,
363,
368,
795,
10571,
25,
705,
4008,
201,
198,
201,
198,
361,
10571,
19841,
939,
25,
201,
198,
220,
220,
220,
662,
78,
796,
10571,
1... | 2.03937 | 127 |
import json
import kubernetes.config
import pytest_bdd
import pytest_bdd.parsers
import utils.helper
pytest_bdd.scenarios('features/metrics_server.feature')
| [
11748,
33918,
198,
198,
11748,
479,
18478,
3262,
274,
13,
11250,
198,
198,
11748,
12972,
9288,
62,
65,
1860,
198,
11748,
12972,
9288,
62,
65,
1860,
13,
79,
945,
364,
198,
198,
11748,
3384,
4487,
13,
2978,
525,
198,
198,
9078,
9288,
... | 2.688525 | 61 |
default = False
actions = 'store_true'
ENC = 'utf-8' | [
12286,
796,
10352,
198,
4658,
796,
705,
8095,
62,
7942,
6,
198,
24181,
796,
705,
40477,
12,
23,
6
] | 2.736842 | 19 |
import sre_constants as sc
import sre_parse as sp
import typing
import unicodedata
from pprint import pprint
from RichConsole import groups, rsjoin
from .knowledge import CAPTURE_GROUP, LITERAL_STR
singleElPreLifter = SingleElPreLifter(REFirstPassVisitor)
re_IN_FlatPreLifter = SingleElPreLifter(RE_IN_FirstPassVisitor)
RecursivePass.DEPENDS = (RecursivePreLifter,) # The default value.
| [
11748,
264,
260,
62,
9979,
1187,
355,
629,
198,
11748,
264,
260,
62,
29572,
355,
599,
198,
11748,
19720,
198,
11748,
28000,
9043,
1045,
198,
6738,
279,
4798,
1330,
279,
4798,
198,
198,
6738,
3998,
47581,
1330,
2628,
11,
44608,
22179,
... | 2.985507 | 138 |
import torch
from torch import nn
| [
11748,
28034,
198,
6738,
28034,
1330,
299,
77,
628,
628
] | 3.7 | 10 |
from pastila.fields import Field
| [
6738,
1613,
10102,
13,
25747,
1330,
7663,
628
] | 4.25 | 8 |
import multiprocessing
import time
from typing import List
from constants import CPU_BIG_NUMBERS
from utils import show_execution_time
if __name__ == "__main__":
show_execution_time(func=lambda: find_sums(CPU_BIG_NUMBERS))
| [
11748,
18540,
305,
919,
278,
198,
11748,
640,
198,
198,
6738,
19720,
1330,
7343,
198,
198,
6738,
38491,
1330,
9135,
62,
3483,
38,
62,
41359,
33,
4877,
198,
6738,
3384,
4487,
1330,
905,
62,
18558,
1009,
62,
2435,
628,
628,
198,
361,
... | 2.876543 | 81 |
from abc import ABCMeta
from whatsapp_tracker.bases.selenium_bases.base_selenium_kit import BaseSeleniumKit
from whatsapp_tracker.mixins.seleniun_keyboard_press_mixin import SeleniumKeyBoardPressMixin
| [
6738,
450,
66,
1330,
9738,
48526,
198,
198,
6738,
45038,
1324,
62,
2213,
10735,
13,
65,
1386,
13,
741,
47477,
62,
65,
1386,
13,
8692,
62,
741,
47477,
62,
15813,
1330,
7308,
48767,
47477,
20827,
198,
6738,
45038,
1324,
62,
2213,
10735,... | 3.075758 | 66 |
import numpy as np
from layers import FullyConnectedLayer, ReLULayer, softmax_with_cross_entropy, l2_regularization
| [
11748,
299,
32152,
355,
45941,
198,
198,
6738,
11685,
1330,
40234,
13313,
276,
49925,
11,
797,
43,
6239,
2794,
11,
2705,
9806,
62,
4480,
62,
19692,
62,
298,
28338,
11,
300,
17,
62,
16338,
1634,
628
] | 3.277778 | 36 |
import numpy as np
### ----- config
# parameters
gamma = 3
omega = 1
precision = 10**-6
# matrix
matrix = np.zeros((20, 20), dtype = np.float64)
np.fill_diagonal(matrix, gamma)
np.fill_diagonal(matrix[:, 1:], -1) # upper part
np.fill_diagonal(matrix[1:, :], -1) # lower part
# vector b
bVector = np.full((20, 1), gamma - 2, dtype = np.float64)
bVector[0] = bVector[0] + 1
bVector[-1] = bVector[-1] + 1
# initial vector
initialVector = np.zeros(bVector.shape, dtype = np.float64)
### ----- solver
# use one of these:
#solver = JacobiSolver(matrix, bVector, initialVector, precision, gamma)
solver = GaussSeidelSolver(matrix, bVector, initialVector, precision, gamma, omega)
solver.solve()
| [
11748,
299,
32152,
355,
45941,
628,
198,
198,
21017,
37404,
4566,
198,
198,
2,
10007,
198,
28483,
2611,
796,
513,
198,
462,
4908,
796,
352,
198,
3866,
16005,
796,
838,
1174,
12,
21,
198,
198,
2,
17593,
198,
6759,
8609,
796,
45941,
1... | 2.575646 | 271 |
# Copyright (C) 2013-2014 DNAnexus, Inc.
#
# This file is part of dx-toolkit (DNAnexus platform client libraries).
#
# 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.
"""
Utilities shared by dxpy modules.
"""
from __future__ import (print_function, unicode_literals)
import os, json, collections, concurrent.futures, traceback, sys, time, gc
import dateutil.parser
from .thread_pool import PrioritizingThreadPool
from .. import logger
from ..compat import basestring
def wait_for_a_future(futures, print_traceback=False):
"""
Return the next future that completes. If a KeyboardInterrupt is
received, then the entire process is exited immediately. See
wait_for_all_futures for more notes.
"""
while True:
try:
future = next(concurrent.futures.as_completed(futures, timeout=10000000000))
break
except concurrent.futures.TimeoutError:
pass
except KeyboardInterrupt:
if print_traceback:
traceback.print_stack()
else:
print('')
os._exit(os.EX_IOERR)
return future
def wait_for_all_futures(futures, print_traceback=False):
"""
Wait indefinitely for all futures in the input iterable to complete.
Use a timeout to enable interrupt handling.
Call os._exit() in case of KeyboardInterrupt. Otherwise, the atexit registered handler in concurrent.futures.thread
will run, and issue blocking join() on all worker threads, requiring us to listen to events in worker threads
in order to enable timely exit in response to Ctrl-C.
Note: This still doesn't handle situations where Ctrl-C is pressed elsewhere in the code and there are worker
threads with long-running tasks.
Note: os._exit() doesn't work well with interactive mode (e.g. ipython). This may help:
import __main__ as main; if hasattr(main, '__file__'): os._exit() else: os.exit()
"""
try:
while True:
waited_futures = concurrent.futures.wait(futures, timeout=60)
if len(waited_futures.not_done) == 0:
break
except KeyboardInterrupt:
if print_traceback:
traceback.print_stack()
else:
print('')
os._exit(os.EX_IOERR)
def normalize_time_input(t, future=False):
"""
Converts inputs such as:
"2012-05-01"
"-5d"
1352863174
to milliseconds since epoch. See http://labix.org/python-dateutil and :meth:`normalize_timedelta`.
"""
error_msg = 'Error: Could not parse {t} as a timestamp or timedelta. Expected a date format or an integer with a single-letter suffix: s=seconds, m=minutes, h=hours, d=days, w=weeks, M=months, y=years, e.g. "-10d" indicates 10 days ago'
if isinstance(t, basestring):
try:
t = normalize_timedelta(t)
except ValueError:
try:
t = int(time.mktime(dateutil.parser.parse(t).timetuple())*1000)
except ValueError:
raise ValueError(error_msg.format(t=t))
now = int(time.time()*1000)
if t < 0 or (future and t < now):
t += now
return t
def normalize_timedelta(timedelta):
"""
Given a string like "1w" or "-5d", convert it to an integer in milliseconds.
Integers without a suffix are interpreted as seconds.
Note: not related to the datetime timedelta class.
"""
try:
return int(timedelta) * 1000
except ValueError as e:
t, suffix = timedelta[:-1], timedelta[-1:]
suffix_multipliers = {'s': 1000, 'm': 1000*60, 'h': 1000*60*60, 'd': 1000*60*60*24, 'w': 1000*60*60*24*7,
'M': 1000*60*60*24*30, 'y': 1000*60*60*24*365}
if suffix not in suffix_multipliers:
raise ValueError()
return int(t) * suffix_multipliers[suffix]
# See http://stackoverflow.com/questions/4126348
def merge(d, u):
"""
Recursively updates a dictionary.
Example: merge({"a": {"b": 1, "c": 2}}, {"a": {"b": 3}}) = {"a": {"b": 3, "c": 2}}
"""
for k, v in u.items():
if isinstance(v, collections.Mapping):
r = merge(d.get(k, {}), v)
d[k] = r
else:
d[k] = u[k]
return d
def _dict_raise_on_duplicates(ordered_pairs):
"""
Reject duplicate keys.
"""
d = {}
for k, v in ordered_pairs:
if k in d:
raise ValueError("duplicate key: %r" % (k,))
else:
d[k] = v
return d
def json_load_raise_on_duplicates(*args, **kwargs):
"""
Like json.load(), but raises an error on duplicate keys.
"""
kwargs['object_pairs_hook'] = _dict_raise_on_duplicates
return json.load(*args, **kwargs)
def json_loads_raise_on_duplicates(*args, **kwargs):
"""
Like json.loads(), but raises an error on duplicate keys.
"""
kwargs['object_pairs_hook'] = _dict_raise_on_duplicates
return json.loads(*args, **kwargs)
# Moved to the bottom due to circular imports
from .exec_utils import run, convert_handlers_to_dxlinks, parse_args_as_job_input, entry_point, DXJSONEncoder
| [
2,
15069,
357,
34,
8,
2211,
12,
4967,
7446,
44520,
11,
3457,
13,
198,
2,
198,
2,
770,
2393,
318,
636,
286,
44332,
12,
25981,
15813,
357,
28886,
44520,
3859,
5456,
12782,
737,
198,
2,
198,
2,
220,
220,
49962,
739,
262,
24843,
13789... | 2.476232 | 2,272 |
"""Routines to make objects serialisable.
Each of the functions in this module makes a specific type of object
serialisable. In most cases, this module needs to be imported and the function
run in both the serialising and the unserialising environments.
Here's a summary (see function documentation for details):
mk_ellipsis: Ellipsis.
mk_slots: classes with __slots__ but not __dict__.
mk_netcdf: netCDF4.
mk_cf: cf.
"""
import copy_reg
_done = []
# ellipsis
def mk_ellipsis ():
"""Make the Ellipsis builtin serialisable."""
if 'ellipsis' in _done:
return
copy_reg.pickle(type(Ellipsis), lambda e: 'Ellipsis')
# slots
def mk_slots (*objs):
"""Make the classes that have __slots__ but not __dict__ serialisable.
Takes a number of types (new-style classes) to make serialisable.
"""
for cls in objs:
copy_reg.pickle(cls, _reduce_slots)
# netcdf
def mk_netcdf ():
"""Make objects in the netCDF4 module serialisable.
Depends on ncserialisable; see that module's documentation for details. This
replaces the netCDF4 module with ncserialisable directly through sys.modules;
to access netCDF4 directly, use ncserialisable.netCDF4.
Call this before importing any module that uses netCDF4.
"""
if 'netcdf' in _done:
return
import sys
from nc_ipython import ncserialisable
sys.modules['netCDF4'] = ncserialisable
# cf
def mk_cf ():
"""Make objects in the cf module serialisable.
Calls mk_netcdf, and so depends on ncserialisable.
Call this before importing cf.
"""
if 'cf' in _done:
return
mk_netcdf()
global cf
import cf
mk_slots(
cf.data.ElementProperties,
cf.Data,
cf.data.SliceData,
#cf.Units,
cf.pp.Variable,
cf.pp.VariableCalc,
cf.pp.VariableCalcBounds,
cf.pp.VariableBounds,
#cf.org_field.SliceVariable,
#cf.org_field.SliceCoordinate,
#cf.org_field.SliceField,
#cf.org_field.SliceVariableList,
#cf.org_field.SliceFieldList,
#cf.org_field.Flags,
cf.field.SliceField,
cf.field.SliceFieldList,
cf.Flags,
cf.coordinate.SliceCoordinate,
cf.variable.SliceVariable,
cf.variable.SliceVariableList
)
copy_reg.pickle(cf.Units, _reduce_cf_units) | [
37811,
49,
448,
1127,
284,
787,
5563,
11389,
43942,
13,
198,
198,
10871,
286,
262,
5499,
287,
428,
8265,
1838,
257,
2176,
2099,
286,
2134,
198,
46911,
43942,
13,
220,
554,
749,
2663,
11,
428,
8265,
2476,
284,
307,
17392,
290,
262,
2... | 2.446898 | 951 |
from floxcore.config import Configuration, ParamDefinition
| [
6738,
781,
1140,
7295,
13,
11250,
1330,
28373,
11,
25139,
36621,
628
] | 5 | 12 |
from flask import Flask
from flask_restful import Api, Resource, reqparse
from kuet_teacher_data import get_data
app = Flask(__name__)
api = Api(app)
data = get_data()
api.add_resource(Teacher_data,"/data","/data/","/data/<string:id>")
api.add_resource(search_dept_teacher,"/find/<string:dept>/<string:id>")
api.add_resource(search_teacher,"/find/<string:id>")
if __name__ == "__main__":
app.run()
| [
6738,
42903,
1330,
46947,
198,
6738,
42903,
62,
2118,
913,
1330,
5949,
72,
11,
20857,
11,
43089,
29572,
198,
198,
6738,
479,
84,
316,
62,
660,
3493,
62,
7890,
1330,
651,
62,
7890,
198,
198,
1324,
796,
46947,
7,
834,
3672,
834,
8,
... | 2.55 | 160 |
import os
import sys
sys.path.append(os.path.dirname(__file__) + "/../")
from scipy.misc import imread
from util.config import load_config
from nnet import predict
from util import visualize
from dataset.pose_dataset import data_to_input
cfg = load_config("demo/pose_cfg.yaml")
# Load and setup CNN part detector
sess, inputs, outputs = predict.setup_pose_prediction(cfg)
# Read image from file
file_name = "demo/image.png"
image = imread(file_name, mode='RGB')
image_batch = data_to_input(image)
# Compute prediction with the CNN
outputs_np = sess.run(outputs, feed_dict={inputs: image_batch})
scmap, locref, _ = predict.extract_cnn_output(outputs_np, cfg)
# Extract maximum scoring location from the heatmap, assume 1 person
pose = predict.argmax_pose_predict(scmap, locref, cfg.stride)
# Visualise
visualize.show_heatmaps(cfg, image, scmap, pose)
visualize.waitforbuttonpress()
| [
11748,
28686,
198,
11748,
25064,
198,
198,
17597,
13,
6978,
13,
33295,
7,
418,
13,
6978,
13,
15908,
3672,
7,
834,
7753,
834,
8,
1343,
12813,
40720,
4943,
198,
198,
6738,
629,
541,
88,
13,
44374,
1330,
545,
961,
198,
198,
6738,
7736,... | 2.943894 | 303 |
import datetime
import logging
import os
import warnings
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from logutils import BraceMessage as __
from tqdm import tqdm
import simulators
from mingle.models.broadcasted_models import inherent_alpha_model
from mingle.utilities.chisqr import chi_squared
from mingle.utilities.norm import chi2_model_norms, continuum, arbitrary_rescale, arbitrary_minimums
from mingle.utilities.phoenix_utils import load_starfish_spectrum
from mingle.utilities.simulation_utilities import check_inputs, spec_max_delta
from simulators.common_setup import setup_dirs, sim_helper_function
from numpy import float64, ndarray
from spectrum_overload.spectrum import Spectrum
from typing import Dict, List, Optional, Tuple, Union
def iam_helper_function(star: str, obsnum: Union[int, str], chip: int, skip_params: bool = False) -> Tuple[
str, Dict[str, Union[str, float, List[Union[str, float]]]], str]:
"""Specifies parameter files and output directories given observation parameters."""
return sim_helper_function(star, obsnum, chip, skip_params=skip_params, mode="iam")
def iam_analysis(obs_spec, model1_pars, model2_pars, rvs=None, gammas=None,
verbose=False, norm=False, save_only=True, chip=None,
prefix=None, errors=None, area_scale=False, wav_scale=True, norm_method="scalar", fudge=None):
"""Run two component model over all model combinations."""
rvs = check_inputs(rvs)
gammas = check_inputs(gammas)
if isinstance(model1_pars, list):
logging.debug(__("Number of close model_pars returned {0}", len(model1_pars)))
if isinstance(model2_pars, list):
logging.debug(__("Number of close model_pars returned {0}", len(model2_pars)))
# Solution Grids to return
iam_grid_chisqr_vals = np.empty((len(model1_pars), len(model2_pars)))
args = [model2_pars, rvs, gammas, obs_spec]
kwargs = {"norm": norm, "save_only": save_only, "chip": chip,
"prefix": prefix, "verbose": verbose, "errors": errors,
"area_scale": area_scale, "wav_scale": wav_scale,
"norm_method": norm_method, "fudge": fudge,
}
for ii, params1 in enumerate(tqdm(model1_pars)):
iam_grid_chisqr_vals[ii] = iam_wrapper(ii, params1, *args, **kwargs)
if save_only:
return None
else:
return iam_grid_chisqr_vals # Just output the best value for each model pair
def continuum_alpha(model1: Spectrum, model2: Spectrum, chip: Optional[int] = None) -> float64:
"""Inherent flux ratio between the continuum of the two models.
Assumes already scaled by area.
Takes mean alpha of chip or full
"""
assert not np.any(np.isnan(model1.xaxis))
assert not np.any(np.isnan(model1.flux))
assert not np.any(np.isnan(model2.xaxis))
assert not np.any(np.isnan(model2.flux))
# Fit models with continuum
cont1 = continuum(model1.xaxis, model1.flux, method="exponential")
cont2 = continuum(model2.xaxis, model2.flux, method="exponential")
# Masking for individual chips
if chip is None:
chip = -1 # Full Crires range
all_limits = {-1: [2111, 2169], 1: [2111, 2124], 2: [2125, 2139], 3: [2140, 2152], 4: [2153, 2169]}
chip_limits = all_limits[chip]
mask1 = (model1.xaxis > chip_limits[0]) * (model1.xaxis < chip_limits[1])
mask2 = (model2.xaxis > chip_limits[0]) * (model2.xaxis < chip_limits[1])
continuum_ratio = cont2[mask2] / cont1[mask1]
alpha_ratio = np.nanmean(continuum_ratio)
return alpha_ratio
def iam_wrapper(num, params1, model2_pars, rvs, gammas, obs_spec, norm=False,
verbose=False, save_only=True, chip=None, prefix=None, errors=None,
area_scale=True, wav_scale=True, grid_slices=False, norm_method="scalar",
fudge=None):
"""Wrapper for iteration loop of iam. params1 fixed, model2_pars are many.
fudge is multiplicative on companion spectrum.
"""
if prefix is None:
sf = os.path.join(
simulators.paths["output_dir"], obs_spec.header["OBJECT"].upper(),
"iam_{0}_{1}-{2}_part{6}_host_pars_[{3}_{4}_{5}].csv".format(
obs_spec.header["OBJECT"].upper(), int(obs_spec.header["MJD-OBS"]), chip,
params1[0], params1[1], params1[2], num))
prefix = os.path.join(
simulators.paths["output_dir"], obs_spec.header["OBJECT"].upper()) # for fudge
else:
sf = "{0}_part{4}_host_pars_[{1}_{2}_{3}].csv".format(
prefix, params1[0], params1[1], params1[2], num)
save_filename = sf
if os.path.exists(save_filename) and save_only:
print("'{0}' exists, so not repeating calculation.".format(save_filename))
return None
else:
if not save_only:
iam_grid_chisqr_vals = np.empty(len(model2_pars))
for jj, params2 in enumerate(model2_pars):
if verbose:
print(("Starting iteration with parameters: "
"{0}={1},{2}={3}").format(num, params1, jj, params2))
# Main Part
rv_limits = observation_rv_limits(obs_spec, rvs, gammas)
obs_spec = obs_spec.remove_nans()
assert ~np.any(np.isnan(obs_spec.flux)), "Observation has nan"
# Load phoenix models and scale by area and wavelength limit
mod1_spec, mod2_spec = \
prepare_iam_model_spectra(params1, params2, limits=rv_limits,
area_scale=area_scale, wav_scale=wav_scale)
# Estimated flux ratio from models
inherent_alpha = continuum_alpha(mod1_spec, mod2_spec, chip)
# Combine model spectra with iam model
mod1_spec.plot(label=params1)
mod2_spec.plot(label=params2)
plt.close()
if fudge or (fudge is not None):
fudge_factor = float(fudge)
mod2_spec.flux *= fudge_factor # fudge factor multiplication
mod2_spec.plot(label="fudged {0}".format(params2))
plt.title("fudges models")
plt.legend()
fudge_prefix = os.path.basename(os.path.normpath(prefix))
fname = os.path.join(simulators.paths["output_dir"],
obs_spec.header["OBJECT"].upper(), "iam", "fudgeplots",
"{1}_fudged_model_spectra_factor={0}_num={2}_iter_{3}.png".format(fudge_factor,
fudge_prefix,
num, jj))
plt.savefig(fname)
plt.close()
warnings.warn("Using a fudge factor = {0}".format(fudge_factor))
iam_grid_func = inherent_alpha_model(mod1_spec.xaxis, mod1_spec.flux, mod2_spec.flux,
rvs=rvs, gammas=gammas)
iam_grid_models = iam_grid_func(obs_spec.xaxis)
# Continuum normalize all iam_gird_models
def axis_continuum(flux):
"""Continuum to apply along axis with predefined variables parameters."""
return continuum(obs_spec.xaxis, flux, splits=20, method="exponential", top=20)
iam_grid_continuum = np.apply_along_axis(axis_continuum, 0, iam_grid_models)
iam_grid_models = iam_grid_models / iam_grid_continuum
# RE-NORMALIZATION
if chip == 4:
# Quadratically renormalize anyway
obs_spec = renormalization(obs_spec, iam_grid_models, normalize=True, method="quadratic")
obs_flux = renormalization(obs_spec, iam_grid_models, normalize=norm, method=norm_method)
if grid_slices:
# Long execution plotting.
plot_iam_grid_slices(obs_spec.xaxis, rvs, gammas, iam_grid_models,
star=obs_spec.header["OBJECT"].upper(),
xlabel="wavelength", ylabel="rv", zlabel="gamma",
suffix="iam_grid_models", chip=chip)
old_shape = iam_grid_models.shape
# Arbitrary_normalization of observation
iam_grid_models, arb_norm = arbitrary_rescale(iam_grid_models,
*simulators.sim_grid["arb_norm"])
# print("Arbitrary Normalized iam_grid_model shape.", iam_grid_models.shape)
assert iam_grid_models.shape == (*old_shape, len(arb_norm))
# Calculate Chi-squared
obs_flux = np.expand_dims(obs_flux, -1) # expand on last axis to match rescale
iam_norm_grid_chisquare = chi_squared(obs_flux, iam_grid_models, error=errors)
# Take minimum chi-squared value along Arbitrary normalization axis
iam_grid_chisquare, arbitrary_norms = arbitrary_minimums(iam_norm_grid_chisquare, arb_norm)
npix = obs_flux.shape[0] # Number of pixels used
if grid_slices:
# Long execution plotting.
plot_iam_grid_slices(rvs, gammas, arb_norm, iam_norm_grid_chisquare,
star=obs_spec.header["OBJECT"].upper(),
xlabel="rv", ylabel="gamma", zlabel="Arbitrary Normalization",
suffix="iam_grid_chisquare", chip=chip)
if not save_only:
iam_grid_chisqr_vals[jj] = iam_grid_chisquare.ravel()[np.argmin(iam_grid_chisquare)]
save_full_iam_chisqr(save_filename, params1, params2,
inherent_alpha, rvs, gammas,
iam_grid_chisquare, arbitrary_norms, npix, verbose=verbose)
if save_only:
return None
else:
return iam_grid_chisqr_vals
def renormalization(spectrum: Union[ndarray, Spectrum], model_grid: ndarray, normalize: bool = False,
method: Optional[str] = "scalar") -> ndarray:
"""Re-normalize the flux of spectrum to the continuum of the model_grid.
Broadcast out spectrum to match the dimensions of model_grid.
Parameters
----------
spectrum: Spectrum
model_grid: np.ndarray
normalize: bool
method: str ("scalar", "linear")
Returns
-------
norm_flux: np.ndarray
"""
if normalize:
if method not in ["scalar", "linear"]:
raise ValueError("Renormalization method '{}' is not in ['scalar', 'linear']".format(method))
logging.info(__("{} Re-normalizing to observations!", method))
norm_flux = chi2_model_norms(spectrum.xaxis, spectrum.flux,
model_grid, method=method)
else:
warnings.warn("Not Scalar Re-normalizing to observations!")
norm_flux = spectrum.flux[:]
# Extend dimensions of norm_flux until they match the grid.
while norm_flux.ndim < model_grid.ndim:
norm_flux = norm_flux[:, np.newaxis]
assert np.allclose(norm_flux.ndim, model_grid.ndim)
return norm_flux
def observation_rv_limits(obs_spec: Spectrum, rvs: Union[int, List[int]], gammas: Union[int, List[int]]) -> List[
float64]:
"""Calculate wavelength limits needed to cover RV shifts used."""
delta = spec_max_delta(obs_spec, rvs, gammas)
obs_min, obs_max = min(obs_spec.xaxis), max(obs_spec.xaxis)
return [obs_min - 1.1 * delta, obs_max + 1.1 * delta]
def prepare_iam_model_spectra(params1: Union[List[float], List[Union[int, float]]],
params2: Union[List[float], List[Union[int, float]], Tuple[int, float, float]],
limits: Union[List[float64], Tuple[int, int], List[int]], area_scale: bool = True,
wav_scale: bool = True) -> Tuple[Spectrum, Spectrum]:
"""Load spectra with same settings."""
if not area_scale:
warnings.warn("Not using area_scale. This is incorrect for paper.")
if not wav_scale:
warnings.warn("Not using wav_scale. This is incorrect for paper.")
mod1_spec = load_starfish_spectrum(params1, limits=limits,
hdr=True, normalize=False, area_scale=area_scale,
flux_rescale=True, wav_scale=wav_scale)
mod2_spec = load_starfish_spectrum(params2, limits=limits,
hdr=True, normalize=False, area_scale=area_scale,
flux_rescale=True, wav_scale=wav_scale)
assert len(mod1_spec.xaxis) > 0 and len(mod2_spec.xaxis) > 0
assert np.allclose(mod1_spec.xaxis, mod2_spec.xaxis)
# Check correct models are loaded
assert mod1_spec.header["PHXTEFF"] == params1[0]
assert mod1_spec.header["PHXLOGG"] == params1[1]
assert mod1_spec.header["PHXM_H"] == params1[2]
assert mod2_spec.header["PHXTEFF"] == params2[0]
assert mod2_spec.header["PHXLOGG"] == params2[1]
assert mod2_spec.header["PHXM_H"] == params2[2]
return mod1_spec, mod2_spec
def save_full_iam_chisqr(filename: str, params1: List[Union[int, float]], params2: List[Union[int, float]],
alpha: Union[int, float64], rvs: Union[ndarray, List[int]], gammas: Union[ndarray, List[int]],
iam_grid_chisquare: ndarray, arbitrary_norms: ndarray, npix: int,
verbose: bool = False) -> None:
"""Save the iterations chisqr values to a cvs."""
rv_grid, g_grid = np.meshgrid(rvs, gammas, indexing='ij')
# assert A.shape == rv_grid.shape
assert rv_grid.shape == g_grid.shape
assert g_grid.shape == iam_grid_chisquare.shape
data = {"rv": rv_grid.ravel(), "gamma": g_grid.ravel(),
"chi2": iam_grid_chisquare.ravel(), "arbnorm": arbitrary_norms.ravel()}
columns = ["rv", "gamma", "chi2", "arbnorm"]
len_c = len(columns)
df = pd.DataFrame(data=data, columns=columns)
# Update all rows with same value.
for par, value in zip(["teff_2", "logg_2", "feh_2"], params2):
df[par] = value
columns = ["teff_2", "logg_2", "feh_2"] + columns
if "[{0}_{1}_{2}]".format(params1[0], params1[1], params1[2]) not in filename:
# Need to add the model values.
for par, value in zip(["teff_1", "logg_1", "feh_1"], params1):
df[par] = value
columns = ["teff_1", "logg_1", "feh_1"] + columns
df["alpha"] = alpha
df["npix"] = npix
columns = columns[:-len_c] + ["alpha", "npix"] + columns[-len_c:]
df = df.round(decimals={"logg_2": 1, "feh_2": 1, "alpha": 4,
"rv": 3, "gamma": 3, "chi2": 4})
exists = os.path.exists(filename)
if exists:
df[columns].to_csv(filename, sep=',', mode="a", index=False, header=False)
else:
# Add header at the top only
df[columns].to_csv(filename, sep=',', mode="a", index=False, header=True)
if verbose:
print("Saved chi-squared values to {0}".format(filename))
return None
def plot_iam_grid_slices(x, y, z, grid, xlabel=None, ylabel=None, zlabel=None, suffix=None, star=None,
chip=None):
"""Slice up 3d grid and plot slices.
This is very slow!"""
os.makedirs(os.path.join(simulators.paths["output_dir"], star.upper(), "grid_plots"), exist_ok=True)
x_grid, y_grid, z_grid = np.meshgrid(x, y, z, indexing="ij")
if xlabel is None:
xlabel = "x"
if ylabel is None:
ylabel = "y"
if zlabel is None:
zlabel = "z"
if len(z) > 1:
for ii, y_val in enumerate(y):
plt.subplot(111)
try:
xii = x_grid[:, ii, :]
zii = z_grid[:, ii, :]
grid_ii = grid[:, ii, :]
plt.contourf(xii, zii, grid_ii)
except IndexError:
print("grid.shape", grid.shape)
print("shape of x, y, z", x.shape, y.shape, z.shape)
print("shape of x_grid, y_grid, z_grid", x_grid.shape, y_grid.shape, z_grid.shape)
print("index value", ii, "y_val ", y_val)
raise
plt.xlabel(xlabel)
plt.ylabel(zlabel)
plt.title("Grid slice for {0}={1}".format(ylabel, y_val))
plot_name = os.path.join(simulators.paths["output_dir"], star, "iam", "grid_plots",
"y_grid_slice_{0}_chip-{1}_{2}_{3}_{4}_{5}_{6}_{7}.png".format(star, chip, xlabel,
ylabel, zlabel, ii,
suffix,
datetime.datetime.now()))
plt.savefig(plot_name)
plt.close(plt.gcf())
for jj, z_val in enumerate(z):
plt.subplot(111)
try:
xjj = x_grid[:, :, jj]
yjj = y_grid[:, :, jj]
grid_jj = grid[:, :, jj]
plt.contourf(xjj, yjj, grid_jj)
except IndexError:
print("shape of x, y, z", x.shape, y.shape, z.shape)
print("shape of x_grid, y_grid, z_grid", x_grid.shape, y_grid.shape, z_grid.shape)
print("index value", jj, "y_val ", z_val)
raise
plt.xlabel(xlabel)
plt.ylabel(ylabel)
plt.title("Grid slice for {0}={1}".format(zlabel, z_val))
plot_name = os.path.join(simulators.paths["output_dir"], star, "iam", "grid_plots",
"z__grid_slice_{0}_chip-{1}_{2}_{3}_{4}_{5}_{6}_{7}.png".format(star, chip, xlabel,
ylabel, zlabel, jj,
suffix,
datetime.datetime.now()))
plt.savefig(plot_name)
plt.close(plt.gcf())
def target_params(params: Dict[str, Union[str, float, int]], mode: Optional[str] = "iam") -> Union[
Tuple[List[Union[int, float]], List[Union[int, float]]], List[Union[int, float]], Tuple[List[float], List[float]]]:
"""Extract parameters from dict for each target.
Includes logic for handling missing companion logg/fe_h.
"""
host_params = [params["temp"], params["logg"], params["fe_h"]]
# Specify the companion logg and metallicity in the parameter files.
if params.get("comp_logg", None) is None:
logging.warning(__("Logg for companion 'comp_logg' is not set for {0}", params.get("name", params)))
print("mode in target params", mode)
if mode == "iam":
comp_logg = params.get("comp_logg", params["logg"]) # Set equal to host if not given
comp_fe_h = params.get("comp_fe_h", params["fe_h"]) # Set equal to host if not given
comp_temp = params.get("comp_temp", 999999) # Will go to largest grid
comp_params = [comp_temp, comp_logg, comp_fe_h]
return host_params, comp_params
elif mode == "bhm":
return host_params
else:
raise ValueError("Mode={} is invalid".format(mode))
| [
11748,
4818,
8079,
198,
11748,
18931,
198,
11748,
28686,
198,
11748,
14601,
198,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
19798,
292,
355,
279,
67,
198,
6738,
2604,
26... | 2.024036 | 9,652 |
import pandas as pd
from datetime import datetime, timedelta
from bs4 import BeautifulSoup as bs
from etl.logger import get_logger
from etl.main import ETL
logger = get_logger("transform")
def transform_data(service: str, data_file: str) -> pd.DataFrame:
"""
Simple function to guide the request to the right function
"""
if service == "youtube":
return transform_youtube_data(data_file)
else:
return transform_netflix_data(data_file)
def transform_youtube_data(filename: str) -> pd.DataFrame:
"""
Function to fetch youtube data from the history file
1. Create a new dataframe to put data in
2. parse the html file to find required data
3. Format the data as needed
4. Populate the dataframe
"""
logger.info("Transforming YouTube data now")
instance = ETL()
simulated = instance.get_sim_status()
simulate_offset = instance.get_simul_days()
data = pd.DataFrame(
columns=[
"Timestamp",
"Source",
"Type",
"Name",
"Season",
"Episode",
"Category",
"Link",
]
)
link = []
timestamp = []
# Open the watch history html file and parse through it for relevant data
with open(filename, encoding="utf8") as f:
soup = bs(f, "html.parser")
tags = soup.find_all(
"div",
{"class": "content-cell mdl-cell mdl-cell--6-col mdl-typography--body-1"},
)
for i, tag in enumerate(tags):
a_pointer = tag.find("a")
dt = a_pointer.next_sibling.next_sibling
date_time = datetime.strptime(str(dt)[:-4], "%b %d, %Y, %I:%M:%S %p")
# If data fetching is simulated
if (
simulated
and date_time + timedelta(days=simulate_offset) > datetime.now()
):
continue
timestamp.append(date_time)
link.append(a_pointer.text)
# Populate the dataframe with the data
data["Timestamp"] = timestamp
data["Source"] = "YouTube"
data["Type"] = "Video"
data["Link"] = link
# Log a warning if the DataFrame is being returned empty
if data.shape[0] < 1:
logger.warning(f"DataFrame does not contain any data")
# Return dataframe
return data
def transform_netflix_data(filename: str) -> pd.DataFrame:
"""
Function to fetch netflix data from the history file
1. Create a new dataframe to put data in
2. parse the csv file to find required data
3. Format the data as needed
4. Populate the dataframe
"""
logger.info("Transforming Netflix data now")
instance = ETL()
simulated = instance.get_sim_status()
simulate_offset = instance.get_simul_days()
data = pd.DataFrame(
columns=[
"Timestamp",
"Source",
"Type",
"Name",
"Season",
"Episode",
"Category",
"Link",
]
)
# Read csv data into a separate dataframe
try:
# Reading data from csv file
nf_data = pd.read_csv(filename)
except Exception as e:
logger.error(f"Unable to read csv file '{filename}' : ", e)
logger.warning(f"File does not contain valid data")
return data
# Import Timestamp column to our datadrame as datetime
# Set "Source" column to "Netflix"
# Import Name column to our dataframe
data["Timestamp"] = pd.to_datetime(nf_data["Date"], format="%m/%d/%y")
data["Source"] = "Netflix"
data["Name"] = nf_data["Title"]
# Keywords to identify if a title is a TV series
keywds = ["Season", "Series", "Limited", "Part", "Volume", "Chapter"]
# Set "Type" column to either "Movie" or "TV Series"
data.loc[data["Name"].str.contains("|".join(keywds)), "Type"] = "TV Series"
data.loc[data["Type"].isnull(), "Type"] = "Movie"
# Wherever Type is "TV Series" split the Title column
# in three: Name, Season and Episode
data.loc[data["Type"] == "TV Series", "Name"] = nf_data["Title"].str.rsplit(
":", n=2, expand=True
)[0]
data.loc[data["Type"] == "TV Series", "Season"] = nf_data["Title"].str.rsplit(
":", n=2, expand=True
)[1]
data.loc[data["Type"] == "TV Series", "Episode"] = nf_data["Title"].str.rsplit(
":", n=2, expand=True
)[2]
# Some cleaning needed in Episode column
data["Episode"] = data["Episode"].str.strip()
# If data fetching is simulated
if simulated:
data = data.loc[
pd.to_datetime(data["Timestamp"])
< datetime.now() - timedelta(days=simulate_offset)
]
# return DataFrame
return data
| [
11748,
19798,
292,
355,
279,
67,
201,
198,
6738,
4818,
8079,
1330,
4818,
8079,
11,
28805,
12514,
201,
198,
6738,
275,
82,
19,
1330,
23762,
50,
10486,
355,
275,
82,
201,
198,
6738,
2123,
75,
13,
6404,
1362,
1330,
651,
62,
6404,
1362,... | 2.223732 | 2,208 |
# Generated by Django 2.2.24 on 2021-07-19 11:52
import cloudinary.models
from django.db import migrations
| [
2,
2980,
515,
416,
37770,
362,
13,
17,
13,
1731,
319,
33448,
12,
2998,
12,
1129,
1367,
25,
4309,
198,
198,
11748,
6279,
3219,
13,
27530,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
628
] | 3.027778 | 36 |
from django.urls import path
from academic.views import SectionCreate, SectionUpdate, SectionDelete
from .views import (
StudentView,
AttendanceMark,
AttendanceSearch,
AttendanceView,
IndividualMarksView,
AdmissionCreate,
AdmissionView,
AdmissionDelete,
AdmissionUpdate,
AdmissionDetail,
StudentMarkSearch,
StudentMarkCreate,
MarkDistributionCreate,
MarkDistributionUpdate,
MarkDistributionDelete,
ExamsView,
ExamsDetail,
ExamsCreate,
ExamsUpdate,
ExamsDelete,
get_class_asignments,
SendEmail_SaveData,
SendEmailForExam,
get_fee,
get_subject_by_class,
get_already_marks,
getting_marks_from_calculated
)
app_name = 'student'
urlpatterns = [
path('', StudentView, name='student_view'),
path('admission/create/', AdmissionCreate.as_view(), name='admission_create'),
path('admission/view/', AdmissionView.as_view(), name='admission_view'),
path('admission/view/<int:pk>/detail', AdmissionDetail.as_view(), name='admission_detail'),
path('admission/view/<int:pk>/update', AdmissionUpdate.as_view(), name='admission_update'),
path('admission/view/<int:pk>/delete', AdmissionDelete.as_view(), name='admission_delete'),
path('createSection/', SectionCreate.as_view(), name='create_section'),
path('updateSection/<int:pk>', SectionUpdate.as_view(), name='update_section'),
path('deleteSection/<int:pk>/delete', SectionDelete.as_view(), name='delete_section'),
path('viewexams/view', ExamsView.as_view(), name='view_exams'),
path('createexams/', ExamsCreate.as_view(), name='create_exams'),
path('detailexams/<int:pk>/detail', ExamsDetail.as_view(), name='detail_exams'),
path('updateexams/<int:pk>/edit', ExamsUpdate.as_view(), name='update_exams'),
path('deleteexams/<int:pk>/delete', ExamsDelete.as_view(), name='delete_exams'),
path('SendEmail_SaveData/', SendEmail_SaveData, name='SendEmail_SaveData'),
path('sendemailforexam/', SendEmailForExam.as_view(), name='sendemailforexam'),
path('attendance/view', AttendanceView.as_view(), name='attendance_view'),
path('attendance/search', AttendanceSearch.as_view(), name='attendance_search'),
path('attendance/mark', AttendanceMark.as_view(), name='attendance_mark'),
path('student_mark/search', StudentMarkSearch.as_view(), name='student_mark'),
path('student_mark/add', StudentMarkCreate.as_view(), name='student_mark_add'),
path('mark_distribution/create', MarkDistributionCreate.as_view(), name='mark_distribution_create'),
path('mark_distribution/<int:pk>/update', MarkDistributionUpdate.as_view(), name='mark_distribution_update'),
path('mark_distribution/<int:pk>/delete', MarkDistributionDelete.as_view(), name='mark_distribution_delete'),
path('report/<int:student_name>/info', IndividualMarksView.as_view(), name='view_individual_marks'),
path('report/<int:student_name>/info?year&tab', IndividualMarksView.as_view(), name='view_individual_marks2'),
path('get_fee', get_fee, name="get_fee"),
path('get_subject_by_class/', get_subject_by_class , name="get_subject_by_class"),
path('get_already_marks/', get_already_marks , name="get_already_marks"),
path('get_class_asignments/<int:pk>/class/<int:class_name>/subject/<int:subject>', get_class_asignments , name="get_class_asignments"),
path('getting_marks_from_calculated/', getting_marks_from_calculated , name="getting_marks_from_calculated")
]
| [
201,
198,
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
201,
198,
6738,
8233,
13,
33571,
1330,
7275,
16447,
11,
7275,
10260,
11,
220,
7275,
38727,
201,
198,
6738,
764,
33571,
1330,
357,
201,
198,
220,
220,
220,
13613,
7680,
11,
201,
... | 2.67191 | 1,335 |
import os
import sys
# PATH vars
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
ROOT_DIR = lambda *x: os.path.join(BASE_DIR, *x)
APPS_DIR = os.path.join(ROOT_DIR(), "apps")
sys.path.insert(0, APPS_DIR)
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'CHANGE THIS!!!'
ALLOWED_HOSTS = []
INSTALLED_APPS = [
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.humanize", # Handy template tags
{%- if cookiecutter.use_cms == 'django-cms' %}
"djangocms_admin_style",
"cms",
"menus",
"treebeard",
"sekizai",
{%- elif cookiecutter.use_cms == 'wagtail' %}
'wagtail.contrib.forms',
'wagtail.contrib.redirects',
'wagtail.embeds',
'wagtail.sites',
'wagtail.users',
'wagtail.snippets',
'wagtail.documents',
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'modelcluster',
'taggit',
{%- endif %}
"django.contrib.admin",
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
{%- if cookiecutter.use_cms == 'django-cms' %}
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware',
'cms.middleware.utils.ApphookReloadMiddleware',
{%- elif cookiecutter.use_cms == 'wagtail' %}
'wagtail.core.middleware.SiteMiddleware',
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
{%- endif %}
]
ROOT_URLCONF = '{{cookiecutter.project_slug}}.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = '{{cookiecutter.project_slug}}.wsgi.application'
LANGUAGE_CODE = 'en'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
SITE_ID = 1
STATIC_ROOT = str(ROOT_DIR("staticfiles"))
STATIC_URL = "/static/"
STATICFILES_DIRS = [str(ROOT_DIR("static"))]
STATICFILES_FINDERS = [
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
]
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
'DIRS': [
ROOT_DIR('templates'),
],
'OPTIONS': {
# 'debug': DEBUG,
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.request',
{%- if cookiecutter.use_cms == 'django-cms' %}
'sekizai.context_processors.sekizai',
'cms.context_processors.cms_settings',
{%- elif cookiecutter.use_cms == 'wagtail' %}
{%- endif %}
],
},
}
]
PASSWORD_HASHERS = [
"django.contrib.auth.hashers.Argon2PasswordHasher",
"django.contrib.auth.hashers.PBKDF2PasswordHasher",
"django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher",
"django.contrib.auth.hashers.BCryptSHA256PasswordHasher",
]
AUTH_PASSWORD_VALIDATORS = [
{'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'},
{'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'},
{'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator'},
{'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator'},
]
{%- if cookiecutter.use_cms == 'django-cms' %}
LANGUAGES = [
('en', 'English'),
('dk', 'Danish'),
]
CMS_TEMPLATES = [
('home.html', 'Home page template'),
]
{%- endif %}
LOGGING = {
"version": 1,
"disable_existing_loggers": True,
"formatters": {
"verbose": {
"format": "%(levelname)s %(asctime)s %(module)s "
"%(process)d %(thread)d %(message)s"
}
},
"handlers": {
"console": {
"level": "DEBUG",
"class": "logging.StreamHandler",
"formatter": "verbose",
}
},
"root": {"level": "INFO", "handlers": ["console"]},
"loggers": {
"django.db.backends": {
"level": "ERROR",
"handlers": ["console"],
"propagate": False,
},
# Errors logged by the SDK itself
"sentry_sdk": {"level": "ERROR", "handlers": ["console"], "propagate": False},
"django.security.DisallowedHost": {
"level": "ERROR",
"handlers": ["console"],
"propagate": False,
},
},
}
{%- if cookiecutter.use_cms == 'wagtail' %}
WAGTAIL_SITE_NAME = '{{ cookiecutter.project_name }}'
{%- endif %}
# .local.py overrides all the common settings.
try:
from .local import * # noqa
except ImportError:
pass
| [
11748,
28686,
198,
11748,
25064,
198,
198,
2,
46490,
410,
945,
198,
198,
33,
11159,
62,
34720,
796,
28686,
13,
6978,
13,
15908,
3672,
7,
418,
13,
6978,
13,
15908,
3672,
7,
418,
13,
6978,
13,
15908,
3672,
7,
418,
13,
6978,
13,
397,... | 2.220547 | 2,521 |
import happybase
from settings.default import DefaultConfig
import redis
pool = happybase.ConnectionPool(size=10, host='hadoop-master', port=9090)
#
redis_client = redis.StrictRedis(host=DefaultConfig.REDIS_HOST,
port=DefaultConfig.REDIS_PORT,
db=10,
decode_responses=True)
# Redis
cache_client = redis.StrictRedis(host=DefaultConfig.REDIS_HOST,
port=DefaultConfig.REDIS_PORT,
db=8,
decode_responses=True)
from pyspark import SparkConf
from pyspark.sql import SparkSession
# spark
conf = SparkConf()
conf.setAll(DefaultConfig.SPARK_GRPC_CONFIG)
SORT_SPARK = SparkSession.builder.config(conf=conf).getOrCreate() | [
11748,
3772,
8692,
198,
6738,
6460,
13,
12286,
1330,
15161,
16934,
198,
11748,
2266,
271,
198,
198,
7742,
796,
3772,
8692,
13,
32048,
27201,
7,
7857,
28,
940,
11,
2583,
11639,
71,
4533,
404,
12,
9866,
3256,
2493,
28,
24,
42534,
8,
1... | 1.992647 | 408 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
2,
2896,
500,
994,
262,
4981,
329,
534,
15881,
276,
3709,
198,
2,
198,
2,
4091,
10314,
287,
25,
198,
2,
2638,
1378,
15390,
13,
1416,
2416,
88,
13,
2398,
14,
2... | 2.693548 | 62 |
sign_sock = None
vrfy_sock = None
MAX_PACKET_LEN = 8192
NOT_BINARY_STR_ERR = -1
MISSING_DELIMITER_ERR = -2
ORIGINAL_MSG_ERR = -3
# Packet Structure: < message >
# Message may be either a long integer, or a binary string
# Packet Structure: < message | ":" | signature >
# Message and signature may be either long integers, or binary strings
| [
12683,
62,
82,
735,
796,
6045,
198,
37020,
24928,
62,
82,
735,
796,
6045,
198,
198,
22921,
62,
47,
8120,
2767,
62,
43,
1677,
796,
807,
17477,
198,
11929,
62,
33,
1268,
13153,
62,
18601,
62,
1137,
49,
796,
532,
16,
198,
44,
16744,
... | 2.774194 | 124 |
from django.contrib.auth.models import User
from django.db import models
| [
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
11787,
198,
6738,
42625,
14208,
13,
9945,
1330,
4981,
628,
628,
628,
628
] | 3.333333 | 24 |
import socket
try:
from .idarest_mixins import IdaRestConfiguration
except:
from idarest_mixins import IdaRestConfiguration
# idarest_master_plugin_t.config['master_debug'] = False
# idarest_master_plugin_t.config['master_info'] = False
# idarest_master_plugin_t.config['api_prefix'] = '/ida/api/v1.0'
# idarest_master_plugin_t.config['master_host'] = "127.0.0.1"
# idarest_master_plugin_t.config['master_port'] = 28612 # hash('idarest75') & 0xffff
MENU_PATH = 'Edit/Other'
try:
import idc
import ida_idaapi
import ida_kernwin
import idaapi
import idautils
from PyQt5 import QtWidgets
except:
return main()
def PLUGIN_ENTRY():
globals()['instance'] = idarest_master_plugin_t()
return globals()['instance']
if __name__ == "__main__":
master = idarest_master()
| [
11748,
17802,
198,
28311,
25,
198,
220,
220,
220,
422,
764,
312,
12423,
62,
19816,
1040,
1330,
5121,
64,
19452,
38149,
198,
16341,
25,
198,
220,
220,
220,
422,
4686,
12423,
62,
19816,
1040,
1330,
5121,
64,
19452,
38149,
198,
198,
2,
... | 2.577287 | 317 |
import logging
import json
from datetime import datetime
from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters,
Job, CallbackQueryHandler)
from telegram import (ChatAction, ParseMode, InlineKeyboardButton, InlineKeyboardMarkup)
from peewee import fn
import pytz
from word import word_query
from model import User, UserVocabularyMapping, Vocabulary, init as model_init
logger = logging.getLogger(__name__)
if __name__ == '__main__':
logging.basicConfig(filename='spam.log',
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
import os
file_path = os.path.abspath(os.path.dirname(__file__))
if not os.path.exists(os.path.join(file_path, "audio")):
os.mkdir(os.path.join(file_path, "audio"))
if not os.path.isfile(os.path.join(file_path, 'bot.db')):
model_init()
import config
bot = WordBot(config.BOT_TOKEN, timezone=config.TIMEZONE, notify_time=config.NOTIFY_TIME)
bot.run()
| [
11748,
18931,
198,
11748,
33918,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
198,
6738,
573,
30536,
13,
2302,
1330,
357,
4933,
67,
729,
11,
9455,
25060,
11,
16000,
25060,
11,
7066,
1010,
11,
198,
220,
220,
220,
220,
220,
220,
220,
... | 2.47482 | 417 |
import setuptools
from setuptools import setup, find_namespace_packages
setuptools.setup(
name="small_nn-jcanode",
version="0.0.1",
author="Justin Canode",
author_email="jcanode@my.gcu.edu",
description="A small Neural Network Framework",
long_description_content_type="text/markdown",
url="https://github.com/jcanode/small_nn",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
)
| [
11748,
900,
37623,
10141,
198,
6738,
900,
37623,
10141,
1330,
9058,
11,
1064,
62,
14933,
10223,
62,
43789,
628,
198,
2617,
37623,
10141,
13,
40406,
7,
198,
220,
220,
220,
1438,
2625,
17470,
62,
20471,
12,
73,
5171,
1098,
1600,
198,
22... | 2.662222 | 225 |
import os
import sys
import utils
import extras.downloadStats as stats
import extras.downloadManuscript as dm
import extras.unpaywall as up
main()
| [
11748,
28686,
198,
11748,
25064,
198,
11748,
3384,
4487,
198,
11748,
33849,
13,
15002,
29668,
355,
9756,
198,
11748,
33849,
13,
15002,
5124,
15817,
355,
288,
76,
220,
198,
11748,
33849,
13,
403,
15577,
11930,
355,
510,
198,
198,
12417,
... | 3.547619 | 42 |
"""."""
from django.urls import path, reverse_lazy
from account.views import (AccountView,
InfoFormView,
EditAccountView,
AddAddressView,
AddressListView,
DeleteAddress)
from django.contrib.auth import views as auth_views
urlpatterns = [
path('', AccountView.as_view(), name='account'),
path('add-address/', AddAddressView.as_view(), name='add_add'),
path('address-list/', AddressListView.as_view(), name='add_list'),
path('delete-address/<int:pk>/', DeleteAddress.as_view(), name='del_add'),
path('edit/<int:pk>/', EditAccountView.as_view(), name='edit_acc'),
path('info-form/<int:pk>/', InfoFormView.as_view(), name='info_reg'),
path('change_password/', auth_views.PasswordChangeView.as_view(
template_name='password_reset/change_password.html',
success_url=reverse_lazy('change_password_done')),
name='change_password'),
path('change_password_done/', auth_views.PasswordChangeDoneView.as_view(
template_name='password_reset/change_password_done.html',
),
name='change_password_done')
]
| [
37811,
526,
15931,
198,
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
11,
9575,
62,
75,
12582,
198,
6738,
1848,
13,
33571,
1330,
357,
30116,
7680,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
... | 2.282486 | 531 |
#!/usr/bin/env python
import os
import sys
sys.path.insert(0, '/home/nullism/web/dnd.nullism.com/')
from main import app
conf = {}
conf['SECRET_KEY'] = 'CHANGEME'
app.config.update(conf)
application = app
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
11748,
28686,
198,
11748,
25064,
198,
17597,
13,
6978,
13,
28463,
7,
15,
11,
31051,
11195,
14,
8423,
1042,
14,
12384,
14,
67,
358,
13,
8423,
1042,
13,
785,
14,
11537,
198,
6738,
1388... | 2.580247 | 81 |
#!/usr/bin/env python
import logging
from binance.spot import Spot as Client
from binance.lib.utils import config_logging
config_logging(logging, logging.DEBUG)
key = ""
secret = ""
spot_client = Client(key, secret)
logging.info(
spot_client.sub_account_futures_asset_transfer_history(
email="",
futuresType=1, # 1:USDT-maringed Futues2: Coin-margined Futures
)
)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
11748,
18931,
198,
6738,
9874,
590,
13,
20485,
1330,
15899,
355,
20985,
198,
6738,
9874,
590,
13,
8019,
13,
26791,
1330,
4566,
62,
6404,
2667,
198,
198,
11250,
62,
6404,
2667,
7,
... | 2.602649 | 151 |
# -*- coding:utf-8 -*-
import json
if __name__ == '__main__':
pass | [
2,
532,
9,
12,
19617,
25,
40477,
12,
23,
532,
9,
12,
198,
198,
11748,
33918,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1208
] | 2.181818 | 33 |
import pytest
from jubox import JupyterNotebook, RawCell, CodeCell, MarkdownCell
| [
198,
11748,
12972,
9288,
198,
198,
6738,
474,
549,
1140,
1330,
449,
929,
88,
353,
6425,
2070,
11,
16089,
28780,
11,
6127,
28780,
11,
2940,
2902,
28780,
198
] | 2.964286 | 28 |
# coding: utf-8
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#--------------------------------------------------------------------------
import unittest
import azure.graphrbac
from testutils.common_recordingtestcase import record
from tests.mgmt_testcase import HttpStatusCode, AzureMgmtTestCase
#------------------------------------------------------------------------------
if __name__ == '__main__':
unittest.main()
| [
2,
19617,
25,
3384,
69,
12,
23,
198,
198,
2,
10097,
45537,
198,
2,
15069,
357,
66,
8,
5413,
13,
220,
1439,
2489,
10395,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198... | 4.330579 | 242 |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import unittest
from time import sleep
path="C:\chromedriver.exe"
url="http://www.hudl.com/login"
#username:nathanyang18@outlook.com
#password:test1234
if __name__ =="__main":
unittest.main()
| [
6738,
384,
11925,
1505,
1330,
3992,
26230,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11321,
13,
13083,
1330,
26363,
198,
11748,
555,
715,
395,
198,
6738,
640,
1330,
3993,
198,
6978,
2625,
34,
7479,
28663,
276,
38291,
13,
13499,... | 2.76 | 100 |
from django.contrib.auth.models import User
from rest_framework import serializers
# MODEL IMPORTS
from project.notes.models import Note, NoteItem
| [
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
11787,
198,
6738,
1334,
62,
30604,
1330,
11389,
11341,
198,
198,
2,
19164,
3698,
30023,
33002,
198,
6738,
1628,
13,
17815,
13,
27530,
1330,
5740,
11,
5740,
7449,
628,
628
] | 3.682927 | 41 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab
import sys
import json
import os
import urllib.parse
import traceback
import datetime
import boto3
DRY_RUN = (os.getenv('DRY_RUN', 'false') == 'true')
AWS_REGION = os.getenv('REGION_NAME', 'us-east-1')
KINESIS_STREAM_NAME = os.getenv('KINESIS_STREAM_NAME', 'octember-bizcard-img')
DDB_TABLE_NAME = os.getenv('DDB_TABLE_NAME', 'OctemberBizcardImg')
if __name__ == '__main__':
s3_event = '''{
"Records": [
{
"eventVersion": "2.0",
"eventSource": "aws:s3",
"awsRegion": "us-east-1",
"eventTime": "1970-01-01T00:00:00.000Z",
"eventName": "ObjectCreated:Put",
"userIdentity": {
"principalId": "EXAMPLE"
},
"requestParameters": {
"sourceIPAddress": "127.0.0.1"
},
"responseElements": {
"x-amz-request-id": "EXAMPLE123456789",
"x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH"
},
"s3": {
"s3SchemaVersion": "1.0",
"configurationId": "testConfigRule",
"bucket": {
"name": "octember-use1",
"ownerIdentity": {
"principalId": "EXAMPLE"
},
"arn": "arn:aws:s3:::octember-use1"
},
"object": {
"key": "bizcard-raw-img/edy_bizcard.jpg",
"size": 638,
"eTag": "0123456789abcdef0123456789abcdef",
"sequencer": "0A1B2C3D4E5F678901"
}
}
}
]
}'''
event = json.loads(s3_event)
lambda_handler(event, {})
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
532,
9,
12,
21004,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
43907,
25,
7400,
11338,
28,
17,
6482,
10394,
28,
17,
2705,
8658,
11338,
28,
17,
4292,
8658,
198,
198,
11748,
... | 1.930909 | 825 |
from pathlib import Path
from src.main import retrieve_soil_composition
# This example is base on geodatabase obtain from ssurgo on Ohio area
ssurgo_folder_path = Path().absolute().parent / 'resources' / 'SSURGO' / 'soils_GSSURGO_oh_3905571_01' \
/ 'soils' / 'gssurgo_g_oh' / 'gSSURGO_OH.gdb'
coordinates = [(40.574234, -83.292448), (40.519224, -82.799437), (40.521048, -82.790174)]
soil_data_list = retrieve_soil_composition(coordinates, ssurgo_folder_path)
| [
6738,
3108,
8019,
1330,
10644,
198,
198,
6738,
12351,
13,
12417,
1330,
19818,
62,
568,
346,
62,
785,
9150,
198,
198,
2,
770,
1672,
318,
2779,
319,
4903,
375,
265,
5754,
7330,
422,
264,
11793,
2188,
319,
6835,
1989,
198,
824,
333,
21... | 2.356098 | 205 |
sol = Solution()
t = int(input())
dp = [[0]*201 for _ in range(201)]
for _ in range(t): print(sol.main()) | [
201,
198,
201,
198,
34453,
796,
28186,
3419,
201,
198,
83,
796,
493,
7,
15414,
28955,
201,
198,
26059,
796,
16410,
15,
60,
9,
1264,
329,
4808,
287,
2837,
7,
1264,
15437,
201,
198,
1640,
4808,
287,
2837,
7,
83,
2599,
3601,
7,
34453... | 2.382979 | 47 |
import unittest
from palindrome import is_palindrome
if __name__ == '__main__':
unittest.main()
| [
11748,
555,
715,
395,
198,
198,
6738,
6340,
521,
5998,
1330,
318,
62,
18596,
521,
5998,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
555,
715,
395,
13,
12417,
3419,
198
] | 2.641026 | 39 |
import requests
import json
import re
if __name__ == "__main__":
# course_id = input("Enter course id: ")
# print(get_course_requirements(course_id))
# major_reqs = get_all_course_requirements()
# save(major_reqs, "../data/course_requirements.json")
# major_titles = get_all_major_titles()
# save(major_titles, "../data/major_titles.json")
all_courses = get_all_courses()
save(all_courses, "../data/allCourses.json")
| [
11748,
7007,
198,
11748,
33918,
198,
11748,
302,
628,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
197,
2,
1781,
62,
312,
796,
5128,
7203,
17469,
1781,
4686,
25,
366,
8,
198,
197,
2,
3601,
7,
1136,
... | 2.644172 | 163 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import bytes
from builtins import chr
from builtins import range
from builtins import super
import random
from pprint import pprint
from binascii import hexlify
from collections import OrderedDict
from bhivebase import (
transactions,
memo,
operations,
objects
)
from bhivebase.objects import Operation
from bhivebase.signedtransactions import Signed_Transaction
from bhivegraphenebase.account import PrivateKey
from bhivegraphenebase import account
from bhivebase.operationids import getOperationNameForId
from bhivegraphenebase.py23 import py23_bytes, bytes_types
from bhive.amount import Amount
from bhive.asset import Asset
from bhive.hive import Hive
import time
from hive import Hive as hiveHive
from hivebase.account import PrivateKey as hivePrivateKey
from hivebase.transactions import SignedTransaction as hiveSignedTransaction
from hivebase import operations as hiveOperations
from timeit import default_timer as timer
if __name__ == "__main__":
steem_test = HiveTest()
bsteem_test = BhiveTest()
steem_test.setup()
bsteem_test.setup()
steem_times = []
bsteem_times = []
loops = 50
for i in range(0, loops):
print(i)
opHive = hiveOperations.Transfer(**{
"from": "foo",
"to": "baar",
"amount": "111.110 HIVE",
"memo": "Fooo"
})
opBhive = operations.Transfer(**{
"from": "foo",
"to": "baar",
"amount": Amount("111.110 HIVE", hive_instance=Hive(offline=True)),
"memo": "Fooo"
})
t_s, t_v = steem_test.doit(ops=opHive)
steem_times.append([t_s, t_v])
t_s, t_v = bsteem_test.doit(ops=opBhive)
bsteem_times.append([t_s, t_v])
steem_dt = [0, 0]
bsteem_dt = [0, 0]
for i in range(0, loops):
steem_dt[0] += steem_times[i][0]
steem_dt[1] += steem_times[i][1]
bsteem_dt[0] += bsteem_times[i][0]
bsteem_dt[1] += bsteem_times[i][1]
print("hive vs bhive:\n")
print("hive: sign: %.2f s, verification %.2f s" % (steem_dt[0] / loops, steem_dt[1] / loops))
print("bhive: sign: %.2f s, verification %.2f s" % (bsteem_dt[0] / loops, bsteem_dt[1] / loops))
print("------------------------------------")
print("bhive is %.2f %% (sign) and %.2f %% (verify) faster than hive" %
(steem_dt[0] / bsteem_dt[0] * 100, steem_dt[1] / bsteem_dt[1] * 100))
| [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
6738,
11593,
37443,
834,
1330,
7297,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
6738,
3170,
1040,
1330,
... | 2.367701 | 1,096 |
from PyQt5 import QtWidgets, QtCore
from utils.styling import rename_user_dialog_title_style
| [
6738,
9485,
48,
83,
20,
1330,
33734,
54,
312,
11407,
11,
33734,
14055,
198,
6738,
3384,
4487,
13,
34365,
1359,
1330,
36265,
62,
7220,
62,
38969,
519,
62,
7839,
62,
7635,
628
] | 2.9375 | 32 |
#!/usr/bin/python
import bluetooth, sys, os, re, subprocess, time, getopt
BT_BLE = int(os.getenv('BT_BLE', 0))
BT_SCAN_TIMEOUT = int(os.getenv('BT_SCAN_TIMEOUT', 2))
if BT_BLE:
from gattlib import DiscoveryService
from ble_client import BleClient
#------------------------------------------------------------------------------
# Connects to Audio Service (Audio Sink, Audio Source, more in bluetoothctl <<EOF
# info <address>
# EOF
# raise bluetooth.btcommon.BluetoothError
#------------------------------------------------------------------------------
# Devices discovery with bluetooth low energy (BT_BLE) support
# return devices list in argument (list append)
if __name__ == '__main__':
main(sys.argv)
| [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
11748,
48208,
16271,
11,
25064,
11,
28686,
11,
302,
11,
850,
14681,
11,
640,
11,
651,
8738,
198,
198,
19313,
62,
19146,
796,
493,
7,
418,
13,
1136,
24330,
10786,
19313,
62,
19146,
3256,
657... | 3.561576 | 203 |
#!/usr/bin/env python
import os
import sys
if not os.getegid() == 0:
sys.exit( 'Script must be run as root' )
from pyA20.gpio import gpio
from pyA20.gpio import port
pin = port.PA12
gpio.init()
gpio.setcfg(pin, gpio.OUTPUT)
gpio.output(pin, int(sys.argv[1])) | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
11748,
28686,
198,
11748,
25064,
198,
198,
361,
407,
28686,
13,
1136,
1533,
312,
3419,
6624,
657,
25,
198,
220,
220,
220,
25064,
13,
37023,
7,
705,
7391,
1276,
307,
1057,
355,
6... | 2.301724 | 116 |
#########################################
# Author: Chenfu Shi
# Email: chenfu.shi@postgrad.manchester.ac.uk
# BSD-3-Clause License
# Copyright 2019 Chenfu Shi
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#########################################
# converts bedpe to long range, making sure to print twice each line.
# allows the user to choose which field to copy over and if you want to do -log10 for eg. p-values or q-values
import argparse
import subprocess
import math
import os
parser = argparse.ArgumentParser(description='Tool to convert bedpe files to long_range format. Uses bgzip and tabix to compress and index the file')
parser.add_argument("-i",'--input', dest='inputfile', action='store', required=True,
help='input file name')
parser.add_argument("-o",'--output', dest='outputfile', action='store', required=False,
help='ouput file name. Will add .gz automatically')
parser.add_argument("-f",'--field', dest='field', action='store', type=int, default=8, required=False,
help='field to store as score. Default 8th field. For MAPS use 9 for FDR')
parser.add_argument('-l', '--log' ,action='store_true', dest='log', help='do -log10 of score')
args = parser.parse_args()
args = parser.parse_args()
if args.outputfile:
outputname=args.outputfile
else:
outputname=args.inputfile + ".washu.bed"
inputname=args.inputfile
if not os.path.isfile(inputname):
raise Exception("input file couldn't be opened")
ID_counter = 1
with open(outputname, "w") as outputfile, open(args.inputfile , "r") as inputfile:
for line in inputfile:
data = line.split("\t")
chr1 = data[0].strip()
if not data[1].strip().isdigit():
# check that the line contains data instead of header
continue
start1 = data[1].strip()
end1 = data[2].strip()
chr2 = data[3].strip()
start2 = data[4].strip()
end2 = data[5].strip()
score = data[args.field-1].strip()
# if chr is a number with no chr add chr, compatibility with washu
if chr1[0:3] != "chr":
chr1 = "chr" + chr1
chr2 = "chr" + chr2
if args.log == True:
try:
score = str(-math.log10(float(score)))
except ValueError:
# in case the score is zero
score = 384
outputfile.write("{}\t{}\t{}\t{}:{}-{},{}\t{}\t{}\n".format(chr1,start1,end1,chr2,start2,end2,score,str(ID_counter),"."))
ID_counter = ID_counter + 1
outputfile.write("{}\t{}\t{}\t{}:{}-{},{}\t{}\t{}\n".format(chr2,start2,end2,chr1,start1,end1,score,str(ID_counter),"."))
ID_counter = ID_counter + 1
# automatically sort, compress and index the output file
subprocess.run(["sort","-o",outputname,"-k1,1","-k2,2n",outputname])
subprocess.run(["bgzip",outputname])
subprocess.run(["tabix","-p","bed",outputname+".gz"]) | [
29113,
7804,
2,
198,
2,
6434,
25,
12555,
20942,
16380,
198,
2,
9570,
25,
269,
831,
20942,
13,
44019,
31,
7353,
9744,
13,
805,
35983,
13,
330,
13,
2724,
198,
2,
347,
10305,
12,
18,
12,
2601,
682,
13789,
198,
2,
15069,
13130,
12555,... | 2.797055 | 1,562 |
# Year 2022
# Authors: Anais Mller based on fink-broker.org code
import os
import sys
import glob
import logging
import argparse
import numpy as np
import pandas as pd
from tqdm import tqdm
from pathlib import Path
from functools import partial
from astropy.table import Table
from astropy import units as u
from astropy.coordinates import SkyCoord
import multiprocessing
from concurrent.futures import ProcessPoolExecutor
# my utils
from utils import xmatch
from utils import mag_color
from utils import query_photoz_datalab as photoz
if __name__ == "__main__":
"""Process light-curves with Fink inspired features & xmatches
https://github.com/astrolabsoftware/fink-filters
"""
parser = argparse.ArgumentParser(description="Compute candidate features + xmatch")
parser.add_argument(
"--path_field",
type=str,
default="data/S82sub8_tmpl",
help="Path to field",
)
parser.add_argument(
"--path_out",
type=str,
default="./Fink_outputs",
help="Path to outputs",
)
parser.add_argument(
"--path_robot",
type=str,
default="../ROBOT_masterlists",
help="Path to ROBOT outputs",
)
parser.add_argument(
"--debug",
action="store_true",
help="Debug: loop processing (slow)",
)
parser.add_argument(
"--test",
action="store_true",
help="one file processed only",
)
args = parser.parse_args()
os.makedirs(args.path_out, exist_ok=True)
os.makedirs("logs/", exist_ok=True)
cwd = os.getcwd()
logpathname = f"{cwd}/logs/{Path(args.path_field).stem}_preprocess"
logger = setup_logging(logpathname)
# read files
list_files = glob.glob(f"{args.path_field}/*/*/*.forced.difflc.txt")
print(f"{len(list_files)} files found in {args.path_field}")
if args.test:
print(list_files)
print("Processing only one file", list_files[0])
df = process_single_file(list_files[0])
elif args.debug:
print(list_files)
# no parallel
list_proc = []
for fil in list_files:
logger.info(fil)
list_proc.append(process_single_file(fil))
df = pd.concat(list_proc)
else:
# Read and process files faster with ProcessPoolExecutor
max_workers = multiprocessing.cpu_count()
# use parallelization to speed up processing
# Split list files in chunks of size 10 or less
# to get a progress bar and alleviate memory constraints
num_elem = len(list_files)
num_chunks = num_elem // 10 + 1
list_chunks = np.array_split(np.arange(num_elem), num_chunks)
logger.info(f"Dividing processing in {num_chunks} chunks")
process_fn_file = partial(process_single_file)
list_fn = []
for fmt in list_files:
list_fn.append(process_fn_file)
list_processed = []
for chunk_idx in tqdm(list_chunks, desc="Process", ncols=100):
# Process each file in the chunk in parallel
with ProcessPoolExecutor(max_workers=max_workers) as executor:
start, end = chunk_idx[0], chunk_idx[-1] + 1
# Need to cast to list because executor returns an iterator
list_pairs = list(zip(list_fn[start:end], list_files[start:end]))
list_processed += list(executor.map(process_fn, list_pairs))
df = pd.concat(list_processed)
print("NOT PARALLEL= UNFORCED PHOTOMETRY")
list_files_un = glob.glob(f"{args.path_field}/*/*/*.unforced.difflc.txt")
list_unforced = []
list_idx = []
if args.test:
list_files_un = [list_files_un[0]]
for fil in list_files_un:
list_unforced.append(process_single_file(fil, suffix=".unforced.difflc"))
df_unforced = pd.concat(list_unforced)
if len(df_unforced) > 0:
df = pd.merge(df, df_unforced, on="id", how="left")
logger.info("SIMBAD xmatch")
z, sptype, typ, ctlg = xmatch.cross_match_simbad(
df["id"].to_list(), df["ra"].to_list(), df["dec"].to_list()
)
logger.info("Finished SIMBAD xmatch")
# save in df
df["simbad_type"] = typ
df["simbad_ctlg"] = ctlg
df["simbad_sptype"] = sptype
df["simbad_redshift"] = z
logger.info("GAIA xmatch")
source, ragaia, decgaia, plx, plxerr, gmag, angdist = xmatch.cross_match_gaia(
df["id"].to_list(),
df["ra"].to_list(),
df["dec"].to_list(),
ctlg="vizier:I/345/gaia2",
)
(
source_edr3,
ragaia_edr3,
decgaia_edr3,
plx_edr3,
plxerr_edr3,
gmag_edr3,
angdist_edr3,
) = xmatch.cross_match_gaia(
df["id"].to_list(),
df["ra"].to_list(),
df["dec"].to_list(),
ctlg="vizier:I/350/gaiaedr3",
)
logger.info("Finished GAIA xmatch")
# save in df
df["gaia_DR2_source"] = source
df["gaia_DR2_ra"] = ragaia
df["gaia_DR2_dec"] = decgaia
df["gaia_DR2_parallax"] = plx
df["gaia_DR2_parallaxerr"] = plxerr
df["gaia_DR2_gmag"] = gmag
df["gaia_DR2_angdist"] = angdist
df["gaia_eDR3_source"] = source_edr3
df["gaia_eDR3_ra"] = ragaia_edr3
df["gaia_eDR3_dec"] = decgaia_edr3
df["gaia_eDR3_parallax"] = plx_edr3
df["gaia_eDR3_parallaxerr"] = plxerr_edr3
df["gaia_eDR3_gmag"] = gmag_edr3
df["gaia_eDR3_angdist"] = angdist_edr3
logger.info("USNO-A.20 xmatch")
(source_usno, angdist_usno,) = xmatch.cross_match_usno(
df["id"].to_list(),
df["ra"].to_list(),
df["dec"].to_list(),
ctlg="vizier:I/252/out",
)
df["USNO_source"] = source_usno
df["USNO_angdist"] = angdist_usno
logger.info("Legacy Survey xmatch")
list_ls_df = []
for (idx, ra, dec) in df[["id", "ra", "dec"]].values:
list_ls_df.append(photoz.query_coords_ls(idx, ra, dec, radius_arcsec=10))
df_ls = pd.concat(list_ls_df)
logger.info("Finished Legacy Survey xmatch")
df = pd.merge(df, df_ls, on="id")
# add ROBOT scores
# You may need to add the field caldate format as Simon's output
# TO DO these next lines should give you that
field = Path(args.path_field).stem.replace("_tmpl", "")
caldate = Path(args.path_field).parent.parent.stem
# TO DO just change the name here
robot_path = f"{args.path_robot}/caldat{caldate}/{field}_{caldate}_masterlist.csv"
if Path(robot_path).exists():
df_robot = pd.read_csv(
robot_path,
delimiter=";",
)
df_robot = df_robot.rename(columns={"Cand_ID": "id"})
df = pd.merge(df, df_robot, on="id", how="left")
else:
print(f"NO ROBOT MASTERLIST FOUND {robot_path}")
outprefix = str(Path(args.path_field).stem)
# outname = f"{args.path_out}/{outprefix}.csv"
# df.to_csv(outname, index=False, sep=";")
outname = f"{args.path_out}/{outprefix}.pickle"
df.to_pickle(outname)
logger.info(f"Saved output {outname}")
| [
2,
6280,
33160,
198,
2,
46665,
25,
1052,
15152,
337,
6051,
1912,
319,
277,
676,
12,
7957,
6122,
13,
2398,
2438,
198,
198,
11748,
28686,
198,
11748,
25064,
198,
11748,
15095,
198,
11748,
18931,
198,
11748,
1822,
29572,
198,
11748,
299,
... | 2.143817 | 3,275 |
#!/usr/bin/python3
'''Day 11 of the 2017 advent of code'''
def part_one(data):
"""Return the answer to part one of this day"""
hexer = HexCounter()
for coord in data:
hexer.move(coord)
return hexer.max()
def part_two(data):
"""Return the answer to part two of this day"""
hexer = HexCounter()
for coord in data:
hexer.move(coord)
return hexer.furthest
if __name__ == "__main__":
DATA = ""
with open("input", "r") as f:
for line in f:
DATA += line.rstrip() #hidden newline in file input
COORDS = DATA.split(",")
print("Part 1: {}".format(part_one(COORDS)))
print("Part 2: {}".format(part_two(COORDS)))
| [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
201,
198,
7061,
6,
12393,
1367,
286,
262,
2177,
19980,
286,
2438,
7061,
6,
201,
198,
201,
198,
201,
198,
201,
198,
4299,
636,
62,
505,
7,
7890,
2599,
201,
198,
220,
220,
220,
37227,
13615,... | 2.19174 | 339 |
# Copied from /u/jlu/data/microlens/20aug22os/reduce/reduce.py
##################################################
#
# General Notes:
# -- python uses spaces to figure out the beginnings
# and ends of functions/loops/etc. So make sure
# to preserve spacings properly (indent). This
# is easy to do if you use emacs with python mode
# and color coding.
# -- You will probably need to edit almost every
# single line of the go() function.
# -- If you need help on the individual function calls,
# then in the pyraf prompt, import the module and
# then print the documentation for that function:
# --> print nirc2.nirc2log.__doc__
# --> print range.__doc__
#
##################################################
# Import python and iraf modules
from pyraf import iraf as ir
import numpy as np
import os, sys
import glob
# Import our own custom modules
from kai.reduce import calib
from kai.reduce import sky
from kai.reduce import data
from kai.reduce import util
from kai.reduce import dar
from kai.reduce import kai_util
from kai import instruments
##########
# Change the epoch, instrument, and distortion solution.
##########
epoch = '19may27'
nirc2 = instruments.NIRC2()
##########
# Make electronic logs
# - run this first thing for a new observing run.
##########
def makelog_and_prep_images():
"""Make an electronic log from all the files in the ../raw/ directory.
The file will be called nirc2.log and stored in the same directory.
@author Jessica Lu
@author Sylvana Yelda
"""
nirc2_util.makelog('../raw', instrument=nirc2)
# If you are reducing OSIRIS, you need to flip the images first.
#raw_files = glob.glob('../raw/i*.fits')
#osiris.flip_images(raw_files)
# Download weather data we will need.
dar.get_atm_conditions('2019')
return
###############
# Analyze darks
###############
# def analyze_darks():
# """Analyze the dark_calib results
# """
# util.mkdir('calib')
# os.chdir('calib')
#
# first_dark = 16
# calib.analyzeDarkCalib(first_dark) # Doesn't support OSIRIS yet
#
# os.chdir('../')
##########
# Reduce
##########
def go_calib():
"""Do the calibration reduction.
@author Jessica Lu
@author Sylvana Yelda
"""
####################
#
# Calibration files:
# everything created under calib/
#
####################
# Darks - created in subdir darks/
# - darks needed to make bad pixel mask
# - store the resulting dark in the file name that indicates the
# integration time (2.8s) and the coadds (10ca).
# -- If you use the OSIRIS image, you must include the full filename in the list.
#darkFiles = ['i200809_a003{0:03d}_flip'.format(ii) for ii in range(3, 7+1)]
#calib.makedark(darkFiles, 'dark_2.950s_10ca_3rd.fits', instrument=osiris)
# darkFiles = ['i200822_s003{0:03d}_flip'.format(ii) for ii in range(28, 32+1)]
# calib.makedark(darkFiles, 'dark_5.901s_1ca_4rd.fits', instrument=osiris)
# darkFiles = ['i200822_s020{0:03d}_flip'.format(ii) for ii in range(2, 10+1)]
# calib.makedark(darkFiles, 'dark_11.802s_4ca_4rd.fits', instrument=osiris)
# darkFiles = ['i200822_s021{0:03d}_flip'.format(ii) for ii in range(2, 10+1)]
# calib.makedark(darkFiles, 'dark_5.901s_8ca_1rd.fits', instrument=osiris)
# Flats - created in subdir flats/
#offFiles = ['i200809_a013{0:03d}_flip'.format(ii) for ii in range(2, 11+1, 2)]
#onFiles = ['i200811_a002{0:03d}_flip'.format(ii) for ii in range(2, 13+1, 2)]
#calib.makeflat(onFiles, offFiles, 'flat_kp_tdOpen.fits', instrument=osiris)
# Masks (assumes files were created under calib/darks/ and calib/flats/)
#calib.makemask('dark_2.950s_10ca_3rd.fits', 'flat_kp_tdOpen.fits',
# 'supermask.fits', instrument=osiris)
darkFiles = list(range(67, 72+1))
calib.makedark(darkFiles, 'dark_30.0s_1ca.fits', instrument=nirc2)
# Flats - created in subdir flats/
offFiles = list(range(11, 16+1))
onFiles = list(range(01, 06+1))
calib.makeflat(onFiles, offFiles, 'flat_ks.fits', instrument=nirc2)
# Masks
calib.makemask('dark_30.0s_1ca.fits', 'flat_ks.fits',
'supermask.fits')
def go():
"""
Do the full data reduction.
"""
##########
#
# OB06284
#
##########
##########
# Kp-band reduction
##########
target = 'OB06284'
#-----OSIRIS------
#sci_files = ['i200810_a004{0:03d}_flip'.format(ii) for ii in range(2, 6+1)]
#sci_files += ['i200822_a012{0:03d}_flip'.format(ii) for ii in range(2, 25+1)] #Add second dataset (on same night). [Optional]
#sky_files = ['i200810_a007{0:03d}_flip'.format(ii) for ii in range(2, 6+1)] #16+1
#refSrc = [1071, 854] # This is the target
#sky.makesky(sky_files, target, 'kp_tdOpen', instrument=osiris)
#data.clean(sci_files, target, 'kp_tdOpen', refSrc, refSrc, field=target, instrument=osiris)
#data.calcStrehl(sci_files, 'kp_tdOpen', field=target, instrument=osiris)
#data.combine(sci_files, 'kp_tdOpen', epoch, field=target,
# trim=0, weight='strehl', submaps=3, instrument=osiris)
#-----------------
#-----NIRC2-------
sci_files = list(range(133, 136+1))
sky_files = list(range(224, 233+1))
refSrc1 = [353., 469.] #This is the target
sky.makesky(sky_files, 'nite1', 'ks', instrument=nirc2)
data.clean(sci_files, 'nite1', 'ks', refSrc1, refSrc1, instrument=nirc2)
data.calcStrehl(sci_files, 'ks', instrument=nirc2)
data.combine(sci_files, 'ks', '27maylgs', trim=1, weight='strehl',
submaps=3, instrument=nirc2)
#-----------------
os.chdir('../')
##########
#
# KB200101
#
##########
##########
# Kp-band reduction
##########
# util.mkdir('kp')
# os.chdir('kp')
# -- If you have more than one position angle, make sure to
# clean them seperatly.
# -- Strehl and Ref src should be the pixel coordinates of a bright
# (but non saturated) source in the first exposure of sci_files.
# -- If you use the OSIRIS image, you must include the full filename in the list.
# target = 'OB060284'
# sci_files = ['i200822_a014{0:03d}_flip'.format(ii) for ii in range(2, 28+1)]
# sci_files += ['i200822_a015{0:03d}_flip'.format(ii) for ii in range(2, 5+1)]
# sci_files += ['i200822_a016{0:03d}_flip'.format(ii) for ii in range(2, 5+1)]
# sky_files = ['i200822_a017{0:03d}_flip'.format(ii) for ii in range(2, 6+1)]
# refSrc = [975, 1006] # This is the target
# Alternative star to try (bright star to right of target): [1158, 994]
# sky.makesky(sky_files, target, 'kp_tdOpen', instrument=osiris)
# data.clean(sci_files, target, 'kp_tdOpen', refSrc, refSrc, field=target, instrument=osiris)
# data.calcStrehl(sci_files, 'kp_tdOpen', field=target, instrument=osiris)
# data.combine(sci_files, 'kp_tdOpen', epoch, field=target,
# trim=1, weight='strehl', submaps=3, instrument=osiris)
#
def jackknife():
"""
Do the Jackknife data reduction.
"""
##########
#
# OB06284
#
##########
##########
# Kp-band reduction
##########
target = 'OB06284'
#sci_files = ['i200810_a004{0:03d}_flip'.format(ii) for ii in range(2, 26+1)] OG
sci_files = ['i200810_a004{0:03d}_flip'.format(ii) for ii in range(2, 26+1)]
# sci_files += ['i200822_a012{0:03d}_flip'.format(ii) for ii in range(2, 25+1)]
sky_files = ['i200810_a007{0:03d}_flip'.format(ii) for ii in range(2, 6+1)] #16+1
refSrc = [1071, 854] # This is the target
# Alternative star to try (bright star to bottom of target): [1015, 581.9]
sky.makesky(sky_files, target, 'kp_tdOpen', instrument=osiris)
for i in enumerate(sci_files, start=1):
jack_list = sci_files[:]
jack_list.remove(i[1])
data.clean(jack_list, target, 'kp_tdOpen', refSrc, refSrc, field=target, instrument=osiris)
data.calcStrehl(jack_list, 'kp_tdOpen', field=target, instrument=osiris)
data.combine(jack_list, 'kp_tdOpen', epoch, field=target,
trim=0, weight='strehl', instrument=osiris, outSuffix=str(i[0]))
os.chdir('reduce')
| [
2,
6955,
798,
422,
1220,
84,
14,
73,
2290,
14,
7890,
14,
24055,
75,
641,
14,
1238,
7493,
1828,
418,
14,
445,
7234,
14,
445,
7234,
13,
9078,
198,
198,
29113,
14468,
2235,
198,
2,
198,
2,
3611,
11822,
25,
198,
2,
1377,
21015,
3544... | 2.406676 | 3,445 |
import tkinter as tk
from PIL import Image, ImageTk
from game import Game
from threading import Thread
import time
from gameSaver import sendFull
from Client import DummyAgent
| [
11748,
256,
74,
3849,
355,
256,
74,
198,
6738,
350,
4146,
1330,
7412,
11,
7412,
51,
74,
198,
6738,
983,
1330,
3776,
198,
6738,
4704,
278,
1330,
14122,
198,
11748,
640,
198,
6738,
983,
50,
8770,
1330,
3758,
13295,
198,
6738,
20985,
1... | 3.765957 | 47 |
"""Core classes for motto
"""
from typing import Any, Callable, ClassVar, Dict, List, Optional, Tuple, Union
from typing_extensions import Protocol, TypedDict
SkillParams = Dict[str, Any]
SkillProc = Callable[[Sentence, SkillParams], Optional[Message]]
Config = Dict[str, Any]
| [
37811,
14055,
6097,
329,
33600,
198,
37811,
198,
6738,
19720,
1330,
4377,
11,
4889,
540,
11,
5016,
19852,
11,
360,
713,
11,
7343,
11,
32233,
11,
309,
29291,
11,
4479,
198,
6738,
19720,
62,
2302,
5736,
1330,
20497,
11,
17134,
276,
35,
... | 3.166667 | 90 |
from diffrascape.env import BadSeeds
| [
6738,
814,
81,
3372,
1758,
13,
24330,
1330,
7772,
50,
39642,
628
] | 3.166667 | 12 |
#!/usr/bin/python
import json, subprocess, sys, platform
from os.path import expanduser
if len (sys.argv) < 2 :
print("Usage: python " + sys.argv[0] + " username(s)")
sys.exit (1)
HOME=expanduser("~")
# determine paths
SYSTEM=platform.system()
if SYSTEM == 'Darwin':
SERVERJSON=HOME+'/Library/Application Support/botframework-emulator/botframework-emulator/server.json'
EMULATORPATH=HOME+'/Applications/botframework-emulator.app/'
elif SYSTEM == 'Windows':
SERVERJSON=HOME+'/AppData/Roaming/botframework-emulator/botframework-emulator/server.json'
EMULATORPATH=HOME+'/AppData/Local/botframework/botframework-emulator.exe'
else:
print("System " + SYSTEM + " not yet supported.")
sys.exit (1)
# read the server config file
with open(SERVERJSON, "r") as jsonFile:
data = json.load(jsonFile)
args=sys.argv[1:]
for arg in args:
# add user if not present
if data["users"]["usersById"].get(arg) is None:
data["users"]["usersById"][arg]={"id": arg,"name": arg}
# set current user
data["users"]["currentUserId"]=arg
# write server config file
with open(SERVERJSON, "w") as jsonFile:
json.dump(data, jsonFile, sort_keys=False, indent=2, separators=(',', ': '))
# launch emulator
if SYSTEM == 'Darwin':
subprocess.call(["/usr/bin/open", "-n", EMULATORPATH])
elif SYSTEM == 'Windows':
subprocess.call([EMULATORPATH])
| [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
11748,
33918,
11,
850,
14681,
11,
25064,
11,
3859,
198,
6738,
28686,
13,
6978,
1330,
4292,
7220,
198,
198,
361,
18896,
357,
17597,
13,
853,
85,
8,
1279,
362,
1058,
198,
220,
220,
220,
3601,... | 2.645522 | 536 |
# coding: utf-8
"""
OriginStamp Client
OpenAPI spec version: 3.0
OriginStamp Documentation: https://docs.originstamp.com
Contact: mail@originstamp.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, TimestampResponse):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other
| [
2,
19617,
25,
3384,
69,
12,
23,
198,
198,
37811,
198,
220,
220,
220,
19349,
1273,
696,
20985,
628,
220,
220,
220,
4946,
17614,
1020,
2196,
25,
513,
13,
15,
198,
220,
220,
220,
19349,
1273,
696,
43925,
25,
3740,
1378,
31628,
13,
11... | 2.551205 | 332 |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate Leakage': 0.00662954,
'Peak Dynamic': 0.0,
'Runtime Dynamic': 0.0,
'Subthreshold Leakage': 0.0691322,
'Subthreshold Leakage with power gating': 0.0259246},
'Core': [{'Area': 32.6082,
'Execution Unit/Area': 8.2042,
'Execution Unit/Complex ALUs/Area': 0.235435,
'Execution Unit/Complex ALUs/Gate Leakage': 0.0132646,
'Execution Unit/Complex ALUs/Peak Dynamic': 0.0,
'Execution Unit/Complex ALUs/Runtime Dynamic': 0.202689,
'Execution Unit/Complex ALUs/Subthreshold Leakage': 0.20111,
'Execution Unit/Complex ALUs/Subthreshold Leakage with power gating': 0.0754163,
'Execution Unit/Floating Point Units/Area': 4.6585,
'Execution Unit/Floating Point Units/Gate Leakage': 0.0656156,
'Execution Unit/Floating Point Units/Peak Dynamic': 0.0,
'Execution Unit/Floating Point Units/Runtime Dynamic': 0.304033,
'Execution Unit/Floating Point Units/Subthreshold Leakage': 0.994829,
'Execution Unit/Floating Point Units/Subthreshold Leakage with power gating': 0.373061,
'Execution Unit/Gate Leakage': 0.122718,
'Execution Unit/Instruction Scheduler/Area': 2.17927,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Area': 0.328073,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Gate Leakage': 0.00115349,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Peak Dynamic': 1.20978,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Runtime Dynamic': 0.398053,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage': 0.017004,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage with power gating': 0.00962066,
'Execution Unit/Instruction Scheduler/Gate Leakage': 0.00730101,
'Execution Unit/Instruction Scheduler/Instruction Window/Area': 1.00996,
'Execution Unit/Instruction Scheduler/Instruction Window/Gate Leakage': 0.00529112,
'Execution Unit/Instruction Scheduler/Instruction Window/Peak Dynamic': 2.07911,
'Execution Unit/Instruction Scheduler/Instruction Window/Runtime Dynamic': 0.689285,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage': 0.0800117,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage with power gating': 0.0455351,
'Execution Unit/Instruction Scheduler/Peak Dynamic': 4.84781,
'Execution Unit/Instruction Scheduler/ROB/Area': 0.841232,
'Execution Unit/Instruction Scheduler/ROB/Gate Leakage': 0.000856399,
'Execution Unit/Instruction Scheduler/ROB/Peak Dynamic': 1.55892,
'Execution Unit/Instruction Scheduler/ROB/Runtime Dynamic': 0.395324,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage': 0.0178624,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage with power gating': 0.00897339,
'Execution Unit/Instruction Scheduler/Runtime Dynamic': 1.48266,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage': 0.114878,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage with power gating': 0.0641291,
'Execution Unit/Integer ALUs/Area': 0.47087,
'Execution Unit/Integer ALUs/Gate Leakage': 0.0265291,
'Execution Unit/Integer ALUs/Peak Dynamic': 0.393459,
'Execution Unit/Integer ALUs/Runtime Dynamic': 0.101344,
'Execution Unit/Integer ALUs/Subthreshold Leakage': 0.40222,
'Execution Unit/Integer ALUs/Subthreshold Leakage with power gating': 0.150833,
'Execution Unit/Peak Dynamic': 5.65134,
'Execution Unit/Register Files/Area': 0.570804,
'Execution Unit/Register Files/Floating Point RF/Area': 0.208131,
'Execution Unit/Register Files/Floating Point RF/Gate Leakage': 0.000232788,
'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.0,
'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.0144298,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage': 0.00399698,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage with power gating': 0.00176968,
'Execution Unit/Register Files/Gate Leakage': 0.000622708,
'Execution Unit/Register Files/Integer RF/Area': 0.362673,
'Execution Unit/Register Files/Integer RF/Gate Leakage': 0.00038992,
'Execution Unit/Register Files/Integer RF/Peak Dynamic': 0.104345,
'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.106717,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage': 0.00614175,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage with power gating': 0.00246675,
'Execution Unit/Register Files/Peak Dynamic': 0.104345,
'Execution Unit/Register Files/Runtime Dynamic': 0.121147,
'Execution Unit/Register Files/Subthreshold Leakage': 0.0101387,
'Execution Unit/Register Files/Subthreshold Leakage with power gating': 0.00423643,
'Execution Unit/Results Broadcast Bus/Area Overhead': 0.0442632,
'Execution Unit/Results Broadcast Bus/Gate Leakage': 0.00607074,
'Execution Unit/Results Broadcast Bus/Peak Dynamic': 0.252141,
'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.66048,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage': 0.0920413,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage with power gating': 0.0345155,
'Execution Unit/Runtime Dynamic': 2.87235,
'Execution Unit/Subthreshold Leakage': 1.83518,
'Execution Unit/Subthreshold Leakage with power gating': 0.709678,
'Gate Leakage': 0.372997,
'Instruction Fetch Unit/Area': 5.86007,
'Instruction Fetch Unit/Branch Predictor/Area': 0.138516,
'Instruction Fetch Unit/Branch Predictor/Chooser/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Chooser/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Chooser/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Chooser/Runtime Dynamic': 0.00419365,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/Gate Leakage': 0.000757657,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Runtime Dynamic': 0.00419365,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Area': 0.0257064,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Gate Leakage': 0.000154548,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Peak Dynamic': 0.0142575,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Runtime Dynamic': 0.00370425,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage': 0.00384344,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage with power gating': 0.00198631,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Area': 0.0151917,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Gate Leakage': 8.00196e-05,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Peak Dynamic': 0.00527447,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Runtime Dynamic': 0.00146219,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage': 0.00181347,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage with power gating': 0.000957045,
'Instruction Fetch Unit/Branch Predictor/Peak Dynamic': 0.0597838,
'Instruction Fetch Unit/Branch Predictor/RAS/Area': 0.0105732,
'Instruction Fetch Unit/Branch Predictor/RAS/Gate Leakage': 4.63858e-05,
'Instruction Fetch Unit/Branch Predictor/RAS/Peak Dynamic': 0.0117602,
'Instruction Fetch Unit/Branch Predictor/RAS/Runtime Dynamic': 0.001533,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage': 0.000932505,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage with power gating': 0.000494733,
'Instruction Fetch Unit/Branch Predictor/Runtime Dynamic': 0.0136245,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage': 0.0199703,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage with power gating': 0.0103282,
'Instruction Fetch Unit/Branch Target Buffer/Area': 0.64954,
'Instruction Fetch Unit/Branch Target Buffer/Gate Leakage': 0.00272758,
'Instruction Fetch Unit/Branch Target Buffer/Peak Dynamic': 0.177867,
'Instruction Fetch Unit/Branch Target Buffer/Runtime Dynamic': 0.0383651,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage': 0.0811682,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage with power gating': 0.0435357,
'Instruction Fetch Unit/Gate Leakage': 0.0590479,
'Instruction Fetch Unit/Instruction Buffer/Area': 0.0226323,
'Instruction Fetch Unit/Instruction Buffer/Gate Leakage': 6.83558e-05,
'Instruction Fetch Unit/Instruction Buffer/Peak Dynamic': 0.606827,
'Instruction Fetch Unit/Instruction Buffer/Runtime Dynamic': 0.10259,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage': 0.00151885,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage with power gating': 0.000701682,
'Instruction Fetch Unit/Instruction Cache/Area': 3.14635,
'Instruction Fetch Unit/Instruction Cache/Gate Leakage': 0.029931,
'Instruction Fetch Unit/Instruction Cache/Peak Dynamic': 6.43323,
'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.347508,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage': 0.367022,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage with power gating': 0.180386,
'Instruction Fetch Unit/Instruction Decoder/Area': 1.85799,
'Instruction Fetch Unit/Instruction Decoder/Gate Leakage': 0.0222493,
'Instruction Fetch Unit/Instruction Decoder/Peak Dynamic': 1.37404,
'Instruction Fetch Unit/Instruction Decoder/Runtime Dynamic': 0.348441,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage': 0.442943,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage with power gating': 0.166104,
'Instruction Fetch Unit/Peak Dynamic': 8.96874,
'Instruction Fetch Unit/Runtime Dynamic': 0.850528,
'Instruction Fetch Unit/Subthreshold Leakage': 0.932587,
'Instruction Fetch Unit/Subthreshold Leakage with power gating': 0.408542,
'L2/Area': 4.53318,
'L2/Gate Leakage': 0.015464,
'L2/Peak Dynamic': 0.012026,
'L2/Runtime Dynamic': 0.00380648,
'L2/Subthreshold Leakage': 0.834142,
'L2/Subthreshold Leakage with power gating': 0.401066,
'Load Store Unit/Area': 8.80969,
'Load Store Unit/Data Cache/Area': 6.84535,
'Load Store Unit/Data Cache/Gate Leakage': 0.0279261,
'Load Store Unit/Data Cache/Peak Dynamic': 3.72231,
'Load Store Unit/Data Cache/Runtime Dynamic': 1.19954,
'Load Store Unit/Data Cache/Subthreshold Leakage': 0.527675,
'Load Store Unit/Data Cache/Subthreshold Leakage with power gating': 0.25085,
'Load Store Unit/Gate Leakage': 0.0351387,
'Load Store Unit/LoadQ/Area': 0.0836782,
'Load Store Unit/LoadQ/Gate Leakage': 0.00059896,
'Load Store Unit/LoadQ/Peak Dynamic': 0.0804019,
'Load Store Unit/LoadQ/Runtime Dynamic': 0.0804019,
'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961,
'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918,
'Load Store Unit/Peak Dynamic': 4.10353,
'Load Store Unit/Runtime Dynamic': 1.67646,
'Load Store Unit/StoreQ/Area': 0.322079,
'Load Store Unit/StoreQ/Gate Leakage': 0.00329971,
'Load Store Unit/StoreQ/Peak Dynamic': 0.198257,
'Load Store Unit/StoreQ/Runtime Dynamic': 0.396515,
'Load Store Unit/StoreQ/Subthreshold Leakage': 0.0345621,
'Load Store Unit/StoreQ/Subthreshold Leakage with power gating': 0.0197004,
'Load Store Unit/Subthreshold Leakage': 0.591622,
'Load Store Unit/Subthreshold Leakage with power gating': 0.283406,
'Memory Management Unit/Area': 0.434579,
'Memory Management Unit/Dtlb/Area': 0.0879726,
'Memory Management Unit/Dtlb/Gate Leakage': 0.00088729,
'Memory Management Unit/Dtlb/Peak Dynamic': 0.0703622,
'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0704855,
'Memory Management Unit/Dtlb/Subthreshold Leakage': 0.0155699,
'Memory Management Unit/Dtlb/Subthreshold Leakage with power gating': 0.00887485,
'Memory Management Unit/Gate Leakage': 0.00813591,
'Memory Management Unit/Itlb/Area': 0.301552,
'Memory Management Unit/Itlb/Gate Leakage': 0.00393464,
'Memory Management Unit/Itlb/Peak Dynamic': 0.399995,
'Memory Management Unit/Itlb/Runtime Dynamic': 0.0571378,
'Memory Management Unit/Itlb/Subthreshold Leakage': 0.0413758,
'Memory Management Unit/Itlb/Subthreshold Leakage with power gating': 0.0235842,
'Memory Management Unit/Peak Dynamic': 0.680136,
'Memory Management Unit/Runtime Dynamic': 0.127623,
'Memory Management Unit/Subthreshold Leakage': 0.0769113,
'Memory Management Unit/Subthreshold Leakage with power gating': 0.0399462,
'Peak Dynamic': 23.9775,
'Renaming Unit/Area': 0.369768,
'Renaming Unit/FP Front End RAT/Area': 0.168486,
'Renaming Unit/FP Front End RAT/Gate Leakage': 0.00489731,
'Renaming Unit/FP Front End RAT/Peak Dynamic': 3.33511,
'Renaming Unit/FP Front End RAT/Runtime Dynamic': 0.0,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage': 0.0437281,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage with power gating': 0.024925,
'Renaming Unit/Free List/Area': 0.0414755,
'Renaming Unit/Free List/Gate Leakage': 4.15911e-05,
'Renaming Unit/Free List/Peak Dynamic': 0.0401324,
'Renaming Unit/Free List/Runtime Dynamic': 0.0203543,
'Renaming Unit/Free List/Subthreshold Leakage': 0.000670426,
'Renaming Unit/Free List/Subthreshold Leakage with power gating': 0.000377987,
'Renaming Unit/Gate Leakage': 0.00863632,
'Renaming Unit/Int Front End RAT/Area': 0.114751,
'Renaming Unit/Int Front End RAT/Gate Leakage': 0.00038343,
'Renaming Unit/Int Front End RAT/Peak Dynamic': 0.86945,
'Renaming Unit/Int Front End RAT/Runtime Dynamic': 0.207453,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage': 0.00611897,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00348781,
'Renaming Unit/Peak Dynamic': 4.56169,
'Renaming Unit/Runtime Dynamic': 0.227807,
'Renaming Unit/Subthreshold Leakage': 0.070483,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0362779,
'Runtime Dynamic': 5.75858,
'Subthreshold Leakage': 6.21877,
'Subthreshold Leakage with power gating': 2.58311},
{'Area': 32.0201,
'Execution Unit/Area': 7.68434,
'Execution Unit/Complex ALUs/Area': 0.235435,
'Execution Unit/Complex ALUs/Gate Leakage': 0.0132646,
'Execution Unit/Complex ALUs/Peak Dynamic': 0.0,
'Execution Unit/Complex ALUs/Runtime Dynamic': 0.202689,
'Execution Unit/Complex ALUs/Subthreshold Leakage': 0.20111,
'Execution Unit/Complex ALUs/Subthreshold Leakage with power gating': 0.0754163,
'Execution Unit/Floating Point Units/Area': 4.6585,
'Execution Unit/Floating Point Units/Gate Leakage': 0.0656156,
'Execution Unit/Floating Point Units/Peak Dynamic': 0.0,
'Execution Unit/Floating Point Units/Runtime Dynamic': 0.304033,
'Execution Unit/Floating Point Units/Subthreshold Leakage': 0.994829,
'Execution Unit/Floating Point Units/Subthreshold Leakage with power gating': 0.373061,
'Execution Unit/Gate Leakage': 0.120359,
'Execution Unit/Instruction Scheduler/Area': 1.66526,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Area': 0.275653,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Gate Leakage': 0.000977433,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Peak Dynamic': 1.04181,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Runtime Dynamic': 0.172918,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage': 0.0143453,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage with power gating': 0.00810519,
'Execution Unit/Instruction Scheduler/Gate Leakage': 0.00568913,
'Execution Unit/Instruction Scheduler/Instruction Window/Area': 0.805223,
'Execution Unit/Instruction Scheduler/Instruction Window/Gate Leakage': 0.00414562,
'Execution Unit/Instruction Scheduler/Instruction Window/Peak Dynamic': 1.6763,
'Execution Unit/Instruction Scheduler/Instruction Window/Runtime Dynamic': 0.27891,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage': 0.0625755,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage with power gating': 0.0355964,
'Execution Unit/Instruction Scheduler/Peak Dynamic': 3.82262,
'Execution Unit/Instruction Scheduler/ROB/Area': 0.584388,
'Execution Unit/Instruction Scheduler/ROB/Gate Leakage': 0.00056608,
'Execution Unit/Instruction Scheduler/ROB/Peak Dynamic': 1.10451,
'Execution Unit/Instruction Scheduler/ROB/Runtime Dynamic': 0.140784,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage': 0.00906853,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage with power gating': 0.00364446,
'Execution Unit/Instruction Scheduler/Runtime Dynamic': 0.592612,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage': 0.0859892,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage with power gating': 0.047346,
'Execution Unit/Integer ALUs/Area': 0.47087,
'Execution Unit/Integer ALUs/Gate Leakage': 0.0265291,
'Execution Unit/Integer ALUs/Peak Dynamic': 0.197769,
'Execution Unit/Integer ALUs/Runtime Dynamic': 0.101344,
'Execution Unit/Integer ALUs/Subthreshold Leakage': 0.40222,
'Execution Unit/Integer ALUs/Subthreshold Leakage with power gating': 0.150833,
'Execution Unit/Peak Dynamic': 4.20986,
'Execution Unit/Register Files/Area': 0.570804,
'Execution Unit/Register Files/Floating Point RF/Area': 0.208131,
'Execution Unit/Register Files/Floating Point RF/Gate Leakage': 0.000232788,
'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.0,
'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00725295,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage': 0.00399698,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage with power gating': 0.00176968,
'Execution Unit/Register Files/Gate Leakage': 0.000622708,
'Execution Unit/Register Files/Integer RF/Area': 0.362673,
'Execution Unit/Register Files/Integer RF/Gate Leakage': 0.00038992,
'Execution Unit/Register Files/Integer RF/Peak Dynamic': 0.0524482,
'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.05364,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage': 0.00614175,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage with power gating': 0.00246675,
'Execution Unit/Register Files/Peak Dynamic': 0.0524482,
'Execution Unit/Register Files/Runtime Dynamic': 0.060893,
'Execution Unit/Register Files/Subthreshold Leakage': 0.0101387,
'Execution Unit/Register Files/Subthreshold Leakage with power gating': 0.00423643,
'Execution Unit/Results Broadcast Bus/Area Overhead': 0.0390912,
'Execution Unit/Results Broadcast Bus/Gate Leakage': 0.00537402,
'Execution Unit/Results Broadcast Bus/Peak Dynamic': 0.110494,
'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.289484,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage': 0.081478,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage with power gating': 0.0305543,
'Execution Unit/Runtime Dynamic': 1.55105,
'Execution Unit/Subthreshold Leakage': 1.79543,
'Execution Unit/Subthreshold Leakage with power gating': 0.688821,
'Gate Leakage': 0.368936,
'Instruction Fetch Unit/Area': 5.85939,
'Instruction Fetch Unit/Branch Predictor/Area': 0.138516,
'Instruction Fetch Unit/Branch Predictor/Chooser/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Chooser/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Chooser/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Chooser/Runtime Dynamic': 0.00231727,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/Gate Leakage': 0.000757657,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Runtime Dynamic': 0.00231727,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Area': 0.0257064,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Gate Leakage': 0.000154548,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Peak Dynamic': 0.0142575,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Runtime Dynamic': 0.00210054,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage': 0.00384344,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage with power gating': 0.00198631,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Area': 0.0151917,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Gate Leakage': 8.00196e-05,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Peak Dynamic': 0.00527447,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Runtime Dynamic': 0.000858113,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage': 0.00181347,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage with power gating': 0.000957045,
'Instruction Fetch Unit/Branch Predictor/Peak Dynamic': 0.0597838,
'Instruction Fetch Unit/Branch Predictor/RAS/Area': 0.0105732,
'Instruction Fetch Unit/Branch Predictor/RAS/Gate Leakage': 4.63858e-05,
'Instruction Fetch Unit/Branch Predictor/RAS/Peak Dynamic': 0.0117602,
'Instruction Fetch Unit/Branch Predictor/RAS/Runtime Dynamic': 0.000770543,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage': 0.000932505,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage with power gating': 0.000494733,
'Instruction Fetch Unit/Branch Predictor/Runtime Dynamic': 0.00750563,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage': 0.0199703,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage with power gating': 0.0103282,
'Instruction Fetch Unit/Branch Target Buffer/Area': 0.64954,
'Instruction Fetch Unit/Branch Target Buffer/Gate Leakage': 0.00272758,
'Instruction Fetch Unit/Branch Target Buffer/Peak Dynamic': 0.177867,
'Instruction Fetch Unit/Branch Target Buffer/Runtime Dynamic': 0.0192808,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage': 0.0811682,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage with power gating': 0.0435357,
'Instruction Fetch Unit/Gate Leakage': 0.0589979,
'Instruction Fetch Unit/Instruction Buffer/Area': 0.0226323,
'Instruction Fetch Unit/Instruction Buffer/Gate Leakage': 6.83558e-05,
'Instruction Fetch Unit/Instruction Buffer/Peak Dynamic': 0.606827,
'Instruction Fetch Unit/Instruction Buffer/Runtime Dynamic': 0.0515655,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage': 0.00151885,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage with power gating': 0.000701682,
'Instruction Fetch Unit/Instruction Cache/Area': 3.14635,
'Instruction Fetch Unit/Instruction Cache/Gate Leakage': 0.029931,
'Instruction Fetch Unit/Instruction Cache/Peak Dynamic': 3.28001,
'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.174533,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage': 0.367022,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage with power gating': 0.180386,
'Instruction Fetch Unit/Instruction Decoder/Area': 1.85799,
'Instruction Fetch Unit/Instruction Decoder/Gate Leakage': 0.0222493,
'Instruction Fetch Unit/Instruction Decoder/Peak Dynamic': 1.37404,
'Instruction Fetch Unit/Instruction Decoder/Runtime Dynamic': 0.17514,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage': 0.442943,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage with power gating': 0.166104,
'Instruction Fetch Unit/Peak Dynamic': 5.65771,
'Instruction Fetch Unit/Runtime Dynamic': 0.428024,
'Instruction Fetch Unit/Subthreshold Leakage': 0.932286,
'Instruction Fetch Unit/Subthreshold Leakage with power gating': 0.40843,
'L2/Area': 4.53318,
'L2/Gate Leakage': 0.015464,
'L2/Peak Dynamic': 0.00668734,
'L2/Runtime Dynamic': 0.00210046,
'L2/Subthreshold Leakage': 0.834142,
'L2/Subthreshold Leakage with power gating': 0.401066,
'Load Store Unit/Area': 8.80901,
'Load Store Unit/Data Cache/Area': 6.84535,
'Load Store Unit/Data Cache/Gate Leakage': 0.0279261,
'Load Store Unit/Data Cache/Peak Dynamic': 2.48583,
'Load Store Unit/Data Cache/Runtime Dynamic': 0.602875,
'Load Store Unit/Data Cache/Subthreshold Leakage': 0.527675,
'Load Store Unit/Data Cache/Subthreshold Leakage with power gating': 0.25085,
'Load Store Unit/Gate Leakage': 0.0350888,
'Load Store Unit/LoadQ/Area': 0.0836782,
'Load Store Unit/LoadQ/Gate Leakage': 0.00059896,
'Load Store Unit/LoadQ/Peak Dynamic': 0.0403988,
'Load Store Unit/LoadQ/Runtime Dynamic': 0.0403987,
'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961,
'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918,
'Load Store Unit/Peak Dynamic': 2.6766,
'Load Store Unit/Runtime Dynamic': 0.842506,
'Load Store Unit/StoreQ/Area': 0.322079,
'Load Store Unit/StoreQ/Gate Leakage': 0.00329971,
'Load Store Unit/StoreQ/Peak Dynamic': 0.0996164,
'Load Store Unit/StoreQ/Runtime Dynamic': 0.199232,
'Load Store Unit/StoreQ/Subthreshold Leakage': 0.0345621,
'Load Store Unit/StoreQ/Subthreshold Leakage with power gating': 0.0197004,
'Load Store Unit/Subthreshold Leakage': 0.591321,
'Load Store Unit/Subthreshold Leakage with power gating': 0.283293,
'Memory Management Unit/Area': 0.4339,
'Memory Management Unit/Dtlb/Area': 0.0879726,
'Memory Management Unit/Dtlb/Gate Leakage': 0.00088729,
'Memory Management Unit/Dtlb/Peak Dynamic': 0.0353542,
'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0354206,
'Memory Management Unit/Dtlb/Subthreshold Leakage': 0.0155699,
'Memory Management Unit/Dtlb/Subthreshold Leakage with power gating': 0.00887485,
'Memory Management Unit/Gate Leakage': 0.00808595,
'Memory Management Unit/Itlb/Area': 0.301552,
'Memory Management Unit/Itlb/Gate Leakage': 0.00393464,
'Memory Management Unit/Itlb/Peak Dynamic': 0.203939,
'Memory Management Unit/Itlb/Runtime Dynamic': 0.0287124,
'Memory Management Unit/Itlb/Subthreshold Leakage': 0.0413758,
'Memory Management Unit/Itlb/Subthreshold Leakage with power gating': 0.0235842,
'Memory Management Unit/Peak Dynamic': 0.42078,
'Memory Management Unit/Runtime Dynamic': 0.064133,
'Memory Management Unit/Subthreshold Leakage': 0.0766103,
'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333,
'Peak Dynamic': 16.5611,
'Renaming Unit/Area': 0.303608,
'Renaming Unit/FP Front End RAT/Area': 0.131045,
'Renaming Unit/FP Front End RAT/Gate Leakage': 0.00351123,
'Renaming Unit/FP Front End RAT/Peak Dynamic': 2.51468,
'Renaming Unit/FP Front End RAT/Runtime Dynamic': 0.0,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage': 0.0308571,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage with power gating': 0.0175885,
'Renaming Unit/Free List/Area': 0.0340654,
'Renaming Unit/Free List/Gate Leakage': 2.5481e-05,
'Renaming Unit/Free List/Peak Dynamic': 0.0306032,
'Renaming Unit/Free List/Runtime Dynamic': 0.00780158,
'Renaming Unit/Free List/Subthreshold Leakage': 0.000370144,
'Renaming Unit/Free List/Subthreshold Leakage with power gating': 0.000201064,
'Renaming Unit/Gate Leakage': 0.00708398,
'Renaming Unit/Int Front End RAT/Area': 0.0941223,
'Renaming Unit/Int Front End RAT/Gate Leakage': 0.000283242,
'Renaming Unit/Int Front End RAT/Peak Dynamic': 0.731965,
'Renaming Unit/Int Front End RAT/Runtime Dynamic': 0.088257,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage': 0.00435488,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228,
'Renaming Unit/Peak Dynamic': 3.58947,
'Renaming Unit/Runtime Dynamic': 0.0960586,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic': 2.98388,
'Subthreshold Leakage': 6.16288,
'Subthreshold Leakage with power gating': 2.55328},
{'Area': 32.0201,
'Execution Unit/Area': 7.68434,
'Execution Unit/Complex ALUs/Area': 0.235435,
'Execution Unit/Complex ALUs/Gate Leakage': 0.0132646,
'Execution Unit/Complex ALUs/Peak Dynamic': 0.0,
'Execution Unit/Complex ALUs/Runtime Dynamic': 0.202689,
'Execution Unit/Complex ALUs/Subthreshold Leakage': 0.20111,
'Execution Unit/Complex ALUs/Subthreshold Leakage with power gating': 0.0754163,
'Execution Unit/Floating Point Units/Area': 4.6585,
'Execution Unit/Floating Point Units/Gate Leakage': 0.0656156,
'Execution Unit/Floating Point Units/Peak Dynamic': 0.0,
'Execution Unit/Floating Point Units/Runtime Dynamic': 0.304033,
'Execution Unit/Floating Point Units/Subthreshold Leakage': 0.994829,
'Execution Unit/Floating Point Units/Subthreshold Leakage with power gating': 0.373061,
'Execution Unit/Gate Leakage': 0.120359,
'Execution Unit/Instruction Scheduler/Area': 1.66526,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Area': 0.275653,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Gate Leakage': 0.000977433,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Peak Dynamic': 1.04181,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Runtime Dynamic': 0.17342,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage': 0.0143453,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage with power gating': 0.00810519,
'Execution Unit/Instruction Scheduler/Gate Leakage': 0.00568913,
'Execution Unit/Instruction Scheduler/Instruction Window/Area': 0.805223,
'Execution Unit/Instruction Scheduler/Instruction Window/Gate Leakage': 0.00414562,
'Execution Unit/Instruction Scheduler/Instruction Window/Peak Dynamic': 1.6763,
'Execution Unit/Instruction Scheduler/Instruction Window/Runtime Dynamic': 0.27972,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage': 0.0625755,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage with power gating': 0.0355964,
'Execution Unit/Instruction Scheduler/Peak Dynamic': 3.82262,
'Execution Unit/Instruction Scheduler/ROB/Area': 0.584388,
'Execution Unit/Instruction Scheduler/ROB/Gate Leakage': 0.00056608,
'Execution Unit/Instruction Scheduler/ROB/Peak Dynamic': 1.10451,
'Execution Unit/Instruction Scheduler/ROB/Runtime Dynamic': 0.141193,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage': 0.00906853,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage with power gating': 0.00364446,
'Execution Unit/Instruction Scheduler/Runtime Dynamic': 0.594333,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage': 0.0859892,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage with power gating': 0.047346,
'Execution Unit/Integer ALUs/Area': 0.47087,
'Execution Unit/Integer ALUs/Gate Leakage': 0.0265291,
'Execution Unit/Integer ALUs/Peak Dynamic': 0.198341,
'Execution Unit/Integer ALUs/Runtime Dynamic': 0.101344,
'Execution Unit/Integer ALUs/Subthreshold Leakage': 0.40222,
'Execution Unit/Integer ALUs/Subthreshold Leakage with power gating': 0.150833,
'Execution Unit/Peak Dynamic': 4.21098,
'Execution Unit/Register Files/Area': 0.570804,
'Execution Unit/Register Files/Floating Point RF/Area': 0.208131,
'Execution Unit/Register Files/Floating Point RF/Gate Leakage': 0.000232788,
'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.0,
'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00727401,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage': 0.00399698,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage with power gating': 0.00176968,
'Execution Unit/Register Files/Gate Leakage': 0.000622708,
'Execution Unit/Register Files/Integer RF/Area': 0.362673,
'Execution Unit/Register Files/Integer RF/Gate Leakage': 0.00038992,
'Execution Unit/Register Files/Integer RF/Peak Dynamic': 0.0526,
'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0537958,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage': 0.00614175,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage with power gating': 0.00246675,
'Execution Unit/Register Files/Peak Dynamic': 0.0526,
'Execution Unit/Register Files/Runtime Dynamic': 0.0610698,
'Execution Unit/Register Files/Subthreshold Leakage': 0.0101387,
'Execution Unit/Register Files/Subthreshold Leakage with power gating': 0.00423643,
'Execution Unit/Results Broadcast Bus/Area Overhead': 0.0390912,
'Execution Unit/Results Broadcast Bus/Gate Leakage': 0.00537402,
'Execution Unit/Results Broadcast Bus/Peak Dynamic': 0.110814,
'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.290296,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage': 0.081478,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage with power gating': 0.0305543,
'Execution Unit/Runtime Dynamic': 1.55377,
'Execution Unit/Subthreshold Leakage': 1.79543,
'Execution Unit/Subthreshold Leakage with power gating': 0.688821,
'Gate Leakage': 0.368936,
'Instruction Fetch Unit/Area': 5.85939,
'Instruction Fetch Unit/Branch Predictor/Area': 0.138516,
'Instruction Fetch Unit/Branch Predictor/Chooser/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Chooser/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Chooser/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Chooser/Runtime Dynamic': 0.00232294,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/Gate Leakage': 0.000757657,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Runtime Dynamic': 0.00232294,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Area': 0.0257064,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Gate Leakage': 0.000154548,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Peak Dynamic': 0.0142575,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Runtime Dynamic': 0.00210565,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage': 0.00384344,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage with power gating': 0.00198631,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Area': 0.0151917,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Gate Leakage': 8.00196e-05,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Peak Dynamic': 0.00527447,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Runtime Dynamic': 0.000860183,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage': 0.00181347,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage with power gating': 0.000957045,
'Instruction Fetch Unit/Branch Predictor/Peak Dynamic': 0.0597838,
'Instruction Fetch Unit/Branch Predictor/RAS/Area': 0.0105732,
'Instruction Fetch Unit/Branch Predictor/RAS/Gate Leakage': 4.63858e-05,
'Instruction Fetch Unit/Branch Predictor/RAS/Peak Dynamic': 0.0117602,
'Instruction Fetch Unit/Branch Predictor/RAS/Runtime Dynamic': 0.000772781,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage': 0.000932505,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage with power gating': 0.000494733,
'Instruction Fetch Unit/Branch Predictor/Runtime Dynamic': 0.00752432,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage': 0.0199703,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage with power gating': 0.0103282,
'Instruction Fetch Unit/Branch Target Buffer/Area': 0.64954,
'Instruction Fetch Unit/Branch Target Buffer/Gate Leakage': 0.00272758,
'Instruction Fetch Unit/Branch Target Buffer/Peak Dynamic': 0.177867,
'Instruction Fetch Unit/Branch Target Buffer/Runtime Dynamic': 0.0193292,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage': 0.0811682,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage with power gating': 0.0435357,
'Instruction Fetch Unit/Gate Leakage': 0.0589979,
'Instruction Fetch Unit/Instruction Buffer/Area': 0.0226323,
'Instruction Fetch Unit/Instruction Buffer/Gate Leakage': 6.83558e-05,
'Instruction Fetch Unit/Instruction Buffer/Peak Dynamic': 0.606827,
'Instruction Fetch Unit/Instruction Buffer/Runtime Dynamic': 0.0517153,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage': 0.00151885,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage with power gating': 0.000701682,
'Instruction Fetch Unit/Instruction Cache/Area': 3.14635,
'Instruction Fetch Unit/Instruction Cache/Gate Leakage': 0.029931,
'Instruction Fetch Unit/Instruction Cache/Peak Dynamic': 3.28954,
'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.174827,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage': 0.367022,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage with power gating': 0.180386,
'Instruction Fetch Unit/Instruction Decoder/Area': 1.85799,
'Instruction Fetch Unit/Instruction Decoder/Gate Leakage': 0.0222493,
'Instruction Fetch Unit/Instruction Decoder/Peak Dynamic': 1.37404,
'Instruction Fetch Unit/Instruction Decoder/Runtime Dynamic': 0.175648,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage': 0.442943,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage with power gating': 0.166104,
'Instruction Fetch Unit/Peak Dynamic': 5.6677,
'Instruction Fetch Unit/Runtime Dynamic': 0.429044,
'Instruction Fetch Unit/Subthreshold Leakage': 0.932286,
'Instruction Fetch Unit/Subthreshold Leakage with power gating': 0.40843,
'L2/Area': 4.53318,
'L2/Gate Leakage': 0.015464,
'L2/Peak Dynamic': 0.00641252,
'L2/Runtime Dynamic': 0.00203156,
'L2/Subthreshold Leakage': 0.834142,
'L2/Subthreshold Leakage with power gating': 0.401066,
'Load Store Unit/Area': 8.80901,
'Load Store Unit/Data Cache/Area': 6.84535,
'Load Store Unit/Data Cache/Gate Leakage': 0.0279261,
'Load Store Unit/Data Cache/Peak Dynamic': 2.48824,
'Load Store Unit/Data Cache/Runtime Dynamic': 0.603977,
'Load Store Unit/Data Cache/Subthreshold Leakage': 0.527675,
'Load Store Unit/Data Cache/Subthreshold Leakage with power gating': 0.25085,
'Load Store Unit/Gate Leakage': 0.0350888,
'Load Store Unit/LoadQ/Area': 0.0836782,
'Load Store Unit/LoadQ/Gate Leakage': 0.00059896,
'Load Store Unit/LoadQ/Peak Dynamic': 0.0404768,
'Load Store Unit/LoadQ/Runtime Dynamic': 0.0404768,
'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961,
'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918,
'Load Store Unit/Peak Dynamic': 2.67938,
'Load Store Unit/Runtime Dynamic': 0.844071,
'Load Store Unit/StoreQ/Area': 0.322079,
'Load Store Unit/StoreQ/Gate Leakage': 0.00329971,
'Load Store Unit/StoreQ/Peak Dynamic': 0.0998089,
'Load Store Unit/StoreQ/Runtime Dynamic': 0.199618,
'Load Store Unit/StoreQ/Subthreshold Leakage': 0.0345621,
'Load Store Unit/StoreQ/Subthreshold Leakage with power gating': 0.0197004,
'Load Store Unit/Subthreshold Leakage': 0.591321,
'Load Store Unit/Subthreshold Leakage with power gating': 0.283293,
'Memory Management Unit/Area': 0.4339,
'Memory Management Unit/Dtlb/Area': 0.0879726,
'Memory Management Unit/Dtlb/Gate Leakage': 0.00088729,
'Memory Management Unit/Dtlb/Peak Dynamic': 0.0354225,
'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0354872,
'Memory Management Unit/Dtlb/Subthreshold Leakage': 0.0155699,
'Memory Management Unit/Dtlb/Subthreshold Leakage with power gating': 0.00887485,
'Memory Management Unit/Gate Leakage': 0.00808595,
'Memory Management Unit/Itlb/Area': 0.301552,
'Memory Management Unit/Itlb/Gate Leakage': 0.00393464,
'Memory Management Unit/Itlb/Peak Dynamic': 0.204531,
'Memory Management Unit/Itlb/Runtime Dynamic': 0.0287537,
'Memory Management Unit/Itlb/Subthreshold Leakage': 0.0413758,
'Memory Management Unit/Itlb/Subthreshold Leakage with power gating': 0.0235842,
'Memory Management Unit/Peak Dynamic': 0.42149,
'Memory Management Unit/Runtime Dynamic': 0.0642409,
'Memory Management Unit/Subthreshold Leakage': 0.0766103,
'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333,
'Peak Dynamic': 16.5754,
'Renaming Unit/Area': 0.303608,
'Renaming Unit/FP Front End RAT/Area': 0.131045,
'Renaming Unit/FP Front End RAT/Gate Leakage': 0.00351123,
'Renaming Unit/FP Front End RAT/Peak Dynamic': 2.51468,
'Renaming Unit/FP Front End RAT/Runtime Dynamic': 0.0,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage': 0.0308571,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage with power gating': 0.0175885,
'Renaming Unit/Free List/Area': 0.0340654,
'Renaming Unit/Free List/Gate Leakage': 2.5481e-05,
'Renaming Unit/Free List/Peak Dynamic': 0.0306032,
'Renaming Unit/Free List/Runtime Dynamic': 0.00782423,
'Renaming Unit/Free List/Subthreshold Leakage': 0.000370144,
'Renaming Unit/Free List/Subthreshold Leakage with power gating': 0.000201064,
'Renaming Unit/Gate Leakage': 0.00708398,
'Renaming Unit/Int Front End RAT/Area': 0.0941223,
'Renaming Unit/Int Front End RAT/Gate Leakage': 0.000283242,
'Renaming Unit/Int Front End RAT/Peak Dynamic': 0.731965,
'Renaming Unit/Int Front End RAT/Runtime Dynamic': 0.0885153,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage': 0.00435488,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228,
'Renaming Unit/Peak Dynamic': 3.58947,
'Renaming Unit/Runtime Dynamic': 0.0963395,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic': 2.98949,
'Subthreshold Leakage': 6.16288,
'Subthreshold Leakage with power gating': 2.55328},
{'Area': 32.0201,
'Execution Unit/Area': 7.68434,
'Execution Unit/Complex ALUs/Area': 0.235435,
'Execution Unit/Complex ALUs/Gate Leakage': 0.0132646,
'Execution Unit/Complex ALUs/Peak Dynamic': 0.0,
'Execution Unit/Complex ALUs/Runtime Dynamic': 0.202689,
'Execution Unit/Complex ALUs/Subthreshold Leakage': 0.20111,
'Execution Unit/Complex ALUs/Subthreshold Leakage with power gating': 0.0754163,
'Execution Unit/Floating Point Units/Area': 4.6585,
'Execution Unit/Floating Point Units/Gate Leakage': 0.0656156,
'Execution Unit/Floating Point Units/Peak Dynamic': 0.0,
'Execution Unit/Floating Point Units/Runtime Dynamic': 0.304033,
'Execution Unit/Floating Point Units/Subthreshold Leakage': 0.994829,
'Execution Unit/Floating Point Units/Subthreshold Leakage with power gating': 0.373061,
'Execution Unit/Gate Leakage': 0.120359,
'Execution Unit/Instruction Scheduler/Area': 1.66526,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Area': 0.275653,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Gate Leakage': 0.000977433,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Peak Dynamic': 1.04181,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Runtime Dynamic': 0.172891,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage': 0.0143453,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage with power gating': 0.00810519,
'Execution Unit/Instruction Scheduler/Gate Leakage': 0.00568913,
'Execution Unit/Instruction Scheduler/Instruction Window/Area': 0.805223,
'Execution Unit/Instruction Scheduler/Instruction Window/Gate Leakage': 0.00414562,
'Execution Unit/Instruction Scheduler/Instruction Window/Peak Dynamic': 1.6763,
'Execution Unit/Instruction Scheduler/Instruction Window/Runtime Dynamic': 0.278866,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage': 0.0625755,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage with power gating': 0.0355964,
'Execution Unit/Instruction Scheduler/Peak Dynamic': 3.82262,
'Execution Unit/Instruction Scheduler/ROB/Area': 0.584388,
'Execution Unit/Instruction Scheduler/ROB/Gate Leakage': 0.00056608,
'Execution Unit/Instruction Scheduler/ROB/Peak Dynamic': 1.10451,
'Execution Unit/Instruction Scheduler/ROB/Runtime Dynamic': 0.140762,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage': 0.00906853,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage with power gating': 0.00364446,
'Execution Unit/Instruction Scheduler/Runtime Dynamic': 0.59252,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage': 0.0859892,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage with power gating': 0.047346,
'Execution Unit/Integer ALUs/Area': 0.47087,
'Execution Unit/Integer ALUs/Gate Leakage': 0.0265291,
'Execution Unit/Integer ALUs/Peak Dynamic': 0.197736,
'Execution Unit/Integer ALUs/Runtime Dynamic': 0.101344,
'Execution Unit/Integer ALUs/Subthreshold Leakage': 0.40222,
'Execution Unit/Integer ALUs/Subthreshold Leakage with power gating': 0.150833,
'Execution Unit/Peak Dynamic': 4.2098,
'Execution Unit/Register Files/Area': 0.570804,
'Execution Unit/Register Files/Floating Point RF/Area': 0.208131,
'Execution Unit/Register Files/Floating Point RF/Gate Leakage': 0.000232788,
'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.0,
'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00725182,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage': 0.00399698,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage with power gating': 0.00176968,
'Execution Unit/Register Files/Gate Leakage': 0.000622708,
'Execution Unit/Register Files/Integer RF/Area': 0.362673,
'Execution Unit/Register Files/Integer RF/Gate Leakage': 0.00038992,
'Execution Unit/Register Files/Integer RF/Peak Dynamic': 0.0524396,
'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0536316,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage': 0.00614175,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage with power gating': 0.00246675,
'Execution Unit/Register Files/Peak Dynamic': 0.0524396,
'Execution Unit/Register Files/Runtime Dynamic': 0.0608834,
'Execution Unit/Register Files/Subthreshold Leakage': 0.0101387,
'Execution Unit/Register Files/Subthreshold Leakage with power gating': 0.00423643,
'Execution Unit/Results Broadcast Bus/Area Overhead': 0.0390912,
'Execution Unit/Results Broadcast Bus/Gate Leakage': 0.00537402,
'Execution Unit/Results Broadcast Bus/Peak Dynamic': 0.110475,
'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.289485,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage': 0.081478,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage with power gating': 0.0305543,
'Execution Unit/Runtime Dynamic': 1.55095,
'Execution Unit/Subthreshold Leakage': 1.79543,
'Execution Unit/Subthreshold Leakage with power gating': 0.688821,
'Gate Leakage': 0.368936,
'Instruction Fetch Unit/Area': 5.85939,
'Instruction Fetch Unit/Branch Predictor/Area': 0.138516,
'Instruction Fetch Unit/Branch Predictor/Chooser/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Chooser/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Chooser/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Chooser/Runtime Dynamic': 0.00231872,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/Gate Leakage': 0.000757657,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Runtime Dynamic': 0.00231872,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Area': 0.0257064,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Gate Leakage': 0.000154548,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Peak Dynamic': 0.0142575,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Runtime Dynamic': 0.00210203,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage': 0.00384344,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage with power gating': 0.00198631,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Area': 0.0151917,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Gate Leakage': 8.00196e-05,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Peak Dynamic': 0.00527447,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Runtime Dynamic': 0.000858816,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage': 0.00181347,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage with power gating': 0.000957045,
'Instruction Fetch Unit/Branch Predictor/Peak Dynamic': 0.0597838,
'Instruction Fetch Unit/Branch Predictor/RAS/Area': 0.0105732,
'Instruction Fetch Unit/Branch Predictor/RAS/Gate Leakage': 4.63858e-05,
'Instruction Fetch Unit/Branch Predictor/RAS/Peak Dynamic': 0.0117602,
'Instruction Fetch Unit/Branch Predictor/RAS/Runtime Dynamic': 0.000770423,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage': 0.000932505,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage with power gating': 0.000494733,
'Instruction Fetch Unit/Branch Predictor/Runtime Dynamic': 0.0075099,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage': 0.0199703,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage with power gating': 0.0103282,
'Instruction Fetch Unit/Branch Target Buffer/Area': 0.64954,
'Instruction Fetch Unit/Branch Target Buffer/Gate Leakage': 0.00272758,
'Instruction Fetch Unit/Branch Target Buffer/Peak Dynamic': 0.177867,
'Instruction Fetch Unit/Branch Target Buffer/Runtime Dynamic': 0.0192865,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage': 0.0811682,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage with power gating': 0.0435357,
'Instruction Fetch Unit/Gate Leakage': 0.0589979,
'Instruction Fetch Unit/Instruction Buffer/Area': 0.0226323,
'Instruction Fetch Unit/Instruction Buffer/Gate Leakage': 6.83558e-05,
'Instruction Fetch Unit/Instruction Buffer/Peak Dynamic': 0.606827,
'Instruction Fetch Unit/Instruction Buffer/Runtime Dynamic': 0.0515575,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage': 0.00151885,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage with power gating': 0.000701682,
'Instruction Fetch Unit/Instruction Cache/Area': 3.14635,
'Instruction Fetch Unit/Instruction Cache/Gate Leakage': 0.029931,
'Instruction Fetch Unit/Instruction Cache/Peak Dynamic': 3.27949,
'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.17487,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage': 0.367022,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage with power gating': 0.180386,
'Instruction Fetch Unit/Instruction Decoder/Area': 1.85799,
'Instruction Fetch Unit/Instruction Decoder/Gate Leakage': 0.0222493,
'Instruction Fetch Unit/Instruction Decoder/Peak Dynamic': 1.37404,
'Instruction Fetch Unit/Instruction Decoder/Runtime Dynamic': 0.175112,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage': 0.442943,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage with power gating': 0.166104,
'Instruction Fetch Unit/Peak Dynamic': 5.65717,
'Instruction Fetch Unit/Runtime Dynamic': 0.428336,
'Instruction Fetch Unit/Subthreshold Leakage': 0.932286,
'Instruction Fetch Unit/Subthreshold Leakage with power gating': 0.40843,
'L2/Area': 4.53318,
'L2/Gate Leakage': 0.015464,
'L2/Peak Dynamic': 0.00635145,
'L2/Runtime Dynamic': 0.00200557,
'L2/Subthreshold Leakage': 0.834142,
'L2/Subthreshold Leakage with power gating': 0.401066,
'Load Store Unit/Area': 8.80901,
'Load Store Unit/Data Cache/Area': 6.84535,
'Load Store Unit/Data Cache/Gate Leakage': 0.0279261,
'Load Store Unit/Data Cache/Peak Dynamic': 2.48542,
'Load Store Unit/Data Cache/Runtime Dynamic': 0.602622,
'Load Store Unit/Data Cache/Subthreshold Leakage': 0.527675,
'Load Store Unit/Data Cache/Subthreshold Leakage with power gating': 0.25085,
'Load Store Unit/Gate Leakage': 0.0350888,
'Load Store Unit/LoadQ/Area': 0.0836782,
'Load Store Unit/LoadQ/Gate Leakage': 0.00059896,
'Load Store Unit/LoadQ/Peak Dynamic': 0.0403853,
'Load Store Unit/LoadQ/Runtime Dynamic': 0.0403852,
'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961,
'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918,
'Load Store Unit/Peak Dynamic': 2.67612,
'Load Store Unit/Runtime Dynamic': 0.842173,
'Load Store Unit/StoreQ/Area': 0.322079,
'Load Store Unit/StoreQ/Gate Leakage': 0.00329971,
'Load Store Unit/StoreQ/Peak Dynamic': 0.0995834,
'Load Store Unit/StoreQ/Runtime Dynamic': 0.199166,
'Load Store Unit/StoreQ/Subthreshold Leakage': 0.0345621,
'Load Store Unit/StoreQ/Subthreshold Leakage with power gating': 0.0197004,
'Load Store Unit/Subthreshold Leakage': 0.591321,
'Load Store Unit/Subthreshold Leakage with power gating': 0.283293,
'Memory Management Unit/Area': 0.4339,
'Memory Management Unit/Dtlb/Area': 0.0879726,
'Memory Management Unit/Dtlb/Gate Leakage': 0.00088729,
'Memory Management Unit/Dtlb/Peak Dynamic': 0.0353425,
'Memory Management Unit/Dtlb/Runtime Dynamic': 0.035407,
'Memory Management Unit/Dtlb/Subthreshold Leakage': 0.0155699,
'Memory Management Unit/Dtlb/Subthreshold Leakage with power gating': 0.00887485,
'Memory Management Unit/Gate Leakage': 0.00808595,
'Memory Management Unit/Itlb/Area': 0.301552,
'Memory Management Unit/Itlb/Gate Leakage': 0.00393464,
'Memory Management Unit/Itlb/Peak Dynamic': 0.203907,
'Memory Management Unit/Itlb/Runtime Dynamic': 0.0287582,
'Memory Management Unit/Itlb/Subthreshold Leakage': 0.0413758,
'Memory Management Unit/Itlb/Subthreshold Leakage with power gating': 0.0235842,
'Memory Management Unit/Peak Dynamic': 0.420728,
'Memory Management Unit/Runtime Dynamic': 0.0641652,
'Memory Management Unit/Subthreshold Leakage': 0.0766103,
'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333,
'Peak Dynamic': 16.5596,
'Renaming Unit/Area': 0.303608,
'Renaming Unit/FP Front End RAT/Area': 0.131045,
'Renaming Unit/FP Front End RAT/Gate Leakage': 0.00351123,
'Renaming Unit/FP Front End RAT/Peak Dynamic': 2.51468,
'Renaming Unit/FP Front End RAT/Runtime Dynamic': 0.0,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage': 0.0308571,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage with power gating': 0.0175885,
'Renaming Unit/Free List/Area': 0.0340654,
'Renaming Unit/Free List/Gate Leakage': 2.5481e-05,
'Renaming Unit/Free List/Peak Dynamic': 0.0306032,
'Renaming Unit/Free List/Runtime Dynamic': 0.00780036,
'Renaming Unit/Free List/Subthreshold Leakage': 0.000370144,
'Renaming Unit/Free List/Subthreshold Leakage with power gating': 0.000201064,
'Renaming Unit/Gate Leakage': 0.00708398,
'Renaming Unit/Int Front End RAT/Area': 0.0941223,
'Renaming Unit/Int Front End RAT/Gate Leakage': 0.000283242,
'Renaming Unit/Int Front End RAT/Peak Dynamic': 0.731965,
'Renaming Unit/Int Front End RAT/Runtime Dynamic': 0.0882409,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage': 0.00435488,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228,
'Renaming Unit/Peak Dynamic': 3.58947,
'Renaming Unit/Runtime Dynamic': 0.0960413,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic': 2.98367,
'Subthreshold Leakage': 6.16288,
'Subthreshold Leakage with power gating': 2.55328}],
'DRAM': {'Area': 0,
'Gate Leakage': 0,
'Peak Dynamic': 0.40658959087042323,
'Runtime Dynamic': 0.40658959087042323,
'Subthreshold Leakage': 4.252,
'Subthreshold Leakage with power gating': 4.252},
'L3': [{'Area': 61.9075,
'Gate Leakage': 0.0484137,
'Peak Dynamic': 0.033795,
'Runtime Dynamic': 0.0199046,
'Subthreshold Leakage': 6.80085,
'Subthreshold Leakage with power gating': 3.32364}],
'Processor': {'Area': 191.908,
'Gate Leakage': 1.53485,
'Peak Dynamic': 73.7075,
'Peak Power': 106.82,
'Runtime Dynamic': 14.7355,
'Subthreshold Leakage': 31.5774,
'Subthreshold Leakage with power gating': 13.9484,
'Total Cores/Area': 128.669,
'Total Cores/Gate Leakage': 1.4798,
'Total Cores/Peak Dynamic': 73.6737,
'Total Cores/Runtime Dynamic': 14.7156,
'Total Cores/Subthreshold Leakage': 24.7074,
'Total Cores/Subthreshold Leakage with power gating': 10.2429,
'Total L3s/Area': 61.9075,
'Total L3s/Gate Leakage': 0.0484137,
'Total L3s/Peak Dynamic': 0.033795,
'Total L3s/Runtime Dynamic': 0.0199046,
'Total L3s/Subthreshold Leakage': 6.80085,
'Total L3s/Subthreshold Leakage with power gating': 3.32364,
'Total Leakage': 33.1122,
'Total NoCs/Area': 1.33155,
'Total NoCs/Gate Leakage': 0.00662954,
'Total NoCs/Peak Dynamic': 0.0,
'Total NoCs/Runtime Dynamic': 0.0,
'Total NoCs/Subthreshold Leakage': 0.0691322,
'Total NoCs/Subthreshold Leakage with power gating': 0.0259246}} | [
6477,
796,
1391,
6,
45346,
1546,
10354,
1391,
6,
30547,
10354,
352,
13,
2091,
18742,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
16286,
14,
30547,
10354,
352,
13,
2091,
18742,
11,
198,
220,
220,
220,
220,
220,
... | 2.342059 | 29,261 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-13 22:10
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import folder_tree.models
import mptt.fields
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2980,
515,
416,
37770,
352,
13,
940,
13,
18,
319,
1584,
12,
1065,
12,
1485,
2534,
25,
940,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
1... | 2.934066 | 91 |
from __future__ import absolute_import
# flake8: noqa
# import apis
from groupdocs_viewer_cloud.apis.file_api import FileApi
from groupdocs_viewer_cloud.apis.folder_api import FolderApi
from groupdocs_viewer_cloud.apis.info_api import InfoApi
from groupdocs_viewer_cloud.apis.license_api import LicenseApi
from groupdocs_viewer_cloud.apis.storage_api import StorageApi
from groupdocs_viewer_cloud.apis.view_api import ViewApi
| [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
198,
2,
781,
539,
23,
25,
645,
20402,
198,
198,
2,
1330,
2471,
271,
198,
6738,
1448,
31628,
62,
1177,
263,
62,
17721,
13,
499,
271,
13,
7753,
62,
15042,
1330,
9220,
32,
14415,
1... | 2.972222 | 144 |
from models.wrap_mobilenet import *
from models.wrap_resnet import *
from models.wrap_vgg import *
from models.wrap_alexnet import * | [
6738,
4981,
13,
37150,
62,
76,
25898,
268,
316,
1330,
1635,
198,
6738,
4981,
13,
37150,
62,
411,
3262,
1330,
1635,
198,
6738,
4981,
13,
37150,
62,
85,
1130,
1330,
1635,
198,
6738,
4981,
13,
37150,
62,
1000,
87,
3262,
1330,
1635
] | 3.142857 | 42 |
import torch
import torch.nn as nn
from NeuralBlocks.blocks.convnormrelu import ConvNormRelu
if __name__ == "__main__":
s = SegNet(3, 10, norm = 'BN')
inp = torch.randn(32,3,128, 128) #M x C x H x W
s.train()
result = s(inp)
| [
11748,
28034,
198,
11748,
28034,
13,
20471,
355,
299,
77,
198,
6738,
47986,
45356,
13,
27372,
13,
42946,
27237,
260,
2290,
1330,
34872,
35393,
6892,
84,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
... | 2.333333 | 105 |
#!/usr/bin/python
# This script derived from a piece of the rubber project
# http://launchpad.net/rubber
# (c) Emmanuel Beffara, 2002--2006
#
# Modified by Nathan Grigg, January 2012
import re
import string
import sys
import getopt
#---- Log parser ----{{{1
re_loghead = re.compile("This is [0-9a-zA-Z-]*")
re_rerun = re.compile("LaTeX Warning:.*Rerun")
re_file = re.compile("(\\((?P<file>[^\n\t(){}]*[^ \n\t(){}])|\\))")
re_badbox = re.compile(r"(Ov|Und)erfull \\[hv]box ")
re_line = re.compile(r"(l\.(?P<line>[0-9]+)( (?P<code>.*))?$|<\*>)")
re_cseq = re.compile(r".*(?P<seq>(\\|\.\.\.)[^ ]*) ?$")
re_macro = re.compile(r"^(?P<macro>\\.*) ->")
re_page = re.compile("\[(?P<num>[0-9]+)\]")
re_atline = re.compile(
"( detected| in paragraph)? at lines? (?P<line>[0-9]*)(--(?P<last>[0-9]*))?")
re_reference = re.compile("LaTeX Warning: Reference `(?P<ref>.*)' \
on page (?P<page>[0-9]*) undefined on input line (?P<line>[0-9]*)\\.$")
re_label = re.compile("LaTeX Warning: (?P<text>Label .*)$")
re_warning = re.compile(
"(LaTeX|Package)( (?P<pkg>.*))? Warning: (?P<text>.*)$")
re_online = re.compile("(; reported)? on input line (?P<line>[0-9]*)")
re_ignored = re.compile("; all text was ignored after line (?P<line>[0-9]*).$")
# command line options
def parse_options(cmdline):
try:
opts, args = getopt.getopt(
cmdline, "h", ["boxes","errors","help","refs","warnings"])
except getopt.GetoptError, e:
sys.stderr.write(e.msg + "\n")
sys.exit(1)
d = {"boxes": 0, "errors": 0, "refs": 0, "warnings": 0}
# set a default option
if len(opts) == 0:
d["errors"] = 1
for opt,arg in opts:
if opt in ("-h","--help"):
help()
else:
d[opt[2:]] = 1
if len(args) != 1:
sys.stderr.write("One log file is required\n")
sys.exit(1)
file = args[0]
return d,file
def help():
print ("""\
usage: rubber [options] logfile
available options:
--boxes display overfull/underfull box messages
--errors display error messages
--help display this message end exit
--refs display missing reference messages
--warnings display all other warnings
""")
sys.exit()
# applescript compatible output
if __name__ == "__main__":
options,file = parse_options(sys.argv[1:])
directory = file[:file.rfind('/') + 1]
check = LogCheck()
check.read(file)
for d in check.parse(errors=options["errors"], boxes=options["boxes"],
refs=options["refs"], warnings=options["warnings"]):
print applescript_output(d, directory)
| [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
198,
2,
770,
4226,
10944,
422,
257,
3704,
286,
262,
14239,
1628,
198,
2,
2638,
1378,
35681,
15636,
13,
3262,
14,
25089,
527,
198,
2,
357,
66,
8,
32390,
1355,
487,
3301,
11,
6244,
438,
133... | 2.287852 | 1,136 |
# Copyright 2018 Fujitsu.
#
# 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 oslo_db import exception as db_exc
from oslo_utils import timeutils
from oslo_versionedobjects import base as object_base
from barbican.common import utils
from barbican.model import models
from barbican.model import repositories as repos
from barbican.objects import base
from barbican.objects import fields
LOG = utils.getLogger(__name__)
| [
2,
220,
220,
220,
15069,
2864,
32671,
19831,
13,
198,
2,
198,
2,
220,
220,
220,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
345,
743,
198,
2,
220,
220,
220,
407,
779,
428,
2393,
2845,
287,
... | 3.461818 | 275 |
#This program converts KPH to MPH.
#constant
CONVERT_FACTOR = 0.6214
#head output
print("KPH \t MPH")
print("_" * 20)
#loop
for kph_speed in range (60, 131, 10):
#calculation
mph_speed = kph_speed * CONVERT_FACTOR
#output
print(kph_speed, '\t', format(mph_speed, '.1f'))
input("\nPress any key to quit")
# Case 1
# KPH MPH
# ____________________
# 60 37.3
# 70 43.5
# 80 49.7
# 90 55.9
# 100 62.1
# 110 68.4
# 120 74.6
# 130 80.8
# Press any key to quit | [
198,
2,
1212,
1430,
26161,
509,
11909,
284,
43822,
13,
198,
198,
2,
9979,
415,
198,
10943,
15858,
62,
37,
10659,
1581,
796,
657,
13,
5237,
1415,
198,
198,
2,
2256,
5072,
198,
4798,
7203,
42,
11909,
3467,
83,
43822,
4943,
198,
4798,
... | 2.042636 | 258 |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from mock import Mock, patch
from sentry.rules.registry import RuleRegistry
from sentry.testutils import APITestCase
| [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
198,
6738,
42625,
14208,
13,
7295,
13,
6371,
411,
349,
690,
1330,
9575,
198,
6738,
15290,
1330,
44123,
11,
8529,
198,
198,
6738,
1908,
563,
13,
38785,
13,
2301,
4592,
1330,
14330,
8... | 3.642857 | 56 |
# train-script.py
# Grab data from movie_data.csv and train a ML model.
# Kelly Fesler (c) Nov 2020
# Modified from Soumya Gupta (c) Jan 2020
# STEP 1: import -------------------------------------------
# Import libraries
import urllib.request
import os
import pandas as pd
import numpy as np
import nltk
import sklearn
import joblib
from nltk.tokenize import RegexpTokenizer
from nltk.stem.porter import PorterStemmer
from nltk.corpus import stopwords
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
# STEP 2: read ---------------------------------------------
# Read in the large movie review dataset; display the first 3 lines
df = pd.read_csv('movie_data.csv', encoding='utf-8')
print("Loading data...\n")
data_top = df.head(3)
print(data_top)
# STEP 3: clean --------------------------------------------
# prepare tokenizer, stopwords, stemmer objects
tokenizer = RegexpTokenizer(r'\w+')
en_stopwords = set(stopwords.words('english'))
ps = PorterStemmer()
# set up helper function to clean data:
# tokenize & clean all reviews
print("")
print("Tokenizing & cleaning...")
df['review'].apply(getStemmedReview)
# STEP 4: split --------------------------------------------
print("Splitting...")
# split: 35k rows for training
X_train = df.loc[:35000, 'review'].values
Y_train = df.loc[:35000, 'sentiment'].values
# split: 15k rows for testing
X_test = df.loc[35000:, 'review'].values
Y_test = df.loc[35000:, 'sentiment'].values
# STEP 5: transform to feature vectors ---------------------
# set up vectorizer from sklearn
vectorizer = TfidfVectorizer(sublinear_tf=True, encoding='utf-8')
# train on the training data
print("Training...")
vectorizer.fit(X_train)
# after learning from training data, transform the test data
print("Transforming...")
X_train = vectorizer.transform(X_train)
X_test = vectorizer.transform(X_test)
# STEP 6: create the ML model ------------------------------
print("Creating the model...")
model = LogisticRegression(solver='liblinear')
model.fit(X_train,Y_train)
print("ok!")
# print scores
print("")
print("Score on training data is: " + str(model.score(X_train,Y_train)))
print("Score on testing data is:" + str(model.score(X_test,Y_test)))
# STEP 7: test model output --------------------------------
print("")
print("Testing a negative review...")
# Sampling a negative review; let's compare expected & predicted values
print("Expected sentiment: 0")
print("Predicted sentiment: " + str(model.predict(X_test[0])))
print("Expected probabilities: ~0.788, ~0.211")
print("Predicted probabilities: " + str(model.predict_proba(X_test[0])))
# STEP 8: save & export the model --------------------------
print("")
print("Exporting to .pkl files...")
joblib.dump(en_stopwords,'stopwords.pkl')
joblib.dump(model,'model.pkl')
joblib.dump(vectorizer,'vectorizer.pkl')
print("done")
| [
2,
4512,
12,
12048,
13,
9078,
198,
2,
25339,
1366,
422,
3807,
62,
7890,
13,
40664,
290,
4512,
257,
10373,
2746,
13,
198,
2,
9077,
376,
274,
1754,
357,
66,
8,
5267,
12131,
198,
2,
40499,
422,
22862,
1820,
64,
42095,
357,
66,
8,
2... | 3.257883 | 888 |
from abc import ABCMeta, abstractmethod
from collections import defaultdict
from copy import deepcopy
from typing import Union, Type, Any, Tuple
import numpy as np
import torch
import torch.nn as nn
from scipy.signal import find_peaks_cwt
from .net import MyNN, MyNNRegressor
from .utils import autoregression_matrix, unified_score
from .metrics import KL_sym, KL, JSD, PE, PE_sym, Wasserstein
from .scaler import SmaScalerCache
from .helper import SMA
| [
6738,
450,
66,
1330,
9738,
48526,
11,
12531,
24396,
198,
6738,
17268,
1330,
4277,
11600,
198,
6738,
4866,
1330,
2769,
30073,
198,
6738,
19720,
1330,
4479,
11,
5994,
11,
4377,
11,
309,
29291,
198,
198,
11748,
299,
32152,
355,
45941,
198,... | 3.271429 | 140 |
import types
from testutils import assert_raises
ns = types.SimpleNamespace(a=2, b='Rust')
assert ns.a == 2
assert ns.b == "Rust"
with assert_raises(AttributeError):
_ = ns.c
| [
11748,
3858,
198,
198,
6738,
1332,
26791,
1330,
6818,
62,
430,
2696,
198,
198,
5907,
796,
3858,
13,
26437,
36690,
10223,
7,
64,
28,
17,
11,
275,
11639,
49444,
11537,
198,
198,
30493,
36545,
13,
64,
6624,
362,
198,
30493,
36545,
13,
... | 2.716418 | 67 |
# entrada
value = int(input())
# variaveis
cashier = True
valueI = value
n1 = 0
n2 = 0
n5 = 0
n10 = 0
n20 = 0
n50 = 0
n100 = 0
# lao quando cashier == False sai
while cashier == True:
# condicionais
if value >= 100:
valueA = value // 100
n100 = valueA
valueB = valueA * 100
value = value - valueB
# condicionais
elif value >= 50:
valueA = value // 50
n50 = valueA
valueB = valueA * 50
value = value - valueB
# condicionais
elif value >= 20:
valueA = value // 20
n20 = valueA
valueB = valueA * 20
value = value - valueB
# condicionais
elif value >= 10:
valueA = value // 10
n10 = valueA
valueB = valueA * 10
value = value - valueB
# condicionais
elif value >= 5:
valueA = value // 5
n5 = valueA
valueB = valueA * 5
value = value - valueB
# condicionais
elif value >= 2:
valueA = value // 2
n2 = valueA
valueB = valueA * 2
value = value - valueB
# condicionais
elif value >= 1:
valueA = value // 1
n1 = valueA
valueB = valueA * 1
value = value - valueB
# condicionais
elif value == 0:
# condio para sair
cashier = False
print(
'{}\n{} nota(s) de R$ 100,00\n{} nota(s) de R$ 50,00\n{} nota(s) de R$ 20,00\n{} nota(s) de R$ 10,00\n{} nota(s) de R$ 5,00\n{} nota(s) de R$ 2,00\n{} nota(s) de R$ 1,00'.format(
valueI, n100, n50, n20, n10, n5, n2, n1)) | [
2,
24481,
4763,
201,
198,
8367,
796,
493,
7,
15414,
28955,
201,
198,
201,
198,
2,
1401,
544,
303,
271,
201,
198,
30350,
959,
796,
6407,
201,
198,
8367,
40,
796,
1988,
201,
198,
77,
16,
796,
657,
201,
198,
77,
17,
796,
657,
201,
... | 1.866292 | 890 |
from abc import ABCMeta
# def _make_delegator_method_to_property(name):
# def delegator(self, *args, **kwargs):
# return getattr(self.__delegate__, name)
# return delegator
# todo: finalize naming: Delegating, Delegate, actual_delegate, delegatee, delegator o_O ?
# We have the following players in this game:
# * MetaClass for Classes of Objects who delegates their implementation to aggregated object
# So who should be named how?
| [
6738,
450,
66,
1330,
9738,
48526,
628,
198,
198,
2,
825,
4808,
15883,
62,
2934,
1455,
1352,
62,
24396,
62,
1462,
62,
26745,
7,
3672,
2599,
198,
2,
220,
220,
220,
220,
825,
8570,
1352,
7,
944,
11,
1635,
22046,
11,
12429,
46265,
220... | 3.102041 | 147 |
# -*- coding: utf-8 -*-
from pymystem3 import Mystem
# text = "some good newses"
text = " "
m = Mystem()
lemmas = m.lemmatize(text)
print(''.join(lemmas))
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
6738,
12972,
1820,
927,
18,
1330,
2011,
927,
198,
2,
2420,
796,
366,
11246,
922,
1705,
274,
1,
198,
5239,
796,
366,
220,
220,
220,
366,
198,
76,
796,
2011,
927,... | 2.208333 | 72 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from config.template_middleware import TemplateResponse
from desenho.desenho_model import Desenho, DesenhoForm
from gaecookie.decorator import no_csrf
#from pedido.pedido_model import Pedido, PedidoForm
from routes import desenhos
from tekton.gae.middleware.redirect import RedirectResponse
from tekton.router import to_path
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
11,
28000,
1098,
62,
17201,
874,
198,
6738,
4566,
13,
28243,
62,
27171,
1574,
1330,
37350,
31077,
198,
6738,
748,
268,
88... | 3.19685 | 127 |
# import necessary libraries
import csv
from PIL import Image
import argparse
# create argument parser with PATH argument
ap = argparse.ArgumentParser()
ap.add_argument('-p', '--path', required=True,
help='''PATH to CUB_200_2011 folder i.e. folder with CUB 200 csv files
(make sure to include full path name for so other scripts can find the data file path(s))''')
args = ap.parse_args()
if __name__ == "__main__":
# run with command line arguments
create_train_test_split(args.path) | [
2,
1330,
3306,
12782,
198,
11748,
269,
21370,
198,
6738,
350,
4146,
1330,
7412,
198,
11748,
1822,
29572,
198,
198,
2,
2251,
4578,
30751,
351,
46490,
4578,
220,
198,
499,
796,
1822,
29572,
13,
28100,
1713,
46677,
3419,
198,
499,
13,
28... | 3.230263 | 152 |
import torch
from torch import nn
def l1_loss(x):
return torch.mean(torch.sum(torch.abs(x), dim=1))
| [
11748,
28034,
198,
198,
6738,
28034,
1330,
299,
77,
628,
628,
198,
198,
4299,
300,
16,
62,
22462,
7,
87,
2599,
198,
220,
220,
220,
1441,
28034,
13,
32604,
7,
13165,
354,
13,
16345,
7,
13165,
354,
13,
8937,
7,
87,
828,
5391,
28,
... | 2.333333 | 48 |
__all__ = [
'IUserService',
'UserService',
]
from services.users.iuser_service import IUserService
from services.users.user_service import UserService
| [
834,
439,
834,
796,
685,
198,
220,
220,
220,
705,
40,
12982,
16177,
3256,
198,
220,
220,
220,
705,
12982,
16177,
3256,
198,
60,
198,
198,
6738,
2594,
13,
18417,
13,
3754,
263,
62,
15271,
1330,
314,
12982,
16177,
198,
6738,
2594,
13,... | 3.076923 | 52 |
# Copyright 2019 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for wipeout service."""
from __future__ import absolute_import # pylint: disable=import-only-modules
from __future__ import unicode_literals # pylint: disable=import-only-modules
from core.domain import rights_manager
from core.domain import topic_domain
from core.domain import topic_services
from core.domain import user_services
from core.domain import wipeout_service
from core.platform import models
from core.tests import test_utils
import feconf
(collection_models, exp_models, user_models,) = (
models.Registry.import_models([
models.NAMES.collection, models.NAMES.exploration, models.NAMES.user]))
| [
2,
15069,
13130,
383,
9385,
544,
46665,
13,
1439,
6923,
33876,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
... | 3.601744 | 344 |
"""Utility module for setting up different envs"""
import numpy as np
import structlog
from shapely.geometry import Point
from ray.rllib.agents.ppo import DEFAULT_CONFIG
from ray.rllib.env.multi_agent_env import MultiAgentEnv
from deepcomp.util.constants import SUPPORTED_ENVS, SUPPORTED_AGENTS, SUPPORTED_SHARING, SUPPORTED_UE_ARRIVAL, \
SUPPORTED_UTILITIES
from deepcomp.env.single_ue.variants import RelNormEnv
from deepcomp.env.multi_ue.central import CentralRelNormEnv
from deepcomp.env.multi_ue.multi_agent import MultiAgentMobileEnv
from deepcomp.env.entities.user import User
from deepcomp.env.entities.station import Basestation
from deepcomp.env.entities.map import Map
from deepcomp.env.util.movement import RandomWaypoint
from deepcomp.util.callbacks import CustomMetricCallbacks
log = structlog.get_logger()
def get_env_class(env_type):
"""Return the env class corresponding to the string type (from CLI)"""
assert env_type in SUPPORTED_AGENTS, f"Environment type was {env_type} but has to be one of {SUPPORTED_AGENTS}."
if env_type == 'single':
# return DatarateMobileEnv
# return NormDrMobileEnv
return RelNormEnv
if env_type == 'central':
# return CentralDrEnv
# return CentralNormDrEnv
return CentralRelNormEnv
# return CentralMaxNormEnv
if env_type == 'multi':
return MultiAgentMobileEnv
def get_sharing_for_bs(sharing, bs_idx):
"""Return the sharing model for the given BS"""
# if it's not mixed, it's the same for all BS
if sharing != 'mixed':
assert sharing in SUPPORTED_SHARING
return sharing
# else loop through the available sharing models
sharing_list = ['resource-fair', 'rate-fair', 'proportional-fair']
return sharing_list[bs_idx % len(sharing_list)]
def create_small_map(sharing_model):
"""
Create small map and 2 BS
:returns: tuple (map, bs_list)
"""
map = Map(width=150, height=100)
bs1 = Basestation('A', Point(50, 50), get_sharing_for_bs(sharing_model, 0))
bs2 = Basestation('B', Point(100, 50), get_sharing_for_bs(sharing_model, 1))
bs_list = [bs1, bs2]
return map, bs_list
def create_dyn_small_map(sharing_model, bs_dist=100, dist_to_border=10):
"""Small env with 2 BS and dynamic distance in between"""
map = Map(width=2 * dist_to_border + bs_dist, height=2 * dist_to_border)
bs1 = Basestation('A', Point(dist_to_border, dist_to_border), sharing_model)
bs2 = Basestation('B', Point(dist_to_border + bs_dist, dist_to_border), sharing_model)
return map, [bs1, bs2]
def create_medium_map(sharing_model):
"""
Deprecated: Use dynamic medium env instead. Kept this to reproduce earlier results.
Same as large env, but with map restricted to areas with coverage.
Thus, optimal episode reward should be close to num_ues * eps_length * 10 (ie, all UEs are always connected)
"""
map = Map(width=205, height=85)
bs1 = Basestation('A', Point(45, 35), sharing_model)
bs2 = Basestation('B', Point(160, 35), sharing_model)
bs3 = Basestation('C', Point(100, 85), sharing_model)
bs_list = [bs1, bs2, bs3]
return map, bs_list
def create_dyn_medium_map(sharing_model, bs_dist=100, dist_to_border=10):
"""
Create map with 3 BS at equal distance. Distance can be varied dynamically. Map is sized automatically.
Keep the same layout as old medium env here: A, B on same horizontal axis. C above in the middle
"""
# calculate vertical distance from A, B to C using Pythagoras
y_dist = np.sqrt(bs_dist ** 2 - (bs_dist / 2) ** 2)
# derive map size from BS distance and distance to border
map_width = 2 * dist_to_border + bs_dist
map_height = 2 * dist_to_border + y_dist
map = Map(width=map_width, height=map_height)
# BS A is located at bottom left corner with specified distance to border
bs1 = Basestation('A', Point(dist_to_border, dist_to_border), get_sharing_for_bs(sharing_model, 0))
# other BS positions are derived accordingly
bs2 = Basestation('B', Point(dist_to_border + bs_dist, dist_to_border), get_sharing_for_bs(sharing_model, 1))
bs3 = Basestation('C', Point(dist_to_border + (bs_dist / 2), dist_to_border + y_dist), get_sharing_for_bs(sharing_model, 2))
return map, [bs1, bs2, bs3]
def create_large_map(sharing_model):
"""
Create larger map with 7 BS that are arranged in a typical hexagonal structure.
:returns: Tuple(map, bs_list)
"""
map = Map(width=230, height=260)
bs_list = [
# center
Basestation('A', Point(115, 130), get_sharing_for_bs(sharing_model, 0)),
# top left, counter-clockwise
Basestation('B', Point(30, 80), get_sharing_for_bs(sharing_model, 1)),
Basestation('C', Point(115, 30), get_sharing_for_bs(sharing_model, 2)),
Basestation('D', Point(200, 80), get_sharing_for_bs(sharing_model, 3)),
Basestation('E', Point(200, 180), get_sharing_for_bs(sharing_model, 4)),
Basestation('F', Point(115, 230), get_sharing_for_bs(sharing_model, 5)),
Basestation('G', Point(30, 180), get_sharing_for_bs(sharing_model, 6)),
]
return map, bs_list
def create_ues(map, num_static_ues, num_slow_ues, num_fast_ues, util_func):
"""Create custom number of slow/fast UEs on the given map. Return UE list"""
ue_list = []
id = 1
for i in range(num_static_ues):
ue_list.append(User(str(id), map, pos_x='random', pos_y='random', movement=RandomWaypoint(map, velocity=0),
util_func=util_func))
id += 1
for i in range(num_slow_ues):
ue_list.append(User(str(id), map, pos_x='random', pos_y='random', movement=RandomWaypoint(map, velocity='slow'),
util_func=util_func))
id += 1
for i in range(num_fast_ues):
ue_list.append(User(str(id), map, pos_x='random', pos_y='random', movement=RandomWaypoint(map, velocity='fast'),
util_func=util_func))
id += 1
return ue_list
def create_custom_env(sharing_model):
"""Hand-created custom env. For demos or specific experiments."""
# map with 4 BS at distance of 100; distance 10 to border of map
map = Map(width=194, height=120)
bs_list = [
# left
Basestation('A', Point(10, 60), get_sharing_for_bs(sharing_model, 0)),
# counter-clockwise
Basestation('B', Point(97, 10), get_sharing_for_bs(sharing_model, 1)),
Basestation('C', Point(184, 60), get_sharing_for_bs(sharing_model, 2)),
Basestation('D', Point(97, 110), get_sharing_for_bs(sharing_model, 3)),
]
return map, bs_list
def get_env(map_size, bs_dist, num_static_ues, num_slow_ues, num_fast_ues, sharing_model, util_func, num_bs=None):
"""Create and return the environment corresponding to the given map_size"""
assert map_size in SUPPORTED_ENVS, f"Environment {map_size} is not one of {SUPPORTED_ENVS}."
assert util_func in SUPPORTED_UTILITIES, \
f"Utility function {util_func} not supported. Supported: {SUPPORTED_UTILITIES}"
# create map and BS list
map, bs_list = None, None
if map_size == 'small':
map, bs_list = create_small_map(sharing_model)
elif map_size == 'medium':
map, bs_list = create_dyn_medium_map(sharing_model, bs_dist=bs_dist)
elif map_size == 'large':
if num_bs is None:
map, bs_list = create_large_map(sharing_model)
else:
map, bs_list = create_dyn_large_map(sharing_model, num_bs)
elif map_size == 'custom':
map, bs_list = create_custom_env(sharing_model)
# create UEs
ue_list = create_ues(map, num_static_ues, num_slow_ues, num_fast_ues, util_func)
return map, ue_list, bs_list
def get_ue_arrival(ue_arrival_name):
"""Get the dict defining UE arrival over time based on the name provided via CLI"""
assert ue_arrival_name in SUPPORTED_UE_ARRIVAL
if ue_arrival_name is None:
return None
if ue_arrival_name == "oneupdown":
return {10: 1, 30: -1}
if ue_arrival_name == "updownupdown":
return {10: 1, 20: -1, 30: 1, 40: -1}
if ue_arrival_name == "3up2down":
return {10: 3, 30: -2}
if ue_arrival_name == "updown":
return {10: 1, 15: 1, 20: 1, 40: 1, 50: -1, 60: -1}
if ue_arrival_name == "largeupdown":
return {
20: 1, 30: -1, 40: 1,
# large increase up to 12 (starting at 1)
45: 1, 50: 1, 55: 2, 60: 3, 65: 2, 70: 1,
# large decrease down to 1
75: -1, 80: -2, 85: -3, 90: -3, 95: -2
}
raise ValueError(f"Unknown UE arrival name: {ue_arrival_name}")
def create_env_config(cli_args):
"""
Create environment and RLlib config based on passed CLI args. Return config.
:param cli_args: Parsed CLI args
:return: The complete config for an RLlib agent, including the env & env_config
"""
env_class = get_env_class(cli_args.agent)
map, ue_list, bs_list = get_env(cli_args.env, cli_args.bs_dist, cli_args.static_ues, cli_args.slow_ues,
cli_args.fast_ues, cli_args.sharing, cli_args.util, num_bs=cli_args.num_bs)
# this is for DrEnv and step utility
# env_config = {
# 'episode_length': eps_length, 'seed': seed,
# 'map': map, 'bs_list': bs_list, 'ue_list': ue_list, 'dr_cutoff': 'auto', 'sub_req_dr': True,
# 'curr_dr_obs': False, 'ues_at_bs_obs': False, 'dist_obs': False, 'next_dist_obs': False
# }
# this is for the custom NormEnv and log utility
env_config = {
'episode_length': cli_args.eps_length, 'seed': cli_args.seed, 'map': map, 'bs_list': bs_list, 'ue_list': ue_list,
'rand_episodes': cli_args.rand_train, 'new_ue_interval': cli_args.new_ue_interval, 'reward': cli_args.reward,
'max_ues': cli_args.max_ues, 'ue_arrival': get_ue_arrival(cli_args.ue_arrival),
# if enabled log_metrics: log metrics even during training --> visible on tensorboard
# if disabled: log just during testing --> probably slightly faster training with less memory
'log_metrics': True,
# custom animation rendering
'dashboard': cli_args.dashboard, 'ue_details': cli_args.ue_details,
}
# convert ue_arrival sequence to str keys as required by RLlib: https://github.com/ray-project/ray/issues/16215
if env_config['ue_arrival'] is not None:
env_config['ue_arrival'] = {str(k): v for k, v in env_config['ue_arrival'].items()}
# create and return the config
config = DEFAULT_CONFIG.copy()
# discount factor (default 0.99)
# config['gamma'] = 0.5
# 0 = no workers/actors at all --> low overhead for short debugging; 2+ workers to accelerate long training
config['num_workers'] = cli_args.workers
config['seed'] = cli_args.seed
# write training stats to file under ~/ray_results (default: False)
config['monitor'] = True
config['train_batch_size'] = cli_args.batch_size # default: 4000; default in stable_baselines: 128
# auto normalize obserations by subtracting mean and dividing by std (default: "NoFilter")
# config['observation_filter'] = "MeanStdFilter"
# NN settings: https://docs.ray.io/en/latest/rllib-models.html#built-in-model-parameters
# configure the size of the neural network's hidden layers; default: [256, 256]
# config['model']['fcnet_hiddens'] = [512, 512, 512]
# LSTM settings
config['model']['use_lstm'] = cli_args.lstm
# config['model']['lstm_use_prev_action_reward'] = True
# config['log_level'] = 'INFO' # ray logging default: warning
# reset the env whenever the horizon/eps_length is reached
config['horizon'] = cli_args.eps_length
config['env'] = env_class
config['env_config'] = env_config
# callback for monitoring custom metrics
config['callbacks'] = CustomMetricCallbacks
config['log_level'] = 'ERROR'
# for multi-agent env: https://docs.ray.io/en/latest/rllib-env.html#multi-agent-and-hierarchical
if MultiAgentEnv in env_class.__mro__:
# instantiate env to access obs and action space and num diff UEs
env = env_class(env_config)
# use separate policies (and NNs) for each agent
if cli_args.separate_agent_nns:
num_diff_ues = env.get_num_diff_ues()
# create policies also for all future UEs
if num_diff_ues > env.num_ue:
log.warning("Varying num. UEs. Creating policy for all (future) UEs.",
curr_num_ue=env.num_ue, num_diff_ues=num_diff_ues, new_ue_interval=env.new_ue_interval,
ue_arrival=env.ue_arrival)
ue_ids = [str(i + 1) for i in range(num_diff_ues)]
else:
ue_ids = [ue.id for ue in ue_list]
config['multiagent'] = {
# attention: ue.id needs to be a string! just casting it to str() here doesn't work;
# needs to be consistent with obs keys --> easier, just use string IDs
'policies': {ue_id: (None, env.observation_space, env.action_space, {}) for ue_id in ue_ids},
'policy_mapping_fn': lambda agent_id: agent_id
}
# or: all UEs use the same policy and NN
else:
config['multiagent'] = {
'policies': {'ue': (None, env.observation_space, env.action_space, {})},
'policy_mapping_fn': lambda agent_id: 'ue'
}
return config
| [
37811,
18274,
879,
8265,
329,
4634,
510,
1180,
551,
14259,
37811,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2878,
6404,
198,
6738,
5485,
306,
13,
469,
15748,
1330,
6252,
198,
6738,
26842,
13,
81,
297,
571,
13,
49638,
13,
16634,
... | 2.440785 | 5,556 |
""" Faa um programa que receba o salrio de um funcionrio, calcule e mostre o novo salrio, sabende-se que este sofreu um aumento de 25%"""
sal = float(input('Salrio:'))
nsal = sal*1.25
print ('novo salrio = ', nsal) | [
37811,
376,
7252,
23781,
1430,
64,
8358,
1407,
7012,
267,
3664,
27250,
390,
23781,
25439,
295,
27250,
11,
2386,
23172,
304,
749,
260,
267,
645,
13038,
3664,
27250,
11,
17463,
38396,
12,
325,
8358,
43577,
523,
19503,
84,
23781,
257,
1713... | 2.721519 | 79 |
import numpy as np
from numpy import random, linspace, cos, pi
import math
import random
import matplotlib.pyplot as plt
from scipy.fft import fft, fftfreq
from scipy.fft import rfft, rfftfreq
import copy
from mpl_toolkits.mplot3d import axes3d
from mpl_toolkits import mplot3d
from plotly import __version__
import pandas as pd
from scipy.optimize import fsolve
import cmath
from numba import jit
from numpy import linalg as LA
from scipy.linalg import expm, norm
from scipy.integrate import odeint
import time
import numba
from parameters import *
from lattice import *
import plotly.offline as pyo
import plotly.graph_objs as go
from plotly.offline import iplot
import plotly.figure_factory as ff
import plotly.express as px
| [
11748,
299,
32152,
355,
45941,
198,
6738,
299,
32152,
1330,
4738,
11,
300,
1040,
10223,
11,
8615,
11,
31028,
198,
11748,
10688,
198,
11748,
4738,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
629,
541,
88,
1... | 2.95935 | 246 |
import unittest
import sys
import os
import sys
import json
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
PROJECT_DIR = os.path.abspath(os.path.join(TEST_DIR, os.pardir))
sys.path.insert(0, PROJECT_DIR)
from module.cmdparse import cmdargs
if __name__ == '__main__':
unittest.main()
| [
11748,
555,
715,
395,
198,
11748,
25064,
198,
11748,
28686,
198,
11748,
25064,
198,
11748,
33918,
198,
198,
51,
6465,
62,
34720,
796,
28686,
13,
6978,
13,
15908,
3672,
7,
418,
13,
6978,
13,
397,
2777,
776,
7,
834,
7753,
834,
4008,
1... | 2.504202 | 119 |
"""
ebb_fit_prior : fits a Beta prior by estimating the parameters from the data using
method of moments and MLE estimates
augment : given data and prior, computes the shrinked estimate, credible intervals and
augments those in the given dataframe
check_fit : plots the true average and the shrinked average
"""
import numpy as np
import pandas as pd
from scipy.stats import beta as beta_dist
from dataclasses import dataclass
import matplotlib.pyplot as plt
if __name__ == '__main__':
x = np.random.randint(0,50,20)
n = np.random.randint(50,100, 20)
p = x/n
dt = pd.DataFrame({'S':x, 'Tot':n, 'est':p})
est1 = ebb_fit_prior(x,n, 'mm')
print(est1)
est1.plot(x, n)
new_dt = augment(est1, dt, dt.S, dt.Tot)
print(new_dt.head(10))
check_fit(new_dt)
print('=============================')
est2 = ebb_fit_prior(x,n,'mle')
print(est2)
est2.plot(x,n)
new_dt = augment(est2, dt, dt.S, dt.Tot)
print(new_dt.head(10))
check_fit(new_dt)
| [
37811,
198,
1765,
65,
62,
11147,
62,
3448,
273,
1058,
11414,
257,
17993,
3161,
416,
39539,
262,
10007,
422,
262,
1366,
1262,
220,
198,
24396,
286,
7188,
290,
337,
2538,
7746,
198,
559,
5154,
1058,
1813,
1366,
290,
3161,
11,
552,
1769,... | 2.231092 | 476 |
import sqlite3
from flask import Flask, render_template
app = Flask(__name__)
# database details - to remove some duplication
db_name = 'shopping_data.db' | [
11748,
44161,
578,
18,
198,
6738,
42903,
1330,
46947,
11,
8543,
62,
28243,
198,
198,
1324,
796,
46947,
7,
834,
3672,
834,
8,
198,
198,
2,
6831,
3307,
532,
284,
4781,
617,
50124,
198,
9945,
62,
3672,
796,
705,
1477,
33307,
62,
7890,
... | 3.391304 | 46 |
# Decode Ways: https://leetcode.com/problems/decode-ways/
# A message containing letters from A-Z can be encoded into numbers using the following mapping:
# 'A' -> "1"
# 'B' -> "2"
# ...
# 'Z' -> "26"
# To decode an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For example, "11106" can be mapped into:
# "AAJF" with the grouping (1 1 10 6)
# "KJF" with the grouping (11 10 6)
# Note that the grouping (1 11 06) is invalid because "06" cannot be mapped into 'F' since "6" is different from "06".
# Given a string s containing only digits, return the number of ways to decode it.
# The answer is guaranteed to fit in a 32-bit integer.
# So the above should work but it does so because it is like the fib sequence we only need two vals to create thrid 1 1 = 1 2
# so you keep the value that you need and discard outside of the range like a window
# Score Card
# Did I need hints? N
# Did you finish within 30 min? Y 25
# Was the solution optimal? I was able to create the optimal solution although I kind of skipped over the bottom up and tabulation that helps with
# creating the optimal solution as I have seen it before with the fib sequence
# Were there any bugs? I accidently pointed the second algo to current (because it is correct) but really I need to return oneBack because
# python can possibly clean up that val after the loop
# 5 5 5 3 = 4.5
| [
2,
4280,
1098,
26658,
25,
3740,
1378,
293,
316,
8189,
13,
785,
14,
1676,
22143,
14,
12501,
1098,
12,
1322,
14,
198,
198,
2,
317,
3275,
7268,
7475,
422,
317,
12,
57,
460,
307,
30240,
656,
3146,
1262,
262,
1708,
16855,
25,
198,
198,... | 3.607843 | 408 |
#!/usr/bin/python -W all
"""
word2vec.py: process tweets with word2vec vectors
usage: word2vec.py [-x] [-m model-file [-l word-vector-length]] -w word-vector-file -T train-file -t test-file
notes:
- optional model file is a text file from which the word vector file is built
- option x writes tokenized sentences to stdout
20170504 erikt(at)xs4all.nl
"""
# import modules & set up logging
import gensim
import getopt
import logging
import numpy
import naiveBayes
import os.path
import re
import sys
from scipy.sparse import csr_matrix
from sklearn.naive_bayes import BernoulliNB
from sklearn.naive_bayes import MultinomialNB
from sklearn.naive_bayes import GaussianNB
from sklearn import svm
# constants
COMMAND = "word2vec.py"
TWEETCOLUMN = 4 # column tweet text in test data file dutch-2012.csv
CLASSCOLUMN = 9 # column tweeting behaviour (T3) in file dutch-2012.csv
IDCOLUMN = 0 # column with the id of the current tweet
PARENTCOLUMN = 5 # column of the id of the parent of the tweet if it is a retweet or reply (otherwise: None)
HASHEADING = True
MINCOUNT = 2
USAGE = "usage: "+COMMAND+" [-m model-file] -w word-vector-file -T train-file -t test-file\n"
# input file names
trainFile = ""
testFile = ""
wordvectorFile = ""
modelFile = ""
# length of word vectors
maxVector = 200
# exporting tokenized sentences
exportTokens = False
selectedTokens = {}
# check for command line options
# create data matrix (no sparse version needed)
# change the class vector into a binary vector
# read wordvector file from file in format of fasttext:
# first line: nbrOfVectors vectorLength; rest: token vector
# main function starts here
checkOptions()
# get target classes from training data file
targetClasses = naiveBayes.getTargetClasses(trainFile)
if len(targetClasses) == 0: sys.exit(COMMAND+": cannot find target classes\n")
# if required: train the word vector model and save it to file
if modelFile != "":
# read the model data
readDataResults = naiveBayes.readData(modelFile,targetClasses[0])
# tokenize the model data
tokenizeResults = naiveBayes.tokenize(readDataResults["text"])
# build the word vectors (test sg=1,window=10)
wordvecModel = gensim.models.Word2Vec(tokenizeResults, min_count=MINCOUNT, size=maxVector)
# save the word vectors
wordvecModel.save(wordvectorFile)
# load the word vector model from file
patternNameVec = re.compile("\.vec$")
if not patternNameVec.search(wordvectorFile):
print >> sys.stderr,"loading gensim vector model from file: %s" % (wordvectorFile)
# read standard file format from gensim
wordvecModel = gensim.models.Word2Vec.load(wordvectorFile)
else:
print >> sys.stderr,"loading fasttext vector model from file: %s" % (wordvectorFile)
# read file format from fasttext
wordvecModel = readFasttextModel(wordvectorFile)
# read training data, tokenize data, make vector matrix
readDataResults = naiveBayes.readData(trainFile,"")
tokenizeResults = naiveBayes.tokenize(readDataResults["text"])
# check if we need to export tokens
if exportTokens:
for i in range(0,len(tokenizeResults)):
sys.stdout.write("__label__"+readDataResults["classes"][i])
for j in range(0,len(tokenizeResults[i])):
sys.stdout.write(" ")
sys.stdout.write(unicode(tokenizeResults[i][j]).encode('utf8'))
sys.stdout.write("\n")
sys.exit()
# select tokens to be used in model, based on token frequency
selectedTokens = naiveBayes.selectFeatures(tokenizeResults,MINCOUNT)
makeVectorsResultsTrain = makeVectors(tokenizeResults,wordvecModel,selectedTokens)
# the matrix can be saved to file and reloaded in next runs but this does not gain much time
# read test data, tokenize data, make vector matrix
readDataResults = naiveBayes.readData(testFile,"")
tokenizeResults = naiveBayes.tokenize(readDataResults["text"])
makeVectorsResultsTest = makeVectors(tokenizeResults,wordvecModel,selectedTokens)
# run binary svm experiments: one for each target class
for targetClass in targetClasses:
# read the training and test file again to get the right class distribution for this target class
readDataResultsTrain = naiveBayes.readData(trainFile,targetClass)
readDataResultsTest = naiveBayes.readData(testFile,targetClass)
# get binary version of train classes
binTrainClasses = makeBinary(readDataResultsTrain["classes"])
# perform svm experiment: http://scikit-learn.org/stable/modules/svm.html (1.4.1.1)
clf = svm.SVC(decision_function_shape='ovo') # definition
clf.fit(makeVectorsResultsTrain,binTrainClasses) # training
outFile = open(testFile+".out."+targetClass,"w") # output file for test results
scores = clf.decision_function(makeVectorsResultsTest) # process all test items
for i in range(0,len(makeVectorsResultsTest)):
guess = "O"
if scores[i] >= 0: guess = targetClass
print >>outFile, "# %d: %s %s %0.3f" % (i,readDataResultsTest["classes"][i],guess,scores[i])
outFile.close()
| [
2,
48443,
14629,
14,
8800,
14,
29412,
532,
54,
477,
198,
37811,
198,
220,
220,
220,
1573,
17,
35138,
13,
9078,
25,
1429,
12665,
351,
1573,
17,
35138,
30104,
198,
220,
220,
220,
8748,
25,
1573,
17,
35138,
13,
9078,
25915,
87,
60,
2... | 3.007199 | 1,667 |
from .pipeline import SampleDataContainer, run_pipeline, make_pipeline
from .preprocess import preprocess_noob
from .postprocess import consolidate_values_for_sheet
__all__ = [
'SampleDataContainer',
'preprocess_noob',
'run_pipeline',
'make_pipeline,',
'consolidate_values_for_sheet'
]
| [
6738,
764,
79,
541,
4470,
1330,
27565,
6601,
29869,
11,
1057,
62,
79,
541,
4470,
11,
787,
62,
79,
541,
4470,
198,
6738,
764,
3866,
14681,
1330,
662,
14681,
62,
3919,
672,
198,
6738,
764,
7353,
14681,
1330,
38562,
62,
27160,
62,
1640... | 2.716814 | 113 |
from .rsmaker import RunstatMaker
| [
6738,
764,
3808,
10297,
1330,
5660,
14269,
48890,
628,
198
] | 3.6 | 10 |
row1 = ["","",""]
row2 = ["","",""]
row3 = ["","",""]
map = [row1, row2, row3]
print(f"{row1}\n{row2}\n{row3}")
position = input("Where do you want to put the treasure? ")
col = int(position[0])
ro = int(position[1])
map[ro-1][col-1] = "X"
print(f"{row1}\n{row2}\n{row3}")
| [
808,
16,
796,
14631,
2430,
2430,
8973,
198,
808,
17,
796,
14631,
2430,
2430,
8973,
198,
808,
18,
796,
14631,
2430,
2430,
8973,
198,
8899,
796,
685,
808,
16,
11,
5752,
17,
11,
5752,
18,
60,
198,
4798,
7,
69,
1,
90,
808,
16,
32239... | 2.166667 | 126 |
import xml.etree.ElementTree as ET
from shared import *
# neutral
for skin in skins:
name = f'{font}/emoji_u1f48f.svg' if skin == 'none' else f'{font}/emoji_u1f48f_{skin}.svg'
left = ET.parse(name).getroot()
right = ET.parse(name).getroot()
remove(left, 2)
remove(left, 1)
remove(right, 0)
write_dual(left, right, '1f9d1', '1f9d1', skin, '1f48b')
# neutral silhouette
name = f'{font}/emoji_u1f48f.svg'
left = ET.parse(name).getroot()
right = ET.parse(name).getroot()
remove(left, 2)
remove(left, 1)
remove(right, 0)
find_set_color(left)
find_set_color(right)
left_out = ET.ElementTree(left)
left_out.write('svgs/silhouette_1f9d1_1f48b.l.svg', encoding='utf-8')
right_out = ET.ElementTree(right)
right_out.write('svgs/silhouette_1f9d1_1f48b.r.svg', encoding='utf-8')
# woman, man silhouette
for g in ['1f469', '1f468']:
name = f'{font}/emoji_u{g}_200d_2764_200d_1f48b_200d_{g}.svg'
left = ET.parse(name).getroot()
right = ET.parse(name).getroot()
remove(left, 2)
remove(left, 1)
remove(right, 0)
find_set_color(left)
find_set_color(right)
left_out = ET.ElementTree(left)
left_out.write(f'svgs/silhouette_{g}_1f48b.l.svg', encoding='utf-8')
right_out = ET.ElementTree(right)
right_out.write(f'svgs/silhouette_{g}_1f48b.r.svg', encoding='utf-8')
# dual woman, dual man
for g in ['1f469', '1f468']:
for skin in skins:
if skin == 'none':
name = f'{font}/emoji_u{g}_200d_2764_200d_1f48b_200d_{g}.svg'
else:
name = f'{font}/emoji_u{g}_{skin}_200d_2764_200d_1f48b_200d_{g}_{skin}.svg'
left = ET.parse(name).getroot()
right = ET.parse(name).getroot()
remove(left, 2)
remove(left, 1)
remove(right, 0)
write_dual(left, right, g, g, skin, '1f48b') | [
11748,
35555,
13,
316,
631,
13,
20180,
27660,
355,
12152,
198,
6738,
4888,
1330,
1635,
198,
198,
2,
8500,
198,
1640,
4168,
287,
25873,
25,
198,
220,
220,
220,
1438,
796,
277,
6,
90,
10331,
92,
14,
368,
31370,
62,
84,
16,
69,
2780,... | 2.048698 | 883 |
# 2019 KidsCanCode LLC / All rights reserved.
# Game options/settings
TITLE = "Jumpy!"
WIDTH = 480
HEIGHT = 600
FPS = 60
# Environment options
GRAVITY = 9.8
# Player properties
PLAYER_ACC = 0.5
PLAYER_FRICTION = -0.01
PLAYER_JUMPPOWER = 10
# Define colors
# I changed the screen color to aqua, the platform color to orange, and the player color to purple
WHITE = (255, 255, 255)
AQUA = (0, 255, 255)
RED = (255, 0, 0)
ORANGE = (255, 101, 0)
BLUE = (0, 0, 255)
PURPLE = (128, 0, 128) | [
2,
220,
13130,
17476,
6090,
10669,
11419,
1220,
1439,
2489,
10395,
13,
198,
198,
2,
3776,
3689,
14,
33692,
198,
49560,
2538,
796,
366,
41,
32152,
2474,
198,
54,
2389,
4221,
796,
23487,
198,
13909,
9947,
796,
10053,
198,
37,
3705,
796,... | 2.57672 | 189 |
N = int(input())
R = input().split()
print(i2r(sum(r2i(r) for r in R)))
| [
628,
198,
45,
796,
493,
7,
15414,
28955,
198,
49,
796,
5128,
22446,
35312,
3419,
198,
198,
4798,
7,
72,
17,
81,
7,
16345,
7,
81,
17,
72,
7,
81,
8,
329,
374,
287,
371,
22305,
198
] | 2.054054 | 37 |
from asyncio import Queue, QueueEmpty
from abc import ABC, abstractmethod
from typing import List
| [
6738,
30351,
952,
1330,
4670,
518,
11,
4670,
518,
40613,
198,
6738,
450,
66,
1330,
9738,
11,
12531,
24396,
198,
6738,
19720,
1330,
7343,
628
] | 3.96 | 25 |
filter(processInput())
| [
628,
198,
24455,
7,
14681,
20560,
28955,
198
] | 3.25 | 8 |
"""
Distributed under the MIT License. See LICENSE.txt for more info.
"""
from django import template
register = template.Library()
| [
37811,
198,
20344,
6169,
739,
262,
17168,
13789,
13,
4091,
38559,
24290,
13,
14116,
329,
517,
7508,
13,
198,
37811,
198,
198,
6738,
42625,
14208,
1330,
11055,
198,
198,
30238,
796,
11055,
13,
23377,
3419,
628,
198
] | 3.675676 | 37 |
contmaior = 0
contahomi = 0
contamuie = 0
while True:
print('CADASTRE UMA PESSOA')
print('=-' * 19)
idade = int(input('INFORME SUA IDADE: '))
if idade > 18:
contmaior += 1
sexo = str(input('INFORME SEU SEXO <<M/F>>: ')).upper().strip()[0]
if sexo not in 'MF':
while True:
sexo = str(input('OPO INVLIDA! INFORME SEU SEXO <<M/F>>: ')).upper().strip()[0]
if sexo in 'MF':
break
if sexo == 'M':
contahomi += 1
if sexo == 'F' and idade < 20:
contamuie += 1
continuacao = str(input('Quer continuar[S/N]: ')).upper().strip()[0]
print('=-' * 20)
if continuacao not in 'SN':
while True:
continuacao = str(input('OPO INVLIDA! Quer continuar[S/N]: ')).upper().strip()[0]
if continuacao in 'SN':
break
if continuacao == 'N':
break
print('=-' * 20)
print(f' -> {contmaior} pessoas so maiores de 18 anos;')
print(f' -> {contahomi} homens foram cadastrados;')
print(f' -> {contamuie} mulheres so menores de 20 anos.')
| [
3642,
2611,
1504,
796,
657,
198,
3642,
993,
12753,
796,
657,
198,
3642,
321,
84,
494,
796,
657,
198,
4514,
6407,
25,
198,
220,
220,
220,
3601,
10786,
34,
2885,
11262,
2200,
471,
5673,
350,
7597,
23621,
11537,
198,
220,
220,
220,
360... | 2.020522 | 536 |
from django.conf.urls import patterns, url
from .views import template_test
urlpatterns = patterns(
'',
url(r'^', template_test, name='template_test2'),
) | [
6738,
42625,
14208,
13,
10414,
13,
6371,
82,
1330,
7572,
11,
19016,
198,
198,
6738,
764,
33571,
1330,
11055,
62,
9288,
628,
198,
6371,
33279,
82,
796,
7572,
7,
198,
220,
220,
220,
705,
3256,
198,
220,
220,
220,
19016,
7,
81,
6,
61... | 2.844828 | 58 |