dbc.close()
    db.commit()
    return matrix

if __name__ == '__main__':

    sample_size = 156601
    pumano = 0

    db = MySQLdb.connect(user='******', passwd='1234', db='ncpopsyn')

    hhld_dimensions = arr([5, 7, 8])
    person_dimensions = arr([2, 10, 7])

    hhld_control_variables = adjusting_sample_joint_distribution.choose_control_variables(
        db, 'hhld')
    person_control_variables = adjusting_sample_joint_distribution.choose_control_variables(
        db, 'person')

    update_string = adjusting_sample_joint_distribution.create_update_string(
        db, hhld_control_variables, hhld_dimensions)
    adjusting_sample_joint_distribution.add_unique_id(db, 'hhld',
                                                      update_string)

    update_string = adjusting_sample_joint_distribution.create_update_string(
        db, person_control_variables, person_dimensions)
    adjusting_sample_joint_distribution.add_unique_id(db, 'person',
                                                      update_string)

    ti = time.clock()
    print 'start - %s' % ti
    dbc.close()
    db.commit()
    return matrix


if __name__ == '__main__':

    sample_size = 156601
    pumano = 0

    db = MySQLdb.connect(user = '******', passwd = '1234', db = 'ncpopsyn')

    hhld_dimensions = arr([5,7,8])
    person_dimensions = arr([2, 10, 7])

    hhld_control_variables = adjusting_sample_joint_distribution.choose_control_variables(db, 'hhld')
    person_control_variables = adjusting_sample_joint_distribution.choose_control_variables(db, 'person')

    update_string = adjusting_sample_joint_distribution.create_update_string(db, hhld_control_variables, hhld_dimensions)
    adjusting_sample_joint_distribution.add_unique_id(db, 'hhld', update_string)

    update_string = adjusting_sample_joint_distribution.create_update_string(db, person_control_variables, person_dimensions)
    adjusting_sample_joint_distribution.add_unique_id(db, 'person', update_string)

    ti = time.clock()
    print 'start - %s'%ti
    populated_matrix = populate_master_matrix(db, pumano, sample_size, hhld_dimensions, person_dimensions)
    print 'End Populated matrix - %s'%(time.clock()-ti)


    ti = time.clock()