Skip to content

Commit 817b1aa

Browse files
committed
Update various docstrings.
1 parent 6765d1d commit 817b1aa

File tree

9 files changed

+170
-71
lines changed

9 files changed

+170
-71
lines changed

colour/plotting/characterisation.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ def plot_single_colour_checker(colour_checker='ColorChecker 2005', **kwargs):
4343
Parameters
4444
----------
4545
colour_checker : unicode, optional
46-
Color checker name.
46+
Color checker to plot. ``colour_checker`` can be of any type or form
47+
supported by the
48+
:func:`colour.plotting.filter_colour_checkers` definition.
4749
4850
Other Parameters
4951
----------------
@@ -87,7 +89,9 @@ def plot_multi_colour_checkers(colour_checkers=None, **kwargs):
8789
Parameters
8890
----------
8991
colour_checkers : array_like, optional
90-
Color checker names, must be less than or equal to 2 names.
92+
Color checker to plot, count must be less than or equal to 2.
93+
``colour_checkers`` elements can be of any type or form supported by
94+
the :func:`colour.plotting.filter_colour_checkers` definition.
9195
9296
Other Parameters
9397
----------------

colour/plotting/colorimetry.py

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ def plot_single_sd(sd,
7575
----------
7676
sd : SpectralDistribution
7777
Spectral distribution to plot.
78+
cmfs : unicode, optional
79+
Standard observer colour matching functions used for computing the
80+
spectrum domain and colours. ``cmfs`` can be of any type or form
81+
supported by the :func:`colour.plotting.filter_cmfs` definition.
7882
out_of_gamut_clipping : bool, optional
7983
Whether to clip out of gamut colours otherwise, the colours will be
8084
offset by the absolute minimal colour leading to a rendering on
@@ -88,8 +92,6 @@ def plot_single_sd(sd,
8892
arguments to *True* will generate a spectrum strip where each
8993
wavelength colour is modulated by the spectral distribution amplitude.
9094
The usual 5% margin above the spectral distribution is also omitted.
91-
cmfs : unicode
92-
Standard observer colour matching functions used for spectrum creation.
9395
9496
Other Parameters
9597
----------------
@@ -213,7 +215,9 @@ def plot_multi_sds(sds,
213215
of :class:`colour.MultiSpectralDistributions` class instances or a
214216
list of :class:`colour.SpectralDistribution` class instances.
215217
cmfs : unicode, optional
216-
Standard observer colour matching functions used for spectrum creation.
218+
Standard observer colour matching functions used for computing the
219+
spectral distributions colours. ``cmfs`` can be of any type or form
220+
supported by the :func:`colour.plotting.filter_cmfs` definition.
217221
use_sds_colours : bool, optional
218222
Whether to use spectral distributions colours.
219223
normalise_sds_colours : bool
@@ -315,7 +319,8 @@ def plot_single_cmfs(cmfs='CIE 1931 2 Degree Standard Observer', **kwargs):
315319
Parameters
316320
----------
317321
cmfs : unicode, optional
318-
Colour matching functions to plot.
322+
Colour matching functions to plot. ``cmfs`` can be of any type or form
323+
supported by the :func:`colour.plotting.filter_cmfs` definition.
319324
320325
Other Parameters
321326
----------------
@@ -359,7 +364,9 @@ def plot_multi_cmfs(cmfs=None, **kwargs):
359364
Parameters
360365
----------
361366
cmfs : array_like, optional
362-
Colour matching functions to plot.
367+
Colour matching functions to plot. ``cmfs`` elements can be of any
368+
type or form supported by the :func:`colour.plotting.filter_cmfs`
369+
definition.
363370
364371
Other Parameters
365372
----------------
@@ -443,9 +450,12 @@ def plot_single_illuminant_sd(illuminant='A',
443450
Parameters
444451
----------
445452
illuminant : unicode, optional
446-
Factory illuminant to plot.
453+
Illuminant to plot. ``illuminant`` can be of any type or form supported
454+
by the :func:`colour.plotting.filter_illuminants` definition.
447455
cmfs : unicode, optional
448-
Standard observer colour matching functions to plot.
456+
Standard observer colour matching functions used for computing the
457+
spectrum domain and colours. ``cmfs`` can be of any type or form
458+
supported by the :func:`colour.plotting.filter_cmfs` definition.
449459
450460
Other Parameters
451461
----------------
@@ -499,7 +509,9 @@ def plot_multi_illuminant_sds(illuminants=None, **kwargs):
499509
Parameters
500510
----------
501511
illuminants : array_like, optional
502-
Factory illuminants to plot.
512+
Illuminants to plot. ``illuminants`` elements can be of any type or
513+
form supported by the :func:`colour.plotting.filter_illuminants`
514+
definition.
503515
504516
Other Parameters
505517
----------------
@@ -559,7 +571,9 @@ def plot_visible_spectrum(cmfs='CIE 1931 2 Degree Standard Observer',
559571
Parameters
560572
----------
561573
cmfs : unicode, optional
562-
Standard observer colour matching functions used for spectrum creation.
574+
Standard observer colour matching functions used for computing the
575+
spectrum domain and colours. ``cmfs`` can be of any type or form
576+
supported by the :func:`colour.plotting.filter_cmfs` definition.
563577
out_of_gamut_clipping : bool, optional
564578
Whether to clip out of gamut colours otherwise, the colours will be
565579
offset by the absolute minimal colour leading to a rendering on
@@ -629,7 +643,8 @@ def plot_single_lightness_function(function='CIE 1976', **kwargs):
629643
Parameters
630644
----------
631645
function : unicode, optional
632-
*Lightness* function to plot.
646+
*Lightness* function to plot. ``function`` can be of any type or form
647+
supported by the :func:`colour.plotting.filter_passthrough` definition.
633648
634649
Other Parameters
635650
----------------
@@ -669,7 +684,9 @@ def plot_multi_lightness_functions(functions=None, **kwargs):
669684
Parameters
670685
----------
671686
functions : array_like, optional
672-
*Lightness* functions to plot.
687+
*Lightness* functions to plot. ``functions`` elements can be of any
688+
type or form supported by the
689+
:func:`colour.plotting.filter_passthrough` definition.
673690
674691
Other Parameters
675692
----------------
@@ -762,7 +779,9 @@ def plot_multi_luminance_functions(functions=None, **kwargs):
762779
Parameters
763780
----------
764781
functions : array_like, optional
765-
*Luminance* functions to plot.
782+
*Luminance* functions to plot. ``functions`` elements can be of any
783+
type or form supported by the
784+
:func:`colour.plotting.filter_passthrough` definition.
766785
767786
Other Parameters
768787
----------------
@@ -821,7 +840,9 @@ def plot_blackbody_spectral_radiance(
821840
temperature : numeric, optional
822841
Blackbody temperature.
823842
cmfs : unicode, optional
824-
Standard observer colour matching functions.
843+
Standard observer colour matching functions used for computing the
844+
spectrum domain and colours. ``cmfs`` can be of any type or form
845+
supported by the :func:`colour.plotting.filter_cmfs` definition.
825846
blackbody : unicode, optional
826847
Blackbody name.
827848
@@ -913,7 +934,9 @@ def plot_blackbody_colours(
913934
shape : SpectralShape, optional
914935
Spectral shape to use as plot boundaries.
915936
cmfs : unicode, optional
916-
Standard observer colour matching functions.
937+
Standard observer colour matching functions used for computing the
938+
blackbody colours. ``cmfs`` can be of any type or form supported by the
939+
:func:`colour.plotting.filter_cmfs` definition.
917940
918941
Other Parameters
919942
----------------

colour/plotting/common.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -695,14 +695,22 @@ class instances whose type is one of the mapping element types.
695695
696696
This definition allows passing custom but compatible objects to the various
697697
plotting definitions that by default expect the key from a dataset element.
698+
698699
For example, a typical call to :func:`colour.plotting.\
699-
plot_multi_illuminant_sds` definition is as follows:
700+
plot_multi_illuminant_sds` definition with a regex pattern automatically
701+
anchored at boundaries by default is as follows:
700702
701703
>>> import colour
702704
>>> colour.plotting.plot_multi_illuminant_sds(['A'])
703705
... # doctest: +SKIP
704706
705-
But it is also possible to pass a custom spectral distribution as follows:
707+
Here, `'A'` is by default anchored at boundaries and transformed into
708+
`'^A$'`. Note that because it is a regex pattern, special characters such
709+
as parenthesis must be escaped: `'Adobe RGB (1998)'` must be written
710+
`'Adobe RGB \\(1998\\)'` instead.
711+
712+
With the previous example, t is also possible to pass a custom spectral
713+
distribution as follows:
706714
707715
>>> data = {
708716
... 500: 0.0651,
@@ -812,7 +820,9 @@ def filter_RGB_colourspaces(filterers,
812820
filterers : unicode or RGB_Colourspace or array_like
813821
Filterer or :class:`colour.RGB_Colourspace` class instance (which is
814822
passed through directly if its type is one of the mapping element
815-
types) or list of filterers.
823+
types) or list of filterers. ``filterers`` elements can also be of any
824+
form supported by the :func:`colour.plotting.filter_passthrough`
825+
definition.
816826
anchors : bool, optional
817827
Whether to use Regex line anchors, i.e. *^* and *$* are added,
818828
surrounding the filterers patterns.
@@ -846,7 +856,9 @@ def filter_cmfs(filterers,
846856
:class:`colour.RGB_ColourMatchingFunctions` or
847857
:class:`colour.XYZ_ColourMatchingFunctions` class instance (which is
848858
passed through directly if its type is one of the mapping element
849-
types) or list of filterers.
859+
types) or list of filterers. ``filterers`` elements can also be of any
860+
form supported by the :func:`colour.plotting.filter_passthrough`
861+
definition.
850862
anchors : bool, optional
851863
Whether to use Regex line anchors, i.e. *^* and *$* are added,
852864
surrounding the filterers patterns.
@@ -877,7 +889,9 @@ def filter_illuminants(filterers,
877889
filterers : unicode or SpectralDistribution or array_like
878890
Filterer or :class:`colour.SpectralDistribution` class instance
879891
(which is passed through directly if its type is one of the mapping
880-
element types) or list of filterers.
892+
element types) or list of filterers. ``filterers`` elements can also be
893+
of any form supported by the :func:`colour.plotting.filter_passthrough`
894+
definition.
881895
anchors : bool, optional
882896
Whether to use Regex line anchors, i.e. *^* and *$* are added,
883897
surrounding the filterers patterns.
@@ -917,7 +931,9 @@ def filter_colour_checkers(filterers,
917931
filterers : unicode or ColourChecker or array_like
918932
Filterer or :class:`colour.characterisation.ColourChecker` class
919933
instance (which is passed through directly if its type is one of the
920-
mapping element types) or list of filterers.
934+
mapping element types) or list of filterers. ``filterers`` elements
935+
can also be of any form supported by the
936+
:func:`colour.plotting.filter_passthrough` definition.
921937
anchors : bool, optional
922938
Whether to use Regex line anchors, i.e. *^* and *$* are added,
923939
surrounding the filterers patterns.

colour/plotting/diagrams.py

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ def plot_spectral_locus(cmfs='CIE 1931 2 Degree Standard Observer',
6161
Parameters
6262
----------
6363
cmfs : unicode, optional
64-
Standard observer colour matching functions defining the
65-
*Spectral Locus*.
64+
Standard observer colour matching functions used for computing the
65+
spectral locus boundaries. ``cmfs`` can be of any type or form
66+
supported by the :func:`colour.plotting.filter_cmfs` definition.
6667
spectral_locus_colours : array_like or unicode, optional
6768
*Spectral Locus* colours, if ``spectral_locus_colours`` is set to
6869
*RGB*, the colours will be computed according to the corresponding
@@ -232,8 +233,9 @@ def plot_chromaticity_diagram_colours(
232233
diagram_clipping_path : array_like, optional
233234
Path of points used to clip the *Chromaticity Diagram* colours.
234235
cmfs : unicode, optional
235-
Standard observer colour matching functions used for
236-
*Chromaticity Diagram* bounds.
236+
Standard observer colour matching functions used for computing the
237+
spectral locus boundaries. ``cmfs`` can be of any type or form
238+
supported by the :func:`colour.plotting.filter_cmfs` definition.
237239
method : unicode, optional
238240
**{'CIE 1931', 'CIE 1960 UCS', 'CIE 1976 UCS'}**,
239241
*Chromaticity Diagram* method.
@@ -332,8 +334,9 @@ def plot_chromaticity_diagram(cmfs='CIE 1931 2 Degree Standard Observer',
332334
Parameters
333335
----------
334336
cmfs : unicode, optional
335-
Standard observer colour matching functions used for
336-
*Chromaticity Diagram* bounds.
337+
Standard observer colour matching functions used for computing the
338+
spectral locus boundaries. ``cmfs`` can be of any type or form
339+
supported by the :func:`colour.plotting.filter_cmfs` definition.
337340
show_diagram_colours : bool, optional
338341
Whether to display the *Chromaticity Diagram* background colours.
339342
show_spectral_locus : bool, optional
@@ -429,8 +432,9 @@ def plot_chromaticity_diagram_CIE1931(
429432
Parameters
430433
----------
431434
cmfs : unicode, optional
432-
Standard observer colour matching functions used for
433-
*Chromaticity Diagram* bounds.
435+
Standard observer colour matching functions used for computing the
436+
spectral locus boundaries. ``cmfs`` can be of any type or form
437+
supported by the :func:`colour.plotting.filter_cmfs` definition.
434438
show_diagram_colours : bool, optional
435439
Whether to display the *Chromaticity Diagram* background colours.
436440
show_spectral_locus : bool, optional
@@ -479,8 +483,9 @@ def plot_chromaticity_diagram_CIE1960UCS(
479483
Parameters
480484
----------
481485
cmfs : unicode, optional
482-
Standard observer colour matching functions used for
483-
*Chromaticity Diagram* bounds.
486+
Standard observer colour matching functions used for computing the
487+
spectral locus boundaries. ``cmfs`` can be of any type or form
488+
supported by the :func:`colour.plotting.filter_cmfs` definition.
484489
show_diagram_colours : bool, optional
485490
Whether to display the *Chromaticity Diagram* background colours.
486491
show_spectral_locus : bool, optional
@@ -529,8 +534,9 @@ def plot_chromaticity_diagram_CIE1976UCS(
529534
Parameters
530535
----------
531536
cmfs : unicode, optional
532-
Standard observer colour matching functions used for
533-
*Chromaticity Diagram* bounds.
537+
Standard observer colour matching functions used for computing the
538+
spectral locus boundaries. ``cmfs`` can be of any type or form
539+
supported by the :func:`colour.plotting.filter_cmfs` definition.
534540
show_diagram_colours : bool, optional
535541
Whether to display the *Chromaticity Diagram* background colours.
536542
show_spectral_locus : bool, optional
@@ -588,8 +594,9 @@ def plot_sds_in_chromaticity_diagram(
588594
of :class:`colour.MultiSpectralDistributions` class instances or a
589595
list of :class:`colour.SpectralDistribution` class instances.
590596
cmfs : unicode, optional
591-
Standard observer colour matching functions used for
592-
*Chromaticity Diagram* bounds.
597+
Standard observer colour matching functions used for computing the
598+
spectral locus boundaries. ``cmfs`` can be of any type or form
599+
supported by the :func:`colour.plotting.filter_cmfs` definition.
593600
annotate_kwargs : dict or array_like, optional
594601
Parameters for the :func:`plt.annotate` definition, used to annotate
595602
the resulting chromaticity coordinates with their respective spectral
@@ -763,8 +770,9 @@ class instance, a list of :class:`colour.MultiSpectralDistributions`
763770
class instances or a list of :class:`colour.SpectralDistribution` class
764771
instances.
765772
cmfs : unicode, optional
766-
Standard observer colour matching functions used for
767-
*Chromaticity Diagram* bounds.
773+
Standard observer colour matching functions used for computing the
774+
spectral locus boundaries. ``cmfs`` can be of any type or form
775+
supported by the :func:`colour.plotting.filter_cmfs` definition.
768776
annotate_kwargs : dict or array_like, optional
769777
Parameters for the :func:`plt.annotate` definition, used to annotate
770778
the resulting chromaticity coordinates with their respective spectral
@@ -838,8 +846,9 @@ class instance, a list of :class:`colour.MultiSpectralDistributions`
838846
class instances or a list of :class:`colour.SpectralDistribution` class
839847
instances.
840848
cmfs : unicode, optional
841-
Standard observer colour matching functions used for
842-
*Chromaticity Diagram* bounds.
849+
Standard observer colour matching functions used for computing the
850+
spectral locus boundaries. ``cmfs`` can be of any type or form
851+
supported by the :func:`colour.plotting.filter_cmfs` definition.
843852
annotate_kwargs : dict or array_like, optional
844853
Parameters for the :func:`plt.annotate` definition, used to annotate
845854
the resulting chromaticity coordinates with their respective spectral
@@ -914,8 +923,9 @@ class instance, a list of :class:`colour.MultiSpectralDistributions`
914923
class instances or a list of :class:`colour.SpectralDistribution` class
915924
instances.
916925
cmfs : unicode, optional
917-
Standard observer colour matching functions used for
918-
*Chromaticity Diagram* bounds.
926+
Standard observer colour matching functions used for computing the
927+
spectral locus boundaries. ``cmfs`` can be of any type or form
928+
supported by the :func:`colour.plotting.filter_cmfs` definition.
919929
annotate_kwargs : dict or array_like, optional
920930
Parameters for the :func:`plt.annotate` definition, used to annotate
921931
the resulting chromaticity coordinates with their respective spectral

0 commit comments

Comments
 (0)