Example #1
0
def execute_query(queries, times):
    "Executes the queries and times the start, end and result times"
    try:
        db = scidb.connect("localhost", 1239)
    except Exception, inst:
        # terminate
        handle_exception(inst, True, op="connecting")
Example #2
0
def connect(host=None, port=None):
    """Helper function that connects to SciDB, returning a new database object."""
    if host is None:
        host = "localhost"
    if port is None:
        port = 1239
    return database_wrapper(scidbapi.connect(hostname=host, port=port))
Example #3
0
def connect(host=None, port=None):
  """Helper function that connects to SciDB, returning a new database object."""
  if host is None:
    host = "localhost"
  if port is None:
    port = 1239
  return database_wrapper(scidbapi.connect(hostname=host, port=port))
def main():
    parser = argparse.ArgumentParser(description='Compute the allele counts for the given array.')
    parser.add_argument('array', help='The SciDB base array name')
    args = parser.parse_args()

    try: 
        db = scidb.connect("localhost", 1239)
    except Exception, inst: 
        handleException(inst, True, op="connecting")
def main():
    size=1600
    db = scidb.connect("localhost", 1239)
    pos=[(498808,499958,0),(499134,498721,1),(665014,401542,2),(499784,499372,3),(498548,499698,4),(498873,498461,5),(499198,498786,6),(706545,443074,7),(499849,499437,8),(498613,499762,9),(498938,498526,10),(540090,276619,11),(499589,499177,12),(499914,499502,13),(498678,499827,14),(499003,498591,15),(581621,318150,16),(499654,499242,17),(499979,499567,18),(498743,499892,19)]
    for x,y,z in pos:
	query="store(reshape(slice(very_small_obs,Z,%d),<oid:int64 NULL,center:bool NULL,polygon:int32 NULL,sumPixel:int64 NULL,avgDist:double NULL,point:bool NULL>[J=%d:%d,%d,0,I=%d:%d,%d,0]),very_small_obs_%d)" %(z,x,x+size-1,size,y,y+size-1,size,z)    
	print query
    	db.executeQuery(query,"afl");
    db.disconnect()     #Disconnect from the SciDB server. 

    print "Done!"
    sys.exit(0) #success
def main():
    size=10
    db = scidb.connect("localhost", 1439)
    pos=[(499967,500048,0),(499990,499961,1),(666073,402182,2),(500036,500007,3),(499949,500030,4),(499972,499942,5),(499994,499965,6),(707670,443779,7),(500040,500011,8),(499953,500034,9),(499967,500048,10),(499990,499961,11),(666073,402182,12),(500036,500007,13),(499949,500030,14),(499972,499942,15),(499994,499965,16),(707670,443779,17),(500040,500011,18),(499953,500034,19)]
    for x,y,z in pos:
	query="store(reshape(slice(tiny_obs,Z,%d),<oid:int64 NULL,center:bool NULL,polygon:int32 NULL,sumPixel:int64 NULL,avgDist:double NULL,point:bool NULL>[J=%d:%d,%d,0,I=%d:%d,%d,0]),tiny_obs_%d)" %(z,x,x+size-1,size,y,y+size-1,size,z)    
	print query
    	db.executeQuery(query,"afl");
    db.disconnect()     #Disconnect from the SciDB server. 

    print "Done!"
    sys.exit(0) #success
def main():
    parser = argparse.ArgumentParser(description='Redimension a large array by parts')
    parser.add_argument('array', help='Base array name')
    parser.add_argument('-c', '--host', help='SciDB coordinator host (Default: localhost)', default='scidb10')
    parser.add_argument('-s', '--size', help='size of chunks to redimension at a time', type=long, default=1000000000)
    parser.add_argument('-b', '--begin', help='row to begin redimension, useful to restart process', type=long, default=0)
    args = parser.parse_args()

    try:
        db = scidb.connect(args.host, 1239)
    except Exception, inst: 
        handleException(inst, True, op="connecting")
def main():
    size=1600
    db = scidb.connect("localhost", 1239)
    pos=[(498808,499958,0),(499134,498721,1),(665014,401542,2),(499784,499372,3),(498548,499698,4),(498873,498461,5),(499198,498786,6),(706545,443074,7),(499849,499437,8),(498613,499762,9),(498938,498526,10),(540090,276619,11),(499589,499177,12),(499914,499502,13),(498678,499827,14),(499003,498591,15),(581621,318150,16),(499654,499242,17),(499979,499567,18),(498743,499892,19)]
    for x,y,z in pos:
	query="store(reshape(slice(very_small_obs,Z,%d),<oid:int64 NULL,center:bool NULL,polygon:int32 NULL,sumPixel:int64 NULL,avgDist:double NULL,point:bool NULL>[J=%d:%d,%d,0,I=%d:%d,%d,0]),very_small_obs_%d)" %(z,x,x+size-1,size,y,y+size-1,size,z)    
	print query
    	result=db.executeQuery(query,"afl")
        db.completeQuery(result.queryID)
    db.disconnect()     #Disconnect from the SciDB server. 

    print "Done!"
    sys.exit(0) #success
