Skip to main content

No project description provided

Project description

CoolerSpace

CoolerSpace is a Python library that provides type checking for programs that manipulate colors.

Installation

CoolerSpace is available on PyPI! You can install CoolerSpace with pip.

pip install coolerspace

Alternatively, if you wish to build CoolerSpace yourself, please use the following commands:

git clone https://github.com/horizon-research/CoolerSpace.git
cd CoolerSpace
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install build
python3 -m build

After running these commands, install the generated wheel file. It should be located in the dist/ folder.

Usage

Please refer here for examples of CoolerSpace programs.

Import

Please note that the code below assumes that you have imported coolerspace as cs.

import coolerspace as cs

Inputs

In order to specify a user input value, use the following syntax:

x = cs.create_input(input_variable_name,shape, type)

Here, input_variable_name is the name of the variable used when running the ONNX file. shape is the shape of the input data. For example, a full HD picture would have the shape [1080, 1920]. type is the type of the input variable. An example of a valid type is cs.XYZ. Valid types are enumerated in the spaces.py file of coolerspace. Please refer to our paper for an exhaustive list.

Initializing CoolerSpace objects

Besides using cs.create_input, coolerspace objects can be created via the following constructor

cs.sRGB([0, 0, 0])

The above line of code creates an sRGB object. cs.sRGB can be substituted for other CoolerSpace types.

Casting CoolerSpace objects

CoolerSpace objects can be cast between different types.

cs.sRGB(xyz)

The above line of code converts a value of the cs.XYZ type to a value of the cs.sRGB type.

Arithmetic operations

Arithmetic operations can be performed on CoolerSpace objects. The list of valid arithmetic operations is detailed in our paper.

xyz1: cs.XYZ = ...
xyz2: cs.XYZ = ...
xyz3 = xyz1 * 0.5 + xyz2 * 0.5

Casting

Outputs

Outputs can be created with the following syntax:

cs.create_output(cs_object)

cs_object is a CoolerSpace object you would like to output when running the ONNX program.

Compilation

Use the cs.compile command to specify what path you would like to compile the ONNX file to:

cs.compile(path)

Related Repositories

CoolerSpace's output ONNX files can be optimized using equality saturation. Our optimization tool is stored in a separate GitHub repository, found here. We also have a benchmarking suite for CoolerSpace, found here. The benchmarking suite was used to gather the data found in the paper.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coolerspace-1.0.1.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

coolerspace-1.0.1-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file coolerspace-1.0.1.tar.gz.

File metadata

  • Download URL: coolerspace-1.0.1.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for coolerspace-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7227e623fa1f0bf0ae89ae229443caac8d55fe206c0d56ab0d8ce4323e0d5c5e
MD5 77106178ce48b619f8170013e6c272b9
BLAKE2b-256 e3271f640a111e174e9313740d3ff14c038052903a9a9af4f5af3e286008204b

See more details on using hashes here.

File details

Details for the file coolerspace-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: coolerspace-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for coolerspace-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a5f4b8b9142dc8709c109a153c6a6ef2344c85268bbf55afb7fffd8c7155b3d7
MD5 853bf25095683ae492bad6878b7a3cb7
BLAKE2b-256 c7d1175424bf76f23133239afd4faba94a9a6c19c1056ed02002fe17af875b5b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page