pyilt2report

pyilt2report is a command line tool based on (and shipped with) the pyilt2 module. It makes a search request to the Ionic Liquids Database (ILThermo v2.0) http://ilthermo.boulder.nist.gov operated by the National Institute of Standards and Technology (NIST). The result of the query will be written in separated folder, as a report.txt storing the metadata and for each hit a ref%.dat file containing the data in cvs format with header.

usage: pyilt2report [-h] [-c str] [-n 0] [-y 2018] [-a name] [-k str]
                    [-p prop] [-o dir] [--doi] [--auto] [--props] [--version]

Named Arguments

-c chemical formula, CAS registry number, or name (part or full)
-n number of mixture components. Default: 0 = any number.
-y publication year
-a author’s last name
-k keyword(s)
-p physical property by abbreviation.
-o, --out result folder for output files
--doi try to resolve DOI from citation (experimental!)
--auto dont ask if to proceed creating report
--props show properties abbreviations and exit
--version show program's version number and exit

Example

As an example lets look up for densities of pure Emim SCN:

$ pyilt2report -c '1-ethyl-3-methylimidazolium thiocyanate' -n 1 -p 'dens' --doi

After a short waiting time, it will return a summary of the result:

Make query to NIST... done! (12 hits)

   # ref                  prop     np components(s)
---- -------------------- ------ ---- ----------------------------------------
   0 Krolikowska2012      dens     65 1-ethyl-3-methylimidazolium thiocyanate
   1 Klomfar2015a         dens     37 1-ethyl-3-methylimidazolium thiocyanate
   2 Freire2011           dens     18 1-ethyl-3-methylimidazolium thiocyanate
   3 Neves2013b           dens     18 1-ethyl-3-methylimidazolium thiocyanate
   4 Seki2012             dens     15 1-ethyl-3-methylimidazolium thiocyanate
   5 Larriba2014c         dens      8 1-ethyl-3-methylimidazolium thiocyanate
   6 Rabari2014           dens      8 1-ethyl-3-methylimidazolium thiocyanate
   7 Ficke2010            dens      7 1-ethyl-3-methylimidazolium thiocyanate
   8 Vatascin2017         dens      7 1-ethyl-3-methylimidazolium thiocyanate
   9 Mohan2016            dens      6 1-ethyl-3-methylimidazolium thiocyanate
  10 Klomfar2015a         dens      1 1-ethyl-3-methylimidazolium thiocyanate
  11 McHale2008           dens      1 1-ethyl-3-methylimidazolium thiocyanate

Proceed? [Y]/n

If you know proceed, the (meta) data for all listed references will be pulled from NIST. Unfortunately the data set from NIST includes just the citation but not the DOI for a data set. With the option --doi the Crossref REST API (https://github.com/CrossRef/rest-api-doc) is used to try to resolve the DOI.

Request data sets from NIST:
 >> Krolikowska and Hofman (2012) [ZcjFu] ... done!
 >> Klomfar et al. (2015a) [EffsN] ... done!
 >> Freire et al. (2011) [VMvPG] ... done!
 >> Neves et al. (2013b) [PbNqg] ... done!
 >> Seki et al. (2012) [DlOSg] ... done!
 >> Larriba et al. (2014c) [udksE] ... done!
 >> Rabari et al. (2014) [expkj] ... done!
 >> Ficke et al. (2010) [ViXKB] ... done!
 >> Vatascin and Dohnal (2017) [LtpPM] ... done!
 >> Mohan et al. (2016) [WUjdB] ... done!
 >> Klomfar et al. (2015a) [PJyyR] ... done!
 >> McHale et al. (2008) [JUCzp] ... done!

Write report to folder: pyilt2report_2018-04-13_22:42:15
 << report.txt
 << ref0.dat [ZcjFu]
 >> resolve DOI ... 10.1016/j.tca.2011.11.009 (score: 127.798130) done!
 << ref1.dat [EffsN]
 >> resolve DOI ... 10.1021/acs.jced.5b00074 (score: 133.175660) done!
 << ref2.dat [VMvPG]
 >> resolve DOI ... 10.1021/je200790q (score: 132.093030) done!
 << ref3.dat [PbNqg]
 >> resolve DOI ... 10.1021/jp405913b (score: 134.855580) done!
 << ref4.dat [DlOSg]
 >> resolve DOI ... 10.1021/je201289w (score: 119.615390) done!
 << ref5.dat [udksE]
 >> resolve DOI ... 10.1016/j.jct.2013.11.005 (score: 120.663440) done!
 << ref6.dat [expkj]
 >> resolve DOI ... 10.1021/je400231q (score: 118.334210) done!
 << ref7.dat [ViXKB]
 >> resolve DOI ... 10.1021/je100522z (score: 109.675900) done!
 << ref8.dat [LtpPM]
 >> resolve DOI ... 10.1016/j.jct.2016.12.008 (score: 117.439735) done!
 << ref9.dat [WUjdB]
 >> resolve DOI ... 10.1021/acs.jced.5b00914 (score: 117.329400) done!
 << ref10.dat [PJyyR]
 >> resolve DOI ... 10.1021/acs.jced.5b00074 (score: 133.175660) done!
 << ref11.dat [JUCzp]
 >> resolve DOI ... 10.1021/ac800490q (score: 131.997470) done!

pyilt2report finished!

All files are now stored in a new folder, here its ./pyilt2report_2018-04-13_22:42:15. The meta data of the request is stored in report.txt:

13. Apr. 2018 (22:42:15)
------------------------

Ref. #0
==========
Property:
  Specific density
Reference:
  "Densities, isobaric expansivities and isothermal compressibilities [...].",
  Krolikowska, M.; Hofman, T. (2012) Thermochim. Acta 530, 1-6.
Component(s):
  1) 1-ethyl-3-methylimidazolium thiocyanate