def main():
    size=3750
    db = scidb.connect("localhost", 1239)
    pos=[(496559,501159,0),(497861,496211,1),(663581,400678,2),(500464,498815,3),(495516,500117,4),(496818,495169,5),(498120,496471,6),(705023,442119,7),(500724,499075,8),(495776,500377,9),(497078,495429,10),(538927,276023,11),(499682,498033,12),(500984,499335,13),(496036,500637,14),(497338,495689,15),(580369,317465,16),(499942,498293,17),(501244,499595,18),(496296,500897,19),(497598,495949,20),(621811,358907,21),(500202,498553,22),(495254,499855,23),(496556,501157,24),(497858,496209,25),(663252,400349,26),(500462,498813,27),(495514,500115,28),(496816,495167,29),(498118,496469,30),(704694,441790,31),(500722,499073,32),(495774,500375,33),(497076,495427,34),(538598,275694,35),(499680,498031,36),(500982,499333,37),(496034,500635,38),(497336,495687,39),(580040,317136,40),(499940,498291,41),(501242,499593,42),(496294,500895,43),(497596,495947,44),(621481,358578,45),(500200,498551,46),(495252,499853,47),(496554,501155,48),(497856,496207,49),(662923,400019,50),(500460,498811,51),(495512,500113,52),(496814,495165,53),(498116,496467,54),(704365,441461,55),(500720,499071,56),(495772,500373,57),(497074,495425,58),(538269,275365,59),(499678,498029,60),(500980,499331,61),(496032,500633,62),(497334,495685,63),(579711,316807,64),(499938,498289,65),(501240,499591,66),(496292,500893,67),(497594,495945,68),(621152,358248,69),(500198,498549,70),(495250,499851,71),(496552,501153,72),(497854,496205,73),(662594,399690,74),(500458,498809,75),(495510,500111,76),(496812,495163,77),(498114,496465,78),(704036,441132,79),(496559,501159,80),(497861,496211,81),(663581,400678,82),(500464,498815,83),(495516,500117,84),(496818,495169,85),(498120,496471,86),(705023,442119,87),(500724,499075,88),(495776,500377,89),(497078,495429,90),(538927,276023,91),(499682,498033,92),(500984,499335,93),(496036,500637,94),(497338,495689,95),(580369,317465,96),(499942,498293,97),(501244,499595,98),(496296,500897,99),(497598,495949,100),(621811,358907,101),(500202,498553,102),(495254,499855,103),(496556,501157,104),(497858,496209,105),(663252,400349,106),(500462,498813,107),(495514,500115,108),(496816,495167,109),(498118,496469,110),(704694,441790,111),(500722,499073,112),(495774,500375,113),(497076,495427,114),(538598,275694,115),(499680,498031,116),(500982,499333,117),(496034,500635,118),(497336,495687,119),(580040,317136,120),(499940,498291,121),(501242,499593,122),(496294,500895,123),(497596,495947,124),(621481,358578,125),(500200,498551,126),(495252,499853,127),(496554,501155,128),(497856,496207,129),(662923,400019,130),(500460,498811,131),(495512,500113,132),(496814,495165,133),(498116,496467,134),(704365,441461,135),(500720,499071,136),(495772,500373,137),(497074,495425,138),(538269,275365,139),(499678,498029,140),(500980,499331,141),(496032,500633,142),(497334,495685,143),(579711,316807,144),(499938,498289,145),(501240,499591,146),(496292,500893,147),(497594,495945,148),(621152,358248,149),(500198,498549,150),(495250,499851,151),(496552,501153,152),(497854,496205,153),(662594,399690,154),(500458,498809,155),(495510,500111,156),(496812,495163,157),(498114,496465,158),(704036,441132,159)]
    for x,y,z in pos:
	query="store(reshape(slice(small_obs,Z,%d),<oid:int64 NULL,center:bool NULL,polygon:int32 NULL,sumPixel:int64 NULL,avgDist:double NULL,point:bool NULL>[J=%d:%d,%d,0,I=%d:%d,%d,0]),small_obs_%d)" %(z,x,x+size-1,size,y,y+size-1,size,z)    
	print query
    	db.executeQuery(query,"afl")
	if(z==19):
		break
    db.disconnect()     #Disconnect from the SciDB server. 

    print "Done!"
    sys.exit(0) #success
