diff --git a/Web/fluid_properties/Incompressibles.rst b/Web/fluid_properties/Incompressibles.rst index 69e34cfa..e921c7b3 100644 --- a/Web/fluid_properties/Incompressibles.rst +++ b/Web/fluid_properties/Incompressibles.rst @@ -82,12 +82,10 @@ the available output keys are: ``D``, ``C``, ``U``, ``H``, ``S``, ``V``, ``L``, Pure Fluids ----------- -See :cite:`Melinder-BOOK-2010` for an introduction to non-standard analysis. - -For refrigeration applications, 8 fluids were implemented from Aake Melinder -"Properties of Secondary Working Fluids for Indirect Systems" published in 2010 -by IIR and coefficients are obtained from a fit between -80 |degC| and +100 |degC|: -DEB, HCM, HFE, PMS1, PMS2, SAB, HCB and TCO. +For refrigeration applications, 8 fluids were implemented from Aake Melinder's +book "Properties of Secondary Working Fluids for Indirect Systems" published in 2010 +by IIR :cite:`Melinder-BOOK-2010` with coefficients obtained from a fit between +-80 |degC| and +100 |degC|: DEB, HCM, HFE, PMS1, PMS2, SAB, HCB and TCO. Some additional secondary cooling fluids are based on data compiled by Morten Juel Skovrup in his `SecCool software `_ @@ -137,10 +135,11 @@ Aqueous Mixtures - Solutions and Brines :file: ../_static/fluid_properties/incompressible/table/volume-based-fluids.csv + .. _FittingReports: Fitting Reports -===================== +--------------------------------------- A file with all fitting reports for the incompressible fluids can be obtained from :download:`here `. These reports help you to diff --git a/wrappers/Python/CoolProp/BibtexParser.py b/wrappers/Python/CoolProp/BibtexParser.py new file mode 100644 index 00000000..1f2050d0 --- /dev/null +++ b/wrappers/Python/CoolProp/BibtexParser.py @@ -0,0 +1,201 @@ +#!/usr/bin/env python +# -*- coding: utf8 -*- + +from __future__ import division, absolute_import, print_function +from pybtex.database.input import bibtex + + + +class BibTeXerClass(object): + """ + A base class that defines all the variables needed + to print a very basic bibliography. + """ + + def __init__(self, fName = '../../../CoolPropBibTeXLibrary.bib'): + self.DEBUG = False + + self.sanitizeDict = {} + self.sanitizeDict['year'] = "no year" + self.sanitizeDict['title'] = "no title" + self.sanitizeDict['journal'] = "no journal" + self.sanitizeDict['volume'] = "no volume" + self.sanitizeDict['pages'] = "no pages" + self.sanitizeDict['booktitle'] = "no book title" + self.sanitizeDict['school'] = "no school" + self.sanitizeDict['note'] = "no note" + self.sanitizeDict['publisher'] = "no publisher" + self.sanitizeDict['institution'] = "no institution" + + self.loadLibrary(fName) + + + def loadLibrary(self, path): + parser = bibtex.Parser() + self.library = parser.parse_file(path) + self.entries = self.library.entries + + + def getEntry(self, key): + if self.library is None: + raise ValueError("Library has not been loaded.") + if key in self.library.entries.keys(): + return self.library.entries[key] + else: + return "Key {0} not in library.".format(key) + + ####################################### + # Some of Ian's old functions + ####################################### + def accent_substitutions(self, name): + mapping = [('{\\~n}','\xf1'), # � + ('{\\`e}','\xe8'), # � + ("{\\'e}",'\xe9'), # � + ("{\\'a}",'\xe1'), # � + ("{\\`a}",'\xe0'), # � + ("{\\'i}",'\xed'), # � + ("{\\'i}",'\xed'), # � + ('{\\\"o}','\xf6'), # � + ('{\\\"u}','\xfc'), # � + ('{\\v s}','\x161'), # � + ] + for old, new in mapping: + name = name.replace(old, new) + return name + + def count_substr(self, s, ss): + c = 0 + for e in s: + if e == ss: + c += 1 + return c + + def DE(self, s): + try: + return s.decode('ascii').encode('utf-8') + except UnicodeEncodeError: + print('Decoding error for',s) + + + def entry2rst(self, key): + + if key.startswith('__'): + return '' + + entry = self.entries[key] + + if entry is None: + return '' + + try: + authors = '; '.join([self.accent_substitutions(unicode(author).decode('ascii').encode('utf-8')) for author in entry.persons['author']]) + except UnicodeEncodeError: + print('Decoding error for',[author for author in entry.persons['author']]) + + if authors.find('{') > -1 or authors.find('}') > -1: + print(authors) + raise ValueError("authors [{authors:s}] may not have '{{' or '}}' character".format(authors = authors)) + + fields = entry.fields + + # Strip off the opening and closing brackets + fields['title'] = fields['title'].strip() + if fields['title'].startswith('{') and fields['title'].endswith('}'): + fields['title'] = fields['title'][1:len(entry.fields['title'])-1] + + f = fields + for key in f: + f[key] = self.DE(f[key]) + authors = str(authors) + + if entry.type == 'article': + if 'journal' not in fields: fields['journal'] = '' + if 'volume' not in fields: fields['volume'] = '' + if 'pages' not in fields: fields['pages'] = '' + + return authors + ', ' + f['year'] + ', ' + f['title'] + ', *' + f['journal'] + '*, ' + f['volume'] + ':' + f['pages'] + + elif entry.type == 'conference': + if 'journal' not in f: f['journal'] = '' + return authors + ', ' + f['year'] + ', ' + f['title'] + ', *' + f['booktitle'] + '*' + + elif entry.type == 'mastersthesis': + return authors + ', ' + f['year'] + ', ' + f['title'] + ', *' + f['school'] + '*' + + elif entry.type == 'unpublished': + return authors + ', ' + f['year'] + ', ' + f['title'] + ', note: ' + f['note'] + + elif entry.type == 'book': + return authors + ', ' + f['year'] + ', *' + f['title'] + '*, ' + f['publisher'] + + elif entry.type == 'techreport': + return authors + ', ' + f['year'] + ', *' + f['title'] + '*, ' + f['institution'] + + else: + print(entry) + + def entry2HTML(self, key): + + if key.startswith('__'): + return '' + + entry = self.entries[key] + + if entry is None: + return '' + + try: + authors = '; '.join([self.accent_substitutions(unicode(author).decode('ascii').encode('utf-8')) for author in entry.persons['author']]) + except UnicodeEncodeError: + print('Decoding error for',[author for author in entry.persons['author']]) + + if authors.find('{') > -1 or authors.find('}') > -1: + print(authors) + raise ValueError("authors [{authors:s}] may not have '{{' or '}}' character".format(authors = authors)) + + fields = entry.fields + + # Strip off the opening and closing brackets + fields['title'] = fields['title'].strip() + if fields['title'].startswith('{') and fields['title'].endswith('}'): + fields['title'] = fields['title'][1:len(entry.fields['title'])-1] + + f = fields + for key in f: + f[key] = self.DE(f[key]) + authors = str(authors) + + if entry.type == 'article': + if 'journal' not in fields: fields['journal'] = '' + if 'volume' not in fields: fields['volume'] = '' + if 'pages' not in fields: fields['pages'] = '' + + return authors + ', ' + f['year'] + ', ' + f['title'] + ', ' + f['journal'] + ', ' + f['volume'] + ':' + f['pages'] + + elif entry.type == 'conference': + if 'journal' not in f: f['journal'] = '' + return authors + ', ' + f['year'] + ', ' + f['title'] + ', ' + f['booktitle'] + '' + + elif entry.type == 'mastersthesis': + return authors + ', ' + f['year'] + ', ' + f['title'] + ', ' + f['school'] + '' + + elif entry.type == 'unpublished': + return authors + ', ' + f['year'] + ', ' + f['title'] + ', note: ' + f['note'] + + elif entry.type == 'book': + return authors + ', ' + f['year'] + ', ' + f['title'] + ', ' + f['publisher'] + + elif entry.type == 'techreport': + return authors + ', ' + f['year'] + ', ' + f['title'] + ', ' + f['institution'] + + else: + print(entry) + + def findentry(self, key): + for entry in self.entries: + if entry['key'] == key: + return entry + +if __name__=='__main__': + B = BibTeXerClass() + print(B.entry2rst('Mulero-JPCRD-2012')) \ No newline at end of file