blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
616
content_id
stringlengths
40
40
detected_licenses
listlengths
0
69
license_type
stringclasses
2 values
repo_name
stringlengths
5
118
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
63
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
2.91k
686M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
23 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
213 values
src_encoding
stringclasses
30 values
language
stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
2
10.3M
extension
stringclasses
246 values
content
stringlengths
2
10.3M
authors
listlengths
1
1
author_id
stringlengths
0
212
bf75b391e67ef7dcf580f0fb97d21a45b023234d
38d08ac4dec726fe72aa90ad78c6330fa3e9d19e
/nagios/libexec/linux-cpu-usage.py
db550ea78ae7af7232ca678a7468de5c8dd6dcce
[]
no_license
huanpc/monitoring_TIC
9583fdea34cb2835c594e4c6f4736b2fcac2eac4
26fa0a04166a0d27a39347c87280409e8e2e9a7a
refs/heads/master
2021-05-10T17:12:53.929269
2018-09-20T06:46:20
2018-09-20T06:46:20
118,602,054
0
1
null
null
null
null
UTF-8
Python
false
false
4,870
py
#!/usr/bin/env python import sys import time from optparse import OptionParser ### Global Identifiers ### cpu_stat_var_array = ('user', 'nice', 'system', 'idle', 'iowait', 'irq', 'softirq', 'steal_time') ### Main code ### # Command Line Arguments Parser cmd_parser = OptionParser(version="%prog 0.1") cmd_parser.add_option("-C", "--CPU", action="store", type="string", dest="cpu_name", help="Which CPU to be Check", metavar="cpu or cpu0 or cpu1") cmd_parser.add_option("-w", "--warning", type="int", action="store", dest="warning_per", help="Exit with WARNING status if higher than the PERCENT of CPU Usage", metavar="Warning Percentage") cmd_parser.add_option("-c", "--critical", type="int", action="store", dest="critical_per", help="Exit with CRITICAL status if higher than the PERCENT of CPU Usage", metavar="Critical Percentage") cmd_parser.add_option("-d", "--debug", action="store_true", dest="debug", default=False, help="enable debug") cmd_parser.add_option("-U", "--useronly", action="store_true", dest="user_only", default=False, help="Check only user cpu usage") (cmd_options, cmd_args) = cmd_parser.parse_args() # Check the Command syntax if not (cmd_options.cpu_name and cmd_options.warning_per and cmd_options.critical_per): cmd_parser.print_help() sys.exit(3) # Collect CPU Statistic Object class CollectStat: """Object to Collect CPU Statistic Data""" def __init__(self,cpu_name): self.total = 0 self.cpu_stat_dict = {} for line in open("/proc/stat"): line = line.strip() if line.startswith(cpu_name): cpustat=line.split() cpustat.pop(0) # Remove the First Array of the Line 'cpu' # Remove the unwanted data from the array # only retain first 8 field on the file while len(cpustat) > 8: cpustat.pop() if cmd_options.debug: print "DEBUG : cpustat array %s" % cpustat cpustat=map(float, cpustat) # Convert the Array to Float for i in range(len(cpustat)): self.cpu_stat_dict[cpu_stat_var_array[i]] = cpustat[i] # Calculate the total utilization for i in cpustat: self.total += i break if cmd_options.debug: print "DEBUG : cpu statistic dictionary %s" % self.cpu_stat_dict print "DEBUG : total statistics %s" % self.total # Get Sample CPU Statistics initial_stat = CollectStat(cmd_options.cpu_name) time.sleep(5) final_stat = CollectStat(cmd_options.cpu_name) cpu_total_stat = final_stat.total - initial_stat.total if cmd_options.debug: print "DEBUG : diff total stat %f" % cpu_total_stat for cpu_stat_var,cpu_stat in final_stat.cpu_stat_dict.items(): globals()['cpu_%s_usage_percent' % cpu_stat_var] = ((final_stat.cpu_stat_dict[cpu_stat_var] - initial_stat.cpu_stat_dict[cpu_stat_var])/cpu_total_stat)*100 cpu_usage_percent = cpu_user_usage_percent + cpu_nice_usage_percent + cpu_system_usage_percent + cpu_iowait_usage_percent + cpu_irq_usage_percent + cpu_softirq_usage_percent + cpu_steal_time_usage_percent if (cmd_options.user_only): cpu_usage_percent = cpu_user_usage_percent # Check if CPU Usage is Critical/Warning/OK if cpu_usage_percent >= cmd_options.critical_per: print cmd_options.cpu_name +' STATISTICS CRITICAL : user=%.2f%% system=%.2f%% iowait=%.2f%% steal=%.2f%% | user=%.2f system=%.2f iowait=%.2f steal=%.2f warn=%d crit=%d' % (cpu_user_usage_percent, cpu_system_usage_percent, cpu_iowait_usage_percent, cpu_steal_time_usage_percent, cpu_user_usage_percent, cpu_system_usage_percent, cpu_iowait_usage_percent, cpu_steal_time_usage_percent, cmd_options.warning_per, cmd_options.critical_per) sys.exit(2) elif cpu_usage_percent >= cmd_options.warning_per: print cmd_options.cpu_name +' STATISTICS WARNING : user=%.2f%% system=%.2f%% iowait=%.2f%% steal=%.2f%% | user=%.2f system=%.2f iowait=%.2f steal=%.2f warn=%d crit=%d' % (cpu_user_usage_percent, cpu_system_usage_percent, cpu_iowait_usage_percent, cpu_steal_time_usage_percent, cpu_user_usage_percent, cpu_system_usage_percent, cpu_iowait_usage_percent, cpu_steal_time_usage_percent, cmd_options.warning_per, cmd_options.critical_per) sys.exit(1) else: print cmd_options.cpu_name +' STATISTICS OK : user=%.2f%% system=%.2f%% iowait=%.2f%% steal=%.2f%% | user=%.2f system=%.2f iowait=%.2f steal=%.2f warn=%d crit=%d' % (cpu_user_usage_percent, cpu_system_usage_percent, cpu_iowait_usage_percent, cpu_steal_time_usage_percent, cpu_user_usage_percent, cpu_system_usage_percent, cpu_iowait_usage_percent, cpu_steal_time_usage_percent, cmd_options.warning_per, cmd_options.critical_per) sys.exit(0)
[ "huanpc2@cyberspace.vn" ]
huanpc2@cyberspace.vn
c16c18cfe3dd6df0a9483ba0946285781057098e
238ebc43c3d54d2842de75fd8ddf0b0b0261906e
/GeoAnimation.py
32f0dc20216e0342f08f233fc9011bb4fc0aaf90
[]
no_license
johndowen/CrossMgr
17c114ab80382b24ce0cdd228782bd000f513ea8
fc9eaf8ae5d4919cef3f1a3680c169be70cf356b
refs/heads/master
2021-06-28T03:14:41.682880
2017-09-17T00:35:26
2017-09-17T00:35:26
null
0
0
null
null
null
null
UTF-8
Python
false
false
38,567
py
import wx import random import math from math import radians, degrees, sin, cos, asin, sqrt, atan2, exp, modf, pi import bisect import sys import datetime import os import re import io import cgi import getpass import socket from Version import AppVerName from Animation import GetLapRatio import Utils import xml.etree.ElementTree import xml.etree.cElementTree import xml.dom import xml.dom.minidom from GpxParse import GpxParse import collections import zipfile def LineNormal( x1, y1, x2, y2, normLen ): ''' Returns the coords of a normal line passing through x1, y1 of length normLen. ''' dx, dy = x2 - x1, y2 - y1 scale = (normLen / 2.0) / sqrt( dx**2 + dy**2 ) dx *= scale dy *= scale return x1 + dy, y1 - dx, x1 - dy, y1 + dx def GreatCircleDistance( lat1, lon1, lat2, lon2 ): """ Calculate the great circle distance between two points on the earth (specified in decimal degrees) in meters. """ # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) # haversine formula dlon = lon2 - lon1 dlat = lat2 - lat1 a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2 c = 2.0 * asin(sqrt(max(a, 0.0))) m = 6371000.0 * c return m def GreatCircleDistance3D( lat1, lon1, ele1, lat2, lon2, ele2 ): d = GreatCircleDistance( lat1, lon1, lat2, lon2 ) return sqrt( d ** 2 + (ele2 - ele1) ** 2 ) def GradeAdjustedDistance( lat1, lon1, ele1, lat2, lon2, ele2 ): d = GreatCircleDistance(lat1, lon1, lat2, lon2 ) if not d: return 0.0 a = atan2( ele2 - ele1, d ) m = 2.0 / (1.0 + exp(-a * 2.5)) # Use a sigmoid curve to approximate the effect of grade on speed. return m * d LatLonEle = collections.namedtuple('LatLonEle', ['lat','lon','ele', 't'] ) GpsPoint = collections.namedtuple('GpsPoint', ['lat','lon','ele','x','y','d','dCum'] ) def triangle( t, a ): a = float(a) return (2 / a) * (t - a * int(t / a + 0.5)) * (-1 ** int(t / a + 0.5)) def CompassBearing(lat1, lon1, lat2, lon2): """ Calculates the bearing between two points. """ lat1 = radians(lat1) lat2 = radians(lat2) diffLong = math.radians(lon2 - lon1) x = sin(diffLong) * cos(lat2) y = cos(lat1) * sin(lat2) - (sin(lat1) * cos(lat2) * cos(diffLong)) initial_bearing = atan2(x, y) # Now we have the initial bearing but math.atan2 return values # from -180 to + 180 which is not what we want for a compass bearing # The solution is to normalize the initial bearing as shown below initial_bearing = degrees(initial_bearing) compass_bearing = (initial_bearing + 360) % 360 return compass_bearing reGpxTime = re.compile( '[^0-9+]' ) def GpxHasTimes( fname ): ''' Check that the gpx file contains valid times. ''' points = GpxParse( fname ) tLast = None for p in points: try: t = p['time'] except KeyError: return False if tLast is not None and tLast > t: return False tLast = t return True def LatLonElesToGpsPoints( latLonEles, useTimes = False, isPointToPoint = False ): hasTimes = useTimes latMin, lonMin = 1000.0, 1000.0 for latLonEle in latLonEles: if latLonEle.t is None: hasTimes = False if latLonEle.lat < latMin: latMin = latLonEle.lat if latLonEle.lon < lonMin: lonMin = latLonEle.lon gpsPoints = [] dCum = 0.0 for i in xrange(len(latLonEles) - (1 if isPointToPoint else 0)): p, pNext = latLonEles[i], latLonEles[(i+1) % len(latLonEles)] if hasTimes: if pNext.t > p.t: gad = (pNext.t - p.t).total_seconds() else: # Estimate the last time difference based on the speed of the last segment. pPrev = latLonEles[(i+len(latLonEles)-1)%len(latLonEles)] d = GreatCircleDistance( pPrev.lat, pPrev.lon, p.lat, p.lon ) t = (p.t - pPrev.t).total_seconds() if t > 0: s = d / t gad = GreatCircleDistance( p.lat, p.lon, pNext.lat, pNext.lon ) / s else: gad = 0.0 else: gad = GradeAdjustedDistance( p.lat, p.lon, p.ele, pNext.lat, pNext.lon, pNext.ele ) x = GreatCircleDistance( latMin, lonMin, latMin, p.lon ) y = GreatCircleDistance( latMin, lonMin, p.lat, lonMin ) if gad > 0.0: gpsPoints.append( GpsPoint(p.lat, p.lon, p.ele, x, y, gad, dCum) ) dCum += gad return gpsPoints def ParseGpxFile( fname, useTimes = False, isPointToPoint = False ): points = GpxParse( fname ) latLonEles = [] for p in points: lat, lon, ele, t = p['lat'], p['lon'], p.get('ele',0.0), p.get('time', None) # Skip consecutive duplicate points. try: if latLonEles[-1].lat == lat and latLonEles[-1].lon == lon: continue except IndexError: pass latLonEles.append( LatLonEle(lat, lon, ele, t) ) return latLonEles def createAppendChild( doc, parent, name, textAttr={} ): child = doc.createElement( name ) parent.appendChild( child ) for k, v in textAttr.iteritems(): attr = doc.createElement( k ) if isinstance(v, float) and modf(v)[0] == 0.0: v = int(v) attr.appendChild( doc.createTextNode( '{:.6f}'.format(v) if isinstance(v, float) else '{}'.format(v) ) ) child.appendChild( attr ) return child def createAppendTextChild( doc, parent, text ): child = doc.createTextNode( text ) parent.appendChild( child ) return child def CreateGPX( courseName, gpsPoints ): ''' Create a GPX file from the gpsPoints list. ''' doc = xml.dom.minidom.Document() gpx = createAppendChild( doc, doc, 'gpx' ) gpx.attributes['creator'] = AppVerName + ' http://sites.google.com/site/crossmgrsoftware/' gpx.attributes['xmlns'] ="http://www.topografix.com/GPX/1/0" gpx.attributes['xmlns:xsi'] = "http://www.w3.org/2001/XMLSchema-instance" gpx.attributes['xsi:schemaLocation'] = "http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd" gpx.appendChild( doc.createComment( u'\n'.join( [ '', 'DO NOT EDIT!', '', u'This file was created automatically by {}.'.format(AppVerName), '', 'For more information, see http://sites.google.com/site/crossmgrsoftware', '', 'Created: {}'.format(datetime.datetime.now().strftime( '%Y-%m-%d %H:%M:%S' )), 'User: {}'.format(cgi.escape(getpass.getuser())), 'Computer: {}'.format(cgi.escape(socket.gethostname())), '', ] ) ) ) trk = createAppendChild( doc, gpx, 'trk', { 'name': courseName, } ) trkseg = createAppendChild( doc, trk, 'trkseg' ) for p in gpsPoints: trkpt = createAppendChild( doc, trkseg, 'trkpt' ) trkpt.attributes['lat'] = '{}'.format(p.lat) trkpt.attributes['lon'] = '{}'.format(p.lon) if p.ele: ele = createAppendChild( doc, trkpt, 'ele' ) createAppendTextChild( doc, ele, '{}'.format(p.ele) ) return doc class GeoTrack( object ): def __init__( self ): self.gpsPoints = [] self.distanceTotal = 0.0 self.cumDistance = [] self.x = 0 self.xMax = self.yMax = 0.0 self.yBottom = 0 self.mult = 1.0 self.length = 0.0 self.totalElevationGain = 0.0 self.isPointToPoint = False self.cache = {} def computeSummary( self ): lenGpsPoints = len(self.gpsPoints) length = 0.0 totalElevationGain = 0.0 self.isPointToPoint = getattr( self, 'isPointToPoint', False ) for i in xrange(lenGpsPoints - (1 if self.isPointToPoint else 0)): pCur, pNext = self.gpsPoints[i], self.gpsPoints[(i + 1) % lenGpsPoints] length += GreatCircleDistance3D( pCur.lat, pCur.lon, pCur.ele, pNext.lat, pNext.lon, pNext.ele ) totalElevationGain += max(0.0, pNext.ele - pCur.ele) self.length = length self.totalElevationGain = totalElevationGain def setPoints( self, gpsPoints, isPointToPoint = False ): self.gpsPoints = gpsPoints self.isPointToPoint = isPointToPoint self.xMax = max( p.x for p in self.gpsPoints ) self.yMax = max( p.y for p in self.gpsPoints ) dCum = 0.0 self.cumDistance = [] for p in self.gpsPoints: self.cumDistance.append( dCum ) dCum += p.d self.distanceTotal = dCum self.computeSummary() def read( self, fname, useTimes = False, isPointToPoint = False ): self.isPointToPoint = isPointToPoint latLonEles = ParseGpxFile( fname, useTimes=useTimes, isPointToPoint=isPointToPoint ) gpsPoints = LatLonElesToGpsPoints( latLonEles, useTimes=useTimes, isPointToPoint=isPointToPoint ) self.setPoints( gpsPoints, isPointToPoint=isPointToPoint ) def getGPX( self, courseName ): return CreateGPX( courseName, self.gpsPoints ) def writeGPXFile( self, fname ): with io.open( fname, 'wb' ) as fp: self.getGPX( os.path.splitext(os.path.basename(fname))[0] ).writexml(fp, indent="", addindent=" ", newl="\n", encoding='utf-8') def readElevation( self, fname ): header = None distance, elevation = [], [] iDistance, iElevation = None, None with open(fname, 'r') as fp: for line in fp: fields = [f.strip() for f in line.split(',')] if not header: header = fields for i, h in enumerate(header): h = h.lower() if h.startswith('distance'): iDistance = i elif h.startswith('elevation'): iElevation = i assert iDistance is not None and iElevation is not None, 'Invalid header in file.' else: distance.append( float(fields[iDistance]) ) elevation.append( float(fields[iElevation]) ) if len(elevation) < 2: return lenGpsPoints = len(self.gpsPoints) length = 0.0 for i in xrange(lenGpsPoints-1): pCur, pNext = self.gpsPoints[i], self.gpsPoints[(i + 1) % lenGpsPoints] length += GreatCircleDistance( pCur.lat, pCur.lon, pNext.lat, pNext.lon ) distanceMult = distance[-1] / length # Update the known GPS points with the proportional elevation. length = 0.0 iSearch = 0 for i in xrange(lenGpsPoints): pCur, pNext = self.gpsPoints[i], self.gpsPoints[(i + 1) % lenGpsPoints] d = min( length * distanceMult, distance[-1] ) for iSearch in xrange(iSearch, len(elevation) - 2): if distance[iSearch] <= d < distance[iSearch+1]: break deltaDistance = max( distance[iSearch+1] - distance[iSearch], 0.000001 ) ele = elevation[iSearch] + (elevation[iSearch+1] - elevation[iSearch]) * \ (d - distance[iSearch]) / deltaDistance self.gpsPoints[i] = pCur._replace( ele = ele ) length += GreatCircleDistance( pCur.lat, pCur.lon, pNext.lat, pNext.lon ) self.computeSummary() def getXYTrack( self ): x, yBottom, mult = self.x, self.yBottom, self.mult return [(p.x * mult + x, yBottom - p.y * mult) for p in self.gpsPoints] def asExportJson( self ): return [ [int(getattr(p, a)*10.0) for a in ('x', 'y', 'd')] for p in self.gpsPoints ] def getAltigraph( self ): if not self.gpsPoints or all( p.ele == 0.0 for p in self.gpsPoints ): return [] altigraph = [(0.0, self.gpsPoints[0].ele)] p = self.gpsPoints for i in xrange(1, len(p)): altigraph.append( (altigraph[-1][0] + GreatCircleDistance(p[i-1].lat, p[i-1].lon, p[i].lat, p[i].lon), p[i].ele) ) altigraph.append( (altigraph[-1][0] + GreatCircleDistance(p[-1].lat, p[-1].lon, p[0].lat, p[0].lon), p[0].ele) ) return altigraph def isClockwise( self ): if not self.gpsPoints: return False p = self.gpsPoints return sum( (p[j].x - p[j-1].x) * (p[j].y + p[j-1].y) for j in xrange(len(self.gpsPoints)) ) > 0.0 def reverse( self ): ''' Reverse the points in the track. Make sure the distance to the next point and cumDistance is correct. ''' self.cumDistance = [] gpsPointsReversed = [] dCum = 0.0 for i in xrange(len(self.gpsPoints)-1, -1, -1): p = self.gpsPoints[i] pPrev = self.gpsPoints[i-1 if i > 0 else len(self.gpsPoints)-1] gpsPointsReversed.append( GpsPoint(p.lat, p.lon, p.ele, p.x, p.y, pPrev.d, dCum) ) self.cumDistance.append( dCum ) dCum += pPrev.d self.gpsPoints = gpsPointsReversed def setClockwise( self, clockwise = True ): if self.isClockwise() != clockwise: self.reverse() def asCoordinates( self ): coordinates = [] for p in self.gpsPoints: coordinates.append( p.lon ) coordinates.append( p.lat ) return coordinates def asKmlTour( self, raceName=None, speedKMH=None ): race = raceName or 'Race' speed = (speedKMH or 35.0) * (1000.0 / (60.0*60.0)) doc = xml.dom.minidom.Document() kml = createAppendChild( doc, doc, 'kml' ) kml.attributes['xmlns'] = "http://www.opengis.net/kml/2.2" kml.attributes['xmlns:gx'] = "http://www.google.com/kml/ext/2.2" kml.appendChild( doc.createComment( '\n'.join( [ '', 'DO NOT EDIT!', '', 'This file was created automatically by CrossMgr.', '', 'Is shows a fly-through of the actual bicycle race course.', 'For more information, see http://sites.google.com/site/crossmgrsoftware', '', 'Created: {}'.format(datetime.datetime.now().strftime( '%Y/%m/%d %H:%M:%S' )), 'User: {}'.format(cgi.escape(getpass.getuser())), 'Computer: {}'.format(cgi.escape(socket.gethostname())), '', ] ) ) ) Document = createAppendChild( doc, kml, 'Document', { 'open': 1, 'name': raceName, } ) # Define some styles. Style = createAppendChild( doc, Document, 'Style' ) Style.attributes['id'] = 'thickBlueLine' LineStyle = createAppendChild( doc, Style, 'LineStyle', { 'width': 5, 'color': '#7fff0000', # aabbggrr } ) # Define an flying tour around the course. Tour = createAppendChild( doc, Document, 'gx:Tour', { 'name': '{}: Tour'.format(race), } ) Playlist = createAppendChild( doc, Tour, 'gx:Playlist' ) def fly( doc, PlayList, p, mode, duration, heading ): FlyTo = createAppendChild( doc, Playlist, 'gx:FlyTo', { 'gx:duration': duration, 'gx:flyToMode': mode, } ) Camera = createAppendChild( doc, FlyTo, 'Camera', { 'latitude': p.lat, 'longitude': p.lon, 'altitude': 2, 'altitudeMode': 'relativeToGround', 'heading': heading, 'tilt': 80, } ) # Fly to the starting point. p, pNext = self.gpsPoints[:2] fly( doc, Playlist, p, 'bounce', 3, CompassBearing(p.lat, p.lon, pNext.lat, pNext.lon) ) # Follow the path through all the points. lenGpsPoints = len(self.gpsPoints) for i in xrange(1, lenGpsPoints + (0 if self.isPointToPoint else 1)): pPrev, p = self.gpsPoints[i-1], self.gpsPoints[i%lenGpsPoints] fly(doc, Playlist, p, 'smooth', GreatCircleDistance(pPrev.lat, pPrev.lon, p.lat, p.lon) / speed, CompassBearing(pPrev.lat, pPrev.lon, p.lat, p.lon) ) if self.isPointToPoint: # Marker for the start line. Placemark = createAppendChild( doc, Document, 'Placemark', {'name': '{}: Start Line'.format(race)} ) createAppendChild( doc, Placemark, 'Point', { 'coordinates': '{},{}'.format(self.gpsPoints[0].lon, self.gpsPoints[0].lat) } ) pFinish = self.gpsPoints[-1] else: pFinish = self.gpsPoints[0] # Marker for the finish line. Placemark = createAppendChild( doc, Document, 'Placemark', {'name': '{}: Finish Line'.format(race)} ) createAppendChild( doc, Placemark, 'Point', {'coordinates': '{},{}'.format(pFinish.lon, pFinish.lat)} ) # Path for the course. Placemark = createAppendChild( doc, Document, 'Placemark', { 'name': '{}: Course'.format(race), 'styleUrl': '#thickBlueLine', } ) coords = [''] for i in xrange(lenGpsPoints + (0 if self.isPointToPoint else 1)): p = self.gpsPoints[i % lenGpsPoints] coords.append( '{},{}'.format(p.lon, p.lat) ) coords.append('') LineString = createAppendChild( doc, Placemark, 'LineString', { 'tessellate': 1, 'altitudeMode': 'clampToGround', 'coordinates': '\n'.join(coords), } ) ret = doc.toprettyxml( indent=' ' ) doc.unlink() return ret def getXY( self, lap, id = None ): # Find the segment at this distance in the lap. lap = modf(lap)[0] # Get fraction of lap. lapDistance = lap * self.distanceTotal # Get distance traveled in the lap. # Avoid the cost of the binary search by checking if the id request is still on the last segment. lenGpsPoints = len(self.gpsPoints) try: i = self.cache[id] pCur = self.gpsPoints[i] if not (pCur.dCum <= lapDistance <= pCur.dCum + pCur.d): i = (i + 1) % lenGpsPoints pCur = self.gpsPoints[i] if not (pCur.dCum <= lapDistance <= pCur.dCum + pCur.d): i = None except (IndexError, KeyError): i = None if i is None: # Find the closest point LT the lap distance. i = bisect.bisect_right( self.cumDistance, lapDistance ) i %= lenGpsPoints if self.cumDistance[i] > lapDistance: i -= 1 self.cache[id] = i pCur, pNext = self.gpsPoints[i], self.gpsPoints[(i + 1) % lenGpsPoints] segDistance = lapDistance - self.cumDistance[i] segRatio = 0.0 if pCur.d <= 0.0 else segDistance / pCur.d x, y = pCur.x + (pNext.x - pCur.x) * segRatio, pCur.y + (pNext.y - pCur.y) * segRatio return x * self.mult + self.x, self.yBottom - y * self.mult @property def lengthKm( self ): return self.length / 1000.0 @property def lengthMiles( self ): return self.length * 0.621371/1000.0 @property def totalElevationGainM( self ): try: return self.totalElevationGain except AttributeError: self.totalElevationGain = sum( max(0.0, self.gpsPoints[i].ele - self.gpsPoints[i-1].ele) for i in xrange(len(self.gpsPoints)) ) return self.totalElevationGain @property def totalElevationGainFt( self ): return self.totalElevationGainM * 3.28084 @property def numPoints( self ): return len(self.gpsPoints) def setDisplayRect( self, x, y, width, height ): if width <= 0 or height <= 0: self.mult = 1.0 self.x = x self.yBottom = y + height return mult = min( width / self.xMax, height / self.yMax ) w, h = self.xMax * mult, self.yMax * mult xBorder = (width - w) / 2.0 yBorder = (height - h) / 2.0 self.mult = mult self.x = xBorder + x self.yBottom = y + height shapes = [ [(cos(a), -sin(a)) \ for a in (q*(2.0*pi/i)+pi/2.0+(2.0*pi/(i*2.0) if i % 2 == 0 else 0)\ for q in xrange(i))] for i in xrange(3,9)] def DrawShape( dc, num, x, y, radius ): dc.DrawPolygon( [ wx.Point(p*radius+x, q*radius+y) for p,q in shapes[num % len(shapes)] ] ) class GeoAnimation(wx.Control): topFewCount = 5 infoLines = 1 def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER, validator=wx.DefaultValidator, name="GeoAnimation"): wx.Control.__init__(self, parent, id, pos, size, style, validator, name) self.SetBackgroundColour('white') self.data = {} self.categoryDetails = {} self.t = 0 self.tMax = None self.tDelta = 1 self.r = 100 # Radius of the turns of the fictional track. self.laneMax = 8 self.geoTrack = None self.compassLocation = '' self.widthLast = -1 self.heightLast = -1 self.xBanner = 300 self.tBannerLast = None self.course = 'geo' self.units = 'km' self.framesPerSecond = 32 self.lapCur = 0 self.iLapDistance = 0 self.tLast = datetime.datetime.now() self.speedup = 1.0 self.suspendGeoAnimation = False self.numsToWatch = set() self.checkeredFlag = wx.Bitmap(os.path.join(Utils.getImageFolder(), 'CheckeredFlag.png'), wx.BITMAP_TYPE_PNG) trackRGB = [int('7FE57F'[i:i+2],16) for i in xrange(0, 6, 2)] self.trackColour = wx.Colour( *trackRGB ) self.colours = [] k = [0,32,64,128,128+32,128+64,255] for r in k: for g in k: for b in k: if sum( abs(c - t) for c, t in zip([r,g,b],trackRGB) ) > 80 and \ sum( c for c in [r,g,b] ) > 64: self.colours.append( wx.Colour(r, g, b) ) random.seed( 1234 ) random.shuffle( self.colours ) self.topFewColours = [ wx.Colour(255,215,0), wx.Colour(230,230,230), wx.Colour(205,133,63) ] while len(self.topFewColours) < self.topFewCount: self.topFewColours.append( wx.Colour(200,200,200) ) self.trackColour = wx.Colour( *[int('7FE57F'[i:i+2],16) for i in xrange(0, 6, 2)] ) # Cache the fonts if the size does not change. self.numberFont = None self.timeFont = None self.highlightFont = None self.rLast = -1 self.timer = wx.Timer( self, id=wx.NewId()) self.Bind( wx.EVT_TIMER, self.NextFrame, self.timer ) # Bind the events related to our control: first of all, we use a # combination of wx.BufferedPaintDC and an empty handler for # wx.EVT_ERASE_BACKGROUND (see later) to reduce flicker self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) self.Bind(wx.EVT_SIZE, self.OnSize) def SetGeoTrack( self, geoTrack ): if self.geoTrack != geoTrack: self.geoTrack = geoTrack def SetOptions( self, *argc, **kwargs ): pass def DoGetBestSize(self): return wx.Size(400, 200) def _initGeoAnimation( self ): self.tLast = datetime.datetime.now() self.suspendGeoAnimation = False def Animate( self, tRunning, tMax = None, tCur = 0.001 ): self.StopAnimate(); self._initGeoAnimation() self.t = tCur if not self.data: return if tMax is None: tMax = 0 for num, info in self.data.iteritems(): try: tMax = max(tMax, info['raceTimes'][-1]) except IndexError: pass self.speedup = float(tMax) / float(tRunning) self.tMax = tMax self.timer.Start( 1000.0/self.framesPerSecond, False ) def StartAnimateRealtime( self ): self.StopAnimate(); self._initGeoAnimation() self.speedup = 1.0 self.tMax = 999999 self.timer.Start( 1000.0/self.framesPerSecond, False ) def StopAnimate( self ): if self.timer.IsRunning(): self.timer.Stop() self.tBannerLast = None def SetNumsToWatch( self, numsToWatch ): self.numsToWatch = numsToWatch self.Refresh() def SuspendAnimate( self ): self.suspendGeoAnimation = True def IsAnimating( self ): return not self.suspendGeoAnimation and self.timer.IsRunning() def SetTime( self, t ): self.t = t self.Refresh() def NextFrame( self, event ): if event.GetId() == self.timer.GetId(): tNow = datetime.datetime.now() tDelta = tNow - self.tLast self.tLast = tNow secsDelta = tDelta.seconds + tDelta.microseconds / 1000000.0 self.SetTime( self.t + secsDelta * self.speedup ) if self.suspendGeoAnimation or self.t >= self.tMax: self.StopAnimate() def SetForegroundColour(self, colour): wx.Control.SetForegroundColour(self, colour) self.Refresh() def SetBackgroundColour(self, colour): wx.Control.SetBackgroundColour(self, colour) self.Refresh() def GetDefaultAttributes(self): """ Overridden base class virtual. By default we should use the same font/colour attributes as the native wx.StaticText. """ return wx.StaticText.GetClassDefaultAttributes() def ShouldInheritColours(self): """ Overridden base class virtual. If the parent has non-default colours then we want this control to inherit them. """ return True def SetData( self, data, tCur = None, categoryDetails = None ): """ * data is a rider information indexed by number. Info includes lap times and lastTime times. * lap times should include the start offset. Example: data = { 101: { raceTimes: [xx, yy, zz], lastTime: None }, 102 { raceTimes: [aa, bb], lastTime: cc} } """ self.data = data if data else {} self.categoryDetails = categoryDetails if categoryDetails else {} for num, info in self.data.iteritems(): info['iLast'] = 1 if info['status'] == 'Finisher' and info['raceTimes']: info['finishTime'] = info['raceTimes'][-1] else: info['finishTime'] = info['lastTime'] # Get the units. for num, info in self.data.iteritems(): if info['status'] == 'Finisher': try: self.units = 'miles' if 'mph' in info['speed'] else 'km' except KeyError: self.units = 'km' break if tCur is not None: self.t = tCur; self.tBannerLast = None self.Refresh() def getShortName( self, num ): try: info = self.data[num] except KeyError: return '' lastName = info.get('LastName','') firstName = info.get('FirstName','') if lastName: if firstName: return '%s, %s.' % (lastName, firstName[:1]) else: return lastName return firstName def OnPaint(self, event): dc = wx.BufferedPaintDC(self) self.Draw(dc) def OnSize(self, event): self.Refresh() event.Skip() def getRiderPositionTime( self, num ): """ Returns the fraction of the lap covered by the rider and the time. """ if num not in self.data: return (None, None) info = self.data[num] raceTimes = info['raceTimes'] if not raceTimes or self.t < raceTimes[0] or len(raceTimes) < 2: return (None, None) tSearch = self.t finishTime = info['finishTime'] if finishTime is not None and finishTime < self.t: if finishTime == raceTimes[-1]: return (len(raceTimes), finishTime) tSearch = finishTime if tSearch >= raceTimes[-1]: p = len(raceTimes) + float(tSearch - raceTimes[-1]) / float(raceTimes[-1] - raceTimes[-2]) else: i = info['iLast'] if not (raceTimes[i-1] < tSearch <= raceTimes[i]): i += 1 if not (raceTimes[i-1] < tSearch <= raceTimes[i]): i = bisect.bisect_left( raceTimes, tSearch ) info['iLast'] = i if i == 1: firstLapRatio = info['flr'] p = float(tSearch - raceTimes[i-1]) / float(raceTimes[i] - raceTimes[i-1]) p = 1.0 - firstLapRatio + p * firstLapRatio p -= math.floor(p) - 1.0 else: p = i + float(tSearch - raceTimes[i-1]) / float(raceTimes[i] - raceTimes[i-1]) return (p, tSearch) def getRiderXYPT( self, num ): positionTime = self.getRiderPositionTime( num ) if positionTime[0] is None: return None, None, None, None if self.data[num]['finishTime'] is not None and self.t >= self.data[num]['finishTime']: self.lapCur = max(self.lapCur, len(self.data[num]['raceTimes'])) return (None, None, positionTime[0], positionTime[1]) self.lapCur = max(self.lapCur, int(positionTime[0])) xy = self.geoTrack.getXY( positionTime[0], num ) return xy[0], xy[1], positionTime[0], positionTime[1] def drawBanner( self, dc, width, height, tHeight, bannerItems ): blue = wx.Colour(0, 0, 200) dc.SetPen( wx.Pen(blue) ) dc.SetBrush( wx.Brush(blue, wx.SOLID) ) dc.DrawRectangle( 0, 0, width, tHeight*1.1 ) if not bannerItems: return y = tHeight * 0.1 tHeight *= 0.85 x = self.xBanner while x < width: for bi in bannerItems: if x >= width: break position, num, name = u'{}'.format(bi[1]), u'{}'.format(bi[0]), self.getShortName(bi[0]) if position == '1': x += tHeight / 2 tWidth = self.checkeredFlag.Width if x + tWidth > 0 and x < width: dc.DrawBitmap( self.checkeredFlag, x, y, False ) x += tWidth + tHeight / 2 dc.SetFont( self.positionFont ) tWidth = dc.GetTextExtent( position )[0] if x + tWidth > 0 and x < width: dc.SetTextForeground( wx.WHITE ) dc.DrawText( position, x, y ) x += tWidth + tHeight / 4 dc.SetFont( self.bibFont ) tWidth = dc.GetTextExtent(num)[0] if x + tWidth > 0 and x < width: dc.SetTextForeground( 'YELLOW' ) dc.DrawText(num, x, y ) x += tWidth + tHeight / 3 dc.SetFont( self.nameFont ) tWidth = dc.GetTextExtent(name)[0] if x + tWidth > 0 and x < width: dc.SetTextForeground( wx.WHITE ) dc.DrawText(name, x, y ) x += tWidth + tHeight if x < 0: self.xBanner = x tBanner = datetime.datetime.now() if self.tBannerLast is None: self.tBannerLast = tBanner self.xBanner -= 64.0 * (tBanner - self.tBannerLast).total_seconds() self.tBannerLast = tBanner def Draw(self, dc): size = self.GetClientSize() width = size.width height = size.height backColour = self.GetBackgroundColour() backBrush = wx.Brush(backColour, wx.SOLID) dc.SetBackground(backBrush) dc.Clear() if width < 80 or height < 80 or not self.geoTrack: return avePoints = 1 isPointToPoint = getattr(self.geoTrack, 'isPointToPoint', False) self.r = int(width / 4) if self.r * 2 > height: self.r = int(height / 2) self.r -= (self.r & 1) # Make sure that r is an even number. r = self.r # Get the fonts if needed. if self.rLast != r: tHeight = int(r / 8.0) self.numberFont = wx.Font( (0,tHeight), wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL ) self.timeFont = self.numberFont self.highlightFont = wx.Font( (0,tHeight * 1.6), wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL ) self.positionFont = wx.Font( (0,tHeight*0.85*0.7), wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL ) self.bibFont = wx.Font( (0,tHeight*0.85), wx.FONTFAMILY_SWISS, wx.FONTSTYLE_ITALIC, wx.FONTWEIGHT_BOLD ) self.nameFont = wx.Font((0,tHeight*0.85), wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD ) self.rLast = r tHeight = int(r / 8.0) textVSpace = tHeight*0.2 laneWidth = (r/2) / self.laneMax border = laneWidth * 1.5 / 2 trackWidth = width - border * 2 topMargin = border + tHeight + textVSpace trackHeight = height - topMargin - border self.geoTrack.setDisplayRect( border, topMargin, trackWidth, trackHeight ) # Draw the course. dc.SetBrush( wx.TRANSPARENT_BRUSH ) drawPoints = self.geoTrack.getXYTrack() if width != self.widthLast or height != self.heightLast: self.widthLast, self.heightLast = width, height locations = ['NE', 'SE', 'NW', 'SW', ] compassWidth, compassHeight = width * 0.25, height * 0.25 inCountBest = len(drawPoints) + 1 self.compassLocation = locations[0] for loc in locations: xCompass = 0 if 'W' in loc else width - compassWidth yCompass = 0 if 'S' in loc else height - compassHeight inCount = sum( 1 for x, y in drawPoints if xCompass <= x < xCompass + compassWidth and yCompass <= y < yCompass + compassHeight ) if inCount < inCountBest: inCountBest = inCount self.compassLocation = loc if inCount == 0: break dc.SetPen( wx.Pen(wx.Colour(128,128,128), laneWidth * 1.25 + 2, wx.SOLID) ) if isPointToPoint: dc.DrawLines( drawPoints ) else: dc.DrawPolygon( drawPoints ) dc.SetPen( wx.Pen(self.trackColour, laneWidth * 1.25, wx.SOLID) ) if isPointToPoint: dc.DrawLines( drawPoints ) else: dc.DrawPolygon( drawPoints ) # Draw a centerline to show all the curves in the course. dc.SetPen( wx.Pen(wx.Colour(80,80,80), 1, wx.SOLID) ) if isPointToPoint: dc.DrawLines( drawPoints ) else: dc.DrawPolygon( drawPoints ) # Draw a finish line. finishLineLength = laneWidth * 2 if isPointToPoint: x1, y1, x2, y2 = LineNormal( drawPoints[-1][0], drawPoints[-1][1], drawPoints[-2][0], drawPoints[-2][1], laneWidth * 2 ) else: x1, y1, x2, y2 = LineNormal( drawPoints[0][0], drawPoints[0][1], drawPoints[1][0], drawPoints[1][1], laneWidth * 2 ) dc.SetPen( wx.Pen(wx.WHITE, laneWidth / 1.5, wx.SOLID) ) dc.DrawLine( x1, y1, x2, y2 ) dc.SetPen( wx.Pen(wx.BLACK, laneWidth / 5, wx.SOLID) ) dc.DrawLine( x1, y1, x2, y2 ) if isPointToPoint: x1, y1, x2, y2 = LineNormal( drawPoints[-1][0], drawPoints[-1][1], drawPoints[-2][0], drawPoints[-2][1], laneWidth * 4 ) else: x1, y1, x2, y2 = LineNormal( drawPoints[0][0], drawPoints[0][1], drawPoints[1][0], drawPoints[1][1], laneWidth * 4 ) dc.DrawBitmap( self.checkeredFlag, x2 - self.checkeredFlag.Width/2, y2 - self.checkeredFlag.Height/2, False ) # Draw starting arrow showing direction. if not self.data and not isPointToPoint and len(drawPoints) > avePoints: x1, y1 = drawPoints[0][0], drawPoints[0][1] x2, y2 = drawPoints[1][0], drawPoints[1][1] a = atan2( y2-y1, x2-x1 ) x2 = int(x1 + cos(a) * laneWidth*4) y2 = int(y1 + sin(a) * laneWidth*4) dc.SetPen( wx.Pen(wx.BLACK, laneWidth / 4, wx.SOLID) ) dc.DrawLine( x1, y1, x2, y2 ) a = atan2( y1-y2, x1-x2 ) x1, y1 = x2, y2 arrowLength = 1.25 arrowAngle = 3.14159/8.0 x2 = int(x1 + cos(a+arrowAngle) * laneWidth*arrowLength) y2 = int(y1 + sin(a+arrowAngle) * laneWidth*arrowLength) dc.DrawLine( x1, y1, x2, y2 ) x2 = int(x1 + cos(a-arrowAngle) * laneWidth*arrowLength) y2 = int(y1 + sin(a-arrowAngle) * laneWidth*arrowLength) dc.DrawLine( x1, y1, x2, y2 ) # Draw the riders dc.SetFont( self.numberFont ) dc.SetPen( wx.BLACK_PEN ) numSize = (r/2)/self.laneMax self.lapCur = 0 topFew = {} riderRadius = laneWidth * 0.5 thickLine = r / 32 highlightPen = wx.Pen( wx.WHITE, thickLine * 1.0 ) riderPosition = {} if self.data: riderXYPT = [] for num, d in self.data.iteritems(): xypt = list(self.getRiderXYPT(num)) xypt.insert( 0, num ) riderXYPT.append( xypt ) # Sort by reverse greatest distance, then by shortest time. # Do this so the leaders are drawn last. riderXYPT.sort( key=lambda x : ( x[3] if x[3] is not None else 0.0, -x[4] if x[4] is not None else 0.0) ) topFew = {} for j, i in enumerate(xrange(len(riderXYPT) - 1, max(-1,len(riderXYPT)-self.topFewCount-1), -1)): topFew[riderXYPT[i][0]] = j numRiders = len(riderXYPT) for j, (num, x, y, position, time) in enumerate(riderXYPT): riderPosition[num] = numRiders - j if x is None: continue dc.SetBrush( wx.Brush(self.colours[num % len(self.colours)], wx.SOLID) ) try: i = topFew[num] dc.SetPen( wx.Pen(self.topFewColours[i], thickLine) ) if num in self.numsToWatch: dc.SetFont( self.highlightFont ) except KeyError: if num in self.numsToWatch: dc.SetFont( self.highlightFont ) dc.SetPen( highlightPen ) i = 9999 else: i = None DrawShape( dc, num, x, y, riderRadius ) if i is not None: if not self.numsToWatch or num in self.numsToWatch: dc.DrawLabel('{}'.format(num), wx.Rect(x+numSize, y-numSize, numSize*2, numSize*2) ) if i is not None: dc.SetPen( wx.BLACK_PEN ) dc.SetFont( self.numberFont ) # Convert topFew from dict to list. leaders = [0] * len(topFew) for num, position in topFew.iteritems(): leaders[position] = num yTop = height - self.infoLines * tHeight tWidth, tHeight = dc.GetTextExtent( '999' ) yCur = tHeight+textVSpace*1.6 # Draw the race time secs = int( self.t ) if secs < 60*60: tStr = '%d:%02d ' % ((secs / 60)%60, secs % 60 ) else: tStr = '%d:%02d:%02d ' % (secs / (60*60), (secs / 60)%60, secs % 60 ) tWidth = dc.GetTextExtent( tStr )[0] dc.DrawText( tStr, width - tWidth, yCur ) yCur += tHeight # Draw the current lap dc.SetFont( self.timeFont ) if self.lapCur and leaders: leaderRaceTimes = self.data[leaders[0]]['raceTimes'] if leaderRaceTimes and leaderRaceTimes[0] < leaderRaceTimes[-1]: maxLaps = len(leaderRaceTimes) - 1 self.iLapDistance, lapRatio = GetLapRatio( leaderRaceTimes, self.t, self.iLapDistance ) lapRatio = int(lapRatio * 10.0) / 10.0 # Always round down, not to nearest decimal. text = [u'{:06.1f} {} {} '.format(self.iLapDistance + lapRatio, _('Laps of'), maxLaps), u'{:06.1f} {}'.format(maxLaps - self.iLapDistance - lapRatio, _('Laps to go'))] cat = self.categoryDetails.get( self.data[leaders[0]].get('raceCat', None) ) if cat: distanceCur, distanceRace = None, None if cat.get('lapDistance', None) is not None: text.append( '' ) flr = self.data[leaders[0]].get('flr', 1.0) distanceLap = cat['lapDistance'] distanceRace = distanceLap * (flr + maxLaps-1) if self.iLapDistance == 0: distanceCur = lapRatio * (distanceLap * flr) else: distanceCur = distanceLap * (flr + self.iLapDistance - 1 + lapRatio) elif cat.get('raceDistance', None) is not None and leaderRaceTimes[0] != leaderRaceTimes[-1]: distanceRace = cat['raceDistance'] distanceCur = (self.t - leaderRaceTimes[0]) / (leaderRaceTimes[-1] - leaderRaceTimes[0]) * distanceRace distanceCur = max( 0.0, min(distanceCur, distanceRace) ) if distanceCur is not None: if distanceCur != distanceRace: distanceCur = int( distanceCur * 10.0 ) / 10.0 text.extend( [ u'{:05.1f} {} {} {:.1f}'.format(distanceCur, self.units, _('of'), distanceRace), u'{:05.1f} {} {}'.format(distanceRace - distanceCur, self.units, _('to go'))] ) widthMax = max( dc.GetTextExtent(t)[0] for t in text ) if 'N' in self.compassLocation: yCur = height - tHeight * (len(text) + 1) if 'E' in self.compassLocation: xCur = width - widthMax else: xCur = tHeight * 0.5 for row, t in enumerate(text): yCur += tHeight if not t: continue tShow = t.lstrip('0') if tShow.startswith('.'): tShow = '0' + tShow dc.DrawText( tShow, xCur + dc.GetTextExtent('0' * (len(t) - len(tShow)))[0], yCur ) # Draw the leader board. bannerItems = [] for i, leader in enumerate(leaders): bannerItems.append( (leaders[i], i+1) ) if self.numsToWatch: rp = [] for n in self.numsToWatch: try: p = riderPosition[n] rp.append( (p, n) ) except KeyError: pass rp.sort() for w in rp: bannerItems.append( (w[1], w[0]) ) if self.data: self.drawBanner( dc, width, height, tHeight, bannerItems ) def OnEraseBackground(self, event): # This is intentionally empty, because we are using the combination # of wx.BufferedPaintDC + an empty OnEraseBackground event to # reduce flicker pass if __name__ == '__main__': fname = r'C:\Projects\CrossMgr\bugs\Stuart\20160419-glenlyon\2016-04-19-WTNC Glenlyon 710-r2-Course.gpx' print GpxHasTimes( fname ) data = {} for num in xrange(100,200): mean = random.normalvariate(6.0, 0.3) raceTimes = [0] for lap in xrange( 4 ): raceTimes.append( raceTimes[-1] + random.normalvariate(mean, mean/20)*60.0 ) data[num] = { 'raceTimes': raceTimes, 'lastTime': raceTimes[-1], 'flr': 1.0, 'status':'Finisher', 'speed':'32.7 km/h' } # import json # with open('race.json', 'w') as fp: fp.write( json.dumps(data, sort_keys=True, indent=4) ) app = wx.App(False) mainWin = wx.Frame(None,title="GeoAnimation", size=(800,700)) animation = GeoAnimation(mainWin) geoTrack = GeoTrack() geoTrack.read( fname ) geoTrack.writeGPXFile( 'geotrack.gpx' ) #sys.exit() #geoTrack.read( 'St._John__039_s_Cyclocross_course_v2.gpx' ) #geoTrack.read( 'Camp Arrowhead mtb GPS course.gpx' ) #geoTrack.read( 'Races/Midweek/Midweek_Learn_to_Race_and_Elite_Series_course.gpx' ) #geoTrack.reverse() print 'Clockwise:', geoTrack.isClockwise() zf = zipfile.ZipFile( 'track.kmz', 'w', zipfile.ZIP_DEFLATED ) zf.writestr( 'track.kml', geoTrack.asKmlTour('Race Track') ) zf.close() with open('track.kml', 'w') as f: f.write( geoTrack.asKmlTour('Race Track') ) #sys.exit() animation.SetGeoTrack( geoTrack ) animation.SetData( data ) animation.Animate( 2*60, 60*60 ) mainWin.Show() app.MainLoop()
[ "edward.sitarski@gmail.com" ]
edward.sitarski@gmail.com
84384db20a89bc39c9f6bc69a468b41c3d98f61d
1397af1014b8d1ca89a66b58d8eb16a52d05ac17
/HSTB/drivers/pos_mv/POSMV_V4_UserManual.py
739e043e3451b5b97d8799e1cc50295584505fdf
[ "CC0-1.0" ]
permissive
mfkiwl/drivers
079466043ae5ca8ea29f5e1ab4a009cb852d3a68
d952d9367dcc303e54015bcc5fa1e8e0206cd9b6
refs/heads/main
2023-04-09T02:12:59.305896
2021-04-05T02:58:34
2021-04-05T02:58:34
null
0
0
null
null
null
null
UTF-8
Python
false
false
175,592
py
Contents = """ The information contained herein is proprietary to Applanix corporation. Release to third parties of this publication or of information contained herein is prohibited without the prior written consent of Applanix Corporation. Applanix reserves the right to change the specifications and information in this document without notice. A record of the changes made to this document is contained in the Revision History sheet. POS MV V4 User ICD Document # : PUBS-ICD-000551 Revision: 0.0 Date: 12-May-06 ii Table of Contents Page 1 SCOPE .................................................................................................................................................. 1 2 ETHERNET AND DATA ACQUISITION INTERFACES................................................................ 1 3 OUTPUT GROUPS .............................................................................................................................. 3 3.1 Introduction .................................................................................................................................... 3 3.2 Output Group Specification............................................................................................................ 3 3.2.1 Group Data Rates .................................................................................................................... 3 3.2.2 Group Classification and Numbering Convention .................................................................. 3 3.2.3 Group Format .......................................................................................................................... 6 3.2.4 Compatibility with Previous POS Products ............................................................................ 9 3.3 Output Group Tables .................................................................................................................... 10 3.3.1 POS Data Groups .................................................................................................................. 10 3.3.1.1 Group 1: Vessel Position, Velocity, Attitude & Dynamics ........................................... 10 3.3.1.2 Group 2: Vessel Navigation Performance Metrics ........................................................ 12 3.3.1.3 Group 3: Primary GPS Status ........................................................................................ 13 3.3.1.4 Group 4: Time-tagged IMU Data................................................................................... 16 3.3.1.5 Group 5: Event 1 ............................................................................................................ 17 3.3.1.6 Group 6: Event 2 ............................................................................................................ 17 3.3.1.7 Group 7: PPS Time Recovery and Status ...................................................................... 17 3.3.1.8 Group 8: Reserved ......................................................................................................... 18 3.3.1.9 Group 9: GAMS Solution .............................................................................................. 18 3.3.1.10 Group 10: General Status and FDIR .............................................................................. 20 3.3.1.11 Group 11: Secondary GPS Status .................................................................................. 26 3.3.1.12 Group 12: Auxiliary 1 GPS Status ................................................................................. 27 3.3.1.13 Group 13: Auxiliary 2 GPS Status ................................................................................. 27 3.3.1.14 Group 14: Calibrated Installation Parameters ................................................................ 29 3.3.1.15 Group 15: Reserved ....................................................................................................... 31 3.3.1.16 Group 16: Reserved ....................................................................................................... 31 iii 3.3.1.17 Group 17: User Time Status........................................................................................... 31 3.3.1.18 Group 20: IIN Solution Status ....................................................................................... 32 3.3.1.19 Group 21: Base GPS 1 Modem Status ........................................................................... 33 3.3.1.20 Group 22: Base GPS 2 Modem Status ........................................................................... 34 3.3.1.21 Group 23: Auxiliary 1 GPS Display Data...................................................................... 34 3.3.1.22 Group 24: Auxiliary 2 GPS Display Data...................................................................... 34 3.3.1.23 Group 25: Reserved ....................................................................................................... 35 3.3.1.24 Group 26: Reserved ....................................................................................................... 35 3.3.1.25 Group 99: Versions and Statistics .................................................................................. 35 3.3.1.26 Group 102: Sensor 1 Position, Velocity, Attitude, Heave & Dynamics ........................ 37 3.3.1.27 Group 103: Sensor 2 Position, Velocity, Attitude, Heave & Dynamics ........................ 37 3.3.1.28 Group 104: Sensor 1 Position, Velocity, and Attitude Performance Metrics ................ 38 3.3.1.29 Group 105: Sensor 2 Position, Velocity, and Attitude Performance Metrics ................ 38 3.3.1.30 Group 110: MV General Status & FDIR ....................................................................... 39 3.3.1.31 Group 111: Heave & True Heave Data.......................................................................... 40 3.3.1.32 Group 112: NMEA Strings ............................................................................................ 41 3.3.1.33 Group 113: Heave & True Heave Performance Metrics................................................ 41 3.3.1.34 Group 114: TrueZ & TrueTide Data .............................................................................. 42 3.3.2 Raw Data Groups .................................................................................................................. 43 3.3.2.1 Group 10001: Primary GPS Data Stream ...................................................................... 43 3.3.2.2 Group 10002: Raw IMU Data........................................................................................ 44 3.3.2.3 Group 10003: Raw PPS ................................................................................................. 45 3.3.2.4 Group 10004: Raw Event 1............................................................................................ 45 3.3.2.5 Group 10005: Raw Event 2............................................................................................ 45 3.3.2.6 Group 10006: Reserved ................................................................................................. 46 3.3.2.7 Group 10007: Auxiliary 1 GPS Data Stream................................................................. 46 3.3.2.8 Group 10008: Auxiliary 2 GPS Data Stream................................................................. 46 3.3.2.9 Group 10009: Secondary GPS Data Stream .................................................................. 47 3.3.2.10 Group 10010: Reserved ................................................................................................. 47 3.3.2.11 Group 10011: Base GPS 1 Data Stream ........................................................................ 48 3.3.2.12 Group 10012: Base GPS 2 Data Stream ........................................................................ 48 iv 4 MESSAGE INPUT AND OUTPUT ................................................................................................... 49 4.1 Introduction .................................................................................................................................. 49 4.2 Message Output Data Rates.......................................................................................................... 49 4.2.1 Message Numbering Convention .......................................................................................... 49 4.2.2 Compatibility with Previous POS Products .......................................................................... 52 4.3 Message Format ........................................................................................................................... 52 4.3.1 Introduction ........................................................................................................................... 52 4.4 Messages Tables........................................................................................................................... 54 4.4.1 General Messages.................................................................................................................. 54 4.4.1.1 Message 0: Acknowledge .............................................................................................. 54 4.4.2 Installation Parameter Set-up Messages................................................................................ 56 4.4.2.1 Message 20: General Installation and Processing Parameters ....................................... 56 4.4.2.2 Message 21: GAMS Installation Parameters ................................................................. 61 4.4.2.3 Message 22: Reserved.................................................................................................... 63 4.4.2.4 Message 23: Reserved.................................................................................................... 63 4.4.2.5 Message 24: User Accuracy Specifications ................................................................... 63 4.4.2.6 Message 25: Reserved.................................................................................................... 64 4.4.2.7 Message 30: Primary GPS Setup ................................................................................... 64 4.4.2.8 Message 31: Secondary GPS Setup ............................................................................... 67 4.4.2.9 Message 32: Set POS IP Address .................................................................................. 69 4.4.2.10 Message 33: Event Discrete Setup................................................................................. 71 4.4.2.11 Message 34: COM Port Setup........................................................................................ 71 4.4.2.12 Message 35: See Message 135....................................................................................... 73 4.4.2.13 Message 36: See Message 136....................................................................................... 73 4.4.2.14 Message 37: Base GPS 1 Setup ..................................................................................... 73 4.4.2.15 Message 38: Base GPS 2 Setup ..................................................................................... 74 4.4.2.16 Message 40: Reserved.................................................................................................... 75 4.4.2.17 Message 41: Reserved.................................................................................................... 75 4.4.3 Processing Control Messages................................................................................................ 75 4.4.3.1 Message 50: Navigation Mode Control ......................................................................... 75 4.4.3.2 Message 51: Display Port Control ................................................................................. 76 v 4.4.3.3 Message 52: Real-Time Data Port Control .................................................................... 77 4.4.3.4 Message 53: Reserved.................................................................................................... 79 4.4.3.5 Message 54: Save/Restore Parameters Control.............................................................. 79 4.4.3.6 Message 55: User Time Recovery ................................................................................. 80 4.4.3.7 Message 56: General Data ............................................................................................. 80 4.4.3.8 Message 57: Installation Calibration Control ................................................................ 82 4.4.3.9 Message 58: GAMS Calibration Control....................................................................... 84 4.4.3.10 Message 60: Reserved.................................................................................................... 85 4.4.3.11 Message 61: Logging Data Port Control........................................................................ 85 4.4.4 Program Control Override Messages .................................................................................... 85 4.4.4.1 Message 90: Program Control........................................................................................ 85 4.4.4.2 Message 91: GPS Control .............................................................................................. 86 4.4.4.3 Message 92: Reserved.................................................................................................... 87 4.4.4.4 Message 93: Reserved.................................................................................................... 87 4.4.5 POS MV Specific Messages ................................................................................................. 87 4.4.5.1 Message 105: Analog Port Set-up.................................................................................. 87 4.4.5.2 Message 106: Heave Filter Set-up ................................................................................. 89 4.4.5.3 Message 111: Password Protection Control................................................................... 90 4.4.5.4 Message 120: Sensor Parameter Set-up ......................................................................... 91 4.4.5.5 Message 121: Vessel Installation Parameter Set-up ...................................................... 94 4.4.5.6 Message 135: NMEA Output Set-up ............................................................................. 95 4.4.5.7 Message 136: Binary Output Set-up .............................................................................. 97 4.4.6 POS MV Specific Diagnostic Control Messages ................................................................ 100 4.4.6.1 Message 20102: Binary Output Diagnostics................................................................ 100 4.4.6.2 Message 20103: Analog Port Diagnostics ................................................................... 101 5 APPENDIX A: DATA FORMAT DESCRIPTION......................................................................... 103 5.1 Data Format ................................................................................................................................ 103 5.2 Invalid Data Values .................................................................................................................... 105 6 APPENDIX B: GLOSSARY OF ACRONYMS ............................................................................... 107 vi List of Tables Table 1: Output Group Data Rates................................................................................................................ 4 Table 2: Group format .................................................................................................................................. 6 Table 3: Time and distance fields ................................................................................................................. 7 Table 4: Group 1: Vessel position, velocity, attitude & dynamics ............................................................. 10 Table 5: Group 1 alignment status .............................................................................................................. 11 Table 6: Group 2: Vessel navigation performance metrics......................................................................... 12 Table 7: Group 3: Primary GPS status........................................................................................................ 13 Table 8: GPS receiver channel status data .................................................................................................. 14 Table 9: GPS navigation solution status ..................................................................................................... 14 Table 10: GPS channel status ..................................................................................................................... 15 Table 11: GPS receiver type ....................................................................................................................... 15 Table 12: Trimble BD950 GPS receiver status........................................................................................... 16 Table 13: Group 4: Time-tagged IMU data ................................................................................................ 16 Table 14: Group 5/6: Event 1/2 .................................................................................................................. 17 Table 15: Group 7: PPS Time Recovery and Status ................................................................................... 18 Table 16: Group 9: GAMS Solution Status ................................................................................................ 19 Table 17: Group 10: General and FDIR status ........................................................................................... 21 Table 18: Group 11: Secondary GPS status................................................................................................ 26 Table 19: Group 12/13: Auxiliary 1/2 GPS status ...................................................................................... 28 Table 20: Group 14: Calibrated installation parameters ............................................................................. 29 Table 21: IIN Calibration Status ................................................................................................................. 31 Table 22: Group 20: IIN solution status...................................................................................................... 32 Table 23: Group 21/22: Base GPS 1/2 Modem Status................................................................................ 34 Table 24: Group 23/24: Auxiliary 1/2 GPS raw display data ..................................................................... 35 Table 25: Group 99: Versions and statistics ............................................................................................... 35 Table 26: Group 102/103: Sensor 1/2 Position, Velocity, Attitude, Heave & Dynamics........................... 37 Table 27: Group 104/105: Sensor 1/2 Position, Velocity, and Attitude Performance Metrics ................... 39 Table 28: Group 110: MV General Status & FDIR .................................................................................... 39 vii Table 29: Group 111: Heave & True Heave Data....................................................................................... 40 Table 30: Group 112: NMEA Strings ......................................................................................................... 41 Table 31: Group 113: Heave & True Heave Performance Metrics............................................................. 42 Table 32: Group 114: TrueZ & TrueTide Data........................................................................................... 43 Table 33: Group 10001: Primary GPS data stream..................................................................................... 44 Table 34: Group 10002: Raw IMU data ..................................................................................................... 44 Table 35: Group 10003: Raw PPS .............................................................................................................. 45 Table 36: Group 10004/10005: Raw Event 1/2 .......................................................................................... 46 Table 37: Group 10007/10008: Auxiliary 1/2 GPS data streams ............................................................... 46 Table 38: Group 10009: Secondary GPS data stream................................................................................. 47 Table 39: Group 10011/10012: Base GPS 1/2 data stream......................................................................... 48 Table 40: Control messages output data rates............................................................................................. 50 Table 41: Message format........................................................................................................................... 52 Table 42: Message 0: Acknowledge ........................................................................................................... 55 Table 43: Message response codes ............................................................................................................. 55 Table 44: Message 20: General Installation and Processing Parameters .................................................... 59 Table 45: Message 21: GAMS installation parameters............................................................................... 62 Table 46: Message 24: User accuracy specifications.................................................................................. 63 Table 47: Message 30: Primary GPS Setup ................................................................................................ 65 Table 48: RS-232/422 communication protocol settings............................................................................ 66 Table 49: Message 31: Secondary GPS Setup ............................................................................................ 68 Table 50: Message 32: Set POS IP Address ............................................................................................... 69 Table 51: Message 33: Event Discrete Setup.............................................................................................. 71 Table 52: Message 34: COM Port Setup .................................................................................................... 72 Table 53: COM port parameters ................................................................................................................. 73 Table 54: Message 37/38: Base GPS 1/2 Setup .......................................................................................... 74 Table 55: Message 50: Navigation mode control ....................................................................................... 76 Table 56: Message 51: Display Port Control .............................................................................................. 77 Table 57: Message 52/61: Real-Time/Logging Data Port Control ............................................................. 78 Table 58: Message 54: Save/restore parameters control............................................................................. 79 Table 59: Message 55: User time recovery................................................................................................. 80 Table 60: Message 56: General data ........................................................................................................... 81 viii Table 61: Message 57: Installation calibration control ............................................................................... 83 Table 62: Message 58: GAMS Calibration Control.................................................................................... 84 Table 63: Message 90: Program Control .................................................................................................... 86 Table 64: Message 91: GPS control............................................................................................................ 87 Table 65: Message 105: Analog Port Set-up .............................................................................................. 87 Table 66: Message 106: Heave Filter Set-up .............................................................................................. 89 Table 67: Message 111: Password Protection Control ............................................................................... 90 Table 68: Message 120: Sensor Parameter Set-up ...................................................................................... 92 Table 69: Message 121: Vessel Installation Parameter Set-up ................................................................... 94 Table 70: Message 135: NMEA Output Set-up .......................................................................................... 95 Table 71: NMEA Port Definition................................................................................................................ 95 Table 72: Message 136: Binary Output Set-up ........................................................................................... 97 Table 73: Binary Port Definition ................................................................................................................ 97 Table 74: Message 20102: Binary Output Diagnostics............................................................................. 100 Table 75: Message 20103: Analog Port Diagnostics ................................................................................ 101 Table 76: Byte Format .............................................................................................................................. 103 Table 77: Short Integer Format ................................................................................................................. 103 Table 78: Long Integer Format ................................................................................................................. 103 Table 79: Single-Precision Real Format ................................................................................................... 103 Table 80: Double-Precision Real Format.................................................................................................. 104 Table 81: Invalid data values .................................................................................................................... 106 1 """ Structures = """ 1 Scope This document presents the functional specification of the POS MV Control, Display and Data Ports and data structures used by the POS Computer System (PCS) to communicate with the user over its Control, Display and Data Ports. The document is separated into specifications of output data groups and input and output control messages that are relevant to the user. This document describes the data structures that are implemented in the V4 system version of POS MV. POS MV V4 shall hereafter be refered to as POS MV or simply POS. 2 Ethernet and Data Acquisition Interfaces The POS MV provides a mechanism for control and data exchange in the form of control messages and data groups. Control messages direct POS MV to execute a well-defined action such as mode transition, or start or stop of data acquisition. Data groups contain the data output by the POS MV for the purpose of display on a control computer, recording to a mass storage device, or for real-time processing by another subsystem. POS MV exchanges all control messages with a user via the POS's Control Port. It outputs all data groups on the Display and Data Logging Ports. Applanix provides a program called MV POSView with the POS MV to run on the user's PC- compatible computer running Microsoft Windows 2000 or XP. The user's PC is called the client computer and is used to both control the system and allow the user to view POS data via the control messages and data groups specified in this document. The user can create custom control and display software that implements similar functionality. In either case, the program that provides the control and display functions on the client computer will hereafter be referred to as the POS Controller. POS MV provides one physical Ethernet interface that has four logical communications ports called the Display Port, the Control Port, the Real-Time Data Port and the Logging Data Port. POS MV outputs data in specified group formats defined in the body of this document. Messages are used to both change and describe the system configuration. Both message and group data are output on three ports: Display, Real-Time Data and Logging Data. Messages are input on the Control Port. The Display Port is a low rate UDP output port that is designed to broadcast low rate data and status information for display. The POS Controller reads the message and group data from this port for display purposes. POS MV is designed to allow multiple POS Controller programs running on different computers to receive and display data from the PCS. However, only one POS Controller at any time can be designated as the master controller and be capable of sending commands to the PCS via the Control Port. This arrangement prevents conflicting controller information from being received by the PCS. The port address for the Display Port is 5600. The subnet mask is 255.255.255.255. The Real-Time Data Port is a high rate UDP output port that is designed to output multiple data 2 groups at high data rates with minimal latency. Since there is no handshaking implemented in UDP there is a possibility that the client may not receive all data packets. The Real-Time Data Port design emphasizes real-time delivery of the data without the overhead of ensuring totally reliable data transfer. To receive data from the Real-Time Data Port, a computer must listen to the port using the UDP socket protocol. Several computers may be connected to the Real-Time Data Port at any one time. MV POSView uses this port to obtain some higher rate data from POS MV that is required for display plots. The Logging Data Port is a high rate TCP/IP output port that is designed to output multiple data groups at high data rates. The emphasis is on reliable and efficient data transfer to the client computer. The Logging Data Port implements several buffers to store data in the event the TCP/IP connection between POS and the client computer becomes bogged down or requires retransmission of packets. To receive data from the Logging Data Port, a computer must connect to it using the TCP/IP socket protocol. Only one computer may be connected to the Logging Data Port at any one time. MV POSView can log this data to the client computer's hard drive. The port address for the Real-Time Data Port is 5602 and 5603 for the Logging Data Port. The IP subnet mask is 255.255.255.255. The user is able to select, from several different options, the data required for output. Each port can be configured to output different data than the other ports. POS MV accepts changes to the output options of the Display, Data and Logging ports at any time. MV POSView automatically sends the Display Port control message to output the data groups that it requires to populate the display windows as the user opens them. The Control Port is designed to receive set-up and control commands from the POS Controller and to acknowledge the commands to indicate successful reception of each message. The Control Port is bi-directional and uses the TCP/IP protocol to communicate with the POS Controller. The port address for the Control Port is 5601. The IP subnet mask is 255.255.255.255. 3 3 Output Groups 3.1 Introduction POS MV organizes the data going to the Display and Data ports into output groups. Each group contains a block of related data at a specified group rate. The user directs POS MV via Control Port messages generated by the POS Controller to include a group or groups containing data items of interest in the Display and Data port data streams. The output groups have been designed to allow simple parsing and decoding of the output data streams into the selected groups. All groups are framed by ASCII delimiters and have identifiers that uniquely identify each group. The output data rate on the Display Port is typically once per second or less. This output is intended for updating the POS Controller display; hence a higher data output rate is not required. The output data rate on the Data Ports is group dependent and has a range from 1Hz to an IMU rate. For certain output groups, it is possible to select, from several options, the output data rate of choice on the Data ports. 3.2 Output Group Specification 3.2.1 Group Data Rates There are several output groups defined for the Display and Data ports. The user can select any of these groups and may select different groups for the Display Port, Real-Time Data Port and Logging Data Port. The Standby and Navigate modes shown in Table 1 are defined in POS MV V4 User Guide. 3.2.2 Group Classification and Numbering Convention All POS products use the following group numbering convention. POS MV outputs the group categories shown. Reserved group numbers are assigned to other products. 0 - 99 POS Core User data groups 100 - 199 POS MV User data groups 200 - 299 POS AV User data groups 300 - 399 POS TG User data groups 400 - 499 POS LV User data groups 500 - 599 POS LS User data groups 600 - 699 POS SV User data groups 700 - 799 POS MC User data groups 800 - 9999 Reserved 4 10000 - 10099 POS Core Raw data groups 10100 - 10199 POS MV Raw data groups 10200 - 10299 POS AV Raw data groups 10300 - 10399 POS TG Raw data groups 10400 - 10499 POS LV Raw data groups 10500 - 10599 POS LS Raw data groups 10600 - 10699 POS SV Raw data groups 10700 - 10799 POS MC Raw data groups 10800 - 19999 Reserved 20000 POS Core User diagnostic group 20001 - 20099 POS Core Proprietary diagnostic groups 20100 POS MV User diagnostic group Core User data groups and MV User data groups comprise groups that contain real-time operational data. During normal operation, these are the only groups that a user would require for observing or recording relevant POS MV data. Core Raw data groups and POS MV Raw data groups comprise the unaltered data streams from the navigation sensors received by the PCS. POS MV packages the sensor data into the specified group formats and outputs the groups. These groups are typically used for post-mission processing and analysis. Table 0: PCSRecordHeader Creating this type since POS MV spec didn't declare a header typ eeven though they use two interchangeable headers Start 4 char $GRP N/A ID 2 ushort 2 N/A Byte count 2 ushort 80 bytes Table 1: GrpRecordHeader Creating this type since POS MV spec didn't declare a header typ eeven though they use two interchangeable headers Start 4 char $GRP N/A ID 2 ushort 2 N/A Byte count 2 ushort 80 bytes Time 1 8 double N/A seconds Time 2 8 double N/A seconds Distance tag 8 double N/A meters Time types 1 byte Time 1 Select Value in bits 0-3 xTable 1: Output Group Data Rates Display Port Output Rate (Hz) Real-Time Data Port Output Rate (Hz) Logging Data Port Output Rate (Hz) Group Contents Standby Navigate Standby Navigate Standby Navigate POS Data Groups 1* Vessel position, velocity, attitude & dynamics - 1 1 - 1-200 - 1-200 2 Vessel navigation performance metrics - 1 1 - 1 - 1 3 Primary GPS status 1 1 1 1 1 1 1 1 4 Time-tagged IMU data 1 1 200 200 200 200 5 Event 1 data 2 1 1 1-500 1-500 1-500 1-500 6 Event 2 data 2 1 1 1-500 1-500 1-500 1-500 7 PPS data 2 1 1 1 1 1 1 8 Reserved - - - - - - 5 Display Port Output Rate (Hz) Real-Time Data Port Output Rate (Hz) Logging Data Port Output Rate (Hz) Group Contents Standby Navigate Standby Navigate Standby Navigate 9 GAMS solution status - 1 - 1 - 1 10 General and FDIR status 1 1 1 1 1 1 1 1 11 Secondary GPS status 1 1 1 1 1 1 12 Auxiliary 1 GPS status 1 1 1 1 1 1 13 Auxiliary 2 GPS status 1 1 1 1 1 1 14 Calibrated installation parameters - 1 - 1 - 1 15 Reserved - - - - - - 16 Reserved - - - - - - 17 User time status 1 1 1 1 1 1 20 IIN solution status - 1 - 1 - 1 21 Base 1 GPS modem status 1 1 1 1 1 1 22 Base 2 GPS modem status 1 1 1 1 1 1 23 Auxiliary 1 GPS display data 2 1 1 1 1 1 1 24 Auxiliary 2 GPS display data 2 1 1 1 1 1 1 25 Reserved - - - - - - 26 Reserved - - - - - - 99 Versions and statistics 1 1 1 1 1 1 102 Sensor 1 position, velocity, attitude, heave & dynamics - 1 - 1-200 - 1-200 103 Sensor 2 position, velocity, attitude, heave & dynamics - 1 - 1-200 - 1-200 104 Sensor 1 position, velocity & attitude performance metrics - 1 - 1 - 1 105 Sensor 2 position, velocity & attitude performance metrics - 1 - 1 - 1 110 MV general status & FDIR 1 1 1 1 1 1 111 Heave & True Heave - 1 - 25 - 25 112 NMEA strings - 1 - 1-50 - 1-50 113 Heave performance metrics - 1 - 25 - 25 114 TrueZ and TrueTide altitude - 1 - 25 - 25 Raw Data Groups 10001 Primary GPS data stream - - 1-10 1-10 1-10 1-10 6 Display Port Output Rate (Hz) Real-Time Data Port Output Rate (Hz) Logging Data Port Output Rate (Hz) Group Contents Standby Navigate Standby Navigate Standby Navigate 10002 IMU data stream - - 200 200 200 200 10003 PPS data - - 1 1 1 1 10004 Event 1 data - - 1-500 1-500 1-500 1-500 10005 Event 2 data - - 1-500 1-500 1-500 1-500 10006 Reserved - - - - - - 10007 Auxiliary 1 GPS data stream 1-10 1-10 1-10 1-10 10008 Auxiliary 2 GPS data stream 1-10 1-10 1-10 1-10 10009 Secondary GPS data stream - - 1-10 1-10 1-10 1-10 10010 Reserved - - - - - - 10011 Base 1 GPS data stream - - 0-1 0-1 0-1 0-1 10012 Base 2 GPS data stream - - 0-1 0-1 0-1 0-1 Note: When POS is in Navigation mode but not aligned then the output rate is implementation dependent. * Data is in the vessel frame for POS MV. 1 These groups are the minimum output of the Display Port for driving the POS View display and cannot be deselected. 2 Groups are only posted when data were available. 3.2.3 Group Format The structure of each output group is defined in this section. The group structure is the same for all groups and consists of a header, data and footer. Table 2 presents the complete groups format, showing the header and footer separated by the data. The next section specifies the data for each group. Table 2: Group format Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort Group number N/A Byte count 2 ushort Group dependent bytes Time/Distance Fields 26 See Table 3 Data Group dependent size and format Pad 0 to 3 _byte 0 N/A 7 Item Bytes Format Value Units Checksum 2 ushort N/A N/A Group end 2 char $# N/A Table 3: Time and distance fields Item Bytes Format Value Units Time 1 8 double N/A seconds Time 2 8 double N/A seconds Distance tag 8 double N/A meters Time types 1 byte Time 1 Select Value in bits 0-3 Time 1: POS time 0 Time 1: GPS time 1 (default) Time 1: UTC time 2 Time 2 Select Value in bits 4-7 Time 2: POS time 0 (default) Time 2: GPS time 1 Time 2: UTC time 2 Time 2: User time 3 Distance type 1 byte Distance Select Value N/A 0 POS distance 1 (default) DMI distance 2 The header consists of the following components: # ASCII group start ($GRP) # group identification (Group ID) number # byte count # time/distance fields The group identification or Group ID is a short unsigned integer equal to the group number having the group numbering convention described in Section 3.2.2. 8 The byte count is a short unsigned integer that includes all fields in the group except the $GRP delimiter, the Group ID and the byte count. Therefore, the byte count is always 8 bytes less than the length of the group. The time/distance fields are shown in Table 3. These occupy 26 bytes and have the same format across all groups. They comprise the following: # Time 1 # Time 2 # Distance tag and time and distance type flags. Time 1 is the POS MV system time of validity of the data in the group, given in one of the following time bases: # POS time (time in seconds since power-on) # GPS seconds of the week # UTC seconds of the week The user can select any of these times for Time 1. Time 1 is set to POS time on power-up and changes to the user selected time base once the primary GPS receiver has locked on to a sufficient number of satellites to compute a time solution. Time 2 is the POS MV system time of validity of the data in the group, given in one of the following time bases: # POS time (time in seconds since power-on) # GPS seconds of the week # UTC seconds of the week # User time User time is specified by the user, with the procedure to set user time described in the POS MV V4 User Guide. It allows the groups to be time tagged with an external computer's time clock. The Time 2 field is always set to POS time for the raw (10000) series of data groups. Distance tag is the distance of validity of the data in the group as determined by one of the following distance measurement sources: # distance traveled derived from the POS MV blended navigation solution # DMI (distance measurement index) distance tag The group data follows the header. Its format is dependent on the particular group. Some group data lengths are fixed, whereas others may vary. For variable length groups the byte count is always updated to reflect the actual length of the group. 9 The group is terminated by the footer, which consists of the following components: # a pad (if required) # checksum # ASCII group end delimiter ($#). The pad is used to make the total lengths of all groups a multiple of four bytes. The checksum is calculated so that the sum of byte pairs cast as short (16 bit) integers over the complete group results in a net sum of zero. The byte, short, ushort, long, ulong, float and double formats are defined in Appendix A: Data Format Description. The ranges of valid values for group fields that contain numbers are specified using the following notation. [a, b] implies the range a to b including the range lower and upper boundaries. A value x that falls in this range will respect the inequality a # x # b. (a, b) implies the range a to b excluding the range lower and upper boundaries. A value x that falls in this range will respect the inequality a # x # b. (a, b] implies the range a to b excluding the lower boundary and including the upper boundary. A value x that falls in this range will respect the inequality a # x # b. [a, b) implies the range a to b excluding the range lower and upper boundaries. A value x that falls in this range will respect the inequality a # x # b. If a value a or b is not given, then there is no corresponding lower or upper boundary. The following are special cases: (0, ) represents all positive numbers (excludes 0) [0, ) represents all non-negative numbers (includes 0) ( , 0) represents all negative numbers (excludes 0) ( , 0] represents all non-positive numbers (includes 0) ( , ) represents all numbers in the range of valid numbers. Group fields that contain numerical values may contain invalid numbers. Invalid byte, short, ushort, long, ulong, float and double values are defined in Table 82 in Appendix A: Data Format Description. POS MV outputs invalid values in fields containing numerical values for which POS MV has no valid data. This does not apply to fields containing bit settings. 3.2.4 Compatibility with Previous POS Products The compatibility of POS MV V4 groups with POS MV V3 products is given as follows: The POS MV V4 group format is the same as that of the POS MV V3 products. 10 The contents of Groups 1-8 and Group 99 are the same as those of the POS MV V3 products. However, Groups 7 and 8 have been expanded with new fields that occur before the Pad field. This is compatible with the POS MV V3 group design. Groups 9-98 are not defined in POS MV V3 products. Hence, no compatibility requirement exists for these groups. Several groups in the range of Groups 9-98 are the same as or similar to some POS MV V3 product-specific groups. For example, Group 10 is similar to POS MV V3 Group 101. The contents of Groups 10001-10005 are the same as those of all POS MV V3 products. 3.3 Output Group Tables 3.3.1 POS Data Groups Group 1: Vessel Position, Velocity, Attitude & Dynamics The POS MV group 1 contains data valid for the position defined by the user-entered reference to vessel lever arms (see Message 121: Vessel Installation Parameter Set-up). POS MV assumes the vessel and reference frames are co-aligned, therefore the reference to vessel mounting angles (see Message 20: General Installation and Processing Parameters) should be zero. Table 4: Group 1: Vessel position, velocity, attitude & dynamics Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 1 N/A Byte count 2 ushort 132 bytes Time/Distance Fields 26 See Table 3 Latitude 8 double (-90, 90] degrees Longitude 8 double (-180, 180] degrees Altitude 8 double ( , ) meters North velocity 4 float ( , ) meters/second East velocity 4 float ( , ) meters/second Down velocity 4 float ( , ) meters/second Vessel roll 8 double (-180, 180] degrees Vessel pitch 8 double (-90, 90] degrees Vessel heading 8 double [0, 360) degrees Vessel wander angle 8 double (-180, 180] degrees 11 Item Bytes Format Value Units Vessel track angle 4 float [0, 360) degrees Vessel speed 4 float [0, ) meters/second Vessel angular rate about longitudinal axis 4 float ( , ) degrees/second Vessel angular rate about transverse axis 4 float ( , ) degrees/second Vessel angular rate about down axis 4 float ( , ) degrees/second Vessel longitudinal acceleration 4 float ( , ) meters/second 2 Vessel transverse acceleration 4 float ( , ) meters/second 2 Vessel down acceleration 4 float ( , ) meters/second 2 Alignment status 1 byte See Table 5 N/A Pad 1 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Table 5: Group 1 alignment status Group 1 Status Description 0 Full navigation (User accuracies are met) 1 Fine alignment is active (RMS heading error is less than 15 degrees) 2 GC CHI 2 (alignment with GPS, RMS heading error is greater than 15 degrees) 3 PC CHI 2 (alignment without GPS, RMS heading error is greater than 15 degrees) 4 GC CHI 1 (alignment with GPS, RMS heading error is greater than 45 degrees) 5 PC CHI 1 (alignment without GPS, RMS heading error is greater than 45 degrees) 6 Coarse leveling is active 12 Group 1 Status Description 7 Initial solution assigned 8 No valid solution Group 2: Vessel Navigation Performance Metrics This group contains vessel position, velocity and attitude performance metrics. The data in this group is valid for the position defined by the user-entered reference vessel lever arms. All data items in this group are given in RMS values. Table 6: Group 2: Vessel navigation performance metrics Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 2 N/A Byte count 2 ushort 80 bytes Time/Distance Fields 26 See Table 3 North position RMS error 4 float [0, ) meters East position RMS error 4 float [0, ) meters Down position RMS error 4 float [0, ) meters North velocity RMS error 4 float [0, ) meters/second East velocity RMS error 4 float [0, ) meters/second Down velocity RMS error 4 float [0, ) meters/second Roll RMS error 4 float [0, ) degrees Pitch RMS error 4 float [0, ) degrees Heading RMS error 4 float [0, ) degrees Error ellipsoid semi-major 4 float [0, ) meters Error ellipsoid semi-minor 4 float [0, ) meters Error ellipsoid orientation 4 float (0, 360] degrees Pad 2 byte 0 N/A 13 Item Bytes Format Value Units Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 3: Primary GPS Status This group contains status data from the primary GPS receiver. The group length is variable, depending on the number of primary GPS receiver channels that report data. This group assumes that the primary GPS receiver contains up to 12 channels and therefore provides up to 12 channel status fields. Each channel status field has the format given in Table 8. The GPS receiver type field identifies the primary GPS receiver in POS MV from among the GPS receiver types listed in Table 11 that POS MV supports. The GPS status field comprises a 4 _byte array of status bits whose format depends on the GPS receiver type. Table 7: Group 3: Primary GPS status Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 3 N/A Byte count 2 ushort 76 + 20 x (number of channels) bytes Time/Distance Fields 26 See Table 3 Navigation solution status 1 byte See Table 9 N/A Number of SV tracked 1 byte [0, 12] N/A Channel status byte count 2 ushort [0, 240] bytes Channel status variable See Table 8 HDOP 4 float ( , ) N/A VDOP 4 float ( , ) N/A DGPS correction latency 4 float [0, 999.9] seconds DGPS reference ID 2 ushort [0, 1023] N/A GPS/UTC week number 4 ulong [0, 1023] 0 if not available week GPS/UTC time offset 8 double ( , ) seconds 14 Item Bytes Format Value Units GPS navigation message latency 4 float Number of seconds from the PPS pulse to the start of the GPS navigation data output seconds Geoidal separation 4 float ( , ) meters GPS receiver type 2 ushort See Table 11 N/A GPS status 4 ulong GPS summary status fields which depend on GPS receiver type. Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Table 8: GPS receiver channel status data Item Bytes Format Value Units SV PRN 2 ushort [1, 40] N/A Channel tracking status 2 ushort See Table 10 N/A SV azimuth 4 float [0, 360) degrees SV elevation 4 float [0, 90] degrees SV L1 SNR 4 float [0, ) dB SV L2 SNR 4 float [0, ) dB Table 9: GPS navigation solution status Status Value Description Expected Accuracy -1 Unknown N/A 0 No data from Receiver N/A 1 Horizontal C/A mode (unconstrained vertical position) 75 meters 2 3-dimension C/A mode 75 meters 3 Horizontal DGPS mode (unconstrained vertical position) 1 meter 4 3-dimension DGPS mode 1 meter 15 Status Value Description Expected Accuracy 5 Float RTK mode 0.25 meters 6 Integer wide lane RTK mode 0.2 meters 7 Integer narrow lane RTK mode 0.02 meters 8 P-Code mode 10 meters Table 10: GPS channel status Channel Status Description 0 L1 Idle 1 Reserved 2 L1 acquisition 3 L1 Code lock 4 Reserved 5 L1 Phase lock (full performance tracking for L1-only receiver) 6 L2 Idle 7 Reserved 8 L2 acquisition 9 L2 Code lock 10 Reserved 11 L2 phase lock (full performance for L1/L2 receiver) Table 11: GPS receiver type GPS type Description 0 No receiver 1 to 7 Reserved 8 Trimble BD112 9 Trimble BD750 10 Reserved 11 Trimble Force 5 GRAM-S 12 Trimble BD132 13 Trimble BD950 14 to 15 Reserved 16 Trimble BD960 17 Trimble BD982 16 GPS type Description 14 and up Reserved Table 12: Trimble BD950 GPS receiver status Item Bytes Format Failure Status of Receiver 4 chars Description Value SETT Setting time GETD Updating Health CAL1 Calibrating MEAS Static Survey KINE Kinematic Survey Group 4: Time-tagged IMU Data This group consists of the time-tagged IMU data that is suitable for import by POSPAC, Applanix' post-processing software package. U.S. and Canadian export control laws prohibit publication of the IMU data format. Table 13: Group 4: Time-tagged IMU data Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 4 N/A Byte count 2 ushort 60 bytes Time/Distance Fields 26 See Table 3 IMU Data 29 byte Pad 1 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A 17 Group 5: Event 1 The time and distance fields in this group indicate the time and distance of Event 1 discrete signals that the POS MV receives. A client can use this message to attach GPS/UTC time to external events. Group 6: Event 2 The time and distance fields in this group indicate the time and distance of Event 2 discrete signals that the POS MV receives. A client can use this message to attach GPS/UTC time to external events. Table 14: Group 5/6: Event 1/2 Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 5 or 6 N/A Byte count 2 ushort 36 bytes Time/Distance Fields 26 See Table 3 Event pulse number 4 ulong [0, ) N/A Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 7: PPS Time Recovery and Status The time and distance fields in this group indicate the time and distance of the PPS from the primary GPS receiver. The PPS count is the number of PPS messages since power-up and initialization of the GPS receivers. The time synchronization status field indicates the status of POS MV synchronization to the PPS time provided by the primary GPS receiver as follows: No synchronization indicates that the POS MV has not synchronized to GPS time. This is the case if the GPS receiver has not initialized and provided time recovery data to the POS MV. Synchronizing indicates that the POS MV is in the process of synchronizing to GPS time. This lasts on the order of 10-20 seconds as the POS MV establishes its internal clock offset and drift parameters. Fully synchronized indicates that the POS MV has established synchronization to GPS time with less than 10 microseconds error and is maintaining the synchronization once per second. 18 Using old offset indicates that the POS MV is using the last good clock offset to compute GPS times. The POS MV has either not received a PPS or time recovery message or has rejected erroneous GPS time synchronization data. This data provides for PPS time recovery of any of the time bases supported by the POS MV. It allows an external device to acquire GPS or UTC time, or to relate GPS time to POS MV time. Table 15: Group 7: PPS Time Recovery and Status Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 7 N/A Byte count 2 ushort 36 bytes Time/Distance Fields 26 See Table 3 PPS count 4 ulong [0, ) N/A Time synchronization status 1 byte 0 Not synchronized 1 Synchronizing 2 Fully synchronized 3 Using old offset Pad 1 byte 0 N/A Checksum 2 ushort N/A N/A Group End 2 char $# N/A Group 8: Reserved Group 9: GAMS Solution This group contains the GAMS solution and solution status. The following are descriptions of some of the group elements. The number of satellites field gives the number of satellites in the GAMS solution. The PDOP is the PDOP of the satellite constellation selected by GAMS. The computed antenna separation is the length of the baseline vector that GAMS computes. The solution status describes the status of the current GAMS solution. The PRN assignment fields give the satellite PRN assigned to each observables processing channel. The cycle slip flag identifies processing channels in which the ambiguity search algorithm has detected cycle slips. 19 The GAMS heading is the heading of the antenna baseline vector. The heading RMS error is estimated by GAMS based on the RMS uncertainties of the primary and secondary carrier phase measurements reported by the primary and secondary GPS receivers. Table 16: Group 9: GAMS Solution Status Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 9 N/A Byte count 2 ushort 72 bytes Time/Distance Fields 26 See Table 3 Number of satellites 1 ubyte N/A N/A A priori PDOP 4 float [0, 999] N/A Computed antenna separation 4 float [0, ) meters Solution Status 1 byte 0 fixed integer 1 fixed integer test install data 2 degraded fixed integer 3 _floated ambiguity 4 degraded floated ambiguity 5 solution without install data 6 solution from navigator attitude and install data 7 no solution PRN assignment 12 byte Each byte contains 0-32 where 0 = unassigned PRN 1-40 = PRN assigned to channel Cycle slip flag 2 ushort Bits 0-11: (k-1) th bit set to 1 implies cycle slip in channel k. Example: Bit 3 set to 1 implies cycle slip in channel 4. Bits 12-15: not used. 20 Item Bytes Format Value Units GAMS heading 8 double [0,360) Degrees GAMS heading RMS error 8 double (0, ) Degrees Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 10: General Status and FDIR This group is used to output general and Fault Detection, Isolation and Reconfiguration (FDIR) status information. The POS Controller decodes and displays the sensor hardware status output in this group. The following is a brief description of group contents. General Status A contains bit-encoded status information from the following processes: integrated navigation, data logging and generic hardware. General Status B contains bit-encoded status information from the following processes: primary GPS data input, secondary GPS data input, auxiliary GPS data input, GAMS. General Status C contains bit-encoded information from the following processes: integrated navigation, gimbal data input, DMI data input, base GPS messages (RTCM, CMR, RTCA) input. FDIR Level 1, similar to a built-in test, reports problems in communications between the sensors and the PCS. FDIR Level 2, the direct reasonableness test, compares the sensor data against reasonable magnitude limits for the POS-instrumented Vessel. FDIR Level 3, the direct comparison test, compares IMU data against aiding sensor data and identifies unreasonable differences when they occur. FDIR Level 4, the residual test, monitors the measurement residuals from the Kalman filter and rejects measurements that fall outside a specified 95% confidence level. Consistent measurement rejection indicates a potential IMU or aiding sensor failure. FDIR Level 5, the indirect reasonableness test, monitors Kalman filter estimates of inertial sensor errors and installation errors. Soft sensor failures appear as slow increases in these errors. If a threshold is exceeded, a sensor failure is flagged. 21 Table 17: Group 10: General and FDIR status Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 10 N/A Byte count 2 ushort 56 Bytes Time/Distance Fields 26 See Table 3 General Status A 4 ulong Coarse levelling active bit 0: set Coarse levelling failed bit 1: set Quadrant resolved bit 2: set Fine align active bit 3: set Inertial navigator initialised bit 4: set Inertial navigator alignment active bit 5: set Degraded navigation solution bit 6: set Full navigation solution bit 7: set Initial position valid bit 8: set Reference to Primary GPS Lever arms = 0 bit 9: set Reference to Sensor 1 Lever arms = 0 bit 10: set Reference to Sensor 2 Lever arms = 0 bit 11: set Logging Port file write error bit 12: set Logging Port file open bit 13: set Logging Port logging enabled bit 14: set Logging Port device full bit 15: set RAM configuration differs from NVM bit 16: set NVM write successful bit 17: set NVM write fail bit 18: set NVM read fail bit 19: set CPU loading exceeds 55% threshold bit 20: set CPU loading exceeds 85% threshold bit 21: set Spare bits: 22-31 22 Item Bytes Format Value Units General Status B 4 ulong User attitude RMS performance bit 0: set User heading RMS performance bit 1: set User position RMS performance bit 2: set User velocity RMS performance bit 3: set GAMS calibration in progress bit 4: set GAMS calibration complete bit 5: set GAMS calibration failed bit 6: set GAMS calibration requested bit 7: set GAMS installation parameters valid bit 8: set GAMS solution in use bit 9: set GAMS solution OK bit 10: set GAMS calibration suspended bit 11: set GAMS calibration forced bit 12: set Primary GPS navigation solution in use bit 13: set Primary GPS initialisation failed bit 14: set Primary GPS reset command sent bit 15: set Primary GPS configuration file sent bit 16: set Primary GPS not configured bit 17: set Primary GPS in C/A mode bit 18: set Primary GPS in Differential mode bit 19: set Primary GPS in float RTK mode bit 20: set Primary GPS in wide lane RTK mode bit 21: set Primary GPS in narrow lane RTK mode bit 22: set Primary GPS observables in use bit 23: set Secondary GPS observables in use bit 24: set Auxiliary GPS navigation solution in use bit 25: set Auxiliary GPS in P-code mode bit 26: set Auxiliary GPS in Differential mode bit 27: set 23 Item Bytes Format Value Units Auxiliary GPS in float RTK mode bit 28: set Auxiliary GPS in wide lane RTK mode bit 29: set Auxiliary GPS in narrow lane RTK mode bit 30: set Primary GPS in P-code mode bit 31: set General Status C 4 ulong Gimbal input ON bit 0: set Gimbal data in use bit 1: set DMI data in use bit 2: set ZUPD processing enabled bit 3: set ZUPD in use bit 4: set Position fix in use bit 5: set RTCM differential corrections in use bit 6: set RTCM RTK messages in use bit 7: set RTCA RTK messages in use bit 8: set CMR RTK messages in use bit 9: set IIN in DR mode bit 10: set IIN GPS aiding is loosely coupled bit 11: set IIN in C/A GPS aided mode bit 12: set IIN in RTCM DGPS aided mode bit 13: set IIN in code DGPS aided mode bit 14: set IIN in float RTK aided mode bit 15 set IIN in wide lane RTK aided mode bit 16: set IIN in narrow lane RTK aided mode bit 17: set Received RTCM Type 1 message bit 18: set Received RTCM Type 3 message bit 19: set Received RTCM Type 9 message bit 20: set Received RTCM Type 18 messages bit 21: set Received RTCM Type 19 messages bit 22: set Received CMR Type 0 message bit 23: set 24 Item Bytes Format Value Units Received CMR Type 1 message bit 24: set Received CMR Type 2 message bit 25: set Received CMR Type 94 message bit 26 set Received RTCA SCAT-1 message bit 27: set Spare bit: 28-31 FDIR Level 1 status 4 ulong IMU-POS checksum error bit 0: set IMU status bit set by IMU bit 1: set Successive IMU failures bit 2: set IIN configuration mismatch failure bit 3: set Primary GPS not in Navigation mode bit 5: set Primary GPS not available for alignment bit 6: set Primary data gap bit 7: set Primary GPS PPS time gap bit 8: set Primary GPS time recovery data not received bit 9: set Primary GPS observable data gap bit 10: set Primary ephemeris data gap bit 11: set Primary GPS excessive lock-time resets bit 12: set Primary GPS missing ephemeris bit 13: set Primary GPS SNR failure bit 16: set Base GPS data gap bit 17: set Base GPS parity error bit 18: set Base GPS message rejected bit 19: set Secondary GPS data gap bit 20: set Secondary GPS observable data gap bit 21: set Secondary GPS SNR failure bit 22: set Secondary GPS excessive lock-time resets bit 23: set Auxiliary GPS data gap bit 25: set GAMS ambiguity resolution failed bit 26: set 25 Item Bytes Format Value Units Gimbal data gap bit 27: set DMI failed or is offline bit 28: set IIN WL ambiguity error bit 30: set IIN NL ambiguity error bit 31: set Spare bits: 4, 14, 15, 24, 29 FDIR Level 1 IMU failures 2 ushort Shows number of FDIR Level 1 Status IMU failures (bits 0 or 1) = Bad IMU Frames FDIR Level 2 status 2 ushort Inertial speed exceeds max bit 0: set Primary GPS velocity exceeds max bit 1: set Primary GPS position error exceeds max bit 2: set Auxiliary GPS position error exceeds max bit 3: set DMI speed exceeds max bit 4: set Spare bits: 5-15 FDIR Level 3 status 2 ushort Spare bits: 0-15 FDIR Level 4 status 2 ushort Primary GPS position rejected bit 0: set Primary GPS velocity rejected bit 1: set GAMS heading rejected bit 2: set Auxiliary GPS data rejected bit 3: set DMI data rejected bit 4: set Primary GPS observables rejected bit 5: set Spare bits: 6-15 FDIR Level 5 status 2 ushort X accelerometer failure bit 0: set Y accelerometer failure bit 1: set Z accelerometer failure bit 2: set X gyro failure bit 3: set Y gyro failure bit 4: set Z gyro failure bit 5: set Excessive GAMS heading offset bit 6: set 26 Item Bytes Format Value Units Excessive primary GPS lever arm error bit 7: set Excessive auxiliary 1 GPS lever arm error bit 8: set Excessive auxiliary 2 GPS lever arm error bit 9: set Excessive POS position error RMS bit10:set Excessive primary GPS clock drift bit11:set Spare bits: 12-15 Pad 0 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A max = maximum Group 11: Secondary GPS Status This group contains status data from the secondary GPS receiver. The group length is variable, depending on the number of secondary GPS receiver channels that report data. This group assumes that the secondary GPS receiver contains up to 12 channels and therefore provides 12 channel status fields. Each channel status field has the format given in Table 8. The GPS navigation message latency field contains the time between the PPS pulse and the start of the GPS navigation data output Table 18: Group 11: Secondary GPS status Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 11 N/A Byte count 2 ushort 76 + 20 x (number of channels) Bytes Time/Distance Fields 26 See Table 3 Navigation solution status 1 byte See Table 9 N/A Number of SV tracked 1 byte [0, 12] N/A Channel status byte count 2 ushort [0, 240] Bytes Channel status variable See Table 8 27 Item Bytes Format Value Units HDOP 4 float (0, ) N/A VDOP 4 float (0, ) N/A DGPS correction latency 4 float [0, 99.9] Seconds DGPS reference ID 2 ushort [0, 1023] N/A GPS/UTC week number 4 ulong [0, 1023] 0 if not available Week GPS/UTC time offset 8 double ( , 0] (GPS time - UTC time) Seconds GPS navigation message latency 4 float [0, ) Seconds Geoidal separation 4 float ( , ) Meters GPS receiver type 2 ushort See Table 11 N/A GPS status 4 ulong GPS summary status fields which depend on GPS receiver type. Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 12: Auxiliary 1 GPS Status This group contains data from an optional auxiliary 1 external GPS receiver. The group is variable in length because it is dependent upon the number of satellites that the auxiliary 1 GPS receiver is tracking. This group assumes that the auxiliary 1 GPS receiver contains up to 12 channels and therefore provides 12 channel status fields. The centre section of this group grows with increasing number of satellites tracked. Group 13: Auxiliary 2 GPS Status This group contains data from an optional auxiliary 2 external GPS receiver. The group has the same format as Group 12. Table 19 specifies the format for both Groups 12 and 13 28 Table 19: Group 12/13: Auxiliary 1/2 GPS status Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 12 or 13 N/A Byte count 2 ushort 72 + 20 x (number of channels) Bytes Time/Distance Fields 26 See Table 3 Navigation solution status 1 byte See Table 9 N/A Number of SV Tracked 1 byte [0, 40] N/A Channel status byte count 2 ushort [0, ) Bytes Channel status variable See Table 8 HDOP 4 float (0, ) N/A VDOP 4 float (0, ) N/A DGPS correction latency 4 float (0, ) Seconds DGPS reference ID 2 ushort [0, 1023] N/A GPS/UTC week number 4 ulong [0, 1023] 0 if not available Week GPS time offset 8 double ( , 0] Seconds (GPS time - UTC time) GPS navigation message latency 4 float [0, ) Seconds Geoidal separation 4 float N/A Meters NMEA messages Received 2 ushort Bit (set) NMEA Message 0 GGA (GPS position) 1 GST (noise statistics) 2 GSV (satellites in view) 3 GSA (DOP & active SVs) 4-15 Reserved 29 Item Bytes Format Value Units Aux 1/2 in Use 1 1 byte 0 Not in use 1 In use N/A Pad 1 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A 1 Group 12/13 Aux in Use fields will not be set in use simultaneously. Group 14: Calibrated Installation Parameters This group lists the calibrated installation parameters that the POS MV computes during Navigate mode when the Calibrate function is active. The group includes a Figure of Merit (FOM) for each set of parameters that the user can choose to calibrate. The FOM ranges from 0 to 100 and describes the percentage of a complete calibration that a calibration has achieved. A FOM equal to 0 indicates one of two possibilities: # A parameter is not being calibrated because the user did not flag the parameter for calibration in Message 57: Installation calibration control (see Section 0). # A parameter is not calibrated during a calibration of the parameter because the Vessel has not executed the required dynamics to effect the calibration. Table 20: Group 14: Calibrated installation parameters Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 14 N/A Byte count 2 ushort 116 Bytes Time/Distance Fields 26 See Table 3 Calibration status 2 ushort See Table 21 for bitfield Reference to Primary GPS X lever arm 4 float ( , ) Meters Reference to Primary GPS Y lever arm 4 float ( , ) Meters Reference to Primary GPS Z lever arm 4 float ( , ) Meters Reference to Primary GPS lever arm calibration FOM 2 ushort [0, 100] N/A Reference to Auxiliary 1 GPS X lever arm 4 float ( , ) Meters 30 Item Bytes Format Value Units Reference to Auxiliary 1 GPS Y lever arm 4 float ( , ) Meters Reference to Auxiliary 1 GPS Z lever arm 4 float ( , ) Meters Reference to Auxiliary 1 GPS lever arm calibration FOM 2 ushort [0, 100] N/A Reference to Auxiliary 2 GPS X lever arm 4 float ( , ) Meters Reference to Auxiliary 2 GPS Y lever arm 4 float ( , ) Meters Reference to Auxiliary 2 GPS Z lever arm 4 float ( , ) Meters Reference to Auxiliary 2 GPS lever arm calibration FOM 2 ushort [0, 100] N/A Reference to DMI X lever arm 4 float ( , ) Meters Reference to DMI Y lever arm 4 float ( , ) Meters Reference to DMI Z lever arm 4 float ( , ) Meters Reference to DMI lever arm calibration FOM 2 ushort [0, 100] N/A DMI scale factor 4 float ( , ) % DMI scale factor calibration FOM 2 ushort [0, 100] N/A Reference to DVS X lever arm 4 float ( , ) Meters Reference to DVS Y lever arm 4 float ( , ) Meters Reference to DVS Z lever arm 4 float ( , ) meters Reference to DVS lever arm calibration FOM 2 ushort [0, 100] N/A DVS scale factor 4 float ( , ) % DVS scale factor calibration FOM 2 ushort [0, 100] N/A Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A 31 Table 21: IIN Calibration Status Bit Set Status Description 0 Reference to Primary GPS lever arm calibration is in progress 1 Reference to Auxiliary 1 GPS lever arm calibration is in progress 2 Reference to Auxiliary 2 GPS lever arm calibration is in progress 3 Reference to DMI lever arm calibration is in progress 4 DMI scale factor calibration is in progress 5 Reference to DVS lever arm calibration is in progress 6 Reference to Position Fix lever arm calibration is in progress 7 Reserved 8 Reference to Primary GPS lever arm calibration is completed 9 Reference to Auxiliary 1 GPS lever arm calibration is completed 10 Reference to Auxiliary 2 GPS lever arm calibration is completed 11 Reference to DMI lever arm calibration is completed 12 DMI scale factor calibration is completed 13 Reference to DVS lever arm calibration is completed 14 Reference to Position Fix lever arm calibration is completed 15 Reserved Group 15: Reserved Group 16: Reserved Group 17: User Time Status This group contains status information about user time synchronization. Table 22: Group 17: User Time Status Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 17 N/A 32 Item Bytes Format Value Units Byte count 2 ushort 40 Bytes Time/Distance Fields 26 See Table 3 Number of Time Synch message rejections 4 ulong [0, ) N/A Number of User Time resynchronizations 4 ulong [0, ) N/A User time valid 1 byte 1 or 0 N/A Time Synch message received 1 byte 1 or 0 N/A Pad 0 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 20: IIN Solution Status This group contains the IIN observables processing status and relevant data. The following are descriptions of some of the fields. The number of satellites field gives the number of satellites in the IIN solution. The a priori PDOP is the PDOP of the satellite constellation selected by IIN before processing. The baseline length is the computed distance between the primary GPS antenna and the reference GPS antenna. The IIN processing status describes the status of the current IIN solution. The 12 PRN assignment fields give the satellite PRN used in each observables processing channel in the IIN solution. The L1 cycle slip flag field contains a bit array whose bits when set, indicate an L1 cycle slips in the observables processing channels. The L2 cycle slip flag field contains a bit array whose bits when set, indicate L2 cycle slips in observables processing channels. In each bit array, bit (k-1) indicates the cycle slip status of processing channel k. Table 23: Group 20: IIN solution status Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 20 N/A Byte count 2 ushort 60 Bytes Time/Distance Fields 26 See Table 3 Number of satellites 2 ushort [0, 12] N/A A priori PDOP 4 float [0, 999] N/A 33 Item Bytes Format Value Units Baseline length 4 float [0, ) Meters IIN processing status 2 ushort 1 Fixed Narrow Lane RTK 2 Fixed Wide Lane RTK 3 Float RTK 4 Code DGPS 5 RTCM DGPS 6 Autonomous (C/A) 7 GPS navigation solution 8 No solution PRN assignment 12 12 byte Each byte contains 0-40 where 0 = unassigned PRN 1-40 = PRN assigned to channel L1 cycle slip flag 2 ushort Bits 0-11: (k-1) th bit set to 1 implies L1 cycle slip in channel k PRN. Example: Bit 3 set to 1 implies an L1 cycle slip in channel 4. Bits 12-15: not used. L2 cycle slip flag 2 ushort Bits 0-11: (k-1) th bit set to 1 implies L2 cycle slip in channel k PRN. Example: Bit 3 set to 1 implies an L2 cycle slip in channel 4. Bits 12-15: not used. Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 21: Base GPS 1 Modem Status The base GPS process may receive differential corrections from a base station via a modem connected to one of the POS MV serial ports. This group contains status information about the modem connected to the serial port associated with the Base GPS 1 input. 34 Group 22: Base GPS 2 Modem Status This group contains status information about the modem connected to the serial port associated with the Base GPS 2 input. Table 24: Group 21/22: Base GPS 1/2 Modem Status Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 21 or 22 N/A Byte count 2 ushort 116 Bytes Time/Distance Fields 26 See Table 3 Modem response 16 char N/A N/A Connection status 48 char N/A N/A Number of redials per disconnect 4 ulong [0, ) N/A Maximum number of redials per disconnect 4 ulong [0, ) N/A Number of disconnects 4 ulong [0, ) N/A Data gap length 4 ulong [0, ) N/A Maximum data gap length 4 ulong [0, ) N/A Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 23: Auxiliary 1 GPS Display Data This group contains the auxiliary 1 GPS receiver data stream, containing the NMEA strings requested by the PCS from the receiver plus any other bytes that the receiver inserts into the stream. The length of this group is variable. It is identical to group 10007 except for the time2 restriction and the fact it is intended for display only. Group 24: Auxiliary 2 GPS Display Data This group contains the auxiliary 2 GPS receiver data stream, containing the NMEA strings requested by the PCS from the receiver plus any other bytes that the receiver inserts into the stream. The length of this group is variable. It is identical to group 10008 except for the time2 restriction and the fact it is intended for display only. 35 Table 25: Group 23/24: Auxiliary 1/2 GPS raw display data Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 10007 or 10008 N/A Byte count 2 ushort variable Bytes Time/Distance Fields 26 See Table 3 Reserved 6 byte N/A N/A Variable message byte count 2 ushort [0, ) Bytes Auxiliary GPS raw data variable char N/A N/A Pad 0-3 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 25: Reserved Group 26: Reserved Group 99: Versions and Statistics This group provides feedback of the current statistics and software and hardware version numbers of the POS MV. This group contains operational statistics such as total hours of operation, number of runs, average run length and longest run. Table 26: Group 99: Versions and statistics Item Bytes Format Value Units Group Start 4 char $GRP N/A Group ID 2 ushort 99 N/A Byte Count 2 ushort 332 Bytes Time/Distance Fields 26 See Table 3 Table 3 System version 120 char Product - Model, Version, Serial Number, Hardware version, 36 Item Bytes Format Value Units Software release version - Date, ICD release version, Operating system version, IMU type, Primary GPS type (Table 11), Secondary GPS type (Table 11), DMI type, Gimbal type [,Option mnemonic-expiry time] [,Option mnemonic-expiry time] ..... Example: MV-320,VER4,S/N123,HW1.80-7, SW03.20-Aug3/05,ICD01.00, OS425B,IMU2,PGPS13,SGPS13, DMI0,GIM0,RTK-75 N/A Primary GPS version 80 char Available information is displayed, eg: Model number Serial number Hardware configuration version Software release version Release date Secondary GPS version 80 char Available information is displayed, eg: Model number Serial number Hardware configuration version Software release version 37 Item Bytes Format Value Units Release date Total hours 4 float [0, ) 0.1 hour resolution Hours Number of runs 4 ulong [0, ) N/A Average length of run 4 float [0, ) 0.1 hour resolution Hours Longest run 4 float [0, ) 0.1 hour resolution Hours Current run 4 float [0, ) 0.1 hour resolution Hours Pad 2 short 0 N/A Checksum 2 ushort N/A N/A Group End 2 char $# N/A Group 102: Sensor 1 Position, Velocity, Attitude, Heave & Dynamics This group contains position, velocity, attitude, track, speed and dynamics data for the sensor 1 position. Group 103: Sensor 2 Position, Velocity, Attitude, Heave & Dynamics This group contains position, velocity, attitude, track, speed and dynamics data for the sensor 2 position. Table 27: Group 102/103: Sensor 1/2 Position, Velocity, Attitude, Heave & Dynamics Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 102 or 103 N/A Byte count 2 ushort 128 Bytes Time/Distance Fields 26 See Table 3 Latitude 8 double (-90, 90] Deg Longitude 8 double (-180, 180] Deg Altitude 8 double ( , ) M Along track velocity 4 float ( , ) m/s Across track velocity 4 float ( , ) m/s 38 Item Bytes Format Value Units Down velocity 4 float ( , ) m/s Roll 8 double (-180, 180] Deg Pitch 8 double (-90, 90] Deg Heading 8 double [0, 360) Deg Wander angle 8 double (-180, 180] Deg Heave 1 4 float ( , ) M Angular rate about longitudinal axis 4 float ( , ) deg/s Angular rate about transverse axis 4 float ( , ) deg/s Angular rate about down axis 4 float ( , ) deg/s Longitudinal acceleration 4 float ( , ) m/s 2 Transverse acceleration 4 float ( , ) m/s 2 Down acceleration 4 float ( , ) m/s 2 Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A 1 Heave is output in the gravity direction from a local level frame located at the sensor 1 or 2 position. The Heave sign is positive down. Group 104: Sensor 1 Position, Velocity, and Attitude Performance Metrics This group contains sensor 1 position, velocity and attitude performance metrics. All data in this group are RMS values. Group 105: Sensor 2 Position, Velocity, and Attitude Performance Metrics This group contains sensor 2 position, velocity and attitude performance metrics. All data in this group are RMS values. 39 Table 28: Group 104/105: Sensor 1/2 Position, Velocity, and Attitude Performance Metrics Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 104 or 105 N/A Byte count 2 ushort 68 Bytes Time/Distance Fields 26 See Table 3 N position RMS 4 float [0, ) M E position RMS 4 float [0, ) M D position RMS 4 float [0, ) M Along track velocity RMS error 4 float [0, ) m/s Across track velocity RMS error 4 float [0, ) m/s Down velocity RMS error 4 float [0, ) m/s Roll RMS error 4 float [0, ) Deg Pitch RMS error 4 float [0, ) Deg Heading RMS error 4 float [0, ) Deg Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 110: MV General Status & FDIR This group contains MV specific status bits. It is an extension of the Core group 10 information. Table 29: Group 110: MV General Status & FDIR Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 110 N/A Byte count 2 ushort 32 Bytes 40 Item Bytes Format Value Units Time/Distance Fields 26 See Table 3 General Status 4 ulong User logged in bit 0: set -- doc error; said 2 byte ulong, but need 32 bits (4 byte ulong) reserved bit 1 to 9 TrueZ Active bit 10: set TrueZ Ready bit 11: set TrueZ In Use bit 12: set Reserved bit 13 to 31 Pad 2 byte 0 -- doc error, with general status as 4 then pad needs to be 2 Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 111: Heave & True Heave Data This group contains data from the True Heave calculations (delayed in time), along with time- matched Heave (Real-time) data. Both the Real-Time and True Heave values are in the gravity direction from a local level frame located at the Sensor 1 position. The Heave sign is positive down. Table 30: Group 111: Heave & True Heave Data Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 111 N/A Byte count 2 ushort 76 Bytes Time/Distance Fields 26 See Table 3 True Heave 4 float ( , ) M True Heave RMS 4 float [0, ) M Status 4 ulong True Heave Valid bit 0: set Real-time Heave Valid bit 1: set reserved bit 2 to 31 Heave 4 float ( , ) M Heave RMS 4 float [0, ) M 41 Item Bytes Format Value Units Heave Time 1 8 double N/A Sec Heave Time 2 8 double N/A Sec Rejected IMU Data Count 4 ulong [0, ) N/A Out of Range IMU Data Count 4 ulong [0, ) N/A Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 112: NMEA Strings This group contains a copy of the NMEA strings output from the user selected COM port. This group will be available for output at the same rate selected for NMEA output on the COM port. Note that the user must select this group for output on the desired Data in order to receive the data. Table 31: Group 112: NMEA Strings Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 112 N/A Byte count 2 ushort variable Bytes Time/Distance Fields 26 See Table 3 Variable group byte count 2 ushort [0, ) N/A- error in docs list this as 2 byte float, guessing it should be a ushort NMEA strings variable char N/A N/A Pad 0-3 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 113: Heave & True Heave Performance Metrics This group contains quality data from the True Heave calculations. 42 Table 32: Group 113: Heave & True Heave Performance Metrics Item Byte s Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 113 N/A Byte count 2 ushort 68 Bytes Time/Distance Fields 26 See Table 3 Heave Time 1 8 double N/A Sec Quality Control 1 8 double N/A N/A Quality Control 2 8 double N/A N/A Quality Control 3 8 double N/A N/A Status 4 ulong Quality Control 1 Valid bit 0: set Quality Control 2 Valid bit 1: set Quality Control 3 Valid bit 2: set Reserved bit 3 to 31 Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 114: TrueZ & TrueTide Data This group contains altitude data from the delayed TrueZ and delayed TrueTide calculations along with the time-matched real-time data. The real-time TrueZ, delayed TrueZ and delayed TrueTide values are in the gravity direction from a local level frame located at the Sensor 1 position. The real-time TrueTide values are in the gravity direction from a local level frame located at the Vessel position. 43 Table 33: Group 114: TrueZ & TrueTide Data Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 114 N/A Byte count 2 ushort 76 Bytes Time/Distance Fields 26 See Table 3 Delayed TrueZ 4 float ( , ) M Delayed TrueZ RMS 4 float [0, ) M Delayed TrueTide 4 float ( , ) M Status 4 ulong Delayed TrueZ Valid bit 0: set Real-time TrueZ Valid bit 1: set Reserved bit 2 to 31 TrueZ 4 float ( , ) M TrueZ RMS 4 float [0, ) M TrueTide 4 float ( , ) M TrueZ Time 1 8 double N/A Sec TrueZ Time 2 8 double N/A Sec Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A 3.3.2 Raw Data Groups Group 10001: Primary GPS Data Stream This group contains the primary GPS receiver data as output by the receiver. The length of this group is variable. The GPS data stream is packaged into the group as it is received, irrespective of GPS message boundaries. The messages contained in this group depends on the primary GPS receiver that the POS MV uses. If a data extraction process concatenates the data components from these groups into a single file, then the resulting file will be the same as a file of data recorded directly from the primary GPS receiver. 44 Table 34: Group 10001: Primary GPS data stream Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 10001 N/A Byte count 2 ushort variable Bytes Time/Distance Fields 26 See Table 3 GPS receiver type 2 ushort See Table 11 N/A Reserved 4 long N/A N/A Variable message byte count 2 ushort [0, ) Bytes GPS Receiver raw data variable char N/A N/A Pad 0-3 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 10002: Raw IMU Data This group contains the IMU data as output by the IMU directly. The length of this group is variable. The IMU header field contains 6 characters of which the first 4 are ``$IMU'' and the last two are the IMU type number in ASCII format (example: ``$IMU01'' identifies IMU type 1). The Data checksum is a 16-bit sum of the IMU data. The POS MV provides this checksum in addition to the possible IMU-generated checksums in the IMU data field. U.S. and Canadian export control laws prevent the publication of the IMU data field formats for the different IMU's that the POS MV supports. Table 35: Group 10002: Raw IMU LN200 data Item Bytes Forma t Value Units Group start 4 char $GRP N/A Group ID 2 ushort 10002 N/A Byte count 2 ushort Variable Bytes Time/Distance Fields 26 See Table 3 IMU header 6 char $IMUnn where nn identifies the IMU type. 45 Item Bytes Forma t Value Units Variable message byte count 2 ushort [0, ) Bytes X delta velocity 2 short 2-14 metres/sec/pulse count pulse counts Yneg delta velocity 2 short 2-14 metres/sec/pulse count pulse counts Zneg delta velocity 2 short 2-14 metres/sec/pulse count pulse counts X delta theta 2 short 2-18 radians/pulse count pulse counts Yneg delta theta 2 short 2-18 radians/pulse count pulse counts Zneg delta theta 2 short 2-18 radians/pulse count pulse counts IMU Status Summary 2 short N/A N/A Mode bit/MUX ID 2 short N/A N/A MUX data word 2 short N/A N/A X raw gyro count 2 short 1 pulse/pulse count pulse counts Y raw gyro count 2 short 1 pulse/pulse count pulse counts Z raw gyro count 2 short 1 pulse/pulse count pulse counts IMU Checksum 2 short N/A N/A Data Checksum 2 short N/A N/A Pad 0 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 10003: Raw PPS This group contains the raw PPS data that the POS MV generates. The time of the PPS is given in the Time/Distance fields. Table 36: Group 10003: Raw PPS Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 10003 N/A Byte count 2 ushort 36 Bytes Time/Distance Fields 26 See Table 3 PPS pulse count 4 Ulong [0, ) N/A Pad 2 Byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 10004: Raw Event 1 This group contains the raw Event 1 data that the POS MV generates. The time of the event pulse count is given in the Time/Distance fields. Group 10005: Raw Event 2 This group contains the raw Event 2 data that the POS MV generates. The time of the event pulse count is given in the Time/Distance fields. 46 Table 37: Group 10004/10005: Raw Event 1/2 Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 10004 or 10005 N/A Byte count 2 ushort 36 Bytes Time/Distance Fields 26 See Table 3 Event 1 pulse count 4 ulong [0, ) N/A Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 10006: Reserved Group 10007: Auxiliary 1 GPS Data Stream This group contains the auxiliary 1 GPS receiver data stream, containing the NMEA strings requested by the PCS from the receiver plus any other bytes that the receiver inserts into the stream. The length of this group is variable. If a data extraction process concatenates the data components from these groups into a single file, then the resulting file will be the same as an ASCII file of NMEA strings recorded directly from the auxiliary 1 GPS receiver. Group 10008: Auxiliary 2 GPS Data Stream This group contains the auxiliary 2 GPS receiver data stream, containing the NMEA strings requested by the PCS from the receiver plus any other bytes that the receiver inserts into the stream. The length of this group is variable. If a data extraction process concatenates the data components from these groups into a single file, then the resulting file will be the same as an ASCII file of NMEA strings recorded directly from the auxiliary 2 GPS receiver. Table 38: Group 10007/10008: Auxiliary 1/2 GPS data streams Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 10007 or 10008 N/A Byte count 2 ushort variable Bytes Time/Distance Fields 26 See Table 3 reserved 2 byte N/A N/A 47 Item Bytes Format Value Units reserved 4 long N/A N/A Variable message byte count 2 ushort [0, ) Bytes Auxiliary GPS raw data variable char N/A N/A Pad 0-3 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 10009: Secondary GPS Data Stream This group contains the secondary GPS receiver data as output by the receiver. The length of this group is variable. The GPS data stream is packaged into the group as it is received, irrespective of GPS message boundaries. The messages contained in this group depends on the secondary GPS receiver that the POS MV uses. If a data extraction process concatenates the data components from these groups into a single file, then the resulting file will be the same as a file of data recorded directly from the secondary GPS receiver. Table 39: Group 10009: Secondary GPS data stream Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 10009 N/A Byte count 2 ushort Variable Bytes Time/Distance Fields 26 See Table 3 GPS receiver type 2 ushort See Table 11 N/A Reserved 4 byte N/A N/A Variable message byte count 2 ushort [0, ) Bytes GPS Receiver Message variable char N/A N/A Pad 0-3 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A Group 10010: Reserved 48 Group 10011: Base GPS 1 Data Stream This group contains the message data stream the POS MV receives as differential corrections. The length of this group is variable and dependent on the messages received by the PCS. If a data extraction process concatenates the data components from this group into a single file, then the resulting file will be the same as a file of data captured from the serial data stream connected to a differential corrections port. Group 10012: Base GPS 2 Data Stream This group contains the message data stream the POS MV receives as differential corrections. The length of this group is variable and dependent on the messages received by the PCS. If a data extraction process concatenates the data components from this group into a single file, then the resulting file will be the same as a file of data captured from the serial data stream connected to a differential corrections port. Table 40: Group 10011/10012: Base GPS 1/2 data stream Item Bytes Format Value Units Group start 4 char $GRP N/A Group ID 2 ushort 10011 or 10012 N/A Byte count 2 ushort variable Bytes Time/Distance Fields 26 See Table 3 reserved 6 byte N/A N/A Variable message byte count 2 ushort [0, ) Bytes Base GPS raw data variable byte N/A N/A Pad 0-3 byte 0 N/A Checksum 2 ushort N/A N/A Group end 2 char $# N/A 49 4 Message Input and Output 4.1 Introduction The POS MV uses the Control Port to receive control messages from the POS Controller, (a user's custom software application or MV POSView), and to acknowledge successful receipt of the messages. The Control Port is bi-directional and uses the TCP/IP protocol to communicate with the control and display software. Each message sent to POS MV causes an action to be initiated. When POS MV receives and validates a message, it replies to the POS Controller by sending an `Acknowledge' message, Message ID 0, on the Control Port over which it received the message. The Acknowledge message protocol is defined below. The purpose of the Acknowledge message is to inform the POS Controller that the POS MV has received a message and has either accepted or rejected it. In addition, POS MV also outputs a message echo on each of the Display and Data ports to indicate the current system state, regardless of whether the action was successful or not. 4.2 Message Output Data Rates The POS MV periodically generates copies (echos) of received control message or internally generated messages at maximum frequencies described in Table 41. This output allows a POS Controller to monitor the current state of the configuration of the POS MV. The content of the output messages reflects the current state of thePOS MV. Thus, if the state of the system changes, as part of the normal operations, it is reflected in the next set of echo messages from the POS MV. 4.2.1 Message Numbering Convention All POS products use the following message numbering convention. POS MV outputs the message categories shown. Reserved message numbers are assigned to other products or previous versions of POS products. In particular, POS MV V3 core messages occupy the namespace range 1-19. 0 Core - Acknowledge message 1 - 19 Core - Reserved 20 - 49 Core - Installation parameter set-up messages 50 - 79 Core - Processing control messages 80 - 89 Core - Reserved 90 - 99 Core - Program control override messages 100 - 199 POS MV specific messages 200 - 19999 Reserved 50 20000 - 20099 Core - Diagnostic messages 20100 - 20199 POS MV specific diagnostic messages 20200 - 29999 Reserved The Acknowledge message is the message that POS MV sends as a reply to a message from the POS Controller. It is described in detail in Section 0 of this document. Installation parameter set-up messages comprise all messages that the user sends via the POS Controller to implement a particular installation of the POS MV. The POS Controller would not normally send these messages once the installation is completed. Messages 20-29 are signal processing parameter set-up messages. These specify sensor installation parameters and user accuracies. Messages 30-49 are hardware control messages. These specify communication control parameters and real-time message selections. Processing control messages comprise all messages that the user requires to control and monitor POS MV during a navigation session. These include navigation mode control, data acquisition control and possibly initialization of navigation quantities if no GPS signal is available. Program control override messages permits the user to directly control functions that POS MV normally performs automatically. The user would send a program control override message only under special circumstances. For example, the user may believe that the primary or secondary GPS receiver has lost its configuration and chooses to manually command the POS MV to re- configure the receiver. This message category also includes control messages that alter the normal operation or output of POS MV for diagnosis purposes. The actions induced by these messages are not part of the normal POS MV operation and should be interpreted only by qualified Applanix service personnel. Table 41: Control messages output data rates Display Port (Hz) Real-Time Data Port (Hz) Logging Data Port (Hz) Message Contents Stby Nav Stby Nav Stby Nav 0 Acknowledge - - - - - - Installation Parameter Set-up Messages 20 General installation parameters 1 1.0 1.0 0.1 0.1 0.1 0.1 21 GAMS installation parameters 1 1.0 1.0 0.1 0.1 0.1 0.1 22 Reserved 23 Reserved 24 User accuracy specifications 1 1.0 1.0 0.1 0.1 0.1 0.1 25 Reserved 30 Primary GPS set-up 1 1.0 1.0 0.1 0.1 0.1 0.1 51 Display Port (Hz) Real-Time Data Port (Hz) Logging Data Port (Hz) Message Contents Stby Nav Stby Nav Stby Nav 31 Secondary GPS set-up 1 1.0 1.0 0.1 0.1 0.1 0.1 32 Set POS IP address 1.0 1.0 0.1 0.1 0.1 0.1 33 Event discretes set-up 1 1.0 1.0 0.1 0.1 0.1 0.1 34 COM port set-up 1 1.0 1.0 0.1 0.1 0.1 0.1 35 See message 135 36 See message 136 37 Base GPS 1 Set-up 1 1.0 1.0 0.1 0.1 0.1 0.1 38 Base GPS 2 Set-up 1 1.0 1.0 0.1 0.1 0.1 0.1 40 Reserved - - - - - - 41 Reserved - - - - - - Processing Control Messages 50 Navigation mode control 1.0 1.0 1.0 0.1 0.1 0.1 51 Display Port control 1 1.0 1.0 1.0 0.1 0.1 0.1 52 Real-Time Data Port control 1 1.0 1.0 1.0 0.1 0.1 0.1 53 Reserved - - - - - - 54 Save/restore parameters command - - - - - - 55 Time synchronization control 1.0 1.0 1.0 0.1 0.1 0.1 56 General data 1.0 1.0 1.0 0.1 0.1 0.1 57 Installation calibration control - - - - - - 58 GAMS calibration control - - - - - - 60 Reserved - - - - - - 61 Logging Data Port control 1 1.0 1.0 1.0 0.1 0.1 0.1 Program Control Override Messages 90 Program control - - - - - - 91 GPS control - - - - - - 92 Reserved - - - - - - 93 Reserved - - - - - - POS MV Specific Messages 105 Analog port set-up 1 1.0 1.0 0.1 0.1 0.1 0.1 106 Heave filter set-up 1 1.0 1.0 0.1 0.1 0.1 0.1 111 Password control - - - - - - 52 Display Port (Hz) Real-Time Data Port (Hz) Logging Data Port (Hz) Message Contents Stby Nav Stby Nav Stby Nav 120 Sensor parameter set-up 1 1.0 1.0 0.1 0.1 0.1 0.1 121 Vessel Installation parameters 1 1.0 1.0 0.1 0.1 0.1 0.1 135 NMEA output set-up 1 1.0 1.0 0.1 0.1 0.1 0.1 136 Binary output set-up 1 1.0 1.0 0.1 0.1 0.1 0.1 POS MV Specific Diagnostic Control Messages 20102 Binary output diagnostics set-up 1.0 1.0 0.1 0.1 0.1 0.1 20103 Analog port diagnostics set-up 1.0 1.0 0.1 0.1 0.1 0.1 1 Message is saved in NVM 4.2.2 Compatibility with Previous POS Products The compatibility of POS MV V4 messages with POS MV V3 products is given as follows: # The POS MV V4 message format is the same as that of POS MV V3 products. # The POS MV V4 Message 0 is the same as that of POS MV V3 products. # The POS MV V4 message namespace occupies 20-98, which does not intersect the core message namespace for POS MV V3 products. Several POS MV V4 messages either are the same or command similar actions or functions as POS MV V3 core messages in the namespace 1-19. This separation of the message namespace allows for the unrestricted re-organization of the POS MV V4 messages and re-design of their content without creating compatibility problems. 4.3 Message Format 4.3.1 Introduction All control messages have the format described in Table 42. The messages consist of a header, message body and footer. The next section describes the specific message formats. Table 42: Message format Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort Message dependent N/A Byte count 2 ushort Message dependent N/A 53 Item Bytes Format Value Units Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A Message body Message dependent format and content. Pad 0 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A The header consists of the following components: # an ASCII string ($MSG) # unique message identifier # byte count # transaction number The byte count is a short unsigned integer that includes the number of bytes in all fields in the message except the Message start ASCII delimiter, the Message ID and the byte count. Therefore, the byte count is always 8 bytes less than the length of the complete message. The transaction number is a number that is attached to the input message by the client. POS MV returns this number to the user in the Acknowledge message (ID 0). This mechanism permits the client to know which message the POS MV is responding to; the number must be between 0 and 65532 when sent to POS. The transaction numbers 65533 to 65535 are used by POS when outputting the echo copy of the messages. The message body falls between the header and footer. While many messages have a message body, it is not a requirement of the protocol. Message without bodies may in themselves act as events, or messages may use the body to command a particular state. Messages end with a footer that contains a pad, a checksum and an ASCII delimiter ($#). The pad is used to make each message length a multiple of four bytes. The checksum is calculated so that short (16 bit) integer addition of sequential groups of two bytes results in a net sum of zero. Parameters flagged as default are the factory settings. The byte, short, ushort, long, ulong, float and double formats are defined in Appendix A: Data Format Description. The ranges of valid values for message fields that contain numbers are specified in the same way as for numerical group fields. 54 Message fields that contain numerical values may contain invalid numbers. Invalid byte, short, ushort, long, ulong, float and double values are defined in Table 82 (Appendix A: Data Format Description). POS MV ignores invalid values that it receives in fields containing numerical values. This does not apply to fields containing bit settings. 4.4 Messages Tables 4.4.1 General Messages The following tables list the format that POS MV expects for each message input and provides for each message output. Message 0: Acknowledge POS MV responds to a user control message with the Acknowledge message in three possible ways described below: 1. The control message from the POS Controller triggers a change of state within the POS MV. Some changes of state such as navigation mode transitions may require several seconds to complete. POS MV sends Message 0: Acknowledge indicating that the transition is in progress but not necessarily complete. For example, POS MV replies to a message commanding the POS MV to transition to Navigate mode as soon as the mode transition begins. 2. The control message from the POS Controller contains new POS MV installation or set-up parameters that replace the parameters currently used by the POS MV. The Acknowledge message then indicates whether the POS MV has received and begun to use the new parameters. POS MV responds with Message 0: Acknowledge only when it has begun to use the new parameters. 3. The control message from the POS Controller starts the transmission of one or more groups of data. The Acknowledge message indicates the successful completion of the requested action. The POS MV subsequently transmits the requested groups on the Display and/or Data ports. If the data for one or more of the requested groups are not current at the time of request, the P POS MV outputs the group(s) with stale fields set to invalid values as described in Table 82. Message 0: Acknowledge indicates if the data for a requested group is available (not yet implemented). The New Parameters Status field indicates if the message being acknowledged has changed the parameters. This allows a POS Controller to prompt the user to direct the POS MV to save the parameters to non-volatile memory if the user has not already done so before commanding a Standby mode transition or system shutdown. POS MV sets the Parameter Name to the name of a parameter that it has rejected or to a null string if it did not reject any parameters. 55 Table 43: Message 0: Acknowledge Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 0 N/A Byte count 2 ushort 44 N/A Transaction number 2 ushort Transaction number sent by client. N/A ID of received message 2 ushort Any valid message number. N/A Response code 2 ushort See Table 44 N/A New parameters status 1 byte Value Message 0 No change in parameters 1 Some parameters changed 2-255 Reserved N/A Parameter name 32 char Name of rejected parameter on parameter error only N/A Pad 1 bytes 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Table 44: Message response codes Field Value Field Name Description 0 Not applicable The message is not applicable to the POS MV. 1 Message accepted POS MV has properly accepted the message from the POS Controller. 2 Message accepted - too long POS MV has accepted the messaged from the POS Controller. This is a warning that the POS MV expected a shorter message than the one received. This could be caused if the POS MV and the POS Controller have different ICD versions. 56 Field Value Field Name Description 3 Message accepted - too short POS MV has accepted the messaged from the POS Controller. This is a warning that the POS MV expected a longer message than the one received. This could be caused if the POS MV and the POS Controller have different ICD versions. 4 Message parameter error The message contains one or more parameter errors. 5 Not applicable in current state POS MV cannot process the message or cannot output data requested in its current state. 6 Data not available The requested data is not available from POS MV. 7 Message start error The message does not have the proper header ``$MSG''. 8 Message end error The message does not have the proper footer ``$#''. 9 Byte count error The byte count of the message is too large for POS MV's internal buffer. 10 Checksum error The message checksum validation failed. 11 User not logged in Password protection feature is in effect, and user must enter password before sending the command. This should only occur if an incompatible Controller or Controller version is being used. 12 Password incorrect User was prompted for password and entered incorrect password. 13-65535 Reserved Reserved 4.4.2 Installation Parameter Set-up Messages Message 20: General Installation and Processing Parameters This message contains general installation parameters that POS MV requires to correctly process sensor data and output the computed navigation data. The POS MV accepts this message at any time. The parameters contained in this message become part of the processing parameters (referred to as ``settings'') that POS MV saves to NVM. The following are brief descriptions of the parameters that this message contains. 57 Time Tag Selection The Time Tag Type field selects the time tag types used for Time 1, Time 2 and Distance fields in the Time/Distance fields in each group (see Table 3). The user can select POS, GPS or UTC time for Time 1 and POS, GPS, UTC or User time for Time 2. Selection of GPS time directs POS MV to set the selected Time 1 or Time 2 field in all groups to the GPS seconds of the current week. The GPS week number can be obtained from Group 3: Primary GPS status. Selection of UTC time directs POS MV to set the selected Time 1 or Time 2 field in all groups to the UTC seconds of the current week. UTC seconds of the week will lag GPS seconds of the week by the accumulated leap seconds since the startup of GPS at which time the two times were synchronized. AutoStart Selection The Select/Deselect Autostart field directs POS MV to enable or disable the AutoStart function. When AutoStart is enabled POS MV enters Navigate mode immediately on power-up using the parameters stored in its NVM. When Autostart is disabled, POS MV enters Standby mode on power-up. The user must explicitly command a transition to Navigate mode. Lever Arms and Mounting Angles This message contains a series of fields that contain lever arm components and mounting angles. These define the positions and orientations of the IMU and aiding sensors (GPS antennas) with respect to user-defined reference and Vessel coordinate frames. These coordinate frames and the installation data contained in this message are defined for an IMU that is rigidly mounted to the Vessel. The Vessel frame is a right-handed coordinate frame that is fixed to the Vessel whose navigation solution the POS MV computes. The X-Y-Z axes are directed along the forward, right and down directions of the Vessel. These are the forward along beam, starboard and vertical directions. The reference frame is a user-defined coordinate frame that is co-aligned with the Vessel frame, but which may be at a location that allows easier measurement of lever arms. It is also the coordinate frame in which the relative positions and orientations of the IMU and aiding sensors are measured. Its origin does not necessarily coincide with the Vessel frame origin, however it is aligned with the Vessel frame. The IMU frame is a right-handed coordinate frame whose X-Y-Z axes coincide with the inertial sensor input axes. The IMU delivers inertial data resolved in the IMU frame to the PCS. The position and orientation of the IMU frame is fixed with respect to the Vessel frame when the user mounts the IMU. Practical considerations may limit the choices in IMU location, in which case the actual position and orientation of the IMU frame may differ from a desired position and orientation. 58 The interpretations of the lever arm and orientation fields are as follows: Reference to IMU lever arm components These are the X-Y-Z distances from the user-defined reference frame origin to the IMU inertial sensor assembly origin, resolved in the reference frame. Note: When MV POSView is used to send this message to the POS MV, the lever arm measurement entered in MV POSView should be to the target painted on the top of the IMU enclosure. MV POSView automatically adds the correct IMU enclosure to the IMU sensing centre offsets (including mounting angles) when constructing the message. The echo message output by POS MV on the Display and Data ports contain the lever arm to the sensing centre parameters. Prior to displaying the lever arm value, MV POSView applies the inverse offset to the Reference to IMU lever arm. If a user wishes to write a POS Controller application, the appropriate offsets can be supplied upon request. Reference to Primary GPS lever arm components These are the X-Y-Z distances measured from the user-defined reference frame origin to the phase centre of the primary GPS antenna, resolved in the reference frame. Reference to Auxiliary 1 GPS lever arm components These are the X-Y-Z distances measured from the user-defined reference frame origin to the phase centre of the auxiliary 1 GPS antenna, resolved in the reference frame. POS MV uses these lever arm components whenever it processes data from an optional auxiliary 1 GPS receiver. If POS MV does not receive the auxiliary 1 GPS data, then it does not use these parameters. Reference to Auxiliary 2 GPS lever arm components These are the X-Y-Z distances measured from the user-defined reference frame origin to the phase centre of the auxiliary 2 GPS antenna, resolved in the reference frame. POS MV uses these lever arm components whenever it processes data from an optional auxiliary 2 GPS receiver. If POS MV does not receive the auxiliary 2 GPS data, then it does not use these parameters. IMU with respect to Reference frame mounting angles These are the angular offsets ( # x , # y , # z ) of the IMU frame with respect to the reference frame when the IMU is rigidly mounted to the Vessel. The angles define the Euler sequence of rotations that bring the reference frame into alignment with the IMU frame. The angles follow the Tate-Bryant sequence of rotation, given as follows: right-hand screw rotation of #z about the z axis right-hand screw rotation of #y about the once rotated y axis right-hand screw rotation of # x about the twice rotated x axis 59 The angles # x , # y and # z may be thought of as the roll, pitch and yaw of the IMU body frame with respect to the user IMU frame. Reference Frame with respect to Vessel Frame mounting angles Although these X-Y-Z fields are part of Core message 20 they are not used in the POS MV product. POS MV assumes the reference frame and the Vessel frame are co-aligned. MV POSView does not provide data entry fields for these values. Multipath Setting The Multipath Environment field directs POS MV to set its processing parameters for one of three multipath levels impinging on primary, secondary and auxiliary GPS antennas. These are LOW, MEDIUM and HIGH multipath. This field allows the user to select the multipath environment which best describes the present multipath conditions. POS uses this information to scale the RMS errors on the position and velocity outputs reported to the user to ensure that the reported errors are reasonable. If the user selects LOW, POS MV assumes virtually no multipath error in the primary, secondary and auxiliary GPS data. If the user selects MEDIUM or HIGH, POS MV assumes, respectively, moderate or severe multipath errors and accounts for these in its GPS processing algorithms. Table 45: Message 20: General Installation and Processing Parameters Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 20 N/A Byte count 2 ushort 84 N/A Transaction Number 2 ushort Input: Transaction number Output: [65533, 65535] N/A Time types 1 byte Value (bits 0-3) Time type 1 0 POS time 1 GPS time (default) 2 UTC time 3-16 Reserved Value (bits 4-7) Time type 2 0 POS time (default) 1 GPS time 2 UTC time 3 User time 60 Item Bytes Format Value Units 4-16 Reserved Distance type 1 byte Value State 0 N/A 1 POS distance (default) 2 DMI distance 3-255 Reserved Select/deselect AutoStart 1 byte Value State 0 AutoStart disabled (default) 1 AutoStart enabled 2-255 Reserved Reference to IMU X lever arm 4 float ( , ) default = 0 meters Reference to IMU Y lever arm 4 float ( , ) default = 0 meters Reference to IMU Z lever arm 4 float ( , ) default = 0 meters Reference to Primary GPS X lever arm 4 float ( , ) default = 0 meters Reference to Primary GPS Y lever arm 4 float ( , ) default = 0 meters Reference to Primary GPS Z lever arm 4 float ( , ) default = 0 meters Reference to Auxiliary 1 GPS X lever arm 4 float ( , ) default = 0 meters Reference to Auxiliary 1 GPS Y lever arm 4 float ( , ) default = 0 meters Reference to Auxiliary 1 GPS Z lever arm 4 float ( , ) default = 0 meters Reference to Auxiliary 2 GPS X lever arm 4 float ( , ) default = 0 meters Reference to Auxiliary 2 GPS Y lever arm 4 float ( , ) default = 0 meters 61 Item Bytes Format Value Units Reference to Auxiliary 2 GPS Z lever arm 4 float ( , ) default = 0 meters X IMU wrt Reference frame mounting angle 4 float [-180, +180] default = 0 degrees Y IMU wrt Reference frame mounting angle 4 float [-180, +180] default = 0 degrees Z IMU wrt Reference frame mounting angle 4 float [-180, +180] default = 0 degrees X Reference frame wrt Vessel frame mounting angle 4 float [-180, +180] default = 0 degrees Y Reference frame wrt Vessel frame mounting angle 4 float [-180, +180] default = 0 degrees Z Reference frame wrt Vessel frame mounting angle 4 float [-180, +180] default = 0 degrees Multipath environment 1 byte Value Multipath 0 Low 1 Medium 2 High (default) 3-255 Reserved Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 21: GAMS Installation Parameters This message contains the GAMS installation parameters. POS MV accepts this message at any time. The parameters contained in this message become part of the processing parameters (referred to as ``settings'') that POS MV saves to NVM. 62 The following are brief descriptions of the parameters that this message contains. The Primary-Secondary Antenna Separation field contains the separation between the primary and secondary antenna centres as measured by the user. This value must have an accuracy of one centimetre or better in order for it to be useful to the algorithm. POS MV flags any value smaller than 10 centimetres as invalid. The default value is zero. The Baseline Vector X-Y-Z Component fields contain the components of the primary-secondary antenna baseline vector resolved in the IMU frame. The user is usually not able to measure these and hence may insert the components that the POS MV computed in a previous GAMS calibration. POS MV computes the vector length and flags any length smaller than 10 centimetres as invalid. It replaces a user-entered primary-secondary antenna separation with a valid length. The default is a zero vector. Only an experienced user should use this message, as a wrong value will disable the GAMS algorithm and a re-calibration will be necessary. The Maximum Heading Error RMS For Calibration field contains the maximum navigation solution heading error RMS that the POS MV uses for executing a GAMS baseline calibration. If the current heading error RMS exceeds the specified maximum when the user commands a GAMS calibration, then POS MV defers the calibration until the heading error RMS drops to below the specified maximum. The Heading Correction field contains a user-entered azimuth error in the primary-secondary antenna baseline vector. POS MV computes a new baseline vector that has been rotated so that the POS MV computed heading changes by the specified heading correction when GAMS is on- line. Note: POS MV echos this message with the updated Baseline Vector and the Heading Correction field cleared. The user should not enter another Heading Correction without also restoring the original calibrated Baseline Vector. Table 46: Message 21: GAMS installation parameters Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 21 N/A Byte count 2 ushort 32 N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A Primary-secondary antenna separation 4 float [0, ) default = 0 Meters Baseline vector X component 4 float ( , ) default = 0 Meters Baseline vector Y component 4 float ( , ) default = 0 meters 63 Item Bytes Format Value Units Baseline vector Z component 4 float ( , ) default = 0 meters Maximum heading error RMS for calibration 4 float [0, ) default = 3 degrees Heading correction 4 float ( , ) default = 0 degrees Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 22: Reserved Message 23: Reserved Message 24: User Accuracy Specifications This message sets the user accuracy specifications for full navigation status. POS MV declares Full Navigation status on the front panel LED's and through the POS Controller when the position, velocity, attitude and heading error RMS have all dropped to or below these accuracy specifications. POS MV accepts this message at anytime. The parameters contained in this message become part of the processing parameters (referred to as ``settings'') that POS MV saves to NVM. Table 47: Message 24: User accuracy specifications Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 24 N/A Byte count 2 ushort 24 N/A Transaction number 2 ushort Input: Transaction number Output: 65533 to 65535 N/A User attitude accuracy 4 float (0, ) default = 0.05 degrees User heading accuracy 4 float (0, ) default = 0.05 degrees User position accuracy 4 float (0, ) default = 2 meters User velocity accuracy 4 float (0, ) default = 0.5 meters/second 64 Item Bytes Format Value Units Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 25: Reserved Message 30: Primary GPS Setup This message contains the setup parameters for the primary GPS receiver. POS MV accepts this message at anytime. The parameters contained in this message become part of the processing parameters (referred to as ``settings'') that POS MV saves to NVM. The Select/Deselect GPS AutoConfig field directs POS MV to reconfigure the primary GPS receiver if the POS MV detects that the primary GPS configuration is incorrect. If the user chooses to disable auto-configuration, then the user must configure the primary GPS receiver manually. The Primary GPS COM1 Output Message Rate field specifies the rate at which the primary GPS receiver outputs its raw observables messages over its COM1 port to the POS MV. POS MV only process 1 Hz observables, however, selecting a higher output rate will allow more data to be logged which may be useful for a post processed solution. The Primary GPS COM2 Port Control directs the primary GPS receiver to accept RTCM differential corrections, RTCA Type 18/19 corrections, CMR corrections or commands over its COM2 port. This message assumes that the user can access the GPS receiver COM2 port directly and connect either a source of RTCM differential corrections or a PC-compatible computer running control software that is compatible with the primary GPS receiver. The POS MV V4 hardware connects the GPS 1 port on the PCS back panel directly to the Primary GPS COM2 port. The Primary GPS COM2 port must not be confused with the COM2 port on the PCS. POS MV V4 processes raw GPS observables and corrections so there is no need to feed corrections directly to the Primary GPS receiver. The GPS 1 port on the PCS read panel is primarily to allow GPS receiver firmware upgrades. Note: GPS Autoconfig will be turned off upon receipt of an Accept Command message and will be turned on again when either an Accept RTCM or a GPS reconfigure message is issued. The Primary GPS COM2 Communication Protocol fields are elaborated in Table 49. They specify the COM2 RS-232 communication protocol settings. 65 Table 48: Message 30: Primary GPS Setup Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 30 N/A Byte count 2 ushort 16 N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A Select/deselect GPS AutoConfig 1 byte Value State 0 AutoConfig disabled 1 AutoConfig enabled (default) 2-255 Reserved Primary GPS COM1 port message output rate 1 byte Value Rate (Hz) 1 1 (default) 2 2 3 3 4 4 5 5 10 10 11-255 Reserved Primary GPS COM2 port control 1 byte Value Operation 0 Accept RTCM (default) 1 Accept commands 2 Accept RTCA 3-255 Reserved Primary GPS COM2 communication protocol 4 See Table 49 Default: 9600 baud, no parity, 8 data bits, 1 stop bit, none 66 Item Bytes Format Value Units Antenna frequency 1 byte Value Operation 0 Accept L1 only 1 Accept L1/L2 2 Accept L2 only Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Table 49: RS-232/422 communication protocol settings Item Bytes Format Value RS-232/422 port baud rate 1 byte Value Rate 0 2400 1 4800 2 9600 3 19200 4 38400 5 57600 6 76800 7 115200 8-255 Reserved Parity 1 byte Value Parity 0 no parity 1 even parity 2 odd parity 3-255 Reserved 67 Item Bytes Format Value Data/Stop Bits 1 byte Value Data/Stop Bits 0 7 data, 1 stop 1 7 data, 2 stop 2 8 data, 1 stop 3 8 data, 2 stop 4-255 Reserved Flow Control 1 byte Value Flow Control 0 none 1 hardware 2 XON/XOFF 3-255 Reserved Message 31: Secondary GPS Setup This message contains the set-up parameters for the secondary GPS receiver. POS MV accepts this message at anytime. The parameters contained in this message become part of the processing parameters (referred to as ``settings'') that POS MV saves to NVM. The Select/Deselect GPS AutoConfig field directs POS MV to reconfigure the secondary GPS receiver if the POS MV detects that the secondary GPS configuration is incorrect. If the user chooses to disable auto-configuration, then the user must configure the secondary GPS receiver manually. The Secondary GPS COM1 Output Message Rate field specifies the rate at which the secondary GPS receiver outputs messages over its COM1 port to POS MV. The Secondary GPS COM2 Port Control directs the secondary GPS receiver to accept RTCM differential corrections, RTCA Type 18 corrections or commands over its COM2 port. This message assumes that the user can access the GPS receiver COM2 port directly and connect either a source of RTCM differential corrections or a PC-compatible computer running control software that is compatible with the secondary GPS receiver. The current POS MV hardware connects the GPS 2 port on the PCS back panel directly to the Secondary GPS COM2 port. The Secondary GPS COM2 port must not be confused with the COM2 port on the PCS. POS MV V4 processes raw GPS observables and corrections so there is no need to feed corrections directly to the Secondary GPS receiver. The GPS 1 port on the PCS read panel is primarily to allow GPS receiver firmware upgrades. The Secondary GPS COM2 Communication Protocol fields are elaborated in Table 49. They specify the COM2 RS-232 communication protocol settings. 68 Table 50: Message 31: Secondary GPS Setup Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 31 N/A Byte count 2 ushort 16 N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A Select/deselect GPS AutoConfig 1 byte Value State 0 AutoConfig disabled 1 AutoConfig enabled (default) 2-255 Reserved Secondary GPS COM1 port message output rate 1 byte Value Rate (Hz) 1 1 (default) 2 2 3 3 4 4 5 5 10 10 11-255 Reserved Secondary GPS COM2 port control 1 byte Value Operation 0 Accept RTCM (default) 1 Accept commands 2 Accept RTCA 3-255 Reserved Secondary GPS COM2 communication protocol 4 See Table 49 Default: 9600 baud, no parity, 8 data bits, 1 stop bit, none 69 Item Bytes Format Value Units Antenna frequency 1 byte Value Operation 0 Accept L1 only 1 Accept L1/L2 2 Accept L2 only Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 32: Set POS IP Address This message installs a new IP address and subnet mask in POS MV. POS MV accepts this message at anytime. The parameters contained in this message become part of the processing parameters (referred to as ``settings''), POS MV does not save it to NVM but changes OS setup file. When POS MV is installed the new IP address, it will disconnect from any connected controller and begin using the new IP address. The changes take effect immediately upon receipt of the message. Table 51: Message 32: Set POS IP Address Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 32 N/A Byte count 2 ushort 16 N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A IP address Network part 1 1 byte [128, 191] Class B, subnet mask 255.255.0.0 [192, 232] Class C, subnet mask 255.255.255.0 default = 129 N/A 70 Item Bytes Format Value Units IP address Network part 2 1 byte [0, 255] default = 100 N/A IP address Host part 1 1 byte [0, 255] default = 0 N/A IP address Host part 2 1 byte [1, 253] default = 219 N/A Subnet mask Network part 1 1 byte [255] default = 255 Subnet mask Network part 2 1 byte [255] default = 255 Subnet mask Host part 1 1 byte [0, 255] default = 255 * see conditions below Subnet mask Host part 2 1 byte [0, 254] default = 0 * see conditions below Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A * Not only must the host parts of the subnet mask be within the ranges specified, but if the 2 host fields are considered as one 16 bit word, then any bit that is set may not have a cleared bit to its left. This results in the following valid subnet masks: 255.255.0.0 255.255.128.0 255.255.192.0 255.255.224.0 255.255.240.0 255.255.248.0 255.255.252.0 255.255.254.0 255.255.255.0 255.255.255.128 255.255.255.192 255.255.255.224 255.255.255.224 255.255.255.240 255.255.255.248 255.255.255.252 255.255.255.254 71 Message 33: Event Discrete Setup This message directs POS MV to set the senses of the signals for the Event 1 and 2 discrete triggers. The user can select either positive or negative edge trigger for each event. POS MV accepts this message at anytime. The parameters contained in this message become part of the processing parameters (referred to as ``settings'') that POS MV saves to NVM. Table 52: Message 33: Event Discrete Setup Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 33 N/A Byte count 2 ushort 8 N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A Event 1 trigger 1 byte Value Command 0 Positive edge (default) 1 Negative edge 2-255 Reserved Event 2 trigger 1 byte Value Command 0 Positive edge (default) 1 Negative edge 2-255 Reserved Pad 0 short 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 34: COM Port Setup This message sets up the communication protocol and selects the input and output content for all available COM ports. It is a variable length message to accommodate POS hardware with varying numbers of COM ports. When this message is sent to POS it may contain parameters for 1 to 10 COM ports. Any COM port can be assigned. If an assigned COM port is not present it will be ignored. Any COM port or ports can be specified as long as they are listed in ascending order and the Port Mask field has bits set corresponding to each COM port entry. All input selections and the Base GPS output 72 selections must be uniquely assigned to a COM port. NMEA and Real-time Binary outputs may be assigned to any number of COM ports. When this message is output from POS it always contains parameters for all n COM ports available for that particular system, with the current protocol and input/output selections. Table 53: Message 34: COM Port Setup Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 34 N/A Byte count 2 ushort 12 + 8 x nPorts N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A Number of COM ports 2 ushort [1,10] Number (nPorts) of COM ports assigned by this message. N/A COM Port Parameters variable See Table 54 One set of parameters for each of nPorts COM port. Port mask 2 ushort Input: Bit positions indicate which port parameters are in message (port parameters must appear in order of increasing port number). Bit 0 ignored Bit n set COMn parameter in message Bit n clear COMn parameter not in message Output: Bit positions indicate which port numbers are available on the PCS for I/O configuration. Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A 73 Table 54: COM port parameters Item Bytes Format Value Units Communication protocol 4 See Table 49 Default: 9600 baud, no parity, 8 data bits, 1 stop bit, none Input select 2 ushort Value Input 0 No input 1 Auxiliary 1 GPS 2 Auxiliary 2 GPS 3 Reserved 4 Base GPS 1 5 Base GPS 2 6-255 No input Output select 2 ushort Value Output 0 No output 1 NMEA messages 2 Real-time binary 3 Base GPS 1 4 Base GPS 2 5-255 No output Message 35: See Message 135 Message 36: See Message 136 Message 37: Base GPS 1 Setup This message selects the message types assigned to the Base GPS 1 port identified in Message 34. If POS MV is connected to a Hayes compatible telephone modem, then this message directs POS MV's configuration of the modem. 74 Message 38: Base GPS 2 Setup This message selects the message types assigned to the Base GPS 2 port identified in Message 34. If POS MV is connected to a Hayes compatible telephone modem, then this message directs POS MV's configuration of the modem. The connection control field will always be set to NO_ACTION when sent by POS MV except when the message sent by the client had modem control set to AUTOMATIC and the connection control set to CONNECT. The reason for this is to prevent manual or command actions from getting saved in NVM and being inadvertently activated when POS MV is started. The AUTOMATIC-CONNECT combination is the only one that a user may want to save to NVM. Table 55: Message 37/38: Base GPS 1/2 Setup Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 37/38 N/A Byte count 2 ushort 240 N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A Select Base GPS input type 2 ushort Value Operation 0 Do not accept base GPS messages 1 Accept RTCM 1/9 (default) 2 Accept RTCM 3, 18/19 3 Accept CMR/CMR+ 4 Accept RTCA 5-65535 Reserved Line control 1 byte Value Operation 0 Line used for Serial (default) 1 Line used for Modem 2-255 Reserved 75 Item Bytes Format Value Units Modem control 1 byte Value Operation 0 Automatic control (default) 1 Manual control 2 Command control 3-255 Reserved Connection control 1 byte Value Operation 0 No action (default) 1 Connect 2 Disconnect/Hang-up 3 Send AT Command 4-255 No action Phone number 32 char N/A N/A Number of redials 1 byte [0, ) default = 0 N/A Modem command string 64 char N/A N/A Modem initialization string 128 char N/A N/A Data timeout length 2 ushort [0, 255] default = 0 seconds Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 40: Reserved Message 41: Reserved 4.4.3 Processing Control Messages Message 50: Navigation Mode Control This message directs POS MV to transition to a specified navigation mode. The two basic navigation modes are Standby and Navigate. 76 Table 56: Message 50: Navigation mode control Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 50 N/A Byte count 2 ushort 8 N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A Navigation mode 1 byte Value Mode 0 No operation (default) 1 Standby 2 Navigate 3-255 Reserved Pad 1 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 51: Display Port Control This message directs POS MV to output specified groups on the Display Port primarily for the purpose of display of data on the POS Controller. The Number of Groups field contains the number n of groups that this message selects. Thereafter follow n Display Port Output Group Identification fields, each of which identifies one selected group to be output on the Display Port. The POS MV always outputs Groups 1, 2, 3, 10 and 110 on the Display Port to provide a minimal set of data for the POS Controller. These cannot be de-selected by omission from this message. POS MV accepts this message at anytime. The parameters contained in this message become part of the processing parameters (referred to as ``settings'') that POS MV saves to NVM. When MV POSView is connected to a POS MV Control port, it immediately sends message 51 requesting the groups it requires to populate all its currently open windows. Whenever the user opens a new display window, MV POSView automatically sends message 51 requesting the additional group(s) that are required. Hence there is no user setup window for the Display port in MV POSView. 77 Table 57: Message 51: Display Port Control Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 51 N/A Byte count 2 ushort 10 + 2 x number of groups (+2 if pad bytes are required) N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A Number of groups selected for Display Port 2 ushort [4, 70] default = 4 (Groups 1,2,3,10 are always output on Display Port) N/A Display Port output group identification variable ushort Group ID to output [1, 65534] N/A Reserved 2 ushort 0 N/A Pad 0 or 2 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 52: Real-Time Data Port Control This message directs POS MV to output specified groups on the Real-Time Data Port at a specified rate. The Number of Groups field contains the number n of groups that this message selects. Thereafter follow n Data Port Output Group Identification fields, each of which identifies one selected group to be output on the Data Port. The Data Port Output Rate field selects the output rates of all specified groups from one of several available discrete output rates. POS MV outputs a selected group at the lesser of the user- specified rate or the internal update rate; this depends on the selected group. If the user selects a group to be output at maximum available rate when the internal update rate of the group data is 1 78 Hz, then POS MV outputs the selected group at 1 Hz. An exception is Group 4: Time-tagged IMU, which the POS MV outputs at the IMU data rate regardless of the user-specified data rate. POS MV accepts this message at anytime. The parameters contained in this message become part of the processing parameters (referred to as ``settings'') that POS MV saves to NVM. Table 58: Message 52/61: Real-Time/Logging Data Port Control Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 52 or 61 N/A Byte count 2 ushort 10 + 2 x number of groups (+2 if pad bytes are required) N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A Number of groups selected for Data Port 2 ushort [0, 70] default = 0 N/A Data Port output group identification variable ushort Group ID to output [1, 65534] N/A Data Port output rate 2 ushort Value Rate (Hz) 1 1 (default) 2 2 10 10 20 20 25 25 50 50 100 100 200 200 other values Reserved Pad 0 or 2 byte 0 N/A 79 Item Bytes Format Value Units Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 53: Reserved Message 54: Save/Restore Parameters Control This message directs POS MV to save the current configuration to non-volatile memory (NVM) or to retrieve the currently saved parameters from NVM. POS MV accepts this message at anytime. If the Control field is set to any value other than 1-3, this message has no effect. If the Control field is set to 1, POS MV saves the current parameters to NVM, thereby overwriting the previously saved parameters. If the Control field is set to 2, POS MV retrieves the currently saved parameters into the active parameters for the current navigation session. If the Control field is set to 3, POS MV resets the active parameters to the factory default settings. The previously active parameters are overwritten. Table 59: Message 54: Save/restore parameters control Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 54 N/A Byte count 2 ushort 8 N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A Control 1 byte Value Operation 0 No operation 1 Save parameters in NVM 2 Restore user settings from NVM 3 Restore factory default settings 4-255 No operation Pad 1 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A 80 Message 55: User Time Recovery This message specifies the time of the last PPS in user time to POS MV. It directs POS MV to synchronize its User Time with the time specified in the User PPS Time field. POS MV accepts this message at anytime at a maximum rate of once per second. To establish user time synchronization, the user must send the user time of last PPS to POS MV with this message after the PPS has occurred. The resolution of time synchronization is one microsecond. Table 60: Message 55: User time recovery Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 55 N/A Byte count 2 ushort 24 N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A User PPS time 8 double [0, ) default = 0.0 seconds User time conversion factor 8 double [0, ) default = 1.0 #/seconds Pad 2 short 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 56: General Data This message provides POS MV with an initial time, position, distance and attitude fix when either the primary GPS receiver is unable to provide this information within a maximum initialization time. The data in this message allows a stationary POS MV to complete the coarse leveling algorithm and begin operating in Navigate mode. POS MV can also be commanded to start (or continue) in an alignment status beyond coarse leveling should the accuracy of prescribed initial conditions warrant. The initial horizontal position CEP describes the circular error probability of the initial position. The initial altitude standard deviation describes the uncertainty in the initial altitude. These can be used to re-align POS MV at a last known position following an integration failure when GPS is unavailable. POS MV accepts this message at any time. It will only use the data in this message if GPS data remains unavailable for longer than 120 seconds after receipt of this message. It will supersede 81 this general data with GPS position data as soon as the GPS data becomes available. POS MV does not save this message to NVM, hence the user must provide this message during every POS MV start-up where the general data are required. Table 61: Message 56: General data Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 56 N/A Byte count 2 ushort 80 N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A Time of day: Hours 1 byte [0, 23] default = 0 hours Time of day: Minutes 1 byte [0, 59] default = 0 minutes Time of day: Seconds 1 byte [0, 59] default = 0 seconds Date: Month 1 byte [1, 12] default = 1 month Date: Day 1 byte [1, 31] default = 1 day Date: Year 2 ushort [0, 65534] default = 0 year Initial alignment status 1 byte See Table 5 N/A Initial latitude 8 double [-90, +90] default = 0 degrees Initial longitude 8 double [-180, +180] default = 0 degrees Initial altitude 8 double [-1000, +10000] default = 0 meters Initial horizontal position CEP 4 float [0, ) default = 0 meters Initial altitude RMS uncertainty 4 float [0, ) default = 0 meters Initial distance 8 double [0, ) default = 0 meters Initial roll 8 double [-180, +180] default = 0 degrees Initial pitch 8 double [-180, +180] default = 0 degrees Initial heading 8 double [0, 360) default = 0 degrees Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A 82 Item Bytes Format Value Units Message end 2 char $# N/A Message 57: Installation Calibration Control This message controls the POS MV function of self-calibration of primary installation parameters. POS MV accepts this message at any time. The primary installation parameters exclude the GAMS installation parameters, which are handled by a separate calibration function and controlled separately by Message 58: GAMS Calibration Control. The calibration is done assuming that the IMU Frame is the Reference Frame. If it is desirable to have the IMU and Reference Frames non-coincident, then the user must apply additional offsets consistently to all sensor frames to define a non-coincident Reference Frame. The calibration action byte specifies a calibration action. The calibration select byte identifies installation parameter sets on which the calibration action is applied. POS MV executes the specified calibration action as soon as it receives this message. The following are calibration actions available to the user: # start an auto-calibration or a manual calibration of selected installation parameters # stop an ongoing calibration # perform normal transfer of selected calibrated parameters following manual calibration # perform forced transfer of selected calibrated parameters following manual calibration The user selects one or more installation parameter sets for calibration by setting the bits in the calibration select byte corresponding to the parameter sets to be calibrated to 1. The user starts a calibration of the selected installation parameters by setting the calibration action byte to 2 for a manual calibration or 3 for an auto-calibration. POS MV restarts the Navigate mode with the calibration option set. It then computes corrected versions of the selected installation parameters and reports these with corresponding calibration figures of merit (FOM) in Group 14: Calibrated installation parameters. A calibration of a selected set of installation parameters is completed when the corresponding FOM reaches 100. The user stops all calibrations by setting the calibration action byte to 1. POS MV restarts the Navigate mode without the calibration option and abandons any previous calibration actions. In an auto-calibration, POS MV replaces the existing set of installation parameters and issues a corresponding Message 20: General Installation and Processing Parameters or Message 22: Aiding Sensor Installation Parameters when the calibration is completed. POS MV resets its Kalman filter and restarts the normal Navigate mode with the updated installation parameters when all selected calibrations are completed. 83 In a manual calibration, POS MV continues the calibration and displays the final values in Group 14: Calibrated installation parameters until it receives a user command to stop the calibration or transfer the calibrated parameters. In a normal transfer of calibrated parameters, POS MV replaces the existing set of installation parameters selected by the calibration select byte with the corrected parameters displayed in Group 14: Calibrated installation parameters and having a FOM of 100. POS MV resets its Kalman filter and restarts the normal Navigate mode with the possibly updated installation parameters. In a forced transfer of calibrated parameters, POS MV replaces the existing set of installation parameters selected by the calibration select byte with the corrected parameters displayed in Group 14: Calibrated installation parameters and having a FOM greater than 0. POS MV resets its Kalman filter and restarts the normal Navigate mode with the updated installation parameters. Table 62: Message 57: Installation calibration control Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 57 N/A Byte count 2 ushort 8 N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A Calibration action 1 byte Value Command 0 No action (default) 1 Stop all calibrations 2 Manual calibration 3 Auto-calibration 4 Normal calibrated parameter transfer 5 Forced calibrated parameter transfer 6-255 No action Calibration select 1 byte Bit (set) Command 0 Calibrate primary GPS lever arm 1 Calibrate auxiliary 1 GPS lever arm 2 Calibrate auxiliary 2 GPS lever arm 3 - 7 reserved 84 Item Bytes Format Value Units Pad 0 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 58: GAMS Calibration Control This message controls the operation of the GAMS calibration function. POS MV accepts this message at any time. The GAMS Calibration Control field directs POS MV to do the following: # stop a current nalibration in progress # begin a new calibration or resume a suspended calibration # suspend a current calibration in progress or # force a calibration to start without regard to the current navigation solution attitude accuracy POS MV returns Message 21: GAMS Installation Parameters containing the new GAMS installation parameters when the calibration is completed. Table 63: Message 58: GAMS Calibration Control Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 58 N/A Byte count 2 ushort 8 N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A GAMS calibration control 1 byte Value Command 0 Stop calibration (default) 1 Begin or resume calibration 2 Suspend calibration 3 Force calibration 4-255 No action Pad 1 byte 0 N/A 85 Item Bytes Format Value Units Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 60: Reserved Message 61: Logging Data Port Control This message directs the POS MV to output specified groups on the Logging Data Port at a specified rate. The format and content of the message is the same as that of Message 52 and is given by Table 58. POS MV accepts this message at anytime. The parameters contained in this message become part of the processing parameters (referred to as ``settings'') that POS MV saves to NVM. 4.4.4 Program Control Override Messages Message 90: Program Control This message controls the operational status of POS MV. POS MV accepts this message at any time. POS MV interprets the values in the message as follows. 000 The connected POS Controller is alive and the TCP/IP connection is good. 001 Terminate the TCP/IP connection. This allows the POS Controller to disconnect as controller and re-connect later. 100 Reset the GAMS algorithm to clear any pending problems. 101 Reset POS to clear pending problems. All parameters will be loaded from NVM after a reset. 102 Shutdown POS in preparation for power-off. This function allows POS to synchronize its files before the user disconnects the power. The user should ensure that POS settings are saved before beginning the shutdown procedure. POS MV continuously monitors the TCP/IP connection between itself and the POS Controller. POS MV expects to receive at least one message from the POS Controller every 30 seconds or it will automatically terminate the TCP/IP connection. The purpose of this function is for the POS MV to determine if the POS Controller has failed, in which case it can reset the TCP/IP port. This message can be used with a value of 0 as a no operation (NOP) message when no other messages need to be sent to POS MV. 86 Table 64: Message 90: Program Control Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 90 N/A Byte count 2 ushort 8 N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A Control 2 ushort Value Command 000 Controller alive 001 Terminate TCP/IP connection 100 Reset GAMS 101 Reset POS 102 Shutdown POS all other values are reserved Pad 0 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 91: GPS Control This message directs POS MV to configure or reset its internal GPS receivers. POS MV accepts this message at any time. The Control Command field when set to Send GPS configuration (0) directs POS MV to reconfigure the GPS receivers. POS MV then sends the configuration script messages to the receivers in the same way as it does during initialization following power-up. The user would use this command if he suspected that an internal GPS receiver had not initialized correctly or had lost its configuration. The Control Command field when set to Send reset command (1) directs POS MV to send ``cold reset'' commands to the GPS receivers. This directs an internal GPS receiver to revert to the factory default configurations. The user would use this command to establish a starting point for troubleshooting problems with a GPS receiver. 87 Table 65: Message 91: GPS control Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 91 N/A Byte count 2 ushort 8 N/A Transaction number 2 ushort Input: Transaction number Output: [65533, 65535] N/A Control command 1 byte Value Command 0 Send primary GPS configuration 1 Send primary GPS reset command 2 Send secondary GPS configuration 3 Send secondary GPS reset command 4-255 No action Pad 1 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 92: Reserved Message 93: Reserved 4.4.5 POS MV Specific Messages Message 105: Analog Port Set-up This message allows the user to configure the analog port to communicate with other equipment. For the analog port, the user is able to configure the output message format, the scale factor and the parameter sense required. Table 66: Message 105: Analog Port Set-up Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 105 N/A 88 Item Bytes Format Value Units Byte count 2 ushort 24 N/A Transaction # 2 ushort Input: Transaction number set by client Output: [65533, 65535] N/A Roll Scale Factor 4 float # = (0, ) (default = 1.0) N/A Pitch Scale Factor 4 float # = (0, ) (default = 1.0) N/A Heave Scale Factor 4 float # = (0, ) (default = 1.0) N/A Roll Sense 1 byte Value Analog +ve 0 port up (default) 1 starboard up N/A Pitch Sense 1 byte Value Analog +ve 0 bow up (default) 1 stern up N/A Heave Sense 1 byte Value Analog +ve 0 up (default) 1 down N/A Analog Formula Select 1 byte Value Formula 0 (Tate-Bryant Trig) roll = ##10sin# pitch = ##10sin# heave = ##heave 1 (Tate-Bryant Linear) roll = ### pitch = ### heave = ##heave 2 (default) (TSS Trig) roll = ##10(sin#cos#) pitch = ##10sin# heave = ##heave 3 (TSS Linear) roll = ##sin -1 (sin#cos#) pitch = ### volts 89 Item Bytes Format Value Units heave = ##heave 4 (RPH) roll = ### pitch = ### heading = ### Analog Output 1 byte Value Condition 0 analog off 1 analog on (default) N/A Frame of Reference 1 byte Value Condition 0 sensor 1 (default) 1 sensor 2 N/A Pad 0 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 106: Heave Filter Set-up This message allows the user to set the cut-off frequency and damping ratio of the heave filter. Also, the message is accepted at anytime and may be saved. Table 67: Message 106: Heave Filter Set-up Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 106 N/A Byte count 2 ushort 16 N/A Transaction # 2 ushort Input: Transaction number set by client Output: [65533, 65535] N/A Heave Corner Period 4 float (10.0, ) (default = 200.0) seconds Heave Damping Ratio 4 float (0, 1.0) (default = 0.707) N/A Pad 2 byte 0 N/A 90 Item Bytes Format Value Units Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 111: Password Protection Control This command ``Logs in'' the user, or changes the password used for user login. The message is accepted anytime, but is redundant if ``Login'' (Password Control) is sent when ``user logged in'' condition exists (see Table 29: Group 110: MV General Status & FDIR). This is the case when the user has logged in within the last 10 minutes, and has not disconnected or terminated the connection to the PCS, since the login. The message is not saved to NVM, when sent (and accepted) with Password Control equal to ``Change Password''. The new password is, however, immediately saved in the operating system's configuration file. The message is not echoed nor output to any of Display or Data Ports. Table 68: Message 111: Password Protection Control Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 111 N/A Byte count 2 ushort 48 N/A Transaction # 2 ushort Input: Transaction number set by client Output: [65533, 65535] N/A Password Control 1 byte Value Command 0 Login 1 Change Password N/A Password 20 char String value of current Password, terminated by ``null'' if less than 20 characters, or 20 (non-null) characters. Default: pcsPasswd N/A 91 Item Bytes Format Value Units New Password 20 char If Password Control = 0: N/A If Password Control = 1: String value of new (user-selected) Password, terminated by ``null'' if less than 20 characters, or 20 (non-null) characters. N/A Pad 1 byte 0 N/A -- doc error; said one short, but pad normally in bytes and one byte here for message size to be a multiple of 4 Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 120: Sensor Parameter Set-up This message contains data that is sent to POS to define the installation parameters of sensors 1 and 2 and the heave lever arm. The interpretation of the items in this message is as follows: Sensor(s) wrt Reference frame mounting angle: Physical angular offsets of the sensor(s) body frame with respect to the user defined reference frame. The reference frame is defined as the right-handed orthogonal co-ordinate system with its origin defined at any point the user wishes. The axes are fixed to the reference frame, with the x axis in the forward going direction, the y axis perpendicular to the x axis and pointing to the right (starboard side), and the z axis pointing down. The sensor(s) body frame is defined as the right-handed orthogonal co-ordinate system with its origin at the sensing centre of the sensor. These axes are fixed to the sensor. The angles define the Euler sequence of rotations that bring the reference frame into alignment with the sensor body frame. The angles follow the Tate-Bryant sequence of rotation given as follows: right-hand screw rotation of # z about the z axis followed by a rotation of # y about the once rotated y axis followed by a rotation of # x about the twice rotated x axis. The angles # x , # y , and # z may be thought of as the roll, pitch, and yaw of the sensor body frame with respect to the reference frame. Reference to Sensor(s) Lever arms: Distances measured from the reference frame origin to the sensing centre of the sensors resolved in the reference frame. Since the reference frame is always aligned to the vessel frame (by design), then from the reference frame origin, x is positive towards the bow, y is positive towards the starboard side of the vessel, and z is positive down (Right-Hand Rule). 92 Reference to Centre of Rotation Lever arms: This set of lever arms allows the user to enter the lever arms between the reference frame origin and the point on the vessel that experiences vertical motion due only to heave, without roll and/or pitch induced vertical motion. The lever arms are defined as the distances measured from the reference frame origin to the centre of rotation (CoR) resolved in the reference frame. Since the reference frame is always aligned to the vessel frame (by design), then from the reference frame origin, x is positive towards the bow, y is positive towards the starboard side of the vessel, and z is positive down (Right-Hand Rule). Vertical acceleration data from the IMU is transformed to the centre of vessel rotation (specified by the lever arms), double integrated and passed through the high-pass heave filter and then transformed back to the sensor positions. If this parameter is not entered, heave is calculated at the IMU location and then transformed to the sensor positions. Table 69: Message 120: Sensor Parameter Set-up Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 120 N/A Byte count 2 ushort 68 N/A Transaction # 2 ushort Input: Transaction number set by client Output: [65533, 65535] N/A X Sensor 1 4 float [-180, +180] default = 0 deg wrt reference frame mounting angle Y Sensor 1 4 float [-180, +180] default = 0 deg wrt reference frame mounting angle Z Sensor 1 4 float [-180, +180] default = 0 deg wrt reference frame mounting angle X Sensor 2 4 float [-180, +180] default = 0 deg wrt reference frame mounting angle Y Sensor 2 4 float [-180, +180] default = 0 deg wrt reference frame mounting angle 93 Item Bytes Format Value Units Z Sensor 2 4 float [-180, +180] default = 0 deg wrt reference frame mounting angle Reference to Sensor 1 X lever arm 4 float ( , ) default = 0 m Reference to Sensor 1 Y lever arm 4 float ( , ) default = 0 m Reference to Sensor 1 Z lever arm 4 float ( , ) default = 0 m Reference to Sensor 2 X lever arm 4 float ( , ) default = 0 m Reference to Sensor 2 Y lever arm 4 float ( , ) default = 0 m Reference to Sensor 2 Z lever arm 4 float ( , ) default = 0 m Reference to CoR X lever arm 4 float ( , ) default = 0 m Reference to CoR Y lever arm 4 float ( , ) default = 0 m Reference to CoR Z lever arm 4 float ( , ) default = 0 m Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A wrt = with respect to 94 Message 121: Vessel Installation Parameter Set-up This message contains data that is sent to POS to define the installation parameters of the vessel. The interpretation of the items in this message is as follows: Reference to Vessel Lever Arms: This set of lever arms allows the user to define a different point at which the position and velocity data is valid for the vessel than the point to which all lever arms are measured. Thus, it is possible to have position valid at the vessel bridge, but measure all sensor lever arms to some conveniently accessible reference point. The lever arm distances are measured from the user defined reference frame origin to vessel position of interest resolved in the reference frame. Table 70: Message 121: Vessel Installation Parameter Set-up Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 121 N/A Byte count 2 ushort 20 N/A Transaction # 2 ushort Input: Transaction number set by client Output: [65533, 65535] N/A Reference to Vessel X lever arm 4 float ( , ) default = 0 m Reference to Vessel Y lever arm 4 float ( , ) default = 0 m Reference to Vessel Z lever arm 4 float ( , ) default = 0 m Pad 2 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A 95 Message 135: NMEA Output Set-up This message allows the user to configure Nmea output on one or more COM ports. The COM ports on which the Nmea output appears is controlled by message 34. Note that this is a MV specific version of the Core message 35. The ZDA, UTC and PPS output strings are fixed at 1 Hz (if selected) and synchronized to the GPS PPS. They may be combined with other outputs at higher rates. Table 71: Message 135: NMEA Output Set-up Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 135 N/A Byte count 2 ushort For even #ports (16 + #ports x 10) For odd #ports (18 + #ports x 10) N/A Transaction # 2 ushort Input: Transaction number set by client Output: [65533, 65535] N/A Reserved 9 byte N/A N/A Number of Ports 1 byte [0, 10] N/A NMEA Port Definitions variable See Table 72: NMEA Port Definition #ports x 10 Pad 0 or 2 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Pad size is 0 bytes if number of ports is even, size is 2 bytes if number of ports is odd. Table 72: NMEA Port Definition Port Number 1 byte [1, 10] N/A Nmea Formula Select 4 ulong Bit (set) Format Formula 0 $xxGST NMEA (pseudorange measurement noise stats) 1 (default)$xxGGA NMEA (Global Position System Fix) 2 $xxHDT NMEA (heading) N/A 96 3 $xxZDA NMEA (date & time) 4,5 reserved 6 $xxVTG NMEA (track and speed) 7 $PASHR NMEA (attitude (Tate- Bryant)) 8 $PASHR NMEA (attitude (TSS)) 9 $PRDID NMEA (attitude (Tate- Bryant) 10 $PRDID NMEA (attitude (TSS) 11 $xxGGK NMEA (Global Position System Fix) 12 $UTC UTC date and time 13 reserved 14 $xxPPS UTC time of PPS pulse xx - is substituted by the Talker ID Nmea output rate 1 ubyte Value Rate (Hz) 0 N/A 1 1 (default) 2 2 5 5 10 10 20 20 25 25 50 50 Hz Talker ID 1 byte Value ID 0 IN (default) 1 GP N/A Roll Sense 1 byte Value Digital +ve 0 port up (default) 1 starboard up N/A Pitch Sense 1 byte Value Digital +ve 0 bow up (default) 1 stern up N/A Heave Sense 1 byte Value Digital +ve 0 up (default) 1 down N/A 97 Message 136: Binary Output Set-up This message allows the user to configure the real-time binary output on one or more COM ports. The COM ports on which the binary output appears is controlled by message 34. Note that this is a MV specific version of the Core message 36. Table 73: Message 136: Binary Output Set-up Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 136 N/A Byte count 2 ushort For even #ports (16 + #ports x 10) For odd #ports (14 + #ports x 10) N/A Transaction # 2 ushort Input: Transaction number set by client Output: [65533, 65535] N/A Reserved 7 byte N/A N/A Number of Ports 1 byte [0, 10] N/A Binary Port Definitions variable See Table 74: Binary Port Definition #ports x 10 Pad 0 or 2 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Pad size is 2 bytes if number of ports is even, size is 0 bytes if number of ports is odd. Table 74: Binary Port Definition Port Number 1 byte [1, 10] N/A Formula Select 4 ushort Value Format Formula 0 - 2 reserved 3 Simrad1000 header (Tate-Bryant) roll = # pitch = # heave = heave heading = # 4 Simrad1000 header N/A 98 (TSS) roll = sin-1(sin#cos#) pitch = # heave = heave heading = # 5 Simrad3000 header (Tate-Bryant) roll = # pitch = # heave = heave heading = # 6 Simrad3000 header (TSS) roll = sin-1(sin#cos#) pitch = # heave = heave heading = # 7 TSS (Format 1) header (default) horizontal acceleration vertical acceleration heave = heave status roll = sin-1(sin#cos#) pitch = # <CR><LF> 8 TSM 5265 header (Tate-Bryant) time tag roll = # pitch = # heave = heave heading = # vel (long, trans, down) 9 TSM 5265 time tag (TSS) roll = sin-1(sin#cos#) pitch = # heave = heave heading = # vel (long, trans, down) 10 Atlas header (TSS) roll = sin-1(sin#cos#) 99 pitch = # heave = heave status footer 11 - 15 reserved 16 PPS header GPS seconds of week week number UTC offset PPS count checksum 17 TM1B header checksum byte count week number GPS seconds of week clock offset clock offset std. dev. UTC offset clock model status Message Update Rate 2 ushort Value Rate (Hz) 0 N/A 1 1 2 2 5 5 10 10 20 20 25 25 (default) 50 50 100 100 200 200 Hz Roll Sense 1 byte Value Digital +ve 0 port up (default) 1 starboard up N/A Pitch Sense 1 byte Value Digital +ve 0 bow up (default) 1 stern up N/A 100 Heave Sense 1 byte Value Digital +ve 0 up (default) 1 down N/A Sensor Frame Output 1 byte Value Frame of Reference 0 sensor 1 frame (default) 1 sensor 2 frame N/A 4.4.6 POS MV Specific Diagnostic Control Messages Message 20102: Binary Output Diagnostics This message is used to set selected output values for the real-time binary output port. This is used to allow POS to generate user selectable constant outputs to test the communications interface between POS and the sensor. Note that this message must be sent again to disable the fixed output. Table 75: Message 20102: Binary Output Diagnostics Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 20102 N/A Byte count 2 ushort 24 N/A Transaction # 2 ushort Input: Transaction number set by client Output: [65533, 65535] N/A Operator roll input 4 float (-180, 180] default = 0 deg Operator pitch input 4 float (-180, 180] default = 0 deg Operator heading input 4 float [0, 360) default = 0 deg Operator heave input 4 float [-100 to 100] default = 0 m 101 Item Bytes Format Value Units Output Enable 1 byte Value Command 0 Disabled (default) Output navigation solution data 1 Enabled Output operator specified fixed values Pad 1 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A Message 20103: Analog Port Diagnostics This message is used to set the output values for the analog port. This is used to allow POS to generate user selectable constant sensor attitude inputs to test the communications interface between POS and the sensor. Note that this message must be sent again to disable the fixed output. Table 76: Message 20103: Analog Port Diagnostics Item Bytes Format Value Units Message start 4 char $MSG N/A Message ID 2 ushort 20103 N/A Byte count 2 ushort 20 N/A Transaction # 2 ushort Input: Transaction number set by client Output: [65533, 65535] N/A Operator roll input 4 float (-180, 180] default = 0 deg Operator pitch input 4 float (-180, 180] default = 0 deg Operator heave input 4 float [-100, 100] default = 0 m 102 Item Bytes Format Value Units Output Enable 1 byte Value Command 0 Disabled (default) Output navigation solution data 1 Enabled Output operator specified fixed values Pad 1 byte 0 N/A Checksum 2 ushort N/A N/A Message end 2 char $# N/A 103 5 Appendix A: Data Format Description 5.1 Data Format The data format for byte, short, long, float and double as used in POS are defined as follows: Byte or Character Table 77: Byte Format MSBit LSBit 7 6 5 4 3 2 1 0 Short Integer The short integer format of the POS data is the INTEL style byte order as follows: Table 78: Short Integer Format MSB LSB 15 8 7 0 Byte #: 1 0 Long Integer The long integer format of the POS data is the INTEL style byte order as follows: Table 79: Long Integer Format MSB LSB 31 24 23 16 15 8 7 0 Byte #: 3 2 1 0 Float and Double The floating point format of the POS data is the INTEL byte order from the IEEE-754 floating point representation standard as follows: Table 80: Single-Precision Real Format Single-Precision Data format 31 30 23 22 0 s e f 104 Single-Precision Data format Field Size in Bits Sign (s) 1 Biased Exponents (e) 8 Fraction (f) 23 Total 32 Interpretation of Sign Positive Fraction s=0 Negative Fraction s=1 Normalised Numbers Bias of Biased Exponent +127 ($7F) Range of Biased Exponent [0, 255] ($FF) Range of Fraction zero or nonzero Fraction 1.f (where f=bit 22 -1 +bit 21 -2 ...+bit 0 -23 ) Relation to Representation of Real Numbers (-1) s x2 e-127 x1.f Approximate Ranges Maximum Positive Normalised 3.4x10 38 Minimum Positive Normalised 1.2x10 -38 Table 81: Double-Precision Real Format Double-Precision Data format 63 62 52 51 0 s e f Field Size in Bits Sign (s) 1 Biased Exponents (e) 11 Fraction (f) 52 Total 64 105 Double-Precision Data format Interpretation of Sign Positive Fraction s=0 Negative Fraction s=1 Normalised Numbers Bias of Biased Exponent +1023 ($3FF) Range of Biased Exponent [0, 2047] ($7FF) Range of Fraction zero or nonzero Fraction 1.f (where f=bit 51 -1 +bit 50 -2 ...+bit 0 -52 ) Relation to Representation of Real Numbers (-1) s x2 e-1023 x1.f Approximate Ranges Maximum Positive Normalized 1.8x10 308 Minimum Positive Normalized 2.2x10 -308 5.2 Invalid Data Values Since there are several fields in each group or message, it is possible that one or more numerical fields will be invalid when the group or message is output. The following numerical values should be interpreted as invalid if they are output in any group or message. This does not apply to single or multiple byte fields that are comprised of bit sub-fields. The hexadecimal value describes the contents of the bytes that represent the invalid decimal value for the type. The invalid values for all integer types are the maximum positive values that the integer types can take. The invalid value for the floating-point types is any value in the range of NaN (Not a Number) or INF (Infinity) defined by IEEE-754. The value NaN is by definition any float or double having a mantissa set to any nonzero value and an exponent whose bits are all set to 1. POS MV assigns an invalid float or double in any group by setting all bits representing the float or double set to 1. POS MV rejects any message that contains any of the invalid integer values in Table 82 or any value in the range of NaN or INF. 106 Table 82: Invalid data values Data Type Hexadecimal Value Decimal Value Byte FF 255 (=2 8 -- 1) Short 7F FF 32767 (=2 15 -- 1) Unsigned short (ushort) FF FF 65535 (=2 16 -- 1) Long 7F FF FF FF 2147483647 (=2 31 -- 1) Unsigned long (ulong) FF FF FF FF 4294967295 (=2 32 -- 1) Float FF FF FF FF NaN Double FF FF FF FF FF FF FF FF NaN 107 6 Appendix B: Glossary of Acronyms AGC automatic gain control AutoConfig auto configure Aux auxiliary C/A course acquisition char character COM(1) communications port 1 COM(2) communications port 2 COM(3) communications port 3 D down D/A Digital-to-Analog dB decibels DCM direction cosine matrix deg degrees deg/s degrees/second DGPS differential global positioning system DMI distance measurement indicator double double precision floating point DSP digital signal processor E East FDIR Fault Detection, Isolation and Reconfiguration float floating-point precision GAMS GPS Azimuth Measurement Subsystem GPS Global Positioning System H/W hardware HDOP Horizontal Dilution of Precision Hz Hertz I/O input and output ICD interface control document IMU Inertial Measurement Unit IP Internet Protocol KF Kalman filter lat latitude long longitude LSB least significant bit m metres m/s metres/second m/s 2 metres/second/second ms millisecond MSB most significant bit N North N/A not applicable NOP No Operation NVM non-volatile Memory 108 PCS POS Computer System POS Position and Orientation System POSPAC Applanix POSPAC post-processing software package PPS Pulse per Second PRN Pseudo Random Noise RAM random access memory RF radio frequency RMS root-mean-square RTK real-time kinematic RX receive data S/D Strapdown SCSI Small Computer Systems Interface sec second SV space vehicle (GPS satellites) TCP Transmission Control Protocol UDP User Datagram Protocol ulong unsigned long ushort unsigned short UTC Universal Coordinated Time VDOP Vertical Dilution of Precision wrt with respect to """
[ "eyou102@gmail.com" ]
eyou102@gmail.com
41b574b6038eae6b1fa688c2a54d753cb1bedaf5
c921aa17fa1bcc2e2c828dac463bd96c5a579d16
/hadoop_fab.py
6fbc67a3915dc4bf7c3a3fb24fa11ccf5a52e70a
[]
no_license
adarshsaraf123/automate_hadoop_install
e8484dc47bc5a7508982c41a8818c6f6c2ac59de
2d03fc5200fa0a09e6a8344381a044a8c507c9d7
refs/heads/master
2021-01-23T07:25:56.472341
2017-02-01T10:25:44
2017-02-01T10:25:44
80,501,821
0
1
null
2017-01-31T08:33:25
2017-01-31T08:05:18
Python
UTF-8
Python
false
false
5,488
py
# Writen by Adarsh Saraf # II M.Tech, SSSIHL, Jan 2017 from global_conf import * hadoop_path = '~/Documents/trials/hadoop' hadoop_datadir_path = '~/Documents/trials/hadoop_datadir' #--------------------------------------------------------------------------------------------------------------- #--------------------------------------OPERATIONS ON ALL THE HADOOP NODES--------------------------------------- #--------------------------------------------------------------------------------------------------------------- @roles('all') def export_hadoop_env_variables(): ''' To append the hadoop environment variables to the .bashrc file in all the nodes in the cluster ''' hadoop_env = ["# -- HADOOP ENVIRONMENT VARIABLES START -- #", "export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_65", "export HADOOP_HOME={}".format(hadoop_path), #"export YCSB_HOME=/home/hduser/Documents/ycsb", "export PATH=$PATH:$HADOOP_HOME/bin", "export PATH=$PATH:$HADOOP_HOME/sbin", #"export PATH=$PATH:$YCSB_HOME/bin", "export HADOOP_MAPRED_HOME=$HADOOP_HOME", "export HADOOP_COMMON_HOME=$HADOOP_HOME", "export HADOOP_HDFS_HOME=$HADOOP_HOME", "export YARN_HOME=$HADOOP_HOME", "# -- HADOOP ENVIRONMENT VARIABLES END -- #", ] append('~/.bashrc', hadoop_env) @roles('all') def reset_hadoop_datadir(): ''' To reset the Hadoop data directory in preparation for a fresh namenode format ''' # now we need to create the hadoop data dirs if exists(hadoop_datadir_path): if 'reset_hadoop' not in env: prompt('are you sure you want to reset the existing hadoop data directory? (y/n)', key='reset_hadoop', default='y') if env.reset_hadoop == 'y': run('rm -R {}'.format(hadoop_datadir_path)) run('mkdir -p {}'.format(hadoop_datadir_path)) #--------------------------------------------------------------------------------------------------------------- #---------------------------------------OPERATIONS ON THE MASTER NODE------------------------------------------- #--------------------------------------------------------------------------------------------------------------- @hosts(master) def setup_hadoop_master(): ''' To setup the master node for Hadoop ''' # prepare the masters file locally fmaster = open('masters', 'w') fmaster.write(master) fmaster.close() # prepare the slaves file locally fslaves = open('slaves', 'w') fslaves.write(master + '\n') for s in slaves: fslaves.write(s + '\n') fslaves.close() # now put the masters and slaves file to the master put('masters', hadoop_path + '/etc/hadoop') put('slaves', hadoop_path + '/etc/hadoop') # enable password-less login for the master on all the slaves for s in slaves: run('ssh-copy-id -i ~/.ssh/id_rsa.pub {}@{}'.format(env.user, s)) # export the environment variables necessary for running the hadoop in the bashrc file export_hadoop_env_variables() @hosts(master) def namenode_format(): ''' To format the namenode ''' run('hdfs namenode -format') #--------------------------------------------------------------------------------------------------------------- #---------------------------------------OPERATIONS ON THE SLAVE NODES------------------------------------------- #--------------------------------------------------------------------------------------------------------------- @roles('slaves') def sync_hadoop(): ''' To sync the hadoop folder, with its configurations, at the master with the slaves ''' run("rsync -avxP --exclude 'logs' {user}@{mn}:{hp}/ {hp}".format(user=env.user,mn=master, hp=hadoop_path)) @roles('slaves') def setup_hadoop_slaves(): ''' To setup the slave ndoes for Hadoop ''' # enable password-less login from the slaves to the master run('ssh-copy-id -i ~/.ssh/id_rsa.pub {}@{}'.format(env.user, master)) # create the hadoop directory if not exists(hadoop_path): run('mkdir -p {}'.format(hadoop_path)) # sync the hadoop directory from the master sync_hadoop() # export the environment variables necessary for running the hadoop in the bashrc file export_hadoop_env_variables() #--------------------------------------------------------------------------------------------------------------- #-------------------------------ADMINISTRATION TASKS FOR THE HADOOP CLUSTER------------------------------------- #--------------------------------------------------------------------------------------------------------------- def reset_namenode(): ''' To reset the namenode, and thereby reset the HDFS data ''' execute(reset_hadoop_datadir) execute(namenode_format) def install_hadoop(): ''' To install the hadoop cluster on the nodes as specified in global_conf ''' execute(setup_hadoop_master) execute(setup_hadoop_slaves) reset_namenode() @hosts(master) def start_hadoop(): ''' To start the hadoop cluster ''' run('start-dfs.sh') run('start-yarn.sh') #run('start-hbase.sh') @hosts(master) def stop_hadoop(): ''' To stop the hadoop cluster ''' #run('stop-hbase.sh') run('stop-yarn.sh') run('stop-dfs.sh')
[ "adarshsaraf123@gmail.com" ]
adarshsaraf123@gmail.com
c098b60d23b959e928a07a300d8702f5d75ab320
983051cb9d4c0f1c799c7725191e119652cae59e
/agents/actor.py
9edd6b3494efd9db8a07fb20b9c1cd5aa361b5a1
[]
no_license
kurazu/RL-Quadcopter-2
f0141c10891b1c822c1c530d879d2949c3bc348a
cf08b9793762f29e89d04b2ce5f7035fbe5caf70
refs/heads/master
2020-03-14T15:42:53.448899
2018-05-04T22:47:19
2018-05-04T22:47:19
131,682,412
0
0
null
2018-05-01T06:12:25
2018-05-01T06:12:25
null
UTF-8
Python
false
false
2,518
py
from keras import layers, models, optimizers, backend as K from agents.neural import dense class Actor: """Actor (Policy) Model.""" def __init__( self, state_size, action_size, action_low, action_high, learning_rate=None ): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action action_low (array): Min value of each action dimension action_high (array): Max value of each action dimension learning_rate (float): Optimizer learning rate """ self.state_size = state_size self.action_size = action_size self.action_low = action_low self.action_high = action_high self.action_range = self.action_high - self.action_low self.learning_rate = learning_rate self.build_model() def build_model(self): """Build an actor (policy) network that maps states -> actions.""" # Define input layer (states) states = layers.Input(shape=(self.state_size,), name='states') # Add hidden layers # Simplified neural net compared to the original DDPG paper. net = dense(states, 64) # Add final output layer with sigmoid activation raw_actions = layers.Dense( units=self.action_size, activation='sigmoid', name='raw_actions' )(net) # Scale [0, 1] output for each action dimension to proper range actions = layers.Lambda( lambda x: (x * self.action_range) + self.action_low, name='actions' )(raw_actions) # Create Keras model self.model = models.Model(inputs=states, outputs=actions) print('Actor model') self.model.summary() # Define loss function using action value (Q value) gradients action_gradients = layers.Input(shape=(self.action_size,)) loss = K.mean(-action_gradients * actions) # Incorporate any additional losses here (e.g. from regularizers) # Define optimizer and training function optimizer = optimizers.Adam(lr=self.learning_rate) updates_op = optimizer.get_updates( params=self.model.trainable_weights, loss=loss ) self.train_fn = K.function( inputs=[self.model.input, action_gradients, K.learning_phase()], outputs=[], updates=updates_op )
[ "kurazu@kurazu.net" ]
kurazu@kurazu.net
d02aa40ba34b8b88f1028e0945a21fc65e086d34
1e0bbcb79baae47218945282d104b9f441be08ef
/movienight/gui/videoplayer.py
1d4df81265bf03369be4121343256412e39fb55d
[]
no_license
Unmoon/movienight
cb3a4d9a5fa8e72fd6882d0ff083545013332e14
23348eea821944e9be55ecd721307fa0005e603e
refs/heads/master
2021-07-01T19:30:12.761806
2021-01-05T16:39:49
2021-01-05T16:39:49
203,797,536
0
0
null
null
null
null
UTF-8
Python
false
false
11,070
py
import logging import os import platform import threading import vlc from PyQt5 import QtCore from PyQt5 import QtGui from PyQt5 import QtWidgets from ..config import config from ..synchandler import SyncHandler log = logging.getLogger("movienight") TITLE = "Movie Night" class VideoPlayer(QtWidgets.QMainWindow): """A simple Media Player using VLC and Qt.""" def __init__(self, master=None): QtWidgets.QMainWindow.__init__(self, master) self.setWindowTitle(TITLE) self.setGeometry(0, 0, 1280, 720) # Create a basic vlc instance self.instance = vlc.Instance() self.media = None self.lock = threading.Lock() # Create an empty vlc media player self.media_player = self.instance.media_player_new() self.media_player.video_set_mouse_input(False) self.media_player.video_set_key_input(False) self.video_frame = None self.widget = None self.palette = None self.h_button_box = None self.play_button = None self.volume_slider = None self.subtitle_tracks_label = None self.subtitle_tracks = None self.audio_tracks_label = None self.audio_tracks = None self.audio_delay = None self.audio_delay_label = None self.v_box_layout = None self.timer = None self.create_ui() self.delay = 0 self.sync_handler = SyncHandler(play_callback=self.play, pause_callback=self.pause, lock=self.lock) def mouseDoubleClickEvent(self, event): if event.button() == QtCore.Qt.LeftButton: if self.windowState() == QtCore.Qt.WindowFullScreen: self.setWindowState(QtCore.Qt.WindowNoState) self.volume_slider.show() self.audio_delay.show() self.play_button.show() self.audio_tracks_label.show() self.audio_tracks.show() self.audio_tracks.setDisabled(False) self.subtitle_tracks_label.show() self.subtitle_tracks.show() self.subtitle_tracks.setDisabled(False) self.audio_delay_label.show() self.audio_delay.show() self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor)) else: self.setWindowState(QtCore.Qt.WindowFullScreen) self.volume_slider.hide() self.audio_delay.hide() self.play_button.hide() self.audio_tracks_label.hide() self.audio_tracks.hide() self.audio_tracks.setDisabled(True) self.subtitle_tracks_label.hide() self.subtitle_tracks.hide() self.subtitle_tracks.setDisabled(True) self.audio_delay_label.hide() self.audio_delay.hide() self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor)) def keyPressEvent(self, event): if event.key() == QtCore.Qt.Key_Space: log.debug("is_playing: %s", self.media_player.is_playing()) with self.lock: if self.media_player.is_playing() == 1: self.pause() else: self.play() def closeEvent(self, event): self.media_player.set_media(None) def create_ui(self): """Set up the user interface, signals & slots.""" self.widget = QtWidgets.QWidget(self) self.setCentralWidget(self.widget) # In this widget, the video will be drawn if platform.system() == "Darwin": # for MacOS self.video_frame = QtWidgets.QMacCocoaViewContainer(0) else: self.video_frame = QtWidgets.QFrame() self.palette = self.video_frame.palette() self.palette.setColor(QtGui.QPalette.Window, QtGui.QColor(0, 0, 0)) self.video_frame.setPalette(self.palette) self.video_frame.setAutoFillBackground(True) self.volume_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self) self.volume_slider.setMaximum(100) self.volume_slider.setValue(self.media_player.audio_get_volume()) self.volume_slider.setToolTip("Volume") self.volume_slider.valueChanged.connect(self.set_volume) self.play_button = QtWidgets.QPushButton("Play") self.play_button.clicked.connect(lambda: self.pause() if self.media_player.is_playing() == 1 else self.play()) self.subtitle_tracks_label = QtWidgets.QLabel("Subtitle Track:", self) self.subtitle_tracks = QtWidgets.QComboBox(self) self.subtitle_tracks.setMinimumWidth(200) self.subtitle_tracks.activated[str].connect(self.set_subtitle_track) self.audio_tracks_label = QtWidgets.QLabel("Audio Track:", self) self.audio_tracks = QtWidgets.QComboBox(self) self.audio_tracks.setMinimumWidth(200) self.audio_tracks.activated[str].connect(self.set_audio_track) self.audio_delay_label = QtWidgets.QLabel("Audio Delay:", self) self.audio_delay = QtWidgets.QLineEdit() self.audio_delay.setValidator(QtGui.QDoubleValidator(-5.0, 5.0, 2)) self.audio_delay.setMaxLength(4) self.audio_delay.setMaximumWidth(50) self.audio_delay.setAlignment(QtCore.Qt.AlignRight) self.audio_delay.setText(str(self.media_player.audio_get_delay())) self.audio_delay.editingFinished.connect( lambda: self.set_audio_delay(float(self.audio_delay.text().replace(",", "."))) ) self.h_button_box = QtWidgets.QHBoxLayout() self.h_button_box.addWidget(self.play_button) self.h_button_box.addWidget(self.audio_tracks_label) self.h_button_box.addWidget(self.audio_tracks) self.h_button_box.addWidget(self.subtitle_tracks_label) self.h_button_box.addWidget(self.subtitle_tracks) self.h_button_box.addWidget(self.audio_delay_label) self.h_button_box.addWidget(self.audio_delay) self.h_button_box.addStretch(1) self.h_button_box.addWidget(self.volume_slider) self.v_box_layout = QtWidgets.QVBoxLayout() self.v_box_layout.addWidget(self.video_frame) self.v_box_layout.addLayout(self.h_button_box) self.v_box_layout.setContentsMargins(0, 0, 0, 0) self.widget.setLayout(self.v_box_layout) def play(self, time=None): if self.media_player.is_playing() == 1: return self.media_player.play() self.play_button.setText("Pause") if time is None: self.send_sync(True) else: self.sync(time) def pause(self, time=None): if self.media_player.is_playing() == 0: return if time is None: self.send_sync(False) else: self.sync(time) self.media_player.pause() self.play_button.setText("Play") def set_audio_delay(self, delay): """Set delay in seconds for audio.""" self.delay = int(delay * 1000000) if self.media_player.is_playing() == 1: log.debug(self.media_player.audio_set_delay(self.delay)) def set_subtitle_track(self, subtitle_track): for key, value in self.media_player.video_get_spu_description(): if str(value, "utf-8") == subtitle_track: self.media_player.video_set_spu(key) log.debug("Setting subtitle track to %s (%i)", value, key) return def set_audio_track(self, audio_track): for key, value in self.media_player.audio_get_track_description(): if str(value, "utf-8") == audio_track: self.media_player.audio_set_track(key) log.debug("Setting audio track to %s (%i)", value, key) return def open_file(self, filename): """Open a media file in a MediaPlayer.""" file_path = os.path.join(config.get("download_directory"), filename) # getOpenFileName returns a tuple, so use only the actual file name self.media = self.instance.media_new(file_path) # Put the media in the media player self.media_player.set_media(self.media) # Parse the metadata of the file self.media.parse() # Set the title of the track as window title self.setWindowTitle(TITLE + " - " + self.media.get_meta(0)) # The media player has to be 'connected' to the QFrame (otherwise the # video would be displayed in it's own window). This is platform # specific, so we must give the ID of the QFrame (or similar object) to # vlc. Different platforms have different functions for this if platform.system() == "Linux": # for Linux using the X Server self.media_player.set_xwindow(int(self.video_frame.winId())) elif platform.system() == "Windows": # for Windows self.media_player.set_hwnd(int(self.video_frame.winId())) elif platform.system() == "Darwin": # for MacOS self.media_player.set_nsobject(int(self.video_frame.winId())) def set_volume(self, volume): """Set the volume.""" self.media_player.audio_set_volume(volume) def send_sync(self, playing): time = max(self.media_player.get_time(), 0) if playing: log.debug("Playing at %i", time) self.sync_handler.play(time) else: log.debug("Pausing at %i", time) self.sync_handler.stop(time) log.debug("Synced server to %i", time) def sync(self, time): log.debug("Synced client to %i", time) self.media_player.set_time(time) def load_subtitle_tracks(self): if self.subtitle_tracks.count() < self.media_player.video_get_spu_count(): subtitle_tracks = list() current_subtitle_track = self.media_player.video_get_spu() for key, value in self.media_player.video_get_spu_description(): if key == current_subtitle_track: current_subtitle_track = str(value, "utf-8") subtitle_tracks.append(str(value, "utf-8")) self.subtitle_tracks.insertItems(0, subtitle_tracks) self.subtitle_tracks.setCurrentIndex( self.subtitle_tracks.findText(current_subtitle_track, QtCore.Qt.MatchFixedString) ) def load_audio_tracks(self): if self.audio_tracks.count() < self.media_player.audio_get_track_count(): audio_tracks = list() current_audio_track = self.media_player.audio_get_track() for key, value in self.media_player.audio_get_track_description(): if key == current_audio_track: current_audio_track = str(value, "utf-8") audio_tracks.append(str(value, "utf-8")) self.audio_tracks.insertItems(0, audio_tracks) self.audio_tracks.setCurrentIndex( self.audio_tracks.findText(current_audio_track, QtCore.Qt.MatchFixedString) )
[ "joona@unmoon.com" ]
joona@unmoon.com
4a4e52af780f0d7b6e3bf669cc3b946e0f289c46
dd27ad86f0b4b2db52d286f339276f05db0e5b44
/algorithm/0107Binary_Tree_Level_Order_Traversal_II.py
1cdd59cde4d57f8410940bedea4cdc1c520300d4
[]
no_license
xkoma001/leetcode
0719397954dbed5db4f767bd941ffffeab3e3584
d71e725d779d7b45402893b311939c2cce60fbca
refs/heads/master
2020-03-19T04:08:02.749563
2018-06-04T06:43:20
2018-06-04T06:43:20
135,797,739
0
0
null
null
null
null
UTF-8
Python
false
false
608
py
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def levelOrderBottom(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ if not root: return [] ans, stack = [], [root] while stack: cur_rel = [node.val for node in stack] stack = [kid for pair in stack for kid in (pair.left, pair.right) if kid] ans.insert(0, cur_rel) return ans
[ "xkoma001@126.com" ]
xkoma001@126.com
87653fd44ba408c19431edb73bbc522075232363
02c53e7e3be9599efad4cb351e5cbdd31912db10
/work/kings.py
3600425f4aa7cbb31efbb0a2c7009c69f3a30529
[]
no_license
nearxu/super-spider
7d3c9dc0375b114312b0df223087493f3065d99e
10551dea1d829461f39e9f8b9e61cdcbaeea2d0c
refs/heads/master
2020-05-20T13:51:10.309224
2019-06-08T13:37:02
2019-06-08T13:37:02
185,609,337
0
0
null
null
null
null
UTF-8
Python
false
false
768
py
import requests from bs4 import BeautifulSoup import csv headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36' } def open_url(): url = 'https://qq.yh31.com/zjbq/' try: response = requests.get(url,headers=headers) if response.status_code == 200: return response.text else : return None except Exception as e: print(e) return None def parse_html(html): print(html,'html') soup = BeautifulSoup(html,features='html.parser') title_pages = soup.find_all(id="qh_con1") return title_pages if __name__ == "__main__": html = open_url() content = parse_html(html) print(content)
[ "2448895924@qq.com" ]
2448895924@qq.com
3a0b1205172916536815cd2e0be3b95a90e8dd4d
0e6a67f1794c3a599c88647f5cb293fc5b49f6a0
/ofm_client/v2/query_builder/query/interfaces/i_query.py
52dceda13c3d050418d9f63986aaeea0c0850f24
[ "Apache-2.0" ]
permissive
factset/ofm-python-sdk
d02d0ed66cab73426020e9609aed9bfb8a979901
3345fea40fa287e899dbab01b1a839a0eeab468c
refs/heads/master
2022-07-04T03:59:33.698571
2020-05-15T07:57:14
2020-05-15T07:57:14
244,479,810
1
1
Apache-2.0
2020-05-15T07:57:15
2020-03-02T21:31:59
Python
UTF-8
Python
false
false
1,225
py
from __future__ import absolute_import import abc from typing import List from ofm_client.v2.query_builder.filters.filter_term import FilterTerm from ofm_client.v2.query_builder.search.search_term import SearchTerm from ofm_client.v2.query_builder.sort.sort_term import SortTerm class IQuery(abc.ABC): @property def searchTerms(self)->List[SearchTerm]: pass @searchTerms.setter def searchTerms(self, searchTerms: List[SearchTerm]): pass @property def filterTerms(self)->List[FilterTerm]: pass @filterTerms.setter def filterTerms(self, filterTerms: List[FilterTerm]): pass @property def sortTerms(self)->List[SortTerm]: pass @sortTerms.setter def sortTerms(self, sortTerms: List[SortTerm]): pass @property def limit(self)->int: pass @limit.setter def limit(self, limit: int)->int: pass @property def page(self)->int: pass @page.setter def page(self, page: int)->int: pass @property def fields(self)->List[str]: pass @fields.setter def fields(self, fields: List[str])->List[str]: pass
[ "alexander.barker@factset.com" ]
alexander.barker@factset.com
7e219a351898aa9df2412ba76a4f3ad488ef012a
925008308759bd81e16ad2a3e3303460f93c8bc6
/status.py
174e38a5ba32600ad821e1faaf648ba74540e838
[]
permissive
mitodl/release-script
88105e5cf44fa798d34b447fb7d459be526ba790
385b68b9962dca6563e2a2a83a4a97b6f1369772
refs/heads/master
2023-08-18T00:10:58.545772
2023-08-14T19:04:50
2023-08-14T19:07:07
51,475,352
15
7
BSD-3-Clause
2023-08-14T19:07:09
2016-02-10T21:55:18
Python
UTF-8
Python
false
false
4,157
py
"""Get release status of a repository""" from constants import ( BLOCKER_LABELS, DEPLOYED_TO_PROD, LIBRARY_TYPE, LIBRARY_PR_WAITING_FOR_MERGE, RELEASE_LABELS, STATUS_EMOJIS, WAITING_FOR_CHECKBOXES, ) from github import get_labels from lib import ( get_default_branch, init_working_dir, ) from release import any_commits_between_branches from version import get_project_version async def status_for_repo_last_pr(*, github_access_token, repo_info, release_pr): """ Calculate release status for the most recent PR The return value will be one of: ALL_CHECKBOXES_CHECKED - All checkboxes are checked off and the release is ready to merge DEPLOYED_TO_PROD - The release has been successfully deployed to production DEPLOYING_TO_PROD - The release is in the process of being deployed to production DEPLOYING_TO_RC - The pull request is in the middle of deploying to RC FREEZE_RELEASE - The release is frozen, so it should be ignored until that github label is removed LIBRARY_WAITING_FOR_RELEASE - There is a release PR for a library, waiting on the release manager to merge WAITING_FOR_CHECKBOXES - The bot is polling regularly to check if all checkboxes are checked off Or None if there is no previous release, or something unexpected happened. Args: github_access_token (str): The github access token repo_info (RepoInfo): Repository info release_pr (ReleasePR): The info for the release PR Returns: str or None: A status string """ if release_pr: if repo_info.project_type == LIBRARY_TYPE: if release_pr.open: return LIBRARY_PR_WAITING_FOR_MERGE else: labels = { label.lower() for label in await get_labels( github_access_token=github_access_token, repo_url=repo_info.repo_url, pr_number=release_pr.number, ) } for label in BLOCKER_LABELS: if label.lower() in labels: return label.lower() if release_pr.open else None if not release_pr.open and WAITING_FOR_CHECKBOXES.lower() in labels: # If a PR is closed and the label is 'waiting for checkboxes', just ignore it # Maybe a user closed the PR, or the label was incorrectly updated return None for label in RELEASE_LABELS: if label.lower() in labels: return label.lower() return None async def status_for_repo_new_commits(*, github_access_token, repo_info, release_pr): """ Check if there are new commits to be part of a release Args: github_access_token (str): The github access token repo_info (RepoInfo): Repository info release_pr (ReleasePR): The info for the release PR Returns: bool: Whether or not there are new commits """ async with init_working_dir(github_access_token, repo_info.repo_url) as working_dir: last_version = await get_project_version( repo_info=repo_info, working_dir=working_dir ) default_branch = await get_default_branch(working_dir) return await any_commits_between_branches( branch1="origin/release-candidate" if release_pr and release_pr.open else f"v{last_version}", branch2=default_branch, root=working_dir, ) def format_status_for_repo(*, current_status, has_new_commits): """ Adds formatting to render a status Args: current_status (str): The status of the most recent PR for the repo has_new_commits (bool): Whether there are new commits to release """ new_status_string = "*new commits*" if has_new_commits else "" current_status_string = ( current_status if current_status and current_status != DEPLOYED_TO_PROD else "" ) emoji = STATUS_EMOJIS.get(current_status, "") return f"{current_status_string}{emoji} {new_status_string}".strip()
[ "noreply@github.com" ]
mitodl.noreply@github.com
da01c87e271a423a775f2341ff133fb00379c654
c8b00fd8bc8bf9a9b6e44657a854431d8029fc9a
/sixus/C.py
29f0d5c78f4fca6a6505aca8a47cc762fd2b7d88
[]
no_license
dionysio/math-python
0a0d4da1223d642f6fa7f4ff93586e0734886f9b
84d5049657d66365bafa48cf802a986711ecb076
refs/heads/master
2021-01-10T19:15:53.243587
2015-03-23T20:33:53
2015-03-23T20:33:53
31,867,130
0
0
null
null
null
null
UTF-8
Python
false
false
900
py
import matplotlib.pyplot as plt import numpy as np def logistic(r,x): return 4*r * x* (1 - x) '''discard - basically how many of values to use from the end iterations - how many iterations of logistic func low_x, high_x - limit the x axis (values of r) low_y, high_y - limit the y axis (actual values of logistic func) ''' def draw_f(iterations=2000, discard=100, low_x=0, high_x=1, low_y=0, high_y=1): x = 0.235 * np.ones(iterations) #numpy array of 0.235s - I do not think the number itself is important r = np.linspace(0, 1, iterations) #numpy array of equally divided values between 0 and 1 for i in range(iterations-discard): #calculate but do not draw x = logistic(r, x) for i in range(iterations-discard, iterations): x = logistic(r, x) plt.plot(r, x, ',k') plt.xlim(low_x, high_x) plt.ylim(low_y, high_y) plt.savefig('feigenbaum.png')
[ "dionyz.lazar+dev@gmail.com" ]
dionyz.lazar+dev@gmail.com
6723224fa7f7efa05ba157f597fb3fd81558e503
98c8659e7cadb85a19e0929d6ccbed3d0888aa77
/GNU/FM_5.py
b3d71e5af479c466e68442594fe158eb026c8c20
[]
no_license
JoshuaatBU/Starobike
9a6eafd49abc2778e8c7c48f8de3b57846626e23
cc458a7dcd49261f00a8442847c9f8be77155f3d
refs/heads/main
2023-05-10T00:58:07.148311
2021-05-25T19:56:00
2021-05-25T19:56:00
370,811,757
0
0
null
null
null
null
UTF-8
Python
false
false
5,827
py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # SPDX-License-Identifier: GPL-3.0 # # GNU Radio Python Flow Graph # Title: FM_5_transmit # Author: jshall # GNU Radio version: 3.8.1.0 from distutils.version import StrictVersion if __name__ == '__main__': import ctypes import sys if sys.platform.startswith('linux'): try: x11 = ctypes.cdll.LoadLibrary('libX11.so') x11.XInitThreads() except: print("Warning: failed to XInitThreads()") from PyQt5 import Qt from gnuradio import qtgui from gnuradio.filter import firdes import sip from gnuradio import analog from gnuradio import blocks from gnuradio import filter from gnuradio import gr import sys import signal from argparse import ArgumentParser from gnuradio.eng_arg import eng_float, intx from gnuradio import eng_notation from gnuradio import uhd import time from gnuradio import qtgui class FM_5(gr.top_block, Qt.QWidget): def __init__(self): gr.top_block.__init__(self, "FM_5_transmit") Qt.QWidget.__init__(self) self.setWindowTitle("FM_5_transmit") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "FM_5") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", args='', channels=list(range(0,1)), ), '', ) self.uhd_usrp_sink_0.set_center_freq(100000000, 0) self.uhd_usrp_sink_0.set_gain(200, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0.set_samp_rate(1000000) # No synchronization enforced. self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=1000000, decimation=22050, taps=None, fractional_bw=None) self.qtgui_sink_x_1 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name True, #plotfreq True, #plotwaterfall True, #plottime True #plotconst ) self.qtgui_sink_x_1.set_update_time(1.0/10) self._qtgui_sink_x_1_win = sip.wrapinstance(self.qtgui_sink_x_1.pyqwidget(), Qt.QWidget) self.qtgui_sink_x_1.enable_rf_freq(False) self.top_grid_layout.addWidget(self._qtgui_sink_x_1_win) self.blocks_wavfile_source_0 = blocks.wavfile_source('/home/jshall/Downloads/ImperialMarch60.wav', True) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(1) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=22050, quad_rate=22050, tau=75e-6, max_dev=8000, fh=-1.0, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_sink_x_1, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.uhd_usrp_sink_0, 0)) def closeEvent(self, event): self.settings = Qt.QSettings("GNU Radio", "FM_5") self.settings.setValue("geometry", self.saveGeometry()) event.accept() def get_samp_rate(self): return self.samp_rate def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.qtgui_sink_x_1.set_frequency_range(0, self.samp_rate) def main(top_block_cls=FM_5, options=None): if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): style = gr.prefs().get_string('qtgui', 'style', 'raster') Qt.QApplication.setGraphicsSystem(style) qapp = Qt.QApplication(sys.argv) tb = top_block_cls() tb.start() tb.show() def sig_handler(sig=None, frame=None): Qt.QApplication.quit() signal.signal(signal.SIGINT, sig_handler) signal.signal(signal.SIGTERM, sig_handler) timer = Qt.QTimer() timer.start(500) timer.timeout.connect(lambda: None) def quitting(): tb.stop() tb.wait() qapp.aboutToQuit.connect(quitting) qapp.exec_() if __name__ == '__main__': main()
[ "joshuaat@bu.edu" ]
joshuaat@bu.edu
7e87b934a7942ef35ad3f231531b13d99f5cbee9
b3eac9ed42c345079f80277cfe1d196033446e24
/permission/api/mission.py
07f2d7941bafea1aa66aeda770eb7b0f92800423
[]
no_license
willtuna/nctuoj
697e0ea02cdc8d19b5f052155a464be1937d718e
5638f76113ff3d6ff24c71b1484fd0b635f09040
refs/heads/master
2021-01-19T13:55:55.259922
2017-08-20T13:41:03
2017-08-20T13:41:03
100,863,976
0
0
null
null
null
null
UTF-8
Python
false
false
374
py
from permission.base import Base class Missions(Base): def post(self, req): if len(req.user) == 0: print("Hello I am in",'backend/permission/api/mission.py') print("Hello I am in",'backend/permission/api/mission.py') print("Hello I am in",'backend/permission/api/mission.py') return (403, 'Permission Denied.')
[ "willvegapunk@gmail.com" ]
willvegapunk@gmail.com
fd68c15474a48ba528dcb0a32ef1c363659d8815
ec85250addb7357dfe7bb3e0680d53fc7b0fd8fb
/examples/docs_snippets/docs_snippets/concepts/io_management/io_manager_per_output.py
d627cfc5ba88b917ea9413293f344a59d3d0929a
[ "Apache-2.0" ]
permissive
dagster-io/dagster
6adb5deee8bcf3ea1866a6a64f2ed81e1db5e73a
fe21995e0402878437a828c6a4244025eac8c43b
refs/heads/master
2023-09-05T20:46:08.203794
2023-09-05T19:54:52
2023-09-05T19:54:52
131,619,646
8,565
1,154
Apache-2.0
2023-09-14T21:57:37
2018-04-30T16:30:04
Python
UTF-8
Python
false
false
463
py
# start_marker from dagster_aws.s3 import S3PickleIOManager, S3Resource from dagster import FilesystemIOManager, Out, job, op @op(out=Out(io_manager_key="fs")) def op_1(): return 1 @op(out=Out(io_manager_key="s3_io")) def op_2(a): return a + 1 @job( resource_defs={ "fs": FilesystemIOManager(), "s3_io": S3PickleIOManager(s3_resource=S3Resource(), s3_bucket="test-bucket"), } ) def my_job(): op_2(op_1()) # end_marker
[ "noreply@github.com" ]
dagster-io.noreply@github.com
05ecad35056a282981a6bad116a1d6d83ae62119
d07aaccefe74ee58780c08f4d6d8fe8da85a1f5e
/blog/migrations/0001_initial.py
bbb03bbe62775e9d8b894dfa74d005bf54c8dddf
[]
no_license
sujithgawtham/my-first-blog
676c98bd8d2574b7f82fd303d32e80248b92c54a
74b8206198332bc23f63882feddd8fbb000b3f6c
refs/heads/master
2021-01-16T17:37:37.729735
2017-08-11T20:08:04
2017-08-11T20:08:04
100,009,483
0
0
null
null
null
null
UTF-8
Python
false
false
1,051
py
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-08-10 19:59 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Post', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=200)), ('text', models.TextField()), ('created_date', models.DateTimeField(default=django.utils.timezone.now)), ('published_date', models.DateTimeField(blank=True, null=True)), ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), ]
[ "gawtham161@gmail.com" ]
gawtham161@gmail.com
c1d450efb4775d6c040c6a1385da6778e4d96224
4be4c5fdaa7509fbcbdfd8115819e84a7f8a4142
/mcazurerm/storagerp.py
37987b781f1e8cd5004f65b9a3f124d62b4702d0
[ "MIT" ]
permissive
pjshi23/mcazurerm
a37d9ff5754d39f0b0a32f836adf68e81c5d1049
e17eb075ec8ffc5593e2a169c7479111478f43ee
refs/heads/master
2021-01-19T11:45:47.080124
2017-08-12T08:00:43
2017-08-12T08:00:43
68,885,817
0
0
null
null
null
null
UTF-8
Python
false
false
4,214
py
# storagerp.py - azurerm functions for the Microsoft.Storage resource provider from .restfns import do_delete, do_get, do_put, do_post from .settings import azure_rm_endpoint, STORAGE_API # create_storage_account(access_token, subscription_id, rgname, account_name, location) # create a storage account in the specified location and resource group # Note: just standard storage for now. Could add a storageType argument later. def create_storage_account(access_token, subscription_id, rgname, account_name, location, storage_type='Standard_LRS'): endpoint = ''.join([azure_rm_endpoint, '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts/', account_name, '?api-version=', STORAGE_API]) body = ''.join(['{\n "location": "', location, '",\n', ' "sku": {\n "name": "', storage_type, '"\n },\n', ' "kind": "Storage"\n}']) return do_put(endpoint, body, access_token) # delete_storage_account(access_token, subscription_id, rgname, account_name) # delete a storage account in the specified resource group def delete_storage_account(access_token, subscription_id, rgname, account_name): endpoint = ''.join([azure_rm_endpoint, '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts/', account_name, '?api-version=', STORAGE_API]) return do_delete(endpoint, access_token) # get_storage_account(access_token, subscription_id, rgname, account_name) # get the properties for the named storage account def get_storage_account(access_token, subscription_id, rgname, account_name): endpoint = ''.join([azure_rm_endpoint, '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts/', account_name, '?api-version=', STORAGE_API]) return do_get(endpoint, access_token) # get_storage_account_keys(access_token, subscription_id, rgname, account_name) # get the access keys for the specified storage account def get_storage_account_keys(access_token, subscription_id, rgname, account_name): endpoint = ''.join([azure_rm_endpoint, '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts/', account_name, '/listKeys', '?api-version=', STORAGE_API]) return do_post(endpoint, '', access_token) # get_storage_usage(access_token, subscription_id) # returns storage usage and quota information for the specified subscription def get_storage_usage(access_token, subscription_id): endpoint = ''.join([azure_rm_endpoint, '/subscriptions/', subscription_id, '/providers/Microsoft.Storage/usages', '?api-version=', STORAGE_API]) return do_get(endpoint, access_token) # list_storage_accounts_rg(access_token, subscription_id, rgname) # list the storage accounts in the specified resource group def list_storage_accounts_rg(access_token, subscription_id, rgname): endpoint = ''.join([azure_rm_endpoint, '/subscriptions/', subscription_id, '/resourcegroups/', rgname, '/providers/Microsoft.Storage/storageAccounts', '?api-version=', STORAGE_API]) return do_get(endpoint, access_token) # list_storage_accounts_sub(access_token, subscription_id) # list the storage accounts in the specified subscription def list_storage_accounts_sub(access_token, subscription_id): endpoint = ''.join([azure_rm_endpoint, '/subscriptions/', subscription_id, '/providers/Microsoft.Storage/storageAccounts', '?api-version=', STORAGE_API]) return do_get(endpoint, access_token)
[ "pjshi23@gmail.com" ]
pjshi23@gmail.com
e232549d038b15c86e79b23335078b46e576c073
6f91392c15d92591a46a6d2bdb9a1b289d34b1d6
/common.py
ce040e96477acf385cb51d7d86ffdc7b7b1d4071
[]
no_license
PaulStepanov/cm
9f3731a3a7a8a73d72aece821a76d5f4be408f40
7a7a48e7bb8fa0d52fcbd2f510bc2144305fd1ac
refs/heads/master
2020-04-07T23:27:51.152634
2018-12-13T09:00:55
2018-12-13T09:00:55
null
0
0
null
null
null
null
UTF-8
Python
false
false
442
py
import matplotlib.pyplot as plt import functools import operator foldl = lambda func, acc, xs: functools.reduce(func, xs, acc) #np.arange(x0, ((n + 1) * xn / n) + h, h) def renderDots(dots): x_cords = [] y_cords = [] templ_str = "(%f, %f)" for dot in dots: x_cords.append(dot[0]) y_cords.append(dot[1]) plt.annotate(templ_str % (dot[0], dot[1]), (dot[0], dot[1])) plt.plot(x_cords, y_cords, 'ro')
[ "pavelstsiapanau@gmail.com" ]
pavelstsiapanau@gmail.com
b5cbc61d5070481fa9cfa55d74918563ba7ebec8
c0c5015b883914aad18419043f5303e20c9accec
/temperature conversion.py
3094e35fb7fb955bed9c3590cb56343934824d22
[]
no_license
KetanMehlawat/python-programs
498bb65b4bc6e21cfcb58c55a08a78414b9445ed
b9fb71ab51c58c95eaf4241e335206032f142004
refs/heads/master
2021-07-09T03:12:50.461896
2017-10-08T15:22:18
2017-10-08T15:22:18
106,181,414
0
0
null
null
null
null
UTF-8
Python
false
false
1,621
py
while True: print "Press 1 to continue" print "press 0 to exit" ch=input("enter your choice") if ch>1 or ch<0: print ("please press correct button") continue elif ch==1: while True: print"Menu" print"1.From celcius to fahrenheit" print"2.From fahrenheit to celcius" print"3.From celcius to kelvin" print"4.From kelvin to celcius" print"5.From kelvin to fahrenheit" print"6.From fahrenheit to kelvin" print"0.Exit" ch=input("enter your choice ") if ch<0 or ch>6: print"please enter correct choice" continue elif ch==1: t=input("temperature in celcius ") f=((9/5.0)*t)+32 print "temperature in fahrenheit is ",f elif ch==2: t=input("temperature in fahrenheit ") c=((t-32.0)*(5/9.0)) print "temperature in celcius is ",c elif ch==3: t=input("temperature in celcius ") k=t+273.0 print "temperature in kelvin is ",k elif ch==4: t=input("temperature in kelvin ") c=t-273.0 print "temperatur in celcius is ",c elif ch==5: t=input("temperature in kelvin ") f=((9/5.0)*t)+32 print "temperature in fahrenheit is ",f elif ch==6: t=input("temperature in fahrenheit ") k=((t-32)*(5/9.0))+273 print "temperature in kelvin is ",k else: break else: break
[ "noreply@github.com" ]
KetanMehlawat.noreply@github.com
1986203ba846dec6136fa59520cacf477d9dd1b3
3e66a5089d386fe0988201ff132446ec9bd04c9d
/M2 ICP7/Source/ICP7/Decisiontree.py
0d33e93a9a4345ca5e8666be19939fdba7427d0b
[]
no_license
Joshmitha307/BDP
b2f3a09cacb4a8f85f431d93e22dc16e3ccbf556
bbdabc8ed76ddcce055e5b03bf6d666037da156d
refs/heads/master
2020-07-09T19:50:26.974088
2019-12-08T04:22:24
2019-12-08T04:22:24
204,067,259
0
1
null
null
null
null
UTF-8
Python
false
false
2,858
py
from pyspark.sql import SparkSession from pyspark.ml.classification import DecisionTreeClassifier from pyspark.ml.evaluation import MulticlassClassificationEvaluator from pyspark.ml.feature import VectorAssembler from pyspark.mllib.evaluation import MulticlassMetrics from pyspark.ml.feature import StringIndexer from pyspark.sql.functions import col import sys import os os.environ["SPARK_HOME"] = "C:\spark-2.4.3-bin-hadoop2.7" os.environ["HADOOP_HOME"]="C:\\winutils" # Creating spark session spark = SparkSession.builder.appName("ICP7").getOrCreate() spark.sparkContext.setLogLevel("ERROR") # Define input path input_path = "C:\\Users\\Anusha Reddy\\PycharmProjects\\Lab" # Load data and select feature and label columns data = spark.read.format("csv").option("header", True).option("inferSchema", True).option("delimiter", ",").load(input_path + "\\adult.csv") data = data.withColumnRenamed("age", "label").select("label", col("education-num").alias("education-num"), col(" hours-per-week").alias("hours-per-week"),col(" education").alias("education"),col(" fnlwgt").alias("fnlwgt"),col(" sex").alias("sex"),col(" relationship").alias("relationship")) data = data.select(data.label.cast("double"),"education-num", "hours-per-week","education","sex","fnlwgt","relationship") new_data=data.toDF("label","education-num","hours-per-week","education","sex","fnlwgt","relationship") indexer = StringIndexer(inputCol="education", outputCol="new_education") indexed = indexer.fit(new_data).transform(new_data) indexer1 = StringIndexer(inputCol="sex", outputCol="new_sex") indexed1 = indexer1.fit(indexed).transform(indexed) indexer2= StringIndexer(inputCol="relationship",outputCol="new_rel") indexed2= indexer2.fit(indexed1).transform(indexed1) indexed2=indexed2.drop("sex","education","relationship") indexed2.show() # Create vector assembler for feature columns assembler = VectorAssembler(inputCols=indexed2.columns[1:], outputCol="features") data = assembler.transform(indexed2) # Split data into training and test data set training, test = data.select("label", "features").randomSplit([0.6, 0.4]) # Create Decision tree model and fit the model with training dataset dt = DecisionTreeClassifier() model = dt.fit(training) # Generate prediction from test dataset predictions = model.transform(test) # Evaluating the accuracy of the model evaluator = MulticlassClassificationEvaluator() accuracy = evaluator.evaluate(predictions) # Show model accuracy print("Accuracy:", accuracy) # Report predictionAndLabels = predictions.select("label", "prediction").rdd metrics = MulticlassMetrics(predictionAndLabels) print("Confusion Matrix:", metrics.confusionMatrix()) print("Precision:", metrics.precision()) print("Recall:", metrics.recall()) print("F-measure:", metrics.fMeasure())
[ "joshmithat96@gmail.com" ]
joshmithat96@gmail.com
05f8680d84d197f63304d082bcbd975140250ff5
5dd711fc63f1f005aa16c2dc07faae310feb8e92
/zabbixapi.py
6ec1510015c2ca962212e7038e41e330aab22ec6
[ "MIT" ]
permissive
mojunneng/zabbixapi
fd8818b87116dcc623cac0f9526ec38ae260a76e
993446dd8269604012c69691086c22df457b706e
refs/heads/master
2020-04-26T23:23:56.208878
2018-01-26T08:10:10
2018-01-26T08:10:10
null
0
0
null
null
null
null
UTF-8
Python
false
false
13,062
py
#!/usr/bin/env python # -*- coding:utf-8 -*- import json import time import requests import os import sys reload(sys) sys.setdefaultencoding('utf-8') # zabbix认证信息 zabbix_url = "http://52.80.127.55/zabbix/api_jsonrpc.php" zabbix_username = "Admin" zabbix_password = "zabbix" #全局变量定义 local_path = os.path.split(os.path.realpath(__file__))[0] log_file = local_path + os.path.sep + "log_zabbixapi.log" headers = {"Content-Type": "application/json"} #记录日志模块 def log(data): file = open(log_file, 'a+') date = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())) try: file.write("%s %s" %(date,data)+'\n') finally: file.close() #zabbix登陆 def zabbix_login(): try: data = json.dumps( { "jsonrpc": "2.0", "method": "user.login", "params": { "user": zabbix_username, "password": zabbix_password }, "id": 0 }) request_data = requests.post(zabbix_url, data=data, headers=headers) return json.loads(request_data.text)['result'] except BaseException,e: log("zabbix_login: %s" %e) return "error" #zabbix退出 def zabbix_logout(token): try: data = json.dumps( { "jsonrpc": "2.0", "method": "user.logout", "params": [], "id": 0, "auth": token }) request_data = requests.post(zabbix_url, data=data, headers=headers) result = json.loads(request_data.text)['result'] if result: return "ok" else: log("登出失败,原因:%s" %e) return "error" except BaseException,e: log("zabbix_logout: %s" %e) return "error" #获取主机组id def get_group_id(group_name): try: token = zabbix_login() data = json.dumps( { "jsonrpc": "2.0", "method": "hostgroup.get", "params": { "output": "extend", "filter": { "name": [ group_name ] } }, "auth": token, "id": 0 }) request = requests.post(zabbix_url, data=data, headers=headers) group_id = json.loads(request.text)['result'] if len(group_id) == 0: return "null" else: return group_id[0]['groupid'] except BaseException,e: log("get_group_id: %s" %e) return "error" finally: zabbix_logout(token) #创建服务器组 def create_group(group_name): try: token = zabbix_login() data = json.dumps( { "jsonrpc": "2.0", "method": "hostgroup.create", "params": { "name": group_name }, "auth": token, "id": 0 }) request = requests.post(zabbix_url, data=data, headers=headers) group_id = json.loads(request.text)['result']['groupids'][0] return group_id except BaseException,e: log("create_group: %s" %e) return "error" finally: zabbix_logout(token) #获取模板id def get_template_id(template_name): try: token = zabbix_login() data = json.dumps( { "jsonrpc": "2.0", "method": "template.get", "params": { "output": "extend", "filter": { "host": [ template_name ] } }, "auth": token, "id": 0 }) request = requests.post(zabbix_url, data=data, headers=headers) template_id = json.loads(request.text)['result'][0]['templateid'] return template_id except BaseException,e: log('get_template_id: %s' %e) return "error" finally: zabbix_logout(token) #创建主机 def create_host(host_name,group_name,host_ip,host_port,template_name): try: token = zabbix_login() template_id = get_template_id(template_name) if template_id == "error": return "error" group_id = get_group_id(group_name) if group_id == "error": return "error" data = json.dumps( { "jsonrpc": "2.0", "method": "host.create", "params": { "host": host_name, "interfaces": [ { "type": 1, "main": 1, "useip": 1, "ip": host_ip, "dns": "", "port": host_port } ], "groups": [ { "groupid": group_id } ], "templates": [ { "templateid": template_id } ], }, "auth": token, "id": 0 }) request = requests.post(zabbix_url, data=data, headers=headers) host_id = json.loads(request.text)['result']['hostids'][0] return host_id except BaseException,e: log('create_host: %s' %e) return "error" finally: zabbix_logout(token) #删除主机 def delete_host(host_id): try: token = zabbix_login() data = json.dumps( { "jsonrpc": "2.0", "method": "host.delete", "params": [ host_id ], "auth": token, "id": 0 }) request = requests.post(zabbix_url, data=data, headers=headers) host_id_deleted = json.loads(request.text)['result']['hostids'][0] if host_id_deleted == host_id: return "ok" else: log('delete_host: failed %s' %request.text) return "failed" except BaseException,e: log('delete_host: %s' %e) return "error" #获取主机状态(监控状态是否正常) def get_host_status(hostid): try: token = zabbix_login() data = json.dumps( { "jsonrpc": "2.0", "method": "host.get", "params": { "output": ["available"], "hostids": hostid }, "id": 0, "auth": token }) request = requests.post(zabbix_url, data=data, headers=headers) host_status = json.loads(request.text)['result'][0]['available'] if host_status == '1': return "available" else: return "unavailable" except BaseException,e: log('get_host_status: %s' %e) return "error" finally: zabbix_logout(token) #根据监控名获取监控项最新值 def get_item_value_name(host_id, item_name): try: token = zabbix_login() data = json.dumps( { "jsonrpc": "2.0", "method": "item.get", "params": { "output": "extend", "hostids": host_id, "search": { "name": item_name }, }, "auth": token, "id": 0 }) request = requests.post(zabbix_url, data=data, headers=headers) last_value = json.loads(request.text)['result'][0]['lastvalue'] return last_value except BaseException,e: log('get_item_value_name: %s' %e) return "error" finally: zabbix_logout(token) #根据监控项键值获取监控项最新值 def get_item_value_key(host_id, item_name): try: token = zabbix_login() data = json.dumps( { "jsonrpc": "2.0", "method": "item.get", "params": { "output": "extend", "hostids": host_id, "search": { "key_": item_name }, }, "auth": token, "id": 0 }) request = requests.post(zabbix_url, data=data, headers=headers) last_value = json.loads(request.text)['result'][0]['lastvalue'] return last_value except BaseException,e: log('get_item_value_key: %s' %e) return "error" finally: zabbix_logout(token) #获取某个主机组下所有主机id def get_group_hosts_id(group_name): try: token = zabbix_login() data = json.dumps( { "jsonrpc": "2.0", "method": "hostgroup.get", "params": { "selectHosts": "hostid", "filter": { "name": [ group_name ] } }, "auth": token, "id": 0 }) request = requests.post(zabbix_url, data=data, headers=headers) hosts = json.loads(request.text)['result'][0]['hosts'] host_id_list = [] for host_id in hosts: host_id_list.append(host_id) return host_id_list except BaseException,e: log('get_group_hosts_id %s' %e) return "error" finally: zabbix_logout(token) #获取主机的监控项数 def get_host_item_num(host_id): try: token = zabbix_login() data = json.dumps( { "jsonrpc": "2.0", "method": "item.get", "params": { "hostids": host_id, "countOutput": "true", }, "auth": token, "id": 0 }) request = requests.post(zabbix_url, data=data, headers=headers) item_num = json.loads(request.text)['result'] return item_num except BaseException,e: log('get_item_num: %s' %e) return "error" finally: zabbix_logout(token) #获取主机的自发现规则id列表 def get_LLD_ids(host_id): try: token = zabbix_login() data = json.dumps( { "jsonrpc": "2.0", "method": "discoveryrule.get", "params": { "output": "extend", "hostids": host_id }, "auth": token, "id": 0 }) request = requests.post(zabbix_url, data=data, headers=headers) item_ids = json.loads(request.text)['result'] lld_id_list = [] for item_id in item_ids: lld_id_list.append(item_id['itemid']) return lld_id_list except BaseException,e: log('get_LLD_ids: %s' %e) return "error" finally: zabbix_logout(token) #开启某个主机的自发现规则 def LLD_on(item_id, host_id): try: token = zabbix_login() data = json.dumps( { "jsonrpc": "2.0", "method": "discoveryrule.update", "params": { "itemid": item_id, "hostids": host_id, "status": 0 }, "auth": token, "id": 0 }) request = requests.post(zabbix_url, data=data, headers=headers) item_result = json.loads(request.text)['result']['itemids'] if len(item_result) != 0: return "ok" else: return "failed" except BaseException,e: log('LLD_on: %s' %e) return "error" finally: zabbix_logout(token) #关闭某个主机的自发现规则 def LLD_off(item_id, host_id): try: token = zabbix_login() data = json.dumps( { "jsonrpc": "2.0", "method": "discoveryrule.update", "params": { "itemid": item_id, "hostids": host_id, "status": 1 }, "auth": token, "id": 0 }) request = requests.post(zabbix_url, data=data, headers=headers) lld_result = json.loads(request.text)['result']['itemids'] if len(lld_result) != 0: return "ok" else: return "failed" except BaseException,e: log('LLD_off: %s' %e) return "error" finally: zabbix_logout(token)
[ "zhenglisai@126.com" ]
zhenglisai@126.com
1a805958afcbe383dc5cc29fa109a76bb53df482
de24f83a5e3768a2638ebcf13cbe717e75740168
/moodledata/vpl_data/217/usersdata/267/113215/submittedfiles/av2_p3_m2.py
520578eac65d6d93a9e155c6f0915e7cad14a53b
[]
no_license
rafaelperazzo/programacao-web
95643423a35c44613b0f64bed05bd34780fe2436
170dd5440afb9ee68a973f3de13a99aa4c735d79
refs/heads/master
2021-01-12T14:06:25.773146
2017-12-22T16:05:45
2017-12-22T16:05:45
69,566,344
0
0
null
null
null
null
UTF-8
Python
false
false
1,203
py
# -*- coding: utf-8 -*- import numpy as np #FUNÇÃO def Ldiferente(a,valorsoma): for i in range(0,n,1): soma=0 for j in range(0,n,1): soma=soma+a[i,j] if valorsoma!=soma: return(i) def Cdiferente(a,valorsoma): for j in range(0,n,1): soma=0 for i in range(0,n,1): soma=soma+a[i,j] if valorsoma!=soma: return(j) def valorsoma(a): A=0 B=0 C=0 for i in range(0,n-2,1): for j in range(0,n,1): A=A+a[i,j] B=B+a[i+1,j] C=C+a[i+2,j] if A==B: return(A) if A==C: return(A) if B==C: return(B) #PROGRAMA PRINCIPAL n=0 while n<3: n=int(input('Digite a dimensão da matriz: ')) matriz=np.zeros((n,n)) for i in range(0,n,1): for j in range(0,n,1): matriz[i,j]=int(input('Digite o valor da posição %d%d: '%(i+1,j+1))) valor=valorsoma(matriz) linha=Ldiferente(matriz,valor) coluna=Cdiferente(matriz,valor) soma=0 for i in range(0,n,1): soma=soma+matriz[linha,i] erro=matriz[linha,coluna] original=valor-(soma-erro) print(original) print(erro)
[ "rafael.mota@ufca.edu.br" ]
rafael.mota@ufca.edu.br
49298219e3aeca8791c90ee9b3151741ec09fcff
2838c2b60402cfb5c67276318f3b1129345eff90
/smbio/interface.py
a33b480aeeb3c9da8ed6cefc85958b933707495e
[ "BSD-3-Clause" ]
permissive
Ryex/i2c-alarmpy
7a92a83f34950c0e01e27846133fa130283ae404
83c613e832bdb131298880b9eef387d9c52fcd3a
refs/heads/master
2016-08-12T13:31:38.564725
2015-12-19T01:34:59
2015-12-19T01:34:59
46,528,534
2
1
null
null
null
null
UTF-8
Python
false
false
3,277
py
import time import re from .smb import Peripheral class Keypad4x4Matrix(Peripheral): DIRECTION = -1 DATAMAP = Peripheral.datamap() DATAMAP["upsidedown"] = "bool" DATAMAP["repeat"] = "int" DATAMAP["timeout"] = "int" DATAMAP["beep"] = "bool" MATRIX = [['1', '2', '3', 'A'], ['4', '5', '6', 'B'], ['7', '8', '9', 'C'], ['*', '0', '#', 'D']] KEYCOL = [0b0111, 0b1011, 0b1101, 0b1110] DECODE = { 0b0111: 0, 0b1011: 1, 0b1101: 2, 0b1110: 3} CODE_RE = re.compile("^\*(.+?)#$") def __check_matrix(self, matrix): try: for x in range(4): for y in range(4): matrix[x][y] except IndexError: raise ValueError("matrix must be 4x4") def init(self): if "upsidedown" in self.data: self.upsidedown = bool(int(self.data["upsidedown"])) else: self.upsidedown = False if "repeat" in self.data: self.repeat = int(self.data["repeat"]) else: self.repeat = 100 if "timeout" in self.data: self.timeout = int(self.data["timeout"]) else: self.timeout = 30 self.matrix = Keypad4x4Matrix.MATRIX self.__check_matrix(self.matrix) self.ensure_mode() self.last_t = time.time() self.last_s = "" self.in_string = "" def ensure_mode(self): if self.io.get_mode() != 0xF0: self.io.set_mode(0xF0) # upper 4 bits are inputs if self.io.get_pullup(): self.io.set_pullup(0xF0) # enable upper 4 bits pullups def read(self): self.ensure_mode() for col in range(0, 4): time.sleep(0.01) self.io.write_out(self.KEYCOL[col]) # write 0 to lowest four bits key = self.io.read_in() >> 4 if key in self.DECODE: row = self.DECODE[key] if self.upsidedown: return self.matrix[row][col] # keypad right side up else: return self.matrix[3 - col][3 - row] # keypad upside down return "" def update_input(self): s = self.read() now = time.time() if s: flag = False if self.last_s: if s == self.last_s: if (now - self.last_t) * 1000 > self.repeat: flag = True else: flag = True else: flag = True if flag: self.last_s = s self.last_t = now self.in_string += s print("INPUT:", s, self.in_string, flush=True) self.message("beep") else: if now - self.last_t > self.timeout: self.in_string = "" self.last_s = "" self.last_t = now def get_code(self, code): match = self.CODE_RE.match(code) if match: self.in_string = "" return match.group(1) return None def update(self): self.update_input() return {"input": self.get_code(self.in_string)}
[ "ryexander@gmail.com" ]
ryexander@gmail.com
e389bfb07bd28dd31c6906e8e412d593f5754b24
d9de59f274ec89ed868891c9c4f9b84b7d347384
/first_app/views.py
5867a4319bfead8e329bd9b93c7c3378fa1da258
[]
no_license
Olivier-Patrick/master_django
dda6214c6217fb3727563f445a0b9bd804057d37
046c72ec5f0267ebab0b1d718c0dd0b6f68c6f27
refs/heads/master
2022-04-27T01:16:08.786574
2020-04-16T21:20:16
2020-04-16T21:20:16
256,332,008
0
0
null
null
null
null
UTF-8
Python
false
false
387
py
# pylint: disable=no-member from django.shortcuts import render from django.http import HttpResponse from first_app.models import Topic, Webpage, AccessRecord # Create your views here. def index(request): webpages_list = AccessRecord.objects.order_by('date') date_dic = {'access_records': webpages_list} return render(request, 'first_app/index.html', context= date_dic)
[ "gopatrik8@gmail.com" ]
gopatrik8@gmail.com
363527ebe0e57e884e5b58ae3336bac79dc85662
ff38e616cc73c5b139205f9b4b26517edeafcf70
/prediksicovidjatim/config.py
91af34dce6725e833a1be81625fa655d04f72803
[ "MIT" ]
permissive
prediksicovidjatim/prediksicovidjatim-core
4319b048b8c9c981a4cd27e1b6eb2085e8faf301
e0be4b86d98e1f628852ec627bb1a5b406efb923
refs/heads/master
2022-12-03T09:19:14.863661
2020-08-19T09:22:10
2020-08-19T09:22:10
282,635,624
0
1
MIT
2020-08-19T09:22:11
2020-07-26T11:28:22
null
UTF-8
Python
false
false
1,219
py
import matplotlib import matplotlib.pyplot as plt FONT_SMALL = 12 FONT_MEDIUM = 14 FONT_BIG = 16 FIG_SIZE = (13,8) LINE_WIDTH = 2 FLOAT_TOLERANCE=1e-7 FIRST_TANGGAL = "2020-03-20" PREDICT_DAYS = 30 def init_plot(font_small=None, font_medium=None, font_big=None, fig_size=None, line_width=None): global FONT_SMALL global FONT_MEDIUM global FONT_BIG global FIG_SIZE global LINE_WIDTH font_small = font_small or FONT_SMALL font_medium = font_medium or FONT_MEDIUM font_big = font_big or FONT_BIG fig_size = fig_size or FIG_SIZE line_width = line_width or LINE_WIDTH plt.rc('font', size=font_small) # controls default text sizes plt.rc('axes', titlesize=font_small) # fontsize of the axes title plt.rc('axes', labelsize=font_medium) # fontsize of the x and y labels plt.rc('xtick', labelsize=font_small) # fontsize of the tick labels plt.rc('ytick', labelsize=font_small) # fontsize of the tick labels plt.rc('legend', fontsize=font_medium) # legend fontsize plt.rc('figure', titlesize=font_big) # fontsize of the figure title plt.rc('figure', figsize=fig_size) plt.rc('lines', linewidth=line_width)
[ "rizqinur2010@gmail.com" ]
rizqinur2010@gmail.com
c9e7229486d218cf9a6fbba78ee81bc0bb9c6479
aa641d59ea282e12a603d463e4396e3a6ce6ab19
/fitlanecal/tests/fitlanecal_test.py
17989330d0e03b5c493ab8748af67832907d0819
[]
no_license
paraita/fitlanecal
440f72827f8932de52228d92c5923bc8b911732e
f5708217ae4c307901904bfb849dd738443c3b0c
refs/heads/master
2020-12-25T20:42:03.927929
2016-02-22T20:46:03
2016-02-22T20:46:03
43,499,292
0
0
null
2016-02-20T22:10:10
2015-10-01T13:54:50
HTML
UTF-8
Python
false
false
5,887
py
from mock import patch from fitlanecal import * def course_name_test(): assert course_name('11') == 'Body Combat' assert course_name('tamure') == '???' def club_name_test(): assert club_name('nice-centre') == 'Nice Centre' assert club_name('aito-gym') == 'Nice Centre' assert club_name('') == 'Nice Centre' @patch('fitlanecal.course_name') def sanitize_course_name_test_mocked(mocked): mocked.return_value = "dumb" str_test1 = "/site/uploaded/cours/cours_logo_11.jpg" str_test2 = "/site/uploaded/cours/cours_logo_11" str_test3 = "11.jpg" str_test4 = "11" str_test5 = "" str_test6 = "/site/uploaded/cours/cours_logo_.jpg" assert sanitize_course_name(str_test1) == "dumb" assert sanitize_course_name(str_test2) == "dumb" assert sanitize_course_name(str_test3) == "dumb" assert sanitize_course_name(str_test4) == "dumb" assert sanitize_course_name(str_test5) == "dumb" assert sanitize_course_name(str_test6) == "dumb" def sanitize_course_name_test(): str_test1 = "/site/uploaded/cours/cours_logo_11.jpg" str_test2 = "/site/uploaded/cours/cours_logo_11" str_test3 = "11.jpg" str_test4 = "11" str_test5 = "" str_test6 = "/site/uploaded/cours/cours_logo_.jpg" assert sanitize_course_name(str_test1) == "Body Combat" assert sanitize_course_name(str_test2) == "Body Combat" assert sanitize_course_name(str_test3) == "Body Combat" assert sanitize_course_name(str_test4) == "Body Combat" assert sanitize_course_name(str_test5) == "???" assert sanitize_course_name(str_test6) == "???" def fetch_courses_on_test(): basepath = os.path.dirname(__file__) orig_path = os.path.abspath(os.path.join(basepath,"resources","fitlane-planning-test.html")) expected_path = os.path.abspath(os.path.join(basepath,"resources","expected_fetch_courses_on_test.txt")) fd_fitlane = open(orig_path,"r") fd_expected = open(expected_path,"r") content_fitlane = fd_fitlane.read() content_expected = fd_expected.read() tree = html.fromstring(content_fitlane) res = fetch_courses_on(tree, 'Lundi') assert str(res) == content_expected @patch('fitlanecal.fetch_html_from_club') def fetch_all_courses_at_club_test(mocked): basepath = os.path.dirname(__file__) orig_path = os.path.abspath(os.path.join(basepath,"resources","fitlane-planning-test.html")) expected_path = os.path.abspath(os.path.join(basepath,"resources","expected_fetch_all_courses_test.txt")) fd_fitlane = open(orig_path,"r") fd_expected = open(expected_path, "r") content_expected = fd_expected.read() mocked.return_value = html.fromstring(fd_fitlane.read()) res = str(fetch_all_courses_at_club('COLLECTIF',"Nice Centre")) print '----------------------' print res print '----------------------' assert res == content_expected def delta_time_duration_test(): assert delta_time_duration("1h") == (1,0) assert delta_time_duration(" 1h") == (1,0) assert delta_time_duration("1h ") == (1,0) assert delta_time_duration(" 1h ") == (1,0) assert delta_time_duration("1 h") == (1,0) assert delta_time_duration("1 h ") == (1,0) assert delta_time_duration("1h30") == (1,30) assert delta_time_duration(" 1h30") == (1,30) assert delta_time_duration("1 h30") == (1,30) assert delta_time_duration("1h 30") == (1,30) assert delta_time_duration("1h30 ") == (1,30) assert delta_time_duration(" 1 h 30 ") == (1,30) assert delta_time_duration("45min") == (0,45) assert delta_time_duration(" 45min") == (0,45) assert delta_time_duration("45 min") == (0,45) assert delta_time_duration(" 45 min") == (0,45) assert delta_time_duration("45min ") == (0,45) assert delta_time_duration(" 45min ") == (0,45) assert delta_time_duration(" 45 min ") == (0,45) assert delta_time_duration("Stretching / 1h") == (1,0) assert delta_time_duration("level 1 45min") == (0,45) assert delta_time_duration("level 1 45 min") == (0,45) assert delta_time_duration("") == (1,0) @patch('fitlanecal.fetch_html_from_club') def get_calendar_at_club_test(mocked): basepath = os.path.dirname(__file__) orig_path = os.path.abspath(os.path.join(basepath,"resources","fitlane-planning-test.html")) expected_path = os.path.abspath(os.path.join(basepath,"resources","expected_calendar_test.txt")) fd_fitlane = open(orig_path,"r") fd_expected = open(expected_path, "r") content_expected = fd_expected.read() mocked.return_value = html.fromstring(fd_fitlane.read()) content_actual = get_calendar_at_club('nice-centre') print '-------------' print content_actual print '-------------' assert content_actual == content_expected # def get_calendar_at_club_Cannes_Carnot_test(): # assert str(get_calendar_at_club('cannes-carnot')) > 0 # # # def get_calendar_at_club_Cannes_Gare_test(): # assert str(get_calendar_at_club('cannes-gare')) > 0 # # # def get_calendar_at_club_Cannes_La_Bocca_test(): # assert str(get_calendar_at_club('cannes-la-bocca')) > 0 # # # def get_calendar_at_club_Juan_Les_Pins_test(): # assert str(get_calendar_at_club('juan-les-pins')) > 0 # # # def get_calendar_at_club_Mandelieu_test(): # assert str(get_calendar_at_club('mandelieu')) > 0 # # # def get_calendar_at_club_Nice_Centre_test(): # assert str(get_calendar_at_club('nice-centre')) > 0 # # # def get_calendar_at_club_Nice_St_Isidore_test(): # assert str(get_calendar_at_club('nice-st-isidore')) > 0 # # # def get_calendar_at_club_Sophia_Antipolis_test(): # assert str(get_calendar_at_club('sophia-antipolis')) > 0 # # # def get_calendar_at_club_Villeneuve_Loubet_test(): # assert str(get_calendar_at_club('villeneuve-loubet')) > 0 # # # def get_calendar_at_club_Villeneuve_A8_test(): # assert str(get_calendar_at_club('villeneuve-A8')) > 0
[ "milkyboi@gmail.com" ]
milkyboi@gmail.com
12bbf196468a074a4a8c3836d80fd7d841d193f5
10c01319a25b4acc0912f523093bd97d15232a8a
/setup.py
2ed999f8bb53aa0d1aa0ff1a868cee1e602c26d1
[ "MIT" ]
permissive
klukosiute/MOSFiT
0c8620ce34ff4d26235fbc7a656dd4b7aec6407e
4bc6c74f4b592e4f023aad69fd17fe95078d518d
refs/heads/master
2020-03-31T19:12:12.953770
2018-10-12T21:31:17
2018-10-12T21:31:17
152,488,198
0
0
MIT
2018-10-10T20:50:55
2018-10-10T20:50:54
null
UTF-8
Python
false
false
2,366
py
"""Setup script for MOSFiT.""" import fnmatch import os import re from setuptools import find_packages, setup with open(os.path.join('mosfit', 'requirements.txt')) as f: required = f.read().splitlines() with open(os.path.join('mosfit', 'dependencies.txt')) as f: dependencies = f.read().splitlines() dir_path = os.path.dirname(os.path.realpath(__file__)) init_string = open(os.path.join(dir_path, 'mosfit', '__init__.py')).read() VERS = r"^__version__ = ['\"]([^'\"]*)['\"]" mo = re.search(VERS, init_string, re.M) __version__ = mo.group(1) AUTH = r"^__author__ = ['\"]([^'\"]*)['\"]" mo = re.search(AUTH, init_string, re.M) __author__ = mo.group(1) LICE = r"^__license__ = ['\"]([^'\"]*)['\"]" mo = re.search(LICE, init_string, re.M) __license__ = mo.group(1) matches = [] for root, dirnames, filenames in os.walk('mosfit'): for filename in fnmatch.filter(filenames, '*.pyx'): matches.append(os.path.join(root, filename)) try: import pypandoc with open('README.md', 'r') as f: txt = f.read() txt = re.sub('<[^<]+>', '', txt) long_description = pypandoc.convert(txt, 'rst', 'md') except ImportError: long_description = open('README.md').read() setup( name='mosfit', packages=find_packages(), entry_points={'console_scripts': [ 'mosfit = mosfit.main:main' ]}, include_package_data=True, version=__version__, # noqa description=('Modular software for fitting ' 'semi-analytical model predictions to observed ' 'astronomical transient data.'), license=__license__, # noqa author=__author__, # noqa author_email='guillochon@gmail.com', install_requires=required, dependency_links=dependencies, url='https://github.com/guillochon/mosfit', download_url=( 'https://github.com/guillochon/mosfit/tarball/' + __version__), # noqa keywords=['astronomy', 'fitting', 'monte carlo', 'modeling'], long_description=long_description, classifiers=[ 'Development Status :: 5 - Production/Stable', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Topic :: Scientific/Engineering :: Astronomy', 'Topic :: Scientific/Engineering :: Physics' ])
[ "guillochon@gmail.com" ]
guillochon@gmail.com
a0847b019b7f8306023ca7019fc09a6d8e70804a
af27baf72b50a3b2333325b7e67806a1895f5820
/docs/conf.py
c804cfb52c4fd3c11cf90cd37cf5b1c35cefdcf5
[]
no_license
dschor5/unit_test
5a77da4b72448a61668908929861b13b0decff0c
0ed00365b4a33c92bd14ed02d4d616bb2df8328a
refs/heads/main
2023-02-15T11:15:20.737159
2021-01-04T19:50:13
2021-01-04T19:50:13
324,447,741
0
0
null
null
null
null
UTF-8
Python
false
false
2,486
py
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # import os import sys sys.path.insert(0, os.path.abspath('../source/')) # -- Project information ----------------------------------------------------- project = 'unit_test' copyright = '2021, Dario Schor' author = 'Dario Schor' # The full version, including alpha/beta/rc tags release = '1.0' # -- General configuration --------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.mathjax', 'sphinx.ext.doctest', 'sphinx.ext.coverage', 'sphinx.ext.napoleon', 'sphinx.ext.graphviz' ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = 'sphinx_rtd_theme' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # -- Extension configuration ------------------------------------------------- napoleon_google_docstring = True napoleon_numpy_docstring = False # -- Options for todo extension ---------------------------------------------- autoapi_dirs = ['../source/calculator'] # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True
[ "dario.schor@und.edu" ]
dario.schor@und.edu
8324a111bb42cc6b2af0226dce01cf06204ed2bd
fa5378bbbea53e3896c74798286e3323d4dbd7b2
/python3/1_6-aaah.py
f07b758112bac2a3ca389708a388236d82cb6107
[]
no_license
ongaaron96/kattis-solutions
150abaab6b223164eef37381d1d5680338e0c9c9
ca059b830891113185667724e0a0c02faf7cbefe
refs/heads/main
2023-04-16T09:33:32.574335
2021-04-25T12:35:36
2021-04-25T12:35:36
359,774,473
0
0
null
null
null
null
UTF-8
Python
false
false
67
py
if len(input()) >= len(input()): print("go") else: print("no")
[ "ong.aaron96@gmail.com" ]
ong.aaron96@gmail.com
ca91272814abf57325250fae6fc0dd6c58ea68b4
2762d9956ab9b79d973c0a9d1082a200c8d088ec
/CLI-py.py
daf1debfeac7ce97dba8247ed9e11e7e142864ab
[]
no_license
PresentJay/py-cli-test
7361c457f8348b9f4eb8f0cc9365c75ee6e6006a
1632329729a97169ab6ba41ddc7d27c564a1b733
refs/heads/master
2022-11-17T11:17:31.494744
2020-07-14T23:08:57
2020-07-14T23:08:57
279,513,092
0
0
null
null
null
null
UTF-8
Python
false
false
5,301
py
import os import re import click import six from PyInquirer import (Token, ValidationError, Validator, print_json, prompt, style_from_dict) from pyfiglet import figlet_format try: import colorama colorama.init() except ImportError: colorama = None try: from termcolor import colored except ImportError: colored = None style = style_from_dict({ Token.QuestionMark: '#fac731 bold', Token.Answer: '#4688f1 bold', Token.Instruction: '', # default Token.Separator: '#cc5454', Token.Selected: '#0abf5b', # default Token.Pointer: '#673ab7 bold', Token.Question: '', }) def getContentType(answer, conttype): return answer.get("content_type").lower() == conttype.lower() def log(string, color, font="slant", figlet=False): if colored: if not figlet: six.print_(colored(string, color)) else: six.print_(colored(figlet_format( string, font=font), color)) else: six.print_(string) class EmailValidator(Validator): pattern = r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?" def validate(self, email): if len(email.text): if re.match(self.pattern, email.text): return True else: raise ValidationError( message="Invalid email", cursor_position=len(email.text)) else: raise ValidationError( message="You can't leave this blank", cursor_position=len(email.text)) class EmptyValidator(Validator): def validate(self, value): if len(value.text): return True else: raise ValidationError( message="You can't leave this blank", cursor_position=len(value.text)) class FilePathValidator(Validator): def validate(self, value): if len(value.text): if os.path.isfile(value.text): return True else: raise ValidationError( message="File not found", cursor_position=len(value.text)) else: raise ValidationError( message="You can't leave this blank", cursor_position=len(value.text)) class APIKEYValidator(Validator): def validate(self, value): if len(value.text): sg = sendgrid.SendGridAPIClient( api_key=value.text) try: response = sg.client.api_keys._(value.text).get() if response.status_code == 200: return True except: raise ValidationError( message="There is an error with the API Key!", cursor_position=len(value.text)) else: raise ValidationError( message="You can't leave this blank", cursor_position=len(value.text)) def askAPIKEY(): questions = [ { 'type': 'input', 'name': 'api_key', 'message': 'Enter SendGrid API Key (Only needed to provide once)', 'validate': APIKEYValidator, }, ] answers = prompt(questions, style=style) return answers def askEmailInformation(): questions = [ { 'type': 'input', 'name': 'to_email', 'message': 'To Email', 'validate': EmailValidator }, { 'type': 'input', 'name': 'subject', 'message': 'Subject', 'validate': EmptyValidator }, { 'type': 'list', 'name': 'content_type', 'message': 'Content Type:', 'choices': ['Text', 'HTML'], 'filter': lambda val: val.lower() }, { 'type': 'input', 'name': 'content', 'message': 'Enter plain text:', 'when': lambda answers: getContentType(answers, "text"), 'validate': EmptyValidator }, { 'type': 'confirm', 'name': 'confirm_content', 'message': 'Do you want to send an html file', 'when': lambda answers: getContentType(answers, "html") }, { 'type': 'input', 'name': 'content', 'message': 'Enter html:', 'when': lambda answers: not answers.get("confirm_content", True), 'validate': EmptyValidator }, { 'type': 'input', 'name': 'content', 'message': 'Enter html path:', 'validate': FilePathValidator, 'filter': lambda val: open(val).read(), 'when': lambda answers: answers.get("confirm_content", False) }, { 'type': 'confirm', 'name': 'send', 'message': 'Do you want to send now' } ] answers = prompt(questions, style=style) return answers @click.command() def main(): """ Simple CLI for sending emails using SendGrid """ log("Email CLI", color="blue", figlet=True) log("Welcome to Email CLI", "green") mailinfo = askEmailInformation() if __name__ == '__main__': main()
[ "PresentJay@Etri.re.kr" ]
PresentJay@Etri.re.kr
9a135fa65eab479380e7f77a1adde1e20bfc8591
36f6bc738de593e8a76ba2af6715b956c7f72ff7
/yahtzee.py
2ced1a7ee98a0be99f83386649ef629dcab8a779
[]
no_license
jmullen2782/projects
18e0498394763aea5787a892373c463856bb41f5
e28e4e34d61ce1569794db2a5a8a4e2a3620c9d9
refs/heads/master
2020-03-31T00:41:41.934053
2019-05-28T16:44:03
2019-05-28T16:44:03
151,750,534
0
0
null
null
null
null
UTF-8
Python
false
false
545
py
''' Created on May 17, 2019 Yahtzee @author: Jennie Mullen ''' class Die: def __init__(self,v=0): self.__value = v def get_value(self): return self.__value def roll(self): import random self.__value = random.randint(1,6) class Yahtzee: dice_and_value = {} def look_value(self): return self.value def score(self): return self.score def main(): d1 = Die() d1.roll() print(d1.get_value()) main()
[ "noreply@github.com" ]
jmullen2782.noreply@github.com
fc3b48c972172f18bf98f4798900ffb4a3fbd7bd
e1b02eb5d72951f1d75d2e5f056448f8b2db819c
/src/gps_example/catkin_generated/pkg.installspace.context.pc.py
b2c9ce3e13fe2bd4011bec4d2958aa35f6e3125c
[]
no_license
saiprasannasp/octagon
90bdefb4b237695498e09f799979d2fc31786b3e
97028cb25e1c1aee08884d3a0ddfd1f47d1b0381
refs/heads/master
2016-08-09T09:23:29.042610
2015-08-18T22:26:36
2015-08-18T22:26:36
36,534,040
1
0
null
null
null
null
UTF-8
Python
false
false
391
py
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/usr/local/include".split(';') if "/usr/local/include" != "" else [] PROJECT_CATKIN_DEPENDS = "".replace(';', ' ') PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else [] PROJECT_NAME = "gps_example" PROJECT_SPACE_DIR = "/usr/local" PROJECT_VERSION = "0.0.0"
[ "sai.saiprasannasp@gmail.com" ]
sai.saiprasannasp@gmail.com
fbd08ee8691b428de5c46390827b57fc9c07e065
e6dab5aa1754ff13755a1f74a28a201681ab7e1c
/.parts/lib/django-1.2/tests/regressiontests/utils/models.py
0dcfaff5de31a5d8bb7e9cd7ba1702e12031609c
[]
no_license
ronkagan/Euler_1
67679203a9510147320f7c6513eefd391630703e
022633cc298475c4f3fd0c6e2bde4f4728713995
refs/heads/master
2021-01-06T20:45:52.901025
2014-09-06T22:34:16
2014-09-06T22:34:16
23,744,842
0
1
null
null
null
null
UTF-8
Python
false
false
103
py
/home/action/.parts/packages/googleappengine/1.9.4/lib/django-1.2/tests/regressiontests/utils/models.py
[ "ron.y.kagan@gmail.com" ]
ron.y.kagan@gmail.com
541df5959e54195ed1c2396b51f3cb95236a0716
4ee54dd2542c62bae162c75e465ec30c26de5b7b
/updatechannel/mixins.py
43cc4d087827915df41106dfef8a4e31bd7d2b12
[]
no_license
INSRapperswil/async-webservice
e90730025c7ca43b65d949bfc69081a676653e54
785b66709147ede760851b21ec1e1cb76e61dc16
refs/heads/master
2023-08-23T06:27:28.502229
2021-04-20T09:57:20
2021-04-20T09:57:20
271,522,677
0
0
null
2021-09-22T19:23:44
2020-06-11T10:55:26
Python
UTF-8
Python
false
false
1,568
py
from updatechannel.consumers import UpdateChannelConsumer class CreateModelNotifyMixin: """ A mixin for views to announce creation of objects. """ def create(self, request, *args, **kwargs): response = super().create(request, *args, **kwargs) model = self.get_serializer().Meta.model UpdateChannelConsumer.send_update_message({ 'event': 'model-created', 'model': model.__name__, 'data': response.data }) return response class DestroyModelNotifyMixin: """ A mixin for views to announce deletion of objects. """ def destroy(self, request, *args, **kwargs): instance = self.get_object() serializer = self.get_serializer(instance) response = super().destroy(request, *args, **kwargs) UpdateChannelConsumer.send_update_message({ 'event': 'model-deleted', 'model': instance.__class__.__name__, 'data': serializer.data }) return response class UpdateModelNotifyMixin: """ A mixin for views to announce changes of objects. """ def update(self, request, *args, **kwargs): response = super().update(request, *args, **kwargs) model = self.get_serializer().Meta.model UpdateChannelConsumer.send_update_message({ 'event': 'model-updated', 'model': model.__name__, 'data': response.data }) return response class NotifyMixin(CreateModelNotifyMixin, DestroyModelNotifyMixin, UpdateModelNotifyMixin): pass
[ "marc.sommerhalder@ins.hsr.ch" ]
marc.sommerhalder@ins.hsr.ch
02adb78a69b1331eeb4a57c48a79f4d544992bae
e1c93a2b876e0187639c8dd00aa82d3c822ffd08
/Project AI/main.py
9133b93ea1644b5b91bd53417b7a659af74e0661
[]
no_license
luigi25/Parameter-Learning-of-a-Bayesian-Network
9854bb78f541184ca7356bbe2273904c29588601
57997b10e96651cc761542504ab7ae872e686505
refs/heads/master
2022-04-16T07:00:49.808870
2020-04-15T13:43:55
2020-04-15T13:43:55
250,318,715
0
1
null
null
null
null
UTF-8
Python
false
false
1,457
py
from dataset_generator import dataset_gen, probabilities_dataset from BayesianNetwork import BayesianNetwork from jensen_shannon import js_divergence from parameter_learning import learning import matplotlib.pyplot as plt import numpy as np def main(): probabilities = [0.9, 0.1, 0.83, 0.17, 0.2, 0.8, 0.21, 0.79, 0.05, 0.95, 0.8, 0.2, 0.78, 0.22, 0.69, 0.31, 0.05, 0.95, 0.8, 0.2, 0.6, 0.4] adj_matrix = np.array([[0, 1, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) network = BayesianNetwork(5, adj_matrix) nodes = network.nodes prob_dataset = probabilities_dataset(nodes) x = [] y = [] start = 10 end = 5010 attempt = 50 iteration = 100 for n in range(start, end, iteration): x.append(n) z = [] for j in range(attempt): dataset = dataset_gen(n, adj_matrix, nodes, prob_dataset) qn = learning(nodes, dataset, n) divergence = js_divergence(probabilities, qn) z.append(divergence) y.append(sum(z) / attempt) print("x: ", x) print("y: ", y) plt.title("Learning curve of Jensen-Shannon divergence") plt.xlabel("Dimensione del dataset") plt.ylabel("Divergenza tra probabilità e qn") plt.plot(x, y) plt.savefig('Jensen-Shannon divergence.png') plt.clf() if __name__ == '__main__': main()
[ "noreply@github.com" ]
luigi25.noreply@github.com
709fe05a854858f078a7119fb1cf5262533f0ebd
f935033b93b8167b5ec10fce3cd6b61d2d0a2213
/structural/adapter.py
33646f3d69c2f880cc36d74ce4c8b2405d3375b1
[]
no_license
lqminhdev/python-design-patterns
ef87e73020bda05fa34c203e2d113d17de90ca23
a58a03aecf2cb8789b01fe557e8b075b400e1c0d
refs/heads/master
2020-03-22T04:56:35.362655
2018-07-03T07:25:23
2018-07-03T07:25:23
139,531,226
0
0
null
null
null
null
UTF-8
Python
false
false
1,508
py
class Dog(object): def __init__(self): self.name = 'Dog' def bark(self): return 'woof!' class Cat(object): def __init__(self): self.name = 'Cat' def meow(self): return 'meow!' class Human(object): def __init__(self): self.name = 'Human' def speak(self): return 'hello!' class Car(object): def __init__(self): self.name = 'Car' def make_noise(self, octane_level): return 'vroom{0}'.format('!' * octane_level) class Adapter(object): """ Usage: dog = Dog() dog = Adapter(dog, make_noise=dog.bark) """ def __init__(self, obj, **adapted_methods): """We set the adapted methods in the object's dict""" self.obj = obj self.__dict__.update(adapted_methods) def __getattr__(self, attr): """All non-adapted calls are passed to the object""" return getattr(self.obj, attr) def original_dict(self): """Print original object dict""" return self.obj.__dict__ def main(): objects = [] dog = Dog() objects.append(Adapter(dog, make_noise=dog.bark)) cat = Cat() objects.append(Adapter(cat, make_noise=cat.meow)) human = Human() objects.append(Adapter(human, make_noise=human.speak)) car = Car() objects.append(Adapter(car, make_noise=lambda: car.make_noise(3))) for obj in objects: print("A {0} goes {1}".format(obj.name, obj.make_noise())) if __name__ == '__main__': main()
[ "minhlq@adasiaholdings.com" ]
minhlq@adasiaholdings.com
32959ae3cdf30d6bce0eff88ef114150768fb897
058a07bcd258a2578d43bcf3d691db41d6cd9a72
/app.py
cf467311b463864313d2ab5496dc33f9675f554b
[]
no_license
nothene/stroke-prediction-web-interface
9200d98f657748ad6124c452a22a78300d105818
427a61d0a4a365a9ee4560feca61c1f7a33fa9d2
refs/heads/master
2023-04-22T12:11:43.167202
2021-04-21T01:54:05
2021-04-21T01:54:05
359,998,852
0
0
null
null
null
null
UTF-8
Python
false
false
1,022
py
import numpy as np import pandas as pd from flask import Flask, request, jsonify, render_template import pickle import json import sys cat_map = {} with open('cat.json') as file: cat_map = json.load(file) app = Flask(__name__) model = pickle.load(open('gradient.pkl', 'rb')) @app.route('/') def home(): return render_template('index.html') @app.route('/predict', methods=['POST']) def predict(): int_features = [] for i in request.form.values(): if i in cat_map: int_features.append(int(cat_map[i])) else: int_features.append(float(i)) final_features = [np.array(int_features)] prediction = model.predict(final_features) #return render_template('index.html', prediction=prediction) if prediction[0] == 1: return render_template('index.html', prediction="You have stroke!") else: return render_template('index.html', prediction="You don't have stroke, for now") if __name__ == "__main__": app.run(debug=True)
[ "kevin_huang31@yahoo.co.id" ]
kevin_huang31@yahoo.co.id
e02f6ab34ef6899c568fd5e10a814e4265496c2d
b8ab0e1ac2634741a05e5fef583585b597a6cdcf
/wsltools/utils/faker/providers/job/pl_PL/__init__.py
719cc78f62dc09cb90efb008194295eb4c964925
[ "MIT" ]
permissive
Symbo1/wsltools
be99716eac93bfc270a5ef0e47769290827fc0c4
0b6e536fc85c707a1c81f0296c4e91ca835396a1
refs/heads/master
2022-11-06T16:07:50.645753
2020-06-30T13:08:00
2020-06-30T13:08:00
256,140,035
425
34
MIT
2020-04-16T14:10:45
2020-04-16T07:22:21
Python
UTF-8
Python
false
false
5,595
py
# coding=utf-8 from __future__ import unicode_literals from .. import Provider as BaseProvider class Provider(BaseProvider): jobs = [ "Agent celny", "Agent firmy inwestycyjnej", "Agent literacki", "Agent ubezpieczeniowy", "Agronom", "Aktor", "Aktor dziecięcy", "Aktor głosowy", "Aktuariusz", "Animator kultury", "Ankieter", "Antykwariusz", "Arborysta", "Archeolog", "Architekt krajobrazu", "Architekt wnętrz", "Archiwista", "Artysta-rezydent", "Astronom", "Audytor efektywności energetycznej", "Babcia klozetowa", "Bankowiec", "Barista", "Barman", "Bibliotekarz", "Bibliotekarz dyplomowany", "Biegły rewident", "Brakarz", "Broker", "Broker informacji", "Broker ubezpieczeniowy", "Certyfikator energetyczny", "Charakteryzator", "Detektyw", "Deweloper budowlany", "Doker", "Doradca finansowy", "Doradca inwestycyjny", "Doradca podatkowy w Polsce", "Doradca ubezpieczeniowy", "Drwal", "Dubler", "Dyplomata", "Dyrektor artystyczny", "Dyrektor finansowy", "Dyrektor kreatywny", "Dziennikarz", "Dżokej", "Ebenista", "Ekonomista", "Ekwilibrystyka", "Elektromonter pomiarów", "Ergonomista", "Fasowacz", "Finansista", "Fotoreporter", "Geodeta", "Geolog", "Główny księgowy", "Grabarz", "Handlarz", "Hostessa", "Hutnik", "Hycel", "Hydraulik", "Iluzjonista", "Inscenizator", "Instruktor", "Integrator automatyki", "Intendent", "Inżynier", "Inżynier budownictwa", "Kasjer biletowy", "Katecheta", "Kawalkator", "Kawiarka", "Kelner", "Kierowca", "Kiper", "Klechdarz", "Konferansjer", "Koniarze", "Konserwator zabytków", "Konsjerż", "Konstruktor", "Konsultant", "Konsultant ślubny", "Kontroler biletów", "Kornak", "Kosmonauta", "Kostiumograf", "Kosztorysant", "Kowboj", "Krojczy", "Krupier", "Ksiądz", "Księgowy", "Kuk", "Kupiec", "Kurator sądowy", "Kurator sztuki", "Kurier", "Kurier rowerowy", "Lalkarz", "Leśniczy", "Liczmen", "Likwidator szkód", "Listonosz", "Łącznik", "Makler giełd towarowych", "Makler morski", "Makler nadzorujący", "Makler papierów wartościowych", "Marketingowiec", "Marynarz", "Masztalerz", "Menedżer kultury", "Meteorolog", "Mim", "Model", "Modelka dużych rozmiarów", "Motorniczy", "Nadleśniczy", "Nauczyciel", "Nauczyciel akademicki", "Naukowiec", "Niania", "Oceanonauta", "Ochroniarz", "Pakowacz", "Palacz", "Perfumiarz", "Pisarz", "Plastyk", "Podleśniczy", "Poganiacz", "Pokojówka", "Politolog", "Polityk", "Portier", "Pośrednik finansowy", "Pośrednik ubezpieczeniowy", "Pośrednik w obrocie nieruchomościami", "Pracownicy uczelni w Polsce", "Pracownik socjalny", "Prezenter", "Producent wykonawczy", "Projektant gier komputerowych", "Przedstawiciel handlowy", "Przewodnik turystyczny", "Psiarz", "Psycholog", "Pucybut", "Rachmistrz", "Ratownik", "Ratownik przedmedyczny", "Redaktor", "Redaktor merytoryczny", "Redaktor naukowy", "Redaktor techniczny", "Rekwizytor", "Reporter wojenny", "Reżyser", "Robotnik", "Rolnik", "Rybak", "Rzecznik prasowy", "Rzeczoznawca", "Rzeczoznawca budowlany", "Rzeczoznawca majątkowy", "Rzeczoznawca samochodowy", "Salowa", "Satyryk", "Scenarzysta", "Scenograf", "Służący", "Sprzątacz", "Sprzedawca", "Stajenny", "Strażak", "Sufler", "Supermodelka", "Syndyk", "Syndyk licencjonowany", "Szatniarz", "Szczurołap", "Szlifierz", "Sztygar", "Taksówkarz", "Technik awionik", "Technik budownictwa", "Technik elektronik", "Technik handlowiec", "Technik kelner", "Technik mechanik", "Technik mechanik lotniczy", "Technik mechanik okrętowy", "Technik nawigator morski", "Technik ochrony środowiska", "Technik technologii drewna", "Technik weterynarii", "Technik żywienia i gospodarstwa domowego", "Teksturator", "Terapeuta", "Terminolog", "Tłumacz", "Tłumacz literacki", "Tłumacz przysięgły", "Tokarz", "Trener", "Trener personalny", "Urbanista", "Lekarz weterynarii", "Wydawca", "Zarządca nieruchomości", "Zoopsycholog", "Żołnierz", "Żongler", ]
[ "tr3jer@gmail.com" ]
tr3jer@gmail.com
9d559a5a5771f3094b3a8a45fc6859e136beef85
99c4d4a6592fded0e8e59652484ab226ac0bd38c
/code/batch-1/vse-naloge-brez-testov/DN4-M-231.py
4900c7a410567b69e439a7b6c5d4bbd07fa705f3
[]
no_license
benquick123/code-profiling
23e9aa5aecb91753e2f1fecdc3f6d62049a990d5
0d496d649247776d121683d10019ec2a7cba574c
refs/heads/master
2021-10-08T02:53:50.107036
2018-12-06T22:56:38
2018-12-06T22:56:38
126,011,752
0
0
null
null
null
null
UTF-8
Python
false
false
4,396
py
import math ################################ WARM UP FUNCTIONS #################################### ### Function gives back coordinates of the city we choose. def koordinate(ime, kraji): for imena in kraji: for data in imena: if ime == data: return imena[1], imena[2] ### Function gives back distance between coordinates of two points. def razdalja_koordinat(x1, y1, x2, y2): distance = abs(math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)) return distance ### Function gives back distance between two cities that we choose. def razdalja(ime1, ime2, kraji): ### Function uses previous function "koordinate" to provide coordinates of chosen cities. koordinate1 = koordinate(ime1, kraji) koordinate2 = koordinate(ime2, kraji) ### When we have coordinates of cities we can use previous function "razdalja_koordinat" to calculate distance between chosen cities. distance = razdalja_koordinat(koordinate1[0], koordinate1[1], koordinate2[0], koordinate2[1]) return distance ################################ OBLIGATORY FUNCTIONS #################################### ### Function gives back list of cities that chosen city can water with selected range. def v_dometu(ime, domet, kraji): seznam = [] for imena in kraji: ### We make sure that teh city will not try to water itself. if imena[0] != ime: ### We use previous function "razdalja" to calculate distances of each city in the dictionary. distance = razdalja(ime, imena[0], kraji) ### If distance is in selected range, we append city to the list that this function will return. if distance <= domet: seznam.append(imena[0]) return seznam ### Function gives back the name of the city with maximum distance from the selected list of cities in relation to chosen city, def najbolj_oddaljeni(ime, imena, kraji): ### We set the starting point of maximum distance to 0 and name to none, so we can replace them later with calculated values. maksimum = 0 oddaljen_kraj = None ### In selected list of cities we calculate the distance of each in relation to the chosen city using previous function "razdalja". for data in imena: distance = razdalja(ime, data, kraji) ### If calculated distance is bigger than selected maximum, we replace the value of maximum with bigger distance and name with the name of the city that has bigger value. if distance > maksimum: maksimum = distance oddaljen_kraj = data return oddaljen_kraj ### Function gives back name of most distant city that a chosen city with selected range can water. def zalijemo(ime, domet, kraji): ### We set the starting point of maximum distance to 0 and name to none, so we can replace them later with calculated values. maksimum = 0 oddaljen_kraj = None ### We determine cities in the selected range of chosen cities with previous function "v_dometu". domet = v_dometu(ime, domet, kraji) ### For each city in selected range we calculate distance from chosen city with previous function "razdalja". for izbrani in domet: distance = razdalja(ime, izbrani, kraji) ### If calculated distance is bigger than selected maximum, we replace the value of maximum with bigger distance and name with the name of the city that has bigger value. if distance > maksimum: maksimum = distance oddaljen_kraj = izbrani return oddaljen_kraj ################################ EXTRA FUNCTIONS #################################### ### Function gives back list of elements that are appearing in both of chosen lists. def presek(s1, s2): seznam = [] for elements in s1: if elements in s2: seznam.append(elements) return seznam ### Function gives back list of cities that can be watered by both of chosen cities with selected range. def skupno_zalivanje(ime1, ime2, domet, kraji): ### We determine cities in the selected range of chosen cities with previous function "v_dometu". domet1 = v_dometu(ime1, domet, kraji) domet2 = v_dometu(ime2, domet, kraji) ### We use previous function "presek" to determine cities that are in range of the first chosen city as of the second chosen city. skupaj = presek(domet1, domet2) return skupaj ################################ UNITTEST ####################################
[ "lenart.motnikar@gmail.com" ]
lenart.motnikar@gmail.com
645909e49a98a779401792630d47737e27a5d5c7
c92c0d92bac73ac54fbb30395f8f9ef6b41b20a8
/attemptlogin/keystone_counter.py
37666a04b71ea146c72e7973b15693ff4b2dd823
[]
no_license
DonnieQ/Randall_PythonCodeSDE
9876272ea2d770f21a0179046fa1847178066d2f
1b87f840a77b1950bcaed0e3572f0de02cad2fcf
refs/heads/main
2023-02-18T07:23:31.220691
2021-01-15T19:58:01
2021-01-15T19:58:01
326,742,763
0
0
null
null
null
null
UTF-8
Python
false
false
685
py
#!/usr/bin/python3 # parse keystone.common.wsgi and return number of failed login attempts loginfail = 0 # counter for fails # open the file for reading keystone_file = open("/home/student/Randall_PythonCodeSDE/attemptlogin/keystone.common.wsgi","r") # turn the file into a list of lines in memory keystone_file_lines=keystone_file.readlines() # loop over the list of lines for line in keystone_file_lines: # if this 'fail pattern' appears in the line... if "- - - - -] Authorization failed" in line: loginfail += 1 # this is the same as loginfail = loginfail + 1 print("The number of failed log in attempts is", loginfail) keystone_file.close() # close the open file
[ "rwade727@gmail.com" ]
rwade727@gmail.com
c0a5b30451404feb6e507cb09220b1771b8859d6
afc19d77eb5423df5b16d24039bff53f381ae628
/dev/apps.py
1dec1bb8e8b5a116e547aa616f7f88e0bb8aab44
[]
no_license
Rsingh2805/BootCampIITR
26a61c7388a30743e16296ff51c9c67a81828f89
4e17dcadb99bc7504d5f2949bd1887ebf01b2e82
refs/heads/master
2021-08-07T22:51:38.332625
2017-11-09T04:59:31
2017-11-09T04:59:31
106,817,773
4
1
null
2017-10-30T07:23:31
2017-10-13T11:47:43
Python
UTF-8
Python
false
false
146
py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.apps import AppConfig class DevConfig(AppConfig): name = 'dev'
[ "rs280599@gmail.com" ]
rs280599@gmail.com
624bd7a4deb3b31e6510371e0799339704ba622f
aa4cf458d23409cdf0be219c05fc31e61fa38593
/djangogirls/wsgi.py
f33604220809ca4421f7ec0941ec27f7de3e84a1
[]
no_license
Jantz021991/djangoGirls
35f8628195e9cb3061c86dcb32f946b0b30854b7
2ab1cb1c2316e267e40740ae69fcee9c04019112
refs/heads/master
2022-12-18T01:15:36.613846
2018-04-02T04:45:23
2018-04-02T04:45:23
127,495,573
1
0
null
2022-12-08T00:51:31
2018-03-31T03:30:43
Python
UTF-8
Python
false
false
546
py
""" WSGI config for djangogirls project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application from django.core.wsgi import get_wsgi_application from whitenoise.django import DjangoWhiteNoise os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djangogirls.settings") application = get_wsgi_application() application = DjangoWhiteNoise(application)
[ "djantz@unomaha.edu" ]
djantz@unomaha.edu
8a37855a595a2977091199954cab2c10d933a1fc
ba3c06f9ae89479fa4987fe841ac09b5b5d71383
/python_for_kids/book/Examples/lotto2.py
fed297d6c381e0e5ae3defaf06ef766695560466
[]
no_license
mary-tano/python-programming
6d806e25011e770a04a0922d0b71bf38c222d026
829654a3274be939fa529ed94ea568c12f7f1a27
refs/heads/master
2021-05-17T15:30:32.710838
2020-04-01T13:37:18
2020-04-01T13:37:18
250,846,188
0
0
null
null
null
null
UTF-8
Python
false
false
494
py
# Лото import random Ball = [] # Все шары еще не "вытащены" for Nr in range(1,50) : Ball.append(0) Case = random.randint(1,49) # "Вытягивается" шесть шаров for Nr in range(6) : # поиск неиспользованных шаров while Ball[Case] == 1 : Case = random.randint(1,49) # Пометка использованного шара "вытащенным" Ball[Case] = 1 print("№ " + str(Nr+1) + " => " + str(Case))
[ "masha.mary.tano@gmail.com" ]
masha.mary.tano@gmail.com
e40eddbfe174f0c3f3d6e09c9525863a77f9a334
e8d13ea933bf004adff9c8a06619feeab109883e
/Ecommerce/wsgi.py
3b88e7f619f66bdc51cc18286e9f3e16482964e3
[]
no_license
AaronDasani/Ecommerce
984fc25060528aee5290def42955803ccad7a375
9e3952865fddb053fc5f627487ad5c71af6e83bb
refs/heads/master
2022-12-08T17:03:01.387326
2019-02-13T20:51:53
2019-02-13T20:51:53
166,871,712
2
0
null
2022-11-22T03:24:06
2019-01-21T19:54:39
HTML
UTF-8
Python
false
false
396
py
""" WSGI config for Ecommerce project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Ecommerce.settings") application = get_wsgi_application()
[ "aaron.mike2406@gmail.com" ]
aaron.mike2406@gmail.com
71a547516f79998fb726804bac2cfca94955988d
15f321878face2af9317363c5f6de1e5ddd9b749
/solutions_python/Problem_136/2046.py
18fd5baede0be2e49e8d3c5f3e0abc6881d0f3b4
[]
no_license
dr-dos-ok/Code_Jam_Webscraper
c06fd59870842664cd79c41eb460a09553e1c80a
26a35bf114a3aa30fc4c677ef069d95f41665cc0
refs/heads/master
2020-04-06T08:17:40.938460
2018-10-14T10:12:47
2018-10-14T10:12:47
null
0
0
null
null
null
null
UTF-8
Python
false
false
826
py
#!/usr/bin/python def main(): fin = open('B-large.in','r') fout = open('B-large-practice.out','w') test_cases = int(fin.readline()) for test_case in xrange(test_cases): win = 0 cfx = fin.readline().split() [C,F,X] = [float(num) for num in cfx] rate = 2.0 cookie = 0.0 time = 0.0 while(not win): decision = decide(C,X,F,rate,time) # print decision if decision == 'dont_buy': time = time+(X/rate) win = 1 else: time = time + (C/rate) rate = rate + F # print time,rate fout.write("Case #%d: %.7f\n"%(test_case+1,time)) fin.close() fout.close() def decide(c,x,f,rate,time): time = 0.0 if (c/rate)+(x/(rate+f))<(time+(x/rate)): return 'buy' else: return 'dont_buy' if __name__ == '__main__': main()
[ "miliar1732@gmail.com" ]
miliar1732@gmail.com
ce6d60c24b1d6975a2e06797a4c029d6dea5b576
89438f70dcad92b76ff1609e3ae587c53a837f80
/Python/Problem28/Problem 28.py
0579cc29e78c2946eeac9954fb679d65b7c7bf65
[]
no_license
TannerLow/Project-Euler-Solutions
78877987b496d30c7845c3010cc99ce95dc8afa2
ffa6a349006d3e2de84b2cd70a565dd0a5196294
refs/heads/master
2020-04-28T02:35:16.956799
2019-11-10T21:34:45
2019-11-10T21:34:45
174,904,457
0
0
null
null
null
null
UTF-8
Python
false
false
213
py
import time start_time = time.time() sum = 1 for x in range(1,501): sum += (2*x+1)**2 sum += ((2*x+1)**2 - 6*x) sum += ((2*x+1)**2 - 4*x) sum += ((2*x+1)**2 - 2*x) print(sum) print(time.time() - start_time)
[ "lowthorpt@gmail.com" ]
lowthorpt@gmail.com
2745ceb8bb2985639715d688754e8b72c6867554
fd2c8d2530a0905dce4316f5136f658b248249a0
/src/classify_reads.py
39c3cd77a88a7ba6f9d363a130ccc8733eaac9ce
[]
no_license
chengdai/amr_pipeline
ddd31d041faaacbe05b258deaff8461a521b76df
677b2d538384a1fe44b56aa0a79ff7efad0321a6
refs/heads/master
2020-03-16T23:13:11.649229
2018-12-17T20:35:18
2018-12-17T20:35:18
133,069,588
0
0
null
null
null
null
UTF-8
Python
false
false
2,610
py
import glob import os import subprocess import argparse '''NOTE: When in doubt, call "python [FILENAME.py] -h" to get a description of the necessary parameters''' def classify_reads(f, centrifuge, db, threads, out_path): print 'Finding taxonomic composition for file: {0}'.format(f.split('/')[-1]) fastq_read_1 = f + '_quality_controlled_paired_1.fastq.gz' fastq_read_2 = f + '_quality_controlled_paired_2.fastq.gz' fastq_unpaired_1 = f + '_quality_controlled_unmatched_1.fastq.gz' fastq_unpaired_2 = f + '_quality_controlled_unmatched_2.fastq.gz' classification_out_file = out_path + f.split('/')[-1] + '_classification.txt' report_out_file = out_path + f.split('/')[-1] + '_report.tsv' centrifuge_kreport = centrifuge + '-kreport' kreport_out_file = out_path + f.split('/')[-1] + '_kreport.txt' command = '{0} -x {1} -1 {2} -2 {3} -U {4},{5} -S {6} --report-file {7} -q -p {8} && {9} -x {1} {6} > {10} && pigz -p {8} --best {6}'.format(centrifuge, db, fastq_read_1, fastq_read_2, fastq_unpaired_1, fastq_unpaired_2, classification_out_file, report_out_file, threads, centrifuge_kreport, kreport_out_file) final = subprocess.Popen(command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True) (stdout, stderr) = final.communicate() print stdout print stderr def main(): # Get arguments parser = argparse.ArgumentParser(description='Specify arguments for centrifuge classification of reads.') parser.add_argument('--fastq_folder', help='path to folder containing quality controlled fastq files') parser.add_argument('--indexed_db', help='path to basename of the index for the reference genomes') parser.add_argument('--out', help='folder for all centrifge output files') parser.add_argument('--centrifuge', default='centrifuge', help='path to centrifuge software') parser.add_argument('--threads', default= 1.0, help='number threads to use for alignment') args = parser.parse_args() #Get all fastq file in folder (NOTE: fastq files should be QC'ed) fastq_folder = args.fastq_folder files = set([f.split('_quality_controlled_')[0] for f in glob.glob(fastq_folder + '*.fastq*')]) out_path = args.out #centrifuge parameters db = args.indexed_db centrifuge = args.centrifuge threads = args.threads for file_prefix in files: classify_reads(file_prefix, centrifuge, db, threads, out_path) main()
[ "chengzhendai@gmail.com" ]
chengzhendai@gmail.com
231a5a25a80b090e60ab3c6522e2717ddce20db9
137b60bdec1aeb865f8f7f85107be1a88e4e7472
/plant_nursery/models/__init__.py
3f4798233587df54ea747cc55dbd67859c65a51b
[]
no_license
HabibAroua/odoo_training2
7db3b26fdca21b7102db65147fbb40432f9afb88
cc1008be6cbc8306dceb95432e8a50902d0fb12c
refs/heads/master
2022-04-24T05:09:19.389561
2020-04-27T15:28:20
2020-04-27T15:28:20
240,235,477
0
0
null
null
null
null
UTF-8
Python
false
false
62
py
from . import customer from . import order from . import plant
[ "habibha.aroua82@gmail.com" ]
habibha.aroua82@gmail.com
cd9ffc5f7f152c218a7c4c78700f66b7c5e2a020
f80b952de024913ba42d9e2f8a1c1e65734bb71a
/characters.py
7e71c4da3aae0ce6e05519ca20ca959796649485
[]
no_license
Python-lab-cycle/ThasniPK
760fde2a13c24f9c8de332c08f5302942b9fdde0
f0b951d3a62a8592d89797e0a26d6c86ca108181
refs/heads/main
2023-06-16T03:55:34.378344
2021-07-02T10:10:49
2021-07-02T10:10:49
330,555,889
0
0
null
null
null
null
UTF-8
Python
false
false
197
py
dict={} str1=input("enter a string:") for n in str1: if n in dict: dict[n]+=1 else: dict[n]=1 print("character frequency") for k,v in dict.items(): print(k,v)
[ "noreply@github.com" ]
Python-lab-cycle.noreply@github.com
ed17f61ed7c21250dc61923916a3569483570fb2
17ea6c9fb83a1b78319eb9578dccf2ddeb7a5a9c
/src/the_counter/migrations/0001_initial.py
846d00a0a3559f6add2ffeccc0f19e0e1183d101
[]
no_license
LIFA-0808/BudgetCounter-DjangoApp
bd736f3586e1357d50e08dc21c18f96604e5568e
d4e8febfc272d256dac314947d06a0915ff61e26
refs/heads/master
2022-08-29T04:48:33.978538
2020-05-29T18:51:52
2020-05-29T18:51:52
262,847,224
0
1
null
null
null
null
UTF-8
Python
false
false
1,135
py
# Generated by Django 3.0.6 on 2020-05-10 18:02 import datetime from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Record', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('budget_item', models.CharField(choices=[('income', 'Текущие доходы'), ('expenses', 'Текущие расходы'), ('wish_list', 'Лист желаний')], default='income', max_length=9, verbose_name='Статья бюджета')), ('money', models.FloatField(verbose_name='Размер')), ('item_description', models.CharField(max_length=200, verbose_name='Описание')), ('date_added', models.DateField(default=datetime.date.today, verbose_name='Дата')), ], options={ 'verbose_name': 'Запись', 'verbose_name_plural': 'Записи', }, ), ]
[ "iramilka123@gmail.com" ]
iramilka123@gmail.com
95ca0ee32f8ed449eec3633ae8dc06658de5473c
f33b30743110532ddae286ba1b34993e61669ab7
/Task Scheduler.py
242eb056eb4d8ce1d4be0f90116b904c570ba218
[]
no_license
c940606/leetcode
fe9dcee7a5daa4d52999d5f53253dd6dd33c348b
631df2ce6892a6fbb3e435f57e90d85f8200d125
refs/heads/master
2021-07-10T14:01:26.164966
2020-08-16T10:46:16
2020-08-16T10:46:16
186,588,449
3
0
null
null
null
null
UTF-8
Python
false
false
1,647
py
from collections import Counter class Solution(object): def leastInterval(self, tasks, n): """ 给定一个用字符数组表示的 CPU 需要执行的任务列表。 其中包含使用大写的 A - Z 字母表示的26 种不同种类的任务。任务可以以任意顺序执行, 并且每个任务都可以在 1 个单位时间内执行完。CPU 在任何一个单位时间内都可以执行一个任务,或者在待命状态。 然而,两个相同种类的任务之间必须有长度为 n 的冷却时间,因此至少有连续 n 个单位时间内 CPU 在执行不同的任务,或者在待命状态。 你需要计算完成所有任务所需要的最短时间。 --- 输入: tasks = ["A","A","A","B","B","B"], n = 2 输出: 8 执行顺序: A -> B -> (待命) -> A -> B -> (待命) -> A -> B. -- 思路: 数学规律 1.找到 任务最多的 2. 分组 每组个数(n+1)*最多任务个数 最后一组除外 3. 最后一组 任务肯定都是最多任务个数一样 :type tasks: List[str] :type n: int :rtype: int """ if not tasks: return 0 c = Counter(tasks) print(list(c.values())) c = sorted(c.items(),key=lambda x:x[1],reverse=True) print(c) max_num = c[0][1] count = 0 for item in c: if item[1] == max_num: count += 1 else: break return (n+1)*(max_num-1) + count def leastInterval1(self, tasks, n): c = Counter(tasks) c = list(c.values()) max_num = max(c) count = c.count(max_num) return max(len(tasks),(n+1)*(max_num-1) + count) a = Solution() print(a.leastInterval1(tasks = ["A","A","A","A","A","A","B","C","D","E","F","G"], n = 2))
[ "762307667@qq.com" ]
762307667@qq.com
821d2627c4102f6899b298e8655bdf34068703f2
35854414ad6bb60b8db6cc69b6e9054b2ea0a3d9
/src/libs/constants.py
5abf9c65c4b3f6d363f89dc8f8e33fd209043c00
[ "MIT" ]
permissive
TalalMahmoodChaudhry/FastAPI-Postgres-Kubernetes
84f4fdca825c08c8f1c71af059d5beeee87b1266
32f5332eb3284201945908a693b106def5767049
refs/heads/main
2023-06-08T11:18:21.047380
2021-06-10T07:44:26
2021-06-10T07:44:26
372,060,147
0
0
null
null
null
null
UTF-8
Python
false
false
643
py
import os # Sensitive secrets injected as env variable (e.g. through Kubernetes secrets or retrieved from vault) DATABASE_URL = os.environ['DATABASE_URL'] SECRET_KEY = os.getenv('SECRET_KEY', 'de4d36b1c5605f70c8aab59216e4261ad8b984b75e23b978c07c22bedc14215e') ALGORITHM = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES = 30 username = 'talal' name = 'Talal Mahmood Chaudhry' email = 'talalmahmood@example.com' fake_users_db = { username: { 'username': username, 'full_name': name, 'email': email, 'hashed_password': '$2b$12$6q.fUkNAab6oqULb1uS8VO.zfpXQbcpEjxYhyR7QEXdafx9fKt7Km', 'disabled': False, }, }
[ "talalmahmood@gmail.com" ]
talalmahmood@gmail.com
0357d900cd341755828a42edc5f1b37fb7abcd83
555b9f764d9bca5232360979460bc35c2f5ad424
/google/ads/google_ads/v1/proto/common/metrics_pb2.py
f013b2668da6c4e30499e209598700d9ac72048a
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
juanmacugat/google-ads-python
b50256163782bc0223bcd8b29f789d74f4cfad05
0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a
refs/heads/master
2021-02-18T17:00:22.067673
2020-03-05T16:13:57
2020-03-05T16:13:57
245,215,877
1
0
Apache-2.0
2020-03-05T16:39:34
2020-03-05T16:39:33
null
UTF-8
Python
false
true
95,551
py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/ads/googleads_v1/proto/common/metrics.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() from google.ads.google_ads.v1.proto.enums import interaction_event_type_pb2 as google_dot_ads_dot_googleads__v1_dot_proto_dot_enums_dot_interaction__event__type__pb2 from google.ads.google_ads.v1.proto.enums import quality_score_bucket_pb2 as google_dot_ads_dot_googleads__v1_dot_proto_dot_enums_dot_quality__score__bucket__pb2 from google.protobuf import wrappers_pb2 as google_dot_protobuf_dot_wrappers__pb2 from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 DESCRIPTOR = _descriptor.FileDescriptor( name='google/ads/googleads_v1/proto/common/metrics.proto', package='google.ads.googleads.v1.common', syntax='proto3', serialized_options=_b('\n\"com.google.ads.googleads.v1.commonB\014MetricsProtoP\001ZDgoogle.golang.org/genproto/googleapis/ads/googleads/v1/common;common\242\002\003GAA\252\002\036Google.Ads.GoogleAds.V1.Common\312\002\036Google\\Ads\\GoogleAds\\V1\\Common\352\002\"Google::Ads::GoogleAds::V1::Common'), serialized_pb=_b('\n2google/ads/googleads_v1/proto/common/metrics.proto\x12\x1egoogle.ads.googleads.v1.common\x1a@google/ads/googleads_v1/proto/enums/interaction_event_type.proto\x1a>google/ads/googleads_v1/proto/enums/quality_score_bucket.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x1cgoogle/api/annotations.proto\"\xb3\x39\n\x07Metrics\x12H\n\"absolute_top_impression_percentage\x18_ \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x35\n\x0f\x61\x63tive_view_cpm\x18\x01 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x35\n\x0f\x61\x63tive_view_ctr\x18O \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12<\n\x17\x61\x63tive_view_impressions\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12?\n\x19\x61\x63tive_view_measurability\x18` \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12G\n\"active_view_measurable_cost_micros\x18\x03 \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12G\n\"active_view_measurable_impressions\x18\x04 \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12=\n\x17\x61\x63tive_view_viewability\x18\x61 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12L\n&all_conversions_from_interactions_rate\x18\x41 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12;\n\x15\x61ll_conversions_value\x18\x42 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x35\n\x0f\x61ll_conversions\x18\x07 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x44\n\x1e\x61ll_conversions_value_per_cost\x18> \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12H\n\"all_conversions_from_click_to_call\x18v \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x45\n\x1f\x61ll_conversions_from_directions\x18w \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12]\n7all_conversions_from_interactions_value_per_interaction\x18\x43 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12?\n\x19\x61ll_conversions_from_menu\x18x \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12@\n\x1a\x61ll_conversions_from_order\x18y \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12K\n%all_conversions_from_other_engagement\x18z \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x46\n all_conversions_from_store_visit\x18{ \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12H\n\"all_conversions_from_store_website\x18| \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x32\n\x0c\x61verage_cost\x18\x08 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x31\n\x0b\x61verage_cpc\x18\t \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x31\n\x0b\x61verage_cpe\x18\x62 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x31\n\x0b\x61verage_cpm\x18\n \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x31\n\x0b\x61verage_cpv\x18\x0b \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x37\n\x11\x61verage_frequency\x18\x0c \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x38\n\x12\x61verage_page_views\x18\x63 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x36\n\x10\x61verage_position\x18\r \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12:\n\x14\x61verage_time_on_site\x18T \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12?\n\x19\x62\x65nchmark_average_max_cpc\x18\x0e \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x33\n\rbenchmark_ctr\x18M \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x31\n\x0b\x62ounce_rate\x18\x0f \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12+\n\x06\x63licks\x18\x13 \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12\x34\n\x0f\x63ombined_clicks\x18s \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12?\n\x19\x63ombined_clicks_per_query\x18t \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x35\n\x10\x63ombined_queries\x18u \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12J\n$content_budget_lost_impression_share\x18\x14 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12>\n\x18\x63ontent_impression_share\x18\x15 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12P\n*conversion_last_received_request_date_time\x18I \x01(\x0b\x32\x1c.google.protobuf.StringValue\x12\x45\n\x1f\x63onversion_last_conversion_date\x18J \x01(\x0b\x32\x1c.google.protobuf.StringValue\x12H\n\"content_rank_lost_impression_share\x18\x16 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12H\n\"conversions_from_interactions_rate\x18\x45 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x37\n\x11\x63onversions_value\x18\x46 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12@\n\x1a\x63onversions_value_per_cost\x18G \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12Y\n3conversions_from_interactions_value_per_interaction\x18H \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x31\n\x0b\x63onversions\x18\x19 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x30\n\x0b\x63ost_micros\x18\x1a \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12>\n\x18\x63ost_per_all_conversions\x18\x44 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x39\n\x13\x63ost_per_conversion\x18\x1c \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12R\n,cost_per_current_model_attributed_conversion\x18j \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12>\n\x18\x63ross_device_conversions\x18\x1d \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12)\n\x03\x63tr\x18\x1e \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12J\n$current_model_attributed_conversions\x18\x65 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x61\n;current_model_attributed_conversions_from_interactions_rate\x18\x66 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12r\nLcurrent_model_attributed_conversions_from_interactions_value_per_interaction\x18g \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12P\n*current_model_attributed_conversions_value\x18h \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12Y\n3current_model_attributed_conversions_value_per_cost\x18i \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x35\n\x0f\x65ngagement_rate\x18\x1f \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x30\n\x0b\x65ngagements\x18 \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12\x45\n\x1fhotel_average_lead_value_micros\x18K \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12s\n!historical_creative_quality_score\x18P \x01(\x0e\x32H.google.ads.googleads.v1.enums.QualityScoreBucketEnum.QualityScoreBucket\x12w\n%historical_landing_page_quality_score\x18Q \x01(\x0e\x32H.google.ads.googleads.v1.enums.QualityScoreBucketEnum.QualityScoreBucket\x12=\n\x18historical_quality_score\x18R \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12q\n\x1fhistorical_search_predicted_ctr\x18S \x01(\x0e\x32H.google.ads.googleads.v1.enums.QualityScoreBucketEnum.QualityScoreBucket\x12\x33\n\x0egmail_forwards\x18U \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12\x30\n\x0bgmail_saves\x18V \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12;\n\x16gmail_secondary_clicks\x18W \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12\x35\n\x10impression_reach\x18$ \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12\x41\n\x1cimpressions_from_store_reach\x18} \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12\x30\n\x0bimpressions\x18% \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12\x36\n\x10interaction_rate\x18& \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x31\n\x0cinteractions\x18\' \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12m\n\x17interaction_event_types\x18\x64 \x03(\x0e\x32L.google.ads.googleads.v1.enums.InteractionEventTypeEnum.InteractionEventType\x12\x38\n\x12invalid_click_rate\x18( \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x33\n\x0einvalid_clicks\x18) \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12G\n!mobile_friendly_clicks_percentage\x18m \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x33\n\x0eorganic_clicks\x18n \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12>\n\x18organic_clicks_per_query\x18o \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x38\n\x13organic_impressions\x18p \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12\x43\n\x1dorganic_impressions_per_query\x18q \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x34\n\x0forganic_queries\x18r \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12:\n\x14percent_new_visitors\x18* \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x30\n\x0bphone_calls\x18+ \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12\x36\n\x11phone_impressions\x18, \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12\x38\n\x12phone_through_rate\x18- \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x32\n\x0crelative_ctr\x18. \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12J\n$search_absolute_top_impression_share\x18N \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12V\n0search_budget_lost_absolute_top_impression_share\x18X \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12I\n#search_budget_lost_impression_share\x18/ \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12M\n\'search_budget_lost_top_impression_share\x18Y \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x38\n\x12search_click_share\x18\x30 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12I\n#search_exact_match_impression_share\x18\x31 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12=\n\x17search_impression_share\x18\x32 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12T\n.search_rank_lost_absolute_top_impression_share\x18Z \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12G\n!search_rank_lost_impression_share\x18\x33 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12K\n%search_rank_lost_top_impression_share\x18[ \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x41\n\x1bsearch_top_impression_share\x18\\ \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x30\n\x0bspeed_score\x18k \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12?\n\x19top_impression_percentage\x18] \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12V\n0valid_accelerated_mobile_pages_clicks_percentage\x18l \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12?\n\x19value_per_all_conversions\x18\x34 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12:\n\x14value_per_conversion\x18\x35 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12S\n-value_per_current_model_attributed_conversion\x18^ \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12=\n\x17video_quartile_100_rate\x18\x36 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12<\n\x16video_quartile_25_rate\x18\x37 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12<\n\x16video_quartile_50_rate\x18\x38 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12<\n\x16video_quartile_75_rate\x18\x39 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x35\n\x0fvideo_view_rate\x18: \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x30\n\x0bvideo_views\x18; \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12=\n\x18view_through_conversions\x18< \x01(\x0b\x32\x1b.google.protobuf.Int64ValueB\xe7\x01\n\"com.google.ads.googleads.v1.commonB\x0cMetricsProtoP\x01ZDgoogle.golang.org/genproto/googleapis/ads/googleads/v1/common;common\xa2\x02\x03GAA\xaa\x02\x1eGoogle.Ads.GoogleAds.V1.Common\xca\x02\x1eGoogle\\Ads\\GoogleAds\\V1\\Common\xea\x02\"Google::Ads::GoogleAds::V1::Commonb\x06proto3') , dependencies=[google_dot_ads_dot_googleads__v1_dot_proto_dot_enums_dot_interaction__event__type__pb2.DESCRIPTOR,google_dot_ads_dot_googleads__v1_dot_proto_dot_enums_dot_quality__score__bucket__pb2.DESCRIPTOR,google_dot_protobuf_dot_wrappers__pb2.DESCRIPTOR,google_dot_api_dot_annotations__pb2.DESCRIPTOR,]) _METRICS = _descriptor.Descriptor( name='Metrics', full_name='google.ads.googleads.v1.common.Metrics', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='absolute_top_impression_percentage', full_name='google.ads.googleads.v1.common.Metrics.absolute_top_impression_percentage', index=0, number=95, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='active_view_cpm', full_name='google.ads.googleads.v1.common.Metrics.active_view_cpm', index=1, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='active_view_ctr', full_name='google.ads.googleads.v1.common.Metrics.active_view_ctr', index=2, number=79, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='active_view_impressions', full_name='google.ads.googleads.v1.common.Metrics.active_view_impressions', index=3, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='active_view_measurability', full_name='google.ads.googleads.v1.common.Metrics.active_view_measurability', index=4, number=96, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='active_view_measurable_cost_micros', full_name='google.ads.googleads.v1.common.Metrics.active_view_measurable_cost_micros', index=5, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='active_view_measurable_impressions', full_name='google.ads.googleads.v1.common.Metrics.active_view_measurable_impressions', index=6, number=4, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='active_view_viewability', full_name='google.ads.googleads.v1.common.Metrics.active_view_viewability', index=7, number=97, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='all_conversions_from_interactions_rate', full_name='google.ads.googleads.v1.common.Metrics.all_conversions_from_interactions_rate', index=8, number=65, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='all_conversions_value', full_name='google.ads.googleads.v1.common.Metrics.all_conversions_value', index=9, number=66, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='all_conversions', full_name='google.ads.googleads.v1.common.Metrics.all_conversions', index=10, number=7, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='all_conversions_value_per_cost', full_name='google.ads.googleads.v1.common.Metrics.all_conversions_value_per_cost', index=11, number=62, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='all_conversions_from_click_to_call', full_name='google.ads.googleads.v1.common.Metrics.all_conversions_from_click_to_call', index=12, number=118, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='all_conversions_from_directions', full_name='google.ads.googleads.v1.common.Metrics.all_conversions_from_directions', index=13, number=119, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='all_conversions_from_interactions_value_per_interaction', full_name='google.ads.googleads.v1.common.Metrics.all_conversions_from_interactions_value_per_interaction', index=14, number=67, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='all_conversions_from_menu', full_name='google.ads.googleads.v1.common.Metrics.all_conversions_from_menu', index=15, number=120, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='all_conversions_from_order', full_name='google.ads.googleads.v1.common.Metrics.all_conversions_from_order', index=16, number=121, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='all_conversions_from_other_engagement', full_name='google.ads.googleads.v1.common.Metrics.all_conversions_from_other_engagement', index=17, number=122, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='all_conversions_from_store_visit', full_name='google.ads.googleads.v1.common.Metrics.all_conversions_from_store_visit', index=18, number=123, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='all_conversions_from_store_website', full_name='google.ads.googleads.v1.common.Metrics.all_conversions_from_store_website', index=19, number=124, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='average_cost', full_name='google.ads.googleads.v1.common.Metrics.average_cost', index=20, number=8, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='average_cpc', full_name='google.ads.googleads.v1.common.Metrics.average_cpc', index=21, number=9, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='average_cpe', full_name='google.ads.googleads.v1.common.Metrics.average_cpe', index=22, number=98, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='average_cpm', full_name='google.ads.googleads.v1.common.Metrics.average_cpm', index=23, number=10, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='average_cpv', full_name='google.ads.googleads.v1.common.Metrics.average_cpv', index=24, number=11, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='average_frequency', full_name='google.ads.googleads.v1.common.Metrics.average_frequency', index=25, number=12, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='average_page_views', full_name='google.ads.googleads.v1.common.Metrics.average_page_views', index=26, number=99, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='average_position', full_name='google.ads.googleads.v1.common.Metrics.average_position', index=27, number=13, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='average_time_on_site', full_name='google.ads.googleads.v1.common.Metrics.average_time_on_site', index=28, number=84, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='benchmark_average_max_cpc', full_name='google.ads.googleads.v1.common.Metrics.benchmark_average_max_cpc', index=29, number=14, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='benchmark_ctr', full_name='google.ads.googleads.v1.common.Metrics.benchmark_ctr', index=30, number=77, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='bounce_rate', full_name='google.ads.googleads.v1.common.Metrics.bounce_rate', index=31, number=15, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='clicks', full_name='google.ads.googleads.v1.common.Metrics.clicks', index=32, number=19, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='combined_clicks', full_name='google.ads.googleads.v1.common.Metrics.combined_clicks', index=33, number=115, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='combined_clicks_per_query', full_name='google.ads.googleads.v1.common.Metrics.combined_clicks_per_query', index=34, number=116, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='combined_queries', full_name='google.ads.googleads.v1.common.Metrics.combined_queries', index=35, number=117, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='content_budget_lost_impression_share', full_name='google.ads.googleads.v1.common.Metrics.content_budget_lost_impression_share', index=36, number=20, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='content_impression_share', full_name='google.ads.googleads.v1.common.Metrics.content_impression_share', index=37, number=21, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='conversion_last_received_request_date_time', full_name='google.ads.googleads.v1.common.Metrics.conversion_last_received_request_date_time', index=38, number=73, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='conversion_last_conversion_date', full_name='google.ads.googleads.v1.common.Metrics.conversion_last_conversion_date', index=39, number=74, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='content_rank_lost_impression_share', full_name='google.ads.googleads.v1.common.Metrics.content_rank_lost_impression_share', index=40, number=22, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='conversions_from_interactions_rate', full_name='google.ads.googleads.v1.common.Metrics.conversions_from_interactions_rate', index=41, number=69, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='conversions_value', full_name='google.ads.googleads.v1.common.Metrics.conversions_value', index=42, number=70, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='conversions_value_per_cost', full_name='google.ads.googleads.v1.common.Metrics.conversions_value_per_cost', index=43, number=71, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='conversions_from_interactions_value_per_interaction', full_name='google.ads.googleads.v1.common.Metrics.conversions_from_interactions_value_per_interaction', index=44, number=72, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='conversions', full_name='google.ads.googleads.v1.common.Metrics.conversions', index=45, number=25, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='cost_micros', full_name='google.ads.googleads.v1.common.Metrics.cost_micros', index=46, number=26, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='cost_per_all_conversions', full_name='google.ads.googleads.v1.common.Metrics.cost_per_all_conversions', index=47, number=68, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='cost_per_conversion', full_name='google.ads.googleads.v1.common.Metrics.cost_per_conversion', index=48, number=28, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='cost_per_current_model_attributed_conversion', full_name='google.ads.googleads.v1.common.Metrics.cost_per_current_model_attributed_conversion', index=49, number=106, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='cross_device_conversions', full_name='google.ads.googleads.v1.common.Metrics.cross_device_conversions', index=50, number=29, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='ctr', full_name='google.ads.googleads.v1.common.Metrics.ctr', index=51, number=30, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='current_model_attributed_conversions', full_name='google.ads.googleads.v1.common.Metrics.current_model_attributed_conversions', index=52, number=101, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='current_model_attributed_conversions_from_interactions_rate', full_name='google.ads.googleads.v1.common.Metrics.current_model_attributed_conversions_from_interactions_rate', index=53, number=102, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='current_model_attributed_conversions_from_interactions_value_per_interaction', full_name='google.ads.googleads.v1.common.Metrics.current_model_attributed_conversions_from_interactions_value_per_interaction', index=54, number=103, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='current_model_attributed_conversions_value', full_name='google.ads.googleads.v1.common.Metrics.current_model_attributed_conversions_value', index=55, number=104, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='current_model_attributed_conversions_value_per_cost', full_name='google.ads.googleads.v1.common.Metrics.current_model_attributed_conversions_value_per_cost', index=56, number=105, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='engagement_rate', full_name='google.ads.googleads.v1.common.Metrics.engagement_rate', index=57, number=31, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='engagements', full_name='google.ads.googleads.v1.common.Metrics.engagements', index=58, number=32, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='hotel_average_lead_value_micros', full_name='google.ads.googleads.v1.common.Metrics.hotel_average_lead_value_micros', index=59, number=75, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='historical_creative_quality_score', full_name='google.ads.googleads.v1.common.Metrics.historical_creative_quality_score', index=60, number=80, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='historical_landing_page_quality_score', full_name='google.ads.googleads.v1.common.Metrics.historical_landing_page_quality_score', index=61, number=81, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='historical_quality_score', full_name='google.ads.googleads.v1.common.Metrics.historical_quality_score', index=62, number=82, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='historical_search_predicted_ctr', full_name='google.ads.googleads.v1.common.Metrics.historical_search_predicted_ctr', index=63, number=83, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='gmail_forwards', full_name='google.ads.googleads.v1.common.Metrics.gmail_forwards', index=64, number=85, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='gmail_saves', full_name='google.ads.googleads.v1.common.Metrics.gmail_saves', index=65, number=86, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='gmail_secondary_clicks', full_name='google.ads.googleads.v1.common.Metrics.gmail_secondary_clicks', index=66, number=87, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='impression_reach', full_name='google.ads.googleads.v1.common.Metrics.impression_reach', index=67, number=36, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='impressions_from_store_reach', full_name='google.ads.googleads.v1.common.Metrics.impressions_from_store_reach', index=68, number=125, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='impressions', full_name='google.ads.googleads.v1.common.Metrics.impressions', index=69, number=37, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='interaction_rate', full_name='google.ads.googleads.v1.common.Metrics.interaction_rate', index=70, number=38, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='interactions', full_name='google.ads.googleads.v1.common.Metrics.interactions', index=71, number=39, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='interaction_event_types', full_name='google.ads.googleads.v1.common.Metrics.interaction_event_types', index=72, number=100, type=14, cpp_type=8, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='invalid_click_rate', full_name='google.ads.googleads.v1.common.Metrics.invalid_click_rate', index=73, number=40, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='invalid_clicks', full_name='google.ads.googleads.v1.common.Metrics.invalid_clicks', index=74, number=41, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='mobile_friendly_clicks_percentage', full_name='google.ads.googleads.v1.common.Metrics.mobile_friendly_clicks_percentage', index=75, number=109, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='organic_clicks', full_name='google.ads.googleads.v1.common.Metrics.organic_clicks', index=76, number=110, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='organic_clicks_per_query', full_name='google.ads.googleads.v1.common.Metrics.organic_clicks_per_query', index=77, number=111, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='organic_impressions', full_name='google.ads.googleads.v1.common.Metrics.organic_impressions', index=78, number=112, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='organic_impressions_per_query', full_name='google.ads.googleads.v1.common.Metrics.organic_impressions_per_query', index=79, number=113, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='organic_queries', full_name='google.ads.googleads.v1.common.Metrics.organic_queries', index=80, number=114, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='percent_new_visitors', full_name='google.ads.googleads.v1.common.Metrics.percent_new_visitors', index=81, number=42, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='phone_calls', full_name='google.ads.googleads.v1.common.Metrics.phone_calls', index=82, number=43, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='phone_impressions', full_name='google.ads.googleads.v1.common.Metrics.phone_impressions', index=83, number=44, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='phone_through_rate', full_name='google.ads.googleads.v1.common.Metrics.phone_through_rate', index=84, number=45, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='relative_ctr', full_name='google.ads.googleads.v1.common.Metrics.relative_ctr', index=85, number=46, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='search_absolute_top_impression_share', full_name='google.ads.googleads.v1.common.Metrics.search_absolute_top_impression_share', index=86, number=78, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='search_budget_lost_absolute_top_impression_share', full_name='google.ads.googleads.v1.common.Metrics.search_budget_lost_absolute_top_impression_share', index=87, number=88, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='search_budget_lost_impression_share', full_name='google.ads.googleads.v1.common.Metrics.search_budget_lost_impression_share', index=88, number=47, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='search_budget_lost_top_impression_share', full_name='google.ads.googleads.v1.common.Metrics.search_budget_lost_top_impression_share', index=89, number=89, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='search_click_share', full_name='google.ads.googleads.v1.common.Metrics.search_click_share', index=90, number=48, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='search_exact_match_impression_share', full_name='google.ads.googleads.v1.common.Metrics.search_exact_match_impression_share', index=91, number=49, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='search_impression_share', full_name='google.ads.googleads.v1.common.Metrics.search_impression_share', index=92, number=50, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='search_rank_lost_absolute_top_impression_share', full_name='google.ads.googleads.v1.common.Metrics.search_rank_lost_absolute_top_impression_share', index=93, number=90, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='search_rank_lost_impression_share', full_name='google.ads.googleads.v1.common.Metrics.search_rank_lost_impression_share', index=94, number=51, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='search_rank_lost_top_impression_share', full_name='google.ads.googleads.v1.common.Metrics.search_rank_lost_top_impression_share', index=95, number=91, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='search_top_impression_share', full_name='google.ads.googleads.v1.common.Metrics.search_top_impression_share', index=96, number=92, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='speed_score', full_name='google.ads.googleads.v1.common.Metrics.speed_score', index=97, number=107, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='top_impression_percentage', full_name='google.ads.googleads.v1.common.Metrics.top_impression_percentage', index=98, number=93, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='valid_accelerated_mobile_pages_clicks_percentage', full_name='google.ads.googleads.v1.common.Metrics.valid_accelerated_mobile_pages_clicks_percentage', index=99, number=108, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='value_per_all_conversions', full_name='google.ads.googleads.v1.common.Metrics.value_per_all_conversions', index=100, number=52, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='value_per_conversion', full_name='google.ads.googleads.v1.common.Metrics.value_per_conversion', index=101, number=53, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='value_per_current_model_attributed_conversion', full_name='google.ads.googleads.v1.common.Metrics.value_per_current_model_attributed_conversion', index=102, number=94, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='video_quartile_100_rate', full_name='google.ads.googleads.v1.common.Metrics.video_quartile_100_rate', index=103, number=54, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='video_quartile_25_rate', full_name='google.ads.googleads.v1.common.Metrics.video_quartile_25_rate', index=104, number=55, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='video_quartile_50_rate', full_name='google.ads.googleads.v1.common.Metrics.video_quartile_50_rate', index=105, number=56, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='video_quartile_75_rate', full_name='google.ads.googleads.v1.common.Metrics.video_quartile_75_rate', index=106, number=57, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='video_view_rate', full_name='google.ads.googleads.v1.common.Metrics.video_view_rate', index=107, number=58, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='video_views', full_name='google.ads.googleads.v1.common.Metrics.video_views', index=108, number=59, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='view_through_conversions', full_name='google.ads.googleads.v1.common.Metrics.view_through_conversions', index=109, number=60, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=279, serialized_end=7626, ) _METRICS.fields_by_name['absolute_top_impression_percentage'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['active_view_cpm'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['active_view_ctr'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['active_view_impressions'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['active_view_measurability'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['active_view_measurable_cost_micros'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['active_view_measurable_impressions'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['active_view_viewability'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['all_conversions_from_interactions_rate'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['all_conversions_value'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['all_conversions'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['all_conversions_value_per_cost'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['all_conversions_from_click_to_call'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['all_conversions_from_directions'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['all_conversions_from_interactions_value_per_interaction'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['all_conversions_from_menu'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['all_conversions_from_order'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['all_conversions_from_other_engagement'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['all_conversions_from_store_visit'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['all_conversions_from_store_website'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['average_cost'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['average_cpc'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['average_cpe'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['average_cpm'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['average_cpv'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['average_frequency'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['average_page_views'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['average_position'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['average_time_on_site'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['benchmark_average_max_cpc'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['benchmark_ctr'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['bounce_rate'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['clicks'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['combined_clicks'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['combined_clicks_per_query'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['combined_queries'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['content_budget_lost_impression_share'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['content_impression_share'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['conversion_last_received_request_date_time'].message_type = google_dot_protobuf_dot_wrappers__pb2._STRINGVALUE _METRICS.fields_by_name['conversion_last_conversion_date'].message_type = google_dot_protobuf_dot_wrappers__pb2._STRINGVALUE _METRICS.fields_by_name['content_rank_lost_impression_share'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['conversions_from_interactions_rate'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['conversions_value'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['conversions_value_per_cost'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['conversions_from_interactions_value_per_interaction'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['conversions'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['cost_micros'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['cost_per_all_conversions'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['cost_per_conversion'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['cost_per_current_model_attributed_conversion'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['cross_device_conversions'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['ctr'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['current_model_attributed_conversions'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['current_model_attributed_conversions_from_interactions_rate'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['current_model_attributed_conversions_from_interactions_value_per_interaction'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['current_model_attributed_conversions_value'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['current_model_attributed_conversions_value_per_cost'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['engagement_rate'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['engagements'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['hotel_average_lead_value_micros'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['historical_creative_quality_score'].enum_type = google_dot_ads_dot_googleads__v1_dot_proto_dot_enums_dot_quality__score__bucket__pb2._QUALITYSCOREBUCKETENUM_QUALITYSCOREBUCKET _METRICS.fields_by_name['historical_landing_page_quality_score'].enum_type = google_dot_ads_dot_googleads__v1_dot_proto_dot_enums_dot_quality__score__bucket__pb2._QUALITYSCOREBUCKETENUM_QUALITYSCOREBUCKET _METRICS.fields_by_name['historical_quality_score'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['historical_search_predicted_ctr'].enum_type = google_dot_ads_dot_googleads__v1_dot_proto_dot_enums_dot_quality__score__bucket__pb2._QUALITYSCOREBUCKETENUM_QUALITYSCOREBUCKET _METRICS.fields_by_name['gmail_forwards'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['gmail_saves'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['gmail_secondary_clicks'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['impression_reach'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['impressions_from_store_reach'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['impressions'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['interaction_rate'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['interactions'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['interaction_event_types'].enum_type = google_dot_ads_dot_googleads__v1_dot_proto_dot_enums_dot_interaction__event__type__pb2._INTERACTIONEVENTTYPEENUM_INTERACTIONEVENTTYPE _METRICS.fields_by_name['invalid_click_rate'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['invalid_clicks'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['mobile_friendly_clicks_percentage'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['organic_clicks'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['organic_clicks_per_query'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['organic_impressions'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['organic_impressions_per_query'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['organic_queries'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['percent_new_visitors'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['phone_calls'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['phone_impressions'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['phone_through_rate'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['relative_ctr'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['search_absolute_top_impression_share'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['search_budget_lost_absolute_top_impression_share'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['search_budget_lost_impression_share'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['search_budget_lost_top_impression_share'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['search_click_share'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['search_exact_match_impression_share'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['search_impression_share'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['search_rank_lost_absolute_top_impression_share'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['search_rank_lost_impression_share'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['search_rank_lost_top_impression_share'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['search_top_impression_share'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['speed_score'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['top_impression_percentage'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['valid_accelerated_mobile_pages_clicks_percentage'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['value_per_all_conversions'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['value_per_conversion'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['value_per_current_model_attributed_conversion'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['video_quartile_100_rate'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['video_quartile_25_rate'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['video_quartile_50_rate'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['video_quartile_75_rate'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['video_view_rate'].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE _METRICS.fields_by_name['video_views'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE _METRICS.fields_by_name['view_through_conversions'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT64VALUE DESCRIPTOR.message_types_by_name['Metrics'] = _METRICS _sym_db.RegisterFileDescriptor(DESCRIPTOR) Metrics = _reflection.GeneratedProtocolMessageType('Metrics', (_message.Message,), dict( DESCRIPTOR = _METRICS, __module__ = 'google.ads.googleads_v1.proto.common.metrics_pb2' , __doc__ = """Metrics data. Attributes: absolute_top_impression_percentage: The percent of your ad impressions that are shown as the very first ad above the organic search results. active_view_cpm: Average cost of viewable impressions (``active_view_impressions``). active_view_ctr: Active view measurable clicks divided by active view viewable impressions. This metric is reported only for display network. active_view_impressions: A measurement of how often your ad has become viewable on a Display Network site. active_view_measurability: The ratio of impressions that could be measured by Active View over the number of served impressions. active_view_measurable_cost_micros: The cost of the impressions you received that were measurable by Active View. active_view_measurable_impressions: The number of times your ads are appearing on placements in positions where they can be seen. active_view_viewability: The percentage of time when your ad appeared on an Active View enabled site (measurable impressions) and was viewable (viewable impressions). all_conversions_from_interactions_rate: All conversions from interactions (as oppose to view through conversions) divided by the number of ad interactions. all_conversions_value: The total value of all conversions. all_conversions: The total number of conversions. This only includes conversion actions which include\_in\_conversions\_metric attribute is set to true. all_conversions_value_per_cost: The value of all conversions divided by the total cost of ad interactions (such as clicks for text ads or views for video ads). all_conversions_from_click_to_call: The number of times people clicked the "Call" button to call a store during or after clicking an ad. This number doesn't include whether or not calls were connected, or the duration of any calls. This metric applies to feed items only. all_conversions_from_directions: The number of times people clicked a "Get directions" button to navigate to a store after clicking an ad. This metric applies to feed items only. all_conversions_from_interactions_value_per_interaction: The value of all conversions from interactions divided by the total number of interactions. all_conversions_from_menu: The number of times people clicked a link to view a store's menu after clicking an ad. This metric applies to feed items only. all_conversions_from_order: The number of times people placed an order at a store after clicking an ad. This metric applies to feed items only. all_conversions_from_other_engagement: The number of other conversions (for example, posting a review or saving a location for a store) that occurred after people clicked an ad. This metric applies to feed items only. all_conversions_from_store_visit: Estimated number of times people visited a store after clicking an ad. This metric applies to feed items only. all_conversions_from_store_website: The number of times that people were taken to a store's URL after clicking an ad. This metric applies to feed items only. average_cost: The average amount you pay per interaction. This amount is the total cost of your ads divided by the total number of interactions. average_cpc: The total cost of all clicks divided by the total number of clicks received. average_cpe: The average amount that you've been charged for an ad engagement. This amount is the total cost of all ad engagements divided by the total number of ad engagements. average_cpm: Average cost-per-thousand impressions (CPM). average_cpv: The average amount you pay each time someone views your ad. The average CPV is defined by the total cost of all ad views divided by the number of views. average_frequency: Average number of times a unique cookie was exposed to your ad over a given time period. Imported from Google Analytics. average_page_views: Average number of pages viewed per session. average_position: Your ad's position relative to those of other advertisers. average_time_on_site: Total duration of all sessions (in seconds) / number of sessions. Imported from Google Analytics. benchmark_average_max_cpc: An indication of how other advertisers are bidding on similar products. benchmark_ctr: An indication on how other advertisers' Shopping ads for similar products are performing based on how often people who see their ad click on it. bounce_rate: Percentage of clicks where the user only visited a single page on your site. Imported from Google Analytics. clicks: The number of clicks. combined_clicks: The number of times your ad or your site's listing in the unpaid results was clicked. See the help page at https://support.google.com/google-ads/answer/3097241 for details. combined_clicks_per_query: The number of times your ad or your site's listing in the unpaid results was clicked (combined\_clicks) divided by combined\_queries. See the help page at https://support.google.com/google-ads/answer/3097241 for details. combined_queries: The number of searches that returned pages from your site in the unpaid results or showed one of your text ads. See the help page at https://support.google.com/google- ads/answer/3097241 for details. content_budget_lost_impression_share: The estimated percent of times that your ad was eligible to show on the Display Network but didn't because your budget was too low. Note: Content budget lost impression share is reported in the range of 0 to 0.9. Any value above 0.9 is reported as 0.9001. content_impression_share: The impressions you've received on the Display Network divided by the estimated number of impressions you were eligible to receive. Note: Content impression share is reported in the range of 0.1 to 1. Any value below 0.1 is reported as 0.0999. conversion_last_received_request_date_time: The last date/time a conversion tag for this conversion action successfully fired and was seen by Google Ads. This firing event may not have been the result of an attributable conversion (e.g. because the tag was fired from a browser that did not previously click an ad from an appropriate advertiser). The date/time is in the customer's time zone. conversion_last_conversion_date: The date of the most recent conversion for this conversion action. The date is in the customer's time zone. content_rank_lost_impression_share: The estimated percentage of impressions on the Display Network that your ads didn't receive due to poor Ad Rank. Note: Content rank lost impression share is reported in the range of 0 to 0.9. Any value above 0.9 is reported as 0.9001. conversions_from_interactions_rate: Conversions from interactions divided by the number of ad interactions (such as clicks for text ads or views for video ads). This only includes conversion actions which include\_in\_conversions\_metric attribute is set to true. conversions_value: The total value of conversions. This only includes conversion actions which include\_in\_conversions\_metric attribute is set to true. conversions_value_per_cost: The value of conversions divided by the cost of ad interactions. This only includes conversion actions which include\_in\_conversions\_metric attribute is set to true. conversions_from_interactions_value_per_interaction: The value of conversions from interactions divided by the number of ad interactions. This only includes conversion actions which include\_in\_conversions\_metric attribute is set to true. conversions: The number of conversions. This only includes conversion actions which include\_in\_conversions\_metric attribute is set to true. cost_micros: The sum of your cost-per-click (CPC) and cost-per-thousand impressions (CPM) costs during this period. cost_per_all_conversions: The cost of ad interactions divided by all conversions. cost_per_conversion: The cost of ad interactions divided by conversions. This only includes conversion actions which include\_in\_conversions\_metric attribute is set to true. cost_per_current_model_attributed_conversion: The cost of ad interactions divided by current model attributed conversions. This only includes conversion actions which include\_in\_conversions\_metric attribute is set to true. cross_device_conversions: Conversions from when a customer clicks on a Google Ads ad on one device, then converts on a different device or browser. Cross-device conversions are already included in all\_conversions. ctr: The number of clicks your ad receives (Clicks) divided by the number of times your ad is shown (Impressions). current_model_attributed_conversions: Shows how your historic conversions data would look under the attribution model you've currently selected. This only includes conversion actions which include\_in\_conversions\_metric attribute is set to true. current_model_attributed_conversions_from_interactions_rate: Current model attributed conversions from interactions divided by the number of ad interactions (such as clicks for text ads or views for video ads). This only includes conversion actions which include\_in\_conversions\_metric attribute is set to true. current_model_attributed_conversions_from_interactions_value_per_interaction: The value of current model attributed conversions from interactions divided by the number of ad interactions. This only includes conversion actions which include\_in\_conversions\_metric attribute is set to true. current_model_attributed_conversions_value: The total value of current model attributed conversions. This only includes conversion actions which include\_in\_conversions\_metric attribute is set to true. current_model_attributed_conversions_value_per_cost: The value of current model attributed conversions divided by the cost of ad interactions. This only includes conversion actions which include\_in\_conversions\_metric attribute is set to true. engagement_rate: How often people engage with your ad after it's shown to them. This is the number of ad expansions divided by the number of times your ad is shown. engagements: The number of engagements. An engagement occurs when a viewer expands your Lightbox ad. Also, in the future, other ad types may support engagement metrics. hotel_average_lead_value_micros: Average lead value of hotel. historical_creative_quality_score: The creative historical quality score. historical_landing_page_quality_score: The quality of historical landing page experience. historical_quality_score: The historical quality score. historical_search_predicted_ctr: The historical search predicted click through rate (CTR). gmail_forwards: The number of times the ad was forwarded to someone else as a message. gmail_saves: The number of times someone has saved your Gmail ad to their inbox as a message. gmail_secondary_clicks: The number of clicks to the landing page on the expanded state of Gmail ads. impression_reach: Number of unique cookies that were exposed to your ad over a given time period. impressions_from_store_reach: The number of times a store's location-based ad was shown. This metric applies to feed items only. impressions: Count of how often your ad has appeared on a search results page or website on the Google Network. interaction_rate: How often people interact with your ad after it is shown to them. This is the number of interactions divided by the number of times your ad is shown. interactions: The number of interactions. An interaction is the main user action associated with an ad format-clicks for text and shopping ads, views for video ads, and so on. interaction_event_types: The types of payable and free interactions. invalid_click_rate: The percentage of clicks filtered out of your total number of clicks (filtered + non-filtered clicks) during the reporting period. invalid_clicks: Number of clicks Google considers illegitimate and doesn't charge you for. mobile_friendly_clicks_percentage: The percentage of mobile clicks that go to a mobile-friendly page. organic_clicks: The number of times someone clicked your site's listing in the unpaid results for a particular query. See the help page at https://support.google.com/google-ads/answer/3097241 for details. organic_clicks_per_query: The number of times someone clicked your site's listing in the unpaid results (organic\_clicks) divided by the total number of searches that returned pages from your site (organic\_queries). See the help page at https://support.google.com/google-ads/answer/3097241 for details. organic_impressions: The number of listings for your site in the unpaid search results. See the help page at https://support.google.com/google-ads/answer/3097241 for details. organic_impressions_per_query: The number of times a page from your site was listed in the unpaid search results (organic\_impressions) divided by the number of searches returning your site's listing in the unpaid results (organic\_queries). See the help page at https://support.google.com/google-ads/answer/3097241 for details. organic_queries: The total number of searches that returned your site's listing in the unpaid results. See the help page at https://support.google.com/google-ads/answer/3097241 for details. percent_new_visitors: Percentage of first-time sessions (from people who had never visited your site before). Imported from Google Analytics. phone_calls: Number of offline phone calls. phone_impressions: Number of offline phone impressions. phone_through_rate: Number of phone calls received (phone\_calls) divided by the number of times your phone number is shown (phone\_impressions). relative_ctr: Your clickthrough rate (Ctr) divided by the average clickthrough rate of all advertisers on the websites that show your ads. Measures how your ads perform on Display Network sites compared to other ads on the same sites. search_absolute_top_impression_share: The percentage of the customer's Shopping or Search ad impressions that are shown in the most prominent Shopping position. See this Merchant Center article for details. Any value below 0.1 is reported as 0.0999. search_budget_lost_absolute_top_impression_share: The number estimating how often your ad wasn't the very first ad above the organic search results due to a low budget. Note: Search budget lost absolute top impression share is reported in the range of 0 to 0.9. Any value above 0.9 is reported as 0.9001. search_budget_lost_impression_share: The estimated percent of times that your ad was eligible to show on the Search Network but didn't because your budget was too low. Note: Search budget lost impression share is reported in the range of 0 to 0.9. Any value above 0.9 is reported as 0.9001. search_budget_lost_top_impression_share: The number estimating how often your ad didn't show anywhere above the organic search results due to a low budget. Note: Search budget lost top impression share is reported in the range of 0 to 0.9. Any value above 0.9 is reported as 0.9001. search_click_share: The number of clicks you've received on the Search Network divided by the estimated number of clicks you were eligible to receive. Note: Search click share is reported in the range of 0.1 to 1. Any value below 0.1 is reported as 0.0999. search_exact_match_impression_share: The impressions you've received divided by the estimated number of impressions you were eligible to receive on the Search Network for search terms that matched your keywords exactly (or were close variants of your keyword), regardless of your keyword match types. Note: Search exact match impression share is reported in the range of 0.1 to 1. Any value below 0.1 is reported as 0.0999. search_impression_share: The impressions you've received on the Search Network divided by the estimated number of impressions you were eligible to receive. Note: Search impression share is reported in the range of 0.1 to 1. Any value below 0.1 is reported as 0.0999. search_rank_lost_absolute_top_impression_share: The number estimating how often your ad wasn't the very first ad above the organic search results due to poor Ad Rank. Note: Search rank lost absolute top impression share is reported in the range of 0 to 0.9. Any value above 0.9 is reported as 0.9001. search_rank_lost_impression_share: The estimated percentage of impressions on the Search Network that your ads didn't receive due to poor Ad Rank. Note: Search rank lost impression share is reported in the range of 0 to 0.9. Any value above 0.9 is reported as 0.9001. search_rank_lost_top_impression_share: The number estimating how often your ad didn't show anywhere above the organic search results due to poor Ad Rank. Note: Search rank lost top impression share is reported in the range of 0 to 0.9. Any value above 0.9 is reported as 0.9001. search_top_impression_share: The impressions you've received in the top location (anywhere above the organic search results) compared to the estimated number of impressions you were eligible to receive in the top location. Note: Search top impression share is reported in the range of 0.1 to 1. Any value below 0.1 is reported as 0.0999. speed_score: A measure of how quickly your page loads after clicks on your mobile ads. The score is a range from 1 to 10, 10 being the fastest. top_impression_percentage: The percent of your ad impressions that are shown anywhere above the organic search results. valid_accelerated_mobile_pages_clicks_percentage: The percentage of ad clicks to Accelerated Mobile Pages (AMP) landing pages that reach a valid AMP page. value_per_all_conversions: The value of all conversions divided by the number of all conversions. value_per_conversion: The value of conversions divided by the number of conversions. This only includes conversion actions which include\_in\_conversions\_metric attribute is set to true. value_per_current_model_attributed_conversion: The value of current model attributed conversions divided by the number of the conversions. This only includes conversion actions which include\_in\_conversions\_metric attribute is set to true. video_quartile_100_rate: Percentage of impressions where the viewer watched all of your video. video_quartile_25_rate: Percentage of impressions where the viewer watched 25% of your video. video_quartile_50_rate: Percentage of impressions where the viewer watched 50% of your video. video_quartile_75_rate: Percentage of impressions where the viewer watched 75% of your video. video_view_rate: The number of views your TrueView video ad receives divided by its number of impressions, including thumbnail impressions for TrueView in-display ads. video_views: The number of times your video ads were viewed. view_through_conversions: The total number of view-through conversions. These happen when a customer sees an image or rich media ad, then later completes a conversion on your site without interacting with (e.g., clicking on) another ad. """, # @@protoc_insertion_point(class_scope:google.ads.googleads.v1.common.Metrics) )) _sym_db.RegisterMessage(Metrics) DESCRIPTOR._options = None # @@protoc_insertion_point(module_scope)
[ "noreply@github.com" ]
juanmacugat.noreply@github.com
c35c47d85e8eaf7ce3ec0cafdf48201c7f443497
647d4a050fb9a702d07b33d3bdea48c4bb3bc94a
/1_term/Homeworks/Homework 7/problem 7_2.py
62adce546a2268be3fbf1a60e67bb170231af595
[]
no_license
MaximPushkar/PythonUniversity
22b54741a13dc50f1c038cbe3fbbd0dfee479b77
25f99d00f935cf3cb6fcc8fcb1d2626b9759304d
refs/heads/master
2021-08-16T07:56:24.497993
2021-06-02T06:29:41
2021-06-02T06:29:41
254,047,704
1
0
null
null
null
null
UTF-8
Python
false
false
204
py
l = list(map(int, input().split())) a, b, c = l[0], l[1], l[2] x = max(a, b, c) y = min(a, b, c) if a != x and a != y: print(a) if b != x and b != y: print(b) if c != x and c != y: print(c)
[ "makspushkar@gmail.com" ]
makspushkar@gmail.com
c7231865f40b0e48fc88eca1e0906a627b701028
d50fa5ec641441af13a2adae13553aff0a7a9afa
/intellexer/comparator/__init__.py
b37349634d0c750fa45851b6d11e1d5c5047a063
[]
no_license
kai3341/intellexer-python
025b65b6bf11dbb7ebd061e0eb6f1d452b26a468
df925db6fe4fcf645a7d83cf3f1fdf98e12c4106
refs/heads/master
2020-05-06T13:47:52.190941
2019-04-17T18:28:18
2019-04-17T18:28:18
180,156,646
0
0
null
2019-04-17T18:28:19
2019-04-08T13:36:12
Python
UTF-8
Python
false
false
29
py
from .main import Comparator
[ "antonk@esl236.es.local" ]
antonk@esl236.es.local
180a77651c0bba342cf5dbf9653fb4cdd9a2f4fe
64575084a709abd2f034fa8baf9fe9bb15f0303d
/timeline/migrations/0006_auto_20210208_1125.py
de8370c78fcbbca5f6c64da4a6666ac06365d1a4
[]
no_license
AsiriAmalk/fb_replica
616041a6134b879884a4349159ae41c6df72d2d1
bdd7af6aee90813393139ff03241163c68ff8b34
refs/heads/master
2023-02-26T18:30:20.729120
2021-02-08T09:15:30
2021-02-08T09:15:30
336,967,775
0
0
null
null
null
null
UTF-8
Python
false
false
419
py
# Generated by Django 3.1.6 on 2021-02-08 05:55 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('timeline', '0005_postfiles_file_name'), ] operations = [ migrations.AlterField( model_name='postfiles', name='file_name', field=models.CharField(default='Unnamed File', max_length=256), ), ]
[ "asiri.15@cse.mrt.ac.lk" ]
asiri.15@cse.mrt.ac.lk
b81e8278d7b20ea07e4043a857d5a74b10a2fb8a
cc2a00ce7e05245327ce8da85d0e3aa01d9635b9
/Q_learning/Tank_1/main.py
bd3fa0cfeb2628b937d011b3d66b22c2f652a843
[]
no_license
puttak/Reinforcement-Learning-in-Process-Control
f7c05a0ed41826cb1d7248caffdb3c47bbe66df0
852967e97b2fb0b6c5022365c9ef62906c099832
refs/heads/master
2020-05-03T21:56:33.515929
2019-03-21T08:28:36
2019-03-21T08:28:36
null
0
0
null
null
null
null
UTF-8
Python
false
false
3,897
py
# Add the ptdraft folder path to the sys.path list # sys.path.append("C:/Users/eskil/Google Drive/Skolearbeid/5. klasse/Master") from models.environment import Environment from models.Agent import Agent from params import MAIN_PARAMS, AGENT_PARAMS, TANK_PARAMS, TANK_DIST import os import matplotlib.pyplot as plt import numpy as np import keyboard from rewards import get_reward_2 as get_reward from rewards import sum_rewards plt.style.use("ggplot") os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2" def main(): # ============= Initialize variables and objects ===========# max_mean_reward = 50 * len(TANK_PARAMS) environment = Environment(TANK_PARAMS, TANK_DIST, MAIN_PARAMS) agent = Agent(AGENT_PARAMS) mean_episode = MAIN_PARAMS["MEAN_EPISODE"] episodes = MAIN_PARAMS["EPISODES"] all_rewards = [] all_mean_rewards = [] # ================= Running episodes =================# try: for e in range(episodes): states, episode_reward = environment.reset() # Reset level in tank for t in range(MAIN_PARAMS["MAX_TIME"]): actions = agent.act(states[-1]) # get action choice from state z = agent.get_z(actions) terminated, next_state = environment.get_next_state( z, states[-1], t ) # Calculate next state with action rewards = sum_rewards( next_state, terminated, get_reward ) # get reward from transition to next state # Store data episode_reward.append(np.sum(rewards)) states.append(next_state) agent.remember(states, rewards, terminated, t) if environment.show_rendering: environment.render(z) if True in terminated: break all_rewards.append(np.sum(np.array(episode_reward))) # Print mean reward and save better models if e % mean_episode == 0 and e != 0: mean_reward = np.mean(all_rewards[-mean_episode:]) all_mean_rewards.append(mean_reward) print( "{} of {}/{} episodes\ reward: {} exp: {}".format( mean_episode, e, episodes, round(mean_reward, 2), round(agent.epsilon[0], 2), ) ) if agent.save_model_bool: max_mean_reward = agent.save_model( mean_reward, max_mean_reward ) # Train model if agent.is_ready(): agent.Qreplay(e) if keyboard.is_pressed("ctrl+x"): break if environment.live_plot: environment.plot(all_rewards, agent.epsilon) if not environment.running: break # if agent.epsilon <= agent.epsilon_min: # break except KeyboardInterrupt: pass print("Memory length: {}".format(len(agent.memory))) print("##### {} EPISODES DONE #####".format(e + 1)) print("Max rewards for all episodes: {}".format(np.max(all_rewards))) plt.ioff() plt.clf() x_range = np.arange(0, e - e % mean_episode, mean_episode) plt.plot(x_range, all_mean_rewards) plt.ylabel("Mean rewards of last {} episodes".format(mean_episode)) plt.show() if __name__ == "__main__": print("#### SIMULATION STARTED ####") print(" Max number of episodes: {}".format(MAIN_PARAMS["EPISODES"])) print(" Max time in each episode: {}".format(MAIN_PARAMS["MAX_TIME"])) print( " {}Rendring simulation ".format( "" if MAIN_PARAMS["RENDER"] else "Not " ) ) main()
[ "eskild.emedd33@gmail.com" ]
eskild.emedd33@gmail.com
0923c8c32c00d1ff45779f2ef45ff25e9f5274e0
22cfe0051c505e569d6d5e4c814c5ab569ca138f
/add_str.py
f67d8bb6f7891ed529af3eb7ac5fdc0231ac8ce3
[]
no_license
haowenchao123/Leetcode_python
01715fd1867996e2d41fe193c3f069a0735582a0
d054cdbfb6f2e0ab6f1ef3b2541612bf57f7c90a
refs/heads/master
2022-02-21T11:46:36.231521
2019-09-02T08:19:48
2019-09-02T08:19:48
null
0
0
null
null
null
null
UTF-8
Python
false
false
398
py
''' 给定两个字符串形式的非负整数 num1 和num2 ,计算它们的和。 注意: num1 和num2 的长度都小于 5100. num1 和num2 都只包含数字 0-9. num1 和num2 都不包含任何前导零。 你不能使用任何內建 BigInteger 库, 也不能直接将输入的字符串转换为整数形式。 ''' class Solution: def addStrings(self, num1: str, num2: str) -> str:
[ "haowenchao123@gmail.com" ]
haowenchao123@gmail.com
a71100ee185d5f0d009211c97743687556883d4a
7ddbf0b004a29e69513204ecf19de11d437d65ba
/application.py
2011bcdbe5130931c4474e6fa36942f35b4dfe14
[]
no_license
bukovinsky/paypage-app1
3c65b56b507df18db1ba181c5b8288419ca8f869
aef1a5133eb0447545ab0f1884f73f7f835f4fc4
refs/heads/master
2022-12-22T06:48:04.978361
2019-02-19T11:07:19
2019-02-19T11:07:19
171,346,316
0
0
null
2022-12-08T01:37:27
2019-02-18T19:49:37
Python
UTF-8
Python
false
false
1,284
py
import logging from flask import Flask, render_template, session, redirect, url_for, request, make_response from application.forms import MainForm, create_form import requests # application from application.views import Payment from application.models import * # Basic configuration for logging logging.basicConfig(filename='loggingg.log', filemode='w', level=logging.DEBUG) STORE_SETTINGS = { 'STORE_SECRET':'SecretKey01', 'STORE_CURRENCY':'840', 'shop_id':'5', 'currencies':('978', '840', '643', '980'), 'payway':'payeer_rub', #'form_fields': list(MainForm._meta.fields.keys()), } DATABASE = { 'name':'database/pbase.db', 'engine':'peewee.SqliteDatabase' } SECRET_KEY = 'd0231b4d850c657d6f5d31a56c68469c14ebd26ad3151dd18bde5e90b585f9c8' CURRENCIES_METHODS = { '0':'', '978':'', '840':'', '643':'', } app = Flask(__name__) app.config.from_object(__name__) @app.route('/', methods=['GET','POST']) def index(): frm = MainForm() if request.method=='POST': paym = Payment(request, STORE_SETTINGS) return make_response(paym.make_result(PaymentParams, 'payCurrency', request.form.get('currency'))) return render_template('spa_application.html', frm=frm) if __name__ == '__main__': app.run(debug=True)
[ "timkramerok@gmail.com" ]
timkramerok@gmail.com
e0dcdd338f02911972cbd6e74097c9bf46d23e95
693c8738997d02eea145c48bc2791dcc9e9660ba
/src/testCase/romd/scenario/test_s_a_set302.py
2c6f50ceb64150d609038cd6eb83b92fc1be4154
[]
no_license
maxuechaogao/ap_test_cs
7d57ec66a58dcf042132597dd550da6ed37807cf
ab92efa6584d231b150420e68a35b1625bbfd70a
refs/heads/master
2021-04-26T22:17:37.097113
2018-03-06T11:04:07
2018-03-06T11:04:07
124,064,328
0
0
null
null
null
null
UTF-8
Python
false
false
260
py
# coding:utf-8 __author__ = 'xcma' from src.controll.AboutTestcase import TestCase from src.func.helper.log import log log = log() class Heart(TestCase): def test_a_main_process(self): '''设置302''' self.udp(self.getParam().set302)
[ "maxc@supervcloud.com" ]
maxc@supervcloud.com
2ce0cfa422e427038019818f0bb20e1a76c70dea
649bd422025e421d86025743eac324c9b882a2e8
/exam/1_three-dimensional_atomic_system/dump/phasetrans/temp131_9000.py
0f4bbbc10fb1931bc9e577fc53fbe4b497a9b7ba
[]
no_license
scheuclu/atom_class
36ddee1f6a5995872e858add151c5942c109847c
0c9a8c63d9b38898c1869fe8983126cef17662cd
refs/heads/master
2021-01-21T10:52:28.448221
2017-03-07T23:04:41
2017-03-07T23:04:41
83,489,471
0
0
null
null
null
null
UTF-8
Python
false
false
68,821
py
ITEM: TIMESTEP 9000 ITEM: NUMBER OF ATOMS 2048 ITEM: BOX BOUNDS pp pp pp -1.7670113513643848e+00 4.8967011351357613e+01 -1.7670113513643848e+00 4.8967011351357613e+01 -1.7670113513643848e+00 4.8967011351357613e+01 ITEM: ATOMS id type xs ys zs 40 1 0.0553833 0.0815896 0.0631967 5 1 0.0891973 0.100476 0.152519 39 1 0.120387 0.0259949 0.0753868 1382 1 0.0752788 0.148785 0.0933909 194 1 0.107407 0.123999 0.0302167 205 1 0.140049 0.0993292 0.0908989 257 1 0.00564804 0.124938 0.155145 261 1 0.0533875 0.0423669 0.12941 1260 1 0.13993 0.042859 0.154686 1126 1 0.0438624 0.00255627 0.0580506 899 1 0.131643 0.0305908 0.00301332 771 1 0.0159675 0.0529534 0.00221956 1386 1 0.143771 0.154926 0.148621 173 1 0.177227 0.102579 0.0125819 14 1 0.212431 0.0282821 0.00851785 273 1 0.27572 0.0554832 0.0590233 48 1 0.211083 0.0820778 0.0948373 1003 1 0.196799 0.156641 0.0712186 85 1 0.251687 0.162059 0.0137443 1131 1 0.254479 0.0239368 0.126385 270 1 0.345651 0.0428176 0.0851055 305 1 0.287397 0.0957535 0.132173 15 1 0.287994 0.135447 0.0672026 303 1 0.398528 0.089102 0.060376 51 1 0.36488 0.14364 0.0108854 11 1 0.337352 0.022033 0.0128739 298 1 0.357318 0.132322 0.163589 1264 1 0.401604 0.00629584 0.0465833 1396 1 0.371012 0.0403791 0.154054 18 1 0.509524 0.128538 0.0250392 271 1 0.470004 0.0670516 0.0383471 1522 1 0.434242 0.017127 0.11452 309 1 0.439789 0.151899 0.0704124 143 1 0.510621 0.136769 0.107636 277 1 0.530161 0.0609378 0.0965426 178 1 0.544127 0.0460613 0.0212033 466 1 0.555654 0.0975034 0.162994 145 1 0.567203 0.00438909 0.140078 146 1 0.595572 0.0987073 0.0188399 153 1 0.659535 0.0983179 0.0633062 184 1 0.608011 0.0433375 0.0712253 275 1 0.637614 0.0710365 0.136606 312 1 0.592383 0.127506 0.103495 919 1 0.666779 0.0342078 0.015294 185 1 0.670015 0.143543 0.134942 1273 1 0.698945 0.0284919 0.106305 960 1 0.729082 0.108566 0.0860171 186 1 0.776166 0.0579636 0.107536 30 1 0.829923 0.0670628 0.0201088 956 1 0.761003 0.137471 0.152307 318 1 0.82485 0.138208 0.0581695 929 1 0.74972 0.0314795 0.027311 192 1 0.826772 0.0373709 0.166141 958 1 0.894198 0.0151348 0.0505773 904 1 0.941642 0.0782424 0.132116 95 1 0.858567 0.0999261 0.126823 1986 1 0.948409 0.0747507 0.0414825 68 1 0.902626 0.141506 0.0700591 7 1 0.999583 0.144335 0.0782763 193 1 0.918518 0.154137 0.143081 900 1 0.890324 0.0171214 0.136428 2026 1 0.974685 0.00616262 0.0344303 963 1 0.105109 0.25989 0.044931 71 1 0.126443 0.193349 0.0721219 201 1 0.0554603 0.202511 0.0436668 97 1 0.0228769 0.223994 0.118938 233 1 0.0331267 0.280853 0.0702109 262 1 0.0622995 0.179094 0.166234 225 1 0.0687551 0.331598 0.0100013 199 1 0.106431 0.333027 0.159974 163 1 0.0210132 0.302442 0.150608 297 1 0.0805893 0.259541 0.157817 104 1 0.181495 0.209081 0.00923857 137 1 0.220392 0.183827 0.14433 38 1 0.201443 0.23917 0.0948528 44 1 0.240154 0.259524 0.152785 134 1 0.175632 0.316271 0.0799322 80 1 0.241841 0.299846 0.057841 947 1 0.268081 0.222113 0.0564066 133 1 0.163762 0.285588 0.159698 165 1 0.250035 0.327552 0.154039 206 1 0.348613 0.194537 0.0719562 140 1 0.291583 0.198463 0.132239 75 1 0.377622 0.300843 0.0821566 330 1 0.308603 0.298491 0.107635 175 1 0.393093 0.198346 0.140193 179 1 0.40505 0.220238 0.0292519 210 1 0.421407 0.323781 0.151527 242 1 0.390606 0.299461 0.0148369 209 1 0.319913 0.273023 0.0374258 216 1 0.459562 0.220072 0.0946907 241 1 0.538738 0.195973 0.0851077 342 1 0.500042 0.282471 0.136318 118 1 0.535327 0.270182 0.0664169 1039 1 0.472126 0.285272 0.0172656 50 1 0.49607 0.211495 0.0174599 181 1 0.568736 0.209912 0.00127728 215 1 0.662734 0.185265 0.00727116 219 1 0.693228 0.199314 0.0764216 855 1 0.612777 0.215768 0.0683727 248 1 0.651364 0.301144 0.0436984 249 1 0.588311 0.261413 0.12085 214 1 0.641704 0.212705 0.155402 1170 1 0.575213 0.332843 0.0848777 983 1 0.585788 0.293792 0.0106652 1304 1 0.699337 0.302633 0.146258 87 1 0.771305 0.19063 0.0479259 125 1 0.826994 0.283252 0.0450514 126 1 0.742351 0.260655 0.0892706 60 1 0.792134 0.209147 0.128494 36 1 0.840629 0.280854 0.120251 123 1 0.721739 0.221881 0.157308 897 1 0.966682 0.175515 0.0236464 33 1 0.882852 0.222467 0.124406 89 1 0.952102 0.205392 0.0958323 988 1 0.905322 0.266533 0.0688944 99 1 0.937108 0.276558 0.164472 226 1 0.963497 0.299109 0.0970848 34 1 0.891068 0.206488 0.0327686 62 1 0.970358 0.249739 0.0297673 965 1 0.096131 0.44929 0.0465312 228 1 0.114306 0.498553 0.132965 70 1 0.0829852 0.370716 0.0923374 101 1 0.0264095 0.426996 0.0458828 968 1 0.00421479 0.377683 0.112652 103 1 0.0543785 0.439862 0.116772 1159 1 0.141734 0.386017 0.0456234 198 1 0.114338 0.41389 0.148106 970 1 0.274419 0.407999 0.00134208 871 1 0.174317 0.42224 0.0969331 334 1 0.167553 0.363263 0.144286 235 1 0.206423 0.461623 0.0356819 208 1 0.22919 0.38643 0.0570689 237 1 0.245762 0.412323 0.142565 203 1 0.269432 0.449837 0.0855566 1799 1 0.203022 0.483441 0.121167 170 1 0.302461 0.363884 0.0530197 362 1 0.339224 0.406084 0.112033 1165 1 0.413782 0.445172 0.0559888 1295 1 0.377429 0.371069 0.0629446 366 1 0.348397 0.347172 0.157407 338 1 0.417186 0.401784 0.123366 1161 1 0.357953 0.417662 0.00834905 1297 1 0.342368 0.492875 0.118585 105 1 0.311035 0.48437 0.0127857 243 1 0.46824 0.346798 0.0829782 111 1 0.545473 0.418951 0.0542235 1041 1 0.562331 0.399493 0.136 1065 1 0.442329 0.489183 0.113336 245 1 0.535634 0.35266 0.0235064 1198 1 0.488914 0.426796 0.114769 112 1 0.470929 0.405799 0.0102145 1940 1 0.491079 0.47959 0.0521233 1034 1 0.547486 0.476722 0.102277 1457 1 0.642115 0.401898 0.166326 1046 1 0.69191 0.461463 0.14403 1081 1 0.688828 0.471139 0.0513226 1169 1 0.707227 0.386825 0.0464283 116 1 0.619139 0.379056 0.0356297 1177 1 0.619405 0.436556 0.0904024 246 1 0.66551 0.352816 0.104669 1047 1 0.608659 0.481373 0.166408 1020 1 0.800915 0.371331 0.057853 1054 1 0.729407 0.394172 0.164379 1950 1 0.84585 0.368611 0.00327021 256 1 0.809772 0.459814 0.104937 218 1 0.817781 0.351014 0.133029 1051 1 0.749322 0.445426 0.0108259 1050 1 0.7459 0.345341 0.0949142 96 1 0.744326 0.434324 0.0973025 1984 1 0.823586 0.446863 0.0269776 102 1 0.939877 0.484942 0.00868 254 1 0.885797 0.459206 0.0797689 255 1 0.957801 0.475353 0.0860892 253 1 0.997266 0.352867 0.026548 1153 1 0.873044 0.389761 0.0707305 995 1 0.929757 0.338143 0.0428137 994 1 0.935752 0.421965 0.153019 1055 1 0.899253 0.340915 0.128282 224 1 0.948373 0.406693 0.0785076 161 1 0.0260315 0.0886088 0.230439 130 1 0.0771057 0.0621804 0.325841 67 1 0.0990487 0.143285 0.218266 294 1 0.0323043 0.120374 0.297798 131 1 0.116451 0.112968 0.289243 31 1 0.100165 0.0560973 0.213825 259 1 0.23201 0.0713313 0.177754 398 1 0.262748 0.0136344 0.228784 296 1 0.200141 0.138997 0.198577 1518 1 0.181268 0.0246498 0.259859 144 1 0.224176 0.0919634 0.248798 295 1 0.172744 0.159299 0.328281 1256 1 0.247577 0.0372407 0.305353 301 1 0.405158 0.0567941 0.233819 302 1 0.308963 0.0686492 0.211946 429 1 0.295855 0.0994779 0.301803 501 1 0.362006 0.116696 0.255921 395 1 0.388211 0.00661199 0.318145 397 1 0.294067 0.159305 0.200259 1392 1 0.315945 0.00159352 0.275288 276 1 0.444859 0.0939516 0.169516 436 1 0.505869 0.0259222 0.170251 340 1 0.508714 0.0944549 0.226538 463 1 0.460208 0.0622485 0.287781 369 1 0.448379 0.149062 0.21062 371 1 0.553214 0.162623 0.309348 311 1 0.550862 0.0357515 0.266177 494 1 0.563211 0.0867002 0.318779 1394 1 0.502127 0.0021667 0.320599 1271 1 0.637965 0.0464733 0.295247 151 1 0.705777 0.0893232 0.169826 284 1 0.696293 0.0796882 0.330412 1400 1 0.648463 0.0719379 0.225395 404 1 0.638698 0.122676 0.317988 405 1 0.587623 0.0242573 0.20401 310 1 0.709018 0.103835 0.254482 188 1 0.644159 0.14596 0.206536 211 1 0.584139 0.106506 0.253162 444 1 0.70621 0.166336 0.308777 221 1 0.84174 0.166408 0.173043 280 1 0.738633 0.0274163 0.257305 150 1 0.78034 0.0829827 0.227374 274 1 0.771503 0.0882214 0.304228 187 1 0.847261 0.0732762 0.264686 281 1 0.807809 0.0124631 0.305586 168 1 0.797669 0.152556 0.241966 91 1 0.868491 0.110148 0.206804 69 1 0.949394 0.099239 0.200858 1150 1 0.991363 0.0320307 0.185257 289 1 0.987568 0.0631662 0.32811 158 1 0.949631 0.142594 0.313471 132 1 0.930477 0.0848815 0.268325 320 1 0.857647 0.135304 0.305257 35 1 0.990166 0.150934 0.229951 164 1 0.909852 0.159802 0.243159 258 1 0.975742 0.0133447 0.268924 288 1 0.909306 0.00807981 0.297614 327 1 0.00613724 0.196825 0.299593 195 1 0.0483093 0.203865 0.235889 322 1 0.0432606 0.290876 0.262796 326 1 0.107376 0.268457 0.226627 450 1 0.100969 0.258048 0.318883 265 1 0.0783404 0.180729 0.302564 268 1 0.181807 0.268222 0.27698 139 1 0.220074 0.174001 0.259962 204 1 0.183994 0.217874 0.197902 236 1 0.245376 0.280136 0.226324 166 1 0.148394 0.191865 0.264639 172 1 0.250958 0.264493 0.304578 202 1 0.29544 0.192492 0.270933 239 1 0.298608 0.233593 0.203725 490 1 0.35623 0.275287 0.167566 364 1 0.387473 0.286813 0.24459 1425 1 0.308962 0.322171 0.219755 304 1 0.357382 0.203977 0.233576 457 1 0.319833 0.281462 0.293048 468 1 0.357689 0.224007 0.314049 180 1 0.483039 0.212241 0.179317 84 1 0.557191 0.185486 0.167066 119 1 0.519711 0.172434 0.244318 365 1 0.441186 0.225466 0.238554 341 1 0.53741 0.294037 0.267508 1167 1 0.452638 0.305065 0.285661 1301 1 0.488648 0.292712 0.216417 1171 1 0.54759 0.32567 0.172808 587 1 0.50161 0.260435 0.319485 308 1 0.47892 0.180742 0.31373 374 1 0.625761 0.320817 0.172277 182 1 0.615671 0.178602 0.270635 212 1 0.592314 0.270981 0.209584 244 1 0.62079 0.298281 0.288493 314 1 0.660207 0.236778 0.246461 467 1 0.660556 0.227768 0.329865 1176 1 0.579363 0.232161 0.315023 317 1 0.724867 0.182876 0.225723 307 1 0.797899 0.27683 0.293495 448 1 0.79233 0.228287 0.20474 316 1 0.740462 0.232994 0.287196 183 1 0.837738 0.211947 0.28011 315 1 0.729249 0.269622 0.222924 247 1 0.787827 0.318282 0.208064 222 1 0.96379 0.217636 0.230992 345 1 0.874313 0.298183 0.302125 252 1 0.932446 0.297715 0.239854 94 1 0.888079 0.225354 0.199086 292 1 0.959256 0.320329 0.311874 420 1 0.912615 0.227578 0.284231 220 1 0.864479 0.325834 0.209381 76 1 0.0205174 0.440811 0.195783 1309 1 0.108298 0.470986 0.210947 200 1 0.0452178 0.373342 0.176029 227 1 0.129485 0.350218 0.230735 1283 1 0.103827 0.336166 0.296165 634 1 0.0210463 0.482657 0.256086 92 1 0.000987446 0.342391 0.218827 349 1 0.0222736 0.382766 0.289826 383 1 0.0825898 0.400944 0.236003 355 1 0.100221 0.434114 0.321425 229 1 0.188123 0.439238 0.188581 73 1 0.206368 0.34124 0.211758 458 1 0.282119 0.349293 0.286348 1293 1 0.263153 0.387529 0.218366 359 1 0.187189 0.346702 0.281335 231 1 0.23725 0.415322 0.278827 454 1 0.276293 0.464556 0.194967 1413 1 0.154268 0.43963 0.25925 358 1 0.343921 0.428849 0.194275 329 1 0.310353 0.426167 0.264817 1296 1 0.357586 0.372816 0.250273 1419 1 0.377214 0.333596 0.315564 363 1 0.424772 0.458307 0.30981 615 1 0.358444 0.408257 0.314998 367 1 0.484269 0.446685 0.25486 238 1 0.487205 0.379485 0.176344 368 1 0.43195 0.344453 0.22041 622 1 0.516799 0.364367 0.275779 372 1 0.551302 0.395149 0.213524 1428 1 0.56069 0.427602 0.296047 1067 1 0.436225 0.42743 0.203423 489 1 0.444073 0.391589 0.28308 1424 1 0.528215 0.466782 0.195681 1079 1 0.674737 0.474231 0.218614 1205 1 0.674866 0.416907 0.300232 433 1 0.680164 0.341552 0.214345 1299 1 0.615289 0.376897 0.270035 1329 1 0.590497 0.456381 0.233494 1053 1 0.763277 0.457093 0.18661 1211 1 0.823356 0.392309 0.202558 1203 1 0.741037 0.340372 0.287542 128 1 0.752225 0.395309 0.236192 377 1 0.828539 0.348123 0.27857 380 1 0.809967 0.450718 0.252766 1281 1 0.832194 0.479504 0.178635 1432 1 0.734629 0.457302 0.266677 1561 1 0.815858 0.47179 0.324965 384 1 0.766248 0.403982 0.312951 476 1 0.953676 0.446399 0.302314 196 1 0.886077 0.437477 0.206708 93 1 0.893609 0.379247 0.261658 127 1 0.925975 0.364467 0.194422 1307 1 0.877211 0.449235 0.286395 510 1 0.968808 0.405184 0.238558 1312 1 0.933002 0.485344 0.244689 1158 1 0.972808 0.495106 0.170553 1508 1 0.104357 0.096002 0.485138 517 1 0.0982011 0.0694295 0.4016 1574 1 0.140307 0.00039441 0.484442 191 1 0.014115 0.153814 0.359414 1378 1 0.0519348 0.0179103 0.440924 385 1 0.0256421 0.0821942 0.396016 386 1 0.0852968 0.134516 0.366963 585 1 0.0693673 0.151644 0.447199 260 1 0.00429774 0.0997613 0.4863 1479 1 0.0788181 0.00184722 0.369992 389 1 0.15015 0.0149222 0.40867 777 1 0.26406 0.134706 0.457282 422 1 0.220833 0.0164828 0.378561 264 1 0.153121 0.0410532 0.333486 1388 1 0.284303 0.0633661 0.376297 524 1 0.159338 0.12554 0.443696 423 1 0.217965 0.0721501 0.425965 325 1 0.240161 0.122381 0.345559 394 1 0.367401 0.0779179 0.338813 393 1 0.352285 0.0668293 0.420251 331 1 0.309872 0.145755 0.376423 426 1 0.362281 0.152314 0.437294 941 1 0.291612 0.0712795 0.480453 1646 1 0.373377 0.0847996 0.490618 272 1 0.452548 0.0233852 0.365928 685 1 0.440141 0.0961087 0.414632 430 1 0.512941 0.0392567 0.407768 593 1 0.53079 0.0960254 0.475924 594 1 0.491009 0.11488 0.352031 469 1 0.568883 0.0140996 0.353862 306 1 0.550626 0.114589 0.401322 437 1 0.508666 0.00834436 0.482344 1528 1 0.59131 0.060578 0.451112 473 1 0.61975 0.128281 0.4481 339 1 0.617056 0.0794317 0.385545 412 1 0.6884 0.0943597 0.433504 440 1 0.638641 0.0113295 0.484221 567 1 0.678833 0.149083 0.381479 406 1 0.657544 0.0206447 0.371142 442 1 0.834316 0.133801 0.460269 701 1 0.854027 0.0667726 0.496171 410 1 0.825359 0.0582804 0.354607 343 1 0.787177 0.0719118 0.474362 446 1 0.821766 0.00638737 0.455428 152 1 0.745939 0.0360859 0.382228 344 1 0.750594 0.11262 0.377187 439 1 0.73834 0.162108 0.49108 574 1 0.924802 0.123231 0.480889 416 1 0.986405 0.0203189 0.481128 387 1 0.88806 0.00803099 0.38649 414 1 0.947325 0.0646549 0.43394 573 1 0.90317 0.0820148 0.351349 474 1 0.873324 0.0709242 0.418219 607 1 0.8732 0.145021 0.393782 417 1 0.948037 0.131569 0.397636 415 1 0.910284 0.0101923 0.484602 647 1 0.132938 0.17366 0.48722 324 1 0.0376887 0.308123 0.445489 162 1 0.0472783 0.294633 0.360392 606 1 0.105916 0.29704 0.421955 424 1 0.0606326 0.214535 0.374046 167 1 0.132191 0.181794 0.391674 451 1 0.0120401 0.235216 0.43518 323 1 0.102738 0.242085 0.469627 619 1 0.190294 0.299326 0.488981 459 1 0.151825 0.299549 0.355747 522 1 0.20686 0.200539 0.494503 1510 1 0.22471 0.182185 0.403992 453 1 0.181225 0.234829 0.343137 556 1 0.275645 0.284265 0.465706 584 1 0.169029 0.258244 0.423359 421 1 0.243095 0.267583 0.392612 716 1 0.360388 0.245274 0.460499 171 1 0.28864 0.207899 0.34077 428 1 0.293271 0.206257 0.460517 554 1 0.385364 0.323993 0.427453 432 1 0.312555 0.267148 0.372492 335 1 0.385689 0.22068 0.397138 555 1 0.450025 0.254754 0.479425 628 1 0.495852 0.193405 0.494914 559 1 0.46722 0.176002 0.4164 560 1 0.481785 0.24993 0.398003 591 1 0.43205 0.271368 0.351434 336 1 0.493854 0.32681 0.351204 499 1 0.531832 0.203538 0.372299 472 1 0.553447 0.272999 0.372245 657 1 0.558057 0.234638 0.440402 531 1 0.566524 0.173239 0.481585 599 1 0.698002 0.233231 0.489541 623 1 0.687278 0.310784 0.423773 596 1 0.612281 0.287054 0.453879 470 1 0.707304 0.286668 0.33397 557 1 0.633356 0.212721 0.449932 562 1 0.60372 0.193246 0.374429 598 1 0.688873 0.238802 0.401867 505 1 0.633898 0.296736 0.364652 251 1 0.795738 0.322883 0.350888 758 1 0.761445 0.300758 0.426605 761 1 0.760244 0.179321 0.414949 291 1 0.795497 0.170321 0.342739 379 1 0.833083 0.212133 0.414051 633 1 0.835802 0.305467 0.420276 373 1 0.76499 0.248105 0.361586 601 1 0.778703 0.228558 0.472995 346 1 0.840201 0.258201 0.355782 293 1 0.961586 0.236513 0.361845 347 1 0.890573 0.203486 0.3501 602 1 0.892376 0.25981 0.473518 449 1 0.976205 0.172848 0.460468 441 1 0.92687 0.201314 0.417747 413 1 0.881122 0.185084 0.47163 351 1 0.973689 0.30173 0.399618 348 1 0.903857 0.330855 0.439907 477 1 0.910418 0.313771 0.369079 702 1 0.954801 0.306514 0.491694 1540 1 0.118541 0.49075 0.469126 509 1 0.00459366 0.364389 0.374123 511 1 0.0494741 0.450401 0.387784 577 1 0.045967 0.432125 0.458591 353 1 0.117711 0.431968 0.419247 488 1 0.0804978 0.376005 0.375927 637 1 0.104525 0.367197 0.463479 1435 1 0.00496014 0.489298 0.3399 361 1 0.223256 0.340232 0.347505 328 1 0.166263 0.384734 0.368438 717 1 0.1654 0.339959 0.430656 481 1 0.179106 0.477048 0.425502 582 1 0.251421 0.448466 0.437661 483 1 0.221768 0.437139 0.361572 485 1 0.17598 0.406024 0.468451 332 1 0.233924 0.378769 0.415999 1285 1 0.159434 0.495557 0.35838 589 1 0.303544 0.365053 0.465644 357 1 0.293478 0.490194 0.34016 583 1 0.311605 0.43882 0.487542 300 1 0.293448 0.412702 0.357203 461 1 0.313174 0.344402 0.391514 745 1 0.349503 0.400724 0.422392 621 1 0.367374 0.455219 0.373769 586 1 0.37512 0.488452 0.499644 592 1 0.419467 0.437071 0.439175 852 1 0.507197 0.386215 0.482841 465 1 0.507707 0.409048 0.347643 493 1 0.50643 0.476761 0.430126 553 1 0.441732 0.347197 0.484773 620 1 0.506779 0.337357 0.430722 1423 1 0.458181 0.458597 0.376612 500 1 0.442793 0.381942 0.370426 370 1 0.544495 0.409736 0.422301 631 1 0.539392 0.478905 0.364258 1305 1 0.634161 0.389243 0.38572 1686 1 0.647298 0.367593 0.460033 491 1 0.577573 0.43933 0.495988 502 1 0.576265 0.369302 0.344124 375 1 0.610061 0.448486 0.347866 590 1 0.585059 0.341769 0.417289 504 1 0.676628 0.440036 0.47356 1563 1 0.620114 0.462218 0.421507 630 1 0.706012 0.362587 0.341813 564 1 0.574062 0.355219 0.491686 858 1 0.766928 0.341606 0.487468 480 1 0.847118 0.383392 0.439794 1471 1 0.844136 0.480304 0.391768 223 1 0.850081 0.401818 0.333372 730 1 0.783031 0.463247 0.462276 636 1 0.733301 0.399144 0.422356 1595 1 0.724146 0.447867 0.354844 508 1 0.798117 0.415644 0.379003 603 1 0.841534 0.335265 0.496424 1437 1 0.983254 0.456889 0.426398 478 1 0.947223 0.395335 0.408568 1439 1 0.903128 0.445187 0.368969 350 1 0.927882 0.380745 0.340514 635 1 0.870733 0.449146 0.460125 734 1 0.916957 0.384536 0.483116 639 1 0.991911 0.364644 0.472594 680 1 0.0751303 0.0818885 0.603716 681 1 0.124811 0.0380624 0.556179 679 1 0.120895 0.123182 0.641904 579 1 0.00827818 0.0806555 0.565714 546 1 0.065833 0.146816 0.531971 677 1 0.0139291 0.115417 0.64565 513 1 0.0613511 0.00264907 0.617027 1634 1 0.0494276 0.0442318 0.519358 650 1 0.20747 0.116434 0.659572 523 1 0.148889 0.117948 0.556142 774 1 0.246723 0.0518102 0.604932 645 1 0.157545 0.0587591 0.629776 427 1 0.224764 0.130127 0.577932 392 1 0.210829 0.098273 0.505569 391 1 0.195727 0.0239806 0.534966 973 1 0.281385 0.12468 0.629059 1776 1 0.424593 0.154402 0.607047 402 1 0.35685 0.108387 0.616058 1774 1 0.304438 0.0943474 0.553019 529 1 0.337601 0.151169 0.506463 1620 1 0.42289 0.0761638 0.582187 907 1 0.309679 0.0451115 0.666055 390 1 0.343234 0.011552 0.516735 1769 1 0.337978 0.0279323 0.586722 527 1 0.521114 0.13409 0.62459 686 1 0.51117 0.135167 0.548475 408 1 0.484606 0.0248112 0.631067 1781 1 0.541132 0.0674604 0.591989 1645 1 0.442366 0.122308 0.505745 1650 1 0.557537 0.0422742 0.532382 431 1 0.480984 0.0627945 0.543704 1778 1 0.592995 0.11012 0.535522 662 1 0.654035 0.0745161 0.613388 658 1 0.694637 0.0177358 0.662223 540 1 0.704175 0.124984 0.586239 403 1 0.668888 0.147156 0.501417 533 1 0.631168 0.0117742 0.564085 1624 1 0.706354 0.0179296 0.527356 503 1 0.667089 0.076449 0.516934 789 1 0.593548 0.126529 0.629392 791 1 0.609572 0.033562 0.656281 534 1 0.785447 0.0214471 0.535987 566 1 0.727207 0.0503445 0.59727 666 1 0.805475 0.0504122 0.606453 479 1 0.766788 0.103422 0.54177 569 1 0.815978 0.126458 0.614579 922 1 0.747952 0.108638 0.647826 545 1 0.995622 0.0487139 0.631352 705 1 0.945937 0.0906826 0.604666 447 1 0.935601 0.0737471 0.529997 641 1 0.874005 0.0839269 0.625977 605 1 0.888772 0.12837 0.56334 411 1 0.868156 0.0306809 0.557653 535 1 0.92538 0.0103477 0.617491 419 1 0.968067 0.139891 0.547208 547 1 0.017764 0.189746 0.584558 551 1 0.0810515 0.224228 0.549893 549 1 0.125647 0.261115 0.64814 838 1 0.113801 0.311437 0.596569 455 1 0.119735 0.299637 0.526166 290 1 0.012821 0.211978 0.513731 684 1 0.0902907 0.1986 0.636732 806 1 0.0372198 0.265665 0.61518 682 1 0.029019 0.284116 0.518507 550 1 0.169133 0.259562 0.573218 678 1 0.251533 0.252424 0.553546 715 1 0.173417 0.187272 0.558018 747 1 0.251302 0.276154 0.626423 815 1 0.17429 0.184588 0.648006 713 1 0.255489 0.204438 0.627718 654 1 0.274001 0.172562 0.547715 843 1 0.182252 0.313772 0.632336 841 1 0.321974 0.236271 0.631969 688 1 0.330777 0.230552 0.522438 683 1 0.312667 0.287818 0.578919 751 1 0.343419 0.319771 0.51236 847 1 0.358253 0.182394 0.577655 1675 1 0.381844 0.304152 0.611137 655 1 0.394904 0.271139 0.538812 746 1 0.322499 0.327007 0.64974 558 1 0.397806 0.197546 0.507138 813 1 0.340537 0.169601 0.656428 719 1 0.412277 0.226 0.633761 561 1 0.46567 0.218192 0.564051 691 1 0.501672 0.207797 0.638329 690 1 0.5614 0.195819 0.561632 689 1 0.464499 0.293168 0.590329 724 1 0.516161 0.319429 0.636104 722 1 0.542185 0.267128 0.576683 778 1 0.494142 0.300907 0.524854 462 1 0.568196 0.271253 0.508929 884 1 0.443337 0.325125 0.662022 563 1 0.64761 0.174885 0.577245 570 1 0.675931 0.204508 0.656844 597 1 0.700709 0.313909 0.573842 595 1 0.645167 0.245157 0.536473 572 1 0.691535 0.308326 0.65521 600 1 0.642239 0.324724 0.524219 721 1 0.596134 0.219906 0.620426 1810 1 0.585932 0.305295 0.65235 337 1 0.72901 0.226782 0.57124 604 1 0.805095 0.184706 0.525231 826 1 0.740438 0.242736 0.652793 726 1 0.774943 0.280821 0.543635 729 1 0.840515 0.21097 0.593035 699 1 0.825589 0.271425 0.643061 853 1 0.755918 0.306263 0.614719 854 1 0.831218 0.318034 0.581935 578 1 0.997583 0.217991 0.666127 673 1 0.966702 0.316373 0.635459 709 1 0.972745 0.251722 0.563423 670 1 0.879644 0.19811 0.653613 575 1 0.889899 0.263086 0.602852 576 1 0.944847 0.185585 0.604706 736 1 0.886283 0.330791 0.638375 321 1 0.911513 0.19323 0.538567 452 1 0.11529 0.418505 0.515152 581 1 0.0345361 0.339277 0.614018 738 1 0.139236 0.474055 0.568773 742 1 0.0701719 0.357719 0.535889 1793 1 0.0405594 0.422361 0.566886 640 1 0.107764 0.488112 0.636631 609 1 0.0643075 0.471246 0.519548 1665 1 0.114625 0.399326 0.592232 865 1 0.0640951 0.399715 0.655405 711 1 0.239197 0.38132 0.503887 611 1 0.218156 0.383362 0.632502 484 1 0.201405 0.428402 0.55972 1825 1 0.23521 0.342484 0.566413 740 1 0.267728 0.461196 0.587365 1798 1 0.197095 0.459978 0.628712 617 1 0.231802 0.47743 0.506697 739 1 0.166065 0.358957 0.531742 876 1 0.283596 0.405829 0.664989 616 1 0.334214 0.446843 0.622216 714 1 0.377512 0.367396 0.562089 748 1 0.306498 0.390382 0.550065 1673 1 0.387945 0.46104 0.565414 1805 1 0.404675 0.412319 0.634782 879 1 0.379218 0.487569 0.65359 588 1 0.392608 0.416839 0.506476 750 1 0.526901 0.494205 0.511652 1816 1 0.567866 0.338083 0.571758 627 1 0.455367 0.45212 0.525002 752 1 0.46997 0.447931 0.613761 753 1 0.52918 0.425526 0.558102 1010 1 0.546124 0.398189 0.627228 977 1 0.477453 0.370744 0.592694 1684 1 0.546374 0.486079 0.632578 1618 1 0.618344 0.448812 0.630962 471 1 0.700961 0.380381 0.631677 1553 1 0.580604 0.495082 0.563011 754 1 0.629106 0.398947 0.530104 1815 1 0.622307 0.366883 0.61896 1463 1 0.656688 0.455013 0.56928 727 1 0.821875 0.408082 0.585822 764 1 0.739564 0.405639 0.531591 885 1 0.714324 0.47383 0.647887 889 1 0.804429 0.490389 0.614396 638 1 0.817053 0.410231 0.503758 895 1 0.820426 0.430555 0.658003 613 1 0.991899 0.341545 0.551244 580 1 0.963324 0.465222 0.519622 1689 1 0.884655 0.45713 0.566266 706 1 0.945354 0.404601 0.553114 861 1 0.990375 0.400556 0.646032 1853 1 0.908236 0.423658 0.641131 766 1 0.976299 0.499951 0.591136 548 1 0.910402 0.341289 0.556763 707 1 0.0645629 0.150666 0.696051 674 1 0.00300387 0.166666 0.731666 676 1 0.0211996 0.0657754 0.700665 646 1 0.0980131 0.0497344 0.713669 1889 1 0.0947055 0.110272 0.770206 802 1 0.0310359 0.0473901 0.784825 908 1 0.0376954 0.1156 0.82224 1898 1 0.227074 0.0224132 0.667885 652 1 0.143827 0.118239 0.712855 1894 1 0.161291 0.0776978 0.805124 780 1 0.230449 0.0499908 0.810611 811 1 0.220987 0.112393 0.767308 773 1 0.183226 0.0573194 0.73585 782 1 0.265109 0.0972751 0.706894 930 1 0.148437 0.159356 0.787859 1130 1 0.260938 0.0160123 0.739019 1773 1 0.347842 0.105658 0.727562 660 1 0.394593 0.0390544 0.668903 939 1 0.290281 0.166525 0.709709 910 1 0.309608 0.0583148 0.787418 687 1 0.409797 0.102357 0.769122 845 1 0.291756 0.138601 0.779459 653 1 0.456699 0.0944118 0.669976 1652 1 0.491864 0.113625 0.743903 1902 1 0.439379 0.0284813 0.782076 659 1 0.45658 0.151905 0.799238 47 1 0.516535 0.0632152 0.81723 693 1 0.525051 0.166423 0.69862 785 1 0.489466 0.0408432 0.726235 532 1 0.53513 0.0718043 0.676766 697 1 0.651159 0.126109 0.681182 667 1 0.673548 0.0197203 0.783312 948 1 0.591439 0.161153 0.82153 857 1 0.58259 0.117001 0.726351 700 1 0.641626 0.149853 0.762935 827 1 0.643826 0.0634059 0.719944 792 1 0.632155 0.0859251 0.801407 953 1 0.710448 0.125372 0.723157 1916 1 0.579162 0.0276866 0.747507 665 1 0.80784 0.0611376 0.682543 1749 1 0.738657 0.0219643 0.735588 859 1 0.715249 0.0915546 0.804767 860 1 0.804928 0.119463 0.82206 668 1 0.785489 0.0728697 0.757144 1918 1 0.826573 0.0266495 0.798997 571 1 0.876209 0.131897 0.686996 388 1 0.942256 0.0607274 0.680638 671 1 0.946999 0.155788 0.673337 735 1 0.963142 0.154465 0.810882 798 1 0.864822 0.093906 0.787728 1791 1 0.910254 0.0229114 0.811879 672 1 0.93439 0.108751 0.752946 796 1 0.890825 0.034313 0.732327 733 1 0.0868806 0.326644 0.671415 770 1 0.0458341 0.184974 0.790381 835 1 0.0213709 0.312271 0.69176 812 1 0.0712477 0.236385 0.716953 840 1 0.0614992 0.303512 0.764935 810 1 0.140673 0.287653 0.736333 46 1 0.132424 0.232435 0.793096 937 1 0.211038 0.166919 0.717865 807 1 0.198976 0.243946 0.672676 809 1 0.255987 0.2618 0.801473 938 1 0.249743 0.21743 0.743359 969 1 0.147536 0.203091 0.718654 842 1 0.209316 0.280533 0.742646 834 1 0.207926 0.33214 0.80421 710 1 0.242134 0.326775 0.695018 42 1 0.21288 0.187021 0.798975 920 1 0.383214 0.173166 0.803689 1001 1 0.28988 0.32542 0.807461 974 1 0.322188 0.237352 0.774236 692 1 0.318183 0.327658 0.740409 81 1 0.371002 0.298579 0.791792 814 1 0.370825 0.194514 0.72025 820 1 0.416191 0.233418 0.775111 1009 1 0.377047 0.286303 0.703156 817 1 0.444403 0.173252 0.720432 114 1 0.461696 0.287981 0.758352 718 1 0.461895 0.251054 0.691716 851 1 0.51966 0.297557 0.808549 849 1 0.474258 0.234532 0.8196 530 1 0.548717 0.250877 0.679169 1011 1 0.516555 0.314194 0.709814 790 1 0.561278 0.231387 0.767086 536 1 0.598378 0.195554 0.70193 878 1 0.583423 0.304109 0.740927 568 1 0.700953 0.201041 0.728363 696 1 0.673239 0.298551 0.778536 822 1 0.634829 0.227084 0.771032 883 1 0.651979 0.260285 0.696203 1016 1 0.625438 0.273908 0.830511 887 1 0.70201 0.225378 0.802965 695 1 0.727289 0.278755 0.72023 704 1 0.811218 0.167714 0.705449 731 1 0.772213 0.247612 0.774629 725 1 0.766307 0.169989 0.770183 804 1 0.847632 0.168996 0.774006 864 1 0.853582 0.241737 0.728569 833 1 0.83651 0.303327 0.772516 824 1 0.7466 0.325549 0.78416 698 1 0.924672 0.256505 0.681437 608 1 0.87269 0.312754 0.71232 991 1 0.935455 0.202281 0.749301 931 1 0.945996 0.29102 0.774728 516 1 0.997984 0.249212 0.743516 862 1 0.886562 0.245238 0.793871 552 1 0.0670383 0.379757 0.732429 839 1 0.135038 0.3851 0.668013 964 1 0.102592 0.364811 0.802135 744 1 0.0899779 0.461598 0.820564 866 1 0.0456905 0.459737 0.752532 890 1 0.0345852 0.405998 0.810557 1725 1 0.022849 0.472089 0.668444 1698 1 0.159226 0.447029 0.691508 737 1 0.149325 0.373427 0.746063 873 1 0.170298 0.467996 0.818767 743 1 0.247625 0.38809 0.765781 1803 1 0.231219 0.469231 0.710175 1676 1 0.246579 0.457288 0.806165 875 1 0.354298 0.401763 0.69751 870 1 0.334802 0.459092 0.736716 1837 1 0.354648 0.486973 0.810845 77 1 0.422636 0.347814 0.742079 848 1 0.357408 0.379958 0.76667 874 1 0.418018 0.445204 0.759179 880 1 0.382 0.407544 0.830007 1674 1 0.467223 0.494055 0.675114 1934 1 0.460096 0.409041 0.707642 1681 1 0.53553 0.473532 0.716557 115 1 0.459605 0.340944 0.811763 1806 1 0.525554 0.364154 0.771704 1711 1 0.561606 0.367401 0.691195 1685 1 0.535159 0.436045 0.803398 625 1 0.650562 0.404317 0.686585 756 1 0.629123 0.471982 0.705208 732 1 0.632286 0.339309 0.703426 723 1 0.597402 0.347919 0.806874 728 1 0.67069 0.37763 0.79004 755 1 0.676404 0.453603 0.765582 856 1 0.598705 0.422882 0.75834 1719 1 0.633723 0.493677 0.803723 1721 1 0.852046 0.49464 0.730405 828 1 0.806458 0.356164 0.667999 981 1 0.804945 0.395912 0.742401 1818 1 0.725639 0.387537 0.699374 82 1 0.742888 0.469555 0.819591 1941 1 0.771441 0.470327 0.738195 765 1 0.742807 0.40152 0.780017 868 1 0.801804 0.410286 0.823699 892 1 0.89924 0.391474 0.832999 1821 1 0.986688 0.428655 0.715368 708 1 0.997028 0.355045 0.761996 767 1 0.86803 0.388902 0.704669 1949 1 0.906732 0.356788 0.766331 893 1 0.956286 0.419647 0.788007 1691 1 0.917828 0.455661 0.716974 894 1 0.939164 0.369352 0.687123 891 1 0.866411 0.435564 0.768589 993 1 0.959435 0.351493 0.825489 6 1 0.130322 0.136823 0.947126 197 1 0.0424932 0.147697 0.997799 933 1 0.0855771 0.0580825 0.860464 967 1 0.0504783 0.114452 0.911938 648 1 0.0433372 0.00608737 0.900859 898 1 0.106397 0.146501 0.845245 41 1 0.0818414 0.0608777 0.946038 906 1 0.248365 0.131038 0.834462 8 1 0.17853 0.0581295 0.945507 269 1 0.256492 0.0839432 0.981548 902 1 0.155187 0.0875269 0.884423 936 1 0.177844 0.166162 0.873282 912 1 0.216056 0.0269801 0.885961 2028 1 0.283208 0.0234448 0.865171 944 1 0.218215 0.111063 0.914875 2032 1 0.346637 0.0200179 0.900888 911 1 0.366676 0.124085 0.873435 45 1 0.290602 0.0894702 0.900848 138 1 0.291335 0.0303226 0.94734 53 1 0.29007 0.151158 0.949678 1134 1 0.426117 0.0248757 0.903965 13 1 0.332234 0.0927599 0.969621 177 1 0.370079 0.0582112 0.836891 20 1 0.406342 0.0694748 0.964322 142 1 0.37381 0.159366 0.942274 819 1 0.512377 0.0355333 0.901923 783 1 0.433937 0.0915285 0.862971 786 1 0.48432 0.109425 0.925149 1138 1 0.490531 0.0426905 0.968987 821 1 0.525934 0.123992 0.86163 21 1 0.55848 0.0957745 0.946365 52 1 0.457888 0.163626 0.972013 49 1 0.579882 0.0487718 0.872231 923 1 0.675672 0.0416697 0.851127 823 1 0.615363 0.112693 0.877629 24 1 0.601326 0.0249094 0.948013 22 1 0.625391 0.140334 0.956907 25 1 0.701991 0.0311096 0.919265 986 1 0.686422 0.108367 0.919304 55 1 0.698072 0.117391 0.998291 928 1 0.831443 0.00926502 0.907212 58 1 0.813977 0.137418 0.984384 189 1 0.801094 0.00884442 0.975184 793 1 0.772416 0.0213955 0.853137 54 1 0.726883 0.161164 0.838148 19 1 0.838303 0.0756328 0.944011 951 1 0.756596 0.0714637 0.966993 825 1 0.841325 0.0716232 0.86463 957 1 0.753957 0.0840821 0.892415 832 1 0.744765 0.150813 0.943701 830 1 0.82129 0.146656 0.901901 954 1 0.892441 0.123157 0.995806 772 1 0.908375 0.00723856 0.922462 769 1 0.917145 0.0653844 0.876309 831 1 0.899154 0.135662 0.851187 805 1 0.970717 0.123297 0.886103 797 1 0.990127 0.0497213 0.849789 57 1 0.902585 0.132019 0.924972 808 1 0.972506 0.124598 0.960685 2 1 0.91516 0.0575946 0.971776 642 1 0.987896 0.048674 0.922302 803 1 0.0479619 0.197932 0.882242 72 1 0.0384918 0.265865 0.999101 174 1 0.108281 0.210282 0.987767 934 1 0.0811738 0.276967 0.852689 816 1 0.0860493 0.288764 0.938366 940 1 0.13608 0.225834 0.89434 935 1 0.00769922 0.271657 0.918948 961 1 0.0224574 0.206815 0.951613 74 1 0.252135 0.249287 0.975016 966 1 0.1668 0.277024 0.972582 972 1 0.205388 0.285597 0.899916 976 1 0.253031 0.224634 0.890423 1007 1 0.279284 0.292944 0.884888 952 1 0.219409 0.178162 0.951029 207 1 0.321322 0.205828 0.994713 971 1 0.324786 0.188861 0.843468 945 1 0.387333 0.204395 0.877782 975 1 0.3199 0.221925 0.916057 43 1 0.385093 0.234167 0.961776 980 1 0.350442 0.280741 0.872928 1043 1 0.392145 0.309011 0.938389 979 1 0.324654 0.28192 0.95932 83 1 0.549793 0.26484 0.940797 240 1 0.465402 0.263373 0.943347 121 1 0.56597 0.295426 0.869879 942 1 0.47249 0.168951 0.881959 950 1 0.535845 0.183588 0.934916 978 1 0.507179 0.24165 0.87772 946 1 0.432573 0.268298 0.880137 850 1 0.500324 0.316687 0.890623 924 1 0.651502 0.253163 0.987653 56 1 0.6882 0.218911 0.928884 863 1 0.661808 0.169197 0.872474 120 1 0.689262 0.26305 0.869587 213 1 0.626166 0.274949 0.916642 818 1 0.584418 0.217627 0.878975 59 1 0.731225 0.22533 0.988859 918 1 0.775242 0.285163 0.840033 1021 1 0.814067 0.226428 0.996773 1017 1 0.719281 0.29556 0.960291 959 1 0.80842 0.308923 0.957831 1019 1 0.806705 0.215358 0.838713 190 1 0.843896 0.264453 0.893265 985 1 0.76945 0.250926 0.919466 1023 1 0.883855 0.329793 0.914422 837 1 0.983124 0.272718 0.83904 990 1 0.879994 0.204933 0.863652 987 1 0.965115 0.304679 0.975887 65 1 0.962161 0.329114 0.897573 217 1 0.883223 0.278242 0.9911 989 1 0.893488 0.306784 0.839462 836 1 0.924741 0.263988 0.914418 37 1 0.933726 0.192355 0.9532 1022 1 0.859726 0.200825 0.943295 932 1 0.966002 0.206394 0.879757 1978 1 0.0190255 0.46544 0.845515 1926 1 0.123433 0.47353 0.886082 66 1 0.0298919 0.347429 0.946797 962 1 0.114161 0.353838 0.875019 1795 1 0.0690849 0.418043 0.877133 1823 1 0.0409286 0.339418 0.844776 1727 1 0.0600928 0.479096 0.938008 999 1 0.114389 0.371222 0.95869 1033 1 0.143324 0.475421 0.979801 1671 1 0.275453 0.393667 0.835791 107 1 0.189404 0.371958 0.984471 79 1 0.272166 0.338738 0.98078 1002 1 0.187997 0.394547 0.837918 867 1 0.222875 0.498769 0.874343 844 1 0.166171 0.412805 0.903638 1004 1 0.220873 0.439742 0.95892 1012 1 0.238671 0.385903 0.899812 110 1 0.412359 0.362346 0.994523 1037 1 0.367488 0.496442 0.962037 78 1 0.342716 0.350868 0.973728 1801 1 0.304893 0.458528 0.862628 1679 1 0.407518 0.339026 0.86543 109 1 0.320161 0.358673 0.897632 106 1 0.30791 0.426995 0.938694 1005 1 0.369919 0.43706 0.891859 1045 1 0.417983 0.425764 0.947091 1006 1 0.441099 0.482174 0.997084 949 1 0.565113 0.342693 0.941636 1040 1 0.502359 0.459135 0.966333 1938 1 0.44849 0.435838 0.873033 113 1 0.485461 0.342351 0.965024 86 1 0.503673 0.403103 0.920056 888 1 0.539279 0.373567 0.846382 1939 1 0.556305 0.450574 0.889675 1812 1 0.604735 0.487171 0.94645 1014 1 0.675799 0.448076 0.978874 992 1 0.702063 0.372503 0.90948 1015 1 0.664085 0.341445 0.853738 88 1 0.653854 0.340364 0.974441 984 1 0.664259 0.442659 0.907173 117 1 0.61329 0.420216 0.840356 1013 1 0.753799 0.436777 0.90551 1947 1 0.763504 0.370872 0.980176 90 1 0.745709 0.353559 0.850015 896 1 0.82265 0.340633 0.869955 1946 1 0.826265 0.465284 0.935938 1025 1 0.835413 0.389542 0.926905 1018 1 0.986382 0.49809 0.909562 1851 1 0.864377 0.453439 0.854274 1925 1 0.957309 0.399009 0.964758 996 1 0.883183 0.429754 0.974976 1955 1 0.940812 0.488061 0.842998 1085 1 0.981207 0.40691 0.881155 1921 1 0.926286 0.446062 0.916024 1156 1 0.0913073 0.649667 0.058215 1027 1 0.0612541 0.54057 0.0979627 1036 1 0.058919 0.607149 0.00172478 997 1 0.0398013 0.524858 3.09552e-05 108 1 0.121286 0.665767 0.133462 1981 1 0.00953706 0.598651 0.0964224 1313 1 0.0432431 0.665437 0.142766 1026 1 0.0159392 0.65993 0.0500613 1195 1 0.0982028 0.582624 0.150192 1162 1 0.130252 0.522678 0.0540387 1030 1 0.150065 0.59954 0.042066 1193 1 0.2108 0.661183 0.158511 230 1 0.237929 0.594144 0.157349 234 1 0.17449 0.551241 0.129875 1069 1 0.219206 0.618725 0.0897913 1008 1 0.241361 0.524649 0.0574747 1163 1 0.272097 0.524821 0.129851 1933 1 0.279812 0.600341 0.019652 1190 1 0.317834 0.543498 0.0622113 1197 1 0.396585 0.588041 0.0990436 1324 1 0.38234 0.612735 0.163046 1963 1 0.42671 0.637561 0.0073896 1104 1 0.356276 0.620112 0.0523241 1931 1 0.396377 0.532804 0.0426022 1928 1 0.293162 0.621476 0.104767 1168 1 0.496892 0.549836 0.0756023 1323 1 0.475081 0.634246 0.0649055 1361 1 0.542438 0.652651 0.0780934 1300 1 0.537226 0.532641 0.144939 1233 1 0.470505 0.57136 0.151331 1172 1 0.513947 0.574011 0.00779117 1042 1 0.566632 0.512359 0.0242075 1294 1 0.518658 0.659982 0.00251792 1166 1 0.680928 0.542005 0.100892 1173 1 0.61523 0.510491 0.0907145 1077 1 0.619592 0.585893 0.142297 1113 1 0.635062 0.602722 0.0730982 1116 1 0.697562 0.6055 0.134917 1174 1 0.577784 0.611027 0.0258247 1973 1 0.640113 0.555077 0.0146917 1078 1 0.805719 0.602707 0.0604388 100 1 0.816349 0.520404 0.0627533 1052 1 0.749969 0.504063 0.123517 1945 1 0.73442 0.618023 0.044791 381 1 0.76435 0.57685 0.12224 1974 1 0.747024 0.537258 0.0583015 1184 1 0.840208 0.563074 0.11856 1214 1 0.797709 0.6581 0.14749 1175 1 0.874688 0.62026 0.153153 1157 1 0.969443 0.570315 0.0336071 1028 1 0.871613 0.600114 0.0216008 1056 1 0.953526 0.553672 0.107685 1181 1 0.895125 0.517193 0.151609 1217 1 0.961075 0.627059 0.157566 1215 1 0.936791 0.621974 0.0839687 1953 1 0.128449 0.760502 0.0360686 1210 1 0.0572354 0.720714 0.0734966 1127 1 0.119236 0.765789 0.107685 1091 1 0.0643807 0.799407 0.0720474 159 1 0.0543947 0.754172 0.14818 1831 1 0.0658804 0.702755 0.00631282 1099 1 0.252784 0.708646 0.0972207 1094 1 0.270751 0.820565 0.0156901 1061 1 0.172491 0.682041 0.044762 1225 1 0.175593 0.713299 0.117611 1189 1 0.239734 0.788502 0.0841915 1223 1 0.194738 0.784902 0.144052 1218 1 0.194047 0.818407 0.0187379 1062 1 0.229544 0.748041 0.0108757 1353 1 0.296834 0.698949 0.156074 1318 1 0.330608 0.768281 0.118699 1354 1 0.30038 0.752114 0.0402619 1996 1 0.340177 0.69393 0.0951962 1066 1 0.408638 0.681691 0.0764665 1356 1 0.402914 0.760461 0.0869756 1358 1 0.388878 0.819418 0.149363 1355 1 0.418036 0.736324 0.013352 2027 1 0.356817 0.685853 0.0194288 1350 1 0.315896 0.832623 0.162169 1068 1 0.288868 0.673196 0.0417077 1268 1 0.525351 0.752085 0.0852235 1325 1 0.448654 0.666958 0.143101 2004 1 0.477076 0.706541 0.0433896 1080 1 0.569585 0.811361 0.121094 1257 1 0.474846 0.808699 0.114058 1237 1 0.508963 0.73061 0.162365 1230 1 0.477622 0.787106 0.0347523 2031 1 0.561094 0.810072 0.0340827 1083 1 0.635122 0.687435 0.0488655 1111 1 0.575964 0.699582 0.126326 1148 1 0.64076 0.812524 0.133136 1107 1 0.704635 0.689078 0.08721 1376 1 0.666338 0.713838 0.153241 1141 1 0.607368 0.765466 0.0751276 1944 1 0.675552 0.751986 0.0347415 1147 1 0.806022 0.816851 0.0622331 1979 1 0.780192 0.685774 0.0694507 1086 1 0.856716 0.668238 0.0919786 1216 1 0.794392 0.761127 0.1334 2043 1 0.821169 0.74544 0.0480945 1241 1 0.737541 0.759193 0.0861291 1109 1 0.840015 0.667215 0.00787259 1048 1 0.744511 0.71796 0.0145384 1106 1 0.773651 0.786946 0.00133738 98 1 0.910676 0.688141 0.153319 27 1 0.88066 0.815583 0.126702 1186 1 0.998795 0.772128 0.108085 2011 1 0.886101 0.741925 0.0922312 1213 1 0.966223 0.696328 0.108859 1060 1 0.937982 0.669926 0.0164945 2007 1 0.929549 0.79055 0.0612797 2015 1 0.904463 0.741273 0.00686058 1090 1 0.981863 0.741367 0.0312206 2020 1 0.0641012 0.890541 0.0815518 1096 1 0.0029389 0.851034 0.0516656 1122 1 0.13174 0.841642 0.066471 1988 1 0.0401887 0.835472 0.123774 135 1 0.0760533 0.960563 0.106296 1 1 0.00764428 0.910385 0.12297 63 1 0.000764382 0.988333 0.114855 1255 1 0.135299 0.835272 0.148336 2021 1 0.13522 0.88957 0.00609208 9 1 0.137888 0.95102 0.0506444 901 1 0.211284 0.898678 0.0138928 1100 1 0.211052 0.852042 0.0962816 2024 1 0.218768 0.924408 0.0860151 1254 1 0.151882 0.954212 0.127339 1227 1 0.274991 0.930995 0.136037 176 1 0.204362 0.996774 0.0760185 1132 1 0.299726 0.887879 0.00939887 1112 1 0.366999 0.836624 0.0386598 1226 1 0.294372 0.843784 0.0901577 1258 1 0.343755 0.898571 0.0801153 10 1 0.296929 0.975104 0.0716809 2025 1 0.351447 0.944209 0.0233507 141 1 0.38723 0.955577 0.109142 148 1 0.485561 0.9925 0.0292057 1904 1 0.432562 0.928553 0.0358184 1269 1 0.560745 0.973842 0.0489946 1232 1 0.453051 0.862674 0.0112377 1259 1 0.515392 0.920842 0.024781 147 1 0.533954 0.923502 0.132764 23 1 0.470629 0.879385 0.158113 1262 1 0.459941 0.929165 0.101882 1270 1 0.508702 0.860838 0.0785262 1261 1 0.431607 0.857579 0.083456 1277 1 0.707387 0.873877 0.073741 1136 1 0.57471 0.905433 0.0708738 1088 1 0.681322 0.916427 0.0198708 156 1 0.654642 0.96562 0.0900167 1401 1 0.647192 0.886092 0.120034 2008 1 0.652803 0.838742 0.0189822 1146 1 0.823664 0.992056 0.0565382 160 1 0.729907 0.969274 0.144864 157 1 0.725939 0.9702 0.0600237 64 1 0.785575 0.910447 0.0817004 29 1 0.819484 0.967743 0.136467 286 1 0.811406 0.856845 0.141528 1120 1 0.814844 0.867288 0.0032902 2048 1 0.773685 0.937896 0.00379655 1149 1 0.870992 0.905457 0.120082 1124 1 0.908873 0.847523 0.0139611 32 1 0.865211 0.920609 0.0357853 1275 1 0.953467 0.842612 0.116954 1280 1 0.925349 0.966097 0.0963211 129 1 0.928018 0.898573 0.0690067 12 1 0.994208 0.930487 0.0174884 1191 1 0.0216579 0.607994 0.208401 1059 1 0.100786 0.57928 0.236648 1187 1 0.082973 0.609981 0.301549 1160 1 0.0518897 0.532369 0.20626 382 1 0.0706454 0.53044 0.282249 1032 1 0.103963 0.654523 0.204047 1438 1 0.127443 0.561081 0.328821 1286 1 0.224394 0.500365 0.299073 360 1 0.16927 0.525916 0.204093 1031 1 0.166544 0.603659 0.198574 1287 1 0.228448 0.548736 0.228716 1155 1 0.15353 0.514141 0.281636 1421 1 0.283202 0.564778 0.314149 486 1 0.232199 0.632091 0.235478 1063 1 0.165404 0.609829 0.279321 482 1 0.204458 0.567655 0.324306 495 1 0.379045 0.503327 0.248665 1194 1 0.292167 0.502142 0.263728 1442 1 0.296305 0.623039 0.200073 1487 1 0.309142 0.640533 0.282415 1164 1 0.340406 0.54801 0.168063 1937 1 0.417916 0.569749 0.284901 1445 1 0.368748 0.639182 0.232838 1292 1 0.318804 0.573022 0.243359 1199 1 0.406667 0.508424 0.180451 460 1 0.357324 0.500882 0.320575 1291 1 0.467637 0.524649 0.227694 1426 1 0.48636 0.509007 0.31609 1359 1 0.437246 0.638744 0.285533 1326 1 0.479908 0.588947 0.331606 1204 1 0.55068 0.555022 0.217418 1450 1 0.503616 0.603503 0.260988 1070 1 0.446676 0.612395 0.208619 1105 1 0.538188 0.619551 0.186956 1332 1 0.540278 0.661987 0.295732 1951 1 0.713841 0.537937 0.186738 1290 1 0.575037 0.50006 0.300962 1206 1 0.614414 0.597182 0.258953 1303 1 0.634541 0.541687 0.213851 1075 1 0.653364 0.655299 0.215825 1302 1 0.572274 0.583361 0.316646 1429 1 0.657363 0.544565 0.28504 250 1 0.742886 0.608164 0.202789 1247 1 0.821813 0.604159 0.24316 1433 1 0.78865 0.586133 0.314568 1341 1 0.78221 0.538376 0.206129 378 1 0.742751 0.535887 0.274356 1180 1 0.854938 0.652589 0.295593 1178 1 0.781478 0.661563 0.309263 124 1 0.851228 0.520662 0.238866 354 1 0.925437 0.550015 0.215035 356 1 0.986344 0.605927 0.330076 1441 1 0.901508 0.593311 0.289548 1310 1 0.960997 0.647709 0.241475 506 1 0.876459 0.65315 0.219362 1469 1 0.949981 0.547843 0.314407 352 1 0.995386 0.553278 0.257603 1375 1 0.933355 0.660793 0.307974 122 1 0.86501 0.531583 0.328164 1245 1 0.0678313 0.819629 0.193593 1221 1 0.130189 0.729786 0.185227 1251 1 0.0559812 0.743443 0.230246 1316 1 0.0604861 0.750975 0.313015 1154 1 0.129834 0.791703 0.23291 1477 1 0.0236743 0.8225 0.258149 1219 1 0.113968 0.698545 0.2654 1185 1 0.0364598 0.668518 0.268045 1072 1 0.214535 0.764479 0.224831 1224 1 0.266018 0.771556 0.168114 1481 1 0.160512 0.742169 0.324048 1328 1 0.241297 0.75759 0.29312 1196 1 0.176968 0.695274 0.229138 1482 1 0.225893 0.684128 0.305551 1514 1 0.184617 0.813514 0.331993 1231 1 0.370045 0.685445 0.170217 1288 1 0.291348 0.705571 0.248193 1317 1 0.367494 0.752488 0.202187 1321 1 0.358079 0.76474 0.32429 1315 1 0.295508 0.794594 0.233939 1322 1 0.365269 0.833293 0.278263 1484 1 0.292002 0.807799 0.31871 1229 1 0.427658 0.777454 0.244598 1452 1 0.293032 0.720367 0.331774 1200 1 0.364942 0.706073 0.272811 1614 1 0.424539 0.816814 0.327164 1201 1 0.434062 0.75331 0.16689 1320 1 0.433761 0.695431 0.230563 1044 1 0.509793 0.672857 0.231848 1103 1 0.499006 0.809956 0.188595 1202 1 0.469198 0.708757 0.291083 1366 1 0.541115 0.76123 0.230075 1486 1 0.487636 0.807111 0.289451 1272 1 0.557151 0.818686 0.306151 1071 1 0.581276 0.682219 0.217622 1143 1 0.590299 0.751376 0.171417 1209 1 0.63118 0.68143 0.292985 1238 1 0.591891 0.818721 0.232109 1334 1 0.667698 0.800843 0.217904 1369 1 0.577202 0.742228 0.293605 1408 1 0.65272 0.766481 0.283334 1212 1 0.703957 0.676807 0.260581 1403 1 0.706042 0.809365 0.320121 1087 1 0.845875 0.734666 0.178522 1248 1 0.728519 0.679423 0.188866 155 1 0.726453 0.76184 0.167245 1115 1 0.724049 0.758109 0.251542 1367 1 0.733843 0.728719 0.317919 1402 1 0.804744 0.686961 0.234439 1342 1 0.813325 0.765762 0.329799 283 1 0.765873 0.817893 0.251593 1243 1 0.786464 0.762735 0.215806 1249 1 0.99248 0.737194 0.27588 1151 1 0.91268 0.760642 0.166974 3 1 0.998101 0.791623 0.19025 1349 1 0.940609 0.783912 0.242216 1407 1 0.884023 0.802057 0.332383 1182 1 0.979213 0.712085 0.181892 1344 1 0.909319 0.70791 0.253771 1188 1 0.868938 0.76906 0.258459 1220 1 0.921115 0.738974 0.320068 1405 1 0.858755 0.826425 0.200947 1474 1 0.113967 0.871685 0.238374 1125 1 0.0294442 0.884766 0.196673 1346 1 0.069344 0.928684 0.243141 1379 1 0.0950448 0.977321 0.176744 1506 1 0.0231909 0.976312 0.317552 1192 1 0.10162 0.897212 0.166984 1478 1 0.0929035 0.92868 0.318761 1253 1 0.139974 0.938059 0.226652 136 1 0.114735 0.998661 0.264865 1128 1 0.0335532 0.993815 0.233209 1278 1 0.183081 0.891998 0.168618 1228 1 0.218576 0.961648 0.18713 1381 1 0.266766 0.940163 0.29334 1352 1 0.240006 0.84224 0.185459 1383 1 0.190142 0.834663 0.255515 1347 1 0.194951 0.903634 0.288724 1389 1 0.247867 0.892941 0.232591 1511 1 0.185793 0.969116 0.321414 1357 1 0.352459 0.931984 0.289944 1390 1 0.31849 0.867589 0.234559 266 1 0.399221 0.907677 0.172632 1385 1 0.310351 0.995697 0.170531 1384 1 0.382763 0.970798 0.224634 267 1 0.322891 0.938842 0.211242 1642 1 0.298543 0.878253 0.326329 1362 1 0.406233 0.889142 0.31688 1391 1 0.449298 0.961457 0.174161 1393 1 0.524238 0.9366 0.221129 1244 1 0.551505 0.869509 0.175599 1397 1 0.528947 0.856067 0.245471 1236 1 0.438591 0.855125 0.220648 1364 1 0.437445 0.954205 0.282134 1267 1 0.474943 0.87738 0.296739 1266 1 0.478044 0.99934 0.241177 1398 1 0.622701 0.886817 0.20203 1368 1 0.590003 0.896254 0.291857 1239 1 0.642246 0.843953 0.280611 1365 1 0.693681 0.910323 0.185074 1370 1 0.599314 0.951889 0.237856 154 1 0.67053 0.991454 0.243424 278 1 0.684727 0.898792 0.321477 1502 1 0.70244 0.870015 0.250425 1274 1 0.634557 0.962175 0.174638 1532 1 0.628166 0.954221 0.315405 282 1 0.841064 0.950263 0.28183 279 1 0.728595 0.999888 0.32054 1252 1 0.749023 0.839903 0.17568 1276 1 0.814635 0.884311 0.246121 443 1 0.774914 0.914867 0.180825 1152 1 0.735726 0.946464 0.255788 319 1 0.856129 0.921446 0.187235 1404 1 0.766128 0.895468 0.303594 313 1 0.80097 0.984256 0.226967 4 1 0.949236 0.938268 0.170375 1345 1 0.962438 0.838747 0.324584 1279 1 0.900677 0.839572 0.257265 1377 1 0.902017 0.918941 0.251131 1380 1 0.865271 0.878174 0.308597 1250 1 0.949728 0.844986 0.185974 1629 1 0.949807 0.908477 0.329205 26 1 0.88063 0.991144 0.211964 1406 1 0.981539 0.941584 0.264488 1311 1 0.089476 0.511071 0.398507 1183 1 0.0990379 0.616462 0.384188 1537 1 0.0417263 0.571126 0.369549 1343 1 0.0991525 0.575588 0.445699 507 1 0.0351549 0.508024 0.462528 1598 1 0.0424462 0.631417 0.443927 1539 1 0.159548 0.605841 0.486764 1282 1 0.233649 0.55546 0.462506 487 1 0.237049 0.51996 0.385716 512 1 0.169777 0.566092 0.400583 232 1 0.192966 0.638696 0.346494 1416 1 0.169816 0.634956 0.422507 1449 1 0.246906 0.616764 0.408629 1420 1 0.283057 0.647845 0.352867 1414 1 0.227976 0.655394 0.493007 614 1 0.380116 0.538583 0.419149 1552 1 0.374376 0.651624 0.494483 464 1 0.417168 0.593601 0.368237 1289 1 0.304631 0.575861 0.409373 1415 1 0.300012 0.643934 0.443888 333 1 0.351708 0.56345 0.352835 1453 1 0.359312 0.652259 0.346085 1417 1 0.370559 0.621448 0.422465 1545 1 0.422075 0.51929 0.357886 1543 1 0.313422 0.579247 0.48757 492 1 0.409959 0.574413 0.49568 456 1 0.301499 0.507651 0.43743 497 1 0.445975 0.500407 0.46727 496 1 0.460756 0.628423 0.427781 498 1 0.481343 0.658365 0.348375 1585 1 0.494342 0.535293 0.392495 1335 1 0.540885 0.621154 0.375255 1557 1 0.549163 0.539776 0.4466 1427 1 0.693948 0.516128 0.39131 1550 1 0.609364 0.512357 0.493988 1331 1 0.598721 0.51755 0.377173 1465 1 0.681072 0.594076 0.434539 1327 1 0.650676 0.582948 0.369528 1298 1 0.593483 0.648105 0.436637 1530 1 0.666563 0.660597 0.403412 1491 1 0.607176 0.648948 0.357068 1494 1 0.617255 0.573522 0.45398 632 1 0.682139 0.52532 0.467733 1207 1 0.718784 0.666451 0.354152 376 1 0.717056 0.581702 0.349985 1430 1 0.823401 0.5673 0.381462 1596 1 0.821623 0.547448 0.465229 1337 1 0.825198 0.638482 0.371708 1431 1 0.828993 0.621544 0.445306 759 1 0.754813 0.552918 0.430058 1373 1 0.756268 0.61685 0.402396 1560 1 0.770021 0.520641 0.353183 1339 1 0.904715 0.625551 0.365585 763 1 0.879629 0.51597 0.491238 1558 1 0.888129 0.560936 0.434692 1411 1 0.980596 0.548363 0.429213 1599 1 0.979268 0.622625 0.413589 1412 1 0.930774 0.520154 0.377244 1672 1 0.944835 0.561307 0.489835 1475 1 0.0819883 0.678037 0.488313 1348 1 0.110157 0.783656 0.356975 1702 1 0.12156 0.745439 0.498407 1533 1 0.102817 0.691823 0.34198 1444 1 0.00194958 0.69249 0.344385 1314 1 0.110567 0.714586 0.410531 1470 1 0.116694 0.797494 0.448278 1600 1 0.0401097 0.777995 0.428624 1631 1 0.0368544 0.698471 0.419347 1578 1 0.196424 0.776231 0.467089 1538 1 0.176339 0.701185 0.459007 1448 1 0.178783 0.745364 0.393398 1480 1 0.198867 0.82725 0.406314 1575 1 0.229778 0.687645 0.396555 1284 1 0.238419 0.774795 0.369242 1609 1 0.257287 0.749107 0.446311 1516 1 0.343461 0.696417 0.405301 1485 1 0.362609 0.803506 0.470799 1319 1 0.422641 0.727453 0.340772 1451 1 0.418298 0.677799 0.391971 1456 1 0.315806 0.784104 0.405231 1490 1 0.393954 0.764899 0.400849 1454 1 0.390735 0.716532 0.464975 1422 1 0.310457 0.712299 0.494697 1330 1 0.528029 0.687682 0.43837 1234 1 0.507237 0.751993 0.345196 1265 1 0.461426 0.721836 0.432032 1584 1 0.512082 0.757283 0.495578 1464 1 0.494175 0.822278 0.368949 1235 1 0.544741 0.77012 0.416308 1208 1 0.562051 0.704196 0.360112 1363 1 0.462772 0.793871 0.451132 1374 1 0.657317 0.71702 0.348964 1240 1 0.619995 0.776296 0.354442 1498 1 0.684891 0.768878 0.401183 1338 1 0.661408 0.668478 0.480479 1462 1 0.581376 0.726889 0.497795 1372 1 0.625281 0.718009 0.421984 1308 1 0.633417 0.822078 0.415521 1497 1 0.657943 0.750477 0.474051 401 1 0.62141 0.809843 0.497963 1500 1 0.757076 0.797248 0.381333 1179 1 0.784266 0.704513 0.373667 1658 1 0.728999 0.696895 0.427283 1461 1 0.798281 0.717479 0.464403 1371 1 0.821318 0.770914 0.416798 1340 1 0.964595 0.705584 0.41274 1306 1 0.862035 0.710275 0.354768 1467 1 0.862824 0.688765 0.428982 1612 1 0.983297 0.766266 0.372265 1504 1 0.900903 0.758596 0.390262 1472 1 0.887023 0.757321 0.472903 1410 1 0.956063 0.770339 0.44205 1436 1 0.985887 0.676739 0.493384 626 1 0.894913 0.676602 0.498883 1632 1 0.116506 0.881871 0.478594 1505 1 0.0555457 0.857024 0.337461 1640 1 0.0545517 0.956115 0.475371 1509 1 0.0318657 0.952537 0.398305 1512 1 0.0671237 0.861804 0.412173 1488 1 0.104113 0.939294 0.412682 1605 1 0.0237698 0.835202 0.469744 1351 1 0.132578 0.872403 0.363932 1489 1 0.228671 0.880772 0.356586 1515 1 0.272096 0.853608 0.480148 1638 1 0.209617 0.976644 0.458994 526 1 0.27408 0.942696 0.392765 518 1 0.197956 0.93434 0.397935 1507 1 0.194247 0.861065 0.479569 1738 1 0.349143 0.879809 0.451352 263 1 0.305042 0.997508 0.360727 299 1 0.29873 0.980881 0.451658 1513 1 0.287155 0.853911 0.398971 1619 1 0.427102 0.853674 0.405513 1360 1 0.354564 0.920572 0.377525 1387 1 0.359549 0.837119 0.363576 1519 1 0.421955 0.862125 0.497873 525 1 0.364699 0.947906 0.480176 1524 1 0.376525 0.996888 0.388959 528 1 0.433617 0.988549 0.442271 1520 1 0.431494 0.953907 0.360986 1399 1 0.502514 0.911108 0.356458 1521 1 0.440638 0.913427 0.447144 1525 1 0.51166 0.863289 0.443367 1653 1 0.505687 0.952401 0.432033 399 1 0.500986 0.92735 0.499665 435 1 0.589463 0.896781 0.457614 537 1 0.659242 0.927197 0.493534 1395 1 0.579097 0.852703 0.377414 285 1 0.685529 0.977581 0.42206 1527 1 0.695527 0.836083 0.454005 400 1 0.579601 0.934509 0.372419 407 1 0.604468 0.989099 0.421116 1493 1 0.640695 0.907151 0.406314 438 1 0.750478 0.992351 0.458905 1536 1 0.807256 0.975574 0.364906 1662 1 0.810633 0.937099 0.462091 1627 1 0.790791 0.851693 0.428059 1626 1 0.806909 0.841611 0.351597 1499 1 0.829469 0.906069 0.37948 1526 1 0.730064 0.921964 0.452363 565 1 0.747208 0.934782 0.373017 1529 1 0.718965 0.864537 0.376103 418 1 0.958695 0.989831 0.369884 445 1 0.881184 0.945224 0.351712 1473 1 0.90513 0.858053 0.373736 1246 1 0.944631 0.848906 0.44121 1503 1 0.997276 0.875727 0.382843 1630 1 0.886594 0.944203 0.423188 1603 1 0.999469 0.901629 0.459387 287 1 0.959235 0.96156 0.436086 1501 1 0.870261 0.847163 0.441228 1476 1 0.917215 0.89953 0.495627 1447 1 0.101351 0.607149 0.645062 1601 1 0.0425878 0.538061 0.665156 1573 1 0.0926773 0.559665 0.593687 1726 1 0.0234163 0.610736 0.639578 1757 1 0.0823647 0.634415 0.555525 1409 1 0.0806308 0.552841 0.519159 1694 1 0.00868178 0.578537 0.573712 1569 1 0.0285047 0.598788 0.506614 1697 1 0.157283 0.545364 0.636795 1443 1 0.185608 0.612645 0.612935 1571 1 0.238457 0.544039 0.643171 1541 1 0.228148 0.657486 0.573173 1833 1 0.150546 0.542557 0.538942 1546 1 0.228821 0.593447 0.534265 610 1 0.226974 0.52717 0.564068 1861 1 0.24883 0.636652 0.649694 1542 1 0.286625 0.597532 0.587377 1669 1 0.371693 0.59259 0.56022 1544 1 0.400556 0.573214 0.634192 1548 1 0.309576 0.64551 0.531077 1579 1 0.407411 0.655299 0.582182 1706 1 0.335128 0.654393 0.60541 712 1 0.314373 0.527052 0.61236 1699 1 0.325839 0.59908 0.648943 1966 1 0.395773 0.665182 0.659549 741 1 0.302914 0.519078 0.525238 757 1 0.456864 0.596563 0.558831 1551 1 0.467275 0.629046 0.637622 1492 1 0.541002 0.618078 0.588367 1517 1 0.518182 0.617155 0.516929 1549 1 0.516353 0.562984 0.645857 1460 1 0.523128 0.543208 0.570356 749 1 0.428753 0.52792 0.54441 1559 1 0.670243 0.515556 0.605992 1556 1 0.589001 0.538951 0.629112 1459 1 0.610374 0.629145 0.521077 720 1 0.579945 0.609626 0.651933 1688 1 0.662362 0.56986 0.530805 1458 1 0.642271 0.622542 0.597167 1583 1 0.591933 0.562242 0.544893 1593 1 0.648344 0.56387 0.659876 1555 1 0.801973 0.605307 0.637181 1682 1 0.718503 0.566726 0.629082 1592 1 0.741153 0.617287 0.584207 1564 1 0.797423 0.6604 0.584772 1813 1 0.825932 0.549673 0.566319 1568 1 0.797935 0.61043 0.51302 629 1 0.759 0.533339 0.518492 1440 1 0.722556 0.612436 0.500307 1723 1 0.926387 0.572571 0.624522 612 1 0.90322 0.536423 0.557587 1567 1 0.937133 0.608353 0.557554 1661 1 0.900852 0.663595 0.573917 1750 1 0.949423 0.657201 0.655512 886 1 0.885588 0.507302 0.624925 1565 1 0.879677 0.595954 0.517378 1570 1 0.0173229 0.756202 0.511564 1882 1 0.0954287 0.765117 0.622059 1828 1 0.0722178 0.802392 0.55075 1792 1 0.0222947 0.775616 0.591527 1887 1 0.0715318 0.715441 0.551214 1761 1 0.107243 0.682159 0.616195 1917 1 0.0425104 0.725045 0.651471 1704 1 0.148913 0.668258 0.529393 1730 1 0.163697 0.802197 0.534064 1577 1 0.265548 0.727461 0.655268 1701 1 0.220611 0.729255 0.530666 1606 1 0.155146 0.727128 0.568224 1733 1 0.200764 0.831155 0.647777 1641 1 0.283415 0.708348 0.576653 1607 1 0.216217 0.771146 0.59751 1611 1 0.274555 0.790631 0.535815 1739 1 0.196375 0.692925 0.635968 1635 1 0.165103 0.762992 0.654696 1616 1 0.364382 0.731479 0.54646 1610 1 0.35677 0.808509 0.543139 1455 1 0.423547 0.726428 0.607581 1581 1 0.352703 0.723881 0.643503 1836 1 0.313922 0.780631 0.602777 1649 1 0.419918 0.833195 0.580578 1587 1 0.417026 0.779641 0.514789 1554 1 0.475487 0.670742 0.573153 1586 1 0.539903 0.698517 0.610012 1523 1 0.448188 0.793751 0.647108 1613 1 0.531868 0.771079 0.647261 1418 1 0.45495 0.694305 0.504558 1651 1 0.558195 0.813171 0.567403 1747 1 0.489532 0.700042 0.661182 1468 1 0.505647 0.765418 0.567588 1336 1 0.600303 0.691779 0.563881 1623 1 0.669255 0.733197 0.555571 1590 1 0.708278 0.771008 0.647047 1745 1 0.645841 0.712032 0.628926 1495 1 0.647388 0.80706 0.592378 1496 1 0.714712 0.68033 0.632249 1909 1 0.725146 0.8042 0.569387 1562 1 0.842203 0.708944 0.549417 1597 1 0.853483 0.671295 0.643803 1621 1 0.763388 0.741162 0.570386 1333 1 0.754309 0.68567 0.521734 1657 1 0.813947 0.797822 0.531602 1434 1 0.72781 0.754647 0.504826 1576 1 0.994189 0.831155 0.541319 1466 1 0.929038 0.739532 0.542593 1760 1 0.993843 0.67222 0.572157 1787 1 0.96698 0.737042 0.621922 1628 1 0.886014 0.74084 0.62931 1572 1 0.93419 0.797194 0.592619 1914 1 0.97847 0.802531 0.660218 1754 1 0.922128 0.814193 0.509575 1608 1 0.117791 0.838154 0.633984 1602 1 0.0434186 0.892103 0.535543 515 1 0.131153 0.970255 0.597818 1765 1 0.0381232 0.858801 0.610038 1770 1 0.112283 0.872369 0.561895 519 1 0.0969506 0.912036 0.651812 1762 1 0.0284861 0.933429 0.640293 1636 1 0.0686703 0.973929 0.548836 520 1 0.141738 0.934037 0.531194 1637 1 0.284247 0.863401 0.565088 1446 1 0.212569 0.845901 0.566471 1639 1 0.27894 0.842125 0.633262 1643 1 0.168687 0.891279 0.607075 396 1 0.243615 0.90808 0.617489 1644 1 0.277763 0.979885 0.626921 514 1 0.278357 0.981693 0.542254 425 1 0.215426 0.925964 0.550606 1768 1 0.203868 0.980039 0.594812 521 1 0.290013 0.921701 0.502671 656 1 0.337917 0.943838 0.570485 1743 1 0.31535 0.910844 0.651146 1648 1 0.36983 0.883888 0.600566 781 1 0.402974 0.988029 0.598023 1869 1 0.394559 0.937889 0.646117 1647 1 0.407215 0.928653 0.549354 434 1 0.428272 0.986447 0.520186 651 1 0.348602 0.883055 0.527558 1617 1 0.536381 0.872426 0.661119 1777 1 0.507902 0.98163 0.556459 1780 1 0.45489 0.937628 0.597628 1905 1 0.440468 0.866993 0.651049 788 1 0.489549 0.936329 0.663842 787 1 0.532787 0.89195 0.581882 1779 1 0.563593 0.988799 0.614881 1588 1 0.488197 0.840595 0.519218 542 1 0.710259 0.968034 0.588475 1748 1 0.629296 0.854786 0.663026 1656 1 0.685741 0.857395 0.52337 664 1 0.647755 0.959603 0.623971 1874 1 0.653322 0.889309 0.594095 1910 1 0.591638 0.931371 0.666006 1782 1 0.585265 0.957445 0.518604 1622 1 0.589021 0.875895 0.530893 1625 1 0.745996 0.842389 0.636166 1784 1 0.725006 0.894925 0.568527 1654 1 0.801985 0.892446 0.566831 1655 1 0.833132 0.870431 0.635036 1785 1 0.771188 0.918148 0.647322 538 1 0.753833 0.948027 0.523317 543 1 0.836577 0.950488 0.665965 1531 1 0.759972 0.855364 0.513172 409 1 0.855096 0.95576 0.517686 661 1 0.765757 0.996657 0.654708 475 1 0.79804 0.958889 0.597975 1790 1 0.839734 0.878586 0.501534 541 1 0.888347 0.871997 0.57763 1659 1 0.982029 0.879571 0.656945 1535 1 0.99071 0.951985 0.508854 544 1 0.925349 0.977355 0.548377 1633 1 0.995436 0.984958 0.586861 539 1 0.873567 0.954434 0.591914 1664 1 0.96223 0.905353 0.575548 1858 1 0.911965 0.920558 0.647116 1666 1 0.102008 0.579302 0.732524 1819 1 0.112187 0.504528 0.74403 1857 1 0.0722391 0.645679 0.701822 1728 1 0.0939022 0.613961 0.800609 1670 1 0.136802 0.643607 0.743397 1668 1 0.0455925 0.539096 0.787298 1895 1 0.0194419 0.594843 0.73698 1759 1 0.0135168 0.651013 0.789494 872 1 0.22438 0.533862 0.796944 1729 1 0.203198 0.538832 0.719647 1827 1 0.270567 0.57988 0.712943 1705 1 0.214554 0.645428 0.737352 1707 1 0.176101 0.614008 0.685864 1580 1 0.26821 0.600534 0.782799 1794 1 0.158422 0.575967 0.781967 624 1 0.301173 0.501722 0.678038 1809 1 0.42666 0.516269 0.819431 1709 1 0.311672 0.663469 0.691927 1808 1 0.300266 0.52304 0.769044 1547 1 0.353008 0.56799 0.71171 1840 1 0.350686 0.580517 0.800722 1712 1 0.396093 0.517451 0.751721 760 1 0.569925 0.565252 0.710175 1677 1 0.528941 0.638447 0.700712 1716 1 0.440503 0.578108 0.785775 1834 1 0.429742 0.6199 0.73108 618 1 0.436438 0.556296 0.700568 1838 1 0.51646 0.588134 0.787365 1752 1 0.458757 0.65383 0.811446 1848 1 0.510454 0.503701 0.824185 1714 1 0.643057 0.645642 0.678955 1967 1 0.584613 0.571317 0.83201 1713 1 0.637718 0.550736 0.744144 1678 1 0.594372 0.624319 0.742747 1742 1 0.669171 0.615338 0.747255 1943 1 0.710734 0.522609 0.782578 1692 1 0.707844 0.539983 0.699129 1845 1 0.623143 0.635924 0.823893 846 1 0.571861 0.519061 0.773315 1695 1 0.810976 0.539256 0.773807 1843 1 0.716848 0.624978 0.688198 1696 1 0.7814 0.527388 0.686548 1814 1 0.75721 0.573283 0.824403 1846 1 0.746171 0.585849 0.750949 1975 1 0.819331 0.596376 0.730171 1885 1 0.852264 0.549298 0.68285 2010 1 0.782425 0.648944 0.784389 1693 1 0.89087 0.620621 0.686268 768 1 0.878514 0.568546 0.773838 1850 1 0.950825 0.583979 0.769821 1856 1 0.923017 0.503221 0.77506 1855 1 0.997537 0.520776 0.729611 1566 1 0.947114 0.574958 0.69999 762 1 0.950581 0.502053 0.675261 1722 1 0.872443 0.651461 0.788879 1854 1 0.00594435 0.692329 0.717771 1886 1 0.0803496 0.690988 0.771013 1756 1 0.116766 0.713872 0.689567 1884 1 0.00661098 0.739342 0.780911 1764 1 0.107559 0.773127 0.766608 1736 1 0.0896653 0.808487 0.696197 1758 1 0.0260566 0.778815 0.714075 1893 1 0.0028276 0.824218 0.775195 799 1 0.0605573 0.796531 0.822 1483 1 0.255717 0.797473 0.691762 1737 1 0.230311 0.69332 0.788449 1604 1 0.219197 0.727986 0.719815 1755 1 0.171639 0.773153 0.81891 1802 1 0.247582 0.789158 0.782497 1826 1 0.154991 0.712315 0.782965 1830 1 0.17399 0.791927 0.74315 1775 1 0.339972 0.777743 0.685112 1865 1 0.292477 0.713037 0.753153 1867 1 0.410411 0.742496 0.697763 1582 1 0.336589 0.668261 0.810653 1735 1 0.365535 0.695296 0.738938 2029 1 0.422549 0.736137 0.823248 2023 1 0.327093 0.793631 0.766917 881 1 0.562185 0.704514 0.686603 1717 1 0.529018 0.77462 0.73063 1839 1 0.537199 0.673603 0.772522 1844 1 0.515495 0.739687 0.800827 1877 1 0.506721 0.816667 0.794352 1101 1 0.432791 0.804387 0.768015 1932 1 0.464077 0.701324 0.742105 1746 1 0.602835 0.777825 0.681897 1753 1 0.68199 0.813861 0.707758 1878 1 0.641762 0.689712 0.756844 1842 1 0.593371 0.744902 0.78932 1715 1 0.693107 0.716088 0.701073 1971 1 0.622537 0.807644 0.746867 1912 1 0.695569 0.781727 0.79132 1751 1 0.776553 0.746097 0.672253 1591 1 0.716546 0.673207 0.755561 1915 1 0.777251 0.715241 0.744753 1911 1 0.75764 0.797604 0.765773 1718 1 0.777437 0.66934 0.685097 1849 1 0.846584 0.748991 0.777211 1954 1 0.838048 0.673626 0.725035 1783 1 0.809093 0.819976 0.709208 1881 1 0.751894 0.732829 0.806527 1920 1 0.824991 0.819121 0.809186 1594 1 0.857947 0.747127 0.698904 1724 1 0.961658 0.752893 0.715853 1690 1 0.91965 0.68346 0.730818 1982 1 0.923777 0.741837 0.785042 2045 1 0.888377 0.813312 0.752892 1952 1 0.947036 0.674246 0.808888 1766 1 0.0671325 0.978349 0.692946 1763 1 0.0253606 0.979401 0.823352 1663 1 0.0371486 0.866713 0.719755 1896 1 0.0455625 0.911329 0.791111 1890 1 0.106674 0.930091 0.729958 1992 1 0.0689249 0.986035 0.763233 1789 1 0.1065 0.860792 0.759405 675 1 0.13718 0.996985 0.6829 1734 1 0.151096 0.855776 0.698682 1740 1 0.231398 0.864444 0.721506 1767 1 0.195906 0.850966 0.782846 649 1 0.179095 0.933937 0.682353 1772 1 0.278632 0.864196 0.787603 1771 1 0.208391 0.930575 0.760774 1866 1 0.265036 0.954678 0.694759 1864 1 0.260427 0.96899 0.797753 2022 1 0.152451 0.999735 0.779702 784 1 0.150971 0.909116 0.807034 1901 1 0.334955 0.971306 0.713243 1615 1 0.37488 0.843073 0.670926 1744 1 0.308835 0.857992 0.708167 1872 1 0.36772 0.862046 0.75848 1868 1 0.318127 0.927123 0.77335 1899 1 0.406189 0.931052 0.790987 1870 1 0.350334 0.991496 0.784737 1906 1 0.549006 0.996966 0.689743 1741 1 0.483907 0.83653 0.708017 1880 1 0.560398 0.852229 0.730216 1903 1 0.433809 0.978883 0.71191 1873 1 0.434401 0.902512 0.715783 917 1 0.497016 0.977835 0.767636 2034 1 0.479838 0.894132 0.77738 2040 1 0.555757 0.933635 0.747562 2035 1 0.55806 0.992236 0.814798 915 1 0.637816 0.955931 0.801573 1720 1 0.636783 0.901892 0.738118 2013 1 0.68935 0.853948 0.779554 2038 1 0.692225 0.902708 0.668205 1875 1 0.584225 0.846315 0.808627 2037 1 0.708247 0.94846 0.749909 1907 1 0.580878 0.920441 0.814459 1144 1 0.636069 0.985421 0.714815 1786 1 0.816012 0.997096 0.720309 663 1 0.742649 0.868212 0.709158 1913 1 0.771042 0.875406 0.798334 955 1 0.770964 0.972903 0.790672 1142 1 0.855547 0.908187 0.781863 1788 1 0.819774 0.897183 0.715676 1660 1 0.893647 0.846152 0.67893 1534 1 0.960017 0.973462 0.689262 644 1 0.988123 0.924472 0.746109 2017 1 0.908609 0.851201 0.809933 1121 1 0.947645 0.854506 0.732904 669 1 0.873432 0.962809 0.741472 1732 1 0.916939 0.94275 0.814286 1991 1 0.976158 0.906741 0.823221 1804 1 0.0655322 0.52567 0.869818 1924 1 0.094649 0.564817 0.939414 1822 1 0.000197657 0.552627 0.857706 1797 1 0.0658046 0.63454 0.938283 1957 1 0.00357664 0.628632 0.864501 1117 1 0.018434 0.573705 0.938654 1800 1 0.102998 0.622331 0.877426 1829 1 0.284473 0.552999 0.862662 1703 1 0.163479 0.666456 0.843293 1700 1 0.209219 0.639734 0.919708 1927 1 0.14903 0.620346 0.965414 1923 1 0.174154 0.542642 0.931802 1710 1 0.209772 0.605896 0.840315 998 1 0.242964 0.572728 0.926629 1667 1 0.146969 0.551577 0.863312 1959 1 0.221983 0.656681 0.988369 1064 1 0.280259 0.629772 0.858795 869 1 0.245333 0.500311 0.98374 1000 1 0.214849 0.569699 0.99933 1936 1 0.424432 0.507535 0.899461 1929 1 0.33787 0.597551 0.889401 877 1 0.296725 0.517626 0.934609 1807 1 0.40539 0.576155 0.869203 1035 1 0.359067 0.580656 0.983122 1680 1 0.353369 0.522113 0.88118 1960 1 0.313871 0.638064 0.962164 1998 1 0.43673 0.573282 0.96485 1997 1 0.563546 0.62345 0.885141 1811 1 0.483413 0.579174 0.850437 1038 1 0.565838 0.554344 0.952708 1969 1 0.503637 0.515018 0.900608 2003 1 0.497625 0.599115 0.931304 1841 1 0.621853 0.58636 0.914172 1589 1 0.674865 0.572439 0.83808 1084 1 0.680464 0.546268 0.948024 1108 1 0.582684 0.651991 0.95947 1049 1 0.708178 0.608341 0.907895 1687 1 0.638278 0.505521 0.876765 1076 1 0.682259 0.624645 0.979224 1847 1 0.715871 0.513032 0.872346 1942 1 0.792468 0.595036 0.899354 1852 1 0.804346 0.504354 0.870082 1082 1 0.835217 0.584906 0.840137 1820 1 0.747526 0.580748 0.962622 982 1 0.751532 0.503189 0.945808 1980 1 0.810687 0.558105 0.984153 1970 1 0.781718 0.645394 0.965787 1977 1 0.916509 0.607584 0.859521 1114 1 0.863991 0.616598 0.921661 1948 1 0.872406 0.512947 0.992981 1029 1 0.932722 0.554928 0.914031 1824 1 0.868852 0.521592 0.922001 1796 1 0.998299 0.640773 0.966798 1057 1 0.93224 0.606506 0.96256 1123 1 0.102045 0.817119 0.974601 2047 1 0.0415156 0.780894 0.975872 1860 1 0.113026 0.724705 0.840711 1832 1 0.0148148 0.768632 0.908137 1859 1 0.0743011 0.71069 0.930184 1095 1 0.130558 0.832236 0.84339 1883 1 0.0399744 0.709836 0.856435 1119 1 0.000358294 0.719991 0.966044 1093 1 0.0928907 0.793677 0.900013 905 1 0.263717 0.780395 0.9374 1731 1 0.142902 0.683872 0.926776 1989 1 0.227978 0.72217 0.944664 1985 1 0.144225 0.763008 0.946175 1958 1 0.210069 0.769143 0.880694 1708 1 0.275936 0.731728 0.841799 1835 1 0.362879 0.784502 0.842899 1968 1 0.385584 0.666735 0.943661 1935 1 0.400075 0.673085 0.863481 1222 1 0.328484 0.805251 0.985273 1964 1 0.396301 0.804795 0.910955 1930 1 0.335425 0.706204 0.878489 1961 1 0.294696 0.713478 0.962405 1965 1 0.359828 0.7396 0.947661 1999 1 0.567615 0.784931 0.854454 1073 1 0.519358 0.673146 0.933673 1098 1 0.477792 0.707136 0.881606 909 1 0.470472 0.778266 0.882545 2001 1 0.551309 0.694492 0.862462 1129 1 0.457341 0.69734 0.962566 1102 1 0.450669 0.781368 0.964827 2000 1 0.530519 0.758111 0.923831 2005 1 0.52457 0.833158 0.967983 1137 1 0.668527 0.714925 0.967514 1683 1 0.636489 0.670353 0.905376 1962 1 0.700452 0.68502 0.834643 1817 1 0.644403 0.820715 0.845635 882 1 0.672484 0.751912 0.881197 2009 1 0.632032 0.790131 0.969711 1263 1 0.708058 0.783219 0.96562 1871 1 0.605614 0.736735 0.919762 1879 1 0.582541 0.821643 0.923922 1074 1 0.572153 0.714966 0.986388 2041 1 0.748375 0.764461 0.895422 2016 1 0.831246 0.763517 0.874056 2006 1 0.795722 0.818821 0.914995 1972 1 0.735459 0.680985 0.906182 2002 1 0.801693 0.668891 0.871039 1976 1 0.809458 0.72904 0.955804 2012 1 0.718416 0.82563 0.84937 1983 1 0.847929 0.787564 0.987211 926 1 0.91737 0.825822 0.92757 1024 1 0.8818 0.68509 0.94819 2014 1 0.961531 0.686766 0.90101 1092 1 0.964052 0.822171 0.868162 1145 1 0.89686 0.691062 0.862032 1919 1 0.899731 0.775372 0.847843 1089 1 0.967126 0.802602 0.990608 1922 1 0.971974 0.741144 0.844106 1888 1 0.916414 0.740683 0.915137 776 1 0.137289 0.984466 0.924937 1118 1 0.0257482 0.847526 0.923731 2018 1 0.0393841 0.950345 0.966706 1987 1 0.043669 0.869706 0.846302 1862 1 0.0985125 0.952956 0.861709 1892 1 0.0294466 0.930053 0.89354 1891 1 0.100588 0.875782 0.925915 2046 1 0.0553521 0.88063 0.990783 1993 1 0.202574 0.842325 0.859996 1133 1 0.254246 0.895255 0.932496 169 1 0.253957 0.955244 0.890728 1900 1 0.194878 0.833572 0.936462 943 1 0.188117 0.962478 0.856886 1897 1 0.239756 0.908277 0.838327 2019 1 0.179259 0.899029 0.905937 775 1 0.223445 0.965836 0.95984 16 1 0.409502 0.981224 0.973449 913 1 0.40013 0.980586 0.844522 903 1 0.286605 0.967541 0.999534 1990 1 0.288513 0.856831 0.862627 1863 1 0.425669 0.842677 0.838043 1908 1 0.399549 0.929531 0.908539 1995 1 0.374792 0.864848 0.956646 1097 1 0.363227 0.86624 0.875219 779 1 0.335274 0.930471 0.84094 1139 1 0.325087 0.920723 0.921333 694 1 0.471622 0.998152 0.850208 1876 1 0.5043 0.85489 0.866968 1994 1 0.452594 0.852032 0.923521 2036 1 0.53978 0.978612 0.972181 916 1 0.515794 0.941975 0.867495 1135 1 0.472753 0.969272 0.931952 1140 1 0.569357 0.888856 0.902324 914 1 0.450923 0.913565 0.854435 2030 1 0.505978 0.906607 0.950253 1110 1 0.666145 0.958826 0.928316 2042 1 0.643086 0.883719 0.95428 1242 1 0.713306 0.984417 0.981021 28 1 0.586069 0.962096 0.898238 149 1 0.608587 0.949895 0.991309 800 1 0.711914 0.966199 0.840792 2033 1 0.644793 0.89871 0.859076 2039 1 0.70471 0.842657 0.916181 17 1 0.573789 0.879238 0.990551 2044 1 0.728694 0.863182 0.987175 925 1 0.775177 0.895317 0.932684 795 1 0.760227 0.96685 0.918218 921 1 0.797272 0.935569 0.851248 927 1 0.854492 0.955599 0.973427 1956 1 0.852091 0.860684 0.8869 703 1 0.878625 0.939049 0.896093 643 1 0.971121 0.976011 0.951055 829 1 0.958741 0.973696 0.87007 801 1 0.966753 0.882103 0.963015 1058 1 0.888084 0.885504 0.955865 794 1 0.933246 0.885153 0.891924 61 1 0.921846 0.944252 0.997815
[ "scheuclu@gmail.com" ]
scheuclu@gmail.com
474b247e2e45087bd74d2544f1382174516ac0f2
1173a50fd7578dbedce0f997ebd6b7b4611661ce
/server/flask/app/model/database.py
b8592377acfe93b46be089bbb75ace92fcf8ebb3
[ "BSD-3-Clause" ]
permissive
JeanExtreme002/Keylogger
d3b2c1fa741030d33b8ad38e3d63071668fbd66f
bcb568818ca2c71f9cc1663d3858906ac660e778
refs/heads/master
2021-01-01T22:24:20.864439
2020-02-18T03:02:42
2020-02-18T03:02:42
240,398,696
4
0
null
null
null
null
UTF-8
Python
false
false
974
py
class Database(): __users = {} def __contains__(self, user): return user in self.__users def addKey(self, user, value): self.__users[user]["keys"].append(value) def createUser(self, user): self.__users[user] = {"keys": [], "output": "", "input": ""} def destroy(self): self.__users.clear() def getInput(self, user): input = self.__users[user]["input"] self.__users[user]["input"] = "" return input def getKeys(self, user): return self.__users[user]["keys"] def getOutput(self, user): output = self.__users[user]["output"] self.__users[user]["output"] = "" return output def setInput(self, user, value): self.__users[user]["input"] = value def setOutput(self, user, value): self.__users[user]["output"] = value @property def users(self): return list(self.__users.keys())
[ "jeangamerextreme@gmail.com" ]
jeangamerextreme@gmail.com
47a7fd2806810bfdca161d08fde9f770cd9ccf33
4cd5186f274b93bda18f7c0c75e27240345500b1
/src/playlists/migrations/0004_alter_playlist_video.py
e2f07cb9ab78137ffd69d6f6eb4402276897bfa8
[]
no_license
alexandersilvera/djangoflix
2244f94358c53476f48c8c2195057982b177da45
ad96fc0489caa4ea0cfe5858a4d8ab3af3f042a3
refs/heads/main
2023-08-21T02:32:39.914463
2021-10-28T13:35:30
2021-10-28T13:35:30
null
0
0
null
null
null
null
UTF-8
Python
false
false
579
py
# Generated by Django 3.2.6 on 2021-08-23 01:07 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('videos', '0010_alter_video_video_id'), ('playlists', '0003_auto_20210822_2159'), ] operations = [ migrations.AlterField( model_name='playlist', name='video', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='playlist_featured', to='videos.video'), ), ]
[ "alexandersilvera@hotmail.com" ]
alexandersilvera@hotmail.com
f099f167e00efaf0e76409c03d259e06c5e5d327
25b81256057c9a2de014ab511e04703dc617f050
/lib_cinci/tests/test_get_dummies.py
6a2eea6dcb86629e638595f29fa716eba950c405
[ "MIT" ]
permissive
conorhenley/cincinnati
7b9b2fc6d13e49ad5e95a557cd79b28bd17f0565
5ca86a8a31099365188969493e0dd369b4faefc0
refs/heads/master
2021-01-13T06:50:18.403686
2016-05-26T20:21:12
2016-05-26T20:21:12
64,249,902
1
0
null
2016-07-26T19:51:03
2016-07-26T19:51:03
null
UTF-8
Python
false
false
2,332
py
import pandas as pd from pandas.util.testing import assert_frame_equal import numpy as np from nose.tools import raises from lib_cinci.util import get_dummies @raises(ValueError) def test_illegal_value(): possible_values = ["val1", "val2", "val3"] data = pd.Series(["val1", "val3", "val1", "val4"]) get_dummies(data, possible_values) def test_empty_input(): possible_values = ["val1", "val2", "val3"] data = pd.Series([]) expected = pd.DataFrame([], columns=possible_values) actual = get_dummies(data, possible_values) assert_frame_equal(expected, actual) def test_only_one_value(): possible_values = ["val1", "val2", "val3"] data = pd.Series(["val2"]) expected = pd.DataFrame([(0, 1, 0)], columns=possible_values) actual = get_dummies(data, possible_values) assert_frame_equal(expected, actual) def test_only_one_value_many_times(): possible_values = ["val1", "val2", "val3"] data = pd.Series(["val2", "val2", "val2", "val2", "val2", "val2"]) expected = pd.DataFrame([(0, 1, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0)], columns=possible_values) actual = get_dummies(data, possible_values) assert_frame_equal(expected, actual) def test_all_values(): possible_values = ["val1", "val2", "val3"] data = pd.Series(["val1", "val3", "val1", "val2"]) expected = pd.DataFrame([(1, 0, 0), (0, 0, 1), (1, 0, 0), (0, 1, 0)], columns=possible_values) actual = get_dummies(data, possible_values) assert_frame_equal(expected, actual) def test_all_values_and_nan(): possible_values = ["val1", "val2", "val3"] data = pd.Series(["val1", "val3", "val1", "val2", np.nan]) expected = pd.DataFrame([(1, 0, 0), (0, 0, 1), (1, 0, 0), (0, 1, 0), (np.nan, np.nan, np.nan)], columns=possible_values) actual = get_dummies(data, possible_values) assert_frame_equal(expected, actual) def test_only_nan(): possible_values = ["val1", "val2", "val3"] data = pd.Series([np.nan, np.nan, np.nan, np.nan]) expected = pd.DataFrame([(np.nan, np.nan, np.nan), (np.nan, np.nan, np.nan), (np.nan, np.nan, np.nan), (np.nan, np.nan, np.nan)], columns=possible_values) actual = get_dummies(data, possible_values) assert_frame_equal(expected, actual)
[ "edu.blancas@gmail.com" ]
edu.blancas@gmail.com
6c107b66a3a89604ab9290c54f27e7ff1faa9675
b23c5bf483b4df164709313b5d0a2fd21e5df8d7
/components/actor/boss.py
6fb32e3bb9fdcc90943bb97928019332bbe4f3e9
[]
no_license
arbuz777/ECS-Game
9b5abb0e8c2a01bd38b2138d82ad872a9b68a2e8
c01cc9efdff9ace77613a94b648086c85f7ead31
refs/heads/master
2023-03-17T06:20:20.747308
2020-02-10T02:09:30
2020-02-10T02:09:30
null
0
0
null
null
null
null
UTF-8
Python
false
false
82
py
class BossComponent: ' Tags the entity as being the boss. ' __slots__ = ()
[ "0jason.gilbert@gmail.com" ]
0jason.gilbert@gmail.com
3c516e258b544d23bd249e9626f358cd03fdac0a
14238f04b56f3ce9da84f5c001956c1640486a13
/task_1.py
89311d9b78cd5248e92e6018bdff55d9ea27b0b6
[]
no_license
Alumasa/Python-Basics-Class
16e6400b700aa51a7258a5d8f851aa1986839ef5
24ee287ef268f6817f882d04769bc0ba1c4a03cc
refs/heads/master
2021-10-23T06:30:15.149769
2021-10-19T08:33:28
2021-10-19T08:33:28
198,873,059
0
0
null
null
null
null
UTF-8
Python
false
false
1,572
py
""""x = str(input("Input a string:")) if (x == "yes") or (x == "YES") or (x == "Yes"): print("Yes") else: print("No")""" #task2 """"number1 = int(input("Input a number:")) number2 = int(input("Input a second number:")) number3 = int(input("Input a third number:")) if (number1 >= number2) and (number1 >= number3): largest = number1 elif (number2 >= number1) and (number2 >= number3): largest = number2 else: largest = number3 print("The largest= ", largest)""" #task3 makes a new list of the first and last elements """"numberList = [78, 76, 67, 432, 65432] def listMaker(numberList): if len(numberList) >= 2: return [numberList[0], numberList[-1]] else: return [numberList[0]] newList = listMaker(numberList) print("This is the new list:", newList)""" #task4 ask user for a number,even or odd, print out appropriate message. # fnumber = int(input("Please input any number:")) # # def numChecker(fnumber): # if (fnumber % 2) == 0: # print("Your number is even.") # if (fnumber % 4) == 0: # print("It is a multiple of 4!!") # else: # print("Your number is odd.") # # numChecker(fnumber) #task5 print first and last half values of tuple is two lines. randomNumber = (1) def halfPrinter(randomNumber): length = int(len(randomNumber) / 2) if length > 1: return str(randomNumber[0:length]) + '\n' + str(randomNumber[length:]) else: return str(randomNumber[0]) #print("The half size of the tuple is:", length) print(halfPrinter(randomNumber))
[ "alumasa.v@gmail.com" ]
alumasa.v@gmail.com
3341d16784036b00723be38b738e54bcf81b3168
40b2334c2de09e2369ce56d744cb9aa7be363260
/src/agent/mnist/model/CNNDQN.py
a11dfb40d3faa793edf8f305c5062e5a207a62ee
[]
no_license
camelop/RL-fooling-framework
4b036ab80480153810d2ee912ba36320793271b8
c3164d3712b566064fdf8b9994b4e0871e161843
refs/heads/master
2020-04-13T23:57:41.966573
2019-10-21T05:22:40
2019-10-21T05:22:40
163,520,589
0
0
null
null
null
null
UTF-8
Python
false
false
3,361
py
from util.config import Config config = Config() from util.logger import Logger logger = Logger() from util import getTimeStr from agent.mnist.model.MnistAgentModelBase import MnistAgentModelBase import numpy as np import mxnet as mx from mxnet import autograd, gluon, init, nd from mxnet.gluon import loss as gloss, nn class CNNDQN(MnistAgentModelBase): def __init__(self, learning_rate=0.01, diff_state=True, load_from=None, save_after_every=10, weight_decay=0): self.diff_state = diff_state self.learning_rate = learning_rate self.save_counter = 0 self.save_after_every = save_after_every self.net = nn.Sequential() self.net.add( # nn.Conv2D(channels=4, kernel_size=1, padding = 0, activation='relu'), nn.Conv2D(channels=64, kernel_size=5, padding = 2, activation='relu'), nn.BatchNorm(), # nn.Conv2D(channels=4, kernel_size=3, padding = 1, activation='relu'), nn.Conv2D(channels=32, kernel_size=1, padding = 0, activation='relu'), nn.BatchNorm(), nn.Conv2D(channels=16, kernel_size=1, padding = 0, activation='relu'), nn.BatchNorm(), nn.Conv2D(channels=2, kernel_size=1, padding = 0, activation='relu'), ) def try_gpu(): try: ctx = mx.gpu() _ = nd.zeros((1,), ctx=ctx) except mx.base.MXNetError: ctx = mx.cpu() return ctx self.ctx = try_gpu() self.net.initialize(force_reinit=True, ctx=self.ctx, init=init.Xavier(magnitude=0.01)) self.loss = gloss.L2Loss() self.trainer = gluon.Trainer(self.net.collect_params(), 'sgd', {'learning_rate': learning_rate, 'wd': weight_decay}) if load_from is not None: self.load(load_from) def predict(self, state): channel, row, col = state.shape if self.diff_state: state[0] = np.abs(state[0] - state[1]) state = nd.array(state.reshape(1, channel, row, col)).as_in_context(self.ctx) return self.net(state).asnumpy() def train(self, state, action_mask, reward, epoch=3): if self.diff_state: state[:, 0] = np.abs(state[:, 0] - state[:, 1]) state = nd.array(state).as_in_context(self.ctx) action_mask = nd.array(action_mask).as_in_context(self.ctx) reward = nd.array(reward).as_in_context(self.ctx) losses = [] self.net.collect_params() for e in range(epoch): with autograd.record(): reward_hat = self.net(state) * action_mask l = self.loss(reward_hat, reward).sum() losses.append(l.asscalar()) l.backward() self.trainer.step(state.shape[0]) logger.info("loss: {}".format(str(losses))) self.save_counter += 1 if (self.save_counter+1) % self.save_after_every == 0: self.save() def save(self, loc=None): if loc is None: loc = "{}/{}[{}]-{}.mxparam".format(config.mnist_agent_model_checkpoint_dir, str(self), self.save_counter, getTimeStr()) logger.info("Saving net to {}".format(loc)) self.net.save_parameters(loc) logger.info("Saved net to {}".format(loc)) def load(self, loc): self.net.load_parameters(loc)
[ "lxy9843@sjtu.edu.cn" ]
lxy9843@sjtu.edu.cn
0e65fc2b6a10c1c6f812606ab4b66ed429350843
df62b81ee990c33689103b144a234cdb4198dc21
/02-methods/2-3-08-wait.py
12fd0632c2745de3e2468a1cdb461c62c72f30e5
[]
no_license
dsamoylov/stepik-selenium
3f6aa525c1804f728de5ee352850d8b92786970f
fb1b102e6e87cb3da44844cc0417930639e045a8
refs/heads/main
2023-06-11T17:06:35.069172
2021-07-10T09:23:22
2021-07-10T09:23:22
384,656,799
0
0
null
null
null
null
UTF-8
Python
false
false
1,306
py
from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium import webdriver import time import math def calc(x): return str(math.log(abs(12*math.sin(int(x))))) try: link = "http://suninjuly.github.io/explicit_wait2.html" browser = webdriver.Chrome() browser.get(link) button = browser.find_element_by_css_selector("button.btn") WebDriverWait(browser, 20).until(EC.text_to_be_present_in_element((By.ID, "price"), '$100')) button.click() x_element = browser.find_element_by_id("input_value") x = x_element.text y = calc(x) print(y) input_field = browser.find_element_by_id("answer") input_field.send_keys(y) # Отправляем заполненную форму button = browser.find_element_by_id("solve") browser.execute_script("return arguments[0].scrollIntoView(true);", button) button.click() finally: # ожидание чтобы визуально оценить результаты прохождения скрипта time.sleep(10) # закрываем браузер после всех манипуляций browser.quit()
[ "d.samoylov@gmail.com" ]
d.samoylov@gmail.com
c3a5b42cf28ba95987b3e86849e2d77f1586d056
afd3799b7eb2dbbc68e79c5b6aa3a86269db3ac7
/task3-2.py
8834039c078eaa989ab7815e46b7cd024118b45c
[]
no_license
pgenkin/geekbrains
ca4960952b0cf830ca30358f10c76c866f73f3da
618577a22c43bc54e1403e1d8aeb2e659e9ca11d
refs/heads/main
2023-04-21T16:41:38.905260
2021-04-07T20:57:18
2021-04-07T20:57:18
345,407,498
0
1
null
null
null
null
UTF-8
Python
false
false
617
py
def user_data_output(name, surname, year, city, email, phone): print(f"First name: {name}; Last name: {surname}; Born in: {year}; Lives in: {city}; Email: {email}; Phone: {phone}") return first_name = input("Enter your first name: ") last_name = input("Enter your last name: ") dob = input("Enter the year your were born in: ") city_name = input("Enter your city: ") email_address = input("Enter your email address: ") phone_number = input("Enter your phone number: ") user_data_output(name=first_name, surname=last_name, year=dob, city=city_name, email=email_address, phone=phone_number)
[ "noreply@github.com" ]
pgenkin.noreply@github.com
c7ba4872c6d2d0f7546a3594c8f71c5f5bea2368
dd6531197b712fa6e284ee274b841fc7449bba2b
/snakelet/utilities/conversion.py
d7315a98511af9649b6f366ca4e86db14a25fe29
[ "MIT" ]
permissive
alexgurrola/snakelet
9c066e70686708388a5ec7f3a0844118c104cdb0
5b9b552f51473f823eba15a5a1525ae0a5999ca6
refs/heads/master
2021-08-20T01:51:49.693605
2021-08-17T01:05:02
2021-08-17T01:05:02
122,287,286
2
1
MIT
2021-04-29T20:09:48
2018-02-21T03:20:19
Python
UTF-8
Python
false
false
672
py
import re def snake(string: str): """ :param string: :return: """ return re.sub("([A-Z])", "_\\1", string).lower().lstrip("_") def camel(string: str): """ :param string: :return: """ return "".join(map(str.capitalize, string.split("_"))) class Conversion: cases = { 'snake': snake, 'camel': camel } def __init__(self, case: str = None): """ :param case: """ self.case = self.cases['snake' if not case or case not in self.cases else case] def encode(self, data: str): """ :param data: :return: """ return self.case(data)
[ "alexgurrola1@gmail.com" ]
alexgurrola1@gmail.com
0fa310bef86d7107cc5edbe56e7901a270e036a1
cebbf770f7421553408c4c17bf2fcdec96dfbf33
/cloudworkers2.py
01f2c74f37df69a399348b3a39c04fa4be114d89
[]
no_license
sduranowski1/Chat-Moderator-bot
cff4f764043f4f74de5f7537affe334115c4d3d2
8a0a9b34d2990b9994f34e94a703ac10ce72eef5
refs/heads/main
2023-02-27T00:41:10.962368
2021-02-06T18:35:38
2021-02-06T18:35:38
336,605,709
0
0
null
null
null
null
UTF-8
Python
false
false
4,424
py
from selenium import webdriver from time import sleep import re from selenium.webdriver.common.keys import Keys from webdriver_manager.chrome import ChromeDriverManager from chatterbot.trainers import ListTrainer from chatterbot import ChatBot from selenium.common.exceptions import NoSuchElementException, StaleElementReferenceException, ElementNotInteractableException, NoSuchWindowException, WebDriverException, UnexpectedAlertPresentException # from selenium.webdriver.common.action_chains import ActionChains import random import os import sys import datetime class TinderBot(): def __init__(self, username, password): self.username = username self.password = password self.driver = webdriver.Firefox() #self.driver = webdriver.Chrome(ChromeDriverManager().install()) def login(self): self.driver.get("http://agents.moderationinterface.com/login") sleep(2) login_button = self.driver.find_element_by_xpath("/html/body/app-root/block-ui/ng-component/div/div/div/div/div/div/div/div/form/div[1]/div/input") login_button.click() sleep(2) email_in = self.driver.find_element_by_xpath("//input[@name='username']") email_in.clear() email_in.send_keys(self.username) pw_in = self.driver.find_element_by_xpath("/html/body/app-root/block-ui/ng-component/div/div/div/div/div/div/div/div/form/div[2]/div/input") pw_in.send_keys(self.password) pw_in.send_keys(Keys.RETURN) def post_comment(self, comment_text,): sleep(5) try: comment_box_elem = lambda: self.driver.find_element_by_xpath('//*[@id="chat-windows-message-textarea"]') comment_box_elem().send_keys("") comment_box_elem().clear() for letter in comment_text: comment_box_elem().send_keys(letter) sleep(random.randint(1, 4) / 90) except (NoSuchWindowException, ElementNotInteractableException, UnexpectedAlertPresentException, WebDriverException): print('No element of that id present!') self.driver.refresh() print('Page has been refreshed.') try: self.driver.find_element_by_xpath("/html/body/app-root/block-ui/ng-component/div/ng-component/div/div/div/div/div[2]/div/form/div[2]/div/div/div/div[2]/div/button").click() except (NoSuchElementException, NoSuchWindowException, ElementNotInteractableException, UnexpectedAlertPresentException, WebDriverException): print('No element of that id present!') """grab comments from a picture page""" def get_comments(self): # load more comments if button exists sleep(5) try: comments_block = self.driver.find_element_by_class_name('timeline') comments_in_block = comments_block.find_elements_by_class_name('timeline-body') comments = [x.find_element_by_tag_name('p') for x in comments_in_block] user_comment = re.sub(r'#.\w*', '', comments[0].text) except (NoSuchElementException, NoSuchWindowException, ElementNotInteractableException, UnexpectedAlertPresentException, WebDriverException): return 'nul' return user_comment """have bot comment on picture""" def comment_on_picture(self): bot = ChatBot('cloudworkersbot') ListTrainer(bot) picture_comment = self.get_comments() # user's comment and bot's response response = bot.get_response(picture_comment).__str__() print("User's Comment", picture_comment) print("Bot's Response", response) dup_items = set() uniq_items = [] for x in response: if x not in dup_items: uniq_items.append(x) dup_items.add(x) return self.post_comment(response) bot = TinderBot(username='EN-1818', password='cRut9yl6afr8cHe') #while datetime.datetime.now().hour < 9: if __name__ == '__main__': bot.login() for i in range(100): print(bot.get_comments()) print("Posted Comment", bot.comment_on_picture()) os.system("killall -9 'firefox-bin'") os.execv(sys.executable, ['python'] + sys.argv) # if __name__ == '__main__': # TinderBot() # os.execl(sys.executable, sys.executable, *sys.argv) # Oh darling , actually I just wanted to tell you that you look awesome on your profile pic
[ "noreply@github.com" ]
sduranowski1.noreply@github.com
2f2007b80c396847b2dfbba44eed7065ef9ad1da
dc2203fcb3fe18da31d8f577dc9b7534f3ac8f13
/Final1.py
326b147f9a62abad4d75fff1c1fd3dcb08f6b7ca
[]
no_license
Lamarwhigham1/Final-Project
234b39cf257a00b7f73f048123011b07c925ad29
39a2d8ebb9daef7db561deb44a8909eff56eeaf9
refs/heads/master
2021-08-23T02:53:51.874798
2017-12-02T18:33:58
2017-12-02T18:33:58
112,861,311
0
0
null
null
null
null
UTF-8
Python
false
false
202
py
''' Created on Dec 2, 2017 @author: ITAUser ''' numberlist=[]; Number=int(input("Enter a Number:")) for i in range(1,Number + 1): if (Number%i==0): numberlist.append(i) print(numberlist);
[ "33788867+Lamarwhigham1@users.noreply.github.com" ]
33788867+Lamarwhigham1@users.noreply.github.com
8182f6e54492b844cb1c0ef0e09bc533df2bdf1b
9961cb32ff98d06956dd318b2ade2980291347dd
/Count leaf Nodes.py
3041ad3d5f46c60106c2420e1b528b687e4909a6
[]
no_license
sunnysunita/generic-tree
ca3e0900484bfb46582d74be2db439d5db548947
768a719cfb404b1b8a1c7320d8990575ff391cb3
refs/heads/master
2022-07-11T20:58:47.623069
2020-05-06T15:01:06
2020-05-06T15:01:06
260,915,437
1
0
null
null
null
null
UTF-8
Python
false
false
1,012
py
class treeNode: def __init__(self, data): self.data = data self.children = [] def __str__(self): return str(self.data) def leafNodeCount(root): ############################# # PLEASE ADD YOUR CODE HERE # ############################# count = 0 if root is None: return count if len(root.children) == 0: count += 1 return count for child in root.children: count = count + leafNodeCount(child) return count def createLevelWiseTree(arr): root = treeNode(int(arr[0])) q = [root] size = len(arr) i = 1 while i<size: parent = q.pop(0) childCount = int(arr[i]) i += 1 for j in range(0,childCount): temp = treeNode(int(arr[i+j])) parent.children.append(temp) q.append(temp) i += childCount return root # Main arr = list(int(x) for x in input().strip().split(' ')) tree = createLevelWiseTree(arr) print(leafNodeCount(tree))
[ "sunnysunita.com@gmail.com" ]
sunnysunita.com@gmail.com
767d7d5658b89c474a5171f2fb7f129f36b2b4d9
a27928d964a27d0c77975623a6c777eaba739e28
/venv/bin/pip2.7
ddf5580abbf1eebbf1bebfcd50f353e6faaff16c
[]
no_license
jslu9/PhotoAlbumApp
a92bce19d611a509784ab6125aeecbb3fa803ab8
5f637e1ee1c7e9af24b43b7909bc70bdb6c2d3ab
refs/heads/master
2020-05-21T07:15:09.864302
2017-03-13T07:07:10
2017-03-13T07:07:10
84,592,919
0
0
null
null
null
null
UTF-8
Python
false
false
230
7
#!/Users/atom/PhotoAlbumApp/venv/bin/python # -*- coding: utf-8 -*- import re import sys from pip import main if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(main())
[ "atom@justins-imac.attlocal.net" ]
atom@justins-imac.attlocal.net
fc30980eca64b6d2199070e5593e7c55ebe8de38
6dc8a8cca60502fba19c99c3d2a1c07d0c79b676
/MW90.bas.10.A5xI.D5C5.py
e676bb251c29ca47610192d4232fd61a17b080ad
[]
no_license
marcelteun/UniformPolyhedra
7d7970d412c515360d896166dead40b0801314b4
ce41d6be97bdd984c4baf485b7a583f9c9b82ea3
refs/heads/master
2021-01-20T06:55:13.454746
2012-02-17T23:07:15
2012-02-17T23:07:15
1,103,365
0
1
null
null
null
null
UTF-8
Python
false
false
24
py
MW82.bas.10.A5xI.D5C5.py
[ "marcelteun@gmail.com" ]
marcelteun@gmail.com
41ae37d9b9aea9c22a68902cb832b9442b095cd8
26b334c726bfbb3ce91d028901fa81f38862725f
/IntentClassification/Parameters.py
f792235959966269045508d931f8236cf457a3a2
[]
no_license
gauravghid/IntentIdentifcation
2ecb15534fb512a5c6af25075afa4c526338ca12
602ee8ea04e85ff619edf1fa3693832fb3d94b89
refs/heads/master
2020-03-23T21:57:17.836200
2018-07-24T19:00:29
2018-07-24T19:00:29
142,143,211
0
0
null
null
null
null
UTF-8
Python
false
false
1,191
py
logpath = "." app_url = "http://10.32.215.23:8000/Intent/" data_Path = './Train_data/' dataFileName = 'SourceData.xlsx' trainFileName = 'Train_Intents.xlsx' testFileName = 'Test_Intents.xlsx' Label = 'Label' class_id = 'class_ids' probability = 'Probability' tensorFlowLogFile = 'tensorflow.log' dataColumn = 'sentence' labelColumn = 'label' labelStrColumn = 'labelStr' module_spec_Url = "https://tfhub.dev/google/nnlm-en-dim128/1" module_Spec_Path = './model/32f2b2259e1cc8ca58c876921748361283e73997' n_classes = 5 model_dir = '/home/osboxes/Downloads/models/chatbot' prob = 'probabilities' default = 'default' LABELS = [ 'ApprovalPolicy', 'InvoiceStatus', 'InvoiceSubProcess', 'Rushpayment','SmallTalk' ] import logging logFormatter = logging.Formatter("%(asctime)s [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s") logger = logging.getLogger() logger.setLevel(logging.INFO) fileHandler = logging.FileHandler("{0}/{1}.log".format(".", "Intent")) fileHandler.setFormatter(logFormatter) logger.addHandler(fileHandler) consoleHandler = logging.StreamHandler() consoleHandler.setFormatter(logFormatter) logger.addHandler(consoleHandler) http_proxy = '' https_proxy = ''
[ "singhgaurav91@gmail.com" ]
singhgaurav91@gmail.com
71e04bc30953211c391db36994b7375c3de21f86
2f85a2d3917a92d0d990620c9cbd7ad50956c876
/session03/type-demo.py
059e70c0f2a192f7d162ae99ebb83d77d40b46c4
[]
no_license
KyleLawson16/mis3640
14e57203a495c6f40188e6f5c8bf3ec82605e924
647a86838ff77544970973196941cd433851b150
refs/heads/master
2020-03-27T16:41:37.798702
2018-11-01T19:40:03
2018-11-01T19:40:03
146,800,315
0
1
null
null
null
null
UTF-8
Python
false
false
349
py
''' Age Validator w/ Error Handling ''' age = input('Please enter your age: ') def check_age(age): try: age = int(age) if age >= 21: print('yes, you can.') else: print('sorry, you cannot.') except: age = input('Please enter a valid number: ') check_age(age) check_age(age)
[ "Kyle.Lawson7@yahoo.com" ]
Kyle.Lawson7@yahoo.com
173e4c5368fbb933fe6add8012f367ebfc4cf777
14f69686d426bab975e86c3dfe16a4943bb6b966
/samples/fig5.py
accc199dfc0495359087a54dc6fb49913c761bf0
[ "MIT" ]
permissive
ctschnur/kr-poylmer-growth-simulation
82fff053f00f1dfe108c742f325fca77a3ee3bd5
7dfbd71cd7cc96eb34afe5632cbb18e95ca87e74
refs/heads/main
2023-02-25T21:35:26.116501
2021-01-28T09:16:45
2021-01-28T09:16:45
315,961,664
1
0
null
null
null
null
UTF-8
Python
false
false
3,257
py
from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl # -- import most important classes from kr.kr import Kr, Kr_constants from kr.plot_utils import Plot_utility def mpl_settings(): # -- plotting settings pgf_with_custom_preamble = { "figure.figsize": (6.4*0.8, 4.8*0.7), "savefig.format": "png", # change this to pgf or png "pgf.rcfonts": False, # don't use pre-specified fonts (in rcParmams) "text.usetex": True, # use latex backend not just built-in MathText "text.latex.unicode": True, # to be able to pass unicode characters to mpl "text.latex.preamble": [ # required for actual rendering to png r"\usepackage{amsmath, siunitx}", ], "pgf.preamble": [ # when exporting pgf code, mpl checks it for compilablity r"\usepackage{amsmath, siunitx}", ]} mpl.rcParams.update(pgf_with_custom_preamble) def fig5(my_kr): config_title = "FIG05-1000" print(" --- ", config_title) # import a configuration of initial parameters importdict = Kr_constants.import_dict_from_file("conf.json", config_title) # show first, which simulation parameters are different # compared with DEFAULT configuration print("custom simulation parameters: \n", Kr_constants.compare_dicts( importdict, Kr_constants.import_dict_from_file("conf.json", "DEFAULT"))) evolution_data_unit_dict, clds = my_kr.run( importdict) # --- dispersity bundle_name = "dispersity" config_and_bundle_str = config_title + bundle_name x_name, y_name = evolution_data_unit_dict[bundle_name].get_xy_names() fig, ax = plt.subplots() ax.set_xlabel("$X$") ax.set_ylabel("$\mathrm{PDI}$") # # reference data # ref_x, ref_y = np.loadtxt("paper_ref_data/butteFig5b-KR1000pointssolid.csv", # skiprows=1, delimiter=',', unpack=True) # ax.plot(ref_x, ref_y, ".", markersize=5, alpha=0.8, color="k", # label=r"reference simulated curve") # bundle data x, y = evolution_data_unit_dict[bundle_name].get_xy_vectors() ax.plot(x, y, linestyle='-', label="simulated") ax.grid() ax.legend(loc='upper left') plt.tight_layout() plt.savefig(my_kr.get_run_hash_str() + config_and_bundle_str) plt.savefig(my_kr.get_run_hash_str() + "_" + config_and_bundle_str + ".pgf", format="pgf") fig_clds = plt.figure() Plot_utility.plot_clds( clds, refdatas=[ # { # "data": np.loadtxt( # "paper_ref_data/butteFig5a-KR1000pointssolid.csv", # skiprows=1, delimiter=','), # "label": "$X=0.6$" # } ], labels={"config_and_bundle_str": "FIG05-1000", # "ref": r"reference simulated curve", "own": "simulated"}, kr_obj=my_kr, savefig=True, savefig_pgf=True, mpl_figure=fig_clds) def main(): mpl_settings() # matplotlib settings my_kr = Kr() fig5(my_kr) if __name__ == "__main__": main()
[ "534ttl3@gmail.com" ]
534ttl3@gmail.com
757c440c03c5231fcb862b3eceeab975475d24dd
a198e2469c63649fcccae4ffa3c4343899a81906
/project/project/settings.py
6483912729c77f2e39d72c648a2c0878740fca35
[]
no_license
kkltcjk/stock
8531dff442d448e51b0d9b4244278795fe954340
d92d5dbaf4ac8213338a405327a8e4f6a6ef0e76
refs/heads/master
2020-09-13T23:17:53.863398
2016-05-08T15:00:56
2016-05-08T15:00:56
67,521,761
0
0
null
null
null
null
UTF-8
Python
false
false
4,982
py
""" Django settings for project project. Generated by 'django-admin startproject' using Django 1.8.1. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'm8(kx(mdce!0==2&(2)-rfk99j9aul-4qxdbc-0f!qi&8!xdnc' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'ios', 'database', 'stock', ) MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', # 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', ) ROOT_URLCONF = 'project.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'project.wsgi.application' # Database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases # DATABASES = { # 'default': { # 'ENGINE': 'django.db.backends.sqlite3', # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), # } # } DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } # 'default': { # 'ENGINE': 'django.db.backends.mysql', # 'NAME': 'bill', # 'USER': 'kklt', # 'PASSWORD': 'password', # 'HOST': '115.29.103.1', # 'PORT': '3306', # } } # Internationalization # https://docs.djangoproject.com/en/1.8/topics/i18n/ LOGGING = { 'version': 1, 'disable_existing_loggers': True, 'formatters': { 'standard': { 'format': '%(levelname)s %(asctime)s %(message)s' }, }, 'filters': { }, 'handlers': { 'mail_admins': { 'level': 'ERROR', 'class': 'django.utils.log.AdminEmailHandler', 'formatter':'standard', }, 'buystockhandler': { 'level':'DEBUG', 'class':'logging.handlers.RotatingFileHandler', 'filename':os.path.join(BASE_DIR, 'stock/log/buystock.log'), 'formatter':'standard', }, 'sellstockhandler': { 'level':'DEBUG', 'class':'logging.handlers.RotatingFileHandler', 'filename':os.path.join(BASE_DIR, 'stock/log/sellstock.log'), 'formatter':'standard', }, 'remindhandler': { 'level':'DEBUG', 'class':'logging.handlers.RotatingFileHandler', 'filename':os.path.join(BASE_DIR, 'stock/log/remind.log'), 'formatter':'standard', }, 'console': { 'level':'DEBUG', 'class':'logging.StreamHandler', 'formatter':'standard', }, }, 'loggers': { 'django.request': { 'handlers': ['mail_admins'], 'level': 'ERROR', 'propagate': True, }, 'buystock':{ 'handlers': ['buystockhandler','console'], 'level': 'INFO', 'propagate': False }, 'sellstock':{ 'handlers': ['sellstockhandler','console'], 'level': 'INFO', 'propagate': False }, 'remind':{ 'handlers': ['remindhandler','console'], 'level': 'INFO', 'propagate': False }, } } LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), ) # https://docs.djangoproject.com/en/1.8/howto/static-files/ STATIC_URL = '/static/'
[ "kkltcjk@gmail.com" ]
kkltcjk@gmail.com
0a48515180b994aa9b65bf5b2e8a3fb424eff032
22279487bee5c983c13887ba11e6a4cd40e8bbe3
/PreprocessData/all_class_files/ParkingFacility.py
7cfad07989704ab95ec0352aeaca6ca40c586a99
[ "MIT" ]
permissive
DylanNEU/Schema
018c9f683c683068422ed7b6392dcebd4ab4d4cd
4854720a15894dd814691a55e03329ecbbb6f558
refs/heads/main
2023-08-30T01:50:20.541634
2021-11-01T15:30:41
2021-11-01T15:30:41
425,238,713
1
0
MIT
2021-11-06T12:29:12
2021-11-06T12:29:11
null
UTF-8
Python
false
false
1,367
py
from PreprocessData.all_class_files.CivicStructure import CivicStructure import global_data class ParkingFacility(CivicStructure): def __init__(self, additionalType=None, alternateName=None, description=None, disambiguatingDescription=None, identifier=None, image=None, mainEntityOfPage=None, name=None, potentialAction=None, sameAs=None, url=None, additionalProperty=None, address=None, aggregateRating=None, amenityFeature=None, branchCode=None, containedInPlace=None, containsPlace=None, event=None, faxNumber=None, geo=None, globalLocationNumber=None, hasMap=None, isAccessibleForFree=None, isicV4=None, logo=None, maximumAttendeeCapacity=None, openingHoursSpecification=None, photo=None, publicAccess=None, review=None, smokingAllowed=None, specialOpeningHoursSpecification=None, telephone=None, openingHours=None): CivicStructure.__init__(self, additionalType, alternateName, description, disambiguatingDescription, identifier, image, mainEntityOfPage, name, potentialAction, sameAs, url, additionalProperty, address, aggregateRating, amenityFeature, branchCode, containedInPlace, containsPlace, event, faxNumber, geo, globalLocationNumber, hasMap, isAccessibleForFree, isicV4, logo, maximumAttendeeCapacity, openingHoursSpecification, photo, publicAccess, review, smokingAllowed, specialOpeningHoursSpecification, telephone, openingHours)
[ "2213958880@qq.com" ]
2213958880@qq.com
795267c77c531b903e734ab21b42d109c86946fc
0fa24b08a48790052f0f0ac9373316b23b7845f1
/yandex_school/__init__.py
10c9c18f63c199d6141dab4af00db65637d1c8cd
[ "Unlicense" ]
permissive
drunckoder/yandex_school
910cd162371c97ac69903c93f69e87c50a1ca59d
d080fee90b74977e0a671309662893b0f95fad60
refs/heads/master
2020-07-09T14:42:18.723440
2019-12-02T10:03:50
2019-12-02T10:03:50
203,999,250
0
0
null
null
null
null
UTF-8
Python
false
false
686
py
from flask import Flask from flask_cors import CORS from flask_restful import Api from flask_sqlalchemy import SQLAlchemy from yandex_school.config import DB_URL, DB_LOGIN, DB_PASSWORD, DB_NAME app = Flask(__name__) api = Api(app) cors = CORS(app, resources={r'/*': {'origins': '*'}}) # headache reducer app.config['SQLALCHEMY_DATABASE_URI'] = f'postgresql://{DB_LOGIN}:{DB_PASSWORD}@{DB_URL}/{DB_NAME}' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False # turning off an outdated feature # TODO: experimental alchemy flags, might blame weird behavior on them db = SQLAlchemy(app, engine_options={'echo': False}, session_options={'autoflush': False, 'expire_on_commit': False})
[ "drunckoder@gmail.com" ]
drunckoder@gmail.com
7648418f043444812065123ac4e452e493569400
00ee627da10a53df5f61c65e5670995be304ee1f
/Domain_Generalization/data/data_helper.py
ec4d7d214bc57bec673cff17a71aaf1890a2fdbb
[ "MIT", "BSD-2-Clause" ]
permissive
GuardSkill/IntraClassInfoMax
f39ea70cb07713ee60be2d58b79965e6e973b44e
ddf71318575f9a2183c2bcad7a0cb48972212fe4
refs/heads/main
2023-02-23T01:11:24.605569
2021-01-23T07:20:34
2021-01-23T07:20:34
331,529,978
0
0
null
null
null
null
UTF-8
Python
false
false
6,506
py
from os.path import join, dirname import numpy as np import torch from torch.utils.data import DataLoader from torchvision import transforms from data import StandardDataset from data.DGLoader import DGDataset, TestDGDataset,JigsawDataset, JigsawTestDataset, get_split_dataset_info, _dataset_info, \ JigsawTestDatasetMultiple from data.concat_dataset import ConcatDataset mnist = 'mnist' mnist_m = 'mnist_m' svhn = 'svhn' synth = 'synth' usps = 'usps' vlcs_datasets = ["CALTECH", "LABELME", "PASCAL", "SUN"] pacs_datasets = ["art_painting", "cartoon", "photo", "sketch"] office_datasets = ["amazon", "dslr", "webcam"] digits_datasets = [mnist, mnist, svhn, usps] available_datasets = office_datasets + pacs_datasets + vlcs_datasets + digits_datasets #office_paths = {dataset: "/home/enoon/data/images/office/%s" % dataset for dataset in office_datasets} #pacs_paths = {dataset: "/home/enoon/data/images/PACS/kfold/%s" % dataset for dataset in pacs_datasets} #vlcs_paths = {dataset: "/home/enoon/data/images/VLCS/%s/test" % dataset for dataset in pacs_datasets} #paths = {**office_paths, **pacs_paths, **vlcs_paths} dataset_std = {mnist: (0.30280363, 0.30280363, 0.30280363), mnist_m: (0.2384788, 0.22375608, 0.24496263), svhn: (0.1951134, 0.19804622, 0.19481073), synth: (0.29410212, 0.2939651, 0.29404707), usps: (0.25887518, 0.25887518, 0.25887518), } dataset_mean = {mnist: (0.13909429, 0.13909429, 0.13909429), mnist_m: (0.45920207, 0.46326601, 0.41085603), svhn: (0.43744073, 0.4437959, 0.4733686), synth: (0.46332872, 0.46316052, 0.46327512), usps: (0.17025368, 0.17025368, 0.17025368), } class Subset(torch.utils.data.Dataset): def __init__(self, dataset, limit): indices = torch.randperm(len(dataset))[:limit] self.dataset = dataset self.indices = indices def __getitem__(self, idx): return self.dataset[self.indices[idx]] def __len__(self): return len(self.indices) def get_train_dataloader(args, patches): dataset_list = args.source assert isinstance(dataset_list, list) datasets = [] val_datasets = [] img_transformer, tile_transformer = get_train_transformers(args) limit = args.limit_source for dname in dataset_list: # name_train, name_val, labels_train, labels_val = get_split_dataset_info(join(dirname(__file__), 'txt_lists', '%s_train.txt' % dname), args.val_size) name_train, labels_train = _dataset_info(join(dirname(__file__), 'correct_txt_lists', '%s_train_kfold.txt' % dname)) name_val, labels_val = _dataset_info(join(dirname(__file__), 'correct_txt_lists', '%s_crossval_kfold.txt' % dname)) train_dataset = DGDataset(name_train, labels_train, patches=patches, img_transformer=img_transformer, tile_transformer=tile_transformer, bias_whole_image=args.bias_whole_image) if limit: train_dataset = Subset(train_dataset, limit) datasets.append(train_dataset) val_datasets.append( TestDGDataset(name_val, labels_val, img_transformer=get_val_transformer(args), patches=patches)) dataset = ConcatDataset(datasets) val_dataset = ConcatDataset(val_datasets) loader = torch.utils.data.DataLoader(dataset, batch_size=args.batch_size, shuffle=True, num_workers=4, pin_memory=True, drop_last=True, worker_init_fn=np.random.seed(0)) val_loader = torch.utils.data.DataLoader(val_dataset, batch_size=args.batch_size, shuffle=False, num_workers=4, pin_memory=True, drop_last=False, worker_init_fn=np.random.seed(0)) return loader, val_loader def get_val_dataloader(args, patches=False): names, labels = _dataset_info(join(dirname(__file__), 'correct_txt_lists', '%s_test_kfold.txt' % args.target)) img_tr = get_val_transformer(args) val_dataset = TestDGDataset(names, labels, patches=patches, img_transformer=img_tr) if args.limit_target and len(val_dataset) > args.limit_target: val_dataset = Subset(val_dataset, args.limit_target) print("Using %d subset of val dataset" % args.limit_target) dataset = ConcatDataset([val_dataset]) loader = torch.utils.data.DataLoader(dataset, batch_size=args.batch_size, shuffle=False, num_workers=4, pin_memory=True, drop_last=False, worker_init_fn=np.random.seed(0)) return loader def get_train_transformers(args): img_tr = [transforms.RandomResizedCrop((int(args.image_size), int(args.image_size)), (args.min_scale, args.max_scale))] #img_tr = [transforms.Resize((args.image_size, args.image_size))] #img_tr.append(transforms.RandomHorizontalFlip(args.random_horiz_flip)) if args.random_horiz_flip > 0.0: img_tr.append(transforms.RandomHorizontalFlip(args.random_horiz_flip)) if args.jitter > 0.0: img_tr.append(transforms.ColorJitter(brightness=args.jitter, contrast=args.jitter, saturation=args.jitter, hue=min(0.5, args.jitter))) img_tr.append(transforms.RandomGrayscale(args.tile_random_grayscale)) img_tr.append(transforms.ToTensor()) img_tr.append(transforms.Normalize([0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])) tile_tr = [] if args.tile_random_grayscale: tile_tr.append(transforms.RandomGrayscale(args.tile_random_grayscale)) tile_tr = tile_tr + [transforms.ToTensor(), transforms.Normalize([0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])] return transforms.Compose(img_tr), transforms.Compose(tile_tr) def get_val_transformer(args): img_tr = [transforms.Resize((args.image_size, args.image_size)), transforms.ToTensor(), transforms.Normalize([0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])] return transforms.Compose(img_tr) # def get_target_jigsaw_loader(args): # img_transformer, tile_transformer = get_train_transformers(args) # name_train, _, labels_train, _ = get_split_dataset_info(join(dirname(__file__), 'txt_lists', '%s_train.txt' % args.target), 0) # dataset = JigsawDataset(name_train, labels_train, patches=False, img_transformer=img_transformer, # tile_transformer=tile_transformer, jig_classes=args.jigsaw_n_classes, bias_whole_image=args.bias_whole_image) # loader = torch.utils.data.DataLoader(dataset, batch_size=args.batch_size, shuffle=True, num_workers=4, pin_memory=True, drop_last=True) # return loader
[ "qq497291093@gmail.com" ]
qq497291093@gmail.com
0e65ddeecec0cd3368fa0af4d0d2af759d054d14
092a8fd0b86a70717faa0ab0067ab4eb0ebb6824
/src/quicksave_async/util/logger.py
2456706502234dc289efbd892bb6254f91404ddf
[]
no_license
adiog/io_quicksave_async
d22cc9201fc746a5c1130ed28e19e0f722d1fd3d
f27b6795639f282576723ed938054ba132cddf08
refs/heads/master
2021-08-15T21:36:52.240445
2017-11-18T10:13:01
2017-11-18T10:13:01
106,772,486
0
0
null
null
null
null
UTF-8
Python
false
false
224
py
# This file is a part of quicksave project. # Copyright (c) 2017 Aleksander Gajewski <adiog@quicksave.io>. import datetime def log(message=''): print(datetime.datetime.now().strftime("[%d/%m/%Y %H:%M:%S] ") + message)
[ "adiog@brainfuck.pl" ]
adiog@brainfuck.pl
aad3bf4a34c110dac88db523d9d8223a7b0c10ef
ddec696f292a1eba01ff6ac125d045af3edf24da
/auto-deployment/roles/prober/files/prober.py
b979d82d38265bf292c53da9ec67075a89dd9333
[]
no_license
liqin323/Nix
96de35cb409835d1b68620dbbf81a791cb74a45f
8bc686aa4261d1bacceb8dd5c79a36ab5fd4d991
refs/heads/master
2021-01-17T13:13:53.580353
2016-06-23T06:49:03
2016-06-23T06:49:03
42,692,858
0
0
null
null
null
null
UTF-8
Python
false
false
6,795
py
#!/usr/bin/env python import psutil import sys import yaml from optparse import OptionParser import os import threading import logging import httplib import json __author__ = 'liqin' class Prober(threading.Thread): def __init__(self, conf, logger): threading.Thread.__init__(self) self.conf = conf self.logger = logger self.net_recv = 0 self.net_sent = 0 # A event to notify the thread that it should finish up and exit self.finished_event = threading.Event() def run(self): try: while not self.finished_event.is_set(): result = self.__probing() self.__post_result_to_supervisor(result) self.finished_event.wait(self.conf['prober']['interval']) except Exception as e: self.logger.error('%s' % e) def __probing(self): system = self.__probe_system() services = self.__probe_services() result = {'system': system, 'services': services} return result def __probe_system(self): system = {'cpu': {}, 'memory': {}, 'disk': {}, 'net': {}} system['name'] = self.conf['host']['name'] system['ip'] = self.conf['host']['ip'] # cpu usage system['cpu']['count'] = psutil.cpu_count(logical=False) system['cpu']['percent'] = psutil.cpu_percent() self.logger.debug('cpu: %s' % system['cpu']) # memory usage memory = psutil.virtual_memory() system['memory']['total'] = memory[0] system['memory']['percent'] = memory[2] system['memory']['used'] = memory[3] system['memory']['free'] = memory[4] self.logger.debug('memory: %s' % system['memory']) # disk usage disk_usage = psutil.disk_usage('/') system['disk']['total'] = disk_usage.total disk_io = psutil.disk_io_counters(perdisk=False) system['disk']['io'] = {} system['disk']['io']['read_count'] = disk_io[0] system['disk']['io']['write_count'] = disk_io[1] system['disk']['io']['read_bytes'] = disk_io[2] system['disk']['io']['write_bytes'] = disk_io[3] self.logger.debug('disk: %s' % system['disk']) # net usage system['net']['connections_count'] = len(psutil.net_connections()) net_io = psutil.net_io_counters(pernic=True) net_out_rate = 0 net_in_rate = 0 if self.net_recv != 0 and self.net_sent != 0: net_out_rate = net_io['eth0'][0] - self.net_sent net_in_rate = net_io['eth0'][1] - self.net_recv interval = self.conf['prober']['interval'] net_in_rate = net_in_rate / (1024.00 * interval) # KB/S net_out_rate = net_out_rate / (1024.00 * interval) # KB/S system['net']['out_rate'] = net_out_rate system['net']['in_rate'] = net_in_rate system['net']['bytes_sent'] = net_io['eth0'][0] system['net']['bytes_recv'] = net_io['eth0'][1] system['net']['packets_sent'] = net_io['eth0'][2] system['net']['packets_recv'] = net_io['eth0'][3] self.net_sent = net_io['eth0'][0] self.net_recv = net_io['eth0'][1] self.logger.debug(('In: %.2f KB/S, Out: %.2f KB/S') % (net_in_rate, net_out_rate)) self.logger.debug('net: %s' % system['net']) return system def __probe_services(self): services = [] for svc in self.conf['services']: svc_result = {} svc_result['id'] = svc['id'] svc_result['name'] = svc['name'] svc_process = self.__get_process_by_service_name(svc['name']) if not svc_process: svc_result['live'] = False services.append(svc_result) continue else: svc_result['live'] = True svc_result['cpu_percent'] = svc_process.cpu_percent() svc_result['memory_percent'] = svc_process.memory_percent() mem_info_ex = svc_process.memory_info_ex() svc_result['virtual_memory_size'] = mem_info_ex[1] svc_result['shared_memory_size'] = mem_info_ex[2] try: self.logger.info('%d' % len(svc_process.connections('tcp4'))) except Exception as e: pass services.append(svc_result) return services def __get_process_by_service_name(self, svc_name): for p in psutil.process_iter(): if p.name() == svc_name: return p return def __post_result_to_supervisor(self, result): try: conn = httplib.HTTPConnection(self.conf['service_manager']['host'], port=self.conf['service_manager']['port']) req_headers = {"Content-type": "application/json", "charset": "UTF-8"} req_body = json.dumps(result) conn.request("POST", "/v1/results?type=xxx", body=req_body, headers=req_headers) response = conn.getresponse() print response.status, response.reason data = response.read() print data conn.close() except Exception as e: self.logger.error('%s' % e) def initLogger(conf): # create logger logger = logging.getLogger("prober") logger.setLevel(conf['prober']['logLevel']) # create console handler and set level to debug ch = logging.StreamHandler() # ch.setLevel(logging.DEBUG) # create formatter formatter = logging.Formatter("%(asctime)s [%(levelname)s] %(message)s") # add formatter to ch ch.setFormatter(formatter) # add ch to logger logger.addHandler(ch) return logger def main(): usage = 'usage: %prog [options]' parser = OptionParser(usage, version='%prog 1.0') parser.add_option('-c', '--config', dest='config', help='config file') options, args = parser.parse_args() if not options.config: parser.print_help() return 1 try: conf_file = os.path.join(os.path.abspath('.'), options.config) with open(conf_file) as f: conf = yaml.load(f) except Exception as e: parser.error('%s' % e) return 1 print conf logger = initLogger(conf) try: logger.info('Start probing...') # create prober and start it prober = Prober(conf, logger) prober.start() # wait for finished while prober.is_alive(): prober.join(500) except KeyboardInterrupt: logger.info('Stop probing...') prober.finished_event.set() except Exception as e: logger.error('%s' % e) return if __name__ == '__main__': sys.exit(main())
[ "28865445@qq.com" ]
28865445@qq.com
f9b2b2adb178b6891af96288648b6a7d20b82fb2
eb6631d40908ab5af1bf91287959474352badaf6
/elpa/jedi-core-20170121.1410/env/bin/easy_install
0593a142d6335636ada0e53a713562b8c2bce0e2
[]
no_license
ykawamura96/my_emacs_setting
86f40accb91faec08fe1e56aa7b30ab5edc9a6f1
fbbe36ccf4db4a9487e0028e6f73f4d11c4b2eca
refs/heads/master
2020-03-30T22:10:00.268593
2019-02-14T13:23:07
2019-02-14T13:23:07
151,652,915
0
0
null
null
null
null
UTF-8
Python
false
false
286
#!/home/mech-user/.emacs.d/elpa/jedi-core-20170121.1410/env/bin/python # -*- coding: utf-8 -*- import re import sys from setuptools.command.easy_install import main if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit(main())
[ "yo.kawamura1227@gmail.com" ]
yo.kawamura1227@gmail.com
880850097f26544049855382cf49db99b66f1706
423760d5f79624170980839e491e63c401e6aa6d
/Maya_Scripts/PySide2Template.py
e0005f199c3a92f6d4fa1686539cbed21ef6a298
[ "MIT" ]
permissive
tadame/TAS_Dev
1689027fde43f2f6eb29fe153ac0a37a54ac5613
972f439fe7178a5b6f635930623f5ef70f296f06
refs/heads/master
2020-03-26T20:42:37.862123
2020-03-01T17:41:30
2020-03-01T17:41:30
145,341,021
0
1
MIT
2020-02-13T09:01:44
2018-08-19T22:09:38
Python
UTF-8
Python
false
false
2,762
py
# -*- coding: utf-8 -*- import pymel.core as pm import maya.cmds as mc import maya.OpenMayaUI as omui # Parsing PySide2 with Qt_py_master.Qt from Qt_py_master.Qt import QtCore from Qt_py_master.Qt import QtGui from Qt_py_master.Qt import QtWidgets from Qt_py_master.Qt import QtCompat mainWindow = None def getMayaWindow(): ''' Get the maya main window as a QMainWindow instance ''' ptr = omui.MQtUtil.mainWindow() return QtCompat.wrapInstance(long(ptr), QtWidgets.QMainWindow) def getMainWindow(): """ Get Maya Main window :return: main window """ mainWindow = QtWidgets.QApplication.activeWindow() while True: parentWin = mainWindow.parent() if parentWin: mainWindow = parentWin else: break return mainWindow class BasicDialog(QtWidgets.QMainWindow): ''' A basic demo of a Maya PyQt Window. ''' def __init__(self, parent=getMayaWindow()): ''' Initialize the window. ''' super(BasicDialog, self).__init__(parent)#parent??? #Window title self.setWindowTitle('Maya PyQt Basic Dialog Demo') self.createUI() def createUI(self): ######################################################################## #Create Widgets ######################################################################## #: A QComboBox (i.e., drop-down menu) for displaying the possible shape #: types. shapeTypeCB = QtWidgets.QComboBox(parent=self) #: A QLineEdit (i.e., input text box) for allowing the user to specify #: a name for the new shape. nameLE = QtWidgets.QLineEdit('newShape', parent=self) #: A button for when the user is ready to create the new shape. makeButton = QtWidgets.QPushButton("Make Shape", parent=self) #: A descriptive label for letting the user know what his current settings #: will do. descLabel = QtWidgets.QLabel("This is a description", parent=self) ######################################################################## #Layout the widgets ######################################################################## central_Widget = QtWidgets.QWidget() self.setCentralWidget(central_Widget) layout = QtWidgets.QVBoxLayout(central_Widget) layout.addWidget(shapeTypeCB) layout.addWidget(nameLE) layout.addWidget(makeButton) layout.addWidget(descLabel) def run(): global mainWindow if not mainWindow or not mc.window(mainWindow, q=True, exist=True): mainWindow = BasicDialog() print ("Opening...") mainWindow.show() if __name__ == '__main__': run()
[ "tomas.adame" ]
tomas.adame
732dfaf365d45a2f8c11aea7f8fca9fb0a7a4811
c4c159a21d2f1ea0d7dfaa965aeff01c8ef70dce
/flask/flaskenv/Lib/site-packages/pip/_internal/commands/__init__.py
b82390b90baf4f31e37aaccfcb0dab47e9708893
[]
no_license
AhsonAslam/webapi
54cf7466aac4685da1105f9fb84c686e38f92121
1b2bfa4614e7afdc57c9210b0674506ea70b20b5
refs/heads/master
2020-07-27T06:05:36.057953
2019-09-17T06:35:33
2019-09-17T06:35:33
208,895,450
0
0
null
null
null
null
UTF-8
Python
false
false
129
py
version https://git-lfs.github.com/spec/v1 oid sha256:285fa6ab39e064cb5b3b1917f4ce9acb21b2ae808dcf9c5d95911ce2522d50c2 size 2295
[ "github@cuba12345" ]
github@cuba12345
d2ff4579f64f6fc73854e5574860063244b80510
9743d5fd24822f79c156ad112229e25adb9ed6f6
/xai/brain/wordbase/nouns/_lagoons.py
452aad121321f957a678bdebf1e2f97ad4db1d91
[ "MIT" ]
permissive
cash2one/xai
de7adad1758f50dd6786bf0111e71a903f039b64
e76f12c9f4dcf3ac1c7c08b0cc8844c0b0a104b6
refs/heads/master
2021-01-19T12:33:54.964379
2017-01-28T02:00:50
2017-01-28T02:00:50
null
0
0
null
null
null
null
UTF-8
Python
false
false
238
py
from xai.brain.wordbase.nouns._lagoon import _LAGOON #calss header class _LAGOONS(_LAGOON, ): def __init__(self,): _LAGOON.__init__(self) self.name = "LAGOONS" self.specie = 'nouns' self.basic = "lagoon" self.jsondata = {}
[ "xingwang1991@gmail.com" ]
xingwang1991@gmail.com
e4ab16f8f7f5eef53da68d709891820278522466
557c1524418c0dc03aff5b0d5b4f13312a1ab748
/Website/website/flaskblog/app.py
1acdb9d72b31511b7e5fff183a44322813bf171a
[]
no_license
theColorfulRainbow/videocapture
0049a6b7819828c320f48e38fd6ff9508dfcda44
77c04685195fe68e9c7513e64092d375da22f774
refs/heads/master
2023-03-09T01:49:34.218224
2021-02-23T14:07:02
2021-02-23T14:07:02
218,082,976
0
0
null
null
null
null
UTF-8
Python
false
false
393
py
""" This script runs the application using a development server. It contains the definition of routes and views for the application. """ from flaskblog import app if __name__ == '__main__': import os HOST = os.environ.get('SERVER_HOST', 'localhost') try: PORT = int(os.environ.get('SERVER_PORT', '5555')) except ValueError: PORT = 5555 app.run(HOST, PORT)
[ "s1645821@contador.inf.ed.ac.uk" ]
s1645821@contador.inf.ed.ac.uk
bd05a82a2e83c4ab4590f24632264aee253d9103
e9ef3cd143478660d098668a10e67544a42b5878
/Lib/corpuscrawler/crawl_aom.py
d50bee1821dc4d9ca99f46f8dae1221d0fcd0b11
[ "Apache-2.0" ]
permissive
google/corpuscrawler
a5c790c19b26e6397b768ce26cf12bbcb641eb90
10adaecf4ed5a7d0557c8e692c186023746eb001
refs/heads/master
2023-08-26T04:15:59.036883
2022-04-20T08:18:11
2022-04-20T08:18:11
102,909,145
119
40
NOASSERTION
2022-04-20T08:18:12
2017-09-08T22:21:03
Python
UTF-8
Python
false
false
799
py
# coding: utf-8 # Copyright 2017 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, print_function, unicode_literals import re def crawl(crawler): out = crawler.get_output(language='aom') crawler.crawl_pngscriptures_org(out, language='aom')
[ "sascha@brawer.ch" ]
sascha@brawer.ch
689030762fd3d8ecc273cc5b9a19029891f5d53b
9130ef79d7fc3af654024ce2927b8f58b4d89f18
/test/print_training_data.py
8bde369e7b7ba352639ef4e6893b95a317419afd
[]
no_license
r-wheeler/qa
19b5370e75d71b399bfd66457c0404222858cdce
28c18bc0b23381e5c9dfd8ee1834f9e559ae9714
refs/heads/master
2021-05-14T07:56:47.296010
2017-12-31T01:19:07
2017-12-31T01:19:07
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,605
py
from preprocessing.vocab_util import * from datasets.squad_data import SquadData from flags import get_options_from_flags import tensorflow as tf PRINT_LIMIT = 10 WORD_PRINT_LIMIT = 5 def _print_qst_or_ctx_np_arr(arr, vocab, ds, is_ctx, wiq_or_wic): for z in range(PRINT_LIMIT): l = [] for zz in range(arr.shape[1]): i = arr[z, zz] if i == vocab.PAD_ID: continue word = vocab.get_word_for_id(i) if wiq_or_wic[z, zz] == 1: word = ("[WIQ:]" if is_ctx else "[WIC:]") + word l.append(word) print(" ".join(l)) print("") def _print_gnd_truths(ds, vocab): for z in range(PRINT_LIMIT): question_id = ds.qid[z] sentences = ds.get_sentences_for_all_gnd_truths(question_id) print(";".join(sentences)) def _print_ds(vocab, ds): print("Context") _print_qst_or_ctx_np_arr(ds.ctx, vocab, ds, is_ctx=True, wiq_or_wic=ds.wiq) print("Questions") _print_qst_or_ctx_np_arr(ds.qst, vocab, ds, is_ctx=False, wiq_or_wic=ds.wic) print("Spans") print(ds.spn[:PRINT_LIMIT]) print("Ground truths") _print_gnd_truths(ds, vocab) print("") def main(_): options = get_options_from_flags() options.num_gpus = 0 with tf.Session() as sess: squad_data = SquadData(options) squad_data.setup_with_tf_session(sess) print("TRAIN") _print_ds(squad_data.vocab, squad_data.train_ds) print("DEV") _print_ds(squad_data.vocab, squad_data.dev_ds) if __name__ == "__main__": tf.app.run()
[ "obryanlouis@gmail.com" ]
obryanlouis@gmail.com
460acbb039e6072d9e3b75ce2ab21dd79bc13261
bda892fd07e3879df21dcd1775c86269587e7e07
/leetcode/tools/sortedcontainers/sortedlist.py
4e9316e46a6204e68970ef488f6bc163b07c4f4d
[]
no_license
CrzRabbit/Python
46923109b6e516820dd90f880f6603f1cc71ba11
055ace9f0ca4fb09326da77ae39e33173b3bde15
refs/heads/master
2021-12-23T15:44:46.539503
2021-09-23T09:32:42
2021-09-23T09:32:42
119,370,525
2
0
null
null
null
null
UTF-8
Python
false
false
78,983
py
"""Sorted List ============== :doc:`Sorted Containers<index>` is an Apache2 licensed Python sorted collections library, written in pure-Python, and fast as C-extensions. The :doc:`introduction<introduction>` is the best way to get started. Sorted list implementations: .. currentmodule:: sortedcontainers * :class:`SortedList` * :class:`SortedKeyList` """ # pylint: disable=too-many-lines from __future__ import print_function import sys import traceback from bisect import bisect_left, bisect_right, insort from itertools import chain, repeat, starmap from math import log from operator import add, eq, ne, gt, ge, lt, le, iadd from textwrap import dedent ############################################################################### # BEGIN Python 2/3 Shims ############################################################################### try: from collections.abc import Sequence, MutableSequence except ImportError: from collections import Sequence, MutableSequence from functools import wraps from sys import hexversion if hexversion < 0x03000000: from itertools import imap as map # pylint: disable=redefined-builtin from itertools import izip as zip # pylint: disable=redefined-builtin try: from thread import get_ident except ImportError: from dummy_thread import get_ident else: from functools import reduce try: from _thread import get_ident except ImportError: from _dummy_thread import get_ident def recursive_repr(fillvalue='...'): "Decorator to make a repr function return fillvalue for a recursive call." # pylint: disable=missing-docstring # Copied from reprlib in Python 3 # https://hg.python.org/cpython/file/3.6/Lib/reprlib.py def decorating_function(user_function): repr_running = set() @wraps(user_function) def wrapper(self): key = id(self), get_ident() if key in repr_running: return fillvalue repr_running.add(key) try: result = user_function(self) finally: repr_running.discard(key) return result return wrapper return decorating_function ############################################################################### # END Python 2/3 Shims ############################################################################### class SortedList(MutableSequence): """Sorted list is a sorted mutable sequence. Sorted list values are maintained in sorted order. Sorted list values must be comparable. The total ordering of values must not change while they are stored in the sorted list. Methods for adding values: * :func:`SortedList.add` * :func:`SortedList.update` * :func:`SortedList.__add__` * :func:`SortedList.__iadd__` * :func:`SortedList.__mul__` * :func:`SortedList.__imul__` Methods for removing values: * :func:`SortedList.clear` * :func:`SortedList.discard` * :func:`SortedList.remove` * :func:`SortedList.pop` * :func:`SortedList.__delitem__` Methods for looking up values: * :func:`SortedList.bisect_left` * :func:`SortedList.bisect_right` * :func:`SortedList.count` * :func:`SortedList.index` * :func:`SortedList.__contains__` * :func:`SortedList.__getitem__` Methods for iterating values: * :func:`SortedList.irange` * :func:`SortedList.islice` * :func:`SortedList.__iter__` * :func:`SortedList.__reversed__` Methods for miscellany: * :func:`SortedList.copy` * :func:`SortedList.__len__` * :func:`SortedList.__repr__` * :func:`SortedList._check` * :func:`SortedList._reset` Sorted lists use lexicographical ordering semantics when compared to other sequences. Some algorithm of mutable sequences are not supported and will raise not-implemented error. """ DEFAULT_LOAD_FACTOR = 1000 def __init__(self, iterable=None, key=None): """Initialize sorted list instance. Optional `iterable` argument provides an initial iterable of values to initialize the sorted list. Runtime complexity: `O(n*log(n))` >>> sl = SortedList() >>> sl SortedList([]) >>> sl = SortedList([3, 1, 2, 5, 4]) >>> sl SortedList([1, 2, 3, 4, 5]) :param iterable: initial values (optional) """ assert key is None self._len = 0 self._load = self.DEFAULT_LOAD_FACTOR self._lists = [] self._maxes = [] self._index = [] self._offset = 0 if iterable is not None: self._update(iterable) def __new__(cls, iterable=None, key=None): """Create new sorted list or sorted-key list instance. Optional `key`-function argument will return an instance of subtype :class:`SortedKeyList`. >>> sl = SortedList() >>> isinstance(sl, SortedList) True >>> sl = SortedList(key=lambda x: -x) >>> isinstance(sl, SortedList) True >>> isinstance(sl, SortedKeyList) True :param iterable: initial values (optional) :param key: function used to extract comparison key (optional) :return: sorted list or sorted-key list instance """ # pylint: disable=unused-argument if key is None: return object.__new__(cls) else: if cls is SortedList: return object.__new__(SortedKeyList) else: raise TypeError('inherit SortedKeyList for key argument') @property def key(self): # pylint: disable=useless-return """Function used to extract comparison key from values. Sorted list compares values directly so the key function is none. """ return None def _reset(self, load): """Reset sorted list load factor. The `load` specifies the load-factor of the list. The default load factor of 1000 works well for lists from tens to tens-of-millions of values. Good practice is to use a value that is the cube root of the list size. With billions of elements, the best load factor depends on your usage. It's best to leave the load factor at the default until you start benchmarking. See :doc:`implementation` and :doc:`performance-scale` for more information. Runtime complexity: `O(n)` :param int load: load-factor for sorted list sublists """ values = reduce(iadd, self._lists, []) self._clear() self._load = load self._update(values) def clear(self): """Remove all values from sorted list. Runtime complexity: `O(n)` """ self._len = 0 del self._lists[:] del self._maxes[:] del self._index[:] self._offset = 0 _clear = clear def add(self, value): """Add `value` to sorted list. Runtime complexity: `O(log(n))` -- approximate. >>> sl = SortedList() >>> sl.add(3) >>> sl.add(1) >>> sl.add(2) >>> sl SortedList([1, 2, 3]) :param value: value to add to sorted list """ _lists = self._lists _maxes = self._maxes if _maxes: pos = bisect_right(_maxes, value) if pos == len(_maxes): pos -= 1 _lists[pos].append(value) _maxes[pos] = value else: insort(_lists[pos], value) self._expand(pos) else: _lists.append([value]) _maxes.append(value) self._len += 1 def _expand(self, pos): """Split sublists with length greater than double the load-factor. Updates the index when the sublist length is less than double the load level. This requires incrementing the nodes in a traversal from the leaf node to the root. For an example traversal see ``SortedList._loc``. """ _load = self._load _lists = self._lists _index = self._index if len(_lists[pos]) > (_load << 1): _maxes = self._maxes _lists_pos = _lists[pos] half = _lists_pos[_load:] del _lists_pos[_load:] _maxes[pos] = _lists_pos[-1] _lists.insert(pos + 1, half) _maxes.insert(pos + 1, half[-1]) del _index[:] else: if _index: child = self._offset + pos while child: _index[child] += 1 child = (child - 1) >> 1 _index[0] += 1 def update(self, iterable): """Update sorted list by adding all values from `iterable`. Runtime complexity: `O(k*log(n))` -- approximate. >>> sl = SortedList() >>> sl.update([3, 1, 2]) >>> sl SortedList([1, 2, 3]) :param iterable: iterable of values to add """ _lists = self._lists _maxes = self._maxes values = sorted(iterable) if _maxes: if len(values) * 4 >= self._len: _lists.append(values) values = reduce(iadd, _lists, []) values.sort() self._clear() else: _add = self.add for val in values: _add(val) return _load = self._load _lists.extend(values[pos:(pos + _load)] for pos in range(0, len(values), _load)) _maxes.extend(sublist[-1] for sublist in _lists) self._len = len(values) del self._index[:] _update = update def __contains__(self, value): """Return true if `value` is an element of the sorted list. ``sl.__contains__(value)`` <==> ``value in sl`` Runtime complexity: `O(log(n))` >>> sl = SortedList([1, 2, 3, 4, 5]) >>> 3 in sl True :param value: search for value in sorted list :return: true if `value` in sorted list """ _maxes = self._maxes if not _maxes: return False pos = bisect_left(_maxes, value) if pos == len(_maxes): return False _lists = self._lists idx = bisect_left(_lists[pos], value) return _lists[pos][idx] == value def discard(self, value): """Remove `value` from sorted list if it is a member. If `value` is not a member, do nothing. Runtime complexity: `O(log(n))` -- approximate. >>> sl = SortedList([1, 2, 3, 4, 5]) >>> sl.discard(5) >>> sl.discard(0) >>> sl == [1, 2, 3, 4] True :param value: `value` to discard from sorted list """ _maxes = self._maxes if not _maxes: return pos = bisect_left(_maxes, value) if pos == len(_maxes): return _lists = self._lists idx = bisect_left(_lists[pos], value) if _lists[pos][idx] == value: self._delete(pos, idx) def remove(self, value): """Remove `value` from sorted list; `value` must be a member. If `value` is not a member, raise ValueError. Runtime complexity: `O(log(n))` -- approximate. >>> sl = SortedList([1, 2, 3, 4, 5]) >>> sl.remove(5) >>> sl == [1, 2, 3, 4] True >>> sl.remove(0) Traceback (most recent call last): ... ValueError: 0 not in list :param value: `value` to remove from sorted list :raises ValueError: if `value` is not in sorted list """ _maxes = self._maxes if not _maxes: raise ValueError('{0!r} not in list'.format(value)) pos = bisect_left(_maxes, value) if pos == len(_maxes): raise ValueError('{0!r} not in list'.format(value)) _lists = self._lists idx = bisect_left(_lists[pos], value) if _lists[pos][idx] == value: self._delete(pos, idx) else: raise ValueError('{0!r} not in list'.format(value)) def _delete(self, pos, idx): """Delete value at the given `(pos, idx)`. Combines lists that are less than half the load level. Updates the index when the sublist length is more than half the load level. This requires decrementing the nodes in a traversal from the leaf node to the root. For an example traversal see ``SortedList._loc``. :param int pos: lists index :param int idx: sublist index """ _lists = self._lists _maxes = self._maxes _index = self._index _lists_pos = _lists[pos] del _lists_pos[idx] self._len -= 1 len_lists_pos = len(_lists_pos) if len_lists_pos > (self._load >> 1): _maxes[pos] = _lists_pos[-1] if _index: child = self._offset + pos while child > 0: _index[child] -= 1 child = (child - 1) >> 1 _index[0] -= 1 elif len(_lists) > 1: if not pos: pos += 1 prev = pos - 1 _lists[prev].extend(_lists[pos]) _maxes[prev] = _lists[prev][-1] del _lists[pos] del _maxes[pos] del _index[:] self._expand(prev) elif len_lists_pos: _maxes[pos] = _lists_pos[-1] else: del _lists[pos] del _maxes[pos] del _index[:] def _loc(self, pos, idx): """Convert an index pair (lists index, sublist index) into a single index number that corresponds to the position of the value in the sorted list. Many queries require the index be built. Details of the index are described in ``SortedList._build_index``. Indexing requires traversing the tree from a leaf node to the root. The parent of each node is easily computable at ``(pos - 1) // 2``. Left-child nodes are always at odd indices and right-child nodes are always at even indices. When traversing up from a right-child node, increment the total by the left-child node. The final index is the sum from traversal and the index in the sublist. For example, using the index from ``SortedList._build_index``:: _index = 14 5 9 3 2 4 5 _offset = 3 Tree:: 14 5 9 3 2 4 5 Converting an index pair (2, 3) into a single index involves iterating like so: 1. Starting at the leaf node: offset + alpha = 3 + 2 = 5. We identify the node as a left-child node. At such nodes, we simply traverse to the parent. 2. At node 9, position 2, we recognize the node as a right-child node and accumulate the left-child in our total. Total is now 5 and we traverse to the parent at position 0. 3. Iteration ends at the root. The index is then the sum of the total and sublist index: 5 + 3 = 8. :param int pos: lists index :param int idx: sublist index :return: index in sorted list """ if not pos: return idx _index = self._index if not _index: self._build_index() total = 0 # Increment pos to point in the index to len(self._lists[pos]). pos += self._offset # Iterate until reaching the root of the index tree at pos = 0. while pos: # Right-child nodes are at odd indices. At such indices # account the total below the left child node. if not pos & 1: total += _index[pos - 1] # Advance pos to the parent node. pos = (pos - 1) >> 1 return total + idx def _pos(self, idx): """Convert an index into an index pair (lists index, sublist index) that can be used to access the corresponding lists position. Many queries require the index be built. Details of the index are described in ``SortedList._build_index``. Indexing requires traversing the tree to a leaf node. Each node has two children which are easily computable. Given an index, pos, the left-child is at ``pos * 2 + 1`` and the right-child is at ``pos * 2 + 2``. When the index is less than the left-child, traversal moves to the left sub-tree. Otherwise, the index is decremented by the left-child and traversal moves to the right sub-tree. At a child node, the indexing pair is computed from the relative position of the child node as compared with the offset and the remaining index. For example, using the index from ``SortedList._build_index``:: _index = 14 5 9 3 2 4 5 _offset = 3 Tree:: 14 5 9 3 2 4 5 Indexing position 8 involves iterating like so: 1. Starting at the root, position 0, 8 is compared with the left-child node (5) which it is greater than. When greater the index is decremented and the position is updated to the right child node. 2. At node 9 with index 3, we again compare the index to the left-child node with value 4. Because the index is the less than the left-child node, we simply traverse to the left. 3. At node 4 with index 3, we recognize that we are at a leaf node and stop iterating. 4. To compute the sublist index, we subtract the offset from the index of the leaf node: 5 - 3 = 2. To compute the index in the sublist, we simply use the index remaining from iteration. In this case, 3. The final index pair from our example is (2, 3) which corresponds to index 8 in the sorted list. :param int idx: index in sorted list :return: (lists index, sublist index) pair """ if idx < 0: last_len = len(self._lists[-1]) if (-idx) <= last_len: return len(self._lists) - 1, last_len + idx idx += self._len if idx < 0: raise IndexError('list index out of range') elif idx >= self._len: raise IndexError('list index out of range') if idx < len(self._lists[0]): return 0, idx _index = self._index if not _index: self._build_index() pos = 0 child = 1 len_index = len(_index) while child < len_index: index_child = _index[child] if idx < index_child: pos = child else: idx -= index_child pos = child + 1 child = (pos << 1) + 1 return (pos - self._offset, idx) def _build_index(self): """Build a positional index for indexing the sorted list. Indexes are represented as binary trees in a dense array notation similar to a binary heap. For example, given a lists representation storing integers:: 0: [1, 2, 3] 1: [4, 5] 2: [6, 7, 8, 9] 3: [10, 11, 12, 13, 14] The first transformation maps the sub-lists by their length. The first row of the index is the length of the sub-lists:: 0: [3, 2, 4, 5] Each row after that is the sum of consecutive pairs of the previous row:: 1: [5, 9] 2: [14] Finally, the index is built by concatenating these lists together:: _index = [14, 5, 9, 3, 2, 4, 5] An offset storing the start of the first row is also stored:: _offset = 3 When built, the index can be used for efficient indexing into the list. See the comment and notes on ``SortedList._pos`` for details. """ row0 = list(map(len, self._lists)) if len(row0) == 1: self._index[:] = row0 self._offset = 0 return head = iter(row0) tail = iter(head) row1 = list(starmap(add, zip(head, tail))) if len(row0) & 1: row1.append(row0[-1]) if len(row1) == 1: self._index[:] = row1 + row0 self._offset = 1 return size = 2 ** (int(log(len(row1) - 1, 2)) + 1) row1.extend(repeat(0, size - len(row1))) tree = [row0, row1] while len(tree[-1]) > 1: head = iter(tree[-1]) tail = iter(head) row = list(starmap(add, zip(head, tail))) tree.append(row) reduce(iadd, reversed(tree), self._index) self._offset = size * 2 - 1 def __delitem__(self, index): """Remove value at `index` from sorted list. ``sl.__delitem__(index)`` <==> ``del sl[index]`` Supports slicing. Runtime complexity: `O(log(n))` -- approximate. >>> sl = SortedList('abcde') >>> del sl[2] >>> sl SortedList(['a', 'b', 'd', 'e']) >>> del sl[:2] >>> sl SortedList(['d', 'e']) :param index: integer or slice for indexing :raises IndexError: if index out of range """ if isinstance(index, slice): start, stop, step = index.indices(self._len) if step == 1 and start < stop: if start == 0 and stop == self._len: return self._clear() elif self._len <= 8 * (stop - start): values = self._getitem(slice(None, start)) if stop < self._len: values += self._getitem(slice(stop, None)) self._clear() return self._update(values) indices = range(start, stop, step) # Delete items from greatest index to least so # that the indices remain valid throughout iteration. if step > 0: indices = reversed(indices) _pos, _delete = self._pos, self._delete for index in indices: pos, idx = _pos(index) _delete(pos, idx) else: pos, idx = self._pos(index) self._delete(pos, idx) def __getitem__(self, index): """Lookup value at `index` in sorted list. ``sl.__getitem__(index)`` <==> ``sl[index]`` Supports slicing. Runtime complexity: `O(log(n))` -- approximate. >>> sl = SortedList('abcde') >>> sl[1] 'b' >>> sl[-1] 'e' >>> sl[2:5] ['c', 'd', 'e'] :param index: integer or slice for indexing :return: value or list of values :raises IndexError: if index out of range """ _lists = self._lists if isinstance(index, slice): start, stop, step = index.indices(self._len) if step == 1 and start < stop: # Whole slice optimization: start to stop slices the whole # sorted list. if start == 0 and stop == self._len: return reduce(iadd, self._lists, []) start_pos, start_idx = self._pos(start) start_list = _lists[start_pos] stop_idx = start_idx + stop - start # Small slice optimization: start index and stop index are # within the start list. if len(start_list) >= stop_idx: return start_list[start_idx:stop_idx] if stop == self._len: stop_pos = len(_lists) - 1 stop_idx = len(_lists[stop_pos]) else: stop_pos, stop_idx = self._pos(stop) prefix = _lists[start_pos][start_idx:] middle = _lists[(start_pos + 1):stop_pos] result = reduce(iadd, middle, prefix) result += _lists[stop_pos][:stop_idx] return result if step == -1 and start > stop: result = self._getitem(slice(stop + 1, start + 1)) result.reverse() return result # Return a list because a negative step could # reverse the order of the items and this could # be the desired behavior. indices = range(start, stop, step) return list(self._getitem(index) for index in indices) else: if self._len: if index == 0: return _lists[0][0] elif index == -1: return _lists[-1][-1] else: raise IndexError('list index out of range') if 0 <= index < len(_lists[0]): return _lists[0][index] len_last = len(_lists[-1]) if -len_last < index < 0: return _lists[-1][len_last + index] pos, idx = self._pos(index) return _lists[pos][idx] _getitem = __getitem__ def __setitem__(self, index, value): """Raise not-implemented error. ``sl.__setitem__(index, value)`` <==> ``sl[index] = value`` :raises NotImplementedError: use ``del sl[index]`` and ``sl.add(value)`` instead """ message = 'use ``del sl[index]`` and ``sl.add(value)`` instead' raise NotImplementedError(message) def __iter__(self): """Return an iterator over the sorted list. ``sl.__iter__()`` <==> ``iter(sl)`` Iterating the sorted list while adding or deleting values may raise a :exc:`RuntimeError` or fail to iterate over all values. """ return chain.from_iterable(self._lists) def __reversed__(self): """Return a reverse iterator over the sorted list. ``sl.__reversed__()`` <==> ``reversed(sl)`` Iterating the sorted list while adding or deleting values may raise a :exc:`RuntimeError` or fail to iterate over all values. """ return chain.from_iterable(map(reversed, reversed(self._lists))) def reverse(self): """Raise not-implemented error. Sorted list maintains values in ascending sort order. Values may not be reversed in-place. Use ``reversed(sl)`` for an iterator over values in descending sort order. Implemented to override `MutableSequence.reverse` which provides an erroneous default implementation. :raises NotImplementedError: use ``reversed(sl)`` instead """ raise NotImplementedError('use ``reversed(sl)`` instead') def islice(self, start=None, stop=None, reverse=False): """Return an iterator that slices sorted list from `start` to `stop`. The `start` and `stop` index are treated inclusive and exclusive, respectively. Both `start` and `stop` default to `None` which is automatically inclusive of the beginning and end of the sorted list. When `reverse` is `True` the values are yielded from the iterator in reverse order; `reverse` defaults to `False`. >>> sl = SortedList('abcdefghij') >>> it = sl.islice(2, 6) >>> list(it) ['c', 'd', 'e', 'f'] :param int start: start index (inclusive) :param int stop: stop index (exclusive) :param bool reverse: yield values in reverse order :return: iterator """ _len = self._len if not _len: return iter(()) start, stop, _ = slice(start, stop).indices(self._len) if start >= stop: return iter(()) _pos = self._pos min_pos, min_idx = _pos(start) if stop == _len: max_pos = len(self._lists) - 1 max_idx = len(self._lists[-1]) else: max_pos, max_idx = _pos(stop) return self._islice(min_pos, min_idx, max_pos, max_idx, reverse) def _islice(self, min_pos, min_idx, max_pos, max_idx, reverse): """Return an iterator that slices sorted list using two index pairs. The index pairs are (min_pos, min_idx) and (max_pos, max_idx), the first inclusive and the latter exclusive. See `_pos` for details on how an index is converted to an index pair. When `reverse` is `True`, values are yielded from the iterator in reverse order. """ _lists = self._lists if min_pos > max_pos: return iter(()) if min_pos == max_pos: if reverse: indices = reversed(range(min_idx, max_idx)) return map(_lists[min_pos].__getitem__, indices) indices = range(min_idx, max_idx) return map(_lists[min_pos].__getitem__, indices) next_pos = min_pos + 1 if next_pos == max_pos: if reverse: min_indices = range(min_idx, len(_lists[min_pos])) max_indices = range(max_idx) return chain( map(_lists[max_pos].__getitem__, reversed(max_indices)), map(_lists[min_pos].__getitem__, reversed(min_indices)), ) min_indices = range(min_idx, len(_lists[min_pos])) max_indices = range(max_idx) return chain( map(_lists[min_pos].__getitem__, min_indices), map(_lists[max_pos].__getitem__, max_indices), ) if reverse: min_indices = range(min_idx, len(_lists[min_pos])) sublist_indices = range(next_pos, max_pos) sublists = map(_lists.__getitem__, reversed(sublist_indices)) max_indices = range(max_idx) return chain( map(_lists[max_pos].__getitem__, reversed(max_indices)), chain.from_iterable(map(reversed, sublists)), map(_lists[min_pos].__getitem__, reversed(min_indices)), ) min_indices = range(min_idx, len(_lists[min_pos])) sublist_indices = range(next_pos, max_pos) sublists = map(_lists.__getitem__, sublist_indices) max_indices = range(max_idx) return chain( map(_lists[min_pos].__getitem__, min_indices), chain.from_iterable(sublists), map(_lists[max_pos].__getitem__, max_indices), ) def irange(self, minimum=None, maximum=None, inclusive=(True, True), reverse=False): """Create an iterator of values between `minimum` and `maximum`. Both `minimum` and `maximum` default to `None` which is automatically inclusive of the beginning and end of the sorted list. The argument `inclusive` is a pair of booleans that indicates whether the minimum and maximum ought to be included in the range, respectively. The default is ``(True, True)`` such that the range is inclusive of both minimum and maximum. When `reverse` is `True` the values are yielded from the iterator in reverse order; `reverse` defaults to `False`. >>> sl = SortedList('abcdefghij') >>> it = sl.irange('c', 'f') >>> list(it) ['c', 'd', 'e', 'f'] :param minimum: minimum value to start iterating :param maximum: maximum value to stop iterating :param inclusive: pair of booleans :param bool reverse: yield values in reverse order :return: iterator """ _maxes = self._maxes if not _maxes: return iter(()) _lists = self._lists # Calculate the minimum (pos, idx) pair. By default this location # will be inclusive in our calculation. if minimum is None: min_pos = 0 min_idx = 0 else: if inclusive[0]: min_pos = bisect_left(_maxes, minimum) if min_pos == len(_maxes): return iter(()) min_idx = bisect_left(_lists[min_pos], minimum) else: min_pos = bisect_right(_maxes, minimum) if min_pos == len(_maxes): return iter(()) min_idx = bisect_right(_lists[min_pos], minimum) # Calculate the maximum (pos, idx) pair. By default this location # will be exclusive in our calculation. if maximum is None: max_pos = len(_maxes) - 1 max_idx = len(_lists[max_pos]) else: if inclusive[1]: max_pos = bisect_right(_maxes, maximum) if max_pos == len(_maxes): max_pos -= 1 max_idx = len(_lists[max_pos]) else: max_idx = bisect_right(_lists[max_pos], maximum) else: max_pos = bisect_left(_maxes, maximum) if max_pos == len(_maxes): max_pos -= 1 max_idx = len(_lists[max_pos]) else: max_idx = bisect_left(_lists[max_pos], maximum) return self._islice(min_pos, min_idx, max_pos, max_idx, reverse) def __len__(self): """Return the size of the sorted list. ``sl.__len__()`` <==> ``len(sl)`` :return: size of sorted list """ return self._len def bisect_left(self, value): """Return an index to insert `value` in the sorted list. If the `value` is already present, the insertion point will be before (to the left of) any existing values. Similar to the `bisect` module in the standard library. Runtime complexity: `O(log(n))` -- approximate. >>> sl = SortedList([10, 11, 12, 13, 14]) >>> sl.bisect_left(12) 2 :param value: insertion index of value in sorted list :return: index """ _maxes = self._maxes if not _maxes: return 0 pos = bisect_left(_maxes, value) if pos == len(_maxes): return self._len idx = bisect_left(self._lists[pos], value) return self._loc(pos, idx) def bisect_right(self, value): """Return an index to insert `value` in the sorted list. Similar to `bisect_left`, but if `value` is already present, the insertion point will be after (to the right of) any existing values. Similar to the `bisect` module in the standard library. Runtime complexity: `O(log(n))` -- approximate. >>> sl = SortedList([10, 11, 12, 13, 14]) >>> sl.bisect_right(12) 3 :param value: insertion index of value in sorted list :return: index """ _maxes = self._maxes if not _maxes: return 0 pos = bisect_right(_maxes, value) if pos == len(_maxes): return self._len idx = bisect_right(self._lists[pos], value) return self._loc(pos, idx) bisect = bisect_right _bisect_right = bisect_right def count(self, value): """Return number of occurrences of `value` in the sorted list. Runtime complexity: `O(log(n))` -- approximate. >>> sl = SortedList([1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) >>> sl.count(3) 3 :param value: value to count in sorted list :return: count """ _maxes = self._maxes if not _maxes: return 0 pos_left = bisect_left(_maxes, value) if pos_left == len(_maxes): return 0 _lists = self._lists idx_left = bisect_left(_lists[pos_left], value) pos_right = bisect_right(_maxes, value) if pos_right == len(_maxes): return self._len - self._loc(pos_left, idx_left) idx_right = bisect_right(_lists[pos_right], value) if pos_left == pos_right: return idx_right - idx_left right = self._loc(pos_right, idx_right) left = self._loc(pos_left, idx_left) return right - left def copy(self): """Return a shallow copy of the sorted list. Runtime complexity: `O(n)` :return: new sorted list """ return self.__class__(self) __copy__ = copy def append(self, value): """Raise not-implemented error. Implemented to override `MutableSequence.append` which provides an erroneous default implementation. :raises NotImplementedError: use ``sl.add(value)`` instead """ raise NotImplementedError('use ``sl.add(value)`` instead') def extend(self, values): """Raise not-implemented error. Implemented to override `MutableSequence.extend` which provides an erroneous default implementation. :raises NotImplementedError: use ``sl.update(values)`` instead """ raise NotImplementedError('use ``sl.update(values)`` instead') def insert(self, index, value): """Raise not-implemented error. :raises NotImplementedError: use ``sl.add(value)`` instead """ raise NotImplementedError('use ``sl.add(value)`` instead') def pop(self, index=-1): """Remove and return value at `index` in sorted list. Raise :exc:`IndexError` if the sorted list is empty or index is out of range. Negative indices are supported. Runtime complexity: `O(log(n))` -- approximate. >>> sl = SortedList('abcde') >>> sl.pop() 'e' >>> sl.pop(2) 'c' >>> sl SortedList(['a', 'b', 'd']) :param int index: index of value (default -1) :return: value :raises IndexError: if index is out of range """ if not self._len: raise IndexError('pop index out of range') _lists = self._lists if index == 0: val = _lists[0][0] self._delete(0, 0) return val if index == -1: pos = len(_lists) - 1 loc = len(_lists[pos]) - 1 val = _lists[pos][loc] self._delete(pos, loc) return val if 0 <= index < len(_lists[0]): val = _lists[0][index] self._delete(0, index) return val len_last = len(_lists[-1]) if -len_last < index < 0: pos = len(_lists) - 1 loc = len_last + index val = _lists[pos][loc] self._delete(pos, loc) return val pos, idx = self._pos(index) val = _lists[pos][idx] self._delete(pos, idx) return val def index(self, value, start=None, stop=None): """Return first index of value in sorted list. Raise ValueError if `value` is not present. Index must be between `start` and `stop` for the `value` to be considered present. The default value, None, for `start` and `stop` indicate the beginning and end of the sorted list. Negative indices are supported. Runtime complexity: `O(log(n))` -- approximate. >>> sl = SortedList('abcde') >>> sl.index('d') 3 >>> sl.index('z') Traceback (most recent call last): ... ValueError: 'z' is not in list :param value: value in sorted list :param int start: start index (default None, start of sorted list) :param int stop: stop index (default None, end of sorted list) :return: index of value :raises ValueError: if value is not present """ _len = self._len if not _len: raise ValueError('{0!r} is not in list'.format(value)) if start is None: start = 0 if start < 0: start += _len if start < 0: start = 0 if stop is None: stop = _len if stop < 0: stop += _len if stop > _len: stop = _len if stop <= start: raise ValueError('{0!r} is not in list'.format(value)) _maxes = self._maxes pos_left = bisect_left(_maxes, value) if pos_left == len(_maxes): raise ValueError('{0!r} is not in list'.format(value)) _lists = self._lists idx_left = bisect_left(_lists[pos_left], value) if _lists[pos_left][idx_left] != value: raise ValueError('{0!r} is not in list'.format(value)) stop -= 1 left = self._loc(pos_left, idx_left) if start <= left: if left <= stop: return left else: right = self._bisect_right(value) - 1 if start <= right: return start raise ValueError('{0!r} is not in list'.format(value)) def __add__(self, other): """Return new sorted list containing all values in both sequences. ``sl.__add__(other)`` <==> ``sl + other`` Values in `other` do not need to be in sorted order. Runtime complexity: `O(n*log(n))` >>> sl1 = SortedList('bat') >>> sl2 = SortedList('cat') >>> sl1 + sl2 SortedList(['a', 'a', 'b', 'c', 't', 't']) :param other: other iterable :return: new sorted list """ values = reduce(iadd, self._lists, []) values.extend(other) return self.__class__(values) __radd__ = __add__ def __iadd__(self, other): """Update sorted list with values from `other`. ``sl.__iadd__(other)`` <==> ``sl += other`` Values in `other` do not need to be in sorted order. Runtime complexity: `O(k*log(n))` -- approximate. >>> sl = SortedList('bat') >>> sl += 'cat' >>> sl SortedList(['a', 'a', 'b', 'c', 't', 't']) :param other: other iterable :return: existing sorted list """ self._update(other) return self def __mul__(self, num): """Return new sorted list with `num` shallow copies of values. ``sl.__mul__(num)`` <==> ``sl * num`` Runtime complexity: `O(n*log(n))` >>> sl = SortedList('abc') >>> sl * 3 SortedList(['a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c']) :param int num: count of shallow copies :return: new sorted list """ values = reduce(iadd, self._lists, []) * num return self.__class__(values) __rmul__ = __mul__ def __imul__(self, num): """Update the sorted list with `num` shallow copies of values. ``sl.__imul__(num)`` <==> ``sl *= num`` Runtime complexity: `O(n*log(n))` >>> sl = SortedList('abc') >>> sl *= 3 >>> sl SortedList(['a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c']) :param int num: count of shallow copies :return: existing sorted list """ values = reduce(iadd, self._lists, []) * num self._clear() self._update(values) return self def __make_cmp(seq_op, symbol, doc): "Make comparator method." def comparer(self, other): "Compare method for sorted list and sequence." if not isinstance(other, Sequence): return NotImplemented self_len = self._len len_other = len(other) if self_len != len_other: if seq_op is eq: return False if seq_op is ne: return True for alpha, beta in zip(self, other): if alpha != beta: return seq_op(alpha, beta) return seq_op(self_len, len_other) seq_op_name = seq_op.__name__ comparer.__name__ = '__{0}__'.format(seq_op_name) doc_str = """Return true if and only if sorted list is {0} `other`. ``sl.__{1}__(other)`` <==> ``sl {2} other`` Comparisons use lexicographical order as with sequences. Runtime complexity: `O(n)` :param other: `other` sequence :return: true if sorted list is {0} `other` """ comparer.__doc__ = dedent(doc_str.format(doc, seq_op_name, symbol)) return comparer __eq__ = __make_cmp(eq, '==', 'equal to') __ne__ = __make_cmp(ne, '!=', 'not equal to') __lt__ = __make_cmp(lt, '<', 'less than') __gt__ = __make_cmp(gt, '>', 'greater than') __le__ = __make_cmp(le, '<=', 'less than or equal to') __ge__ = __make_cmp(ge, '>=', 'greater than or equal to') __make_cmp = staticmethod(__make_cmp) def __reduce__(self): values = reduce(iadd, self._lists, []) return (type(self), (values,)) @recursive_repr() def __repr__(self): """Return string representation of sorted list. ``sl.__repr__()`` <==> ``repr(sl)`` :return: string representation """ return '{0}({1!r})'.format(type(self).__name__, list(self)) def _check(self): """Check invariants of sorted list. Runtime complexity: `O(n)` """ try: assert self._load >= 4 assert len(self._maxes) == len(self._lists) assert self._len == sum(len(sublist) for sublist in self._lists) # Check all sublists are sorted. for sublist in self._lists: for pos in range(1, len(sublist)): assert sublist[pos - 1] <= sublist[pos] # Check beginning/end of sublists are sorted. for pos in range(1, len(self._lists)): assert self._lists[pos - 1][-1] <= self._lists[pos][0] # Check _maxes index is the last value of each sublist. for pos in range(len(self._maxes)): assert self._maxes[pos] == self._lists[pos][-1] # Check sublist lengths are less than double load-factor. double = self._load << 1 assert all(len(sublist) <= double for sublist in self._lists) # Check sublist lengths are greater than half load-factor for all # but the last sublist. half = self._load >> 1 for pos in range(0, len(self._lists) - 1): assert len(self._lists[pos]) >= half if self._index: assert self._len == self._index[0] assert len(self._index) == self._offset + len(self._lists) # Check index leaf nodes equal length of sublists. for pos in range(len(self._lists)): leaf = self._index[self._offset + pos] assert leaf == len(self._lists[pos]) # Check index branch nodes are the sum of their children. for pos in range(self._offset): child = (pos << 1) + 1 if child >= len(self._index): assert self._index[pos] == 0 elif child + 1 == len(self._index): assert self._index[pos] == self._index[child] else: child_sum = self._index[child] + self._index[child + 1] assert child_sum == self._index[pos] except: traceback.print_exc(file=sys.stdout) print('len', self._len) print('load', self._load) print('offset', self._offset) print('len_index', len(self._index)) print('index', self._index) print('len_maxes', len(self._maxes)) print('maxes', self._maxes) print('len_lists', len(self._lists)) print('lists', self._lists) raise def identity(value): "Identity function." return value class SortedKeyList(SortedList): """Sorted-key list is a subtype of sorted list. The sorted-key list maintains values in comparison order based on the result of a key function applied to every value. All the same algorithm that are available in :class:`SortedList` are also available in :class:`SortedKeyList`. Additional algorithm provided: * :attr:`SortedKeyList.key` * :func:`SortedKeyList.bisect_key_left` * :func:`SortedKeyList.bisect_key_right` * :func:`SortedKeyList.irange_key` Some examples below use: >>> from operator import neg >>> neg <built-in function neg> >>> neg(1) -1 """ def __init__(self, iterable=None, key=identity): """Initialize sorted-key list instance. Optional `iterable` argument provides an initial iterable of values to initialize the sorted-key list. Optional `key` argument defines a callable that, like the `key` argument to Python's `sorted` function, extracts a comparison key from each value. The default is the identity function. Runtime complexity: `O(n*log(n))` >>> from operator import neg >>> skl = SortedKeyList(key=neg) >>> skl SortedKeyList([], key=<built-in function neg>) >>> skl = SortedKeyList([3, 1, 2], key=neg) >>> skl SortedKeyList([3, 2, 1], key=<built-in function neg>) :param iterable: initial values (optional) :param key: function used to extract comparison key (optional) """ self._key = key self._len = 0 self._load = self.DEFAULT_LOAD_FACTOR self._lists = [] self._keys = [] self._maxes = [] self._index = [] self._offset = 0 if iterable is not None: self._update(iterable) def __new__(cls, iterable=None, key=identity): return object.__new__(cls) @property def key(self): "Function used to extract comparison key from values." return self._key def clear(self): """Remove all values from sorted-key list. Runtime complexity: `O(n)` """ self._len = 0 del self._lists[:] del self._keys[:] del self._maxes[:] del self._index[:] _clear = clear def add(self, value): """Add `value` to sorted-key list. Runtime complexity: `O(log(n))` -- approximate. >>> from operator import neg >>> skl = SortedKeyList(key=neg) >>> skl.add(3) >>> skl.add(1) >>> skl.add(2) >>> skl SortedKeyList([3, 2, 1], key=<built-in function neg>) :param value: value to add to sorted-key list """ _lists = self._lists _keys = self._keys _maxes = self._maxes key = self._key(value) if _maxes: pos = bisect_right(_maxes, key) if pos == len(_maxes): pos -= 1 _lists[pos].append(value) _keys[pos].append(key) _maxes[pos] = key else: idx = bisect_right(_keys[pos], key) _lists[pos].insert(idx, value) _keys[pos].insert(idx, key) self._expand(pos) else: _lists.append([value]) _keys.append([key]) _maxes.append(key) self._len += 1 def _expand(self, pos): """Split sublists with length greater than double the load-factor. Updates the index when the sublist length is less than double the load level. This requires incrementing the nodes in a traversal from the leaf node to the root. For an example traversal see ``SortedList._loc``. """ _lists = self._lists _keys = self._keys _index = self._index if len(_keys[pos]) > (self._load << 1): _maxes = self._maxes _load = self._load _lists_pos = _lists[pos] _keys_pos = _keys[pos] half = _lists_pos[_load:] half_keys = _keys_pos[_load:] del _lists_pos[_load:] del _keys_pos[_load:] _maxes[pos] = _keys_pos[-1] _lists.insert(pos + 1, half) _keys.insert(pos + 1, half_keys) _maxes.insert(pos + 1, half_keys[-1]) del _index[:] else: if _index: child = self._offset + pos while child: _index[child] += 1 child = (child - 1) >> 1 _index[0] += 1 def update(self, iterable): """Update sorted-key list by adding all values from `iterable`. Runtime complexity: `O(k*log(n))` -- approximate. >>> from operator import neg >>> skl = SortedKeyList(key=neg) >>> skl.update([3, 1, 2]) >>> skl SortedKeyList([3, 2, 1], key=<built-in function neg>) :param iterable: iterable of values to add """ _lists = self._lists _keys = self._keys _maxes = self._maxes values = sorted(iterable, key=self._key) if _maxes: if len(values) * 4 >= self._len: _lists.append(values) values = reduce(iadd, _lists, []) values.sort(key=self._key) self._clear() else: _add = self.add for val in values: _add(val) return _load = self._load _lists.extend(values[pos:(pos + _load)] for pos in range(0, len(values), _load)) _keys.extend(list(map(self._key, _list)) for _list in _lists) _maxes.extend(sublist[-1] for sublist in _keys) self._len = len(values) del self._index[:] _update = update def __contains__(self, value): """Return true if `value` is an element of the sorted-key list. ``skl.__contains__(value)`` <==> ``value in skl`` Runtime complexity: `O(log(n))` >>> from operator import neg >>> skl = SortedKeyList([1, 2, 3, 4, 5], key=neg) >>> 3 in skl True :param value: search for value in sorted-key list :return: true if `value` in sorted-key list """ _maxes = self._maxes if not _maxes: return False key = self._key(value) pos = bisect_left(_maxes, key) if pos == len(_maxes): return False _lists = self._lists _keys = self._keys idx = bisect_left(_keys[pos], key) len_keys = len(_keys) len_sublist = len(_keys[pos]) while True: if _keys[pos][idx] != key: return False if _lists[pos][idx] == value: return True idx += 1 if idx == len_sublist: pos += 1 if pos == len_keys: return False len_sublist = len(_keys[pos]) idx = 0 def discard(self, value): """Remove `value` from sorted-key list if it is a member. If `value` is not a member, do nothing. Runtime complexity: `O(log(n))` -- approximate. >>> from operator import neg >>> skl = SortedKeyList([5, 4, 3, 2, 1], key=neg) >>> skl.discard(1) >>> skl.discard(0) >>> skl == [5, 4, 3, 2] True :param value: `value` to discard from sorted-key list """ _maxes = self._maxes if not _maxes: return key = self._key(value) pos = bisect_left(_maxes, key) if pos == len(_maxes): return _lists = self._lists _keys = self._keys idx = bisect_left(_keys[pos], key) len_keys = len(_keys) len_sublist = len(_keys[pos]) while True: if _keys[pos][idx] != key: return if _lists[pos][idx] == value: self._delete(pos, idx) return idx += 1 if idx == len_sublist: pos += 1 if pos == len_keys: return len_sublist = len(_keys[pos]) idx = 0 def remove(self, value): """Remove `value` from sorted-key list; `value` must be a member. If `value` is not a member, raise ValueError. Runtime complexity: `O(log(n))` -- approximate. >>> from operator import neg >>> skl = SortedKeyList([1, 2, 3, 4, 5], key=neg) >>> skl.remove(5) >>> skl == [4, 3, 2, 1] True >>> skl.remove(0) Traceback (most recent call last): ... ValueError: 0 not in list :param value: `value` to remove from sorted-key list :raises ValueError: if `value` is not in sorted-key list """ _maxes = self._maxes if not _maxes: raise ValueError('{0!r} not in list'.format(value)) key = self._key(value) pos = bisect_left(_maxes, key) if pos == len(_maxes): raise ValueError('{0!r} not in list'.format(value)) _lists = self._lists _keys = self._keys idx = bisect_left(_keys[pos], key) len_keys = len(_keys) len_sublist = len(_keys[pos]) while True: if _keys[pos][idx] != key: raise ValueError('{0!r} not in list'.format(value)) if _lists[pos][idx] == value: self._delete(pos, idx) return idx += 1 if idx == len_sublist: pos += 1 if pos == len_keys: raise ValueError('{0!r} not in list'.format(value)) len_sublist = len(_keys[pos]) idx = 0 def _delete(self, pos, idx): """Delete value at the given `(pos, idx)`. Combines lists that are less than half the load level. Updates the index when the sublist length is more than half the load level. This requires decrementing the nodes in a traversal from the leaf node to the root. For an example traversal see ``SortedList._loc``. :param int pos: lists index :param int idx: sublist index """ _lists = self._lists _keys = self._keys _maxes = self._maxes _index = self._index keys_pos = _keys[pos] lists_pos = _lists[pos] del keys_pos[idx] del lists_pos[idx] self._len -= 1 len_keys_pos = len(keys_pos) if len_keys_pos > (self._load >> 1): _maxes[pos] = keys_pos[-1] if _index: child = self._offset + pos while child > 0: _index[child] -= 1 child = (child - 1) >> 1 _index[0] -= 1 elif len(_keys) > 1: if not pos: pos += 1 prev = pos - 1 _keys[prev].extend(_keys[pos]) _lists[prev].extend(_lists[pos]) _maxes[prev] = _keys[prev][-1] del _lists[pos] del _keys[pos] del _maxes[pos] del _index[:] self._expand(prev) elif len_keys_pos: _maxes[pos] = keys_pos[-1] else: del _lists[pos] del _keys[pos] del _maxes[pos] del _index[:] def irange(self, minimum=None, maximum=None, inclusive=(True, True), reverse=False): """Create an iterator of values between `minimum` and `maximum`. Both `minimum` and `maximum` default to `None` which is automatically inclusive of the beginning and end of the sorted-key list. The argument `inclusive` is a pair of booleans that indicates whether the minimum and maximum ought to be included in the range, respectively. The default is ``(True, True)`` such that the range is inclusive of both minimum and maximum. When `reverse` is `True` the values are yielded from the iterator in reverse order; `reverse` defaults to `False`. >>> from operator import neg >>> skl = SortedKeyList([11, 12, 13, 14, 15], key=neg) >>> it = skl.irange(14.5, 11.5) >>> list(it) [14, 13, 12] :param minimum: minimum value to start iterating :param maximum: maximum value to stop iterating :param inclusive: pair of booleans :param bool reverse: yield values in reverse order :return: iterator """ min_key = self._key(minimum) if minimum is not None else None max_key = self._key(maximum) if maximum is not None else None return self._irange_key( min_key=min_key, max_key=max_key, inclusive=inclusive, reverse=reverse, ) def irange_key(self, min_key=None, max_key=None, inclusive=(True, True), reverse=False): """Create an iterator of values between `min_key` and `max_key`. Both `min_key` and `max_key` default to `None` which is automatically inclusive of the beginning and end of the sorted-key list. The argument `inclusive` is a pair of booleans that indicates whether the minimum and maximum ought to be included in the range, respectively. The default is ``(True, True)`` such that the range is inclusive of both minimum and maximum. When `reverse` is `True` the values are yielded from the iterator in reverse order; `reverse` defaults to `False`. >>> from operator import neg >>> skl = SortedKeyList([11, 12, 13, 14, 15], key=neg) >>> it = skl.irange_key(-14, -12) >>> list(it) [14, 13, 12] :param min_key: minimum key to start iterating :param max_key: maximum key to stop iterating :param inclusive: pair of booleans :param bool reverse: yield values in reverse order :return: iterator """ _maxes = self._maxes if not _maxes: return iter(()) _keys = self._keys # Calculate the minimum (pos, idx) pair. By default this location # will be inclusive in our calculation. if min_key is None: min_pos = 0 min_idx = 0 else: if inclusive[0]: min_pos = bisect_left(_maxes, min_key) if min_pos == len(_maxes): return iter(()) min_idx = bisect_left(_keys[min_pos], min_key) else: min_pos = bisect_right(_maxes, min_key) if min_pos == len(_maxes): return iter(()) min_idx = bisect_right(_keys[min_pos], min_key) # Calculate the maximum (pos, idx) pair. By default this location # will be exclusive in our calculation. if max_key is None: max_pos = len(_maxes) - 1 max_idx = len(_keys[max_pos]) else: if inclusive[1]: max_pos = bisect_right(_maxes, max_key) if max_pos == len(_maxes): max_pos -= 1 max_idx = len(_keys[max_pos]) else: max_idx = bisect_right(_keys[max_pos], max_key) else: max_pos = bisect_left(_maxes, max_key) if max_pos == len(_maxes): max_pos -= 1 max_idx = len(_keys[max_pos]) else: max_idx = bisect_left(_keys[max_pos], max_key) return self._islice(min_pos, min_idx, max_pos, max_idx, reverse) _irange_key = irange_key def bisect_left(self, value): """Return an index to insert `value` in the sorted-key list. If the `value` is already present, the insertion point will be before (to the left of) any existing values. Similar to the `bisect` module in the standard library. Runtime complexity: `O(log(n))` -- approximate. >>> from operator import neg >>> skl = SortedKeyList([5, 4, 3, 2, 1], key=neg) >>> skl.bisect_left(1) 4 :param value: insertion index of value in sorted-key list :return: index """ return self._bisect_key_left(self._key(value)) def bisect_right(self, value): """Return an index to insert `value` in the sorted-key list. Similar to `bisect_left`, but if `value` is already present, the insertion point will be after (to the right of) any existing values. Similar to the `bisect` module in the standard library. Runtime complexity: `O(log(n))` -- approximate. >>> from operator import neg >>> skl = SortedList([5, 4, 3, 2, 1], key=neg) >>> skl.bisect_right(1) 5 :param value: insertion index of value in sorted-key list :return: index """ return self._bisect_key_right(self._key(value)) bisect = bisect_right def bisect_key_left(self, key): """Return an index to insert `key` in the sorted-key list. If the `key` is already present, the insertion point will be before (to the left of) any existing keys. Similar to the `bisect` module in the standard library. Runtime complexity: `O(log(n))` -- approximate. >>> from operator import neg >>> skl = SortedKeyList([5, 4, 3, 2, 1], key=neg) >>> skl.bisect_key_left(-1) 4 :param key: insertion index of key in sorted-key list :return: index """ _maxes = self._maxes if not _maxes: return 0 pos = bisect_left(_maxes, key) if pos == len(_maxes): return self._len idx = bisect_left(self._keys[pos], key) return self._loc(pos, idx) _bisect_key_left = bisect_key_left def bisect_key_right(self, key): """Return an index to insert `key` in the sorted-key list. Similar to `bisect_key_left`, but if `key` is already present, the insertion point will be after (to the right of) any existing keys. Similar to the `bisect` module in the standard library. Runtime complexity: `O(log(n))` -- approximate. >>> from operator import neg >>> skl = SortedList([5, 4, 3, 2, 1], key=neg) >>> skl.bisect_key_right(-1) 5 :param key: insertion index of key in sorted-key list :return: index """ _maxes = self._maxes if not _maxes: return 0 pos = bisect_right(_maxes, key) if pos == len(_maxes): return self._len idx = bisect_right(self._keys[pos], key) return self._loc(pos, idx) bisect_key = bisect_key_right _bisect_key_right = bisect_key_right def count(self, value): """Return number of occurrences of `value` in the sorted-key list. Runtime complexity: `O(log(n))` -- approximate. >>> from operator import neg >>> skl = SortedKeyList([4, 4, 4, 4, 3, 3, 3, 2, 2, 1], key=neg) >>> skl.count(2) 2 :param value: value to count in sorted-key list :return: count """ _maxes = self._maxes if not _maxes: return 0 key = self._key(value) pos = bisect_left(_maxes, key) if pos == len(_maxes): return 0 _lists = self._lists _keys = self._keys idx = bisect_left(_keys[pos], key) total = 0 len_keys = len(_keys) len_sublist = len(_keys[pos]) while True: if _keys[pos][idx] != key: return total if _lists[pos][idx] == value: total += 1 idx += 1 if idx == len_sublist: pos += 1 if pos == len_keys: return total len_sublist = len(_keys[pos]) idx = 0 def copy(self): """Return a shallow copy of the sorted-key list. Runtime complexity: `O(n)` :return: new sorted-key list """ return self.__class__(self, key=self._key) __copy__ = copy def index(self, value, start=None, stop=None): """Return first index of value in sorted-key list. Raise ValueError if `value` is not present. Index must be between `start` and `stop` for the `value` to be considered present. The default value, None, for `start` and `stop` indicate the beginning and end of the sorted-key list. Negative indices are supported. Runtime complexity: `O(log(n))` -- approximate. >>> from operator import neg >>> skl = SortedKeyList([5, 4, 3, 2, 1], key=neg) >>> skl.index(2) 3 >>> skl.index(0) Traceback (most recent call last): ... ValueError: 0 is not in list :param value: value in sorted-key list :param int start: start index (default None, start of sorted-key list) :param int stop: stop index (default None, end of sorted-key list) :return: index of value :raises ValueError: if value is not present """ _len = self._len if not _len: raise ValueError('{0!r} is not in list'.format(value)) if start is None: start = 0 if start < 0: start += _len if start < 0: start = 0 if stop is None: stop = _len if stop < 0: stop += _len if stop > _len: stop = _len if stop <= start: raise ValueError('{0!r} is not in list'.format(value)) _maxes = self._maxes key = self._key(value) pos = bisect_left(_maxes, key) if pos == len(_maxes): raise ValueError('{0!r} is not in list'.format(value)) stop -= 1 _lists = self._lists _keys = self._keys idx = bisect_left(_keys[pos], key) len_keys = len(_keys) len_sublist = len(_keys[pos]) while True: if _keys[pos][idx] != key: raise ValueError('{0!r} is not in list'.format(value)) if _lists[pos][idx] == value: loc = self._loc(pos, idx) if start <= loc <= stop: return loc elif loc > stop: break idx += 1 if idx == len_sublist: pos += 1 if pos == len_keys: raise ValueError('{0!r} is not in list'.format(value)) len_sublist = len(_keys[pos]) idx = 0 raise ValueError('{0!r} is not in list'.format(value)) def __add__(self, other): """Return new sorted-key list containing all values in both sequences. ``skl.__add__(other)`` <==> ``skl + other`` Values in `other` do not need to be in sorted-key order. Runtime complexity: `O(n*log(n))` >>> from operator import neg >>> skl1 = SortedKeyList([5, 4, 3], key=neg) >>> skl2 = SortedKeyList([2, 1, 0], key=neg) >>> skl1 + skl2 SortedKeyList([5, 4, 3, 2, 1, 0], key=<built-in function neg>) :param other: other iterable :return: new sorted-key list """ values = reduce(iadd, self._lists, []) values.extend(other) return self.__class__(values, key=self._key) __radd__ = __add__ def __mul__(self, num): """Return new sorted-key list with `num` shallow copies of values. ``skl.__mul__(num)`` <==> ``skl * num`` Runtime complexity: `O(n*log(n))` >>> from operator import neg >>> skl = SortedKeyList([3, 2, 1], key=neg) >>> skl * 2 SortedKeyList([3, 3, 2, 2, 1, 1], key=<built-in function neg>) :param int num: count of shallow copies :return: new sorted-key list """ values = reduce(iadd, self._lists, []) * num return self.__class__(values, key=self._key) def __reduce__(self): values = reduce(iadd, self._lists, []) return (type(self), (values, self.key)) @recursive_repr() def __repr__(self): """Return string representation of sorted-key list. ``skl.__repr__()`` <==> ``repr(skl)`` :return: string representation """ type_name = type(self).__name__ return '{0}({1!r}, key={2!r})'.format(type_name, list(self), self._key) def _check(self): """Check invariants of sorted-key list. Runtime complexity: `O(n)` """ try: assert self._load >= 4 assert len(self._maxes) == len(self._lists) == len(self._keys) assert self._len == sum(len(sublist) for sublist in self._lists) # Check all sublists are sorted. for sublist in self._keys: for pos in range(1, len(sublist)): assert sublist[pos - 1] <= sublist[pos] # Check beginning/end of sublists are sorted. for pos in range(1, len(self._keys)): assert self._keys[pos - 1][-1] <= self._keys[pos][0] # Check _keys matches _key mapped to _lists. for val_sublist, key_sublist in zip(self._lists, self._keys): assert len(val_sublist) == len(key_sublist) for val, key in zip(val_sublist, key_sublist): assert self._key(val) == key # Check _maxes index is the last value of each sublist. for pos in range(len(self._maxes)): assert self._maxes[pos] == self._keys[pos][-1] # Check sublist lengths are less than double load-factor. double = self._load << 1 assert all(len(sublist) <= double for sublist in self._lists) # Check sublist lengths are greater than half load-factor for all # but the last sublist. half = self._load >> 1 for pos in range(0, len(self._lists) - 1): assert len(self._lists[pos]) >= half if self._index: assert self._len == self._index[0] assert len(self._index) == self._offset + len(self._lists) # Check index leaf nodes equal length of sublists. for pos in range(len(self._lists)): leaf = self._index[self._offset + pos] assert leaf == len(self._lists[pos]) # Check index branch nodes are the sum of their children. for pos in range(self._offset): child = (pos << 1) + 1 if child >= len(self._index): assert self._index[pos] == 0 elif child + 1 == len(self._index): assert self._index[pos] == self._index[child] else: child_sum = self._index[child] + self._index[child + 1] assert child_sum == self._index[pos] except: traceback.print_exc(file=sys.stdout) print('len', self._len) print('load', self._load) print('offset', self._offset) print('len_index', len(self._index)) print('index', self._index) print('len_maxes', len(self._maxes)) print('maxes', self._maxes) print('len_keys', len(self._keys)) print('keys', self._keys) print('len_lists', len(self._lists)) print('lists', self._lists) raise SortedListWithKey = SortedKeyList
[ "1016864609@qq.com" ]
1016864609@qq.com
787c56c76cfc61bc3e23eb78aa673a5d422b1b23
049c29351641e7245a6dc1fc44a684c0fd17ebf7
/snn/librispeech/train.py
d1e3b4c9d54298cd6108e52a7092871f64251078
[ "MIT" ]
permissive
vjoki/fsl-experi
c093d13efd27ea22a1e990e0c073df6bd30135e6
a5d81afbc69dfec0c01f545168c966fd03a037f1
refs/heads/master
2023-07-11T02:00:25.772149
2021-08-05T11:06:52
2021-08-05T11:06:52
304,908,552
4
1
null
null
null
null
UTF-8
Python
false
false
5,204
py
import argparse from typing import List import pytorch_lightning as pl from snn.librispeech.model import BaseNet, SNN, SNNCapsNet, SNNAngularProto, SNNSoftmaxProto from snn.librispeech.datamodule import LibriSpeechDataModule from pytorch_lightning.loggers import TensorBoardLogger from pytorch_lightning.callbacks import ModelCheckpoint, LearningRateMonitor from pytorch_lightning.callbacks.early_stopping import EarlyStopping def train_and_test(args: argparse.Namespace): dict_args = vars(args) seed = args.rng_seed log_dir = args.log_dir early_stop = args.early_stop early_stop_min_delta = args.early_stop_min_delta early_stop_patience = args.early_stop_patience checkpoint_dir = args.checkpoint_dir pl.seed_everything(seed) callbacks: List[pl.callbacks.Callback] = [ LearningRateMonitor(logging_interval='step') ] if early_stop: # Should give enough time for lr_scheduler to try do it's thing. callbacks.append(EarlyStopping( monitor='val_loss', mode='min', min_delta=early_stop_min_delta, patience=early_stop_patience, verbose=True, strict=True )) checkpoint_callback = ModelCheckpoint( monitor='val_loss' if args.fast_dev_run else 'val_eer', mode='min', filepath=checkpoint_dir + args.model + '-{epoch}-{val_loss:.2f}-{val_eer:.2f}', save_top_k=3 ) logger = TensorBoardLogger(log_dir, name=args.model, log_graph=True, default_hp_metric=False) trainer = pl.Trainer.from_argparse_args(args, logger=logger, progress_bar_refresh_rate=20, deterministic=True, auto_lr_find=False, # Do this manually. checkpoint_callback=checkpoint_callback, callbacks=callbacks) model: BaseNet if args.model == 'snn': model = SNN(**dict_args) datamodule = LibriSpeechDataModule(train_set_type='pair', **dict_args) elif args.model == 'snn-capsnet': model = SNNCapsNet(**dict_args) datamodule = LibriSpeechDataModule(train_set_type='pair', **dict_args) elif args.model == 'snn-angularproto': model = SNNAngularProto(**dict_args) datamodule = LibriSpeechDataModule(train_set_type='nshotkway', **dict_args) elif args.model == 'snn-softmaxproto': model = SNNSoftmaxProto(**dict_args) datamodule = LibriSpeechDataModule(train_set_type='nshotkway', **dict_args) # Tune. trainer.tune(model, datamodule=datamodule) # Prefer provided LR over lr_finder. new_lr: float if args.learning_rate: new_lr = args.learning_rate elif args.fast_dev_run: new_lr = 1e-3 else: lr_finder = trainer.tuner.lr_find(model) new_lr = lr_finder.suggestion() # Could also try max(lr_finder.results['lr']) max_lr = new_lr * (args.max_lr_multiplier or 3) model.hparams.max_learning_rate = max_lr # type: ignore model.hparams.learning_rate = new_lr # type: ignore print('Learning rate set to {}.'.format(new_lr)) logger.log_hyperparams(params=model.hparams) # Train model. trainer.fit(model, datamodule=datamodule) print('Best model saved to: ', checkpoint_callback.best_model_path) trainer.save_checkpoint(checkpoint_dir + args.model + '-last.ckpt') # Test using best checkpoint. trainer.test(datamodule=datamodule) def train(): parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) general = parser.add_argument_group('General') general.add_argument('--model', type=str.lower, default='snn', choices=['snn', 'snn-capsnet', 'snn-angularproto', 'snn-softmaxproto'], help='Choose the model to train.') general.add_argument('--learning_rate', type=float, help='Override initial learning rate.') general.add_argument('--max_lr_multiplier', type=float, help='A multiplier that is applied on learning rate, the result of which is then provided to ' 'OneCycleLR scheduler as the maximum learning rate.') general.add_argument('--early_stop', action='store_true', default=False, help='Enable early stopping') general.add_argument('--early_stop_min_delta', type=float, default=1e-8, help='Minimum change in val_loss quantity to qualify as an improvement') general.add_argument('--early_stop_patience', type=int, default=15, help='# of validation epochs with no improvement after which training will be stopped') general.add_argument('--log_dir', type=str, default='./lightning_logs/', help='Tensorboard log directory') general.add_argument('--checkpoint_dir', type=str, default='./checkpoints/', help='Model checkpoint directory.') parser = BaseNet.add_model_specific_args(parser) parser = LibriSpeechDataModule.add_dataset_specific_args(parser) parser = pl.Trainer.add_argparse_args(parser) args = parser.parse_args() train_and_test(args) if __name__ == "__main__": train()
[ "vjoki@zv.fi" ]
vjoki@zv.fi
164cfc3e9cab75e960c7b44fb9e765b75b4c75cc
ac061dfce3fe48024e5e32922f3903194a8fe8b7
/conkat.py
b4e91aa34fbf910c696c6f62e7fa01546e60c19a
[ "MIT" ]
permissive
elbow-jason/jasons-dot-files
e486c771836a2428e4054251dd8be4ab7a27927c
081300ed391e6c59b93e3696ab8219d94e10b768
refs/heads/master
2020-06-02T22:21:11.995806
2014-05-17T09:47:17
2014-05-17T09:47:17
null
0
0
null
null
null
null
UTF-8
Python
false
false
222
py
#!/usr/bin/python #open it f = open('jasons-commands.sh') contents = f.read() f.close() #remove all the newlines new_contents = contents.replace('\n', '') f = open('doit.sh', 'w') #save it f.write(new_contents) f.close()
[ "jlgoldb2@asu.edu" ]
jlgoldb2@asu.edu
6c17096b29d16a058c5371b3d125c37bca2ba7b6
8104f04c4a31232962f82c9f237f87f7be3909b0
/project-2/features.py
64b12a70f91d58619e902c5671dc06623fe87b62
[]
no_license
AndrewZhou924/Digital-Image-Processing-Course-Design
6624d4c819a0f980ddda103577de0677f134b38c
f3a4a29fd7c4dda25d249c2c36fd43efda2d8460
refs/heads/master
2021-07-07T00:49:24.584572
2020-03-31T07:35:37
2020-03-31T07:35:37
241,303,727
0
1
null
2021-06-08T21:07:18
2020-02-18T07:57:59
Jupyter Notebook
UTF-8
Python
false
false
3,066
py
import matplotlib import numpy as np from scipy.ndimage import uniform_filter def extract_features(imgs, feature_fns, verbose = False): num_images = imgs.shape[0] if num_images == 0: return np.array([]) feature_dims = [] first_image_features = [] for feature_fn in feature_fns: feats = feature_fn(imgs[0].squeeze()) assert len(feats.shape) == 1,'Feature functions must be one-dimensional' feature_dims.append(feats.size) first_image_features.append(feats) total_feature_dim = sum(feature_dims) imgs_features = np.zeors((num_images, total_feature_dim)) imgs_features[0] = np.hstack(first_image_features).T for i in range(1, num_images): idx = 0 for feature_fn, feature_dim in zip(feature_fns, feature_dims): next_idx = idx + feature_dim imgs_features[i, idx:next_idx] = feature_fn(imgs[i].squeeze()) idx = next_idx if verbose and i % 1000 == 0: print('Done extracting features for %d / $d images' % (i, num_images)) return imgs_features def rgb2gray(rgb): return np.dot(rgb[...,:3],[0.299,0.587,0.144]) def hog_feature(im): #extract hog feature if im.ndim == 3: image = rgb2gray(im) else: image = np.at_least_2d(im) sx, sy = image.shape # image size orientations = 9 # number of gradient bins cx, cy = (8, 8) # pixels per cell gx = np.zeros(image.shape) gy = np.zeros(image.shape) gx[:, :-1] = np.diff(image, n=1, axis=1) # compute gradient on x-direction gy[:-1, :] = np.diff(image, n=1, axis=0) # compute gradient on y-direction grad_mag = np.sqrt(gx ** 2 + gy ** 2) # gradient magnitude grad_ori = np.arctan2(gy, (gx + 1e-15)) * (180 / np.pi) + 90 # gradient orientation n_cellsx = int(np.floor(sx / cx)) # number of cells in x n_cellsy = int(np.floor(sy / cy)) # number of cells in y # compute orientations integral images orientation_histogram = np.zeros((n_cellsx, n_cellsy, orientations)) for i in range(orientations): # create new integral image for this orientation # isolate orientations in this range temp_ori = np.where(grad_ori < 180 / orientations * (i + 1), grad_ori, 0) temp_ori = np.where(grad_ori >= 180 / orientations * i, temp_ori, 0) # select magnitudes for those orientations cond2 = temp_ori > 0 temp_mag = np.where(cond2, grad_mag, 0) orientation_histogram[:, :, i] = uniform_filter(temp_mag, size=(cx, cy))[cx / 2::cx, cy / 2::cy].T return orientation_histogram.ravel() def color_histogram_hsv(im, nbin = 10, xmin = 0, xmax = 255, normalized = True): ndim = im.ndim bins = np.linspace(xmin, xmax, nbin + 1) hsv = matplotlib.colors.rgb_to_hsv(im / xmax) * xmax imhist, bin_edges = np.histogram(hsv[:, :, 0], bins=bins, density=normalized) imhist = imhist * np.diff(bin_edges) # return histogram return imhist
[ "1525927685.com" ]
1525927685.com
f338224e98044fd787e9b9ba9f75cc88a538b2a7
ce2e72a45446699917a306654a7f826c054858a2
/product/wsgi.py
f2f3ceda560156bf841308b2bcf65bc1cc9f47f4
[]
no_license
camiry/Placetoplay-Student_Project
de574460cac6fd807175cd7f7ab21bf1798eb78f
d4baeb0e35b102f8b2d49fb3fdb7fca2f215aeb8
refs/heads/master
2020-06-04T17:07:20.763927
2014-01-10T22:02:45
2014-01-10T22:02:45
null
0
0
null
null
null
null
UTF-8
Python
false
false
389
py
""" WSGI config for product project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "product.settings") from django.core.wsgi import get_wsgi_application application = get_wsgi_application()
[ "camiry@gmail.com" ]
camiry@gmail.com
1a5f00bb85d54e7ab67df6c7d63c7592678538cc
a35b24c8c3c5bdf861f3cda9396f2fa6795ec929
/abc/089/A.py
c27ff2005302ee85fa121359bd47bb1ff3c4fde2
[]
no_license
Msksgm/atcoder_msksgm_practice
92a19e2d6c034d95e1cfaf963aff5739edb4ab6e
3ae2dcb7d235a480cdfdfcd6a079e183936979b4
refs/heads/master
2021-08-18T16:08:08.551718
2020-09-24T07:01:11
2020-09-24T07:01:11
224,743,360
0
0
null
null
null
null
UTF-8
Python
false
false
105
py
def main(): n = int(input()) ans = n // 3 print(ans) if __name__ == "__main__": main()
[ "4419517@ed.tus.ac.jp" ]
4419517@ed.tus.ac.jp
df3d637d65bb4848b78f737e4333bed429154921
f07e583dd0b146af05a690e95c4f56231ccee9fc
/lab1_template/onlinecourse/views.py
2db3f6f83325b5e83e2c3066127b9c9484e77698
[]
no_license
andymaintain/complete-django-app-practise-on-ibmcloud
d5e58fdaf6a0df4386991a34f12f89b6eb9c9717
490908cfa7d5ee83d177d42c401ff37b511e05ed
refs/heads/main
2023-08-19T02:20:36.861072
2021-10-01T20:26:08
2021-10-01T20:26:08
412,608,348
0
0
null
null
null
null
UTF-8
Python
false
false
3,422
py
from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404, render, redirect from .models import Course, Lesson, Enrollment from django.urls import reverse from django.views import generic, View from django.http import Http404 # Create your class based views here. # Function based views # Function-based course list view # def popular_course_list(request): # context = {} # if request.method == 'GET': # course_list = Course.objects.order_by('-total_enrollment')[:10] # context['course_list'] = course_list # return render(request, 'onlinecourse/course_list_no_css.html', context) # Function-based course_details view # def course_details(request, course_id): # context = {} # if request.method == 'GET': # try: # course = Course.objects.get(pk=course_id) # context['course'] = course # return render(request, 'onlinecourse/course_detail.html', context) # except Course.DoesNotExist: # raise Http404("No course matches the given id.") # Function-based enroll view # def enroll(request, course_id): # if request.method == 'POST': # course = get_object_or_404(Course, pk=course_id) # # Create an enrollment # course.total_enrollment += 1 # course.save() # return HttpResponseRedirect(reverse(viewname='onlinecourse:course_details', args=(course.id,))) # Note that we are subclassing CourseListView from base View class #class CourseListView(View): # # # Handles get request # def get(self, request): # context = {} # course_list = Course.objects.order_by('-total_enrollment')[:10] # context['course_list'] = course_list # return render(request, 'onlinecourse/course_list.html', context) class EnrollView(View): # Handles post request def post(self, request, *args, **kwargs): course_id = kwargs.get('pk') course = get_object_or_404(Course, pk=course_id) # Increase total enrollment by 1 course.total_enrollment += 1 course.save() return HttpResponseRedirect(reverse(viewname='onlinecourse:course_details', args=(course.id,))) #class CourseDetailsView(View): # # # Handles get request # def get(self, request, *args, **kwargs): # context = {} # # We get URL parameter pk from keyword argument list as course_id # course_id = kwargs.get('pk') # try: # course = Course.objects.get(pk=course_id) # context['course'] = course # return render(request, 'onlinecourse/course_detail.html', context) # except Course.DoesNotExist: # raise Http404("No course matches the given id.") # Note that CourseListView is subclassing from generic.ListView instead of View # so that it can use attributes and override methods from ListView such as get_queryset() class CourseListView(generic.ListView): template_name = 'onlinecourse/course_list.html' context_object_name = 'course_list' # Override get_queryset() to provide list of objects def get_queryset(self): courses = Course.objects.order_by('-total_enrollment')[:10] return courses # Note that CourseDetailsView is now subclassing DetailView class CourseDetailsView(generic.DetailView): model = Course template_name = 'onlinecourse/course_detail.html'
[ "andymaintain1@gmail.com" ]
andymaintain1@gmail.com
3da14aecafcfc02e03e388bca809f4404cf34489
f090c3e0faa70cf0ef7c4be99cb894630bce2842
/scripts/dataAnalysis/collectionEfficiency/2012April27/dataProcessor.py
4f1d8b7a99d28231422bab5a365e427e4a5c3195
[]
no_license
HaeffnerLab/resonator
157d1dc455209da9b7de077157bda53b4883c8b7
7c2e377fdc45f6c1ad205f8bbc2e6607eb3fdc71
refs/heads/master
2021-01-09T20:48:03.587634
2016-09-22T18:40:17
2016-09-22T18:40:17
6,715,345
2
1
null
null
null
null
UTF-8
Python
false
false
4,749
py
import numpy as np import labrad import matplotlib from matplotlib import pyplot class dataProcessor(): binTime = 40.0*10**-9 #fpga resolution dopplerBinTime = 1.0*10**-3 def __init__(self, params): self.repumpD = float(params['repumpD']) self.repumpDelay = float(params['repumpDelay']) self.exciteP = float(params['exciteP']) self.finalDelay = float(params['finalDelay']) self.dopplerCooling = float(params['dopplerCooling']) self.iterDelay = float(params['iterDelay']) self.iterationsCycle = int(params['iterationsCycle']) self.cycleTime = self.repumpD + self.repumpDelay + self.exciteP + self.finalDelay binNumber = int(self.cycleTime / self.binTime) self.bins = self.binTime * np.arange(binNumber + 1) self.binned = np.zeros(binNumber) dopplerBinNumber = int(self.dopplerCooling / self.dopplerBinTime) self.dopplerBins = self.dopplerBinTime * np.arange(dopplerBinNumber + 1) self.dopplerBinned = np.zeros(dopplerBinNumber) def addTimetags(self, timetags): sliced = self.sliceArr(timetags, start = self.dopplerCooling + self.iterDelay, duration = self.cycleTime, cyclenumber = self.iterationsCycle, cycleduration = self.cycleTime) self.binned += np.histogram(sliced, self.bins)[0] / float(self.iterationsCycle) doppler = self.sliceArr(timetags, start = 0, duration = self.dopplerCooling + self.iterDelay) self.dopplerBinned += np.histogram(doppler, self.dopplerBins)[0] def normalize(self, repeatitions): self.binned = self.binned / self.binTime self.binned = self.binned / float(repeatitions) self.dopplerBinned = self.dopplerBinned / float(repeatitions) self.dopplerBinned = self.dopplerBinned / self.dopplerBinTime def save(self, dataset): np.savez('{}binning'.format(dataset), binned = self.binned, bins = self.bins, dopplerBins = self.dopplerBins, dopplerBinned = self.dopplerBinned) def load(self, dataset): pass # fileName = '2012Apr24_1625_39binning.npz' # f = np.load(fileName) # binned = f['binned'] # bins = f['bins'] # dopplerBins = f['dopplerBins'] # dopplerBinned = f['dopplerBinned'] # makePlot(dopplerBins, dopplerBinned, bins, binned) def makePlot(self): pyplot.figure() ax = pyplot.subplot(121) pyplot.plot(self.dopplerBins[0:-1],self.dopplerBinned) pyplot.title('Doppler Cooling') pyplot.xlabel('Sec') pyplot.ylabel('Counts/Sec') pyplot.subplot(122, sharey = ax) pyplot.title('Experimental Cycle') pyplot.plot(self.bins[0:-1],self.binned) ax = pyplot.gca() ax.ticklabel_format(style = 'sci', scilimits = (0,0), axis = 'x') pyplot.xlabel('Sec') pyplot.ylabel('Counts/Sec') pyplot.show() def sliceArr(self, arr, start, duration, cyclenumber = 1, cycleduration = 0 ): '''Takes a np array arr, and returns a new array that consists of all elements between start and start + duration modulo the start time If cyclenumber and cycleduration are provided, the array will consist of additional slices taken between start and start + duration each offset by a cycleduration. The additional elements will added modulo the start time of their respective cycle''' starts = [start + i*cycleduration for i in range(cyclenumber)] criterion = reduce(np.logical_or, [(start <= arr) & (arr <= start + duration) for start in starts]) result = arr[criterion] if cycleduration == 0: if start != 0: result = np.mod(result, start) else: result = np.mod(result - start, cycleduration) return result if __name__ == '__main__': dataset = '2012Apr27_1650_23' #dataset = '2012Apr27_1742_15' #dataset = '2012Apr27_1817_45' #dataset = '2012Apr27_1849_26' #dataset = '2012Apr27_1918_55' #dataset = '2012Apr27_1949_31' experiment = 'collectionEfficiency' #objects we need cxn = labrad.connect() dv = cxn.data_vault #naviagate to the dataset dv.cd(['', 'Experiments', experiment, dataset, 'timetags']) repeations = len(dv.dir()[1]) print 'processing {} repeatitions'.format(repeations) dv.open(1) params = dict(dv.get_parameters()) dp = dataProcessor(params) import time for i in range(1, repeations + 1): print 'opening', i time.sleep(.1) dv.open(i) timetags = dv.get().asarray timetags = timetags.transpose()[0] dp.addTimetags(timetags) dp.normalize(repeations) dp.save(dataset) dp.makePlot()
[ "soenkeamoeller@gmail.com" ]
soenkeamoeller@gmail.com
96ce2d6fd40161c9b3df1ff3f281341de4ba2225
0d994b81145d6ca42b7b1fba11f15e28cc44c0eb
/pir_wifi.py
2302b842897daee3830dce83563ebfe8dcc85390
[]
no_license
abhimanyus1997/pirbot
a7028cee11cfb31085a0c30131c757e0320609cc
8a5dd034da646849eaf4df83636538f916f0cbbc
refs/heads/master
2020-04-26T20:16:30.923512
2019-04-23T02:19:26
2019-04-23T02:19:26
173,804,134
1
0
null
null
null
null
UTF-8
Python
false
false
1,801
py
def connect(ssid=None,ssid_password=None): import network if ssid is None: ssid = "whotspot" print('Error!!: Invalid Credentials Provided') print('Using Default SSID') if ssid_password is None: ssid_password = "manumanu" print('Using Default WIFI Authentication Password...') wlan = network.WLAN(network.STA_IF) wlan.active(True) if not wlan.isconnected(): print('Connecting to network...') wlan.connect(ssid,ssid_password) while not wlan.isconnected(): pass print("\n****Connection Successful****") print('Network config:', wlan.ifconfig()) def disconnect(): import network print('Disconnecting...') wlan = network.WLAN(network.STA_IF) if not wlan.isconnected(): print('Warning: Already Disconnected!') else: wlan.disconnect() print('\n****Disconnected Successfully****') #def update(pkg=None): # import network, upip # if not network.WLAN(network.STA_IF).isconnected(): # print('Error!!: Connect to Internet') # else: # if pkg is None: # pkg=["micropython-uasyncio","micropython-pkg_resources","picoweb","utemplate","micropython-ulogging"] # print("Warning!:No Library name provided.") # i=0 # while i<len(pkg): # print("\n"+"Updating Default Library: "+pkg[i]) # upip.install(pkg[i]) # i+=1 # print("\n****Library update successful****") # else: # print("Updating Library: "+pkg) # upip.install(pkg)
[ "abhimanyus1997@gmail.com" ]
abhimanyus1997@gmail.com
70dce8734e8aceda917032bf8c58b58d4d23a82f
8709bd3eb425bb1bf7ac960707285c59aa179403
/src/hackathon/utils/httpclient.py
f9ba5f29a9e744360ad54132543459e620d710ab
[ "MIT" ]
permissive
hyponet/open-hackathon
89969ba26d34d7a14e9bb352b0d3c610d3de45de
cb5f287d4d359e5c4390f94ace9733f7e41f04bc
refs/heads/master
2023-01-22T14:25:28.077574
2020-11-16T00:50:16
2020-11-16T00:50:16
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,290
py
import requests import logging from urllib.parse import urljoin from requests.adapters import HTTPAdapter DEFAULT_HEADERS = { 'User-Agent': "OpenHackathon/HttpClient", 'Accept-Encoding': ', '.join(('gzip', 'deflate')), 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Type': 'application/json', } LOG = logging.getLogger(__name__) class ClientError(ConnectionError): pass class BaseClient(requests.Session): def __init__(self, base_url, headers: dict = None): super(BaseClient, self).__init__() self.base_url = base_url self.verify = False if not headers: headers = {} self.headers.update(DEFAULT_HEADERS) self.headers.update(headers) self.mount("http://", HTTPAdapter(max_retries=3)) self.mount("https://", HTTPAdapter(max_retries=3)) def url(self, path): return urljoin(self.base_url, path) @classmethod def result_or_raise(cls, response, json=True): status_code = response.status_code if status_code // 100 != 2: msg = "[Status Code {}]: {}".format(status_code, response.text) LOG.warning(msg) raise ClientError(msg) if json: return response.json() return response.text
[ "i@ihypo.net" ]
i@ihypo.net