def main():
    size=7500
    db = scidb.connect("localhost", 1239)
    pos=[(490205,507962,0),(495230,488864,1),(661084,399169,2),(505281,498915,3),(486183,503940,4),(491208,484842,5),(496234,489868,6),(702370,440455,7),(506284,499918,8),(487186,504943,9),(492212,485846,10),(536898,274984,11),(502262,495896,12),(507288,500922,13),(488190,505947,14),(493215,486849,15),(578184,316270,16),(503266,496900,17),(508291,501925,18),(489193,506950,19),(494219,487853,20),(619470,357556,21),(504269,497903,22),(485171,502929,23),(490197,507954,24),(495222,488856,25),(660756,398842,26),(505273,498907,27),(486175,503932,28),(491200,484834,29),(496226,489860,30),(702042,440127,31),(506276,499910,32),(487178,504936,33),(492204,485838,34),(536570,274656,35),(502254,495888,36),(507280,500914,37),(488182,505939,38),(493207,486841,39),(577856,315942,40),(503258,496892,41),(508283,501917,42),(489185,506942,43),(494211,487845,44),(619142,357228,45),(504261,497895,46),(485164,502921,47),(490189,507946,48),(495214,488848,49),(660428,398514,50),(505265,498899,51),(486167,503924,52),(491192,484826,53),(496218,489852,54),(701714,439800,55),(506268,499902,56),(487170,504928,57),(492196,485830,58),(536243,274328,59),(502246,495880,60),(507272,500906,61),(488174,505931,62),(493199,486833,63),(577528,315614,64),(503250,496884,65),(508275,501909,66),(489177,506934,67),(494203,487837,68),(618814,356900,69),(504253,497887,70),(485156,502913,71),(490181,507938,72),(495206,488840,73),(660100,398186,74),(505257,498891,75),(486159,503916,76),(491184,484818,77),(496210,489844,78),(701386,439472,79),(506260,499894,80),(487162,504920,81),(492188,485822,82),(535915,274000,83),(502238,495872,84),(507264,500898,85),(488166,505923,86),(493191,486825,87),(577201,315286,88),(503242,496876,89),(508267,501901,90),(489169,506927,91),(494195,487829,92),(618486,356572,93),(504245,497879,94),(485148,502905,95),(490173,507930,96),(495198,488832,97),(659772,397858,98),(505249,498883,99),(486151,503908,100),(491176,484810,101),(496202,489836,102),(701058,439144,103),(506252,499886,104),(487155,504912,105),(492180,485814,106),(535587,273673,107),(502230,495864,108),(507256,500890,109),(488158,505915,110),(493183,486817,111),(576873,314958,112),(503234,496868,113),(508259,501893,114),(489161,506919,115),(494187,487821,116),(618159,356244,117),(504237,497871,118),(485140,502897,119),(490165,507922,120),(495190,488824,121),(659444,397530,122),(505241,498875,123),(486143,503900,124),(491168,484802,125),(496194,489828,126),(700730,438816,127),(506244,499878,128),(487147,504904,129),(492172,485806,130),(535259,273345,131),(502222,495857,132),(507248,500882,133),(488150,505907,134),(493175,486809,135),(576545,314631,136),(503226,496860,137),(508251,501885,138),(489153,506911,139),(494179,487813,140),(617831,355916,141),(504229,497863,142),(485132,502889,143),(490157,507914,144),(495182,488816,145),(659117,397202,146),(505233,498867,147),(486135,503892,148),(491160,484795,149),(496186,489820,150),(700402,438488,151),(506236,499870,152),(487139,504896,153),(492164,485798,154),(534931,273017,155),(502214,495849,156),(507240,500874,157),(488142,505899,158),(493167,486801,159),(576217,314303,160),(503218,496852,161),(508243,501877,162),(489146,506903,163),(494171,487805,164),(617503,355589,165),(504221,497855,166),(485124,502881,167),(490149,507906,168),(495174,488808,169),(658789,396874,170),(505225,498859,171),(486127,503884,172),(491152,484787,173),(496178,489812,174),(700075,438160,175),(506228,499862,176),(487131,504888,177),(492156,485790,178),(534603,272689,179),(502206,495841,180),(507232,500866,181),(488134,505891,182),(493159,486793,183),(575889,313975,184),(503210,496844,185),(508235,501869,186),(489138,506895,187),(494163,487797,188),(617175,355261,189),(504213,497848,190),(485116,502873,191),(490141,507898,192),(495166,488800,193),(658461,396547,194),(505217,498851,195),(486119,503876,196),(491144,484779,197),(496170,489804,198),(699747,437833,199),(490205,507962,200),(495230,488864,201),(661084,399169,202),(505281,498915,203),(486183,503940,204),(491208,484842,205),(496234,489868,206),(702370,440455,207),(506284,499918,208),(487186,504943,209),(492212,485846,210),(536898,274984,211),(502262,495896,212),(507288,500922,213),(488190,505947,214),(493215,486849,215),(578184,316270,216),(503266,496900,217),(508291,501925,218),(489193,506950,219),(494219,487853,220),(619470,357556,221),(504269,497903,222),(485171,502929,223),(490197,507954,224),(495222,488856,225),(660756,398842,226),(505273,498907,227),(486175,503932,228),(491200,484834,229),(496226,489860,230),(702042,440127,231),(506276,499910,232),(487178,504936,233),(492204,485838,234),(536570,274656,235),(502254,495888,236),(507280,500914,237),(488182,505939,238),(493207,486841,239),(577856,315942,240),(503258,496892,241),(508283,501917,242),(489185,506942,243),(494211,487845,244),(619142,357228,245),(504261,497895,246),(485164,502921,247),(490189,507946,248),(495214,488848,249),(660428,398514,250),(505265,498899,251),(486167,503924,252),(491192,484826,253),(496218,489852,254),(701714,439800,255),(506268,499902,256),(487170,504928,257),(492196,485830,258),(536243,274328,259),(502246,495880,260),(507272,500906,261),(488174,505931,262),(493199,486833,263),(577528,315614,264),(503250,496884,265),(508275,501909,266),(489177,506934,267),(494203,487837,268),(618814,356900,269),(504253,497887,270),(485156,502913,271),(490181,507938,272),(495206,488840,273),(660100,398186,274),(505257,498891,275),(486159,503916,276),(491184,484818,277),(496210,489844,278),(701386,439472,279),(506260,499894,280),(487162,504920,281),(492188,485822,282),(535915,274000,283),(502238,495872,284),(507264,500898,285),(488166,505923,286),(493191,486825,287),(577201,315286,288),(503242,496876,289),(508267,501901,290),(489169,506927,291),(494195,487829,292),(618486,356572,293),(504245,497879,294),(485148,502905,295),(490173,507930,296),(495198,488832,297),(659772,397858,298),(505249,498883,299),(486151,503908,300),(491176,484810,301),(496202,489836,302),(701058,439144,303),(506252,499886,304),(487155,504912,305),(492180,485814,306),(535587,273673,307),(502230,495864,308),(507256,500890,309),(488158,505915,310),(493183,486817,311),(576873,314958,312),(503234,496868,313),(508259,501893,314),(489161,506919,315),(494187,487821,316),(618159,356244,317),(504237,497871,318),(485140,502897,319),(490165,507922,320),(495190,488824,321),(659444,397530,322),(505241,498875,323),(486143,503900,324),(491168,484802,325),(496194,489828,326),(700730,438816,327),(506244,499878,328),(487147,504904,329),(492172,485806,330),(535259,273345,331),(502222,495857,332),(507248,500882,333),(488150,505907,334),(493175,486809,335),(576545,314631,336),(503226,496860,337),(508251,501885,338),(489153,506911,339),(494179,487813,340),(617831,355916,341),(504229,497863,342),(485132,502889,343),(490157,507914,344),(495182,488816,345),(659117,397202,346),(505233,498867,347),(486135,503892,348),(491160,484795,349),(496186,489820,350),(700402,438488,351),(506236,499870,352),(487139,504896,353),(492164,485798,354),(534931,273017,355),(502214,495849,356),(507240,500874,357),(488142,505899,358),(493167,486801,359),(576217,314303,360),(503218,496852,361),(508243,501877,362),(489146,506903,363),(494171,487805,364),(617503,355589,365),(504221,497855,366),(485124,502881,367),(490149,507906,368),(495174,488808,369),(658789,396874,370),(505225,498859,371),(486127,503884,372),(491152,484787,373),(496178,489812,374),(700075,438160,375),(506228,499862,376),(487131,504888,377),(492156,485790,378),(534603,272689,379),(502206,495841,380),(507232,500866,381),(488134,505891,382),(493159,486793,383),(575889,313975,384),(503210,496844,385),(508235,501869,386),(489138,506895,387),(494163,487797,388),(617175,355261,389),(504213,497848,390),(485116,502873,391),(490141,507898,392),(495166,488800,393),(658461,396547,394),(505217,498851,395),(486119,503876,396),(491144,484779,397),(496170,489804,398),(699747,437833,399)]
    for x,y,z in pos:
	query="store(reshape(slice(normal_obs,Z,%d),<oid:int64 NULL,center:bool NULL,polygon:int32 NULL,sumPixel:int64 NULL,avgDist:double NULL,point:bool NULL>[J=%d:%d,%d,0,I=%d:%d,%d,0]),normal_obs_%d)" %(z,x,x+size-1,size,y,y+size-1,size,z)    
	print query
    	db.executeQuery(query,"afl");
	if(z==19):
		break
    db.disconnect()     #Disconnect from the SciDB server. 

    print "Done!"
    sys.exit(0) #success
    def test_load(self):
        array_name = "testScidbLoaderArray"

        scidb = scidbapi.connect("localhost", 1239)
        
        utils = _utils_scidb_load.UtilsScidbLoad(scidb)
        utils.remove_array_if_present(array_name) 
        
        first_dimension = "a"
        second_dimension = "b"
        attribute = "c"
        #create the list of columns to be loaded
        scidb_load_column_list = [scidb_load_column.ScidbLoadColumn(first_dimension, "int64", False),
                                  scidb_load_column.ScidbLoadColumn(second_dimension, "int64", False),
                                  scidb_load_column.ScidbLoadColumn(attribute, "double", True)]

        loader = scidb_loader.ScidbLoader(scidb)
        
        #get the path to the csv holding the test data
        csv_file = "".join([commands.getoutput("pwd"), "/test_data.csv"])
        
        #load the data from the csv file into the database
        loader.load(scidb_load_column_list, csv_file, array_name)

        #compare what was loaded to what we expected to be loaded
        #first check format of created array
        reader = scidb_reader.ScidbReader(scidb)
        reader.read("show({})".format(array_name))
        result = reader.next()[1][0]
        reader.complete_query()
        
        self.assertTrue(result.find("[{}=".format(first_dimension)) >= 0)
        self.assertTrue(result.find(",{}=".format(second_dimension)) >= 0)
        self.assertTrue(result.find("<{}:double>".format(attribute)) >= 0)
        
        #second check values stored in array
        attribute_dimension_list = [first_dimension, second_dimension, attribute]
        #expected values from test_data.csv
        expected = {first_dimension:(1,13), second_dimension:(2,17), attribute:(3,19)}

        result = utils.get_min_and_max(attribute_dimension_list, array_name)
        
        for attr_dim in attribute_dimension_list:
            min_max_expected = expected[attr_dim]
            min_max_found = result[attr_dim]
            self.assertTupleEqual(min_max_expected, min_max_found)

        scidb.disconnect()
Example #12
0
def main():
    size = 10
    db = scidb.connect("localhost", 1239)
    pos = [(499967, 500048, 0), (499990, 499961, 1), (666073, 402182, 2),
           (500036, 500007, 3), (499949, 500030, 4), (499972, 499942, 5),
           (499994, 499965, 6), (707670, 443779, 7), (500040, 500011, 8),
           (499953, 500034, 9), (499967, 500048, 10), (499990, 499961, 11),
           (666073, 402182, 12), (500036, 500007, 13), (499949, 500030, 14),
           (499972, 499942, 15), (499994, 499965, 16), (707670, 443779, 17),
           (500040, 500011, 18), (499953, 500034, 19)]
    for x, y, z in pos:
        query = "store(reshape(slice(tiny_obs,Z,%d),<oid:int64 NULL,center:bool NULL,polygon:int32 NULL,sumPixel:int64 NULL,avgDist:double NULL,point:bool NULL>[J=%d:%d,%d,0,I=%d:%d,%d,0]),tiny_obs_%d)" % (
            z, x, x + size - 1, size, y, y + size - 1, size, z)
        print query
        result = db.executeQuery(query, "afl")
        db.completeQuery(result.queryID)
    db.disconnect()  #Disconnect from the SciDB server.

    print "Done!"
    sys.exit(0)  #success
 def test_read(self):
     #connect to SciDB database
     scidb = scidbapi.connect("localhost", 1239)
     
     #instantiate reader by passing reference to database connection
     reader = scidb_read.scidb_reader.ScidbReader(scidb)
     
     #read for a specific query - in this case all the data in a previously setup array
     reader.read("scan({})".format(TestScidbReader.array_name))
     
     #iterate over the data returned by the query, printing it out
     #(data is returned as a list)
     for data in reader:
         print data
         
     #end the query
     reader.complete_query()
     
     #close the database connection
     scidb.disconnect()
Example #14
0
if __name__ == "__main__":
    files = ['querylist.csv']  # files to execute statements from

    host = "localhost"
    port = "1239"

    if ('IQUERY_HOST' in os.environ.keys()):
        host = os.environ['IQUERY_HOST']

    if ('IQUERY_PORT' in os.environ.keys()):
        port = os.environ['IQUERY_PORT']

    if len(sys.argv) > 2:
        host = sys.argv[1]
        port = sys.argv[2]
    db = scidb.connect(host, int(port))
    for ifile in files:
        stmt = []
        qno = 0
        # print ""
        if not os.path.exists(ifile):
            print "File: ", ifile, " does not exist!"
            sys.exit(2)
        print "Reading file %s" % ifile
        fileHandle = open(ifile, 'r')
        for row in fileHandle:
            stmt.append(row)
        fileHandle.close()
        for stmt_str in stmt:
            query = partition(stmt_str, ',')
            if (len(query[2].strip()) > 3):
def connect():
	global db
	db = scidb.connect("vega.cs.washington.edu", 5555)
Example #16
0
def scidbOpenConn():
	global db
	db = scidb.connect("localhost",1239)
def main():
    size=7500
    try:
        db = scidb.connect("localhost", 1239)
    except Exception, inst:
        handleException(inst, True, op="connecting")
Example #18
0
def scidbOpenConn():
    #global db
    db = scidb.connect("localhost",1239)
    #db = scidb.connect("vise4.csail.mit.edu",1239)
    #db = scidb.connect("istc11.csail.mit.edu",1239)
    return db
 def setUp(self):
     self.__scidb = scidbapi.connect("localhost", 1239)
     self.__utils = scidb_load._utils_scidb_load.UtilsScidbLoad(self.__scidb)
Example #20
0
File: q9.py Project: Myasuka/scidb
import os
import sys
import traceback
sys.path.append(os.getcwd()) # NOCHECKIN 
sys.path.append('/opt/scidb/12.7' + '/lib')
import scidbapi as scidb


