Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ MANIFEST
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
!ColorLab.spec

# Installer logs
pip-log.txt
Expand Down Expand Up @@ -107,12 +108,16 @@ celerybeat.pid
# Environments
.env
.venv
.venv-build/
env/
venv/
ENV/
env.bak/
venv.bak/

# Local tool state
.claude/

# Spyder project settings
.spyderproject
.spyproject
Expand Down Expand Up @@ -142,4 +147,8 @@ cython_debug/

# Image related stuff
images/
*.png
*.png

# User spectra inputs
*.xls
*.xlsx
47 changes: 47 additions & 0 deletions ColorLab.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# -*- mode: python ; coding: utf-8 -*-
"""PyInstaller spec — builds ColorLab into a single-file windowed executable."""

from PyInstaller.utils.hooks import collect_data_files, collect_submodules

datas = [
('dataManager/illuminants.csv', 'dataManager'),
('dataManager/white_point.csv', 'dataManager'),
]
datas += collect_data_files('customtkinter')

hiddenimports = collect_submodules('customtkinter')

a = Analysis(
['clgui.py'],
pathex=[],
binaries=[],
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=['PyQt5', 'PyQt6', 'PySide2', 'PySide6', 'tests'],
noarchive=False,
)
pyz = PYZ(a.pure)

exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='ColorLab',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
43 changes: 15 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,22 @@ ColorLab uses internationally-defined illuminants to translate absorbance spectr

## Running ColorLab

### Downloading ColorLab
ColorLab now ships with a modern customtkinter GUI. Python 3.9+ is required.

The latest release of ColorLab can be downloaded using the above DOI link on Zenodo. The cutting edge version of ColorLab can also be downloaded on GitHub by selecting the green "Code" dropdown menu and selecting "Download ZIP".
1. Download or clone this repository.
2. Open a terminal in the ColorLab folder.
3. Install dependencies: `pip install -r requirements.txt`
4. Launch the app: `python clgui.py` (or `python3 clgui.py` on macOS/Linux).

### Running on Windows
### Using the app

We recommend using Anaconda to run ColorLab, as it contains all of the required packages ColorLab uses.
- **Input folder** — pick a folder containing UV-Vis spectra files (`.csv`, `.xls`, or tab-separated). Filenames ending in `_<seconds>.ext` enable the time-series color matrix; without timestamps, files render as uniform-width strips.
- **Illuminant** — reference light source. D65 is standard daylight and is the most common choice.
- **Data type** — Absorbance (raw A values), Transmission (%T), or AIPS (internal format).
- **Aspect ratio** — width-to-height ratio of the output image.
- **Image title** — shown on the rendered figure.
- **Preview first file** — fast check that your parameters make sense before running a full batch.
- **Process all files** — runs the whole folder; progress and per-file errors stream to the log on the right.
- **Save image as...** — writes the current preview to a PNG/JPEG of your choice.

1. Download [Anaconda here](https://docs.anaconda.com/anaconda/install/windows/) and follow installation instructions
1. Once installed, open the Anaconda Prompt.
1. Navigate to the ColorLab directory using the command "cd". Example, if starting in C:\Users\LISPEM\ and ColorLab is in Documents, navigate using "cd Documents" "cd *ColorLab folder name*"
1. Once in the main ColorLab folder, type "python clgui.py". This should open ColorLab

### Running on Linux

Python is already preinstalled on most Linux operating systems.

1. Ensure the packages that are listed in requirements.txt are installed
1. In the main ColorLab directory, open a terminal
1. Type "python3 clgui.py". This should open ColorLab

### Running on Mac

We recommend using Anaconda on Mac to run ColorLab, as it contains all of the required packages. [Instructions for installing Anaconda on Mac OS X can be found here.](https://docs.anaconda.com/anaconda/install/mac-os/)

Note: Python comes preinstalled on Mac, you can also individually install all of the packages listed in requirements.txt using your preferred package manager and run it.

1. Ensure Anaconda OR required packages are installed on your Mac
1. Navigate to the ColorLab folder and open an instance of the Terminal in that folder. Alternatively, open Terminal and navigate to the ColorLab folder using "cd"
1. If using Anaconda, type "python clgui.py" to run. If using the preinstalled Python version, type "python3 clgui.py". This should open ColorLab.

[Click here for more information about using ColorLab](https://arizona.box.com/s/jh7vkxpwik3q5xojpfgcho5ijw0rthgy)
[More information about ColorLab](https://arizona.box.com/s/jh7vkxpwik3q5xojpfgcho5ijw0rthgy)
27 changes: 12 additions & 15 deletions clgui.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 28 12:24:04 2020

@author: priscillababiak
"""

from PyQt5.QtWidgets import QApplication
import sys
from dataManager.loadfiles4CIE import RGBImage

app = QApplication(sys.argv)
RGBImageApp = RGBImage()

sys.exit(app.exec_())
"""ColorLab entry point."""

from ui.app import ColorLabApp


def main() -> None:
app = ColorLabApp()
app.mainloop()


if __name__ == "__main__":
main()
12 changes: 10 additions & 2 deletions dataManager/CIE_XYZ.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@

@author: priscillababiak
"""
import pandas as pd
import os
import pandas as pd
import numpy as np

_MODULE_DIR = os.path.dirname(os.path.abspath(__file__))
_WHITE_POINT_PATH = os.path.join(_MODULE_DIR, "white_point.csv")

def data_cleanup(loaded_data):
loaded_data['Wavelength'] = loaded_data['Wavelength'].astype(int)
loaded_data = loaded_data.drop_duplicates(subset='Wavelength').reset_index()
Expand All @@ -19,6 +23,10 @@ def CIElab(spec_illum, illum, datatype, df_list, x_bar, y_bar, z_bar, calcRGB):
subdf.rename(columns = {'Absorbance':'Transmission'}, inplace=True)
elif datatype == 1:
subdf = df_list[['Wavelength', 'Transmission']].copy()
# Auto-scale %T (0-100) to fractional (0-1). Values slightly above 100
# are tolerated (instrument noise on near-transparent references).
if subdf['Transmission'].max() > 1.5:
subdf['Transmission'] = subdf['Transmission'] / 100
elif datatype == 2:
subdf = df_list[['Wavelength', 'FT']].copy()
subdf['FT'] = (1+subdf['FT']) * 100
Expand Down Expand Up @@ -69,7 +77,7 @@ def bradford(CIE_X, CIE_Y, CIE_Z, spec_illum):
return CIE_X, CIE_Y, CIE_Z
else:
source = np.matrix([[CIE_X], [CIE_Y], [CIE_Z]])
whites = pd.read_csv("dataManager/white_point.csv")
whites = pd.read_csv(_WHITE_POINT_PATH)

# D65 will always be destination color
ma = np.matrix([[0.8951000, 0.266400, -0.1614000], [-0.7502000, 1.7135000, 0.036700], [0.0389000, -0.0685000, 1.0296000]])
Expand Down
1 change: 0 additions & 1 deletion dataManager/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from dataManager.loadfiles4CIE import RGBImage
Loading