Esempio n. 1
0
def get_test_data(num_houses):
	devices_types_unsampled={}
	ids_for_devices={}
	db_url='postgresql://*****:*****@db.wiki-energy.org:5432/postgres'
	psda.set_url(db_url)
	schema = 'shared'
	tables= psda.get_table_names(schema)
	print tables
	table=tables[3]
	ids_device_name='air1'
	ids_for_devices[ids_device_name]=psda.get_dataids_with_real_values(schema,table,ids_device_name)

	device_name='air1'
	devices_types_unsampled[device_name]=psda.generate_type_for_appliance_by_dataids(schema,table,device_name,ids_for_devices[ids_device_name][:num_houses])
	device_name='use'
	devices_types_unsampled[device_name]=psda.generate_type_for_appliance_by_dataids(schema,table,device_name,ids_for_devices[ids_device_name][:num_houses])
	

	#Resamples the data
	devices_types={}
	devices_types_unsplit={}
	sample_rate='1T'
	length='D'
	for key in devices_types_unsampled:
	    devices_types_unsplit[key]=devices_types_unsampled[key].resample(sample_rate)
	    #devices_types[key]=devices_types_unsplit[key].split_by(length)
	    devices_types[key]=devices_types_unsplit[key]
	    print "Resampled " + str(key)
	
	return devices_types
Esempio n. 2
0
def get_test_data(num_houses):
    devices_types_unsampled = {}
    ids_for_devices = {}
    db_url = 'postgresql://*****:*****@db.wiki-energy.org:5432/postgres'
    psda.set_url(db_url)
    schema = 'shared'
    tables = psda.get_table_names(schema)
    print tables
    table = tables[3]
    ids_device_name = 'air1'
    ids_for_devices[ids_device_name] = psda.get_dataids_with_real_values(
        schema, table, ids_device_name)

    device_name = 'air1'
    devices_types_unsampled[
        device_name] = psda.generate_type_for_appliance_by_dataids(
            schema, table, device_name,
            ids_for_devices[ids_device_name][:num_houses])
    device_name = 'use'
    devices_types_unsampled[
        device_name] = psda.generate_type_for_appliance_by_dataids(
            schema, table, device_name,
            ids_for_devices[ids_device_name][:num_houses])

    #Resamples the data
    devices_types = {}
    devices_types_unsplit = {}
    sample_rate = '1T'
    length = 'D'
    for key in devices_types_unsampled:
        devices_types_unsplit[key] = devices_types_unsampled[key].resample(
            sample_rate)
        #devices_types[key]=devices_types_unsplit[key].split_by(length)
        devices_types[key] = devices_types_unsplit[key]
        print "Resampled " + str(key)

    return devices_types
Esempio n. 3
0
def get_type_from_dataset(device_name,schema,table_num,limit=0):
    '''
    Given the device name
    '''

    devices_types={}
    devices_types_unsampled={}
    db_url='postgresql://*****:*****@db.wiki-energy.org:5432/postgres'
    psda.set_url(db_url)
    table='group1_disaggregated_2013_0'+str(table_num)
    ids_for_device=psda.get_dataids_with_real_values(schema,table,device_name)
    if(limit>len(ids_for_device) or limit==0):
        limit=len(ids_for_device)
    device_type_orig=psda.generate_type_for_appliance_by_dataids(schema,
            table,device_name,ids_for_device[:limit])
    return device_type_orig
Esempio n. 4
0
def get_type_from_dataset(device_name, table_num, limit=0):
    """
    Given the device name
    """

    devices_types = {}
    devices_types_unsampled = {}
    db_url = "postgresql://*****:*****@db.wiki-energy.org:5432/postgres"
    psda.set_url(db_url)
    schema = "shared"
    table = "validated_0" + str(table_num) + "_2014"
    ids_for_device = psda.get_dataids_with_real_values(schema, table, device_name)
    if limit > len(ids_for_device) or limit == 0:
        limit = len(ids_for_device)
    device_type_orig = psda.generate_type_for_appliance_by_dataids(schema, table, device_name, ids_for_device[:limit])
    return device_type_orig
Esempio n. 5
0
def get_type_from_dataset(device_name, schema, table_num, limit=0):
    '''
    Given the device name
    '''

    devices_types = {}
    devices_types_unsampled = {}
    db_url = 'postgresql://*****:*****@db.wiki-energy.org:5432/postgres'
    psda.set_url(db_url)
    table = 'group1_disaggregated_2013_0' + str(table_num)
    ids_for_device = psda.get_dataids_with_real_values(schema, table,
                                                       device_name)
    if (limit > len(ids_for_device) or limit == 0):
        limit = len(ids_for_device)
    device_type_orig = psda.generate_type_for_appliance_by_dataids(
        schema, table, device_name, ids_for_device[:limit])
    return device_type_orig