The first python script that I wrote was to determine degrees of subsitution (DS) on modified cellulose from elemental analysis results. Details of the different atoms added to cellulose and the elemental analysis outputs for C, H, O, N, S.
DS values are calculated for the different elements in the sample. Naturally the calculation based on hydrogen gives significant error. Carbon is a little better and if the sample contains nitrogen the results will be most accurate.
The script also contains the whole periodic table in the python ‘dictionary’ format.
The script works by calculation of the different elemental compositions for iterative increases in DS value. The values are then compared to the actual experimental elemental analysis values to determine the DS values for the diferent elements.