# Start the single instance server. 
slabs=[(503000,503000),(504000,491000),(500000,504000),(504000,501000),(504000,493000)]
pos=[(490205,507962,0),(495230,488864,1),(661084,399169,2),(505281,498915,3),(486183,503940,4),(491208,484842,5),(496234,489868,6),(702370,440455,7),(506284,499918,8),(487186,504943,9),(492212,485846,10),(536898,274984,11),(502262,495896,12),(507288,500922,13),(488190,505947,14),(493215,486849,15),(578184,316270,16),(503266,496900,17),(508291,501925,18),(489193,506950,19),(494219,487853,20),(619470,357556,21),(504269,497903,22),(485171,502929,23),(490197,507954,24),(495222,488856,25),(660756,398842,26),(505273,498907,27),(486175,503932,28),(491200,484834,29),(496226,489860,30),(702042,440127,31),(506276,499910,32),(487178,504936,33),(492204,485838,34),(536570,274656,35),(502254,495888,36),(507280,500914,37),(488182,505939,38),(493207,486841,39),(577856,315942,40),(503258,496892,41),(508283,501917,42),(489185,506942,43),(494211,487845,44),(619142,357228,45),(504261,497895,46),(485164,502921,47),(490189,507946,48),(495214,488848,49),(660428,398514,50),(505265,498899,51),(486167,503924,52),(491192,484826,53),(496218,489852,54),(701714,439800,55),(506268,499902,56),(487170,504928,57),(492196,485830,58),(536243,274328,59),(502246,495880,60),(507272,500906,61),(488174,505931,62),(493199,486833,63),(577528,315614,64),(503250,496884,65),(508275,501909,66),(489177,506934,67),(494203,487837,68),(618814,356900,69),(504253,497887,70),(485156,502913,71),(490181,507938,72),(495206,488840,73),(660100,398186,74),(505257,498891,75),(486159,503916,76),(491184,484818,77),(496210,489844,78),(701386,439472,79),(506260,499894,80),(487162,504920,81),(492188,485822,82),(535915,274000,83),(502238,495872,84),(507264,500898,85),(488166,505923,86),(493191,486825,87),(577201,315286,88),(503242,496876,89),(508267,501901,90),(489169,506927,91),(494195,487829,92),(618486,356572,93),(504245,497879,94),(485148,502905,95),(490173,507930,96),(495198,488832,97),(659772,397858,98),(505249,498883,99),(486151,503908,100),(491176,484810,101),(496202,489836,102),(701058,439144,103),(506252,499886,104),(487155,504912,105),(492180,485814,106),(535587,273673,107),(502230,495864,108),(507256,500890,109),(488158,505915,110),(493183,486817,111),(576873,314958,112),(503234,496868,113),(508259,501893,114),(489161,506919,115),(494187,487821,116),(618159,356244,117),(504237,497871,118),(485140,502897,119),(490165,507922,120),(495190,488824,121),(659444,397530,122),(505241,498875,123),(486143,503900,124),(491168,484802,125),(496194,489828,126),(700730,438816,127),(506244,499878,128),(487147,504904,129),(492172,485806,130),(535259,273345,131),(502222,495857,132),(507248,500882,133),(488150,505907,134),(493175,486809,135),(576545,314631,136),(503226,496860,137),(508251,501885,138),(489153,506911,139),(494179,487813,140),(617831,355916,141),(504229,497863,142),(485132,502889,143),(490157,507914,144),(495182,488816,145),(659117,397202,146),(505233,498867,147),(486135,503892,148),(491160,484795,149),(496186,489820,150),(700402,438488,151),(506236,499870,152),(487139,504896,153),(492164,485798,154),(534931,273017,155),(502214,495849,156),(507240,500874,157),(488142,505899,158),(493167,486801,159),(576217,314303,160),(503218,496852,161),(508243,501877,162),(489146,506903,163),(494171,487805,164),(617503,355589,165),(504221,497855,166),(485124,502881,167),(490149,507906,168),(495174,488808,169),(658789,396874,170),(505225,498859,171),(486127,503884,172),(491152,484787,173),(496178,489812,174),(700075,438160,175),(506228,499862,176),(487131,504888,177),(492156,485790,178),(534603,272689,179),(502206,495841,180),(507232,500866,181),(488134,505891,182),(493159,486793,183),(575889,313975,184),(503210,496844,185),(508235,501869,186),(489138,506895,187),(494163,487797,188),(617175,355261,189),(504213,497848,190),(485116,502873,191),(490141,507898,192),(495166,488800,193),(658461,396547,194),(505217,498851,195),(486119,503876,196),(491144,484779,197),(496170,489804,198),(699747,437833,199),(490205,507962,200),(495230,488864,201),(661084,399169,202),(505281,498915,203),(486183,503940,204),(491208,484842,205),(496234,489868,206),(702370,440455,207),(506284,499918,208),(487186,504943,209),(492212,485846,210),(536898,274984,211),(502262,495896,212),(507288,500922,213),(488190,505947,214),(493215,486849,215),(578184,316270,216),(503266,496900,217),(508291,501925,218),(489193,506950,219),(494219,487853,220),(619470,357556,221),(504269,497903,222),(485171,502929,223),(490197,507954,224),(495222,488856,225),(660756,398842,226),(505273,498907,227),(486175,503932,228),(491200,484834,229),(496226,489860,230),(702042,440127,231),(506276,499910,232),(487178,504936,233),(492204,485838,234),(536570,274656,235),(502254,495888,236),(507280,500914,237),(488182,505939,238),(493207,486841,239),(577856,315942,240),(503258,496892,241),(508283,501917,242),(489185,506942,243),(494211,487845,244),(619142,357228,245),(504261,497895,246),(485164,502921,247),(490189,507946,248),(495214,488848,249),(660428,398514,250),(505265,498899,251),(486167,503924,252),(491192,484826,253),(496218,489852,254),(701714,439800,255),(506268,499902,256),(487170,504928,257),(492196,485830,258),(536243,274328,259),(502246,495880,260),(507272,500906,261),(488174,505931,262),(493199,486833,263),(577528,315614,264),(503250,496884,265),(508275,501909,266),(489177,506934,267),(494203,487837,268),(618814,356900,269),(504253,497887,270),(485156,502913,271),(490181,507938,272),(495206,488840,273),(660100,398186,274),(505257,498891,275),(486159,503916,276),(491184,484818,277),(496210,489844,278),(701386,439472,279),(506260,499894,280),(487162,504920,281),(492188,485822,282),(535915,274000,283),(502238,495872,284),(507264,500898,285),(488166,505923,286),(493191,486825,287),(577201,315286,288),(503242,496876,289),(508267,501901,290),(489169,506927,291),(494195,487829,292),(618486,356572,293),(504245,497879,294),(485148,502905,295),(490173,507930,296),(495198,488832,297),(659772,397858,298),(505249,498883,299),(486151,503908,300),(491176,484810,301),(496202,489836,302),(701058,439144,303),(506252,499886,304),(487155,504912,305),(492180,485814,306),(535587,273673,307),(502230,495864,308),(507256,500890,309),(488158,505915,310),(493183,486817,311),(576873,314958,312),(503234,496868,313),(508259,501893,314),(489161,506919,315),(494187,487821,316),(618159,356244,317),(504237,497871,318),(485140,502897,319),(490165,507922,320),(495190,488824,321),(659444,397530,322),(505241,498875,323),(486143,503900,324),(491168,484802,325),(496194,489828,326),(700730,438816,327),(506244,499878,328),(487147,504904,329),(492172,485806,330),(535259,273345,331),(502222,495857,332),(507248,500882,333),(488150,505907,334),(493175,486809,335),(576545,314631,336),(503226,496860,337),(508251,501885,338),(489153,506911,339),(494179,487813,340),(617831,355916,341),(504229,497863,342),(485132,502889,343),(490157,507914,344),(495182,488816,345),(659117,397202,346),(505233,498867,347),(486135,503892,348),(491160,484795,349),(496186,489820,350),(700402,438488,351),(506236,499870,352),(487139,504896,353),(492164,485798,354),(534931,273017,355),(502214,495849,356),(507240,500874,357),(488142,505899,358),(493167,486801,359),(576217,314303,360),(503218,496852,361),(508243,501877,362),(489146,506903,363),(494171,487805,364),(617503,355589,365),(504221,497855,366),(485124,502881,367),(490149,507906,368),(495174,488808,369),(658789,396874,370),(505225,498859,371),(486127,503884,372),(491152,484787,373),(496178,489812,374),(700075,438160,375),(506228,499862,376),(487131,504888,377),(492156,485790,378),(534603,272689,379),(502206,495841,380),(507232,500866,381),(488134,505891,382),(493159,486793,383),(575889,313975,384),(503210,496844,385),(508235,501869,386),(489138,506895,387),(494163,487797,388),(617175,355261,389),(504213,497848,390),(485116,502873,391),(490141,507898,392),(495166,488800,393),(658461,396547,394),(505217,498851,395),(486119,503876,396),(491144,484779,397),(496170,489804,398),(699747,437833,399)]
size=7500
U3=999
d6=100
try:
    db = scidb.connect("localhost", 1239)
except Exception, inst:
    handleException(inst, True, op="connecting")
def handleException(inst, exitWhenDone, op=None):
    traceback.print_exc()
    if op:
        print >> sys.stderr, "Exception while ", op
    print >> sys.stderr, "     Exception Type: %s" % type(inst)     # the exception instance
    print >> sys.stderr, "     Exception Value: %r" % inst 
    print >> sys.stderr, ""
    if(exitWhenDone):
        exit(2)

def fetch(x,y,z):
    query="between(normal,%d,%d,%d,%d,%d+%d,%d+%d)" %(z,y,x,z,y,d6,x,d6)
    result=db.executeQuery(query,"afl")
Example #21
0
File: basic.py Project: cerbo/scidb
if __name__ == "__main__":
    files = ['querylist.csv']             # files to execute statements from

    host="localhost"
    port="1239"

    if ('IQUERY_HOST' in os.environ.keys()):
      host = os.environ['IQUERY_HOST']

    if ('IQUERY_PORT' in os.environ.keys()):
      port = os.environ['IQUERY_PORT']

    if len(sys.argv) >2:
      host = sys.argv[1]
      port = sys.argv[2]
    db = scidb.connect(host, int(port))
    for ifile in files:
        stmt = []
        qno = 0
        # print ""
        if not os.path.exists(ifile):
            print "File: ",ifile," does not exist!"
            sys.exit(2)
        print "Reading file %s" % ifile
        fileHandle = open(ifile,'r')
        for row in fileHandle:
            stmt.append(row)
        fileHandle.close()
        for stmt_str in stmt:
            query = partition(stmt_str,',')
            if( len(query[2].strip()) > 3 ):
Example #22
0
 def __enter__(self):
     self.scidb = scidbapi.connect(self.host, self.port)
     return self