Method: Vibrating tube method
Phase(s): Liquid
Data columns:
  1) Temperature/K
  2) Pressure/kPa
  3) Specific_density[Liquid]/kg/m3
  4) Delta(prev)
Data points: 65
ILT2 setid: ZcjFu
DOI: 10.1016/j.tca.2011.11.009 (score: 127.798130)
URL: http://dx.doi.org/10.1016/j.tca.2011.11.009

Ref. #1
==========
Property:
  Specific density
...

For each reference the data points are stored in a separate ref%.dat file. Here for example the first lines of ref0.dat from the example:

# Temperature/K  Pressure/kPa  Specific_density[Liquid]/kg/m3  Delta(prev)
+2.98150000e+02 +1.00000000e+02 +1.11670000e+03 +1.10000000e+00
+2.98150000e+02 +2.00000000e+02 +1.11670000e+03 +1.10000000e+00
+2.98150000e+02 +3.00000000e+02 +1.11670000e+03 +1.10000000e+00
+2.98150000e+02 +4.00000000e+02 +1.11680000e+03 +1.10000000e+00
+2.98150000e+02 +5.00000000e+02 +1.11680000e+03 +1.10000000e+00
+2.98150000e+02 +6.00000000e+02 +1.11690000e+03 +1.10000000e+00
+2.98150000e+02 +8.00000000e+02 +1.11690000e+03 +1.10000000e+00
...

pyilt2.report (module)

If you like to build your own command line tool, you may like to re-use some of the functions used in pyilt2report. To access the sub-module, pyilt2.report documented below, you need to import it separately:

import pyilt2
import pyilt2.report

Simple example for a search & report tool using the pyILT2 library.

(c) 2018 Frank Roemer; see http://wgserve.de/pyilt2 Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

class pyilt2.report.Spinner(delay=None)[source]

A class providing a spinning courser for cli tools.

start()[source]

Start the spinner.

stop()[source]

Stop the spinner.

pyilt2.report.printPropAbbrList()[source]

Print a table, showing the physical properties which can be addressed in a query, and the respective abbreviation which is used in the pyilt2.query() function, to stdout:

 Abbr.  Property
------  -----------------------------------------
 Dself  Self-diffusion coefficient
 Dterm  Thermal diffusivity
 Dtrac  Tracer diffusion coefficient
     H  Enthalpy
   Hap  Apparent enthalpy
   ...  ...
pyilt2.report.printResultTable(resObj)[source]

Print a result table (similar to the web version) to stdout, like:

   # ref                  prop     np components(s)
---- -------------------- ------ ---- ----------------------------------------
   0 Krolikowska2012      dens     65 1-ethyl-3-methylimidazolium thiocyanate
   1 Klomfar2015a         dens     37 1-ethyl-3-methylimidazolium thiocyanate
   2 Freire2011           dens     18 1-ethyl-3-methylimidazolium thiocyanate
   3 Neves2013b           dens     18 1-ethyl-3-methylimidazolium thiocyanate
pyilt2.report.metaDataStr(datObj)[source]

Returns the meta data of an pyilt2.dataset object as a string, like:

Property:
  Specific density
Reference:
  "Densities, isobaric expansivities and isothermal compressibilities [...].",
  Krolikowska, M.; Hofman, T. (2012) Thermochim. Acta 530, 1-6.
Component(s):
  1) 1-ethyl-3-methylimidazolium thiocyanate
Method: Vibrating tube method
Phase(s): Liquid
Data columns:
  1) Temperature/K
  2) Pressure/kPa
...
Parameters:datObj (pyilt2.dataset) -- dataset object
Returns:meta data
Return type:str
pyilt2.report.doicache(func)[source]

Decorator function for citation2doi() providing a cache.

pyilt2.report.citation2doi(citation)[source]

Resolves a citation string like the respective DOI ,URL and a score. Therefore we use Crossref's REST API: https://github.com/CrossRef/rest-api-doc

>>> cite='Lennard-Jones, J. E. "Cohesion" Proc. Phys. Soc., 1931, 43, 461-482'
>>> print( citation2doi(cite) )
('10.1088/0959-5309/43/5/301',
 'http://dx.doi.org/10.1088/0959-5309/43/5/301',
 69.865814)
Parameters:citation (str) -- citation in natural form
Returns:DOI, URL, score
Return type:tuple
pyilt2.report.cliQuery(comp='', numOfComp=0, year='', author='', keywords='', prop='', verbose=True)[source]

This is a wapper function for pyilt2.query() which is suitable for cli tools. It shows a spinning cursor while waiting for the answer from the web server and includes error handling.

Parameters:
  • comp (str) -- Chemical formula (case-sensitive), CAS registry number, or name (part or full)
  • numOfComp (int) -- Number of mixture components. Default '0' means any number.
  • year (str) -- Publication year
  • author (str) -- Author's last name
  • keywords (str) -- Keyword(s)
  • prop (str) -- Physical property by abbreviation. Default '' means unspecified.
  • verbose (bool) -- Show messages and spinning cursor while waiting.
Returns:

result object

Return type:

pyilt2.result

pyilt2.report.getAllData(resObj, verbose=False)[source]

Requests the data sets for all references of a pyilt2.result object and returns them as a list.

Parameters:
  • resObj (pyilt2.result) -- A result object
  • verbose -- Show messages and spinning cursor while waiting.
Returns:

List of pyilt2.dataset objects

pyilt2.report.run()[source]

CLI main entry point.