| 1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 |
% Hugo Gomes @ 15/04/2016 (v1.0) |
| 3 |
% Hugo Gomes @ 15/03/2021 (v2.0.0) |
| 4 |
% Hugo Gomes @ 12/05/2021 (v2.1.0) |
| 5 |
% Hugo Gomes @ 27/06/2021 (v2.1.1) |
| 6 |
% Hugo Gomes @ 03/07/2021 (v2.1.2) |
| 7 |
% Hugo Gomes @ 21/02/2023 (v2.2.0) |
| 8 |
% Hugo Gomes @ 25/04/2023 (v3.0.0) |
| 9 |
% Hugo Gomes @ 27/04/2023 (v3.0.1) |
| 10 |
% Hugo Gomes @ 07/07/2024 (v3.0.1a) |
| 11 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 12 |
\NeedsTeXFormat{LaTeX2e}% |
| 13 |
\ProvidesPackage{pgf-spectra}[07/07/2024 pgf-spectra v3.0.1a]% |
| 14 |
\RequirePackage{tikz}% |
| 15 |
\DeclareOption{LSE}{\input{pgf-spectra.data.LSE.tex}\xdef\pgfspectra@DATASET{1}}% |
| 16 |
\DeclareOption{NIST}{\input{pgf-spectra.data.NIST.tex}\xdef\pgfspectra@DATASET{0}}% |
| 17 |
\ExecuteOptions{NIST}% |
| 18 |
\ProcessOptions\relax% |
| 19 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 20 |
\input{pgf-spectra.input.library.tex}% Loading the input library mechanism (new v3.0.0) |
| 21 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 22 |
\definecolor{pgfspectraIRcolor}{rgb}{.3157,.2373,.2373}% NEW v2.0.0 |
| 23 |
\definecolor{pgfspectraUVcolor}{rgb}{.3,.2568,.3}% NEW v2.0.0 |
| 24 |
% |
| 25 |
\newcount\pgfspectra@counta% tmp counter |
| 26 |
\newcount\pgfspectra@countb% tmp counter |
| 27 |
\newcount\pgfspectra@countc% tmp counter |
| 28 |
\newcount\pgfspectra@countd% tmp counter |
| 29 |
% |
| 30 |
\newif\ifpgfspectra@absorption% |
| 31 |
\newif\ifpgfspectra@cur@elem@exist% |
| 32 |
\newif\ifpgfspectra@drawaxis% |
| 33 |
\newif\ifpgfspectra@axislabel% spectra label ! |
| 34 |
\newif\ifpgfspectra@axisunitlabel% NEW v3.0.0 |
| 35 |
\newif\ifpgfspectra@intensity% |
| 36 |
\newif\ifpgfspectra@redshift% NEW v2.0.0 |
| 37 |
\newif\ifpgfspectra@RSvalue% NEW v2.0.0 |
| 38 |
\newif\ifpgfspectra@usevisibleshade% NEW v2.1.0 |
| 39 |
\newif\ifpgfspectra@visibleRangeOnly% NEW v2.2.0 |
| 40 |
\newif\ifpgfspectra@UVRangeOnly% NEW v2.2.0 |
| 41 |
\newif\ifpgfspectra@IRRangeOnly% NEW v2.2.0 |
| 42 |
\newif\ifpgfspectra@datanotfound% NEW v2.2.0 |
| 43 |
\newif\ifpgfspectra@band% NEW v3.0.0 |
| 44 |
\def\@pgfspectra@list@purge BEGIN,#1[#2]\relax{\expandafter\edef\csname#2\endcsname{#1}}% NEW v3.0.0 |
| 45 |
% defining PGF keys |
| 46 |
\pgfkeys{/pgfspectra/.cd,% |
| 47 |
element/.get=\pgfspectra@element,% |
| 48 |
element/.store in=\pgfspectra@element,% |
| 49 |
element/.default=NONE,% |
| 50 |
width/.get=\pgfspectra@width,% |
| 51 |
width/.store in=\pgfspectra@width,% |
| 52 |
width/.default={0.9\textwidth},% |
| 53 |
height/.get=\pgfspectra@height,% |
| 54 |
height/.store in=\pgfspectra@height,% |
| 55 |
height/.default=1cm,% |
| 56 |
back/.get=\pgfspectra@back,% |
| 57 |
back/.store in=\pgfspectra@back,% |
| 58 |
back/.default=black,% |
| 59 |
backIRUV/.get=\pgfspectra@backnotvisible,% NEW v2.0.0 |
| 60 |
backIRUV/.store in=\pgfspectra@backnotvisible,% NEW v2.0.0 |
| 61 |
backIRUV/.default=black,% NEW v2.0.0 |
| 62 |
backVIS/.get=\pgfspectra@backvisible,% NEW v2.1.0 |
| 63 |
backVIS/.store in=\pgfspectra@backvisible,% NEW v2.1.0 |
| 64 |
backVIS/.default=black,% NEW v2.1.0 |
| 65 |
IRcolor/.get=\pgfspectra@IRcolor,% NEW v2.0.0 |
| 66 |
IRcolor/.store in=\pgfspectra@IRcolor,% NEW v2.0.0 |
| 67 |
IRcolor/.default=pgfspectraIRcolor,% NEW v2.0.0 |
| 68 |
UVcolor/.get=\pgfspectra@UVcolor,% NEW v2.0.0 |
| 69 |
UVcolor/.store in=\pgfspectra@UVcolor,% NEW v2.0.0 |
| 70 |
UVcolor/.default=pgfspectraUVcolor,% NEW v2.0.0 |
| 71 |
charge/.get=\pgfspectra@charge,% |
| 72 |
charge/.store in=\pgfspectra@charge,% |
| 73 |
charge/.default=0,% |
| 74 |
Imin/.get=\pgfspectra@intmin,% |
| 75 |
Imin/.store in=\pgfspectra@intmin,% |
| 76 |
Imin/.default=0,% |
| 77 |
lines/.get=\pgfspectra@lines,% |
| 78 |
lines/.store in=\pgfspectra@lines,% |
| 79 |
lines/.default={},% |
| 80 |
line width/.get=\pgfspectra@linewidth,% |
| 81 |
line width/.store in=\pgfspectra@linewidth,% |
| 82 |
line width/.default=1pt,% |
| 83 |
begin/.get=\pgfspectra@begin,% |
| 84 |
begin/.store in=\pgfspectra@begin,% |
| 85 |
begin/.default=380,% |
| 86 |
end/.get=\pgfspectra@end,% |
| 87 |
end/.store in=\pgfspectra@end,% |
| 88 |
end/.default=780,% |
| 89 |
axis step/.get=\pgfspectra@axisstep,% |
| 90 |
axis step/.store in=\pgfspectra@axisstep,% |
| 91 |
axis step/.default=20,% |
| 92 |
axis unit/.get=\pgfspectra@axisunit,% NEW v2.1.0 |
| 93 |
axis unit/.store in=\pgfspectra@axisunit,% NEW v2.1.0 |
| 94 |
axis unit/.default=nm,% NEW v2.1.0 |
| 95 |
axis unit precision/.get=\pgfspectra@axisunitprecision,% NEW v2.1.0 |
| 96 |
axis unit precision/.store in=\pgfspectra@axisunitprecision,% NEW v2.1.0 |
| 97 |
axis unit precision/.default=3,% NEW v2.1.0 |
| 98 |
axis ticks/.get=\pgfspectra@axisticks,% NEW v2.0.0 |
| 99 |
axis ticks/.store in=\pgfspectra@axisticks,% NEW v2.0.0 |
| 100 |
axis ticks/.default=0,% NEW v2.0.0 |
| 101 |
axis label text/.get=\pgfspectra@axislabeltxt,% NEW v3.0.0 |
| 102 |
axis label text/.store in=\pgfspectra@axislabeltxt,% NEW v3.0.0 |
| 103 |
axis label text/.default={},% NEW v3.0.0 |
| 104 |
axis label position/.get=\pgfspectra@axislabelposition,% NEW v3.0.0 |
| 105 |
axis label position/.store in=\pgfspectra@axislabelposition,% NEW v3.0.0 |
| 106 |
axis label position/.default=center,% NEW v3.0.0 |
| 107 |
axis color/.get=\pgfspectra@axiscolor,% |
| 108 |
axis color/.store in=\pgfspectra@axiscolor,% |
| 109 |
axis color/.default=black,% |
| 110 |
axis font/.get=\pgfspectra@axisfont,% |
| 111 |
axis font/.store in=\pgfspectra@axisfont,% |
| 112 |
axis font/.default={\tiny},% |
| 113 |
axis font color/.get=\pgfspectra@axisfontcolor,% |
| 114 |
axis font color/.store in=\pgfspectra@axisfontcolor,% |
| 115 |
axis font color/.default=white,% |
| 116 |
label position/.get=\pgfspectra@labelposition,% |
| 117 |
label position/.store in=\pgfspectra@labelposition,% |
| 118 |
label position/.default={west},% |
| 119 |
label before text/.get=\pgfspectra@labelbtext,% |
| 120 |
label before text/.store in=\pgfspectra@labelbtext,% |
| 121 |
label before text/.default={},% |
| 122 |
label after text/.get=\pgfspectra@labelatext,% |
| 123 |
label after text/.store in=\pgfspectra@labelatext,% |
| 124 |
label after text/.default={},% |
| 125 |
label font/.get=\pgfspectra@labelfont,% |
| 126 |
label font/.store in=\pgfspectra@labelfont,% |
| 127 |
label font/.default={\bfseries\small},% |
| 128 |
label font color/.get=\pgfspectra@labelfontcolor,% |
| 129 |
label font color/.store in=\pgfspectra@labelfontcolor,% |
| 130 |
label font color/.default=black,% |
| 131 |
gamma/.get=\pgfspectra@gamma,% |
| 132 |
gamma/.store in=\pgfspectra@gamma,% |
| 133 |
gamma/.default=0.8,% |
| 134 |
brightness/.get=\pgfspectra@brightness,% |
| 135 |
brightness/.store in=\pgfspectra@brightness,% |
| 136 |
brightness/.default=1,% |
| 137 |
line intensity/.get=\pgfspectra@lineint,% |
| 138 |
line intensity/.store in=\pgfspectra@lineint,% |
| 139 |
line intensity/.default=100,% |
| 140 |
relative intensity threshold/.get=\pgfspectra@relintthresh,% |
| 141 |
relative intensity threshold/.store in=\pgfspectra@relintthresh,% |
| 142 |
relative intensity threshold/.default=0.25,% |
| 143 |
absorption/.is if=pgfspectra@absorption,% |
| 144 |
axis/.is if=pgfspectra@drawaxis,% |
| 145 |
axis label/.is if=pgfspectra@axisunitlabel,% NEW v2.0.0 |
| 146 |
label/.is if=pgfspectra@axislabel,% |
| 147 |
relative intensity/.is if=pgfspectra@intensity,% |
| 148 |
redshift/.get=\pgfspectra@redshift,% NEW v2.0.0 |
| 149 |
redshift/.store in=\pgfspectra@redshift,% NEW v2.0.0 |
| 150 |
redshift/.default={},% NEW v2.0.0 |
| 151 |
show redshift value/.is if=pgfspectra@RSvalue,% NEW v2.0.0 |
| 152 |
use visible shading/.is if=pgfspectra@usevisibleshade,% NEW v2.1.0 |
| 153 |
precision/.get=\pgfspectra@precision,% NEW v3.0.0 (for data library) |
| 154 |
precision/.store in=\pgfspectra@precision,% NEW v3.0.0 (for data library) |
| 155 |
precision/.default=1,% NEW v3.0.0 (for data library) |
| 156 |
unit/.get=\pgfspectra@unit,% NEW v3.0.0 (for data library) |
| 157 |
unit/.store in=\pgfspectra@unit,% NEW v3.0.0 (for data library) |
| 158 |
unit/.default={}% NEW v3.0.0 (for data library) |
| 159 |
}% |
| 160 |
% setting keys with default values |
| 161 |
\pgfkeys{/pgfspectra/.cd,element,width,height,back,backIRUV,IRcolor,UVcolor,charge,Imin,lines,line width,begin,end,% NEW v2.0.0 -> backIRUV,IRcolor,UVcolor |
| 162 |
axis color,axis font,axis font color,axis step,axis unit,axis unit precision,axis ticks,% NEW v2.1.0 -> axis unit,axis unit precision |
| 163 |
axis label=false,axis label text,axis label position,% NEW v3.0.0 ->axis label,axis label text,axis label position |
| 164 |
label position,label before text,label after text,label font,label font color,gamma,brightness,line intensity,% |
| 165 |
relative intensity threshold,absorption=false,axis=false,label=false,relative intensity=false,redshift,show redshift value=false,% NEW v2.0.0 -> redshift, show redshift value |
| 166 |
use visible shading,backVIS,% NEW v2.1.0 -> use visible shading |
| 167 |
precision,unit% NEW v3.0.0 (for data library) |
| 168 |
}% |
| 169 |
% strings for \ifx tests |
| 170 |
\def\pgfspectra@wlN@NE{NONE}% |
| 171 |
\def\pgfspectra@ll{all}% |
| 172 |
\def\pgfspectra@visible{visible}% |
| 173 |
\def\pgfspectra@visible@list{visible,visible5,visible10,visible15,visible20,visible25,visible30,visible35,visible40,visible45,visible50,visible55,visible60,visible65,visible70,visible75,visible80,visible85,visible90,visible95,visible100}% |
| 174 |
\def\pgfspectra@label@position@list{west,north west,north,north east,east,south east,south,south west}% |
| 175 |
\def\pgfspectra@redshift@D{D}% NEW v2.0.0 |
| 176 |
\def\pgfspectra@axisunit@nm{nm}% NEW v2.1.0 |
| 177 |
\def\pgfspectra@axisunit@um{micron}% NEW v2.1.0 |
| 178 |
\def\pgfspectra@axisunit@A{A}% NEW v2.1.0 |
| 179 |
%%%% COMMANDS ------------------------------------------------------------------------------> |
| 180 |
% commands ################################################## |
| 181 |
\newif\ifpgfspectra@StyleIsDef\pgfspectra@StyleIsDeffalse% NEW v2.0.0 |
| 182 |
% \pgfspectraStyle[options]% NEW v2.0.0 |
| 183 |
\def\pgfspectraStyle[#1]{\pgfspectraStyleReset\pgfspectra@StyleIsDeftrue\relax\tikzset{/pgfspectra/.cd,#1}% |
| 184 |
\def\pgfspectra@DoStyle{\tikzset{/pgfspectra/.cd,#1}}% applies storing user style for future use |
| 185 |
}% NEW v2.0.0 |
| 186 |
% \pgfspectraStyleReset% NEW v2.0.0 |
| 187 |
\def\pgfspectraStyleReset{\pgfspectra@StyleIsDeffalse\tikzset{/pgfspectra/.cd,% |
| 188 |
element=NONE,width=0.9\textwidth,height=1cm,back=black,backIRUV=black,IRcolor=pgfspectraIRcolor,UVcolor=pgfspectraUVcolor,% |
| 189 |
charge=0,Imin=0,lines={},line width=1pt,begin=380,end=780,axis color=black,axis font=\tiny,axis font color=white,axis step=20,axis unit=nm,axis unit precision=3,axis ticks=0,label position=west,% NEW v2.1.0 -> axis unit,axis unit precision |
| 190 |
axis label=false,axis label text={},axis label position=center,% NEW v3.0.0 ->axis label,axis label text,axis label position |
| 191 |
label before text={},label after text={},label font=\bfseries\small,label font color=black,gamma=0.8,brightness=1,line intensity=100,% |
| 192 |
relative intensity threshold=0.25,absorption=false,axis=false,label=false,relative intensity=false,redshift={},show redshift value=false,% NEW v2.0.0 -> redshift, show redshift value |
| 193 |
use visible shading,backVIS=black,% NEW v2.1.0 -> use visible shading |
| 194 |
precision=1,unit={}% NEW v3.0.0 (for data library) |
| 195 |
}}% |
| 196 |
% --------------- The main command to draw the spectra ---------------------------------------- |
| 197 |
% \pgfspectra[options] |
| 198 |
\def\pgfspectra{\@ifnextchar[\pgfspectra@withoptions{\pgfspectra@nooptions}}% |
| 199 |
\def\pgfspectra@nooptions{\pgfspectra@continuous(0.9\textwidth,1cm)}% |
| 200 |
% ######################################################### |
| 201 |
\def\pgfspectra@continuous(#1,#2){\ignorespaces% |
| 202 |
\ifpgfspectra@usevisibleshade% NEW v2.1.0 |
| 203 |
\pgfspectrashade(380,780){pgfspectra@visibleshade}% |
| 204 |
\tikz{\fill[shading=pgfspectra@visibleshade] (0,0) rectangle (#1,#2);}% |
| 205 |
\else% |
| 206 |
\begin{tikzpicture}% |
| 207 |
\pgfmathparse{#1/400}\edef\pgfspectra@xscale{\pgfmathresult} |
| 208 |
\pgfmathparse{1.4*\pgfspectra@xscale+.09*\linewidth/\pgfspectra@width}\edef\pgfspectra@linewidth{\pgfmathresult}% NEW v2.0.0 {\pgfspectra@xscale} -> {1.4*\pgfspectra@xscale+.09*\linewidth/\pgfspectra@width} |
| 209 |
\foreach \x in {380,...,780}% |
| 210 |
{% |
| 211 |
\wlcolor{\x}% |
| 212 |
\pgfmathparse{(\x-380)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 213 |
\draw[pgfspectra@temp,line width=\pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,#2);% |
| 214 |
}% |
| 215 |
\end{tikzpicture}% |
| 216 |
\fi% |
| 217 |
}% |
| 218 |
% ######################################################### |
| 219 |
\def\pgfspectra@withoptions[#1]{\ignorespaces% |
| 220 |
% setting default values or user style |
| 221 |
\ifpgfspectra@StyleIsDef\pgfspectraStyleReset\pgfspectra@DoStyle\pgfspectra@StyleIsDeftrue\relax\else\pgfspectraStyleReset\relax\fi% NEW v2.0.0 |
| 222 |
% process options (key values) |
| 223 |
\pgfkeys{/pgfspectra/.cd,#1}% |
| 224 |
% axis height |
| 225 |
\setbox0=\hbox{\pgfspectra@axisfont\selectfont380}\edef\@pgfspectra@axis@height{\the\ht0}% |
| 226 |
% process visible background (visible+opacity) |
| 227 |
\pgfspectra@counta=0% |
| 228 |
\pgfspectra@countb=-1% |
| 229 |
\@for\@myarg:=\pgfspectra@visible@list\do{% |
| 230 |
\ifx\pgfspectra@back\@myarg\pgfspectra@countb=\pgfspectra@counta\fi% |
| 231 |
\advance\pgfspectra@counta by1% |
| 232 |
}% |
| 233 |
\ifnum\pgfspectra@countb=-1\edef\@visible@opacity{1}\else% NEW v2.0.0 |
| 234 |
\ifnum\pgfspectra@countb=0\let\pgfspectra@back\pgfspectra@visible\edef\@visible@opacity{.5}\else% |
| 235 |
\ifnum\pgfspectra@countb>0\let\pgfspectra@back\pgfspectra@visible\pgfmathparse{.05*\pgfspectra@countb}\edef\@visible@opacity{\pgfmathresult}\fi\fi\fi% |
| 236 |
% ---------------------------------------------------------------------------------------------------- |
| 237 |
% check limits... % NEW v2.0.0 |
| 238 |
\ifnum\pgfspectra@end<10\relax\def\wldez{10}\let\pgfspectra@end\wldez\fi% |
| 239 |
\ifnum\pgfspectra@end>4000\relax\def\wlquatromil{4000}\let\pgfspectra@end\wlquatromil\fi% |
| 240 |
\ifnum\pgfspectra@begin<10\relax\def\wldez{10}\let\pgfspectra@begin\wldez\fi% |
| 241 |
\ifnum\pgfspectra@begin>4000\relax\def\wlquatromil{4000}\let\pgfspectra@begin\wlquatromil\fi% |
| 242 |
% ---------------------------------------------------------------------------------------------------- |
| 243 |
% verifying redshift key |
| 244 |
\ifx\pgfspectra@redshift\@empty\relax% |
| 245 |
\pgfspectra@redshiftfalse% |
| 246 |
\else% |
| 247 |
\pgfspectra@processredshiftkey\pgfspectra@redshift\relax% |
| 248 |
\fi% |
| 249 |
% ---------------------------------------------------------------------------------------------------- |
| 250 |
% check if is only in visible range... or in UV... or in IV % NEW v2.2.0 |
| 251 |
\pgfspectra@visibleRangeOnlyfalse% |
| 252 |
\pgfspectra@UVRangeOnlyfalse% |
| 253 |
\pgfspectra@IRRangeOnlyfalse% |
| 254 |
\ifnum\pgfspectra@end>\pgfspectra@begin\relax% |
| 255 |
\ifnum\pgfspectra@end<380\relax% UV |
| 256 |
\pgfspectra@UVRangeOnlytrue% |
| 257 |
\else% VIS or IV |
| 258 |
\ifnum\pgfspectra@end<781\relax% |
| 259 |
\ifnum\pgfspectra@begin>379\relax\pgfspectra@visibleRangeOnlytrue\fi% VIS |
| 260 |
\else% |
| 261 |
\ifnum\pgfspectra@begin>780\relax\pgfspectra@IRRangeOnlytrue\fi% IR |
| 262 |
\fi% |
| 263 |
\fi% |
| 264 |
\else% |
| 265 |
\ifnum\pgfspectra@begin<380\relax% UV |
| 266 |
\pgfspectra@UVRangeOnlytrue% |
| 267 |
\else% VIS or IV |
| 268 |
\ifnum\pgfspectra@begin<781\relax% |
| 269 |
\ifnum\pgfspectra@end>379\relax\pgfspectra@visibleRangeOnlytrue\fi% VIS |
| 270 |
\else% |
| 271 |
\ifnum\pgfspectra@end>780\relax\pgfspectra@IRRangeOnlytrue\fi% IR |
| 272 |
\fi% |
| 273 |
\fi% |
| 274 |
\fi% |
| 275 |
% --------------------------------------------------------------------------------------------------- |
| 276 |
% check if the axis are labeled and if true sets \ifpgfspectra@drawaxis to true % NEW v3.0.0 |
| 277 |
\ifpgfspectra@axisunitlabel\pgfspectra@drawaxistrue\fi% |
| 278 |
\edef\pgfspectra@testa{\pgfspectra@axislabeltxt}\edef\pgfspectra@testb{}% |
| 279 |
\ifx\pgfspectra@testa\pgfspectra@testb\relax\else\pgfspectra@drawaxistrue\pgfspectra@axisunitlabeltrue\fi% |
| 280 |
% --------------------------------------------------------------------------------------------------- |
| 281 |
% if no element provided draws continuous spectrum with options or user list of lines |
| 282 |
\ifx\pgfspectra@element\pgfspectra@wlN@NE%no element by the user |
| 283 |
\ifx\pgfspectra@elt@chemsym\undefined\else\let\pgfspectra@elt@chemsym\undefined\fi% |
| 284 |
\ifx\pgfspectra@lines\@empty%no lines by the user => continuous spectrum |
| 285 |
% draws the continuous spectrum width options (default or by the user) |
| 286 |
\begin{tikzpicture}% |
| 287 |
\pgfkeys{/pgfspectra/.cd,#1}% NEW v2.0.0 |
| 288 |
\pgfmathparse{\pgfspectra@width/(abs(\pgfspectra@end-\pgfspectra@begin))}\edef\pgfspectra@xscale{\pgfmathresult}% |
| 289 |
\ifpgfspectra@drawaxis%draws the axis |
| 290 |
\pgfspectra@utils@draw@axis% |
| 291 |
\fi%\ifpgfspectra@drawaxis |
| 292 |
\ifpgfspectra@axislabel%put the label |
| 293 |
\pgfspectra@utils@put@label% |
| 294 |
\fi%\ifpgfspectra@axislabel |
| 295 |
\let\pgfspectra@back\pgfspectra@visible% |
| 296 |
\let\pgfspectra@background@UVcolor\pgfspectra@backnotvisible\let\pgfspectra@background@IRcolor\pgfspectra@backnotvisible\relax% |
| 297 |
\pgfspectra@utils@drawbackground{\@visible@opacity*\pgfspectra@brightness}% |
| 298 |
\end{tikzpicture}% |
| 299 |
\let\pgfspectra@list@@\@empty% |
| 300 |
\else% lines by the user |
| 301 |
% NEW v3.0.0: lines={wl_1,wl_2,wl_3 to wl_4,wl_5 to wl_6,...,wl_n} |
| 302 |
\def\pgfspectrag@bblespaces##1\relax{\edef\pgfspectra@lines{\zap@space##1 \@empty}}% |
| 303 |
\def\pgfspectra@isband##1to##2\relax{\edef\pgfspectra@testa{##2}\edef\pgfspectra@testb{}% |
| 304 |
\ifx\pgfspectra@testa\pgfspectra@testb\pgfspectra@bandfalse\else\pgfspectra@bandtrue\fi}% |
| 305 |
\expandafter\pgfspectrag@bblespaces\pgfspectra@lines\relax% |
| 306 |
\expandafter\pgfspectra@isband\pgfspectra@lines to\relax% |
| 307 |
\ifpgfspectra@band% BAND |
| 308 |
\def\pgfspectra@getband##1to##2\relax{\edef\pgfspectra@band@start{##1}\edef\pgfspectra@band@end{##2}}% |
| 309 |
\edef\pgfspectra@lines@tmp{BEGIN}% |
| 310 |
\@for\pgfspectra@tmp:=\pgfspectra@lines\do{% |
| 311 |
\expandafter\pgfspectra@isband\pgfspectra@tmp to\relax% |
| 312 |
\ifpgfspectra@band% |
| 313 |
\expandafter\pgfspectra@getband\pgfspectra@tmp\relax% |
| 314 |
\pgfmathparse{\pgfspectra@band@start+.5*\pgfspectra@linewidth}\edef\pgfspectra@band@step{\pgfmathresult}% |
| 315 |
\foreach \x in {\pgfspectra@band@start,\pgfspectra@band@step,...,\pgfspectra@band@end}{\xdef\pgfspectra@lines@tmp{\pgfspectra@lines@tmp,\x}}% |
| 316 |
\else\xdef\pgfspectra@lines@tmp{\pgfspectra@lines@tmp,\pgfspectra@tmp}\fi% |
| 317 |
}% |
| 318 |
\expandafter\@pgfspectra@list@purge \pgfspectra@lines@tmp[pgfspectra@list@@]\relax% |
| 319 |
\else%NOT BAND |
| 320 |
\edef\pgfspectra@list@@{\pgfspectra@lines}% |
| 321 |
\fi% |
| 322 |
\let\pgfspectra@background@UVcolor\pgfspectra@backnotvisible\let\pgfspectra@background@IRcolor\pgfspectra@backnotvisible\relax% |
| 323 |
\fi%\pgfspectra@lines\@empty |
| 324 |
\else%\pgfspectra@element\pgfspectra@wlN@NE |
| 325 |
% else get element(s) data |
| 326 |
\pgfspectra@countc=0% |
| 327 |
\pgfspectra@countd=1% |
| 328 |
\@for\@myarg:=\pgfspectra@element\do{\advance\pgfspectra@countc by1}%count number of elements |
| 329 |
\pgfspectra@addt@list{}{}% |
| 330 |
\@for\@myarg:=\pgfspectra@element\do{% |
| 331 |
\pgfspectra@cur@elem@existtrue% |
| 332 |
\def\pgfspectra@elt@chemsym{NOT FOUND!}% |
| 333 |
\def\@search@result@err{NOT FOUND!}% |
| 334 |
\pgfspectra@elt@data{\@myarg}\relax% |
| 335 |
% check if element provided exists |
| 336 |
\ifx\@search@result@err\pgfspectra@elt@chemsym Element\ ``\@myarg'' with charge ``\pgfspectra@charge'' not found!\pgfspectra@cur@elem@existfalse\else% |
| 337 |
% if exists, set the wavelength's list |
| 338 |
% CHANGED IN v2.2.0 to better accommodate relative intensities (also considering charges...) ----> |
| 339 |
\ifpgfspectra@UVRangeOnly% |
| 340 |
\expandafter\pgfspectra@getmaxint\pgfspectra@elt@Imax@UV\relax% |
| 341 |
\pgfspectra@setmaxint{UV}% |
| 342 |
\else\ifpgfspectra@visibleRangeOnly% |
| 343 |
\expandafter\pgfspectra@getmaxint\pgfspectra@elt@Imax@VIS\relax% |
| 344 |
\pgfspectra@setmaxint{VIS}% |
| 345 |
\else\ifpgfspectra@IRRangeOnly% |
| 346 |
\expandafter\pgfspectra@getmaxint\pgfspectra@elt@Imax@IR\relax% |
| 347 |
\pgfspectra@setmaxint{IR}% |
| 348 |
\else% |
| 349 |
\expandafter\pgfspectra@getmaxint\pgfspectra@elt@Imax@ALL\relax% |
| 350 |
\pgfspectra@setmaxint{ALL}% |
| 351 |
\fi\fi\fi% |
| 352 |
% <----- v2.0.0 |
| 353 |
\pgfspectra@set@element@list{\pgfspectra@elt@elemdata}{\pgfspectra@elt@Imax}% |
| 354 |
\fi%\@search@result@err\pgfspectra@elt@chemsym |
| 355 |
\ifpgfspectra@cur@elem@exist\ifnum\pgfspectra@countd<\pgfspectra@countc\pgfspectra@addt@list{\pgfspectra@list@@}{,}\fi\fi% |
| 356 |
\advance\pgfspectra@countd by1% |
| 357 |
}%end do |
| 358 |
\fi%\pgfspectra@element\pgfspectra@wlN@NE |
| 359 |
% check if there are lines to draw and make the spectrum |
| 360 |
\ifx\pgfspectra@list@@\@empty\ifx\pgfspectra@element\pgfspectra@wlN@NE\else Element\ ``\pgfspectra@element'' with charge ``\pgfspectra@charge'' have no lines to display.\fi\else% |
| 361 |
\ifpgfspectra@absorption%absortion spectrum |
| 362 |
\begin{tikzpicture}% |
| 363 |
\pgfkeys{/pgfspectra/.cd,#1}% NEW v2.0.0 |
| 364 |
\pgfmathparse{\pgfspectra@width/(abs(\pgfspectra@end-\pgfspectra@begin))}\edef\pgfspectra@xscale{\pgfmathresult}% |
| 365 |
\ifpgfspectra@drawaxis%draws the axis |
| 366 |
\pgfspectra@utils@draw@axis% |
| 367 |
\fi%\ifpgfspectra@drawaxis |
| 368 |
\ifpgfspectra@axislabel%put the label |
| 369 |
\pgfspectra@utils@put@label% |
| 370 |
\fi%\ifpgfspectra@axislabel |
| 371 |
\let\pgfspectra@back\pgfspectra@visible% |
| 372 |
\let\pgfspectra@background@UVcolor\pgfspectra@UVcolor\let\pgfspectra@background@IRcolor\pgfspectra@IRcolor\relax% |
| 373 |
\pgfspectra@utils@drawbackground{\pgfspectra@brightness}% |
| 374 |
% draws the lines |
| 375 |
\pgfspectra@utils@drawabsorptionlines% |
| 376 |
\end{tikzpicture}% |
| 377 |
\else%emission spectrum |
| 378 |
% draws the spectrum |
| 379 |
\ifx\pgfspectra@back\pgfspectra@visible%visible background |
| 380 |
\begin{tikzpicture}% |
| 381 |
\pgfkeys{/pgfspectra/.cd,#1}% NEW v2.0.0 |
| 382 |
\pgfmathparse{\pgfspectra@width/(abs(\pgfspectra@end-\pgfspectra@begin))}\edef\pgfspectra@xscale{\pgfmathresult}% |
| 383 |
\ifpgfspectra@drawaxis%draws the axis |
| 384 |
\pgfspectra@utils@draw@axis% |
| 385 |
\fi%\ifpgfspectra@drawaxis |
| 386 |
\ifpgfspectra@axislabel%put the label |
| 387 |
\pgfspectra@utils@put@label% |
| 388 |
\fi%\ifpgfspectra@axislabel |
| 389 |
\let\pgfspectra@background@UVcolor\pgfspectra@backnotvisible\let\pgfspectra@background@IRcolor\pgfspectra@backnotvisible\relax% |
| 390 |
\pgfspectra@utils@drawbackground{\@visible@opacity*\pgfspectra@brightness}% |
| 391 |
\pgfspectra@utils@drawemissionlines% emission lines |
| 392 |
\end{tikzpicture}% |
| 393 |
\else%without visible background |
| 394 |
\begin{tikzpicture}% |
| 395 |
\pgfkeys{/pgfspectra/.cd,#1}% NEW v2.0.0 |
| 396 |
\pgfmathparse{\pgfspectra@width/(abs(\pgfspectra@end-\pgfspectra@begin))}\edef\pgfspectra@xscale{\pgfmathresult}% |
| 397 |
\ifpgfspectra@drawaxis%draws the axis |
| 398 |
\pgfspectra@utils@draw@axis% |
| 399 |
\fi%\ifpgfspectra@drawaxis |
| 400 |
\ifpgfspectra@axislabel%put the label |
| 401 |
\pgfspectra@utils@put@label% |
| 402 |
\fi%\ifpgfspectra@axislabel |
| 403 |
\let\pgfspectra@background@UVcolor\pgfspectra@backnotvisible\let\pgfspectra@background@IRcolor\pgfspectra@backnotvisible\relax% |
| 404 |
\pgfspectra@utils@drawbackground{0}% dummy argument |
| 405 |
\pgfspectra@utils@drawemissionlines% emission lines |
| 406 |
\end{tikzpicture}% |
| 407 |
\fi%\pgfspectra@back\@visible |
| 408 |
\fi%\ifpgfspectra@absorption |
| 409 |
\fi% \pgfspectra@list@@\@empty |
| 410 |
}% |
| 411 |
% ######################################################### |
| 412 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 413 |
% get individual line data from one element of the array data |
| 414 |
\def\pgfspectra@get@line@info[#1 #2 #3]{% |
| 415 |
\def\pgfspectra@currentline@wl{#1}% return |
| 416 |
\def\pgfspectra@currentline@int{#2}% return |
| 417 |
\def\pgfspectra@currentline@charge{#3}% return |
| 418 |
}% |
| 419 |
% ######################################################### |
| 420 |
% ################### \pgfspectra@set@element@list ################## |
| 421 |
% ######################################################### |
| 422 |
% |
| 423 |
% \pgfspectra@set@element@list{\pgfspectra@elt@elemdata}{\pgfspectra@elt@Imax} |
| 424 |
% RETURN: \pgfspectra@list@@ -> (wl1,wl2,...) |
| 425 |
% or if relative intensity true (between 0 and 1) |
| 426 |
% \pgfspectra@list@@ -> (wl1/int1,wl2/int2,...) |
| 427 |
% |
| 428 |
\newif\ifpgfspectra@first% for first ocurrence of Imin |
| 429 |
\def\pgfspectra@set@element@list#1#2{\ignorespaces% \pgfspectra@elt@Imax |
| 430 |
\pgfspectra@firsttrue% |
| 431 |
\pgfspectra@counta=0% |
| 432 |
\pgfspectra@countb=1% |
| 433 |
\pgfmathparse{int(\pgfspectra@intmin*100)}\edef\@pgfspectra@intmin{\pgfmathresult}%intensity percentage |
| 434 |
\ifnum\@pgfspectra@intmin=0% include all intensities |
| 435 |
\ifx\pgfspectra@ll\pgfspectra@charge%ALL lines |
| 436 |
\@for\@myarg:=#1\do{\advance\pgfspectra@counta by1}%count all entries |
| 437 |
\ifpgfspectra@intensity% |
| 438 |
\@for\@myarg:=#1% |
| 439 |
\do{% |
| 440 |
\expandafter\pgfspectra@get@line@info\@myarg% |
| 441 |
\pgfmathparse{\pgfspectra@relintthresh+(1-\pgfspectra@relintthresh)*\pgfspectra@currentline@int/#2}\edef\pgfspectra@intensity@to@list{\pgfmathresult}% |
| 442 |
\ifnum\pgfspectra@countb<\pgfspectra@counta\pgfspectra@addt@list{\pgfspectra@list@@}{\pgfspectra@currentline@wl/\pgfspectra@intensity@to@list,}\else% |
| 443 |
\pgfspectra@addt@list{\pgfspectra@list@@}{\pgfspectra@currentline@wl/\pgfspectra@intensity@to@list}\fi% |
| 444 |
\advance\pgfspectra@countb by1% |
| 445 |
}%END do |
| 446 |
\else% |
| 447 |
\@for\@myarg:=#1% |
| 448 |
\do{% |
| 449 |
\expandafter\pgfspectra@get@line@info\@myarg% |
| 450 |
\ifnum\pgfspectra@countb<\pgfspectra@counta\pgfspectra@addt@list{\pgfspectra@list@@}{\pgfspectra@currentline@wl,}\else% |
| 451 |
\pgfspectra@addt@list{\pgfspectra@list@@}{\pgfspectra@currentline@wl}\fi% |
| 452 |
\advance\pgfspectra@countb by1% |
| 453 |
}%END do |
| 454 |
\fi% |
| 455 |
\else% lines for one specific charge |
| 456 |
\@for\@myarg:=#1\do{\expandafter\pgfspectra@get@line@info\@myarg\ifx\pgfspectra@currentline@charge\pgfspectra@charge\advance\pgfspectra@counta by 1\fi}%count only if is the desired charge |
| 457 |
\ifpgfspectra@intensity% |
| 458 |
\@for\@myarg:=#1% |
| 459 |
\do{% |
| 460 |
\expandafter\pgfspectra@get@line@info\@myarg% |
| 461 |
\pgfmathparse{\pgfspectra@relintthresh+(1-\pgfspectra@relintthresh)*\pgfspectra@currentline@int/#2}\edef\pgfspectra@intensity@to@list{\pgfmathresult}% |
| 462 |
\ifx\pgfspectra@currentline@charge\pgfspectra@charge%add to list if is the desired charge |
| 463 |
\ifnum\pgfspectra@countb<\pgfspectra@counta\pgfspectra@addt@list{\pgfspectra@list@@}{\pgfspectra@currentline@wl/\pgfspectra@intensity@to@list,}\else% |
| 464 |
\pgfspectra@addt@list{\pgfspectra@list@@}{\pgfspectra@currentline@wl/\pgfspectra@intensity@to@list}\fi% |
| 465 |
\advance\pgfspectra@countb by 1% |
| 466 |
\fi% |
| 467 |
}%END do |
| 468 |
\else% |
| 469 |
\@for\@myarg:=#1% |
| 470 |
\do{% |
| 471 |
\expandafter\pgfspectra@get@line@info\@myarg% |
| 472 |
\ifx\pgfspectra@currentline@charge\pgfspectra@charge%add to list if is the desired charge |
| 473 |
\ifnum\pgfspectra@countb<\pgfspectra@counta\pgfspectra@addt@list{\pgfspectra@list@@}{\pgfspectra@currentline@wl,}\else% |
| 474 |
\pgfspectra@addt@list{\pgfspectra@list@@}{\pgfspectra@currentline@wl}\fi% |
| 475 |
\advance\pgfspectra@countb by 1% |
| 476 |
\fi% |
| 477 |
}%END do |
| 478 |
\fi% |
| 479 |
\fi% |
| 480 |
\else%\pgfspectra@intmin>0 & \pgfspectra@intmin<1 |
| 481 |
\ifnum\@pgfspectra@intmin>100\else% |
| 482 |
\pgfmathparse{\pgfspectra@intmin*#2}\edef\pgfspectra@actual@int{\pgfmathresult}% |
| 483 |
\ifx\pgfspectra@ll\pgfspectra@charge%ALL lines |
| 484 |
\@for\@myarg:=#1\do{\advance\pgfspectra@counta by 1}%count all entries |
| 485 |
\ifpgfspectra@intensity% |
| 486 |
\@for\@myarg:=#1% |
| 487 |
\do{% |
| 488 |
\expandafter\pgfspectra@get@line@info\@myarg% |
| 489 |
\pgfmathparse{notless(\pgfspectra@currentline@int,\pgfspectra@actual@int)}\relax\edef\pgfspectra@int@result{\pgfmathresult}% |
| 490 |
\ifnum\pgfspectra@int@result=1% |
| 491 |
\pgfmathparse{\pgfspectra@relintthresh+(1-\pgfspectra@relintthresh)*\pgfspectra@currentline@int/#2}\edef\pgfspectra@intensity@to@list{\pgfmathresult}% |
| 492 |
\ifpgfspectra@first\pgfspectra@addt@list{\pgfspectra@list@@}{\pgfspectra@currentline@wl/\pgfspectra@intensity@to@list}\else% |
| 493 |
\pgfspectra@addt@list{\pgfspectra@list@@}{,\pgfspectra@currentline@wl/\pgfspectra@intensity@to@list}\fi% |
| 494 |
\ifpgfspectra@first\pgfspectra@firstfalse\fi% |
| 495 |
\fi% |
| 496 |
\advance\pgfspectra@countb by 1% |
| 497 |
}%END do |
| 498 |
\else% |
| 499 |
\@for\@myarg:=#1% |
| 500 |
\do{% |
| 501 |
\expandafter\pgfspectra@get@line@info\@myarg% |
| 502 |
\pgfmathparse{notless(\pgfspectra@currentline@int,\pgfspectra@actual@int)}\relax\edef\pgfspectra@int@result{\pgfmathresult}% |
| 503 |
\ifnum\pgfspectra@int@result=1% |
| 504 |
\ifpgfspectra@first\pgfspectra@addt@list{\pgfspectra@list@@}{\pgfspectra@currentline@wl}\else% |
| 505 |
\pgfspectra@addt@list{\pgfspectra@list@@}{,\pgfspectra@currentline@wl}\fi% |
| 506 |
\ifpgfspectra@first\pgfspectra@firstfalse\fi% |
| 507 |
\fi% |
| 508 |
\advance\pgfspectra@countb by 1% |
| 509 |
}%END do |
| 510 |
\fi% |
| 511 |
\else% lines for one specific charge |
| 512 |
\@for\@myarg:=#1\do{\expandafter\pgfspectra@get@line@info\@myarg\ifx\pgfspectra@currentline@charge\pgfspectra@charge\advance\pgfspectra@counta by 1\fi}%count only if is the desired charge |
| 513 |
\ifpgfspectra@intensity% |
| 514 |
\@for\@myarg:=#1% |
| 515 |
\do{% |
| 516 |
\expandafter\pgfspectra@get@line@info\@myarg% |
| 517 |
\ifx\pgfspectra@currentline@charge\pgfspectra@charge%add to list if is the desired charge |
| 518 |
\pgfmathparse{notless(\pgfspectra@currentline@int,\pgfspectra@actual@int)}\edef\pgfspectra@int@result{\pgfmathresult}% |
| 519 |
\ifnum\pgfspectra@int@result=1% |
| 520 |
\pgfmathparse{\pgfspectra@relintthresh+(1-\pgfspectra@relintthresh)*\pgfspectra@currentline@int/#2}\edef\pgfspectra@intensity@to@list{\pgfmathresult}% |
| 521 |
\ifpgfspectra@first\pgfspectra@addt@list{\pgfspectra@list@@}{\pgfspectra@currentline@wl/\pgfspectra@intensity@to@list}\else% |
| 522 |
\pgfspectra@addt@list{\pgfspectra@list@@}{,\pgfspectra@currentline@wl/\pgfspectra@intensity@to@list}\fi% |
| 523 |
\ifpgfspectra@first\pgfspectra@firstfalse\fi% |
| 524 |
\fi% |
| 525 |
\advance\pgfspectra@countb by 1% |
| 526 |
\fi% |
| 527 |
}%END do |
| 528 |
\else% |
| 529 |
\@for\@myarg:=#1% |
| 530 |
\do{% |
| 531 |
\expandafter\pgfspectra@get@line@info\@myarg% |
| 532 |
\ifx\pgfspectra@currentline@charge\pgfspectra@charge%add to list if is the desired charge |
| 533 |
\pgfmathparse{notless(\pgfspectra@currentline@int,\pgfspectra@actual@int)}\edef\pgfspectra@int@result{\pgfmathresult}% |
| 534 |
\ifnum\pgfspectra@int@result=1% |
| 535 |
\ifpgfspectra@first\pgfspectra@addt@list{\pgfspectra@list@@}{\pgfspectra@currentline@wl}\else% |
| 536 |
\pgfspectra@addt@list{\pgfspectra@list@@}{,\pgfspectra@currentline@wl}\fi% |
| 537 |
\ifpgfspectra@first\pgfspectra@firstfalse\fi% |
| 538 |
\fi% |
| 539 |
\advance\pgfspectra@countb by 1% |
| 540 |
\fi% |
| 541 |
}%END do |
| 542 |
\fi% |
| 543 |
\fi% |
| 544 |
\fi% |
| 545 |
\fi% |
| 546 |
}% |
| 547 |
% add to list |
| 548 |
\def\pgfspectra@addt@list#1#2{\edef\pgfspectra@list@@{#1#2}}% |
| 549 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 550 |
% internal utils |
| 551 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 552 |
\def\pgfspectra@utils@draw@axis{\ignorespaces% |
| 553 |
% axis unit -> NEW v2.1.0 |
| 554 |
\pgfkeys{/pgf/number format/.cd,fixed,precision=\pgfspectra@axisunitprecision,set thousands separator={},assume math mode=true}% |
| 555 |
\ifx\pgfspectra@axisunit\pgfspectra@axisunit@nm\relax% |
| 556 |
\def\pgfspectra@axisunit@scale{1}\def\pgfspectra@axisunit@addzeros{}% |
| 557 |
\ifpgfspectra@axisunitlabel\def\pgfspectra@axilabelsunit{$nm$}\fi% |
| 558 |
\else\ifx\pgfspectra@axisunit\pgfspectra@axisunit@um\relax% |
| 559 |
\def\pgfspectra@axisunit@scale{1000}\def\pgfspectra@axisunit@addzeros{}\pgfkeys{/pgf/number format/.cd,fixed zerofill}% |
| 560 |
\ifpgfspectra@axisunitlabel\def\pgfspectra@axilabelsunit{$\mu m$}\fi% |
| 561 |
\else\ifx\pgfspectra@axisunit\pgfspectra@axisunit@A\relax% |
| 562 |
\def\pgfspectra@axisunit@scale{1}\def\pgfspectra@axisunit@addzeros{0}% probably not the best solution to overcome the TeX dimension limit values (16384pt)... but works! |
| 563 |
\ifpgfspectra@axisunitlabel\edef\pgfspectra@axilabelsunit{\AA}\fi% |
| 564 |
\fi\fi\fi% |
| 565 |
\ifnum\pgfspectra@begin>\pgfspectra@end% |
| 566 |
% New xshift={-2.5*\@pgfspectra@axis@height} to hold bigger numbers, e.g. 2500 |
| 567 |
\draw[draw=none,fill=\pgfspectra@axiscolor] ([xshift={2.5*\@pgfspectra@axis@height}]0,\pgfspectra@height+2.5pt) rectangle ([xshift={-2.5*\@pgfspectra@axis@height}]-\pgfspectra@width,-2.5*\@pgfspectra@axis@height);% |
| 568 |
% minor ticks -> NEW v2.0.0 -> improved in v3.0.0 -> the width of ticks is now dependent of \pgfspectra@linewidth |
| 569 |
\ifnum\pgfspectra@axisticks>0\relax% |
| 570 |
\pgfmathparse{\pgfspectra@end+\pgfspectra@axisstep/(\pgfspectra@axisticks+1)}\pgfmathparse{int(\pgfmathresult)}% |
| 571 |
\edef\@axis@list{\pgfspectra@end,\pgfmathresult,...,\pgfspectra@begin}% |
| 572 |
\foreach \x in \@axis@list% |
| 573 |
{% |
| 574 |
\pgfmathparse{(\pgfspectra@end-\x)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 575 |
\draw[\pgfspectra@axisfontcolor!80!transparent,line width={.25*\pgfspectra@linewidth}] (\pgfspectra@currentx,-.375*\@pgfspectra@axis@height) -- ++(0,.375*\@pgfspectra@axis@height);% |
| 576 |
}% |
| 577 |
\fi% |
| 578 |
\pgfmathparse{\pgfspectra@end+\pgfspectra@axisstep}\pgfmathparse{int(\pgfmathresult)}% |
| 579 |
\edef\@axis@list{\pgfspectra@end,\pgfmathresult,...,\pgfspectra@begin}% |
| 580 |
\foreach \x in \@axis@list% |
| 581 |
{% |
| 582 |
\pgfmathparse{(\pgfspectra@end-\x)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 583 |
\draw[\pgfspectra@axisfontcolor,line width=\pgfspectra@linewidth] (\pgfspectra@currentx,-.75*\@pgfspectra@axis@height) -- ++(0,.75*\@pgfspectra@axis@height);% |
| 584 |
\pgfmathparse{\x/\pgfspectra@axisunit@scale}\edef\pgfspectra@xscaledvalue{\pgfmathresult}% NEW v2.1.0 |
| 585 |
\node[\pgfspectra@axisfontcolor,font=\pgfspectra@axisfont,above,inner sep=0pt] at (\pgfspectra@currentx,-2.25*\@pgfspectra@axis@height) {\pgfmathprintnumber{\pgfspectra@xscaledvalue}\pgfspectra@axisunit@addzeros};% |
| 586 |
}% |
| 587 |
\else% |
| 588 |
\draw[draw=none,fill=\pgfspectra@axiscolor] ([xshift={-2.5*\@pgfspectra@axis@height}]0,\pgfspectra@height+2.5pt) rectangle ([xshift={2.5*\@pgfspectra@axis@height}]\pgfspectra@width,-2.5*\@pgfspectra@axis@height);% |
| 589 |
% minor ticks -> NEW v2.0.0 |
| 590 |
\ifnum\pgfspectra@axisticks>0\relax% |
| 591 |
\pgfmathparse{\pgfspectra@begin+\pgfspectra@axisstep/(\pgfspectra@axisticks+1)}\pgfmathparse{int(\pgfmathresult)}% |
| 592 |
\edef\@axis@list{\pgfspectra@begin,\pgfmathresult,...,\pgfspectra@end}% |
| 593 |
\foreach \x in \@axis@list% |
| 594 |
{% |
| 595 |
\pgfmathparse{(\x-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 596 |
\draw[\pgfspectra@axisfontcolor!80!transparent,line width={.25*\pgfspectra@linewidth}] (\pgfspectra@currentx,-.375*\@pgfspectra@axis@height) -- ++(0,.375*\@pgfspectra@axis@height);% |
| 597 |
}% |
| 598 |
\fi% |
| 599 |
\pgfmathparse{\pgfspectra@begin+\pgfspectra@axisstep}\pgfmathparse{int(\pgfmathresult)}% |
| 600 |
\edef\@axis@list{\pgfspectra@begin,\pgfmathresult,...,\pgfspectra@end}% |
| 601 |
\foreach \x in \@axis@list% |
| 602 |
{% |
| 603 |
\pgfmathparse{(\x-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 604 |
\draw[\pgfspectra@axisfontcolor,line width=\pgfspectra@linewidth] (\pgfspectra@currentx,-.75*\@pgfspectra@axis@height) -- ++(0,.75*\@pgfspectra@axis@height);% |
| 605 |
\pgfmathparse{\x/\pgfspectra@axisunit@scale}\edef\pgfspectra@xscaledvalue{\pgfmathresult}% NEW v2.1.0 |
| 606 |
\node[\pgfspectra@axisfontcolor,font=\pgfspectra@axisfont,above,inner sep=0pt] at (\pgfspectra@currentx,-2.25*\@pgfspectra@axis@height) {\pgfmathprintnumber{\pgfspectra@xscaledvalue}\pgfspectra@axisunit@addzeros};% |
| 607 |
}% |
| 608 |
\fi% |
| 609 |
% axis label -> NEW v3.0.0 |
| 610 |
\ifpgfspectra@axisunitlabel% |
| 611 |
\edef\pgfspectra@testa{\pgfspectra@axislabeltxt}% |
| 612 |
\ifx\pgfspectra@testa\@empty\relax% |
| 613 |
\edef\pgfspectra@axislabeltxt{$\lambda\,($\pgfspectra@axilabelsunit$)$}% |
| 614 |
\fi% |
| 615 |
\edef\pgfspectra@testa{\pgfspectra@axislabelposition}% |
| 616 |
\edef\pgfspectra@testb{center}% |
| 617 |
\ifx\pgfspectra@testa\pgfspectra@testb\relax% |
| 618 |
\pgfmathparse{sign(\pgfspectra@end-\pgfspectra@begin)*0.5*\pgfspectra@width}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 619 |
\edef\pgfspectra@currentpos{below}% |
| 620 |
\edef\pgfspectra@currentxshift{0pt}% |
| 621 |
\else\edef\pgfspectra@testb{right}% |
| 622 |
\ifx\pgfspectra@testa\pgfspectra@testb\relax% |
| 623 |
\pgfmathparse{sign(\pgfspectra@end-\pgfspectra@begin)*\pgfspectra@width}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 624 |
\edef\pgfspectra@currentpos{below left} |
| 625 |
\pgfmathparse{2.5*\@pgfspectra@axis@height}\edef\pgfspectra@currentxshift{\pgfmathresult pt}% |
| 626 |
\else\edef\pgfspectra@testb{left}% |
| 627 |
\ifx\pgfspectra@testa\pgfspectra@testb\relax% |
| 628 |
\edef\pgfspectra@currentx{0pt}% |
| 629 |
\edef\pgfspectra@currentpos{below right}% |
| 630 |
\pgfmathparse{-2.5*\@pgfspectra@axis@height}\edef\pgfspectra@currentxshift{\pgfmathresult pt}% |
| 631 |
\else% |
| 632 |
\PackageError{pgf-spectra}{Unknown '\pgfspectra@testa' axis label position. Default (center) will be used...}{}% |
| 633 |
\pgfmathparse{sign(\pgfspectra@end-\pgfspectra@begin)*0.5*\pgfspectra@width}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 634 |
\edef\pgfspectra@currentpos{below}% |
| 635 |
\edef\pgfspectra@currentxshift{0pt}% |
| 636 |
\fi\fi\fi% |
| 637 |
{\pgfspectra@axisfont\selectfont\pgfmathparse{ceil(4/3*height("()"))}\xdef\pgfspectra@axisfont@ht{\pgfmathresult pt}}% |
| 638 |
\fill[\pgfspectra@axiscolor] (-2.5*\@pgfspectra@axis@height,-2.5*\@pgfspectra@axis@height) rectangle % |
| 639 |
++(\pgfspectra@width+5*\@pgfspectra@axis@height,-\pgfspectra@axisfont@ht-4pt);% |
| 640 |
\node[\pgfspectra@currentpos,\pgfspectra@axisfontcolor,font=\pgfspectra@axisfont,inner ysep=2pt,inner xsep=1pt] at ([xshift=\pgfspectra@currentxshift]\pgfspectra@currentx,-2.5*\@pgfspectra@axis@height) {\pgfspectra@axislabeltxt};% |
| 641 |
\fi% |
| 642 |
}% |
| 643 |
\def\pgfspectra@utils@put@label{\ignorespaces% |
| 644 |
\ifx\pgfspectra@elt@chemsym\undefined\def\pgfspectra@elt@chemsym{}\else\fi% |
| 645 |
\pgfspectra@get@label@position% |
| 646 |
\ifnum\pgfspectra@begin>\pgfspectra@end% |
| 647 |
\ifcase\pgfspectra@label@position% |
| 648 |
%west |
| 649 |
\ifpgfspectra@drawaxis%\ifpgfspectra@axislabel% |
| 650 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,left,minimum width=2.1em,align=right] at (-2.5*\@pgfspectra@axis@height-\pgfspectra@width,0.5*\[email protected]*\@pgfspectra@axis@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 651 |
\else% |
| 652 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,left,minimum width=2.1em,align=right] at (-\pgfspectra@width,0.5*\pgfspectra@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 653 |
\fi% |
| 654 |
\or%north west |
| 655 |
\ifpgfspectra@drawaxis% |
| 656 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,above right,inner xsep=0pt] at (-2.5*\@pgfspectra@axis@height-\pgfspectra@width,\pgfspectra@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 657 |
\else% |
| 658 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,above right,inner xsep=0pt] at (-\pgfspectra@width,\pgfspectra@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 659 |
\fi% |
| 660 |
\or%north |
| 661 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,above] at (-0.5*\pgfspectra@width,\pgfspectra@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 662 |
\or%north east |
| 663 |
\ifpgfspectra@drawaxis% |
| 664 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,above left,inner xsep=0pt] at (2.5*\@pgfspectra@axis@height,\pgfspectra@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 665 |
\else% |
| 666 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,above left,inner xsep=0pt] at (0,\pgfspectra@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 667 |
\fi |
| 668 |
\or%east |
| 669 |
\ifpgfspectra@drawaxis% |
| 670 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,right] at (2.5*\@pgfspectra@axis@height,0.5*\[email protected]*\@pgfspectra@axis@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 671 |
\else% |
| 672 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,right] at (0,0.5*\pgfspectra@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 673 |
\fi% |
| 674 |
\or%south east |
| 675 |
\ifpgfspectra@drawaxis% |
| 676 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,below left,inner xsep=0pt] at (2.5*\@pgfspectra@axis@height,-2.5*\@pgfspectra@axis@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 677 |
\else% |
| 678 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,below left,inner xsep=0pt] at (0,0) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 679 |
\fi% |
| 680 |
\or%south |
| 681 |
\ifpgfspectra@drawaxis% |
| 682 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,below] at (-0.5*\pgfspectra@width,-2.5*\@pgfspectra@axis@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 683 |
\else% |
| 684 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,below] at (-0.5*\pgfspectra@width,0) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 685 |
\fi% |
| 686 |
\or%south west |
| 687 |
\ifpgfspectra@drawaxis% |
| 688 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,below right,inner xsep=0pt] at (-2.5*\@pgfspectra@axis@height-\pgfspectra@width,-2.5*\@pgfspectra@axis@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 689 |
\else% |
| 690 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,below right,inner xsep=0pt] at (-\pgfspectra@width,0) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 691 |
\fi% |
| 692 |
\fi% |
| 693 |
\else% |
| 694 |
\ifcase\pgfspectra@label@position% |
| 695 |
%west |
| 696 |
\ifpgfspectra@drawaxis% |
| 697 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,left,minimum width=2.1em,align=right] at (-2.5*\@pgfspectra@axis@height,0.5*\[email protected]*\@pgfspectra@axis@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 698 |
\else% |
| 699 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,left,minimum width=2.1em,align=right] at (0,0.5*\pgfspectra@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 700 |
\fi% |
| 701 |
\or%north west |
| 702 |
\ifpgfspectra@drawaxis% |
| 703 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,above right,inner xsep=0pt] at (-2.5*\@pgfspectra@axis@height,\pgfspectra@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 704 |
\else% |
| 705 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,above right,inner xsep=0pt] at (0,\pgfspectra@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 706 |
\fi% |
| 707 |
\or%north |
| 708 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,above] at (0.5*\pgfspectra@width,\pgfspectra@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 709 |
\or%north east |
| 710 |
\ifpgfspectra@drawaxis% |
| 711 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,above left,inner xsep=0pt] at (\pgfspectra@width+2.5*\@pgfspectra@axis@height,\pgfspectra@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 712 |
\else% |
| 713 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,above left,inner xsep=0pt] at (\pgfspectra@width,\pgfspectra@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 714 |
\fi% |
| 715 |
\or%east |
| 716 |
\ifpgfspectra@drawaxis% |
| 717 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,right] at ([xshift={2.5*\@pgfspectra@axis@height}]\pgfspectra@width,0.5*\[email protected]*\@pgfspectra@axis@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 718 |
\else% |
| 719 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,right] at (\pgfspectra@width,0.5*\pgfspectra@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 720 |
\fi% |
| 721 |
\or%south east |
| 722 |
\ifpgfspectra@drawaxis% |
| 723 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,below left,inner xsep=0pt] at (\pgfspectra@width+2.5*\@pgfspectra@axis@height,-2.5*\@pgfspectra@axis@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 724 |
\else% |
| 725 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,below left,inner xsep=0pt] at (\pgfspectra@width,0) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 726 |
\fi% |
| 727 |
\or%south |
| 728 |
\ifpgfspectra@drawaxis% |
| 729 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,below] at (0.5*\pgfspectra@width,-2.5*\@pgfspectra@axis@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 730 |
\else% |
| 731 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,below] at (0.5*\pgfspectra@width,0) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 732 |
\fi% |
| 733 |
\or%south west |
| 734 |
\ifpgfspectra@drawaxis% |
| 735 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,below right,inner xsep=0pt] at (-2.5*\@pgfspectra@axis@height,-2.5*\@pgfspectra@axis@height) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 736 |
\else% |
| 737 |
\node[\pgfspectra@labelfontcolor,font=\pgfspectra@labelfont,below right,inner xsep=0pt] at (0,0) {\pgfspectra@labelbtext\pgfspectra@elt@chemsym\pgfspectra@labelatext};% |
| 738 |
\fi% |
| 739 |
\fi% |
| 740 |
\fi% |
| 741 |
}% |
| 742 |
\def\pgfspectra@utils@drawbackground#1{\ignorespaces% NEW v2.0.0 - in this version draws from UV, VIS to IV -> replaces \pgfspectra@utils@visiblespectrum#1 |
| 743 |
% reprocess visible background (only visible) -> needed because of the override in keys |
| 744 |
\pgfspectra@counta=0% |
| 745 |
\pgfspectra@countb=-1% |
| 746 |
\@for\@myarg:=\pgfspectra@visible@list\do{% |
| 747 |
\ifx\pgfspectra@back\@myarg\pgfspectra@countb=\pgfspectra@counta\fi% |
| 748 |
\advance\pgfspectra@counta by1% |
| 749 |
}% |
| 750 |
\ifnum\pgfspectra@countb>-1\let\pgfspectra@back\pgfspectra@visible\fi% |
| 751 |
\ifpgfspectra@usevisibleshade\relax% NEW v2.1.0 |
| 752 |
\pgfmathparse{int(#1*100)}\edef\pgfspectra@bright{\pgfmathresult}% |
| 753 |
\ifnum\pgfspectra@begin>\pgfspectra@end% 0 |
| 754 |
\ifnum\pgfspectra@end<380\relax% 1 |
| 755 |
\pgfmathparse{(\pgfspectra@end-380)*\pgfspectra@xscale}\edef\pgfspectra@pointA{\pgfmathresult pt}% |
| 756 |
\ifnum\pgfspectra@begin>780\relax% 2 |
| 757 |
\pgfmathparse{(\pgfspectra@end-780)*\pgfspectra@xscale}\edef\pgfspectra@pointB{\pgfmathresult pt}% |
| 758 |
\draw[draw=none,fill=\pgfspectra@background@UVcolor] (0,0) rectangle (\pgfspectra@pointA,\pgfspectra@height);% |
| 759 |
\draw[draw=none,fill=\pgfspectra@background@IRcolor] (\pgfspectra@pointB,0) rectangle (-\pgfspectra@width,\pgfspectra@height);% |
| 760 |
\ifx\pgfspectra@back\pgfspectra@visible% 3 visible background |
| 761 |
\pgfspectrashade(380,780){pgfspectra@visibleshade}% |
| 762 |
\fill[shading=pgfspectra@visibleshade,shading angle=180] (\pgfspectra@pointA,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 763 |
\else% 3 |
| 764 |
\draw[draw=none,fill=\pgfspectra@back] (\pgfspectra@pointA,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 765 |
\fi% 3 |
| 766 |
\else% 2 |
| 767 |
\pgfmathparse{(\pgfspectra@end-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@pointB{\pgfmathresult pt}% |
| 768 |
\draw[draw=none,fill=\pgfspectra@background@UVcolor] (0,0) rectangle (\pgfspectra@pointA,\pgfspectra@height);% |
| 769 |
\ifx\pgfspectra@back\pgfspectra@visible% 3 visible background |
| 770 |
\pgfspectrashade(380,\pgfspectra@begin){pgfspectra@visibleshade}% |
| 771 |
\fill[shading=pgfspectra@visibleshade,shading angle=180] (\pgfspectra@pointA,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 772 |
\else% 3 |
| 773 |
\draw[draw=none,fill=\pgfspectra@back] (\pgfspectra@pointA,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 774 |
\fi% 3 |
| 775 |
\fi% 2 |
| 776 |
\else% 1 |
| 777 |
\ifnum\pgfspectra@begin>780\relax% 2 |
| 778 |
\pgfmathparse{(\pgfspectra@end-780)*\pgfspectra@xscale}\edef\pgfspectra@pointB{\pgfmathresult pt}% |
| 779 |
\draw[draw=none,fill=\pgfspectra@background@IRcolor] (\pgfspectra@pointB,0) rectangle (-\pgfspectra@width,\pgfspectra@height);% |
| 780 |
\ifx\pgfspectra@back\pgfspectra@visible% 3 visible background |
| 781 |
\pgfspectrashade(\pgfspectra@end,780){pgfspectra@visibleshade}% |
| 782 |
\fill[shading=pgfspectra@visibleshade,shading angle=180] (0,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 783 |
\else% 3 |
| 784 |
\draw[draw=none,fill=\pgfspectra@back] (0,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 785 |
\fi% 3 |
| 786 |
\else% 2 |
| 787 |
\pgfmathparse{(\pgfspectra@end-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@pointB{\pgfmathresult pt}% |
| 788 |
\ifx\pgfspectra@back\pgfspectra@visible% 3 visible background |
| 789 |
\pgfspectrashade(\pgfspectra@end,\pgfspectra@begin){pgfspectra@visibleshade}% |
| 790 |
\fill[shading=pgfspectra@visibleshade,shading angle=180] (0,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 791 |
\else% 3 |
| 792 |
\draw[draw=none,fill=\pgfspectra@back] (0,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 793 |
\fi% 3 |
| 794 |
\fi% 2 |
| 795 |
\fi% 1 |
| 796 |
\else% 0 |
| 797 |
\ifnum\pgfspectra@begin<380\relax% 1 |
| 798 |
\pgfmathparse{(380-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@pointA{\pgfmathresult pt}% |
| 799 |
\ifnum\pgfspectra@end>780\relax% 2 |
| 800 |
\pgfmathparse{(780-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@pointB{\pgfmathresult pt}% |
| 801 |
\draw[draw=none,fill=\pgfspectra@background@UVcolor] (0,0) rectangle (\pgfspectra@pointA,\pgfspectra@height);% |
| 802 |
\draw[draw=none,fill=\pgfspectra@background@IRcolor] (\pgfspectra@pointB,0) rectangle (\pgfspectra@width,\pgfspectra@height);% |
| 803 |
\ifx\pgfspectra@back\pgfspectra@visible% 3 visible background |
| 804 |
\pgfspectrashade(380,780){pgfspectra@visibleshade}% |
| 805 |
\fill[shading=pgfspectra@visibleshade] (\pgfspectra@pointA,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 806 |
\else% 3 |
| 807 |
\draw[draw=none,fill=\pgfspectra@back] (\pgfspectra@pointA,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 808 |
\fi% 3 |
| 809 |
\else% 2 |
| 810 |
\pgfmathparse{(\pgfspectra@end-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@pointB{\pgfmathresult pt}% |
| 811 |
\draw[draw=none,fill=\pgfspectra@background@UVcolor] (0,0) rectangle (\pgfspectra@pointA,\pgfspectra@height);% |
| 812 |
\ifx\pgfspectra@back\pgfspectra@visible% 3 visible background |
| 813 |
\pgfspectrashade(380,\pgfspectra@end){pgfspectra@visibleshade}% |
| 814 |
\fill[shading=pgfspectra@visibleshade] (\pgfspectra@pointA,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 815 |
\else% 3 |
| 816 |
\draw[draw=none,fill=\pgfspectra@back] (\pgfspectra@pointA,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 817 |
\fi% 3 |
| 818 |
\fi% 2 |
| 819 |
\else% 1 |
| 820 |
\ifnum\pgfspectra@end>780\relax% 2 |
| 821 |
\pgfmathparse{(780-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@pointB{\pgfmathresult pt}% |
| 822 |
\draw[draw=none,fill=\pgfspectra@background@IRcolor] (\pgfspectra@pointB,0) rectangle (\pgfspectra@width,\pgfspectra@height);% |
| 823 |
\ifx\pgfspectra@back\pgfspectra@visible% 3 visible background |
| 824 |
\pgfspectrashade(\pgfspectra@begin,780){pgfspectra@visibleshade}% |
| 825 |
\fill[shading=pgfspectra@visibleshade] (0,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 826 |
\else% 3 |
| 827 |
\draw[draw=none,fill=\pgfspectra@back] (0,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 828 |
\fi% 3 |
| 829 |
\else% 2 |
| 830 |
\pgfmathparse{(\pgfspectra@end-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@pointB{\pgfmathresult pt}% |
| 831 |
\ifx\pgfspectra@back\pgfspectra@visible% 3 visible background |
| 832 |
\pgfspectrashade(\pgfspectra@begin,\pgfspectra@end){pgfspectra@visibleshade}% |
| 833 |
\fill[shading=pgfspectra@visibleshade] (0,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 834 |
\else% 3 |
| 835 |
\draw[draw=none,fill=\pgfspectra@back] (0,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 836 |
\fi% 3 |
| 837 |
\fi% 2 |
| 838 |
\fi% 1 |
| 839 |
\fi%0 |
| 840 |
\else% pgfspectra@usevisibleshade (don't use shading, draw line by line...) |
| 841 |
\pgfmathparse{int(#1*100)}\edef\pgfspectra@bright{\pgfmathresult}% |
| 842 |
\pgfmathparse{1.4*\pgfspectra@xscale+.09*\linewidth/\pgfspectra@width}\edef\@pgfspectra@linewidth{\pgfmathresult}% NEW v2.0.0 {\pgfspectra@xscale} -> {1.4*\pgfspectra@xscale+.09*\linewidth/\pgfspectra@width} |
| 843 |
\ifnum\pgfspectra@begin>\pgfspectra@end% 0 |
| 844 |
\ifnum\pgfspectra@end<380\relax% 1 |
| 845 |
\pgfmathparse{(\pgfspectra@end-380)*\pgfspectra@xscale}\edef\pgfspectra@pointA{\pgfmathresult pt}% |
| 846 |
\ifnum\pgfspectra@begin>780\relax% 2 |
| 847 |
\pgfmathparse{(\pgfspectra@end-780)*\pgfspectra@xscale}\edef\pgfspectra@pointB{\pgfmathresult pt}% |
| 848 |
\draw[draw=none,fill=\pgfspectra@background@UVcolor] (0,0) rectangle (\pgfspectra@pointA,\pgfspectra@height);% |
| 849 |
\draw[draw=none,fill=\pgfspectra@background@IRcolor] (\pgfspectra@pointB,0) rectangle (-\pgfspectra@width,\pgfspectra@height);% |
| 850 |
\ifx\pgfspectra@back\pgfspectra@visible% 3 visible background |
| 851 |
\foreach \x in {780,...,380}{% |
| 852 |
\wlcolor{\x}% |
| 853 |
\colorlet{wlcolor}{pgfspectra@temp!\pgfspectra@bright!\pgfspectra@backvisible}% CHANGED v2.1.0 |
| 854 |
\pgfmathparse{\pgfspectra@pointB+(780-\x)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 855 |
\draw[wlcolor,line width=\@pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,\pgfspectra@height);}% |
| 856 |
\else% 3 |
| 857 |
\draw[draw=none,fill=\pgfspectra@back] (\pgfspectra@pointA,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 858 |
\fi% 3 |
| 859 |
\else% 2 |
| 860 |
\pgfmathparse{(\pgfspectra@end-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@pointB{\pgfmathresult pt}% |
| 861 |
\draw[draw=none,fill=\pgfspectra@background@UVcolor] (0,0) rectangle (\pgfspectra@pointA,\pgfspectra@height);% |
| 862 |
\ifx\pgfspectra@back\pgfspectra@visible% 3 visible background |
| 863 |
\foreach \x in {\pgfspectra@begin,...,380}{% |
| 864 |
\wlcolor{\x}% |
| 865 |
\colorlet{wlcolor}{pgfspectra@temp!\pgfspectra@bright!\pgfspectra@backvisible}% CHANGED v2.1.0 |
| 866 |
\pgfmathparse{\pgfspectra@pointB+(\pgfspectra@begin-\x)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 867 |
\draw[wlcolor,line width=\@pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,\pgfspectra@height);}% |
| 868 |
\else% 3 |
| 869 |
\draw[draw=none,fill=\pgfspectra@back] (\pgfspectra@pointA,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 870 |
\fi% 3 |
| 871 |
\fi% 2 |
| 872 |
\else% 1 |
| 873 |
\ifnum\pgfspectra@begin>780\relax% 2 |
| 874 |
\pgfmathparse{(\pgfspectra@end-780)*\pgfspectra@xscale}\edef\pgfspectra@pointB{\pgfmathresult pt}% |
| 875 |
\draw[draw=none,fill=\pgfspectra@background@IRcolor] (\pgfspectra@pointB,0) rectangle (-\pgfspectra@width,\pgfspectra@height);% |
| 876 |
\ifx\pgfspectra@back\pgfspectra@visible% 3 visible background |
| 877 |
\foreach \x in {780,...,\pgfspectra@end}{% |
| 878 |
\wlcolor{\x}% |
| 879 |
\colorlet{wlcolor}{pgfspectra@temp!\pgfspectra@bright!\pgfspectra@backvisible}% CHANGED v2.1.0 |
| 880 |
\pgfmathparse{\pgfspectra@pointB+(780-\x)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 881 |
\draw[wlcolor,line width=\@pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,\pgfspectra@height);}% |
| 882 |
\else% 3 |
| 883 |
\draw[draw=none,fill=\pgfspectra@back] (0,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 884 |
\fi% 3 |
| 885 |
\else% 2 |
| 886 |
\pgfmathparse{(\pgfspectra@end-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@pointB{\pgfmathresult pt}% |
| 887 |
\ifx\pgfspectra@back\pgfspectra@visible% 3 visible background |
| 888 |
\foreach \x in {\pgfspectra@begin,...,\pgfspectra@end}{% |
| 889 |
\wlcolor{\x}% |
| 890 |
\colorlet{wlcolor}{pgfspectra@temp!\pgfspectra@bright!\pgfspectra@backvisible}% CHANGED v2.1.0 |
| 891 |
\pgfmathparse{\pgfspectra@pointB+(\pgfspectra@begin-\x)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 892 |
\draw[wlcolor,line width=\@pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,\pgfspectra@height);}% |
| 893 |
\else% 3 |
| 894 |
\draw[draw=none,fill=\pgfspectra@back] (0,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 895 |
\fi% 3 |
| 896 |
\fi% 2 |
| 897 |
\fi% 1 |
| 898 |
\else% 0 |
| 899 |
\ifnum\pgfspectra@begin<380\relax% 1 |
| 900 |
\pgfmathparse{(380-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@pointA{\pgfmathresult pt}% |
| 901 |
\ifnum\pgfspectra@end>780\relax% 2 |
| 902 |
\pgfmathparse{(780-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@pointB{\pgfmathresult pt}% |
| 903 |
\draw[draw=none,fill=\pgfspectra@background@UVcolor] (0,0) rectangle (\pgfspectra@pointA,\pgfspectra@height);% |
| 904 |
\draw[draw=none,fill=\pgfspectra@background@IRcolor] (\pgfspectra@pointB,0) rectangle (\pgfspectra@width,\pgfspectra@height);% |
| 905 |
\ifx\pgfspectra@back\pgfspectra@visible% 3 visible background |
| 906 |
\foreach \x in {380,...,780}{% |
| 907 |
\wlcolor{\x}% |
| 908 |
\colorlet{wlcolor}{pgfspectra@temp!\pgfspectra@bright!\pgfspectra@backvisible}% CHANGED v2.1.0 |
| 909 |
\pgfmathparse{\pgfspectra@pointB-(780-\x)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 910 |
\draw[wlcolor,line width=\@pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,\pgfspectra@height);}% |
| 911 |
\else% 3 |
| 912 |
\draw[draw=none,fill=\pgfspectra@back] (\pgfspectra@pointA,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 913 |
\fi% 3 |
| 914 |
\else% 2 |
| 915 |
\pgfmathparse{(\pgfspectra@end-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@pointB{\pgfmathresult pt}% |
| 916 |
\draw[draw=none,fill=\pgfspectra@background@UVcolor] (0,0) rectangle (\pgfspectra@pointA,\pgfspectra@height);% |
| 917 |
\ifx\pgfspectra@back\pgfspectra@visible% 3 visible background |
| 918 |
\foreach \x in {\pgfspectra@end,...,380}{% |
| 919 |
\wlcolor{\x}% |
| 920 |
\colorlet{wlcolor}{pgfspectra@temp!\pgfspectra@bright!\pgfspectra@backvisible}% CHANGED v2.1.0 |
| 921 |
\pgfmathparse{\pgfspectra@pointB-(\pgfspectra@end-\x)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 922 |
\draw[wlcolor,line width=\@pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,\pgfspectra@height);}% |
| 923 |
\else% 3 |
| 924 |
\draw[draw=none,fill=\pgfspectra@back] (\pgfspectra@pointA,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 925 |
\fi% 3 |
| 926 |
\fi% 2 |
| 927 |
\else% 1 |
| 928 |
\ifnum\pgfspectra@end>780\relax% 2 |
| 929 |
\pgfmathparse{(780-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@pointB{\pgfmathresult pt}% |
| 930 |
\draw[draw=none,fill=\pgfspectra@background@IRcolor] (\pgfspectra@pointB,0) rectangle (\pgfspectra@width,\pgfspectra@height);% |
| 931 |
\ifx\pgfspectra@back\pgfspectra@visible% 3 visible background |
| 932 |
\foreach \x in {\pgfspectra@begin,...,780}{% |
| 933 |
\wlcolor{\x}% |
| 934 |
\colorlet{wlcolor}{pgfspectra@temp!\pgfspectra@bright!\pgfspectra@backvisible}% CHANGED v2.1.0 |
| 935 |
\pgfmathparse{(\x-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 936 |
\draw[wlcolor,line width=\@pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,\pgfspectra@height);}% |
| 937 |
\else% 3 |
| 938 |
\draw[draw=none,fill=\pgfspectra@back] (0,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 939 |
\fi% 3 |
| 940 |
\else% 2 |
| 941 |
\pgfmathparse{(\pgfspectra@end-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@pointB{\pgfmathresult pt}% |
| 942 |
\ifx\pgfspectra@back\pgfspectra@visible% 3 visible background |
| 943 |
\foreach \x in {\pgfspectra@begin,...,\pgfspectra@end}{% |
| 944 |
\wlcolor{\x}% |
| 945 |
\colorlet{wlcolor}{pgfspectra@temp!\pgfspectra@bright!\pgfspectra@backvisible}% CHANGED v2.1.0 |
| 946 |
\pgfmathparse{\x-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 947 |
\draw[wlcolor,line width=\@pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,\pgfspectra@height);}% |
| 948 |
\else% 3 |
| 949 |
\draw[draw=none,fill=\pgfspectra@back] (0,0) rectangle (\pgfspectra@pointB,\pgfspectra@height);% |
| 950 |
\fi% 3 |
| 951 |
\fi% 2 |
| 952 |
\fi% 1 |
| 953 |
\fi%0 |
| 954 |
\fi% pgfspectra@usevisibleshade |
| 955 |
}% |
| 956 |
\def\pgfspectra@utils@drawabsorptionlines{\ignorespaces% |
| 957 |
\ifnum\pgfspectra@begin>\pgfspectra@end% |
| 958 |
\ifpgfspectra@intensity% |
| 959 |
\ifpgfspectra@redshift\pgfspectra@utils@redshift\fi% NEW v2.0.0 |
| 960 |
\foreach \x/\y in \pgfspectra@list@@% |
| 961 |
{% |
| 962 |
\pgfmathparse{notless(\x,\pgfspectra@end)}\edef\pgfspectra@x@nl{\pgfmathresult}% |
| 963 |
\pgfmathparse{notgreater(\x,\pgfspectra@begin)}\edef\pgfspectra@x@ng{\pgfmathresult}% |
| 964 |
\pgfmathparse{and(\pgfspectra@x@nl,\pgfspectra@x@ng)}\edef\pgfspectra@plot@point{\pgfmathresult}% |
| 965 |
\ifnum\pgfspectra@plot@point=1% |
| 966 |
\pgfmathparse{(\pgfspectra@end-\x)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 967 |
\pgfmathparse{int(\y*100)}\edef\pgfspectra@black{\pgfmathresult}% |
| 968 |
\wlcolor{\x}% |
| 969 |
\colorlet{wlcolor}{black!\pgfspectra@black!pgfspectra@temp}% |
| 970 |
\draw[wlcolor,line width=\pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,\pgfspectra@height);% |
| 971 |
\fi% |
| 972 |
}% |
| 973 |
\else% |
| 974 |
\ifpgfspectra@redshift\pgfspectra@utils@redshift\fi% NEW v2.0.0 |
| 975 |
\foreach \x in \pgfspectra@list@@% |
| 976 |
{% |
| 977 |
\pgfmathparse{notless(\x,\pgfspectra@end)}\edef\pgfspectra@x@nl{\pgfmathresult}% |
| 978 |
\pgfmathparse{notgreater(\x,\pgfspectra@begin)}\edef\pgfspectra@x@ng{\pgfmathresult}% |
| 979 |
\pgfmathparse{and(\pgfspectra@x@nl,\pgfspectra@x@ng)}\edef\pgfspectra@plot@point{\pgfmathresult}% |
| 980 |
\ifnum\pgfspectra@plot@point=1% |
| 981 |
\pgfmathparse{(\pgfspectra@end-\x)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 982 |
\wlcolor{\x}% |
| 983 |
\colorlet{wlcolor}{black!\pgfspectra@lineint!pgfspectra@temp}% |
| 984 |
\draw[wlcolor,line width=\pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,\pgfspectra@height);% |
| 985 |
\fi% |
| 986 |
}% |
| 987 |
\fi% |
| 988 |
\else% |
| 989 |
\ifpgfspectra@intensity% |
| 990 |
\ifpgfspectra@redshift\pgfspectra@utils@redshift\fi% NEW v2.0.0 |
| 991 |
\foreach \x/\y in \pgfspectra@list@@% |
| 992 |
{% |
| 993 |
\pgfmathparse{notless(\x,\pgfspectra@begin)}\edef\pgfspectra@x@nl{\pgfmathresult}% |
| 994 |
\pgfmathparse{notgreater(\x,\pgfspectra@end)}\edef\pgfspectra@x@ng{\pgfmathresult}% |
| 995 |
\pgfmathparse{and(\pgfspectra@x@nl,\pgfspectra@x@ng)}\edef\pgfspectra@plot@point{\pgfmathresult}% |
| 996 |
\ifnum\pgfspectra@plot@point=1% |
| 997 |
\pgfmathparse{(\x-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 998 |
\pgfmathparse{int(\y*100)}\edef\pgfspectra@black{\pgfmathresult}% |
| 999 |
\wlcolor{\x}% |
| 1000 |
\colorlet{wlcolor}{black!\pgfspectra@black!pgfspectra@temp}% |
| 1001 |
\draw[wlcolor,line width=\pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,\pgfspectra@height);% |
| 1002 |
\fi% |
| 1003 |
}% |
| 1004 |
\else% |
| 1005 |
\ifpgfspectra@redshift\pgfspectra@utils@redshift\fi% NEW v2.0.0 |
| 1006 |
\foreach \x in \pgfspectra@list@@% |
| 1007 |
{% |
| 1008 |
\pgfmathparse{notless(\x,\pgfspectra@begin)}\edef\pgfspectra@x@nl{\pgfmathresult}% |
| 1009 |
\pgfmathparse{notgreater(\x,\pgfspectra@end)}\edef\pgfspectra@x@ng{\pgfmathresult}% |
| 1010 |
\pgfmathparse{and(\pgfspectra@x@nl,\pgfspectra@x@ng)}\edef\pgfspectra@plot@point{\pgfmathresult}% |
| 1011 |
\ifnum\pgfspectra@plot@point=1% |
| 1012 |
\pgfmathparse{(\x-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 1013 |
\wlcolor{\x}% |
| 1014 |
\colorlet{wlcolor}{black!\pgfspectra@lineint!pgfspectra@temp}% |
| 1015 |
\draw[wlcolor,line width=\pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,\pgfspectra@height);% |
| 1016 |
\fi% |
| 1017 |
}% |
| 1018 |
\fi% |
| 1019 |
\fi% |
| 1020 |
\ifpgfspectra@RSvalue% NEW v2.0.0 |
| 1021 |
\ifnum\pgfspectra@begin>\pgfspectra@end% |
| 1022 |
\ifpgfspectra@drawaxis\pgfmathparse{-\[email protected]*\@pgfspectra@axis@height}\edef\pgfspectra@redshiftinfo@x{\pgfmathresult pt}% |
| 1023 |
\else\pgfmathparse{-\pgfspectra@width}\edef\pgfspectra@redshiftinfo@x{\pgfmathresult pt}\fi% |
| 1024 |
\else% |
| 1025 |
\ifpgfspectra@drawaxis\pgfmathparse{-2.5*\@pgfspectra@axis@height}\edef\pgfspectra@redshiftinfo@x{\pgfmathresult pt}% |
| 1026 |
\else\edef\pgfspectra@redshiftinfo@x{0pt}\fi% |
| 1027 |
\fi% |
| 1028 |
\ifpgfspectra@drawaxis\pgfmathparse{-.75*\@pgfspectra@[email protected]*\ht0-2pt}\edef\pgfspectra@redshiftinfo@y{\pgfmathresult pt}\else\edef\pgfspectra@redshiftinfo@y{0pt}\fi% |
| 1029 |
\node[below right,inner xsep=0pt,font=\pgfspectra@axisfont] at (\pgfspectra@redshiftinfo@x,\pgfspectra@redshiftinfo@y) {\pgfspectra@redshiftinfo};% |
| 1030 |
\fi% NEW v2.0.0 |
| 1031 |
}% |
| 1032 |
\def\pgfspectra@utils@drawemissionlines{\ignorespaces% |
| 1033 |
\ifnum\pgfspectra@begin>\pgfspectra@end% |
| 1034 |
\ifpgfspectra@intensity% |
| 1035 |
\ifpgfspectra@redshift\pgfspectra@utils@redshift\fi% NEW v2.0.0 |
| 1036 |
\foreach \x/\y in \pgfspectra@list@@% |
| 1037 |
{% |
| 1038 |
\wlcolor{\x}% |
| 1039 |
\pgfmathparse{notless(\x,\pgfspectra@end)}\edef\pgfspectra@x@nl{\pgfmathresult}% |
| 1040 |
\pgfmathparse{notgreater(\x,\pgfspectra@begin)}\edef\pgfspectra@x@ng{\pgfmathresult}% |
| 1041 |
\pgfmathparse{and(\pgfspectra@x@nl,\pgfspectra@x@ng)}\edef\pgfspectra@plot@point{\pgfmathresult}% |
| 1042 |
\ifnum\pgfspectra@plot@point=1% |
| 1043 |
\pgfmathparse{(\pgfspectra@end-\x)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 1044 |
\pgfmathparse{int(\y*100)}\edef\pgfspectra@black{\pgfmathresult}% |
| 1045 |
\colorlet{wlcolor}{pgfspectra@temp!\pgfspectra@black!black}% |
| 1046 |
\draw[wlcolor,line width=\pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,\pgfspectra@height);% |
| 1047 |
\fi% |
| 1048 |
}% |
| 1049 |
\else% |
| 1050 |
\ifpgfspectra@redshift\pgfspectra@utils@redshift\fi% NEW v2.0.0 |
| 1051 |
\foreach \x in \pgfspectra@list@@% |
| 1052 |
{% |
| 1053 |
\wlcolor{\x}% |
| 1054 |
\pgfmathparse{notless(\x,\pgfspectra@end)}\edef\pgfspectra@x@nl{\pgfmathresult}% |
| 1055 |
\pgfmathparse{notgreater(\x,\pgfspectra@begin)}\edef\pgfspectra@x@ng{\pgfmathresult}% |
| 1056 |
\pgfmathparse{and(\pgfspectra@x@nl,\pgfspectra@x@ng)}\edef\pgfspectra@plot@point{\pgfmathresult}% |
| 1057 |
\ifnum\pgfspectra@plot@point=1% |
| 1058 |
\pgfmathparse{(\pgfspectra@end-\x)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 1059 |
\colorlet{wlcolor}{pgfspectra@temp!\pgfspectra@lineint!black}% |
| 1060 |
\draw[wlcolor,line width=\pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,\pgfspectra@height);% |
| 1061 |
\fi% |
| 1062 |
}% |
| 1063 |
\fi% |
| 1064 |
\else% |
| 1065 |
\ifpgfspectra@intensity% |
| 1066 |
\ifpgfspectra@redshift\pgfspectra@utils@redshift\fi% NEW v2.0.0 |
| 1067 |
\foreach \x/\y in \pgfspectra@list@@% |
| 1068 |
{% |
| 1069 |
\wlcolor{\x}% |
| 1070 |
\pgfmathparse{notless(\x,\pgfspectra@begin)}\edef\pgfspectra@x@nl{\pgfmathresult}% |
| 1071 |
\pgfmathparse{notgreater(\x,\pgfspectra@end)}\edef\pgfspectra@x@ng{\pgfmathresult}% |
| 1072 |
\pgfmathparse{and(\pgfspectra@x@nl,\pgfspectra@x@ng)}\edef\pgfspectra@plot@point{\pgfmathresult}% |
| 1073 |
\ifnum\pgfspectra@plot@point=1% |
| 1074 |
\pgfmathparse{(\x-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 1075 |
\pgfmathparse{int(\y*100)}\edef\pgfspectra@black{\pgfmathresult}% |
| 1076 |
\colorlet{wlcolor}{pgfspectra@temp!\pgfspectra@black!black}% |
| 1077 |
\draw[wlcolor,line width=\pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,\pgfspectra@height);% |
| 1078 |
\fi% |
| 1079 |
}% |
| 1080 |
\else% |
| 1081 |
\ifpgfspectra@redshift\pgfspectra@utils@redshift\fi% NEW v2.0.0 |
| 1082 |
\foreach \x in \pgfspectra@list@@% |
| 1083 |
{% |
| 1084 |
\wlcolor{\x}% |
| 1085 |
\pgfmathparse{notless(\x,\pgfspectra@begin)}\edef\pgfspectra@x@nl{\pgfmathresult}% |
| 1086 |
\pgfmathparse{notgreater(\x,\pgfspectra@end)}\edef\pgfspectra@x@ng{\pgfmathresult}% |
| 1087 |
\pgfmathparse{and(\pgfspectra@x@nl,\pgfspectra@x@ng)}\edef\pgfspectra@plot@point{\pgfmathresult}% |
| 1088 |
\ifnum\pgfspectra@plot@point=1% |
| 1089 |
\pgfmathparse{(\x-\pgfspectra@begin)*\pgfspectra@xscale}\edef\pgfspectra@currentx{\pgfmathresult pt}% |
| 1090 |
\colorlet{wlcolor}{pgfspectra@temp!\pgfspectra@lineint!black}% |
| 1091 |
\draw[wlcolor,line width=\pgfspectra@linewidth] (\pgfspectra@currentx,0) -- ++(0,\pgfspectra@height);% |
| 1092 |
\fi% |
| 1093 |
}% |
| 1094 |
\fi% |
| 1095 |
\fi% |
| 1096 |
\ifpgfspectra@RSvalue% NEW v2.0.0 |
| 1097 |
\ifnum\pgfspectra@begin>\pgfspectra@end% |
| 1098 |
\ifpgfspectra@drawaxis\pgfmathparse{-\[email protected]*\@pgfspectra@axis@height}\edef\pgfspectra@redshiftinfo@x{\pgfmathresult pt}% |
| 1099 |
\else\pgfmathparse{-\pgfspectra@width}\edef\pgfspectra@redshiftinfo@x{\pgfmathresult pt}\fi% |
| 1100 |
\else% |
| 1101 |
\ifpgfspectra@drawaxis\pgfmathparse{-2.5*\@pgfspectra@axis@height}\edef\pgfspectra@redshiftinfo@x{\pgfmathresult pt}% |
| 1102 |
\else\edef\pgfspectra@redshiftinfo@x{0pt}\fi% |
| 1103 |
\fi% |
| 1104 |
\ifpgfspectra@drawaxis\pgfmathparse{-.75*\@pgfspectra@[email protected]*\ht0-2pt}\edef\pgfspectra@redshiftinfo@y{\pgfmathresult pt}\else\edef\pgfspectra@redshiftinfo@y{0pt}\fi% |
| 1105 |
\node[below right,inner xsep=0pt,font=\pgfspectra@axisfont] at (\pgfspectra@redshiftinfo@x,\pgfspectra@redshiftinfo@y) {\pgfspectra@redshiftinfo};% |
| 1106 |
\fi% NEW v2.0.0 |
| 1107 |
}% |
| 1108 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1109 |
% return: integer with position (e.g. '0' for west, ... ) |
| 1110 |
\def\pgfspectra@get@label@position{\ignorespaces% |
| 1111 |
\pgfspectra@countc=0% |
| 1112 |
\@for\@mylabel:=\pgfspectra@label@position@list% |
| 1113 |
\do{% |
| 1114 |
\ifx\@mylabel\pgfspectra@labelposition\edef\pgfspectra@label@position{\the\pgfspectra@countc}\fi% |
| 1115 |
\advance\pgfspectra@countc by1% |
| 1116 |
}% |
| 1117 |
}% |
| 1118 |
% NEW v2.0.0 ---------------------- |
| 1119 |
% redshift: lambda(obs)=lambda(emit)*{(1+v/c*cos(theta))/sqrt(1-v^2/c^2)} ---> Relativistic Doppler |
| 1120 |
% vbar-> v/c -> normalized velocity of the source (e.g. '0.9' for v=0.9c ) |
| 1121 |
% theta ->angle between the direction of relative motion of the source and the direction of emission in the observer's frame (zero angle is directly away from the observer) |
| 1122 |
\def\pgfspectra@processredshiftkey#1{\ignorespaces% |
| 1123 |
\pgfspectra@redshiftfalse% |
| 1124 |
\edef\pgfspectra@redshiftkey@expand{#1}% to expand a value passed by a macro (not necessary if the user provided a number...) |
| 1125 |
\expandafter\pgfspectra@redshiftkey@firstchar\pgfspectra@redshiftkey@expand\relax% |
| 1126 |
\ifcat1\pgfspectra@@RedShift\relax% |
| 1127 |
\pgfmathparse{1+#1}\relax% |
| 1128 |
\edef\pgfspectra@UMMAISZ{\pgfmathresult}\pgfspectra@redshifttrue% |
| 1129 |
\edef\pgfspectra@redshiftinfo{redshift: z=#1}% |
| 1130 |
\edef\pgfspectra@write@redshiftinfo{redshift: z=#1}% |
| 1131 |
\else% |
| 1132 |
\edef\pgfspectra@redshiftkey@expand{#1}% |
| 1133 |
\expandafter\pgfspectra@process@redshift\pgfspectra@redshiftkey@expand\relax% |
| 1134 |
\fi% |
| 1135 |
}% |
| 1136 |
\def\pgfspectra@redshiftkey@firstchar#1#2\relax{\edef\pgfspectra@@RedShift{#1}}% |
| 1137 |
\def\pgfspectra@process@redshift#1=#2/#3\relax{% |
| 1138 |
\edef\pgfspectra@redshifttest{#1}% |
| 1139 |
\ifx\pgfspectra@redshifttest\pgfspectra@redshift@D\relax% |
| 1140 |
\pgfmathparse{(1+#2*cos(#3))/sqrt(1-#2*#2)}% |
| 1141 |
\edef\pgfspectra@UMMAISZ{\pgfmathresult}\pgfspectra@redshifttrue% |
| 1142 |
\pgfmathparse{#2*cos(#3))/sqrt(1-#2*#2)}% |
| 1143 |
\edef\pgfspectra@redshiftinfo{Relativistic Doppler redshift: z=\pgfmathresult\ (\mbox{v\hskip.1ex=\hskip.1ex#2\hskip.1exc\hskip.5ex;\hskip.5ex\ensuremath{\theta}\hskip.1ex=\hskip.1ex#3\ensuremath{^\circ}})}% |
| 1144 |
\edef\pgfspectra@write@space{ }% |
| 1145 |
\edef\pgfspectra@write@redshiftinfo{Relativistic Doppler redshift: z=\pgfmathresult\pgfspectra@write@space(v=#2c ; theta=#3 degrees)}% |
| 1146 |
\fi% |
| 1147 |
}% |
| 1148 |
% \pgfspectra@utils@redshift --------------------------------------------------------------------- |
| 1149 |
% returns the wllist with the shift computed |
| 1150 |
\def\pgfspectra@utils@redshift{\ignorespaces% |
| 1151 |
\let\wt@backlist@@\pgfspectra@list@@\relax% |
| 1152 |
\let\pgfspectra@list@@\@empty\relax% |
| 1153 |
\pgfspectra@firsttrue\relax% |
| 1154 |
\ifpgfspectra@intensity% list (lambda/intensity) |
| 1155 |
\foreach \x/\y in \wt@backlist@@{% |
| 1156 |
\pgfmathparse{\x*\pgfspectra@UMMAISZ}\edef\pgfspectra@currentline@wl{\pgfmathresult}% |
| 1157 |
\ifpgfspectra@first\global\pgfspectra@addt@list{\pgfspectra@list@@}{\pgfspectra@currentline@wl/\y}\else% |
| 1158 |
\global\pgfspectra@addt@list{\pgfspectra@list@@}{,\pgfspectra@currentline@wl/\y}\fi% |
| 1159 |
\ifpgfspectra@first\global\pgfspectra@firstfalse\fi% |
| 1160 |
}% |
| 1161 |
\else% list (lambda) |
| 1162 |
\foreach \x in \wt@backlist@@{% |
| 1163 |
\pgfmathparse{\x*\pgfspectra@UMMAISZ}\edef\pgfspectra@currentline@wl{\pgfmathresult}% |
| 1164 |
\ifpgfspectra@first\global\pgfspectra@addt@list{}{\pgfspectra@currentline@wl}\else% |
| 1165 |
\global\pgfspectra@addt@list{\pgfspectra@list@@}{,\pgfspectra@currentline@wl}\fi% |
| 1166 |
\ifpgfspectra@first\global\pgfspectra@firstfalse\fi% |
| 1167 |
}% |
| 1168 |
\fi% |
| 1169 |
}% |
| 1170 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1171 |
% NEW v2.1.0 ----------------------> |
| 1172 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1173 |
% \pgfspectrashade[type=<h|v>](start,end){name} ---> type: h-horizontal (default) | v-vertical |
| 1174 |
\def\pgfspectrashade{\ignorespaces\@ifnextchar[\pgfspectra@pgfspectrashade{\pgfspectra@pgfspectrashade[h]}}% |
| 1175 |
\def\pgfspectra@pgfspectrashade[#1](#2,#3)#4{\ignorespaces% |
| 1176 |
\ifnum#2>#3\relax\PackageError{pgf-spectra}% |
| 1177 |
{in \textbackslash pgfspectrashade the starting wavelength (#2) must be lesser then the finishing wavelength (#3)}% |
| 1178 |
{Try typing the wavelengths in the correct order: \textbackslash pgfspectrashade(#3,#2)...}\else% |
| 1179 |
\ifnum#3<381\relax\PackageError{pgf-spectra}{in \textbackslash pgfspectrashade the finishing wavelength (#3) must be at least 381...}% |
| 1180 |
{Please type a finishing wavelength greater then 380...}\else% |
| 1181 |
\ifnum#2<380\relax\def\pgfspectra@shade@begin{380}\else\pgfmathparse{int(#2)}\edef\pgfspectra@shade@begin{\pgfmathresult}\fi% |
| 1182 |
\ifnum#3>780\relax\def\pgfspectra@shade@end{780}\else\pgfmathparse{int(#3)}\edef\pgfspectra@shade@end{\pgfmathresult}\fi% |
| 1183 |
\pgfmathparse{(\pgfspectra@shade@end-\pgfspectra@shade@begin)/50}\edef\pgfspectra@shadecolor@step{\pgfmathresult}% |
| 1184 |
%\foreach \n in {1,...,51}{% |
| 1185 |
\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,% |
| 1186 |
21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,% |
| 1187 |
39,40,41,42,43,44,45,46,47,48,49,50,51}\do{% |
| 1188 |
\pgfmathparse{\pgfspectra@shade@begin+(\n-1)*\pgfspectra@shadecolor@step}\edef\pgfspectra@currentwl{\pgfmathresult}% |
| 1189 |
\wlcolor{\pgfspectra@currentwl}% |
| 1190 |
\edef\pgfspectra@colorname{wlshcol\@Roman\n}\relax\colorlet{\pgfspectra@colorname}{wlcolor}%% |
| 1191 |
}% |
| 1192 |
\def\pgfspectra@test{#1}\def\pgfspectra@v{v}\def\pgfspectra@h{h}% |
| 1193 |
\ifx\pgfspectra@test\pgfspectra@h\relax% |
| 1194 |
% the horizontal pgfshading |
| 1195 |
\pgfdeclarehorizontalshading{#4}{100bp}{color(0bp)=(wlshcolI); color(25bp)=(wlshcolI); color(26bp)=(wlshcolII); color(27bp)=(wlshcolIII); color(28bp)=(wlshcolIV); color(29bp)=(wlshcolV); color(30bp)=(wlshcolVI); color(31bp)=(wlshcolVII); color(32bp)=(wlshcolVIII); color(33bp)=(wlshcolIX); color(34bp)=(wlshcolX); color(35bp)=(wlshcolXI); color(36bp)=(wlshcolXII); color(37bp)=(wlshcolXIII); color(38bp)=(wlshcolXIV); color(39bp)=(wlshcolXV); color(40bp)=(wlshcolXVI); color(41bp)=(wlshcolXVII); color(42bp)=(wlshcolXVIII); color(43bp)=(wlshcolXIX); color(44bp)=(wlshcolXX); color(45bp)=(wlshcolXXI); color(46bp)=(wlshcolXXII); color(47bp)=(wlshcolXXIII); color(48bp)=(wlshcolXXIV); color(49bp)=(wlshcolXXV); color(50bp)=(wlshcolXXVI); color(51bp)=(wlshcolXXVII); color(52bp)=(wlshcolXXVIII); color(53bp)=(wlshcolXXIX); color(54bp)=(wlshcolXXX); color(55bp)=(wlshcolXXXI); color(56bp)=(wlshcolXXXII); color(57bp)=(wlshcolXXXIII); color(58bp)=(wlshcolXXXIV); color(59bp)=(wlshcolXXXV); color(60bp)=(wlshcolXXXVI); color(61bp)=(wlshcolXXXVII); color(62bp)=(wlshcolXXXVIII); color(63bp)=(wlshcolXXXIX); color(64bp)=(wlshcolXL); color(65bp)=(wlshcolXLI); color(66bp)=(wlshcolXLII); color(67bp)=(wlshcolXLIII); color(68bp)=(wlshcolXLIV); color(69bp)=(wlshcolXLV); color(70bp)=(wlshcolXLVI); color(71bp)=(wlshcolXLVII); color(72bp)=(wlshcolXLVIII); color(73bp)=(wlshcolXLIX); color(74bp)=(wlshcolL); color(75bp)=(wlshcolLI); color(100bp)=(wlshcolLI)}% |
| 1196 |
\else\ifx\pgfspectra@test\pgfspectra@v\relax% |
| 1197 |
% the vertical pgfshading |
| 1198 |
\pgfdeclareverticalshading{#4}{100bp}{color(0bp)=(wlshcolI); color(25bp)=(wlshcolI); color(26bp)=(wlshcolII); color(27bp)=(wlshcolIII); color(28bp)=(wlshcolIV); color(29bp)=(wlshcolV); color(30bp)=(wlshcolVI); color(31bp)=(wlshcolVII); color(32bp)=(wlshcolVIII); color(33bp)=(wlshcolIX); color(34bp)=(wlshcolX); color(35bp)=(wlshcolXI); color(36bp)=(wlshcolXII); color(37bp)=(wlshcolXIII); color(38bp)=(wlshcolXIV); color(39bp)=(wlshcolXV); color(40bp)=(wlshcolXVI); color(41bp)=(wlshcolXVII); color(42bp)=(wlshcolXVIII); color(43bp)=(wlshcolXIX); color(44bp)=(wlshcolXX); color(45bp)=(wlshcolXXI); color(46bp)=(wlshcolXXII); color(47bp)=(wlshcolXXIII); color(48bp)=(wlshcolXXIV); color(49bp)=(wlshcolXXV); color(50bp)=(wlshcolXXVI); color(51bp)=(wlshcolXXVII); color(52bp)=(wlshcolXXVIII); color(53bp)=(wlshcolXXIX); color(54bp)=(wlshcolXXX); color(55bp)=(wlshcolXXXI); color(56bp)=(wlshcolXXXII); color(57bp)=(wlshcolXXXIII); color(58bp)=(wlshcolXXXIV); color(59bp)=(wlshcolXXXV); color(60bp)=(wlshcolXXXVI); color(61bp)=(wlshcolXXXVII); color(62bp)=(wlshcolXXXVIII); color(63bp)=(wlshcolXXXIX); color(64bp)=(wlshcolXL); color(65bp)=(wlshcolXLI); color(66bp)=(wlshcolXLII); color(67bp)=(wlshcolXLIII); color(68bp)=(wlshcolXLIV); color(69bp)=(wlshcolXLV); color(70bp)=(wlshcolXLVI); color(71bp)=(wlshcolXLVII); color(72bp)=(wlshcolXLVIII); color(73bp)=(wlshcolXLIX); color(74bp)=(wlshcolL); color(75bp)=(wlshcolLI); color(100bp)=(wlshcolLI)}% |
| 1199 |
\fi\fi% |
| 1200 |
\fi\fi% |
| 1201 |
}% |
| 1202 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1203 |
% |
| 1204 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1205 |
% |
| 1206 |
% nm2rgb convert nanometre wavelength to rgb |
| 1207 |
% (380 <= Lambda <= 780 ) -> r,g,b on stack |
| 1208 |
% |
| 1209 |
% BASED on FORTRAN Code |
| 1210 |
% RGB VALUES FOR VISIBLE WAVELENGTHS by Dan Bruton ([email protected]) |
| 1211 |
% This program can be found at |
| 1212 |
% http://www.physics.sfasu.edu/astro/color.html |
| 1213 |
% and was last updated on February 20, 1996. |
| 1214 |
% The spectrum is generated using approximate RGB values for visible |
| 1215 |
% wavelengths between 380 nm and 780 nm. |
| 1216 |
% The red, green and blue values (RGB) are |
| 1217 |
% assumed to vary linearly with wavelength (for GAMMA=1). |
| 1218 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1219 |
\newdimen\pgfspectrawl%wavelength |
| 1220 |
\newdimen\pgfspectra@i%intensity |
| 1221 |
\newdimen\@pgfspectra@gamma%gamma |
| 1222 |
\newdimen\wlc@lorr%red (0. - 1) |
| 1223 |
\newdimen\wlc@lorg%green (0. - 1) |
| 1224 |
\newdimen\wlc@lorb%blue (0. - 1) % wavelength to rgb values |
| 1225 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1226 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1227 |
% \wlcolor{wavelength} |
| 1228 |
\def\wlcolor#1{\ignorespaces% |
| 1229 |
\ifx\pgfspectra@bright\undefined\relax\def\pgfspectra@bright{100}\fi% NEW v2.1.0 |
| 1230 |
\pgfspectrawl=#1pt% |
| 1231 |
\@pgfspectra@gamma=\pgfspectra@gamma pt% |
| 1232 |
% compute the rgb components |
| 1233 |
\ifdim\pgfspectrawl<10pt\relax\PackageWarning{pgf-spectra}{(#1nm) wavelength out of range ignored. The wavelength must be greater or equal to 10nm (EUV)...}\else% NEW v2.0.0 |
| 1234 |
\ifdim\pgfspectrawl<379.99999pt\relax\else%% NEW v2.0.0 |
| 1235 |
\ifdim\pgfspectrawl<440pt\wlc@lorr=440pt\advance\wlc@lorr by-\pgfspectrawl\divide\wlc@lorr by60\wlc@lorg=0pt\wlc@lorb=1pt\else% |
| 1236 |
\ifdim\pgfspectrawl<490pt\wlc@lorr=0pt\wlc@lorg=\pgfspectrawl\advance\wlc@lorg by-440pt\divide\wlc@lorg by50\wlc@lorb=1pt\else% |
| 1237 |
\ifdim\pgfspectrawl<510pt\wlc@lorr=0pt\wlc@lorg=1pt\wlc@lorb=510pt\advance\wlc@lorb by-\pgfspectrawl\divide\wlc@lorb by20\else% |
| 1238 |
\ifdim\pgfspectrawl<580pt\wlc@lorr=\pgfspectrawl\advance\wlc@lorr by-510pt\divide\wlc@lorr by70\wlc@lorg=1pt\wlc@lorb=0pt\else% |
| 1239 |
\ifdim\pgfspectrawl<645pt\wlc@lorr=1pt\wlc@lorg=645pt\advance\wlc@lorg by-\pgfspectrawl\divide\wlc@lorg by65\wlc@lorb=0pt\else% |
| 1240 |
\ifdim\pgfspectrawl<780.00001pt\wlc@lorr=1pt\wlc@lorg=0pt\wlc@lorb=0pt\else% |
| 1241 |
\ifdim\pgfspectrawl>4000pt\relax\PackageWarning{pgf-spectra}{invalid wavelength (#1nm). The wavelength must be lesser or equal to 4000nm (NIR)...}% NEW v2.0.0 |
| 1242 |
\relax% |
| 1243 |
\fi\fi\fi\fi\fi\fi\fi\fi\fi% |
| 1244 |
% intensity correction at vision limits |
| 1245 |
\ifdim\pgfspectrawl>700pt\ifdim\pgfspectrawl<780.00001pt\pgfspectra@i=780pt\advance\pgfspectra@i by-\pgfspectrawl\divide\pgfspectra@i by80\multiply\pgfspectra@i by7\advance\pgfspectra@i by3pt\divide\pgfspectra@i by10\fi\else% NEW |
| 1246 |
\ifdim\pgfspectrawl<420pt\ifdim\pgfspectrawl>379.99999pt\pgfspectra@i=\pgfspectrawl\advance\pgfspectra@i by-380pt\divide\pgfspectra@i by40\multiply\pgfspectra@i by7\advance\pgfspectra@i by3pt\divide\pgfspectra@i by10\fi\else% |
| 1247 |
\pgfspectra@i=1pt% |
| 1248 |
\fi\fi% |
| 1249 |
%apply intensity at vision limits correction and gamma |
| 1250 |
\ifdim\pgfspectrawl<380pt\colorlet{pgfspectra@temp}{\pgfspectra@UVcolor}\else\ifdim\pgfspectrawl>780pt\colorlet{pgfspectra@temp}{\pgfspectra@IRcolor}\else% NEW v2.0.0 |
| 1251 |
\pgfmathparse{\wlc@lorr*\pgfspectra@i^\@pgfspectra@gamma}\edef\pgfspectra@red{\pgfmathresult}% |
| 1252 |
\pgfmathparse{\wlc@lorg*\pgfspectra@i^\@pgfspectra@gamma}\edef\pgfspectra@green{\pgfmathresult}% |
| 1253 |
\pgfmathparse{\wlc@lorb*\pgfspectra@i^\@pgfspectra@gamma}\edef\pgfspectra@blue{\pgfmathresult}% |
| 1254 |
\definecolor{pgfspectra@temp}{rgb}{\pgfspectra@red,\pgfspectra@green,\pgfspectra@blue}% |
| 1255 |
\fi\fi% NEW v2.0.0 |
| 1256 |
\ifpgfspectra@usevisibleshade\relax% NEW v2.1.0 |
| 1257 |
\colorlet{wlcolor}{pgfspectra@temp!\pgfspectra@bright!\pgfspectra@backvisible}% |
| 1258 |
\else% |
| 1259 |
\colorlet{wlcolor}{pgfspectra@temp}% |
| 1260 |
\fi% |
| 1261 |
}% |
| 1262 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1263 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1264 |
\def\pgfspectra@elt@search#1#2#3#4#5#6#7{\ignorespaces% |
| 1265 |
% #1 Chemical Symbol, entered by USER |
| 1266 |
% #2 Chemical Symbol to compare to, e.g. Na |
| 1267 |
% #3 Emission Lines Data (or error message) |
| 1268 |
% #4 Imax@ALL (changed in v2.2.0) |
| 1269 |
% #5 Imax@UV (NEW v2.2.0) |
| 1270 |
% #6 Imax@VIS (NEW v2.2.0) |
| 1271 |
% #7 Imax@IR (NEW v2.2.0) |
| 1272 |
\ifpgfspectra@datanotfound\relax% |
| 1273 |
\edef\pgfspectra@CS@user{#1}\edef\pgfspectra@CS@comp{#2}\relax% |
| 1274 |
\ifx\pgfspectra@CS@user\pgfspectra@CS@comp\relax% |
| 1275 |
\global\pgfspectra@datanotfoundfalse\relax% |
| 1276 |
\def\pgfspectra@elt@chemsym{#2}% set chemical symbol |
| 1277 |
\def\pgfspectra@elt@elemdata{#3}% set element lines data |
| 1278 |
\def\pgfspectra@elt@Imax@ALL{#4}% set element Imax: ALL range |
| 1279 |
\def\pgfspectra@elt@Imax@UV{#5}% set element Imax: UV range |
| 1280 |
\def\pgfspectra@elt@Imax@VIS{#6}% set element Imax: VIS range |
| 1281 |
\def\pgfspectra@elt@Imax@IR{#7}% set element Imax: IR range |
| 1282 |
\fi% |
| 1283 |
\fi% |
| 1284 |
}% |
| 1285 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1286 |
% NEW v2.2.0 |
| 1287 |
% \pgfspectra@setmaxin{UV or VIS or IR or ALL} -> OUTPUT: \pgfspectra@elt@Imax |
| 1288 |
\def\pgfspectra@setmaxint#1{\ignorespaces% |
| 1289 |
\edef\pgfspectra@qALL{all}\edef\pgfspectra@qO{0}\edef\pgfspectra@qI{1}\edef\pgfspectra@qII{2}\edef\pgfspectra@qIII{3}\edef\pgfspectra@qIV{4}% |
| 1290 |
\ifnum\pgfspectra@DATASET=0\relax% NIST |
| 1291 |
\ifx\pgfspectra@charge\pgfspectra@qO\relax% |
| 1292 |
\edef\pgfspectra@elt@Imax{\csname int#1qO\endcsname}% |
| 1293 |
\else\ifx\pgfspectra@charge\pgfspectra@qI\relax% |
| 1294 |
\edef\pgfspectra@elt@Imax{\csname int#1qI\endcsname}% |
| 1295 |
\else% |
| 1296 |
\edef\pgfspectra@elt@Imax{\csname int#1qALL\endcsname}% |
| 1297 |
\fi\fi% |
| 1298 |
\else% LSE |
| 1299 |
\ifx\pgfspectra@charge\pgfspectra@qO\relax% |
| 1300 |
\edef\pgfspectra@elt@Imax{\csname int#1qO\endcsname}% |
| 1301 |
\else\ifx\pgfspectra@charge\pgfspectra@qI\relax% |
| 1302 |
\edef\pgfspectra@elt@Imax{\csname int#1qI\endcsname}% |
| 1303 |
\else\ifx\pgfspectra@charge\pgfspectra@qII\relax% |
| 1304 |
\edef\pgfspectra@elt@Imax{\csname int#1qII\endcsname}% |
| 1305 |
\else\ifx\pgfspectra@charge\pgfspectra@qIII\relax% |
| 1306 |
\edef\pgfspectra@elt@Imax{\csname int#1qIII\endcsname}% |
| 1307 |
\else\ifx\pgfspectra@charge\pgfspectra@qIV\relax% |
| 1308 |
\edef\pgfspectra@elt@Imax{\csname int#1qIV\endcsname}% |
| 1309 |
\else% |
| 1310 |
\edef\pgfspectra@elt@Imax{\csname int#1qALL\endcsname}% |
| 1311 |
\fi\fi\fi\fi\fi% |
| 1312 |
\fi% |
| 1313 |
}% |
| 1314 |
% NEW v2.2.0 |
| 1315 |
%USAGE \expandafter\pgfspectra@getmaxint#1x#2x#3x#4x#5x#6x#7x#8\relax |
| 1316 |
\def\pgfspectra@getmaxint#1x#2x#3x#4x#5x#6x#7x#8\relax{% |
| 1317 |
\expandafter\edef\csname int#1qALL\endcsname{#2}% all charges |
| 1318 |
\expandafter\edef\csname int#1qO\endcsname{#3}% charge 0 (neutral atom) |
| 1319 |
\expandafter\edef\csname int#1qI\endcsname{#4}% charge +1 |
| 1320 |
\expandafter\edef\csname int#1qII\endcsname{#5}% charge +2 |
| 1321 |
\expandafter\edef\csname int#1qIII\endcsname{#6}% charge +3 |
| 1322 |
\expandafter\edef\csname int#1qIV\endcsname{#7}% charge +4 |
| 1323 |
%\expandafter\edef\csname int#1qU\endcsname{#8}% charge Unknown |
| 1324 |
}% |
| 1325 |
\endinput |