Package: pvc-export
Implen spectra export(er)Intention:extract XY (absorption spectrum) data from PVC wavescan files created by"Implen NanoPhotometer Pearl P300"export the data as a "CSV" (TAB-separated) table, original and smoothedfind most prominent peaks in the spectrum and export them as a separate CSV tableplot the data and save the imagesupport loading of multiple PVC files, plotting them together in one figure and exporting them into a single tableif a custom configuration file (*.yaml) provided (by the-coption), read it,
merge it with the default configuration and use to style the plot(s)if requested (by the--ccoption), create a custom configuration file templateImplementation:Import the default configuration from cfg.py as dictcfgRead a custom config and merge it with the default one, reconstruct missing valuesXY (absorption spectrum) array in PVC file is on the line starting with '$PVC 'Find and read the line, reshape the array, apply transformations specified in the config fileCreate a dictdataholding all the read data and merged configurationUsescipy.signal.savgol_filter()to smooth the raw dataUsescipy.signal.find_peaks()to find peaks in spectraPlot loaded data onmatplotlib.Figure(), reserve a large part of the figure for the plot descriptions,so that most of the images created with this tool have the same dimensions of the plot area.CreatePillow.Image()from the figure.Remove excessive white borders from the image withPillow.Image.crop()Add borders (padding) of the size defined by config.Save (export) the figure image and CSV files with the loaded dataInstallation:Either install the package directly frompypipipx install pvc-export,Or download a.whlfile from thelatest releasepageand install the package from the filepipx install <the-downloaded-file>.whlIn command shell, the script can be started withpvc-exportorpython3 -m pvc_exportIn Windows, to add right click menu actions for PVC and YAML files,consult the includedwin-install.regfile.Note that the suggested approach does not support combining multiple files
into a single figure or CSV table via the right-click menu.Some command line examples:pvc-export *.pvc
    => from all found *.pvc files produce:
    export.png       - figure
    export.csv       - plot data
    export.peaks.csv - peaks data

pvc-export *.pvc -e <name>
    => from all found *.pvc files produce:
    <name>.png       - figure
    <name>.csv       - plot data
    <name>.peaks.csv - peaks data

pvc-export --cc "config"
    => create "config.yaml" template,
    do not export figure or data

pvc-export *.pvc --cc "config"
    => create "config.yaml" listing inside all found *.pvc files with the default styles assigned,
    do not export figure or data

pvc-export -c "config.yaml"
    => use "config.yaml" to save
    figure, plot data, and peaks data with the styles and locations defined inside "config.yaml"

pvc-export *.pvc -c "config.yaml"
    => use "config.yaml" for styles and locations to save all found .pvc files
    <name>.png       - figure,
    <name>.csv       - plot data,
    <name>.peaks.csv - peaks data,
    where <name> is set in advance in CONFIG:export:pathVariables, like"$HOME", and globs, like"*", are expanded in *.pvc file names,"~"is not.Globs are only expanded if a file path is not absolute.