Compare commits

..

16 commits

Author SHA1 Message Date
Cedar Grove Maker Studios
9a324d0916
Update pyproject.toml 2023-10-03 18:18:40 -07:00
Cedar Grove Maker Studios
a44cb1ab44
Update pyproject.toml 2023-10-03 17:07:46 -07:00
Cedar Grove Maker Studios
27721b725e
Update pyproject.toml 2023-10-03 17:04:49 -07:00
Cedar Grove Maker Studios
25c6f0e596 remove blender 2023-10-03 17:00:20 -07:00
Cedar Grove Maker Studios
ba648abd44 add two_color_blender class 2023-10-03 12:35:42 -07:00
Cedar Grove Maker Studios
30649266f6
Update docs 2023-10-03 10:18:22 -07:00
Cedar Grove Maker Studios
ae84cdd27e
Merge pull request #1 from tekktrik/dev/update-ci
Update CI files
2023-02-07 08:25:51 -08:00
Alec Delaney
bc6e1bc7b0 Disable duplicate code check 2023-02-07 09:41:04 -05:00
Cedar Grove Maker Studios
6b7980c2c3
update pylint to v2.15.5 2023-02-06 21:43:17 -08:00
Cedar Grove Maker Studios
c0acc3ee03 fix pylint error 2023-02-06 21:12:45 -08:00
Cedar Grove Maker Studios
d848b4c428 fix pylint error 2023-02-06 21:02:17 -08:00
Cedar Grove Maker Studios
6242fe3953 fix pylint error 2023-02-06 20:52:54 -08:00
Cedar Grove Maker Studios
992b028e1a fix pylint errors 2023-02-06 20:44:46 -08:00
Cedar Grove Maker Studios
c225aa5d4b fix pylint error 2023-02-06 20:29:53 -08:00
Alec Delaney
8e5b7ea03e Update CI files 2023-02-06 21:53:14 -05:00
Cedar Grove Maker Studios
2d8e4e5aad update docs 2022-11-04 10:33:11 -07:00
13 changed files with 77 additions and 217 deletions

View file

