Exemple #1
0
def format_converter(data):
    # input: data = [halide, cation, solvent, solubility]
    n = len(data)
    # get solvent info
    solvent_info = parse_data.solvent_parser('data_solvent.csv')
    data_cl = [[0 for i in range(10)] for j in range(n)]
    for i in range(n):
        # halide
        if data[i][0] == 'Br':
            data_cl[i][0] = 1
        elif data[i][0] == 'Cl':
            data_cl[i][1] = 1
        elif data[i][0] == 'I':
            data_cl[i][2] = 1
        # cation
        if data[i][1] == 'MA':
            data_cl[i][3] = 1
        elif data[i][1] == 'FA':
            data_cl[i][4] = 1
        elif data[i][1] == 'Cs':
            data_cl[i][5] = 1
        # solvent
        name = data[i][2]
        info = solvent_info[name]
        data_cl[i][6],data_cl[i][7],data_cl[i][8] = \
          info[0],info[1],info[2]
        data_cl[i][9] = data[i][3]
    return data_cl
Exemple #2
0
def format_converter(data):
	# input:
	#	data = [halide, cation, solvent, solubility]
	# output:
	#	data_cl = binary representation of ha, ca, sol 
	#				with umbo, be, and order number

	n = len(data)
	# get solvent info (umbo, polarity)
	solvent_info = parse_data.solvent_parser('data_solvent.csv')
	data_cl = [[0 for i in range(10)] for j in range(n)]
	for i in range(n):
		# halide
		if data[i][0] == 'Br':
			data_cl[i][0] = 1
		elif data[i][0] == 'Cl':
			data_cl[i][1] = 1
		elif data[i][0] == 'I':
			data_cl[i][2] = 1
		# cation
		if data[i][1] == 'MA':
			data_cl[i][3] = 1
		elif data[i][1] == 'FA':
			data_cl[i][4] = 1
		elif data[i][1] == 'Cs':
			data_cl[i][5] = 1
		# solvent
		name = data[i][2]
		info = solvent_info[name]
		data_cl[i][6],data_cl[i][7],data_cl[i][8] = \
				info[0],info[1],info[2]
		data_cl[i][9] = data[i][3]
	return data_cl
Exemple #3
0
def alphaToNum(data):
    # input is in (hal, cat, solv) format
    # output is in (0,0,1,0,1,0,density,polarity,solvent number,
    #					solution number) format
    n = len(data)
    # get solvent info
    solvent_info = parse_data.solvent_parser('data_solvent.csv')
    data_num = [[0 for i in range(9)] for j in range(n)]
    for i in range(n):
        # halide
        if data[i][0] == 'Br':
            data_num[i][0] = 1
        elif data[i][0] == 'Cl':
            data_num[i][1] = 1
        elif data[i][0] == 'I':
            data_num[i][2] = 1
        # cation
        if data[i][1] == 'MA':
            data_num[i][3] = 1
        elif data[i][1] == 'FA':
            data_num[i][4] = 1
        elif data[i][1] == 'Cs':
            data_num[i][5] = 1
        # solvent
        name = data[i][2]
        info = solvent_info[name]
        data_num[i][6],data_num[i][7],data_num[i][8] = \
          info[0],info[1],info[2]
    return data_num
Exemple #4
0
def format_converter(data):
    # input: data format = [halide1, halide2, halide3, \
    #                   cation, solvent, solubility]
    # output: data format = [0,0,1,0,0,1,0,0,1,0,0,1,\
    #               mvee,polarity,solvent#,solubility]
    n = len(data)
    # get solvent info
    solvent_info = parse_data.solvent_parser('data_solvent.csv')
    data_num = [[0 for i in range(16)] for j in range(n)]
    for i in range(n):
        # halide1
        if data[i][0] == 'Br':
            data_num[i][0] = 1
        elif data[i][0] == 'Cl':
            data_num[i][1] = 1
        elif data[i][0] == 'I':
            data_num[i][2] = 1
        # halide2
        if data[i][1] == 'Br':
            data_num[i][3] = 1
        elif data[i][1] == 'Cl':
            data_num[i][4] = 1
        elif data[i][1] == 'I':
            data_num[i][5] = 1
        # halide3
        if data[i][2] == 'Br':
            data_num[i][6] = 1
        elif data[i][2] == 'Cl':
            data_num[i][7] = 1
        elif data[i][2] == 'I':
            data_num[i][8] = 1
        # cation
        if data[i][3] == 'MA':
            data_num[i][9] = 1
        elif data[i][3] == 'FA':
            data_num[i][10] = 1
        elif data[i][3] == 'Cs':
            data_num[i][11] = 1
        # solvent
        name = data[i][4]
        info = solvent_info[name]
        data_num[i][12],data_num[i][13],data_num[i][14] = \
                info[0],info[1],info[2]
        data_num[i][15] = data[i][5]
    return data_num
Exemple #5
0
    x1, x2 = pt[0], pt[1]
    dis_dict = {}
    dis_list = np.zeros(len(solvents.keys()))
    count = 0
    for key in solvents:
        s1, s2 = solvents[key][0], solvents[key][1]
        distance = (x1 - s1)**2 + (x2 - s2)**2
        dis_dict[distance] = key
        dis_list[count] = distance
        count += 1
    min_dist = min(dis_list)
    return dis_dict[min_dist]


# read in solvents and their polarity and mbo
sol = parse_data.solvent_parser('data_solvent.csv')
# number of initial samples
n_sample = 10
# sample uniformly from [0,1]^4
samples = lhsmdu.sample(4, n_sample)
# first two dimensions are {1,2,3}
samples[0] = np.floor(samples[0] * 3)
samples[1] = np.floor(samples[1] * 3)
# third dim is (0.6,1.4)
samples[2] = [0.6 for i in range(n_sample)] + \
    samples[2] * (1.4-0.6)
# fourth dim is (5, 60)
samples[3] = [5. for i in range(n_sample)] + \
    samples[3] * (60 - 5.)
# map samples to solution combo
solutions = [[0 for j in range(3)] for i in range(n_sample)]