Fichier:Cone-fundamentals-with-srgb-spectrum.svg

De testwiki
Aller à la navigation Aller à la recherche
Fichier d’origine (Fichier SVG, nominalement de 540 × 380 pixels, taille : 5 kio)

Ce fichier provient de Wikimedia Commons et peut être utilisé par d'autres projets. Sa description sur sa page de description est affichée ci-dessous.

Description

Description
English: The Stockman and Sharpe (2000) 2° cone fundamentals, as found at Cone Fundamentals. cvrl.ucl.ac.uk. Retrieved on 2025-11-11., plotted against the most accurate sRGB spectrum I could manage. Now in SVG.
Date
Source Travail personnel
Auteur BenRG
Autres versions
SVG information
InfoField
 Le code de ce fichier SVG est valide.
 Ce diagramme a été créé avec un logiciel SVG inconnu
  Ce diagramme SVG utilise du texte encapsulé qui peut être traduit facilement à l'aide d'un éditeur de texte.

Conditions d’utilisation

Public domain Moi, propriétaire des droits d’auteur sur cette œuvre, la place dans le domaine public. Ceci s'applique dans le monde entier.
Dans certains pays, ceci peut ne pas être possible ; dans ce cas :
J’accorde à toute personne le droit d’utiliser cette œuvre dans n’importe quel but, sans aucune condition, sauf celles requises par la loi.

Perl code

use strict;
use Svg;

sub MakeGrad {
	my ($grad,$a) = @_;
	my ($lo,$hi) = ($$a[0][0], $$a[$#$a][0]);
	for my $stop (@$a) {
		$grad->stop(offset => int(($$stop[0]-$lo)/($hi-$lo)*100+0.5) . '%', 'stop-color' => $$stop[1]);
	}
}

# cone fundamentals in steps of 5nm from 390nm to 710nm, normalized to max=1000
my @lfund = (0,1,2,5,9,13,18,23,28,34,40,45,50,55,65,81,99,119,140,164,192,233,289,360,444,536,629,705,771,826,881,919,940,966,981,994,1000,992,969,956,928,886,834,775,706,631,554,480,401,328,266,213,165,125,93,69,50,36,25,18,12,8,6,4,3);
my @mfund = (0,1,2,5,9,15,22,30,39,52,65,76,87,98,116,145,176,205,236,268,304,357,428,516,616,719,817,886,936,969,995,997,977,957,918,873,814,740,653,573,493,411,334,265,205,156,117,86,62,44,31,22,15,11,7,5,3,2,2,1,1,1,0,0,0);
my @sfund = (10,24,57,122,233,381,544,674,803,904,991,992,955,860,787,738,646,516,390,290,212,161,123,89,61,43,29,19,13,8,5,3,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);

my @colorgradient1 = ([390,'#000001'],[400,'#010002'],[410,'#020007'],[420,'#060013'],[440,'#170039'],[450,'#1D004E'],[455,'#1D005B'],[460,'#18006B'],[465,'#000879'],[470,'#002061'],[480,'#00334D'],[490,'#004245'],[500,'#005446'],[520,'#007C4F'],[530,'#00884D'],[535,'#008C48'],[545,'#00912F'],[550,'#159300'],[555,'#409000'],[570,'#7E8000'],[585,'#A56400'],[595,'#B44A00'],[605,'#BA2700'],[610,'#B90C00'],[615,'#B00016'],[620,'#A4001F'],[630,'#8B0021'],[640,'#72001D'],[670,'#310009'],[680,'#220005'],[700,'#0D0001'],[710,'#070001']);
my @colorgradient2 = ([390,'#8E8D8F'],[400,'#8E8D93'],[410,'#908B9C'],[420,'#9587B6'],[430,'#9C7FDA'],[440,'#9C7DE8'],[450,'#9780E9'],[460,'#8F86E5'],[470,'#8390D5'],[490,'#68A6AA'],[500,'#55B29C'],[510,'#30C292'],[520,'#00D189'],[530,'#33D985'],[540,'#5FDB82'],[555,'#96D681'],[570,'#C5C783'],[585,'#EAB186'],[595,'#FAA088'],[605,'#FF918A'],[615,'#FA888B'],[625,'#EB848C'],[655,'#B1898D'],[670,'#9D8C8D'],[690,'#928D8E'],[710,'#8F8D8E']);

my ($bgcolor,$legendcolor,$tracecolor,$spectrum) = (qw(white black white), \@colorgradient1);
#my ($bgcolor,$legendcolor,$tracecolor,$spectrum) = (qw(black white black), \@colorgradient2);
my $graph_width = 480;
my $graph_height = 300;
my $spectrum_top_padding = 10;
my $graph_ofs_x = 40;
my $graph_ofs_y = 20;
my $image_width = $graph_ofs_x + $graph_width + 20;
my $image_height = $graph_ofs_y + $graph_height + 60;

my $svg = new Svg(width => $image_width, height => $image_height, fill => 'none');
MakeGrad($svg->defs()->linearGradient(id => 'spectrum'), $spectrum);

$svg->rect(width => $image_width, height => $image_height, fill => $bgcolor);

my $graph = $svg->group(stroke => $tracecolor, 'stroke-width' => 3, 'stroke-linecap' => 'square');
$graph->translate($graph_ofs_x, $graph_ofs_y);
$graph->rect(x => 0, y => 0, width => $graph_width, height => $graph_height, stroke => 'none', fill => 'url(#spectrum)');
for my $a (\@lfund,\@mfund,\@sfund) {
	$graph->path(d => MakePath(Interpolate([0..$#$a], $a, 4), $graph_width / $#$a, ($graph_height-$spectrum_top_padding)/-1000, 0, $graph_height, 0.25));
}
$graph->line(x1 => 0, y1 => $graph_height, x2 => $graph_width, y2 => $graph_height, stroke => $bgcolor);

my $text = $svg->group('font-family' => 'Nimbus Roman No9 L, Times, serif', 'font-size' => 20, 'text-anchor' => 'middle', stroke => 'none', fill => $legendcolor);
my $ticks = do { my $w = $graph_width+19; my $h = $graph_height+19; "M30.5,10.5l$w,0l0,${h}l-$w,0l0,-$h" };
for (my $i = 390; $i <= 710; $i += 10) {
	my $h = $i % 50 ? 3 : 6;
	my $x = $graph_ofs_x + 0.5 + $graph_width * ($i-390)/(710-390);
	my $y2 = $graph_ofs_y + $graph_height + 9.5 - $h;
	$ticks .= "M$x,10.5l0,${h}M$x,${y2}l0,$h";
	if ($i % 50 == 0) {
		$text->text(x => $x, y => $graph_ofs_y + $graph_height + 30)->add($i);
	}
}
$text->text(x => $graph_ofs_x + $graph_width * 0.5, y => $graph_ofs_y + $graph_height + 50)->add('Wavelength (nm)');
$text->text()->rotate(-90)->translate(20, $graph_ofs_y + $graph_height/2)->add('Normalized cone response (linear energy)');
my $sml_text = $text->group(fill => $tracecolor);
$sml_text->text(x => 145, y => 50)->add('S');
$sml_text->text(x => 230, y => 50)->add('M');
$sml_text->text(x => 355, y => 50)->add('L');
$svg->path(stroke => $legendcolor, 'stroke-width' => 1, d => $ticks);

$svg->write('Cone-fundamentals-with-srgb-spectrum.svg');

Légendes

Ajoutez en une ligne la description de ce que représente ce fichier

Éléments décrits dans ce fichier

dépeint

image/svg+xml

15f4919b7ec6bb0f955837af49ad332379eced4e

380 pixel

540 pixel

Historique du fichier

Cliquer sur une date et heure pour voir le fichier tel qu'il était à ce moment-là.

Date et heureVignetteDimensionsUtilisateurCommentaire
actuel23 septembre 2009 à 18:14Vignette pour la version du 23 septembre 2009 à 18:14540 × 380 (5 kio)wikimediacommons>BenRGuse font-family="Nimbus Roman No9 L, Times, serif"

La page suivante utilise ce fichier :