Commit 8f6d1b3c authored by Aymeric BLONDEL's avatar Aymeric BLONDEL
Browse files

Avec de pdf lourd

parent 5ad1e248
......@@ -583,7 +583,7 @@ class Application(Frame):
"If you want to change the settings, go to options "\
"several parameters are changed as "\
"the colorimetric space, concentration, illuminant, fwhm value.\n"\
"Full Documentation on").pack(padx =10, pady =10)
"Full Documentation on").pack(padx =10, pady =10)
def about(self):
'''Window message of the autor and licence type'''
......@@ -591,7 +591,7 @@ class Application(Frame):
Message(msg, width =200, aspect =100, justify =CENTER,
text ="CoPreMo\n\n(C) Aymeric Blondel,2015.\n"\
"Marches Project.\n"\
"Licence = GPL").pack(padx =10, pady =10)
if __name__ == '__main__':
......@@ -10,7 +10,6 @@ Copremo.egg-info/dependency_links.txt
......@@ -9,5 +9,4 @@ include test/verif2/result_easyrgb/*.gif
include test/verif3/*.log
include test/verif4/*.log
include ini/cam_medium.gif
include docs/*.pdf
include docs/copremo_image/*.png
#Copremo : Python package for COlor PREdiction of MOlecules
Copremo is a free software within the framework of the project Marches. It is written in python and possesses a GUI. It aims to simulate the absorption and transmittance spectra of dyes and ultimately quantify its color as perceived by any standard human eyes. This color quantification is based on the absorption spectrum obtained by experiment or by quantum computations.
The color is a perception related to three physiological parameters: the nature of the illuminated object, the light that illuminates the object and the sensor (the eye) that receives the message and communicates it to the brain by means of electrical pulses. The light is generated by an illuminant (e.g. D65 is the standard illuminant corresponding to daylight). It then interacts with the matter/object. The human eye decomposes the received light into three electrical signals to the brain which in turn only, creates the sensation of color.
When light hits an object, three scenarii are possible: it can be absorbed by the object and its energy is transformed into heat; it can go through the object; and it may be reflected by the object. Often these scenarii occur simultaneously. Any object that absorbs a portion of incident visible light (380 nm-800 nm) and reflects the rest is colored. For example, the pigment of green leaves is chlorophyll which absorbs short (blue) and long (red) wavelengths of the visible spectrum, therefore leaves reflect in the mid-wavelengths area (green). Similarly, carrots contain the β-carotene pigment that absorbs wavelengths between violet and green. They reflect what is left meaning that the wavelengths ranging from red to green, giving them their characteristic orange color.
The active site of a dye is called a chromophore, it is in this site that electronic excitation occurs: the chromophore absorbs light energy that induces a change in the electronic state going from a ground state to an excited state. To predict the color, it is sufficient to measure or calculate the absorption spectrum of the compound. This spectrum is in fact the light that will be reflected by the object or absorbed by the solution. By taking the inverse of this absorption spectrum (transmittance), it determines the range of wavelengths detected by the human eye and can determine the color of the object / the solution. Copremo aims to convert these absorption spectra into transmittance spectrum in order to deduce their color. Absorption spectrum can be obtained in three ways:
* From a measurement given by a spectrophotometer or by web data as a csv file;
* From the excitation energies obtained using the Gaussian09 software and gathering into a log file;
* From a computed absorption spectrum vibronically resolved obtained via the FCclasses software located in fort.18 file (data eV). This latter file will be converted to nm before use in Copremo (.fcuv extension).
Each color is characterized by a point in a colorimetric multi-dimensional reference space. There are several color spaces, e.g. RGB, XYZ, LAB and HTML. Copremo computes these values and provides a color image perceived by the human eye in the presence of daylight.
##Copremo description
This package is a free software under the GNU GPL License (see below) that can be employed in two different ways:
1. As software with a graphical interface (GUI) in order to predict the color of a compound from one of the three ways listed above (.csv file, .log and .fcuv).
2. As a python package to use in your own programs / scripts.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Copremo. If not, see <>.
##How to cite Copremo
If you use Copremo to get publisheable results, please cite: A.Blondel, Copremo, Université de Nantes, 2015.
L'installation préalable de Copremo nécessite
* Python 2.X ou X > 7
* Numpy
* Matplotlib
* pyhton-setuptools
* python-pip
Copremo employs two librariesunder LGPL licence: Colorpy [3] et cclib [4].
* colorpy [3] est furnished with Copremo
cclib [4] will be automatically installed with setuptools.
Copremo is working on Apple operating systems, on several Linux distribution (fedora, Ubuntu, opensuse) but on Windows 7 (not yet validated interface).
tar -xvz Copremo-1.3.tar.gz
python install
If you are notified that numpy or matplotlib cannot be loaded, it means that you simply forgot installing them.
Under a python-pip environement you can rapidly install them :
pip install numpy
pip install matplotlib
Re-do the previous installation step that should automatically install cclib [4] if not present and then install Copemo.
Launch the software
python Copremo
Copremo GUI shows up.
##How to predict color from a Gaussian computation
The procedure described below has been used previously in Ref. [1] Considering the dye/pigment of your choice, follow the five steps to vizualize the color induced by the interaction between you molecule and light:
1. Calculate the transition energies with Gaussian09.
2. Create the absorption spectrum by interpolating data from Gaussian09 the help of the class spectrum of the Copremo Package.
3. Inverse the spectrum to get the transmittance spectrum.
4. Estimate the color (XYZ, RGB or LAB values) associated to your molecule using the Color class of the Copremo package which uses the Colorpy library [3]
5. Visualize the color code of the molecule in hexadecimal within the GUI Copremo.
The Copremo software has many other options which are explained below using different validation tests.
###Objective 1:
Diluate your dye in a solution and visualize (take a picture) the color of your solution (A)
Perform a spectrophotometric measurement of your diluted compound (B) and extract the data (.csv format). Use Copremo to transform this csv file in order to generate within Corpremo approximation the hexdecimal color value. Compare this value with the color of A.
Realize an electronic transition calculation (cf follow the above protcol), generate the theoretical absorption spectrum (C). Compare the preceived color (A) with B and the predicted color (C) from a theoretical method.
###Validation 1 :
Four dyes synthesized in the laboratory CEISAM were used for the validation of Copremo.
These molecules were placed in a UV spectrometer/Visible Shimadzu UV-2501PC using dichloromethane as solvent and taking readings in the visible region of every 0.5 nm. The data were exported in ASCII format and then converted to .csv format.
.csv files and associated pictures (A) of this validation are in the directory 'test / verif1'. The color of each dye predicted using the .csv file and Copremo interface are in 'test/verif1/test_result/'. The generated png files were made with the the Color class
Objective 2 :
* Recover the experimental transmittance spectrum of Ref. [2] using WebPlotDigitizer for each molecule and create a .csv file that is readable by Copremo.
* Compare the results of colors perceived by the human eye when the molecules are in solution (see Table 1 in Ref. [2]) to the Copremo predictions.
###Validation 2 :
Compare Copremo to a similar approach (see Ref. [2]) which has been validated with four solution tests and water. This aims to validate Copremo colorimetric analysis method. We recovered the transmittance spectra of these colored solutions to estimate whether the perceived colors estimated by Copremo were comparable to the one of Ref. [3].
Useful .csv files of this validation test are in the 'test/directory verif2'
Be cautious that .csv files contain normalized transmittance spectra. For Copremo, open this .csv file (Files → Open), an absorption spectrum apparears. There is then no need to invert it into a transmittance spectrum and no need to standardize it since it already done.
Copremo allows to find the colors from the experimental transmittance spectrum.
##Initial and default values
The ini file (in ini folder) gathers the intitial parameters. The following parameters might be changed by the user:
##Input files
* .csv : La première ligne du fichier csv n'est pas prise en compte. Ensuite deux colonnes de valeurs séparées par un « ; ». La première colonne correspond à la longueur d'onde en nm. La seconde correspond à l'intensité à cette longueur d'onde.
* .log: Copremo permet d'utiliser comme entrée un fichier Gaussian09 et le traiter afin d'extraire les données permettant de réaliser les spectres nécessaires pour l'approximation de la couleur de la molécule. Ce fichier .log doit contenir les résultats d'un calcul d'energie d'excitation (CIS, TD-DFT,…).
* .uv : Fichier réalisable à l'aide d'une fonction de la classe Spectral à partir d'un fichier Gaussian09. Ensuite deux colonnes de valeurs séparées par un « ; ». La première colonne correspond à la longueur d'onde en nm. La deuxième colonne correspond à l'énergie d'éxcitation et la troisième à l'intensité à cette longueur d'onde.
* .fcuv: Copremo peut également lire les fichiers issus de FCclasses (cf ci-dessous) après conversion des nm en eV,on nommera ce fichier .fcuv.
#Copremo API
Copremo includes an API (Application Programming Interface) containing two classes Color and Spectral.
##Test of Color class
* Test 1 :use in command line to obtain the hexadecimal value corresponding tp the color of the studied dye, for instance CuSO4 (vérif2).
```python -i ../../test/verif2/CuSO4.csv -s Hexa
* Test 2 : use to create .png file with the color predictiopn from .csv file de test/verif1
``` python all
##Classe Spectral docs
Classe Color Doc
##Test of Spectral class
* Test 1 : use in command line to obtain the spectrum of Color.log file (verif4) in the .uv (Color.log.uv) format. Then just open GUI.
python -i ../../test/verif4/color.log -a
* Test 2 : use to get .uv files corresponding to .log file of test/verif4
python all
1 :Beck, M. E. (2005), Estimation of physiologically perceived color from TDDFT-derived excitation spectra. Int. J. Quantum Chem., 101: 683–689. doi: 10.1002/qua.20326
2: Beyond λ[lambda]max: Transforming Visible Spectra into 24-Bit Color Values Darren L. Williams, Thomas J. Flaherty, Casie L. Jupe, Stephanie A. Coleman, Kara A. Marquez, and Jamie J. Stanton Journal of Chemical Education 2007 84 (11), 1873
3: M. Kness, “ColorPy-A Python package for handling physical descriptions of color and light spectra,”, accessed on 08/06/2013 at
4: O'boyle, N. M., Tenderholt, A. L. and Langner, K. M. (2008), cclib: A library for package-independent computational chemistry algorithms. J. Comput. Chem., 29: 839–845. doi: 10.1002/jcc.20823
No preview for this file type
......@@ -41,7 +41,7 @@ author = "Aymeric Blondel Project Marches",
author_email = "",
py_modules = ['Copremo'],
install_requires = ['cclib>=1.2'],
install_requires = ['cclib<=1.2'],
packages = ['lib','lib.colorpy','lib.copremo'],
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment