# opviewer **Repository Path**: hitdic/opviewer ## Basic Information - **Project Name**: opviewer - **Description**: CLI visualization toolkit for HitDIC. - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2016-05-29 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README OPVIEWER: A CLI visualization toolkit for the hitdic code ========================================================== 0. Prerequisite ---------------- 0.1 Dependency ^^^^^^^^^^^^^^^^^ - Python 3+ - matplotlib - numpy - scipy The `Anaconda `_ package is recommended. 0.2 Installation ^^^^^^^^^^^^^^^^^ Just run :: python setup.py install And opviewer is now available from the command line. 1. Options ------------ The opviewer is a command line interface program. The options are listed as following :: optional arguments: -h, --help show this help message and exit -o OBJECT, --obj OBJECT object file name -c COUPLENAME, --cpn COUPLENAME Name of the couple. -s, --sim Show the simulated properties. -x, --exp Show the experimental properties. -f, --flux Show the fluxes. --t2b T2B Tranform text to binary. --b2t B2T Tranform binary to text. --com Complete the database.input. 1.1 Profiles and fluxes ^^^^^^^^^^^^^^^^^^^^^^^^ The options are designed for visualizing the output files from the hitdic code. To compare the simulation and experiment result, one should run the hitdic code with "hitdic --sim couplename" and "hitdic --exp couplename". Output files are produced in the current folder with a pattern, namely :: [couplename]_[exp|sim][conc|flux|interd]_distance.cols The option -c is used to specify the couplename, --sim and --exp are the flags to determine whether the simulation and experiment data should be shown. To show the simulated composition profiles and the experimental ones, one use the following options: :: opviewer -c couplename -s opviewer -c couplename -x opviewer -c couplename -s -x When the fluxes, instead of the composition profiles, are to be shown, one should add the -f flag to the command line, namely :: opviewer -c couplename -s -x -f where -s and -x are optionals, but at least one of them should be chosen. 1.2 Formatting files ^^^^^^^^^^^^^^^^^^^^^ Among the outputs from hitdic, the binary format is used to stored information in order to reserve the precision of the computation result. In order to retrieve the result as text, one can adopt the --b2t option. :: opviewer --b2t filename -o targetfilename 1.3 Complete database setting ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ There is a time that one has to push the optimize result back to the database input file. One can use the auto-complete option to activate a GUI interface that helps with you. :: opviewer --com 2. APIs -------- Beside the command line options, the apis are available from the current package, i.e., visualizing the profiles and fluxes. Such apis are to facilitate the batch operations on sequent otimization results. 2.1 Visualize profiles ^^^^^^^^^^^^^^^^^^^^^^^^^ Here comes an example. :: import os from opviewer import showprofiles targets = ["AB", "AC", "AD", "BC", "BD", "CD",] basedir = os.getcwd() labels = ["Mn", "Ni", "Cu", "Zn"] for i in range(len(targets)): for j in range(i+1, len(targets)): each, fach = targets[i], targets[j] folder = "-".join([each, fach]) os.chdir(os.path.join(basedir, folder)) showprofiles(os.path.join(basedir, folder), couplename="couple3", labels=labels, targets=("exp", "sim"), ext="jpg") 2.2 Locate the latest log file ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ One can do this with the latestfile. :: from opviewer import latestfile print(latestfile(folder="./", format=".log"))