Example #23
0
def main():
    size = 3750
    db = scidb.connect("localhost", 1239)
    pos = [(496559, 501159, 0), (497861, 496211, 1), (663581, 400678, 2),
           (500464, 498815, 3), (495516, 500117, 4), (496818, 495169, 5),
           (498120, 496471, 6), (705023, 442119, 7), (500724, 499075, 8),
           (495776, 500377, 9), (497078, 495429, 10), (538927, 276023, 11),
           (499682, 498033, 12), (500984, 499335, 13), (496036, 500637, 14),
           (497338, 495689, 15), (580369, 317465, 16), (499942, 498293, 17),
           (501244, 499595, 18), (496296, 500897, 19), (497598, 495949, 20),
           (621811, 358907, 21), (500202, 498553, 22), (495254, 499855, 23),
           (496556, 501157, 24), (497858, 496209, 25), (663252, 400349, 26),
           (500462, 498813, 27), (495514, 500115, 28), (496816, 495167, 29),
           (498118, 496469, 30), (704694, 441790, 31), (500722, 499073, 32),
           (495774, 500375, 33), (497076, 495427, 34), (538598, 275694, 35),
           (499680, 498031, 36), (500982, 499333, 37), (496034, 500635, 38),
           (497336, 495687, 39), (580040, 317136, 40), (499940, 498291, 41),
           (501242, 499593, 42), (496294, 500895, 43), (497596, 495947, 44),
           (621481, 358578, 45), (500200, 498551, 46), (495252, 499853, 47),
           (496554, 501155, 48), (497856, 496207, 49), (662923, 400019, 50),
           (500460, 498811, 51), (495512, 500113, 52), (496814, 495165, 53),
           (498116, 496467, 54), (704365, 441461, 55), (500720, 499071, 56),
           (495772, 500373, 57), (497074, 495425, 58), (538269, 275365, 59),
           (499678, 498029, 60), (500980, 499331, 61), (496032, 500633, 62),
           (497334, 495685, 63), (579711, 316807, 64), (499938, 498289, 65),
           (501240, 499591, 66), (496292, 500893, 67), (497594, 495945, 68),
           (621152, 358248, 69), (500198, 498549, 70), (495250, 499851, 71),
           (496552, 501153, 72), (497854, 496205, 73), (662594, 399690, 74),
           (500458, 498809, 75), (495510, 500111, 76), (496812, 495163, 77),
           (498114, 496465, 78), (704036, 441132, 79), (496559, 501159, 80),
           (497861, 496211, 81), (663581, 400678, 82), (500464, 498815, 83),
           (495516, 500117, 84), (496818, 495169, 85), (498120, 496471, 86),
           (705023, 442119, 87), (500724, 499075, 88), (495776, 500377, 89),
           (497078, 495429, 90), (538927, 276023, 91), (499682, 498033, 92),
           (500984, 499335, 93), (496036, 500637, 94), (497338, 495689, 95),
           (580369, 317465, 96), (499942, 498293, 97), (501244, 499595, 98),
           (496296, 500897, 99), (497598, 495949, 100), (621811, 358907, 101),
           (500202, 498553, 102), (495254, 499855, 103), (496556, 501157, 104),
           (497858, 496209, 105), (663252, 400349, 106), (500462, 498813, 107),
           (495514, 500115, 108), (496816, 495167, 109), (498118, 496469, 110),
           (704694, 441790, 111), (500722, 499073, 112), (495774, 500375, 113),
           (497076, 495427, 114), (538598, 275694, 115), (499680, 498031, 116),
           (500982, 499333, 117), (496034, 500635, 118), (497336, 495687, 119),
           (580040, 317136, 120), (499940, 498291, 121), (501242, 499593, 122),
           (496294, 500895, 123), (497596, 495947, 124), (621481, 358578, 125),
           (500200, 498551, 126), (495252, 499853, 127), (496554, 501155, 128),
           (497856, 496207, 129), (662923, 400019, 130), (500460, 498811, 131),
           (495512, 500113, 132), (496814, 495165, 133), (498116, 496467, 134),
           (704365, 441461, 135), (500720, 499071, 136), (495772, 500373, 137),
           (497074, 495425, 138), (538269, 275365, 139), (499678, 498029, 140),
           (500980, 499331, 141), (496032, 500633, 142), (497334, 495685, 143),
           (579711, 316807, 144), (499938, 498289, 145), (501240, 499591, 146),
           (496292, 500893, 147), (497594, 495945, 148), (621152, 358248, 149),
           (500198, 498549, 150), (495250, 499851, 151), (496552, 501153, 152),
           (497854, 496205, 153), (662594, 399690, 154), (500458, 498809, 155),
           (495510, 500111, 156), (496812, 495163, 157), (498114, 496465, 158),
           (704036, 441132, 159)]
    for x, y, z in pos:
        query = "store(reshape(slice(small_obs,Z,%d),<oid:int64 NULL,center:bool NULL,polygon:int32 NULL,sumPixel:int64 NULL,avgDist:double NULL,point:bool NULL>[J=%d:%d,%d,0,I=%d:%d,%d,0]),small_obs_%d)" % (
            z, x, x + size - 1, size, y, y + size - 1, size, z)
        print query
        result = db.executeQuery(query, "afl")
        db.completeQuery(result.queryID)
        if (z == 19):
            break
    db.disconnect()  #Disconnect from the SciDB server.

    print "Done!"
    sys.exit(0)  #success
Example #24
0
       (495174, 488808, 369), (658789, 396874, 370), (505225, 498859, 371),
       (486127, 503884, 372), (491152, 484787, 373), (496178, 489812, 374),
       (700075, 438160, 375), (506228, 499862, 376), (487131, 504888, 377),
       (492156, 485790, 378), (534603, 272689, 379), (502206, 495841, 380),
       (507232, 500866, 381), (488134, 505891, 382), (493159, 486793, 383),
       (575889, 313975, 384), (503210, 496844, 385), (508235, 501869, 386),
       (489138, 506895, 387), (494163, 487797, 388), (617175, 355261, 389),
       (504213, 497848, 390), (485116, 502873, 391), (490141, 507898, 392),
       (495166, 488800, 393), (658461, 396547, 394), (505217, 498851, 395),
       (486119, 503876, 396), (491144, 484779, 397), (496170, 489804, 398),
       (699747, 437833, 399)]
size = 7500
U3 = 999
d6 = 100
try:
    db = scidb.connect("localhost", 1239)
except Exception, inst:
    handleException(inst, True, op="connecting")


def handleException(inst, exitWhenDone, op=None):
    traceback.print_exc()
    if op:
        print >> sys.stderr, "Exception while ", op
    print >> sys.stderr, "     Exception Type: %s" % type(
        inst)  # the exception instance
    print >> sys.stderr, "     Exception Value: %r" % inst
    print >> sys.stderr, ""
    if (exitWhenDone):
        exit(2)
def main():
    size = 7500
    try:
        db = scidb.connect("localhost", 1239)
    except Exception, inst:
        handleException(inst, True, op="connecting")