Ejemplo n.º 1
0
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 30 14:56:51 2016

@author: txia

retrieve log file from log server

"""
import os, sys
import params as ps
from datetime import datetime
import connectors

param = ps.Parameters()


class DataSourceRetriever():
    def copy_files_from_remote_to_local(self, source, destination):
        #use scp to copy the file 'source' to destination
        sshconnector = connectors.SSHConnector(param)
        sshconnector.createSCPClient()
        sshconnector.scp(source, destination)
        sshconnector.close()

    def execute(self):
        print 'execute starts.'
        start_time = datetime.time()

        print 'execute ends.'
        end_time = datetime.time()
Ejemplo n.º 2
0
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 23 07:20:09 2016

@author: txia
functions
"""
from datetime import datetime
import pandas as pd
import params
import json
##### functions for blob
p = params.Parameters()
tableIATA = pd.read_csv(filepath_or_buffer=p.path_IATAinfo,
                        header=None,
                        names=p.fields_IATAinfo)
# table of property information that found in blob 08-26 (whole day)
table_propertyInfo = pd.read_csv(
    filepath_or_buffer=p.path_propertyInfo_0826blob,
    header=None,
    names=p.fields_propertyInfo)


################         functions for decoded blob
def lineClean(line):
    #replace all "" in a line to "
    #replace all \' by ""+'    #s = s.replace("\\\'", "")
    #replace \+digits by ""+digit  -> combine these two, replace /
    while (line.find('\"\"') != -1):
        line = line.replace('\"\"', '\"')
    line = line.replace(
Ejemplo n.º 3
0
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 23 09:28:41 2016

@author: txia

main script: 
load data, format data and import data to ES
"""

import params as ps
import connectors
import data_handlers
import pandas as pd

p = ps.Parameters()
table_hotelDespInfo_20minavailRS = pd.read_csv(
    filepath_or_buffer=p.path_propertyInfo_0826_20minavailRS,
    header=None,
    names=p.fields_propertyInfo)
table_IATAinfo = pd.read_csv(filepath_or_buffer=p.path_IATAinfo,
                             header=None,
                             names=p.fields_IATAinfo)
table_singleAvailRQ = pd.read_csv(filepath_or_buffer=p.path_singleAvailRQ,
                                  header=None,
                                  names=p.fieldName_availRQ)
table_multiAvailRQ = pd.read_csv(filepath_or_buffer=p.path_multiAvailRQ,
                                 header=None,
                                 names=p.fieldName_availRQ)
table_availRQ = pd.concat([table_singleAvailRQ, table_multiAvailRQ])
#after concatenation, index should be reset, otherwise the index is not unique.
Ejemplo n.º 4
0
"""

import connectors as ct
import params as pm
import pandas as pd
import data_handlers

#pms = pm.Parameters()
#connectEx = ct.ElasticsearchConnector(pms.es_host, pms.es_port)
#data = []
#mapping={}
#for i in range(0, 100):
#    data.append("{\"message\":{\"a\":\"asd\", \"temp_id\":"+str(i)+"}}")
#connectEx.execute("indexbulkex", mapping, "dd", data)

pms = pm.Parameters()
table_reserv = pd.read_csv(filepath_or_buffer=pms.path_reserv,
                           header=None,
                           names=pms.fieldName_reserv)
table_singleAvailRS = pd.read_csv(filepath_or_buffer=pms.path_singleAvailRS,
                                  header=None,
                                  names=pms.fieldName_singleAvailRS)

#result of group by
res_series = table_reserv.groupby(['chain_code',
                                   'roomTypeCode'])['roomTypeCode'].count()
#rename it
res_series = res_series.rename('NbrReserv')
res_table = pd.DataFrame(res_series)
res_table.reset_index(inplace=True)
Ejemplo n.º 5
0
        while depth < info.depth_max:
            traced = funclib.trace_ray(rayO, rayD, info)
            if not traced:
                break
            obj, M, N, col_ray = traced
            # Reflection: create a new ray.
            rayO, rayD = M + N * .0001, funclib.normalize(rayD - 2 * np.dot(rayD, N) * N)
            depth += 1
            col += reflection * col_ray
            reflection *= obj.get('reflection', 1.)
        array[i, :] = np.clip(col, 0, 1)
    return Piece(inputdata[0], array)
    
global info
info = params.Parameters()
img = np.zeros((info.height, info.width, 3))

#start = timer()
# Loop through all pixels.
inputdata = []
mapping = {};
for j, y in enumerate(np.linspace(info.Screen[1], info.Screen[3], info.height)):
    d = (j, y)
    inputdata.append(d)

p = multiprocessing.Pool(multiprocessing.cpu_count())
pieces = p.map(computepiece, inputdata)
#print(timer()-start)

for piece in pieces:
Ejemplo n.º 6
0
 def setUp(self):
     self.params = params.Parameters()
     self.params.fluor_frame_params.phase_file = 'Images/1hOxa_1_w1Phase.TIF'
     self.params.fluor_frame_params.fluor_file = 'Images/1hOxa_1_w1Phase.TIF'
     self.ehooke = ehooke.EHooke(self.params)
Ejemplo n.º 7
0
}
Energy = {
    '0': '12.95',
    '30': '16.027',
    '45': '21.71',
    '60': '36.55',
    '70': '70.0',
    '25.90': '25.90',
    '51.80': '51.80',
    '103.60': '103.60'
}
te = 15 // 0.025  #default equilibration time
t_eq = int(fp * 0.025) + 1

###### Chosen Input Parameters
params.Parameters(temperature, energy)
name = 'a' + Angle[angle] + 't' + Temperature[temperature] + 'e' + Energy[
    energy]  # shorthand notation "a<rad>t<K>e<[float]meV>"
nameS = 'a' + angle + 't' + Temperature[temperature] + 'e' + Energy[
    energy].split('.')[0]  # shorthand "a<deg>t<K>e<[int]meV>"
nameAng = angle + u"\u00b0, " + temperature + ' K, ' + Energy[
    energy] + ' meV'  # notation for titles "[deg], [temp] K, [energy] meV"
''' # Ar-Pt analysis
g.jobs = (7331694, 7331705, 7331706, 7331713, 7331723, 7344079, 7344080, 7344081)
name = 'Pta'+Angle[angle]+'t'+Temperature[temperature]+'e'+Energy[energy]
'''
surface = '111'
in_folder = g.HOME + '/lammps/' + surface + '/' + name + '/'
from pathlib import Path

home = str(Path.home())