@ -10,73 +10,5 @@ jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Dump GitHub context - name: Run Build CI workflow
env: uses: adafruit/workflows-circuitpython-libs/build@main
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo ::set-output name=repo-name::$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Versions
run: |
python3 --version
- name: Checkout Current Repo
uses: actions/checkout@v3
with:
submodules: true
- name: Checkout tools repo
uses: actions/checkout@v3
with:
repository: adafruit/actions-ci-circuitpython-libs
path: actions-ci
- name: Install dependencies
# (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.)
run: |
source actions-ci/install.sh
- name: Pip install Sphinx, pre-commit
run: |
pip install --force-reinstall Sphinx sphinx-rtd-theme pre-commit
- name: Library version
run: git describe --dirty --always --tags
- name: Setup problem matchers
uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1
- name: Pre-commit hooks
run: |
pre-commit run --all-files
- name: Build assets
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --package_folder_prefix cedargrove_ --library_location .
- name: Archive bundles
uses: actions/upload-artifact@v2
with:
name: bundles
path: ${{ github.workspace }}/bundles/
- name: Check for docs folder
id: need-docs
run: |
echo ::set-output name=docs::$( find . -wholename './docs' )
- name: Build docs
if: contains(steps.need-docs.outputs.docs, 'docs')
working-directory: docs
run: sphinx-build -E -W -b html . _build/html
- name: Check For pyproject.toml
id: need-pypi
run: |
echo ::set-output name=pyproject-toml::$( find . -wholename './pyproject.toml' )
- name: Build Python package
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
run: |
pip install --upgrade build twine
for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do
sed -i -e "s/0.0.0+auto.0/1.2.3/" $file;
done;
python -m build
twine check dist/*

View file

@ -1,88 +0,0 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: Release Actions
on:
release:
types: [published]
jobs:
upload-release-assets:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo ::set-output name=repo-name::$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Versions
run: |
python3 --version
- name: Checkout Current Repo
uses: actions/checkout@v3
with:
submodules: true
- name: Checkout tools repo
uses: actions/checkout@v3
with:
repository: adafruit/actions-ci-circuitpython-libs
path: actions-ci
- name: Install deps
run: |
source actions-ci/install.sh
- name: Build assets
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --package_folder_prefix cedargrove_ --library_location .
- name: Upload Release Assets
# the 'official' actions version does not yet support dynamically
# supplying asset names to upload. @csexton's version chosen based on
# discussion in the issue below, as its the simplest to implement and
# allows for selecting files with a pattern.
# https://github.com/actions/upload-release-asset/issues/4
#uses: actions/upload-release-asset@v1.0.1
uses: csexton/release-asset-action@master
with:
pattern: "bundles/*"
github-token: ${{ secrets.GITHUB_TOKEN }}
upload-pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check For pyproject.toml
id: need-pypi
run: |
echo ::set-output name=pyproject-toml::$( find . -wholename './pyproject.toml' )
- name: Set up Python
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
run: |
python -m pip install --upgrade pip
pip install --upgrade build twine
- name: Build and publish
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
env:
TWINE_USERNAME: ${{ secrets.pypi_username }}
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do
sed -i -e "s/0.0.0+auto.0/${{github.event.release.tag_name}}/" $file;
done;
python -m build
twine upload dist/*

19
.github/workflows/release_gh.yml vendored Normal file
View file

@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: GitHub Release Actions
on:
release:
types: [published]
jobs:
upload-release-assets:
runs-on: ubuntu-latest
steps:
- name: Run GitHub Release CI workflow
uses: adafruit/workflows-circuitpython-libs/release-gh@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
upload-url: ${{ github.event.release.upload_url }}

19
.github/workflows/release_pypi.yml vendored Normal file
View file

@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: PyPI Release Actions
on:
release:
types: [published]
jobs:
upload-release-assets:
runs-on: ubuntu-latest
steps:
- name: Run PyPI Release CI workflow
uses: adafruit/workflows-circuitpython-libs/release-pypi@main
with:
pypi-username: ${{ secrets.pypi_username }}
pypi-password: ${{ secrets.pypi_password }}

View file

@ -18,7 +18,7 @@ repos:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/pycqa/pylint - repo: https://github.com/pycqa/pylint
rev: v2.11.1 rev: v2.15.5
hooks: hooks:
- id: pylint - id: pylint
name: pylint (library code) name: pylint (library code)

View file

@ -26,7 +26,7 @@ jobs=1
# List of plugins (as comma separated values of python modules names) to load, # List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers. # usually to register additional checkers.
load-plugins= load-plugins=pylint.extensions.no_self_use
# Pickle collected data for later comparisons. # Pickle collected data for later comparisons.
persistent=yes persistent=yes
@ -54,8 +54,8 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have # --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes # no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W" # --disable=W"
# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call # disable=import-error,raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,deprecated-str-translate-call
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,bad-continuation,pointless-string-statement,unspecified-encoding disable=raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,import-error,pointless-string-statement,unspecified-encoding
# Enable the message, report, category or checker with the given id(s). You can # Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option # either give multiple identifier separated by comma (,) or put this option
@ -225,12 +225,6 @@ max-line-length=100
# Maximum number of lines in a module # Maximum number of lines in a module
max-module-lines=1000 max-module-lines=1000
# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,dict-separator
# Allow the body of a class to be on the same line as the declaration if body # Allow the body of a class to be on the same line as the declaration if body
# contains single statement. # contains single statement.
single-line-class-stmt=no single-line-class-stmt=no
@ -257,38 +251,22 @@ min-similarity-lines=12
[BASIC] [BASIC]
# Naming hint for argument names
argument-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct argument names # Regular expression matching correct argument names
argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Naming hint for attribute names
attr-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct attribute names # Regular expression matching correct attribute names
attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Bad variable names which should always be refused, separated by a comma # Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata bad-names=foo,bar,baz,toto,tutu,tata
# Naming hint for class attribute names
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
# Regular expression matching correct class attribute names # Regular expression matching correct class attribute names
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
# Naming hint for class names
# class-name-hint=[A-Z_][a-zA-Z0-9]+$
class-name-hint=[A-Z_][a-zA-Z0-9_]+$
# Regular expression matching correct class names # Regular expression matching correct class names
# class-rgx=[A-Z_][a-zA-Z0-9]+$ # class-rgx=[A-Z_][a-zA-Z0-9]+$
class-rgx=[A-Z_][a-zA-Z0-9_]+$ class-rgx=[A-Z_][a-zA-Z0-9_]+$
# Naming hint for constant names
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
# Regular expression matching correct constant names # Regular expression matching correct constant names
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
@ -296,9 +274,6 @@ const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
# ones are exempt. # ones are exempt.
docstring-min-length=-1 docstring-min-length=-1
# Naming hint for function names
function-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct function names # Regular expression matching correct function names
function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
@ -309,21 +284,12 @@ good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_
# Include a hint for the correct naming format with invalid-name # Include a hint for the correct naming format with invalid-name
include-naming-hint=no include-naming-hint=no
# Naming hint for inline iteration names
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
# Regular expression matching correct inline iteration names # Regular expression matching correct inline iteration names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
# Naming hint for method names
method-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct method names # Regular expression matching correct method names
method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Naming hint for module names
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
# Regular expression matching correct module names # Regular expression matching correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
@ -339,9 +305,6 @@ no-docstring-rgx=^_
# to this list to register other decorators that produce valid properties. # to this list to register other decorators that produce valid properties.
property-classes=abc.abstractproperty property-classes=abc.abstractproperty
# Naming hint for variable names
variable-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct variable names # Regular expression matching correct variable names
variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

View file

@ -67,9 +67,9 @@ Usage Example
``grayscale(index, gamma)`` ``grayscale(index, gamma)``
Translates the normalized index value into a 24-bit RGB integer with gamma Translates the normalized index value into a 24-bit RGB integer with gamma
adjustment. The spectral index is a floating point value in the range of 0.0 to visual perception control. The spectral index is a floating point value in the
1.0 (inclusive); default is 0.0. The gamma value can be from 0.0 to 1.0 range of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value can be from 0.0
(inclusive); default is 0.8, tuned for TFT displays. If the index or gamma to 1.0 (inclusive); default is 0.8, tuned for TFT displays. If the index or gamma
value is outside of the specified range, the 24-bit RGB output will be limited value is outside of the specified range, the 24-bit RGB output will be limited
to the minimum (0x0) or maximum (0xFFFFFF) value. to the minimum (0x0) or maximum (0xFFFFFF) value.
@ -83,9 +83,9 @@ to the minimum (0x0) or maximum (0xFFFFFF) value.
``iron(index, gamma)`` ``iron(index, gamma)``
Translates the normalized index value into a 24-bit RGB integer with gamma Translates the normalized index value into a 24-bit RGB integer with gamma
adjustment. The spectral index is a floating point value in the range of 0.0 to visual perception control. The spectral index is a floating point value in the
1.0 (inclusive); default is 0.0. The gamma value can be from 0.0 to 1.0 range of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value can be from 0.0
(inclusive); default is 0.5, tuned for TFT displays. If the index or gamma to 1.0 (inclusive); default is 0.5, tuned for TFT displays. If the index or gamma
value is outside of the specified range, the 24-bit RGB output will be limited value is outside of the specified range, the 24-bit RGB output will be limited
to the minimum (0x0) or maximum (0xFFFFFF) value. to the minimum (0x0) or maximum (0xFFFFFF) value.
@ -99,9 +99,9 @@ to the minimum (0x0) or maximum (0xFFFFFF) value.
``stoplight(index, gamma)`` ``stoplight(index, gamma)``
Translates the normalized index value into a 24-bit RGB integer with gamma Translates the normalized index value into a 24-bit RGB integer with gamma
adjustment. The spectral index is a floating point value in the range of 0.0 to visual perception control. The spectral index is a floating point value in the
1.0 (inclusive); default is 0.0. The gamma value can be from 0.0 to 1.0 range of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value can be from 0.0
(inclusive); default is 0.5, tuned for TFT displays. If the index or gamma to 1.0 (inclusive); default is 0.5, tuned for TFT displays. If the index or gamma
value is outside of the specified range, the 24-bit RGB output will be limited value is outside of the specified range, the 24-bit RGB output will be limited
to the minimum (0x0) or maximum (0xFFFFFF) value. to the minimum (0x0) or maximum (0xFFFFFF) value.
@ -115,9 +115,9 @@ to the minimum (0x0) or maximum (0xFFFFFF) value.
``visible(index, gamma)`` ``visible(index, gamma)``
Translates the normalized index value into a 24-bit RGB integer with gamma Translates the normalized index value into a 24-bit RGB integer with gamma
adjustment. The spectral index is a floating point value in the range of 0.0 to visual perception control. The spectral index is a floating point value in the
1.0 (inclusive); default is 0.0. The gamma value can be from 0.0 to 1.0 range of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value can be from 0.0
(inclusive); default is 0.5, tuned for TFT displays. If the index or gamma to 1.0 (inclusive); default is 0.5, tuned for TFT displays. If the index or gamma
value is outside of the specified range, the 24-bit RGB output will be limited value is outside of the specified range, the 24-bit RGB output will be limited
to the minimum (0x0) or maximum (0xFFFFFF) value. to the minimum (0x0) or maximum (0xFFFFFF) value.
@ -131,11 +131,11 @@ to the minimum (0x0) or maximum (0xFFFFFF) value.
``n_color(index, gamma)`` ``n_color(index, gamma)``
A class that translates the normalized index value into a 24-bit RGB integer A class that translates the normalized index value into a 24-bit RGB integer
with gamma adjustment. The spectral index is a floating point value in the with gamma visual perception control. The spectral index is a floating point
range of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value can be from value in the range of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value
0.0 to 3.0 (inclusive); default is 0.55, tuned for TFT displays. If the index can be from 0.0 to 3.0 (inclusive); default is 0.55, tuned for TFT displays. If
or gamma value is outside of the specified range, the 24-bit RGB output will be the index or gamma value is outside of the specified range, the 24-bit RGB
limited to the minimum (0x0) or maximum (0xFFFFFF) value. output will be limited to the minimum (0x0) or maximum (0xFFFFFF) value.
The class converts a spectrum index value consisting of a positive numeric The class converts a spectrum index value consisting of a positive numeric
value (0.0 to 1.0, modulus of 1.0) to an RGB color value that representing the value (0.0 to 1.0, modulus of 1.0) to an RGB color value that representing the
@ -160,7 +160,7 @@ consumption with a slight speed performance sacrifice. Use the
0xff9c00 0xff9c00
``n_color(index, gamma)`` ``n_color_table(index, gamma)``
This class functions the same as the ``n_color.Spectrum`` class, calculating This class functions the same as the ``n_color.Spectrum`` class, calculating
resultant color values from a pre-compiled internal color list to improve speed resultant color values from a pre-compiled internal color list to improve speed

View file

@ -25,6 +25,7 @@ __repo__ = "https://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools
def map_range(x, in_min, in_max, out_min, out_max): def map_range(x, in_min, in_max, out_min, out_max):
# pylint: disable = duplicate-code
""" """
Maps and constrains an input value from one range of values to another. Maps and constrains an input value from one range of values to another.
(from adafruit_simpleio) (from adafruit_simpleio)
@ -54,6 +55,7 @@ def map_range(x, in_min, in_max, out_min, out_max):
def index_to_rgb(index=0, gamma=0.8): def index_to_rgb(index=0, gamma=0.8):
# pylint: disable = duplicate-code
""" """
Converts a spectral index to a grayscale RGB value. Spectral index in Converts a spectral index to a grayscale RGB value. Spectral index in
range of 0.0 to 1.0. Gamma in range of 0.0 to 1.0 (1.0=linear), range of 0.0 to 1.0. Gamma in range of 0.0 to 1.0 (1.0=linear),

View file

@ -24,6 +24,7 @@ __repo__ = "https://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools
def map_range(x, in_min, in_max, out_min, out_max): def map_range(x, in_min, in_max, out_min, out_max):
# pylint: disable = duplicate-code
""" """
Maps and constrains an input value from one range of values to another. Maps and constrains an input value from one range of values to another.
(from adafruit_simpleio) (from adafruit_simpleio)
@ -53,6 +54,7 @@ def map_range(x, in_min, in_max, out_min, out_max):
def index_to_rgb(index=0, gamma=0.5): def index_to_rgb(index=0, gamma=0.5):
# pylint: disable = duplicate-code
""" """
Converts a temperature index to an iron thermographic pseudocolor spectrum Converts a temperature index to an iron thermographic pseudocolor spectrum
RGB value. Temperature index in range of 0.0 to 1.0. Gamma in range of RGB value. Temperature index in range of 0.0 to 1.0. Gamma in range of

View file

@ -24,6 +24,7 @@ __repo__ = "https://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools
def map_range(x, in_min, in_max, out_min, out_max): def map_range(x, in_min, in_max, out_min, out_max):
# pylint: disable = duplicate-code
"""Maps and constrains an input value from one range of values to another. """Maps and constrains an input value from one range of values to another.
(from adafruit_simpleio) (from adafruit_simpleio)
@ -51,7 +52,9 @@ def map_range(x, in_min, in_max, out_min, out_max):
return min(max(mapped, out_max), out_min) return min(max(mapped, out_max), out_min)
# pylint: disable = duplicate-code
class Spectrum: class Spectrum:
# pylint: disable = duplicate-code
"""Converts a spectrum index value consisting of a positive numeric value """Converts a spectrum index value consisting of a positive numeric value
(0.0 to 1.0, modulus of 1.0) to an RGB color value that representing the (0.0 to 1.0, modulus of 1.0) to an RGB color value that representing the
index position on a graduated and blended multicolor spectrum. index position on a graduated and blended multicolor spectrum.
@ -90,6 +93,7 @@ class Spectrum:
""" """
def __init__(self, colors=None, mode="continuous", gamma=0.55): def __init__(self, colors=None, mode="continuous", gamma=0.55):
# pylint: disable = duplicate-code
self._colors = colors self._colors = colors
self._mode = mode self._mode = mode
self._gamma = min(max(gamma, 0), 3.0) self._gamma = min(max(gamma, 0), 3.0)

View file

@ -24,6 +24,7 @@ __repo__ = "https://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools
def map_range(x, in_min, in_max, out_min, out_max): def map_range(x, in_min, in_max, out_min, out_max):
# pylint: disable = duplicate-code
"""Maps and constrains an input value from one range of values to another. """Maps and constrains an input value from one range of values to another.
(from adafruit_simpleio) (from adafruit_simpleio)
@ -51,7 +52,9 @@ def map_range(x, in_min, in_max, out_min, out_max):
return min(max(mapped, out_max), out_min) return min(max(mapped, out_max), out_min)
# pylint: disable = duplicate-code
class Spectrum: class Spectrum:
# pylint: disable = duplicate-code
"""Converts a spectrum index value consisting of a positive numeric value """Converts a spectrum index value consisting of a positive numeric value
(0.0 to 1.0, modulus of 1.0) to an RGB color value that representing the (0.0 to 1.0, modulus of 1.0) to an RGB color value that representing the
index position on a graduated and blended multicolor spectrum. index position on a graduated and blended multicolor spectrum.
@ -89,6 +92,7 @@ class Spectrum:
""" """
def __init__(self, colors=None, mode="normal", gamma=0.55): def __init__(self, colors=None, mode="normal", gamma=0.55):
# pylint: disable = duplicate-code
self._colors = colors self._colors = colors
self._mode = mode self._mode = mode
self._gamma = min(max(gamma, 0), 3.0) self._gamma = min(max(gamma, 0), 3.0)

View file

@ -24,6 +24,7 @@ __repo__ = "https://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools
def map_range(x, in_min, in_max, out_min, out_max): def map_range(x, in_min, in_max, out_min, out_max):
# pylint: disable = duplicate-code
""" """
Maps and constrains an input value from one range of values to another. Maps and constrains an input value from one range of values to another.
(from adafruit_simpleio) (from adafruit_simpleio)
@ -53,6 +54,7 @@ def map_range(x, in_min, in_max, out_min, out_max):
def index_to_rgb(index=0, gamma=0.5): def index_to_rgb(index=0, gamma=0.5):
# pylint: disable = duplicate-code
""" """
Converts a spectral index to "stop light" (green -> yellow -> red) Converts a spectral index to "stop light" (green -> yellow -> red)
spectrum to an RGB value. Spectral index in range of 0.0 to 1.0 spectrum to an RGB value. Spectral index in range of 0.0 to 1.0

View file

@ -27,6 +27,7 @@ __repo__ = "https://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools
def index_to_rgb(index=0, gamma=0.5): def index_to_rgb(index=0, gamma=0.5):
# pylint: disable = duplicate-code
""" """
Converts a spectral index to rainbow (visible light wavelength) Converts a spectral index to rainbow (visible light wavelength)
spectrum to an RGB value. Spectral index in range of 0.0 to 1.0 spectrum to an RGB value. Spectral index in range of 0.0 to 1.0