'name1', 'name2', 'F', 'function', 'BibTeX', 'xi', 'zeta', 'betaT', 'betaV', 'gammaT', 'gammaV' ]: try: d.add( key, CoolProp.CoolProp.get_mixture_binary_pair_data( CAS1, CAS2, key)) except BaseException as BE: d.add(key, '') import pandas df = pandas.DataFrame(d.data) df = df.sort_values(by=['BibTeX', 'name1'], ascending=[0, 1]) bibtexer = getBibtexParser() #filename = '../../../CoolPropBibTeXLibrary.bib') with open(csvfile, 'w') as fp: header = 'Ref.,Name1,Name2,function,F,' header += merge_args("xi", "zeta,") header += merge_args("betaT", "betaV,") header += merge_args("gammaT", "gammaV") header += '\n' fp.write(header) for index, row in df.iterrows(): text = ','.join([ \ getCitationOrAlternative(bibtexer,row['BibTeX']), row['name1'], row['name2'], row['function'],
pairs = CoolProp.get('mixture_binary_pairs_list') for pair in pairs.split(','): CAS1, CAS2 = pair.split('&') d.add('CAS1', CAS1) d.add('CAS2', CAS2) for key in ['name1','name2','F','function','BibTeX','xi','zeta','betaT','betaV','gammaT','gammaV']: try: d.add(key, CoolProp.CoolProp.get_mixture_binary_pair_data(CAS1, CAS2, key)) except BaseException as BE: d.add(key, '') import pandas df = pandas.DataFrame(d.data) df = df.sort(['BibTeX','name1'], ascending = [0, 1]) bibtexer = getBibtexParser()#filename = '../../../CoolPropBibTeXLibrary.bib') with open(csvfile,'w') as fp: header = 'Ref.,Name1,Name2,function,F,' header += merge_args("xi","zeta,") header += merge_args("betaT","betaV,") header += merge_args("gammaT","gammaV") header += '\n' fp.write(header) for index, row in df.iterrows(): text = ','.join([ \ getCitationOrAlternative(bibtexer,row['BibTeX']), row['name1'], row['name2'], row['function'],
self.data = {} def add(self, key, value): if key not in self.data: self.data[key] = [] self.data[key].append(value) d = Dossier() from pybtex.database.input import bibtex parser = bibtex.Parser() bibdata = parser.parse_file(os.path.join(root_dir, "CoolPropBibTeXLibrary.bib")) bibtexer = getBibtexParser() bibtex_map = { 'EOS': 'EOS', 'CP0': ':math:`c_{p0}`', 'CONDUCTIVITY': ':math:`\lambda`', 'VISCOSITY': ':math:`\eta`', 'MELTING_LINE': 'melt', 'SURFACE_TENSION': ':math:`\sigma`' } bibtex_keys = [ 'EOS', 'CP0', 'CONDUCTIVITY', 'VISCOSITY', 'MELTING_LINE', 'SURFACE_TENSION' ] fluids_path = os.path.join(web_dir, 'fluid_properties', 'fluids')
class Dossier: def __init__(self): self.data = {} def add(self, key, value): if key not in self.data: self.data[key] = [] self.data[key].append(value) d = Dossier() from pybtex.database.input import bibtex parser = bibtex.Parser() bibdata = parser.parse_file(os.path.join(root_dir,"CoolPropBibTeXLibrary.bib")) bibtexer = getBibtexParser() bibtex_map = {'EOS': 'EOS', 'CP0': ':math:`c_{p0}`', 'CONDUCTIVITY': ':math:`\lambda`', 'VISCOSITY': ':math:`\eta`', 'MELTING_LINE': 'melt'} bibtex_keys = ['EOS','CP0','CONDUCTIVITY','VISCOSITY','MELTING_LINE'] fluids_path = os.path.join(web_dir,'fluid_properties','fluids') if not os.path.exists(fluids_path): os.makedirs(fluids_path) for fluid in CoolProp.__fluids__: FG = FluidGenerator(fluid)