Ejemplo n.º 1
0
def configure():
    print('\n /--------------------\\ ')
    print(' |  Welcome to AIKIF  | ')
    print(' \--------------------/ \n')
    print('This script asks for a folder to save to, and builds the database scripts.')
    print('You can do this manually by setting creating the file ' + settings_file )
    print('in your current folder (' + cur_fldr + ')')
    print('')
    fldr = get_local_config()
    if fldr == '':
        fldr = ask_for_folder()
    print('Folder = ' + fldr)
    import create_database
    create_database.main()
Ejemplo n.º 2
0
def configure():
    print('\n /--------------------\\ ')
    print(' |  Welcome to AIKIF  | ')
    print(' \--------------------/ \n')
    print('This script asks for a folder to save to, and builds the database scripts.')
    print('You can do this manually by setting creating the file ' + settings_file )
    print('in your current folder (' + cur_fldr + ')')
    print('')
    fldr = get_local_config()
    if fldr == '':
        fldr = ask_for_folder()
    print('Folder = ' + fldr)
    import create_database
    create_database.main()
Ejemplo n.º 3
0
import create_sound
import create_labels
import create_frames
import create_database

# Splits the Video up into Pictures
create_frames.main()

# Takes the List of Labels and Timeintervals and converts them into a list of frame and label
create_labels.main()

# Extracts the Features of one Batch of Frames each time, creating the Feature Database
# Expected Runtime: 30h
create_database.main()

# Extracts the Sound from the Videos
# Saves the Sound to Sound-Frames
# Extracts the Sound Features
# Expected Runtime: 10h
create_sound.main()
def main():
    
    #name = input("What is the name of the masterfile? Include the file extension (for example, searchResults.csv).\n").strip()
    #try:
    #    master_list = pd.read_csv("..//data//{}".format(name))
    #except FileNotFoundError as e:
    #    print(e)
    #    print("Make sure the masterfile is located in a directory called data.")
    #    return

    options = sys.argv
    c = 5
    if "--help" in options:
        print("""
Usage: weedmaps_scrape.py [options] -name <name_of_masterfile>

Pipeline options:
--create                    Creates a new SQL database for data scraped from Weedmaps
--skip-scrape               Skips scraping data from Weedmaps
--API-limit-pause   <int>   Sets number of seconds to retry an API call to Weedmaps if Weedmaps returns an "API limit exceeded" message
            """)
        return

    if "-name" not in options:
        print("Please specify a name for the master file.")
        return
    else:
        name = options[options.index("-name") + 1]
        nocsv = name.replace(".csv", "")

    if "--API-limit-pause" in options:
        c = int(options[options.index("--API-limit-pause") + 1])
    # Stage 1
    if "--create" in options:
        print("Deleting existing Weedmaps database\n")
        datafiles = glob.glob("..\\data\\*")

        # checking if weedmaps.db already exists
        if sum([True for x in datafiles if "weedmaps.db" in x]):
            delete_database.main()
        else:
            print("No existing Weedmaps database found. Moving on.")

        print("\nStage 1: Create database")
        create_database.main()
    else:
        print("Skipping Stage 1: Create database")

    # Stage 2
    print("\nStage 2: Clean master file")
    clean_master_data.main(name)

    # Stage 3
    if "--skip-scrape" in options:
        print("\nSkipping Stage 3: Scraping Weedmaps")
    else:
        print("\nStage 3: Scraping Weedmaps")
        scrape_weedmaps.main(c)

    # Stage 4
    print("\nStage 4: Creating .csv files from SQL database")
    output_csv.main()

    # Stage 5
    print("\nStage 5: Clean Weedmaps store file")
    clean_weedmaps.main()

    # Stage 6
    print("\nStage 6: Joining master file and weedmaps scrape")
    join_master_and_weedmaps.main(nocsv)

    # Stage 7
    print("\nStage 7: Suggesting Weedmaps stores for unjoined stores in master file")
    create_matches.main(nocsv)

    print("\nFinished. You may now use the interface to manually join stores.")
Ejemplo n.º 5
0
 def run(self):
     """Run database creation script."""
     create_database.main([self.config])
     with self.output().open('w') as f:
         f.write(str(self))
     return
    '''

    LOGGER.info('Listing active customers')
    query = cm.Customer.select().where(
        cm.Customer.customer_status == 'active').count()
    LOGGER.info(f'{query} customers are active')
    return query


def print_customers():
    """
    Prints all customer info from the database.    
    """
    all_records = cm.Customer.select()
    for person in all_records:
        print(
            f"Customer id: {person.customer_id}\nFirst Name: {person.customer_name}\n"
            f"Last Name: {person.customer_last_name}\n"
            f"Home Address: {person.customer_address}\nPhone Number: {person.customer_phone}\n"
            f"Email Address: {person.customer_email}\nStatus: {person.customer_status}\n"
            f"Credit Limit: ${person.customer_limit}\n")


if __name__ == "__main__":

    cb.main()
    #    print(add_customers_csv())
    print("print all customer's info from the database")
    print(print_customers())
    print(list_active_customers())
import create_database, preprocessing, unsupervised, update_db, supervised_test, unsupervised_test

if __name__ == '__main__':
    create_database.main('500_kmann.csv')
    preprocessing.main()
    unsupervised_test.main()
    # supervised_test.main()
    update_db.main()
Ejemplo n.º 8
0
sys.path.append('/home/mathewsa/Desktop/confinement_table/codes+/')
import fast_efit06
from fast_efit06 import path_shot
sys.path.append('/home/mathewsa/Desktop/confinement_table/codes+/')
import data_acquire_MDSplus
sys.path.append('/home/mathewsa/Desktop/confinement_table/codes+/')
import insert_columns_and_populate_training
sys.path.append('/home/mathewsa/Desktop/confinement_table/codes+/')
import create_database
sys.path.append('/home/mathewsa/Desktop/confinement_table/codes+/')
import populate_new_database
import sqlite3

sqlite_old_file = '/home/mathewsa/Desktop/am_transitions.db'  #location of old database
try:
    create_database.main(
    )  #creates confinement_table in database (old = new = same database here)
except:
    print('Table already exists')
populate_new_database.main(
)  #inserts rows at every 1ms in confinement table of database
sqlite_new_file = '/home/mathewsa/Desktop/am_transitions.db'  #location of new database
table_old_name = 'transitions'  #name of old table in old db
table_new_name = 'confinement_table'  #name of new table in new db
column1 = 'shot'
column2 = 'id'
column3 = 'present_mode'
column4 = 'next_mode'
column5 = 'time'
column6 = 'time_at_transition'

# Connecting to the database file
Ejemplo n.º 9
0
 def test_03_create_database(self):
     result = c_d.main(self.hostname, self.username, self.password)
     self.assertTrue(result)